News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

debug

Started by LouisStDubois, September 08, 2006, 11:08:25 PM

Previous topic - Next topic

LouisStDubois

Can anyone enlighten me on the debug function in DOS.  I've read in an old CS course that it has an assembler capability, at least for small programs.  I did a websearch on it and of course turned up all sorts of stuff on debugging programs.  It seems to be totally left out of the user manuals I have for PC and MSDOS.  It seems kinda mysterious.  Also, on a related issue, if anyone can provide me a link for the sixteen bit version of MASM I would greatly appreciate that.  I did a websearch on that one too and likewise turned up nothing useful.  Thanks  EWW

Tedd

To start debug, type "debug" :bg
Type "?" to get a list of commands (they're all one letter, followed by parameters as needed - most are optional)
To create a program type "A" and this will start the assembler with your code placed at CS:0100h. Enter instructions, one per line..
Press ctrl+c once to exit assemble mode.
Then type "G" to run the program you made.
"P" will step through the program (stopping after each instruction)

saving your program is an interesting exercise :lol
"W" allows you to save a chunk of memory to disk, but the data is written to disk sectors, not as a file.
Possibly your best bet is to use "D" to get a hex dump and then save a text listing of that (assuming you're not running natively in DOS.)

I don't have a reference for it, I just spent a few minutes playing with it, so there may be something I've missed. Check out the other commands to see what else you can do.
No snowflake in an avalanche feels responsible.

japheth

> "W" allows you to save a chunk of memory to disk, but the data is written to disk sectors, not as a file.

you can also write a file of course, but for that you will have to do

-N<name of the file>
-r cx
cx:<size of file>
-w



ninjarider

or if your really good you can save the data to the sector the file is located in.

i've been working in win 98se and xp pro. I usually open a command prompt and type debug. if you have an exe or com that you made that you wanting to work with you type debug [filename]. given that the file is in the working directory. or else debug [location & filename]. type a to begin the assembler. d [address] should give you a hex dump from that address. w Mem address, disk drive, sector, and some numner. dont know what the number is for. the disk drive is easy, 0 for your first floppy, usually 2 for c: and so on. l is to read information. l mem address, disk drive, sector, and some number. write and load will only write or read a sector at a time which is usually 512 bytes. use q to exit debug.

MichaelW

eschew obfuscation

sinsi

Quote from: japheth on September 09, 2006, 04:51:53 PM
> "W" allows you to save a chunk of memory to disk, but the data is written to disk sectors, not as a file.

you can also write a file of course, but for that you will have to do

-N<name of the file>
-r cx
cx:<size of file>
-w




Don't forget that <size of file> is actually a 32-bit number in BX:CX
Light travels faster than sound, that's why some people seem bright until you hear them.