data segment
buf db ‘THE ASCII CODE OF[‘,’$’
buf1 db ‘] IS ‘,’$’
buf2 db 13,10,’$’
data ends
code segment
assume cs:code,ds:data
main:mov ax,data
mov ds,ax
lea dx,[buf]
mov ah,9;输入提示
int 21h
mov ah,1;输入
int 21h
mov ah,0
mov bl,10h
div bl
mov bx,ax
cmp bl,9
jb lxiao;bl小于
sub bl,9
add bl,40h
cmp bh,9
jb hxiao
hdayu:sub bh,9 ;bh大于
add bh,40h
jmp lab
lxiao:add bl,30h
cmp bh,9
ja hdayu
hxiao:add bh,30h
lab:lea dx,[buf1]
mov ah,9
int 21h
mov ah,2
mov dl,bl
int 21h
mov dl,bh
int 21h
mov dl,’H’
int 21h
mov ax,4c00h
int 21hcode ends
end main
汇编 输入一个数,输出相应的ASCII值(带效果图)
- THE END -
Category: 汇编
0 条评论。