所以我写了一个小程序,把一个大于 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