DEBUG OVERVIEW

In this section there will be presented at first a complete overview of debug syntaxis, since there are a few good texts available on the net about debug, but the bare presentation of syntaxis is in those texts often not complete or unclear. And since the company that designed debug also putted very bare online documentation as a response on "?" you are prone to unneccesary and off_topic frustrations here. It is only after the syntax overview that i will outline some of the major usages of debug for beginners (or for small programs as you wish). Since you might know what exactly is the command that you want information about i list them all here with links to to the syntax part [S] and with a link to the example part [E].

Note: Before turning to the actual syntaxi i have to make a note however. I have used all the commands with absolute values for start and end. Although you COULD have specified also start and length( which as far as i can see offers EXACTLY the same functionality), i did not included the syntaxi for the start/length variants. Since i could not see any addition in the use of the L parameter it is considered unnecessary and unnecessary blurring up the overview picture.
Assemble [S][E], Compare [S][E], Dump [S][E], Enter [S][E], Fill [S][E], Go [S][E], Hexarithmic [S][E], Input [S][E], Load [S][E], Move [S][E], Name [S][E], Output [S][E], Proceed [S][E], Quit [S][E], Register [S][E], Search [S][E], Trace [S][E], Unassemble [S][E], Write [S][E], Expanded mem reserve [S][E], Expanded mem release [S][E], Expanded mem assign [S][E], Expanded mem display status [S][E]

DEBUG SYNTAXIS OVERVIEW

A (ASSEMBLE)

.Main syntax:

 A [[segment:] offset] 
.Variants:

 1. A segment:offset  

Example: A 1234:1000
Description: Assemble at 1234:1000
Output/ prompt: 1234:1003 -

 2. A offset  

Example: A 1100
Description:Assemble at CS:1100
Output/ prompt: [CS]:1100

 3. A 

Example: A
Description:Assemble at CS:IP
Output/ prompt: [CS]:[IP]


C (COMPARE)

.Main syntax:

 C [segment1:] offset1 endoffset1 [segment2:] offset2 
(Segment boundery crossing is not possible so the end point can only be a near pointer, segment1:endoffset1)

.Variants:

 1. C segment1:offset1 endoffset1 segment2:offset2 

Example:C 1234:1000 1FFF 3456:2000
Description: Compare 1234:1000 until 1234:1FFF with 3456:2000 until
3456:2FFF
Output/ prompt: 1234:1000 45 35 3456:2000
.........................
1234:2FFF 00 13 3456:2FFF
-

 2. C segment1:offset1 endoffset1 offset2 

Example: C ES:100 10A 200C
Description: Compare ES:100 until ES:10A with DS:200C until DS:2017
Output/ prompt: [ES]:0100 93 21 [DS]:200C
.........................
[ES]:010A 13 13 [DS]:2018
-

 3. C offset1 endoffset1 segment2:offset2 

Example:C 200 20B 3456:200C
Description:Compare DS:200 until DS:20B with 3456:200C until 3456:2018
Output/ prompt: [DS]:020B 69 70 3456:200C
.........................
[DS]:020B 20 13 3456:2018
-

 4. C offset1 endoffset1 offset2 

Example:C 100 11B 0C
Description:Compare DS:100 until DS:11B with DS:20C until DS:227
Output/ prompt: [DS]:0100 84 45 [DS]:020C
.........................
[DS]:011B 10 13 [DS]:0227
-


D (DUMP)

.Main syntax:

 D [[[segment]:startoffset] endoffset] 
(Segment boundery crossing is not possible so the end point can only be a near pointer, segment: endoffset)

. Variants:

 1. D segment:startoffset endoffset 

Example: D DS:1000 1FFF
Description:Dump from DS:1000 until DS:1FFF
Output/ prompt: [DS]:1000 33 CO 45 65 67 78 45 67 78 .........
..............................................
[DS]:1FFF 43 56 D0 C9 F5 E3 21 33 ............
-

 2. D startoffset endoffset 

Example: D 100 300
Description: Dump from CS:100 until CS:300
Output/ prompt: [CS]:0100 33 CO 45 65 67 78 45 67 78 .........
..............................................
[CS]:0300 43 56 D0 C9 F5 E3 21 33 9...........
-

 3. D startoffset 

