【#文档大全网# 导语】以下是®文档大全网的小编为您整理的《10进制转16进制》,欢迎阅读!
data segment
data ends
code segment
assume cs:code,ds:data
main proc far
start:
mov ax,data
mov ds,ax
call input
call output
mov ah,4ch
int 21h
main endp
input proc near
mov bx,0
mov ch,2h
newchar:
mov ah,1h
int 21h
sub al,30h
jl exit
cmp al,10d
jl addto
sub al,27h
cmp al,0ah
jl exit
cmp al,10h
jge exit
addto:
mov cl,4
shl bx,cl
mov ah,0
add bx,ax
dec ch
jnz newchar
exit:
ret
input endp
output proc near
mov bh,0h
cmp bl,64H
jc next
mov ax,bx
mov ch,64H
div ch
mov bl,ah
add al,30h
mov dl,al
mov ah,2h
int 21h
next: mov ch,10d
mov ax,bx
div ch
mov bl,ah
add al,30h
mov dl,al
mov ah,2h
int 21h
add bl,30h
mov dl,bl
mov ah,2h
int 21h
ret
output endp
code ends
end main
相关推荐
最新更新
热门阅读