weinan030416

导航

按键盘指定字母跳转输出

data segment ;数据段
    str1 db 'Yes!$'
    str2 db 'No!$'
data ends

code segment ;代码段
assume cs:code,ds:data
start:
    jmp get
get: 
    mov ah,1
    int 21h
    cmp al,'y'
    je yes
    cmp al,'n'
    je no
    jne get
yes:
    mov ax,data ;获取段基址
    mov ds,ax ;将段基址送入寄存器
    mov dx,offset str1
    mov ah,9
    int 21h
    mov ah,4ch
    int 21h
no:
    mov ax,data ;获取段基址
    mov ds,ax ;将段基址送入寄存器
    mov dx,offset str2
    mov ah,9
    int 21h
    mov ah,4ch
    int 21h
code ends
end start

mov ah,1  字符输入

mov ah,9  字符串输出

posted on 2023-01-26 17:21  楠030416  阅读(34)  评论(0编辑  收藏  举报