Skip to content

Commit

Permalink
fixed dm cmd: last invalid mcb no longer displayed
Browse files Browse the repository at this point in the history
  • Loading branch information
Baron-von-Riedesel committed Jan 7, 2024
1 parent dfa4a2e commit 3bce1cd
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 45 deletions.
29 changes: 15 additions & 14 deletions HISTORY.TXT
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
0.99c [29 Septemb 2006]
- RX changed. Now it toggles 16/32 bit register dump.
- RN displays floating point register status.
0.99d [02 October 2006]
0.99d [2 October 2006]
- bugfix: RN displayed error-pointer registers wrong.
0.99e [12 October 2006]
- XR command added to reallocate EMS handle.
Expand All @@ -35,7 +35,7 @@
0.99g [25 October 2006]
- bugfix: U was unable to recognise [ESP] related memory operands
(i.e. mov eax,[esp]).
0.99h [07 November 2006]
0.99h [7 November 2006]
- bugfix: R trying to display content of effective address has
caused a GPF in v86-mode if this address was FFFFh of FFFDh.
- IW, ID, OW and OD implemented.
Expand Down Expand Up @@ -105,7 +105,7 @@
int 2Fh is now hooked later. This allows to debug applications
which install their own DPMI host during initialization.
- DEBUGX: DL understands an optional "count" argument.
1.11 [06 February 2008]
1.11 [6 February 2008]
- bugfix: debugger lost debuggee's HiWord(EFL) in real-mode.
- bugfix: if debuggee set CR0 AM bit and EFL AC flag, an
exception 11h occured in the debugger.
Expand Down Expand Up @@ -200,21 +200,21 @@
MS debug is accepted now ( which is a segment register followed
by a colon ).
- file makex.bat added.
1.24 [04 July 2011]
1.24 [4 July 2011]
- bugfix: line assembler didn't encode 32-bit addressing with SIB
byte correctly in v1.23.
- debug script DPMICL16.SCR added.
1.25 [08 August 2011]
1.25 [8 August 2011]
- 2 variants (F & G) added to makex.bat
1.26 [16 January 2020]
1.26 [16.1.2020]
- bugfix 'a' cmd: 'MOV sreg, mem' and 'MOV mem, sreg' needed a size.
- bugfix 'xm' cmd: logical page displayed was 2 digits only.
- DEBUGX: interrupt and exception 07 intercepted.
- DEBUGX: int 2Fh was "rehooked" if protected-mode debuggee caused a
break in real-mode.
- bugfix 'xs' cmd: no of pages of just the first handle was displayed,
and the handle total was not correct.
1.27 [08 November 2020]
1.27 [8.11.2020]
- added new variant DEBUGXU.COM. This version does not use int 15h,
ah=87h inside the DX command, thus avoiding to disable a possibly
active unreal mode. The catch is that this version's DX command won't
Expand All @@ -226,7 +226,7 @@
- if InDOS flag is set, a '!' is preceding the debugger prompt.
- BIOS used when waiting for a key in help msg display.
- 'e' cmd uses BIOS if InDOS flag set.
1.28 [10 March 2022]
1.28 [10.3.2022]
- DEBUGX bugfix e-cmd: used wrong offset when reading from 32-bit
segments.
- DEBUGX bugfix d-cmd: hiword(ecx) wasn't cleared, resulting in a
Expand All @@ -237,7 +237,7 @@
- DEBUGX: int 2Fh, ax=1686h to detect mode no longer used - this makes
interrupt 2Fh traceable.
- bugfix 'e' cmd: don't stop input after byte '0d' has been entered.
1.29 [06 May 2022]
1.29 [6.5.2022]
- DEBUGX bugfix c/d/e/m/s-cmd: an offset beyond 0ffffh was rejected if
the segment descriptor's 'default-size' flag wasn't set.
- DEBUGX bugfix e-cmd interactive mode: offset increment and decrement
Expand All @@ -261,7 +261,7 @@
intercepted protected-mode int 21h and refuses to quit.
- another variant - DEBUGXV - may be created. It allows to flip video
screen between debugger and debuggee.
2.00 [5 December 2022]
2.00 [5.12.2022]
- fixed: routine int21ah9 did use DOS, even if InDos flag was set.
- fixed: reading stdin from file wasn't fully MS Debug compatible.
- fixed: correctly handle tabs if output is via BIOS.
Expand Down Expand Up @@ -295,8 +295,9 @@
converted to selectors during initial switch to protected-mode.
- DEBUGX: exceptions 0dh/0eh are set/reset on debugger entry/exit.
- DEBUGXV: stop in debugger if SYSREQ is pressed.
2.1 []
- added a ring0 (PL0) variant for long mode - DebugRL.bin.
2.01 [7.1.2024]
- fixed: addr/opsize prefixes "toggle", but just once.
- added bp/bc cmds for ring 0 variants (DebugR/DebugRL).
- ignore debug exception if inside debugger.
- fixed: debug exceptions occuring inside debug are now ignored.
- fixed dm cmd: invalid last mcb no longer displayed.
- added a ring0 (PL0) variant for long mode - DebugRL.bin.
- DEBUGR(L): added bp & bc cmds.
53 changes: 27 additions & 26 deletions src/DEBUG.ASM
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
; - add MMX instructions for A and U
; - support loading *.HEX files

VERSION textequ <2.1>
VERSION textequ <2.01>

option casemap:none
option proc:private
Expand Down Expand Up @@ -238,7 +238,7 @@ SYSRQINT equ 9 ;if CATCHSYSREQ==1, defines the method (int 09h or int 15h)

