Display results of an asm file

守給你的承諾、 提交于 2019-12-11 11:55:03

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!