尽管您将值写入十进制,但汇编器 (FASM) 将它们转换为“计算机”格式,即二进制。要获得十进制输出,您必须将结果转换为“输出”格式,即 ASCII。该方法在书籍和网络上得到了广泛的描述。这是您需要的示例(FASM、MSDOS、.com):
format binary as "com"
use16
org 100h
mov al, 10 ; bin: 00001010b
mov bl, 5 ; bin: 00000101b
add bl, al
sub bl, 1
movzx ax, bl
call AX_to_DEC
mov dx, DECIMAL
mov ah, 9
int 21h
;mov ah, 0
;int 16h
ret
DECIMAL DB "00000$" ; place to hold the decimal number
AX_to_DEC:
mov bx, 10 ; divisor
xor cx, cx ; CX=0 (number of digits)
First_Loop:
xor dx, dx ; Attention: DIV applies also DX!
div bx ; DX:AX / BX = AX remainder: DX
push dx ; LIFO
inc cl ; increment number of digits
test ax, ax ; AX = 0?
jnz First_Loop ; no: once more
mov di, DECIMAL ; target string DECIMAL
Second_Loop:
pop ax ; get back pushed digit
or al, 00110000b ; AL to ASCII
mov [di], al ; save AL
inc di ; DI points to next character in string DECIMAL
loop Second_Loop ; until there are no digits left
mov byte [di], '$' ; End-of-string delimiter for INT 21 / FN 09h
ret