Short and simple debug tutorial (or something..) ===================================================== If you don't know what debug is, or what to use it for, read this. otherwise skip it. ---------------------- Debug is a DOS program used for either debugging or coding assembly. We will use it primarily for debugging, but coding is quite simple too. It can disassemble code, and run through it instruction by instruction, showing the registers, which means that it's great for debugging. You can also use it for direct disk IO, but that's not explained here. That's because it uses DOS disk IO, not BIOS disk IO, which in english means that if the disk(ette) doesn't have a valid dos bootsector, you can't do IO. That requires BIOS IO. Another thing debug does, it to show the machine code for every instruction too, which can be handy for example when your assembler is to "smart" and tries to optimize your code, which must not be changed. Then check the machine code for your instruction with debug, and "db xxxh" in your code. At least I've needed that a couple of times. Blah, this intro became to long already... i'll stop here :) ---------------------- First, make a program with an assembler, and do: C:\>debug prog.com (note; can be .exe too) You will now have the - prompt. the ? command will give you a helpscreen .. but its not always as easy to understand all of that. 'q' will quit, by the way. :) Here's an explanation of the commands.. if you read this as a tutorial, start from the top. ----- List: U ----- You will now see the first 16 lines in your program disassembled. To list more, type 'u' again. You can specify what offset to start listing from by doing for example 'u 123', where 123 is the offset. You can also specify both segment and offset: 'u 1234:100' . ----- Register: R ----- The command 'r' will show the current registers, and the next instruction. If you specify a register like 'r AX', you can change the value of that register. ----- Trace: T ----- type 't' to execute one instruction. It will execute the instruction, and show the registers, and the next instruction. ----- Proceed: P ----- This command will execute the next instruction as T does, but if that instruction for example is an int call, the int will execute, and you will be back at the next instruction, instead of tracing the interrupt code (which could be fun too;) ). To proceed over several commands, give a parameter, number of commands to proceed over. 'p 3' will proceed over 3 instructions. ----------------- The 4 commands you now have will be enough for basic debugging. ----------------- ----- Assemble: A ----- You can code assembly with debug :) type 'a' and then you can code. To code at a specific place, specify offset only, or segmet:offset after a, with the same syntax as with the command 'u'. ==================================================================== Thats it. simply because this is all I know ;) But when you know this, you can find out more yourself.. debug is a great tool! :) --- by Loonix http://loonix.technigga.net solvesle at gmail com