深入探索MS - DOS文件输入输出服务
1. 标准MS - DOS文件输入输出服务基础
在MS - DOS环境下,文件的输入输出操作是编程中的重要部分。下面我们将介绍一些关键的程序和函数,帮助你更好地理解和运用这些服务。
首先是 ReadString 程序,它用于从键盘读取输入字符串,直到用户按下回车键。以下是其代码实现:
; Returns: AX = size of the input string
; Comments: Stops when the Enter key (0Dh) is pressed.
;--------------------------------------------------------
push cx
; save registers
push si
push cx
; save digit count again
mov si,dx
; point to input buffer
L1:
mov ah,1
; function: keyboard input
int 21h
; returns character in AL
cmp al,0Dh
; end of line?
je L2
; yes: exit
mov [si],al
; no: store the character
inc si
; increment buffer pointer
loop L1
; loop until CX=0
L2:
mov byte ptr [si],0
; end with a null byte
pop ax
超级会员免费看
订阅专栏 解锁全文
3

被折叠的 条评论
为什么被折叠?



