========================================== How to capture DEBUG output when using DOS ========================================== -IAN! idallen@ncf.ca This is a step-by-step explanation of the use of input and output redirection in DOS. You might find this useful when saving the output of DEBUG into a file (or files). * Suppose I want to capture the DEBUG output of dumping the boot sector. * * Here's what I would normally type into DOS and DEBUG, along with * the expected output: C:\> C:\> DEBUG -L 0 0 0 1 -D 0 L 20 2C4B:0000 EB 45 90 22 22 79 6F 3D-49 48 43 00 02 02 01 00 .E.""yo=IHC..... 2C4B:0010 02 F0 00 34 08 F0 04 00-0E 00 02 00 00 00 00 00 ...4............ -Q C:\> * I don't want this DEBUG output on my screen; I want it in a file, * so that I can have it for printing or incorporating into my * assignment when I reboot my computer and restart Windows. * * Just like Unix (from which it was copied), DOS supports input and * output redirection on command lines. So I type this output redirection: C:\> C:\> DEBUG >OUT * At this point, everything that would normally appear on my screen * is being sent into the file named OUT in the current directory. * (You can use any pathname to put the output anywhere you want.) * * Now, when I say *everything*, I mean *everything*. That means * anything I type won't echo on my screen, it's going to go directly * into the file OUT. So I can't see what I'm typing. I have to * type "blind" and hope I don't make any mistakes. So I type the * same three lines I typed above. They don't echo on my screen (I'm * typing blind, with no keyboard character echo at all): L 0 0 0 1 *** BLIND TYPING: this line does not echo on my screen *** D 0 L 20 *** BLIND TYPING: this line does not echo on my screen *** Q *** BLIND TYPING: this line does not echo on my screen *** C:\> * The moment I type Q and hit return, DEBUG exits, just as it did * above. I look in the output file to see the echo of what I typed, * along with the expected output from DEBUG: C:\> C:\> TYPE OUT -L 0 0 0 1 -D 0 L 20 2C4B:0000 EB 45 90 22 22 79 6F 3D-49 48 43 00 02 02 01 00 .E.""yo=IHC..... 2C4B:0010 02 F0 00 34 08 F0 04 00-0E 00 02 00 00 00 00 00 ...4............ -Q C:\> * I must have blind-typed the lines correctly - it looks correct. * * So that's one way to save output from DEBUG into a file; but, I don't * like the fact that I can't see what I'm typing. * * DOS also supports input redirection. That means I can prepare a file * containing my typed commands and feed that file as input to DEBUG. * * So I will prepare a text input file containing my three DEBUG command * lines. I use the DOS "EDIT" command to do this. EDIT supports the * arrow keys so that I can move around and edit text. When I want to * exit, I push ALT-F to bring up the File menu, and I use the arrow keys * (or I type x) to select "Exit". It asks me where to save the file, * and I type in a file name such as "INPUT". * * After creating the INPUT text file with EDIT, I type my input text * file on the screen to make sure it is correct: C:\> C:\> TYPE INPUT L 0 0 0 1 D 0 L 20 Q C:\> * Those are the three commands I want DEBUG to execute. * (Don't forget the Q (QUIT) command as the last line!) * * I first select only DOS input redirection, so that I can see the * output from DEBUG on my screen: C:\> C:\> DEBUG * DEBUG read my three commands from the file INPUT and displayed the * output on my screen - I didn't have to type anything. * * Since I'm happy with that output, I redo the same command but this * time add output redirection to save the output in a file called OUT: C:\> C:\> DEBUG OUT C:\> * No input was needed from me - it all came from the INPUT file. * No output is visible - it all went into the OUT file. * * I check the contents of the output file OUT: C:\> C:\> TYPE OUT -L 0 0 0 1 -D 0 L 20 2C4B:0000 EB 45 90 22 22 79 6F 3D-49 48 43 00 02 02 01 00 .E.""yo=IHC..... 2C4B:0010 02 F0 00 34 08 F0 04 00-0E 00 02 00 00 00 00 00 ...4............ -Q C:\> * That's correct. * * I repeat variations on this process until I have all the output files * I want for my assignment. For small commands, I type blind and * just redirect the output. For more complex things, I use EDIT to * prepare a list of commands that I want DEBUG to execute for me. * * You can see examples of this use of input and output redirection * on the Assembler page for DAT2343. I give both the INPUT files * that I used along with the annotated OUT files: http://www.algonquincollege.com/~alleni/dat2343/00f/assembler_programming.htm