Example: D EFE0
Description: Dump 8*16 bytes at CS:EFE0
Output/ prompt: [CS]:EFE0 33 CO 45 65 67 78 45 67 78 .........
..............................................
[CS]:F050 43 56 D0 C9 F5 E3 21 33 69..........
-

 4. D 

Example: D
Description: Dump 8*16 bytes at CS:IP
Output/ prompt: [CS]:[IP] 33 CO 45 65 67 78 45 67 78 .........
... ..........................................
[CS]:[IP+80] 43 56 D0 C9 F5 E3 21 33 69.......
-


E (ENTER)

.Main syntax:

 E [[segment]:startoff] enterdata 

.Variants:

 1. E segment:offset enterdata 

Example:E CS:1000 12 10 'test' 1F FF
Description:Enter the bytesequence &h12 &h10 'test' &h1F &hFF at CS:1000
Output/ prompt: -

 2. E offset enterdata 

Example: E 100 13 'test' 10
Description:Enter the bytesequence 'test' &h13 at DS:0100
Output/ prompt: -

 3. E segment:offset 

Example: E CS:34
Description:Let you enter bytes at CS:0034
Output/ prompt: [CS]:0034 -

 4. E offset  

Example: E 300
Description: Let you enter bytes at DS:300
Output/ prompt: [DS]:0300 -


F (FILL)

.Main syntax:

 F [[[segment]:startoffset] endoffset] filldata 
(Segment boundery crossing is not possible so the end point can only be a near pointer, segment: endoffset)

. Variants:

 1. F segment:startoffset endoffset filldata 

Example: F CS:1000 2000 12 10 'test' 1F FF
Description: Fill CS:1000 with the (repeated) bytesequence &h12 &h10 'test' &h1F &hFF
Output/ prompt: -

 2. F startoffset endoffset filldata  

Example: F 100 200 'test' 10
Description:Fill DS:100 until DS:200 with the (repeated) bytesequence &h13 test
Output/ prompt: -

 3. F startoffset filldata 

Example: F 300 'test' 34
Description: Fill DS:300 with the bytesequence 'test' &h34 ( crf: enter)
Output/ prompt: -

F without specification is not possible as is not F with only adress specification( unlike enter).
So F and F 100 and F 100 200 will return error.


G (GO)

.Main syntax:

 G [[[=startsegment:] startoffset] [breaksegment:] breakoffset]]] 

.Variants:

 1. G =startsegment:startoffset breaksegment:breakoffset 

Example: G=156E:100 156D:100
Description:Start execution at 156E:100 set a breakpoint at 156D:100
Output/ prompt: AX=0000 BX=0000 CX=0446 DX=0000 SP=FFFE BP=0000 SI=0000..
DS=6897 ES=6897 SS=6897 CS=6897 IP=0100 NV UP DI PL NZ..
[156D]:0100 MOV AH,4C
-

 2. G =startoffset breaksegment:breakoffset  

Example: G=100 DS:100 ES:200
Description:Start execution at CS:100 set a breakpoint at DS:100 and
ES:200
Output/ prompt: AX=0000 BX=0000 CX=0446 DX=0000 SP=FFFE BP=0000 SI=0000..
DS=6897 ES=6897 SS=6897 CS=6897 IP=0100 NV UP DI PL NZ ..
[ES]:0200 MOV AH,4C
-

 3. G breaksegment:breakoffset 

Example: G DS:100 ES:200
Description:Start execution at CS:IP set a breakpoint at DS:100 and
ES:200
Output/ prompt: AX=0000 BX=0000 CX=0446 DX=0000 SP=FFFE BP=0000 SI=0000..
DS=6897 ES=6897 SS=6897 CS=6897 IP=0100 NV UP DI PL NZ..
[ES]:0200 MOV AH,4C
-

 4. G =startsegment:startoffset 

Example: G=1234:F100
Description:Start execution at 1234:F100 and go until termination of
code
Output/ prompt: Program termination normally
-

 5. G =startoffset  

Example: G=100
Description:Start execution at CS:100 and go until termination of code
Output/ prompt: Program termination normally
-

 6. G  

Example: G
Description:Start execution at CS:IP and go until termination of code
Output/ prompt: Program termination normally
-

