Looping statement that works in Windows 7 debug instructions won't work in DOSBox 0.74

末鹿安然 提交于 2019-12-02 00:49:39
Michael Petch

Although your question isn't a duplicate of this other Stackoverflow question it seems to share certain similarities. Namely unexpected hangs or unusual behaviour. It would seem that DEBUG.EXE versions available for MS-DOS do not always function properly when run in DOSBox. This may be because DOSBox may not be 100% compatible emulating a real PC/Hardware(and DOS). This could result in some programs and/or OSes to not work as expected when used in DOSBox.

I have amended my previous Stackoverflow answer to suggest a variety of MS-DOS DEBUG.EXE programs may not work properly when run under DOSBox. Ross Ridge confirms he can duplicate your problem with DOS 6.22's debugger when run inside DOSBox.

There is a version of DEBUG.COM that was released by FreeDOS that seems to play well with DOSBox. I have made the FreeDOS version of DEBUG.COM available for download from my website. Alternatively you can download the ZIP File from Softpedia and extract DEBUG.COM.

AX is a volatile register for DOS-interrupt int 21h. So the content of AH=02h will be overwritten by INT 21h calls. The only source I could find to reference to is a document about Interrupt Services from the Mississippi State University which states on page one:

BIOS (and most DOS) ISRs Preserve Register Contents – Except ax

So in your code

int 21       ; alters AX
mov dl,bl    ; AH is undefined
inc dl       ; DL is increased correctly
loop 0107    

you falsely assume that AH would still contain the value of 02h. This is not (necessarily) the case.

So add a MOV AH, 02h before the loop statement and your program should execute less erroneous, because your INT 21h located at 0107 then would call the correct DOS-function 02h.

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