DOSBox: debug.exe reads file - processes commands

2019-03-05 18:21发布

问题:

I'm trying to use DOSBox with debug.exe on a 64-bit system. It works perfectly fine if I enter the commands manually. When I redirect input from a file with:

debug < [file]

it doesn't work. On every line except for the first it displays an error similar to this:

DOSBox will eventually hang and crash. Is there any way to fix this?

The input file I am trying to process as commands is:

a 100
jmp 145
db 'Hello, World!', 0D, 0A, 'Press any key to continue . . .$'

a 145
mov ah, 09
mov dx, 102
int 21
mov ah, 08
int 21
int 20

rcx
100
n hello.com
w
q

回答1:

I can reproduce the behavior you are seeing in this scenario:

  • DOSBox 0.74 on Windows and Linux
  • DEBUG.EXE from Windows XP copied to DOSBox
  • DEBUG.EXE from various versions of MS-DOS will cause problem including unexpected hangs. See this Stackoverflow question for another related problem.

I found a version of DEBUG.COM from FreeDOS that works as expected. I have made DEBUG.COM available for download from my website. Alternatively you can download the ZIP File from Softpedia and extract DEBUG.COM.

When I run DEBUG.COM I get this:

S:\>debug.com <hello.asm
-a 100
0BFB:0100 jmp 145
0BFB:0102 db 'Hello, World!', 0D, 0A, 'Press any key to continue . . .$'
0BFB:0131
-a 145
0BFB:0145 mov ah, 09
0BFB:0147 mov dx, 102
0BFB:014A int 21
0BFB:014C mov ah, 08
0BFB:014E int 21
0BFB:0150 int 20
0BFB:0152
-rcx
CX 0000
:100
-n hello.com
-w
Writing 00100 bytes
-q

S:\>hello
Hello, World!


回答2:

Had same problem in DosBox 0.74 with DEBUG.EXE script redirection. Discovered that it could be fixed by changing the end-of-line characters in the script file from [CR][LF] to just [CR] when redirecting into DEBUG.EXE.

Pasting your file into the Scite editor and viewing the line-end characters showed this:

a 100{CR][LF] jmp 145[CR][LF].... et cetera

I used an option in Scite to change the EOL characters to [CR] alone, getting

a 100{CR] jmp 145[CR].... et cetera

saved the file, and was able to redirect it into DEBUG.EXE with no problem. Not sure why [CR][LF] causes the issue with DEBUG.EXE, but hope this helps.

DEBUG.COM handles either EOL sequence with no glitch, so makes sense to use it instead, especially with its extended features. But one can use DEBUG.EXE it seems, with this fix, FWIW. The Scite editor is a neat tool.

share|improve this answer
0

I found the same problem running a script file for Debug within Dosbox. but I found another editor: Notepad2. runs great and small and changes color to highlight assembler words. Had to use debug ver 1.25 though.

share|improve this answer
0

Than you Michael Petch. I was trying everything to get the output of FreeDos clone of MS-DEBUG to save into a text file. But it was not the path, the speed, or the memory allotment that was blocking the redirection of output. It was indeed the line feed and cursor return combination. I quickly wrote a program to take out cursor return and leave line feed. It now redirects! I can also take out the line feed and leave the cursor returns, and DEBUG redirects to file as well. The small glitch is I have to access Windows outside the or close the DosBox window, for the outputted DEBUG code to become visible in a directory listing.

This is how I redirect DEBUG output to a file:

DEBUG < game.dbg > game.lst

share|improve this answer

Your Answer

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged assembly dosbox x86-16 or ask your own question.

收藏的人(0)

Ta的文章 更多文章
登录 后发表评论
0条评论
还没有人评论过~