我的想法是将输入的一位十进制数然后将这个输入的ascii码减去30h,再依次和8,4,2,1比较,分别出是否大于等于8,4,2,1,然后决定是输出0还是1.初学,不怎么入门,请大家回答详细点,谢谢
请大家帮忙看看程序,谢谢了
code segment
assume cs:code,ds:data
start:mov ax,data
mov ds,ax
mov ah,08h
int 21h
sub al,30h
one1: cmp al,08h
jb zero1
mov dl,31h
mov ah,02h
int 21h
jmp one2
zero1:mov dl,30h
mov ah,02h
int 21h
one2: sub al,08h
cmp al,04h
jb zero2
mov dl,31h
mov ah,02h
int 21h
jmp one3
zero2:mov dl,30h
mov ah,02h
int 21h
one3: sub al,04h
cmp al,02h
jb zero3
mov dl,31h
mov ah,02h
int 21h
jmp one4
zero3:mov dl,30h
mov ah,02h
int 21h
one4: sub al,02h
cmp al,01h
jb zero4
mov dl,31h
mov ah,02h
int 21h
jmp stop
zero4:mov dl,30h
mov ah,02h
int 21h
stop: mov ah,4ch
int 21h
code ends
end start