Up to ten breakpoints can be set. For the breakpoints segment overrides can be set( do not forget however that the actual segmentsvalues on runtime are swapped in here(when DS is changed before you reach the breakpoint set by DS:100 then this might give you less desirable effects(look at the examples below)).


H (HEXADECIMAL MATH)

.Main syntax:

 H hexnr1( word) hexnr2( word) 

.Variants:

 1. H hexnr1  hexnr2 

Example: H 1234 1000
Description: Returns both addition and substraction of 1234 and 1000
Output/ prompt: 2234 0234
-


I (INPUT PORT)

.Main syntax:

 I portnr 

.Variants:

 1. I portnr 

Example: I 60
Description:Displays current contents of the keyboard port( &h60)
Output/ prompt: 1C
-


L (LOAD)

.Main syntax:

 L [[startsegment:]startoffset] [station startsector nrsectors] 

.Variants:

 1. L startsegment:startoffset station startsector nrsector 

Example: L 156E:100 0 0 1
Description:Load sector 0 of station A into 156E:100
Output/ prompt: -

 2. L startoffset station startsector nrsector 

Example: L 100 2 0 2
Description:Load sector 0 to 2 of station C into CS:100
Output/ prompt: -

 3. L startsegment:startoffset 

Example: L 156E:100
Description:Loads the last named file into 156E:100with segment registers ready for execution, BX:CX set to filelength, commandline parameters in PSP:&h80 ( cref: name)
Output/ prompt: -

 4. L startsegment:startoffset 

Example: L 156E:100
Description:Loads the last named file into 156E:100 with segment registers ready for execution, BX:CX set to filelength, commandline parameters in PSP:&h80 ( cref: name)
Output/ prompt: -

 5. L startoffset 

Example: L 100
Description:Loads the last named file into CS:100 with segment registers ready for execution, BX:CX set to filelength, commandline parameters in PSP:&h80 ( cref: name)
Output/ prompt: -

 6. L  

Example: L
Description:Loads the last named file into CS:IP with segment registers ready for execution, BX:CX set to filelength, commandline parameters in PSP:&h80 ( cref: name)
Output/ prompt: -


M (MOVE)

.Main syntax:

 M [segment1:] offset1 [endoffset] [segment2:] offset2 
(Segment boundery crossing is not possible so the end point can only be a near pointer, segment1:endoffset)

.Variants:

 1. M  segment1:offset1 endoffset segment2:offset2 

Example: M DS:1000 1FFF 1234:2000
Description:Move the bytes from DS:1000 until DS:1FFF to 1234:2000
Output/ prompt: -

 2. M  segment1:offset1 endoffset offset2  

Example: M 1234:0100 0200 0300
Description:Move the bytes from 1234:0100 until DS:0200 to DS:0300
Output/ prompt: -

 3. M  offset1 endoffset segment2:offset2 

Example: M 100 200 ES:100
Description:Move the bytes from DS:100 until DS:200 to ES:0100
Output/ prompt: -

 4. M offset1 endoffset  offset2 

Example: M 200 300 1100
Description:Move the bytes from DS:100 until DS:200 to DS:1100
Output/ prompt: -


N (NAME)

.Main syntax:

 N filename 

.Variants:

 1. N filename 

Example: N tempo.com
Description:Specifies a file with the name tempo.com for later write or load operations( crf: write / load)
Output/ prompt: -


O (OUTPUT PORT)

.Main syntax:

 O portnr byte 

.Variants:

 1. O portnr byte 

Example: O 60 13
Description:Send a carrige return ( &h13) to the keyboard port( &h60)
Output/ prompt: -


P (PROCEED)

. Main syntax:

 P =[[startsegment:] startoffset] [nrinstructions] 
(Proceed does NOT step INTO CALLS/INTERRUPTS ( crf:
trace ))

. Variants:

 1. P =startsegment:startoffset nrinstructions  

Example:P=DS:2000 2
Description:Execute 2 instructions at DS:2000 and display registers
Output/ prompt: AX=0000 BX=0000 CX=0446 DX=0000 SP=FFFE BP=0000 SI=0000..
DS=6897 ES=6897 SS=6897 CS=6897 IP=0100 NV UP DI PL NZ ..
[DS]:0200 XOR AX,AX
-

 2. P =startoffset nrinstructions  

Example: P=200 3
Description: Execute 3 instructions at CS:200 and display registers
Output/ prompt: AX=0000 BX=0000 CX=0446 DX=0000 SP=FFFE BP=0000 SI=0000..
DS=6897 ES=6897 SS=6897 CS=6897 IP=0100 NV UP DI PL NZ ..
[CS]:0200 AND AH,80
-

 3. P nrinstructions 

Example: P 5
Description: Execute 5 instructions at CS:IP
Output/ prompt: AX=0000 BX=0000 CX=0446 DX=0000 SP=FFFE BP=0000 SI=0000..
DS=6897 ES=6897 SS=6897 CS=6897 IP=0100 NV UP DI PL NZ ..
[CS]:[IP] MOV AH,4C
-

 4. P 

Example: P
Description:Execute 1 instruction at CS:IP
Output/ prompt: AX=0000 BX=0000 CX=0446 DX=0000 SP=FFFE BP=0000 SI=0000..
DS=6897 ES=6897 SS=6897 CS=6897 IP=0100 NV UP DI PL NZ ..
[CS]:[IP] REPNZ MOVSW
-


Q (QUIT)

.Main syntax:

 Q 

.Variants:

 1. Q 

Example: Q
Description:Quits DEBUG and returns to DOS prompt
Output/ prompt: .../.../> -


R (REGISTER)

. Main syntax:

 R [CPU Register] 

. Variants:

 1. R CPU-Register 

Example: R IP
Description:Displays current content of IP and prompt you to change it
Output/ prompt: IP 156D
: -

 2. R 

Example: R
Description:Displays all CPU registers and flags and the instruction at CS:IP
Output/ prompt: AX=0000 BX=0000 CX=0446 DX=0000 SP=FFFE BP=0000 SI=0000..
DS=6897 ES=6897 SS=6897 CS=6897 IP=0100 NV UP DI PL NZ ..
[DS]:0200 XOR AX,AX
-


S (SEARCH)

.Main syntax:

 S [startsegment:] startoffset [endoffset] searchdata 
(Segment boundery crossing is not possible so the end point can only be a near pointer, segment1:endoffset)

.Variants:

 1. S startsegment:startoffset endoffset searchdata 

Example: S CS:1000 1FFF 34 56 'test' 43
Description: Search the bytesequence 34 'test' 43 from CS:1000 until CS:1FFF
Output/ prompt: [CS]:1003
[CS]:1201
[CS]:1451
-

 2. S startoffset endoffset searchdata 

Example: S 100 12A 20 'test' 0C
Description:Search the bytesequence 20 'test' 0C from DS:100 until DS:12A
Output/ prompt: [DS]:0101
[DS]:0112
[DS]:0119
-

 3. S startsegment:startoffset string2search 
(String2search can NOT start with a byte: S ES:100 43 'test' will return error)

Example:S ES:100 'test' 43
Description:Search the bytesequence 'test' 43 in the first &h80 bytes above ES:0100
Output/ prompt: [ES]:0111
-

 4. S offset string2search 
(String2search can NOT start with a byte: S 100 43 'test' will return error)

Example: S 200 'test'
Description:Search the bytesequence 'test' in the first &h80 bytes above DS:0200
Output/ prompt: [DS]:0201
[DS]:0221
-


T (TRACE)

. Main syntax:

 T =[[startsegment]: startoffset] [nrinstructions] 
(Trace does step INTO CALLS/INTERRUPTS ( crf:
proceed )

. Variants:

 1. T =startsegment:startoffset nrinstructions 

Example: T=DS:2000 2
Description:Execute 2 instructions at DS:2000 and display registers
Output/ prompt: AX=0000 BX=0000 CX=0446 DX=0000 SP=FFFE BP=0000 SI=0000..
DS=6897 ES=6897 SS=6897 CS=6897 IP=0100 NV UP DI PL NZ ..
[DS]:0200 XOR AX,AX
-

 2. T =startoffset nrinstructions 

Example:T=200 3
Description:Execute 3 instructions at CS:200 and display registers
Output/ prompt: AX=0000 BX=0000 CX=0446 DX=0000 SP=FFFE BP=0000 SI=0000..
DS=6897 ES=6897 SS=6897 CS=6897 IP=0100 NV UP DI PL NZ ..
[CS]:0200 AND AH,80
-

 3. T nrinstructions 

Example:T 5
Description:Execute 5 instructions at CS:IP
Output/prompt: AX=0000 BX=0000 CX=0446 DX=0000 SP=FFFE BP=0000 SI=0000..
DS=6897 ES=6897 SS=6897 CS=6897 IP=0100 NV UP DI PL NZ ..
[CS]:[IP] MOV AH,4C
-

 4. T 

Example:
T 
Description: Execute 1 instruction at CS:IP
Output/ prompt: AX=0000 BX=0000 CX=0446 DX=0000 SP=FFFE BP=0000 SI=0000..
DS=6897 ES=6897 SS=6897 CS=6897 IP=0100 NV UP DI PL NZ ..
[CS]:[IP] REPNZ MOVSW
-


U (UNASSEMBLE)

.Main syntax:

 U [[[segment]:startoffset] endoffset] 

.Variants:

 1. U segment:startoffset endoffset 

Example:U 1234:100 200
Description:Unassemble from 1234:100 to 1234:200
Output/ prompt: 1234:0100 XOR AX,AX
...................
1234:0200 MOV AH,4C
-

 2. U segment:startoffset 

Example:U DS:200
Description: Unassemble 32 bytes from DS:200
Output/ prompt: [DS]:0200 AND AX,AX
...................
[DS]:0220 INT 20
-

 3. U startoffset endoffset 

Example:U 200 300
Description: Unassemble from CS:200 to CS:300
Output/ prompt: [CS]:0200 MOVSW
...............
[CS]:0300 REPNZ
-

 4. U startoffset 

Example:U 1DFE
Description:Unassemble 32 bytes from CS:1FFE
Output/ prompt: [CS]:1DFE CMP AX,80
...............
[CS]:1E1B IRET
-

 5. U 

Example:U
Description:Unassemble 32 bytes from CS:IP
Output/ prompt: [CS]:[IP] XCHG AX,BX
....................
[CS]:[IP+20] RETF
-


W (WRITE)

.Main syntax:

 W [[startsegment:]startoffset] [station startsector nrsectors] 

.Variants:

 1. W startsegment:startoffset station startsector nrsector 

Example: W DS:100 0 0 1
Description:Writes 1 sector from DS:100 to sector 0 of station A
Output/ prompt: -

 2. W startoffset station startsector nrsector  

Example: W 100 2 0 2
Description:Writes 2 sectors from CS:100 to sector 0-2 of station A
Output/ prompt: -

 3. W startsegment:startoffset 

Example: W 1456:100
Description:Writes BX:CX bytes from 1456:100 to the the last named file ( crf: name)
Output/ prompt: -

 4. W startoffset  

Example: W 100
Description: Writes BX:CX bytes from CS:100 to the the last named file( crf: name)
Output/ prompt: -

 5. W 

Example: W
Description: Writes BX:CX bytes from CS:IP to the the last named file( crf: name)
Output/ prompt: -


XA (ALLOCATE EXPANDED MEMORY)

.Main syntax:

 XA nrpages( 16Kb) 

.Variants:

 1. XA nrpages( 16Kb) 
(This command only works if you have some expanded memory manager like EMM386.exe installed)

Example: XA 1
Description:Allocates 1 page of 16 KB of expanded memory and returns
handle
Output/ prompt: Entrance created= 0003
-


XD (DEALLOCATE EXPANDED MEMORY)

.Main syntax:

 XD handle 

.Variants:

 1. XD handle 
(This command only works if you have some expanded memory manager like EMM386.exe installed)

Example: XD 1
Description:Deallocates handle 1 of expanded memory
Output/ prompt: Assignment of entrance 0003 is terminated
-


XS (DISPLAY EXPANDED MEMORY STATUS)

.Main syntax:

 XS 

.Variants:

 1. XS 
(This command only works if you have some expanded memory manager like EMM386.exe installed)

Example: XS
Description:Displays the status of expanded memory
Output/ prompt: .................................
Fysical page 02 = Frame part D400
Fysical page 03 = Frame part D800
Fysical page 04 = Frame part E400
-


XM (MAPS LOGICAL PAGE OF EMS TO PHYSICAL PAGE)

.Main syntax:

 XM Logical-pagenr Physical-pagenr handle 

.Variants:

 1. XM Logical-pagenr  Physical-pagenr handle 
(This command only works if you have some expanded memory manager like EMM386.exe installed)

Example: XM 01 02 3
Description:Maps Logical-pagenr 01 to Physical pagenr 02 using handle 3
Output/ prompt: Logical page 01 is assigned to
Fysical page 02
-


1