一个朋友写的操作系统源码

源代码在线查看: rdconfig.asm

软件大小: 2890 K
上传用户: Rebecca_SYF
关键词: 操作系统 源码
下载地址: 免注册下载 普通下载 VIP

相关代码

				sseg segment stack
				
				     db 128 dup (0)
				
				sseg ends
				
				dseg segment para public 'global'
				
				     extrn parambuf:byte
				     extrn paramnr:word
				     configpath db 'config.txt',0  ; file name to be open
				
				dseg ends
				
				cseg segment para public 'code'
				
				     assume cs:cseg,ds:dseg,ss:sseg
				
				     public rdconfig
				
				     rdconfig proc near
				
				     push ds  ; save caller's segment
				     push es
				     push bp  ; make stack frame
				     mov bp,sp
				
				     mov ax,3d00h  ; read only open file         
				     mov dx,offset configpath
				     int 21h
				     jnc suc
				     ; don't clear carry if error detected
				     mov sp,bp
				     pop bp  ; restore stack frame
				     pop es
				     pop ds
				     ret     ; leave error code in ax
				
				suc:
				     mov bx,ax    ;we will read the config file
				     xor ax,ax
				     mov ah,3fh
				     mov dx,offset parambuf
				     mov cx,1024
				     int 21h
				     jnc suc1
				     mov sp,bp
				     pop bp
				     pop es
				     pop ds
				     ret
				suc1:
				     mov [paramnr],ax   ; indicate how many byte we read from config file
				     clc                ; guaratee no error
				     mov sp,bp
				     pop bp
				     pop es
				     pop ds
				     ret
				
				     rdconfig endp
				
				cseg ends
				
				end
				
							

相关资源