ifndef CATCHINT01
CATCHINT01 equ 1 ;catch INT 01 (single-step)
NOEXC01INDBG equ 1 ;v2.1: ignore unexpected debug exceptions in debug itself
NOEXC01INDBG equ 1 ;v2.01: ignore unexpected debug exceptions in debug itself
endif
ifndef CATCHINT03
CATCHINT03 equ 1 ;catch INT 03 (break)
Expand Down Expand Up @@ -4851,6 +4851,9 @@ endif

if DMCMD

;--- dm cmd: display list of MCBs
;--- DI=lineout

mcbout proc
; mov di,offset line_out
mov ax,"SP"
Expand All @@ -4862,33 +4865,36 @@ mcbout proc
call putsline ;destroys cx,dx,bx

mov si,[wMCB]
push ds
nextmcb:
mov di,offset line_out
push ds
call setds2si
mov ch,ds:[0000]
mov bx,ds:[0001] ;owner psp
mov dx,ds:[0003]
mov ax,si
call hexword ;segment address of MCB
mov al,' '
stosb
mov al,ch
call hexbyte ;'M' or 'Z'
mov al,ds:[0000];'M' or 'Z'
cmp al,'Z'
jz @F
cmp al,'M'
jnz mcbout_done
@@:
call hexbyte
mov al,' '
stosb
mov ax,bx
call hexword ;MCB owner
mov ax,ds:[0001];MCB owner
mov bx,ax
call hexword
mov al,' '
stosb
mov ax,dx
call hexword ;MCB size in paragraphs
mov ax,ds:[0003];MCB size in paragraphs
mov dx,ax
call hexword
mov al,' '
stosb
and bx,bx
jz mcbisfree
push si
push cx
push dx
mov si,8
mov cx,2
Expand All @@ -4903,21 +4909,17 @@ nextmcbchar: ;copy "name" of owner MCB
and al,al
loopnz nextmcbchar
pop dx
pop cx
pop si
mcbisfree:
pop ds
add si,dx
jc mcbout_done
inc si
push cx
pop ds
push ds
call putsline ;destroys cx,dx,bx
pop cx
cmp ch,'Z'
jz nextmcb
cmp ch,'M'
jz nextmcb
jmp nextmcb
mcbout_done:
pop ds
ret

setds2si:
Expand Down Expand Up @@ -10982,8 +10984,8 @@ parse_pt endp
; Uses AH,BX,CX,(E)DX.

parseql proc
mov [eqflag],0 ;mark '=' as absent
mov bx,[regs.rCS] ;default segment
mov [eqflag],al
cmp al,'='
jne peq1 ;if no '=' operand
call skipwhite
Expand All @@ -10994,7 +10996,6 @@ endif
call getaddr ;get address into bx:(e)dx
sizeprfX ;mov [eqladdr+0],edx
mov [eqladdr+0],dx
inc [eqflag]
peq1:
mov [eqladdr+4],bx
ret
Expand All @@ -11005,8 +11006,8 @@ parseql endp
; Uses AX.

seteq proc
cmp [eqflag],0 ;'=' argument given?
jz @F
cmp [eqflag],'=' ;'=' argument given?
jnz @F
sizeprfX ;mov eax,[eqladdr+0]
mov ax,[eqladdr+0]
sizeprfX ;mov [regs.rIP+0],eax
Expand Down Expand Up @@ -12400,7 +12401,7 @@ if DRIVER or RING0 or BOOTDBG
ret
endif
else
mov [bInDbg], 1 ; v2.1: variable is set only when debug is entered via interrupt
mov [bInDbg], 1 ; v2.01: variable is set only when debug is entered via interrupt
push ds
pop es
mov cl, 4
Expand Down
8 changes: 4 additions & 4 deletions src/DISASM.INC
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ if ?PM
call getseldefsize
mov [bCSAttr],al
if 0
;--- ?PM v2.1: don't preset opsize/adrsize prefixes if D bit is set;
;--- ?PM v2.01: don't preset opsize/adrsize prefixes if D bit is set;
;--- those prefixes toggle just once.
jz @F
or [preflags], PRE32D or PRE32A
Expand Down Expand Up @@ -301,14 +301,14 @@ da_fpugrp:
;--- dis_jmp2[5]: Instruction prefix. At this point, bl = prefix bits; bh = segment

da_insprf:
if 0 ; v2.1: removed - opsize/adrsize prefixes "toggle" just once
if 0 ; v2.01: removed - opsize/adrsize prefixes "toggle" just once
mov al,bl
and bl,not (PRE32D or PRE32A) ;these flags are XORed!
endif
test bl,[preflags]
jnz disbad0 ;if there are duplicates
or [preflags],bl
if 0 ; v2.1: removed - opsize/adrsize prefixes "toggle" just once
if 0 ; v2.01: removed - opsize/adrsize prefixes "toggle" just once
mov bl,al
and al,PRE32D or PRE32A
xor [preflags],al
Expand All @@ -326,7 +326,7 @@ disbad0:

da13pre:

if ?PM ; v2.1: update opsize/adrsize prefixes if D bit set AFTER prefixes have been read
if ?PM ; v2.01: update opsize/adrsize prefixes if D bit set AFTER prefixes have been read
test [bCSAttr], 40h
jz @F
xor [preflags], PRE32D or PRE32A
Expand Down
2 changes: 1 addition & 1 deletion src/DPRINTF.INC
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ ltob PROC
ltob ENDP

;--- ss doesn't need to be dgroup
;--- v2.1: ss may be 32-bit!
;--- v2.01: ss may be 32-bit!

dprintf PROC

Expand Down

0 comments on commit 3bce1cd

Please sign in to comment.