Skip to content

Commit dd6f150

Browse files
v1.27
1 parent accdbb0 commit dd6f150

20 files changed

Lines changed: 733 additions & 45 deletions

DEBUG.TXT

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,14 @@ offset address with a colon. Some examples using the Dump command:
8686
-D DS:100 102
8787
-D SS:20 L 4
8888

89-
[ENH: DEBUGX understand this additional syntax:
89+
[ENH: the command prompt is changed if the debuggee has been stopped
90+
inside DOS - a '!' will precede the default prompt ('!-' instead of
91+
just '-'). DEBUGX changes the prompt to '#' if debuggee is in protected-
92+
mode. Prompt '!#', which means "inside DOS" AND "in protected-mode",
93+
is also possible, if the debuggee has been stopped in a so-called
94+
DPMI real-mode callback.
95+
96+
As for the Dump command, DEBUGX understands this additional syntax:
9097

9198
#D $F000:FFF6
9299

@@ -97,9 +104,8 @@ if debuggee is in protected-mode and the segment part of the starting
97104
address is a 32bit selector, the offset parts of the starting and ending
98105
address - as well as the length - can be 32bit. Examples:
99106

100-
-D DS:110000 110FFF
101-
-D CS:400000 L 20000
102-
107+
#D DS:110000 110FFF
108+
#D CS:400000 L 20000
103109
]
104110

105111
---
@@ -251,15 +257,15 @@ The Go command (G), when used without a parameter, causes DEBUG to
251257
copy the contents of the register variables to the actual CPU
252258
registers and effectively jump to the instruction at CS:IP, giving
253259
full control to the program being debugged. DEBUG will reassert
254-
control when the program terminates normally, or DEBUG will not
255-
reassert control. The optional address parameter can be used to
256-
specify the starting address. The optional breakpoint list can
257-
be used to specify up to 10 temporary breakpoint addresses.
258-
To differentiate the address parameter from the breakpoint list,
259-
the address parameter must be preceded with an "=". Note that the
260-
breakpoint addresses must coincide with the start of a valid
261-
instruction. To resume execution after a breakpoint, use the Go
262-
command without a parameter.
260+
control when the program terminates normally, a debug exception
261+
(exception 01) or a hard-coded breakpoint (INT 03) is reached.
262+
The optional address parameter can be used to specify the starting
263+
address. The optional breakpoint list can be used to specify up to
264+
10 temporary breakpoint addresses. To differentiate the address
265+
parameter from the breakpoint list, the address parameter must be
266+
preceded with an "=". Note that the breakpoint addresses must coincide
267+
with the start of a valid instruction. To resume execution after a
268+
breakpoint, use the Go command without a parameter.
263269

264270
Syntax: G [=address] [break0 break1...]
265271

HISTORY.TXT

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,10 +214,16 @@
214214
break in real-mode.
215215
- bugfix 'xs' cmd: no of pages of just the first handle was displayed,
216216
and the handle total was not correct.
217-
1.27 [ ?? 2020]
217+
1.27 [08 November 2020]
218218
- added new variant DEBUGXU.COM. This version does not use int 15h,
219219
ah=87h inside the DX command, thus avoiding to disable a possibly
220220
active unreal mode. The catch is that this version's DX command won't
221221
work in V86 mode.
222-
- disassembler handles operand size prefix for one-byte push command
223-
correctly: 66h, 6Ah, 00h -> 'PUSH DWORD +00'.
222+
- disassembler handles operand size prefix for one-byte "push <imm>"
223+
opcodes correctly. OTOH, for 2/4 byte "push <imm>" opcodes, the
224+
disassembler no longer displays the operand size, since the size
225+
is obvious.
226+
- if InDOS flag is set, a '!' is preceding the debugger prompt.
227+
- BIOS used when waiting for a key in help msg display.
228+
- 'e' cmd uses BIOS if InDOS flag set.
229+

MAKE.BAT

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
echo creating debug.com
33
jwasm -nologo -D?PM=0 -bin -Fobuild\DEBUG.COM -Flbuild\DEBUG.LST src\debug.asm
44
echo creating debugx.com
5-
jwasm -c -nologo -D?PM=1 -bin -Fo build\DEBUGX.COM -Flbuild\DEBUGX.LST src\debug.asm
5+
jwasm -nologo -D?PM=1 -bin -Fo build\DEBUGX.COM -Flbuild\DEBUGX.LST src\debug.asm
66
rem ml -c -nologo -D?PM=1 -Fo build\DEBUGX.OBJ -Flbuild\DEBUGX.LST src\debug.asm

MAKEC.BAT

100644100755
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,11 @@ rem 1) instr.set
55
rem 2) instr.key
66
rem 3) instr.ord
77
rem 4) mktables.c
8-
wcl -ox -3 -d__MSDOS__ mktables.c
8+
9+
rem using Open Watcom
10+
rem wcl -ox -3 -d__MSDOS__ src\mktables.c
11+
12+
rem using MSVC v1.5
13+
\msvc\bin\cl -c -G3 -D__MSDOS__ -Fobuild\mktables.obj -I\msvc\include src\mktables.c
14+
set lib=\msvc\lib
15+
\msvc\bin\link16 build\mktables.obj,build\mktables.exe,build\mktables.map /NON;

