Ms-Dos Debug

Status
Not open for further replies.

oSpIkEo

Seniorius Lurkius
33
Hi, i was wondering what the debug command was used for in dos?

does it have anything to do with the cpu's registers?

i was reading up on something and it had this

The CPU has 4 internal registers, each one of 16 bits.

AX Accumulator
BX Base register
CX Counting register
DX Data register
DS Data Segment register
ES Extra Segment register
SS Battery segment register
CS Code Segment register
BP Base Pointers register
SI Source Index register
DI Destiny Index register
SP Battery pointer register
IP Next Instruction Pointer register
F Flag register

is the debug mainly display the active proccess of the cpu?
or whats its main function?

thanks
 

bugbum1

Ars Scholae Palatinae
893
sry, posted too soon.

list-o-debug commands:
Code:
 -?
assemble     A [address]
compare      C range address
dump         D [range]
enter        E address [list]
fill         F range list
go           G [=address] [addresses]
hex          H value1 value2
input        I port
load         L [address] [drive] [firstsector] [number]
move         M range address
name         N [pathname] [arglist]
output       O port byte
proceed      P [=address] [number]
quit         Q
register     R [register]
search       S range list
trace        T [=address] [value]
unassemble   U [range]
write        W [address] [drive] [firstsector] [number]
allocate expanded memory        XA [#pages]
deallocate expanded memory      XD [handle]
map expanded memory pages       XM [Lpage] [Ppage] [handle]
display expanded memory status  XS
-

if you want to write hand assembly, use the A command, presss return on a blank line to quit. change the IP (instruction pointer) to the beginning address you started assemblying at, and T (trace) thru the code. notice the registers changing as your code executes.

a secret - you can become guru this way quickly ;)
 

bugbum1

Ars Scholae Palatinae
893
a quick program into memory to get you going

Code:
-A
0ADC:0100 MOV AX, 1
0ADC:0103 ADD ax, 5
0ADC:0106 XOR AX,AX
0ADC:0108
-rip
IP 0100

-T

AX=0001  BX=0000  CX=0000  DX=0000  SP=FFEE  BP=0000  SI=0000  DI=0000
DS=0ADC  ES=0ADC  SS=0ADC  CS=0ADC  IP=0103   NV UP EI PL NZ NA PO NC
0ADC:0103 050500        ADD     AX,0005
-T

AX=0006  BX=0000  CX=0000  DX=0000  SP=FFEE  BP=0000  SI=0000  DI=0000
DS=0ADC  ES=0ADC  SS=0ADC  CS=0ADC  IP=0106   NV UP EI PL NZ NA PE NC
0ADC:0106 31C0          XOR     AX,AX
-T

AX=0000  BX=0000  CX=0000  DX=0000  SP=FFEE  BP=0000  SI=0000  DI=0000
DS=0ADC  ES=0ADC  SS=0ADC  CS=0ADC  IP=0108   NV UP EI PL ZR NA PE NC
0ADC:0108 037518        ADD     SI,[DI+18]                         DS:0018=0101
-

from the earlier post, r + register name allows you to examine/change registers (i'm checking the instruction pointer IP is set to the beginning of the assembly code w/ rip command. the display shows 100 org (origin), so everything is peachy to trace (single step execute) the first assembly command.
 

jaem

Ars Scholae Palatinae
1,023
It had almost the same use as edlin and link: crippled apps with no use. Technically you could assemble, disassemble, execute, load from the disk (either file of sector but no more than 64k) and dump memory. OK a little more useful, but not by much. Apparently still runs on 16bit segmented mode.
[edited: I forgot to say you could supposedly debug 16bit programs]
 
Okay, now you got my curiosity up, jaem.

I just looked up two commands:

link - apparently, a linker for .obj files. However, there wasn't any way to produce .obj files with just DOS (AFAIK). It doesn't seem like DEBUG could do this... I'm pretty sure that I had to use MS Macro Assembler back in the day to generate proper .obj files.

exe2bin - I now remember using this one or twice for amusement. It converted an .exe file to a .com file. This is a performance hack that seems ludicrous now. Imagine if the multiple segmented model of the .exe file was really slowing you down! :)

On the other hand, I remember using pklite 10 years ago to compress .exe files to save valuable hard drive space on a 286 with 20 megs of hard drive space. What a waste of time.
 
Status
Not open for further replies.