利用DOS的OAH功能从键盘输入一串字符,并将此
字符串在显示屏上显示出来。
;-------------------------------------
DATA SEGMENT
STRING1 DB 'Press any keys please: ', 10, 13, 24H
STRING2 DB 13, 10, 'The string is: ', 10, 13, 24H
BUF1 DB 100
DB ?
DB 100 DUP(?)
DATA ENDS
;-------------------------------------
CODE SEGMENT
ASSUME CS:CODE, DS:DATA, ES:DATA
START:
MOV AX, DATA
MOV DS, AX
L:
MOV AH, 09H ;输入提示
LEA DX, STRING1
INT 21H
MOV AH, 0AH
LEA DX, BUF1 ;键盘输入到缓存区
INT 21H
;------------------------------
MOV AH, 09H ;输入提示
LEA DX, STRING2
INT 21H
LEA SI, BUF1 ;键盘输入缓存区
INC SI
MOV CL, [SI] ;取出实际输入个数
MOV CH, 0
INC SI
L3:
MOV AH, 02H ; 显示
MOV DL, [SI]
INT 21H
INC SI
LOOP L3
;------------------------------
EXIT:
MOV AH, 4CH
INT 21H
CODE ENDS
END START
;-------------------------------------