问题
I'm trying to assemble the following program with Tasm on Windows 7 64bit:
.model small
.stack 100h
.data
a db 09H
b db 02H
.code
start:
mov ax, @data
mov ds, ax
mov al, a
mov bl, b
add al, bl
mov ah, 4CH
int 21H
end start
filename is prog4.asm
I did follow these steps:
tasm prog4.asm
tlink prog4.obj
prog4
I am able to run this on the EMU8086 simulator, however i'm not able to see the execution of the commands on DOSBOX.
How can I display the register values after the addition command?
回答1:
You basically have to write some code which will take al
and output it to the screen character by character.
This can be done by pushing ax, dividing it by 100, then adding 48 (ascii for '0'). Then copy that to dl and use int 21/ah=2 to output it. That does the 100s digit.
Similarly for the 10s digit and 1s digit though you'll need to use modulo as well to get rid of the higher places.
If you want to know all the available interrupts, see the ralf brown's interrupt list, a truly awesome reference for this sort of stuff.
来源:https://stackoverflow.com/questions/13050433/display-results-of-an-asm-file