10进制转16进制

时间:2022-08-15 03:26:34 阅读: 最新文章 文档下载
说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

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

本文来源:https://www.wddqw.com/doc/4bcc2179f705cc17552709a6.html