请求编写一段程序

来源:百度知道 编辑:UC知道 时间:2024/05/13 07:57:13
请用汇编语言编写程序当键盘按下1,在屏幕上显示YES
当键盘按下2,在屏幕上显示NO。

急需!谢谢了!

data segment
msg1 db 'YES$'
msg2 db 'NO$'
data ends

code segment
assume cs:code,ds:data
start:
mov ax,data
mov ds,ax

mov ah,01h
int 21h
cmp al,'1'
je m1
cmp al,'2'
je m2
jmp exit
m1:
call crlf
mov dx,offset msg1
mov ah,09h
int 21h
jmp exit
m2:
call crlf
mov dx,offset msg2
mov ah,09h
int 21h
exit:
mov ah,4ch
int 21h

crlf proc near;回车换行子程序
mov dl,0dh
mov ah,02h
int 21h
mov dl,0ah
mov ah,02h
int 21h
ret
crlf endp

code ends
end start