我无法在寄存器中显示大量数字

时间:2018-11-07 22:17:46

标签: assembly masm masm32 emu8086

我正在编写一个非常简单的程序,在该程序中,我将数字移动到al寄存器并使用ah,02 int 21显示出来,它正常工作到15 num,但是当我将16和更大的num添加到al时它不起作用,请我是新来的帮助我!这是代码

.model small
.stack 100h
.data

    msg db 10,9,'hello ,the number is ;$'

.code

main proc       ; main procedure
mov ax, @data   ; pointing to ds
mov ds, ax      ; intializing data segment

mov al, 16      ; moving integer to al register ,if the int is <=15 work fine
mov ah, 0       ; making ah=0   ,ah=al
aaa             ; adjust after addition

add ah, 30h     ; convert the int to ascii
add al, 30h     ; convert to the  ascii
mov bx, ax      ; moving ax to bx register
mov ah, 02      ; input mod
mov dl, bh      ; moving high order bit to dl for displaying
int 21h         ; dos interrupt

mov ah, 02h     ; input mod
mov dl, bl      ; moving low order bit to dl displaying
int 21h         ; dos interrupt

mov ah, 4ch     ; quite from the prog
int 21h         ; dos interrupt`

main endp
end main

0 个答案:

没有答案