Search code examples
assemblyx86dosx86-16dosbox

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


We had an activity about looping in assembly language. Our task is simple: display the numbers 0 to 9 with spaces in-between each number. I got the code to work in the command prompt using the 'debug' command in WINDOWS 7 in our school. My laptop is Windows 10 and I recently found out that there's no 'debug' command in the command prompt. So I tried writing my code in DOSBox 0.74 (latest, maybe). Every time i run it in DOSBox, the programs suddenly hangs up and then crashes. Here's the code

mov cx,0a
mov ah,02
mov dl,30
int 21
mov bl,dl
mov dl,20
int 21
mov dl,bl
inc dl
loop 0107
int 20

Can someone please explain me why DOSBox crashes?

Here is a sample pic of the working program which runs in cmd on Windows 7:

enter image description here


Solution

  • 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.