📄 2.asm
字号:
stack segment stack 'stack'
dw 32 dup(?)
stack ends
data segment
DecIn db 6,0,6 dup(?)
HexOut db 4 dup(?),'$'
data ends
code segment
begin proc far
assume ss:stack,cs:code,ds:data
push ds
sub ax,ax
push ax
mov ax,data
mov ds,ax
mov dx,offset DecIn
mov ah,10
int 21H
mov ch,0
mov cl,DecIn[1]
mov SI,offset DecIn + 2
mov ax,0
AGAIN:
mov bx,10
mul bx
mov dl,[SI]
sub dl,030H
add ax,dx
INC SI
loop AGAIN
mov SI,0
mov bl,ah
and bl,0F0H
mov cl,4
shr bl,cl
CALL CHANGE
mov HexOut[SI],bh
INC SI
mov bl,ah
and bl,00FH
CALL CHANGE
mov HexOut[SI],bh
INC SI
mov bl,al
and bl,0F0H
mov cl,4
shr bl,cl
CALL CHANGE
mov HexOut[SI],bh
INC SI
mov bl,al
and bl,00FH
CALL CHANGE
mov HexOut[SI],bh
mov dl,'='
mov ah,2
int 21H
mov dx,offset HexOut
mov bx,word ptr HexOut
CMP bx,03030H
JNZ ZERO
add dx,2
ZERO:
mov ah,9
int 21H
ret
begin endp
CHANGE PROC
CMP bl,0AH
JB NUMBER
add bl,7
NUMBER:
add bl,030H
mov bh,bl
ret
CHANGE ENDP
code ends
end begin
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -