匯編:將四位十進(jìn)制數(shù)轉(zhuǎn)化為十六進(jìn)制數(shù)
mov ax,0
sub bl,30h
mov al,bl ;ax被乘100
mul si
mul si
add jichun,ax
mov ax,0
sub ch,30h
mov al,ch
mul si ;ax乘10
add jichun,ax
mov ax,0
sub cl,30h
mov al,cl
add jichun,ax ;徹底轉(zhuǎn)化為十進(jìn)制數(shù)
mov ax,jichun ; ax中為9999轉(zhuǎn)化為16進(jìn)制數(shù)270f
;over;;;;;;;;;;;;;;;;;;;;;;;;
mov dx,0;初始化
mov di,0;指針為0
mov bx,0010h
quyu:
div bx ;默認(rèn) ax
mov yushu[di],dl
inc di
mov dx,0
cmp ax,10h
jae quyu
mov yushu[di],al
inc di
mov cx,di
dec di
shuchu:
mov dl,yushu[di]
dec di
cmp dl,0ah
jnae l2
add dl,37h
mov ah,02h
int 21h
jmp jiedian
l2: add dl,30h
mov ah,02h
int 21h
jiedian:
loop shuchu
tishi:
lea dx,kongzi;控制換行回車
mov ah,09h
int 21h
lea dx,tital3;輸出抬頭3
mov ah,09h
int 21h
mov ah,01h ;判斷是否繼續(xù)
int 21h
cmp al,y
je retry
lea dx,kongzi;控制換行回車
mov ah,09h
int 21h
lea dx,tital4
mov ah,09h
int 21h本文引用地址:http://m.butianyuan.cn/article/201612/324133.htm
over: ;結(jié)束
mov ah,4ch
int 21h
code ends
end start
評論