Samples/DPMIBK16.ASM

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
2+
;--- DPMIBK16.ASM: 16bit DPMI application written in MASM syntax.
3+
;--- this sample temporarily switches back to real-mode.
4+
;--- assemble: JWasm -bin -Fo dpmibk16.com dpmibk16.asm
5+
6+
LF equ 10
7+
CR equ 13
8+
9+
.286
10+
.model tiny
11+
12+
;--- DPMI real-mode call structure
13+
14+
RMCS struct
15+
rEDI dd ?
16+
rESI dd ?
17+
rEBP dd ?
18+
dd ?
19+
rEBX dd ?
20+
rEDX dd ?
21+
rECX dd ?
22+
rEAX dd ?
23+
rFlags dw ?
24+
rES dw ?
25+
rDS dw ?
26+
rFS dw ?
27+
rGS dw ?
28+
rIP dw ?
29+
rCS dw ?
30+
rSP dw ?
31+
rSS dw ?
32+
RMCS ends
33+
34+
.code
35+
36+
org 100h
37+
38+
;--- the 16bit initialization part
39+
40+
start:
41+
pop ax ;get word saved on stack for COM files
42+
mov bx, sp
43+
shr bx, 4
44+
jnz @F
45+
mov bx,1000h ;it was a full 64kB stack
46+
@@:
47+
mov ah, 4Ah ;free unused memory
48+
int 21h
49+
mov ax, 1687h ;DPMI host installed?
50+
int 2Fh
51+
and ax, ax
52+
jnz nohost
53+
push es ;save DPMI entry address
54+
push di
55+
and si, si ;requires host client-specific DOS memory?
56+
jz nomemneeded
57+
mov bx, si
58+
mov ah, 48h ;alloc DOS memory
59+
int 21h
60+
jc nomem
61+
mov es, ax
62+
nomemneeded:
63+
mov bp, sp
64+
mov bx, cs ;save real-mode value of CS in BX
65+
mov ax, 0000 ;start a 16-bit client
66+
call far ptr [bp] ;initial switch to protected-mode
67+
jnc initok
68+
call error
69+
db "DPMI initialisation failed",CR,LF,'$'
70+
nohost:
71+
call error
72+
db "no DPMI host installed",CR,LF,'$'
73+
nomem:
74+
call error
75+
db "not enough DOS memory for initialisation",CR,LF,'$'
76+
error:
77+
push cs
78+
pop ds
79+
pop dx
80+
mov ah, 9
81+
int 21h
82+
mov ax, 4C00h
83+
int 21h
84+
85+
;--- now in protected-mode
86+
87+
initok:
88+
push bx
89+
call printstring
90+
db "welcome in protected-mode",CR,LF,0
91+
pop bx
92+
93+
;--- switch back to real-mode
94+
95+
sub sp, sizeof RMCS
96+
mov bp,sp
97+
mov [bp].RMCS.rIP, offset backinreal
98+
mov [bp].RMCS.rCS, bx
99+
xor ax, ax
100+
mov [bp].RMCS.rFlags, ax
101+
mov [bp].RMCS.rDS, ax
102+
mov [bp].RMCS.rES, ax
103+
lea ax,[bp-20h]
104+
mov [bp].RMCS.rSP, ax
105+
mov [bp].RMCS.rSS, bx
106+
xor bx,bx
107+
xor cx,cx
108+
mov di,bp
109+
push ss
110+
pop es
111+
mov ax,0301h ;temporarily switch to real-mode
112+
int 31h
113+
114+
call printstring
115+
db "back in protected-mode",CR,LF,0
116+
mov ax, 4C00h ;normal client exit
117+
int 21h
118+
119+
backinreal:
120+
push cs
121+
pop ds
122+
call printstring
123+
db "switched to real-mode",CR,LF,0
124+
retf ;back to protected-mode
125+
126+
;--- print a string in both protected-mode and real-mode.
127+
;--- uses simple DOS commands without pointers.
128+
129+
printstring:
130+
pop si
131+
nextchar:
132+
lodsb
133+
and al,al
134+
jz stringdone
135+
mov dl,al
136+
mov ah,2
137+
int 21h
138+
jmp nextchar
139+
stringdone:
140+
push si
141+
ret
142+
143+
end start

0 commit comments

Comments
 (0)