【发布时间】:2013-02-27 04:58:45
【问题描述】:
所以我编写了一个小程序来将大于 9 的数字写入屏幕。但是,一旦我将一个值压入堆栈,直到堆栈为空,我才能打印任何东西。有没有办法解决这个问题?
代码如下:
print_int: ; Breaks number in ax register to print it
mov cx, 10
mov bx, 0
break_num_to_pics:
cmp ax, 0
je print_all_pics
div cx
push dx
inc bx
jmp break_num_to_pics
print_all_pics:
cmp bx, 0 ; tests if bx is already null
je f_end
pop ax
add ax, 30h
call print_char
dec bx
jmp print_all_pics
print_char: ; Function to print single character to screen
mov ah, 0eh ; Prepare registers to print the character
int 10h ; Call BIOS interrupt
ret
f_end: ; Return back upon function completion
ret
【问题讨论】:
标签: assembly printing x86 stack x86-16