PAGE    ,132
NAME    DFDATA
TITLE   DFDATA.ASM - dump formatter data and tables
.286p

;***    DFDATA.ASM
;
;       This contains the data and tables for the dump formatter
;

.xlist
        include debseg.inc
        include debmac.inc
        include debequ.inc
        include debinit.inc
        include debdesc.inc
        include debprt.inc
.list

DataSegmentStart

; Initialization data

Global DebData,         STRUC,  DebugInit
Global InDebugger,      BYTE,   FALSE           ; if TRUE, are in the debugger.
Global DisAddr,         STRUC,  AddrS, <>       ; current disassembly address
Global DumpAddr,        STRUC,  AddrS, <>       ; dump address
Global EnterAddr,       STRUC,  AddrS, <>       ; enter address
Global DefMode,         BYTE,   0               ; dump mode "DW,DD,etc".
Global DefType,         WORD,   9               ; default address type

; Initial command buffer, the buffer is initialize to the command
; that is to be executed when the debugger is first initialized. Can
; be patched by the debpatch program.  If the first bytes is zero, this
; means it hasn't been patched and there is no initialization command.

Static Signature,       BYTE,   <0afH, "djh", 1, 0, "DPATCH">
Global InitCmdBuffer,   CMDLINELEN,     0

; Command input buffer

Global CmdInputBuffer,  CMDLINELEN,     0

; Default command to execute when entering debugger, can be
; changed with the "z" command.

Global DefaultCmd,      BYTE,           <"R", 0>
Static           ,      <CMDLINELEN - ($ - DefaultCmd)>, 0

; Command line buffer and text pointer

Global pTXTstart,       WORD,   <dataOFFSET CmdInputBuffer>
Global pTXT,            WORD,   <dataOFFSET CmdInputBuffer>

; Command script buffer address and size (0 size == end of script)

Global CommandScriptAddrS,      STRUC,  AddrS, <>
Global CommandScriptSize,       WORD,   0


; Trace calls table

Global TraceCallsStack, TRACE_CALLS_SIZE, 0
Global TraceCallsDepth, WORD, 0
Global TraceCallsFirst, WORD, 0
Global TraceCallsSecond, WORD, 0

; Sticky Breakpoint table - must be zero initialized

Global sbrtab,          STICKY_BP_LEN,  0

; Register save area
EVEN
Global pRegSA,          WORD,   0
Global RegSA,           STRUC,  RegSA_frame, <>
EVEN
Global LoadAllSav,      STRUC,  LoadAllStruc, <>

; Buffer used to cache SymDefs and speed up symbol searching.

EVEN
Global MemCache,        BYTE,   <MEMCACHESIZE DUP(?)>
Global DebStackFence,   WORD,   <STACK_FENCE_VALUE>
Static DebStack,        1024,   0
EVEN
Global StackTop,        WORD,   0

; Global registers strings

Global AXmsg,   STRING, "AX="
Global EAXmsg,  STRING, "EAX="
Global BXmsg,   STRING, "BX="
Global EBXmsg,  STRING, "EBX="
Global CXmsg,   STRING, "CX="
Global ECXmsg,  STRING, "ECX="
Global DXmsg,   STRING, "DX="
Global EDXmsg,  STRING, "EDX="
Global SPmsg,   STRING, "SP="
Global ESPmsg,  STRING, "ESP="
Global BPmsg,   STRING, "BP="
Global EBPmsg,  STRING, "EBP="
Global SImsg,   STRING, "SI="
Global ESImsg,  STRING, "ESI="
Global DImsg,   STRING, "DI="
Global EDImsg,  STRING, "EDI="
Global CSmsg,   STRING, "CS="
Global DSmsg,   STRING, "DS="
Global ESmsg,   STRING, "ES="
Global SSmsg,   STRING, "SS="
Global IPmsg,   STRING, "IP="
Global EIPmsg,  STRING, "EIP="
Global GDTRmsg, STRING, "GDTR="
Global IDTRmsg, STRING, "IDTR="
Global GDTBmsg, STRING, "GDTB="
Global GDTLmsg, STRING, "GDTL="
Global IDTBmsg, STRING, "IDTB="
Global IDTLmsg, STRING, "IDTL="
Global TRmsg,   STRING, "TR="
Global LDTRmsg, STRING, "LDTR="
Global IOPLmsg, STRING, "IOPL="
Global MSWmsg,  STRING, "MSW="
Global CR0msg,  STRING, "CR0="
Global CR2msg,  STRING, "CR2="
Global CR3msg,  STRING, "CR3="
Global Fmsg,    STRING, "F="
Global EFmsg,   STRING, "EF="
Global FSmsg,   STRING, "FS="
Global GSmsg,   STRING, "GS="
Global DR0msg,  STRING, "DR0="
Global DR1msg,  STRING, "DR1="
Global DR2msg,  STRING, "DR2="
Global DR3msg,  STRING, "DR3="
Global TR6msg,  STRING, "TR6="
Global TR7msg,  STRING, "TR7="
Global DR6msg,  STRING, "DR6="
Global DR7msg,  STRING, "DR7="

DataSegmentEnd

CodeSegmentStart

; Extern  Debug_Entry, FAR
; Extern  Debug_Break, FAR
; Extern  Debug_Break32, FAR
; Extern  Debug_Exit, FAR
; Extern  Debug_Sym, FAR
; Extern  Debug_Sym32, FAR
; Extern  Debug_Trap, FAR
; Extern  Debug_Trap32, FAR
; Extern  Debug_CtrlC, FAR
; Extern  Debug_CtrlC32, FAR
; Extern  ExEnterDebugRETF, FAR
; Extern  ExEnterDebugIRET, FAR
; Extern  ExitDebug, NEAR
Extern  DoCommand, NEAR
; Extern  CheckCtrlC, NEAR
Extern  CmdBreak, NEAR
Extern  command, NEAR
; Extern  ChkBPaddr, NEAR
; Extern  ParseString, NEAR
Extern  ScanP, NEAR
Extern  SkipB, NEAR
Extern  GetChr, NEAR
Extern  GetChrI, NEAR
; Extern  IsSeparator, NEAR
Extern  PeekChr, NEAR
Extern  EvalRange, NEAR
Extern  EvalAddr, NEAR
Extern  EvalExpr, NEAR
; Extern  GetSymbolBuf, NEAR
; Extern  GetSymbolVal, NEAR
Extern  OutAddrS, NEAR
Extern  OutRadix, NEAR
Extern  fmtnum, NEAR
Extern  inbuf, NEAR
Extern  rprbuf, NEAR
Extern  put_ch, NEAR
Extern  waitchr, NEAR
Extern  inchr, NEAR
Extern  ungetc, NEAR
Extern  FillAddr, NEAR
Extern  PutByte, NEAR
Extern  PutBuff, NEAR
Extern  GetCache, NEAR
Extern  GetByte, NEAR
Extern  GetBuff, NEAR
Extern  AddrToPhy, NEAR
Extern  AddrToLin, NEAR
Extern  PrintMemErr, NEAR
Extern  CompareAddr, NEAR
Extern  GetAddrType, NEAR
Extern  GetCurrTask, NEAR
; Extern  OpInterpret, NEAR
Extern  ErrBreak, NEAR
Extern  RCmdBreak, NEAR
Extern  perr, NEAR
Extern  perror, NEAR
Extern  CheckAddr, NEAR

DebRetf: retf

CodeSegmentEnd

DataSegmentStart first

Global  DebSASTable, LABEL, BYTE

        db      'DEBUG'
        db      DSAS_VERSION                    ; version #
        dd      0
        dd      0
        dw      dataOFFSET DebData
        dw      dataOFFSET RegSA
        dw      dataOFFSET MemCache
        dw      dataOFFSET DefType
        dw      dataOFFSET pTXT
        dw      codeOFFSET DebRetf
;        dw      codeOFFSET Debug_Entry
;        dw      codeOFFSET Debug_Entry          ; no 32 bit entry yet
        dw      0,0                             ; Debug_Entry * 2
;        dw      codeOFFSET Debug_Break
        dw      0                               ; Debug_Break
;         dw      codeOFFSET Debug_Exit
        dw      0                               ; LIB - debug_exit
;         dw      codeOFFSET Debug_Sym
;         dw      codeOFFSET Debug_Sym32
        dw      0,0                     ; Debug_Sym, Debug_Sym32
;        dw      codeOFFSET Debug_Trap
;        dw      codeOFFSET Debug_Trap32
        dw      0,0                     ; Debug_Trap, Debug_Trap32
;        dw      codeOFFSET Debug_CtrlC
;        dw      codeOFFSET Debug_CtrlC32
        dw      0,0                     ; Debug_CtrlC, Debug_CtrlC32
;        dw      codeOFFSET ExEnterDebugRETF
;        dw      codeOFFSET ExEnterDebugIRET
        dw      0,0                     ; ExEnterDebugRETF, ExEnterDebugIRET
;        dw      codeOFFSET ExitDebug
        dw      0                       ; ExitDebug
        dw      codeOFFSET DoCommand
;        dw      codeOFFSET CheckCtrlC
        dw      0                       ; CheckCtrlC
        dw      codeOFFSET CmdBreak
        dw      codeOFFSET command
;        dw      codeOFFSET ChkBPaddr
        dw      0                       ; ChkBPaddr
;        dw      codeOFFSET ParseString
        dw      0                       ; ParseString
        dw      codeOFFSET ScanP
        dw      codeOFFSET SkipB
        dw      codeOFFSET GetChr
        dw      codeOFFSET GetChrI
;        dw      codeOFFSET IsSeparator
        dw      0                       ; IsSeparator
        dw      codeOFFSET PeekChr
        dw      codeOFFSET EvalRange
        dw      codeOFFSET EvalAddr
        dw      codeOFFSET EvalExpr
;        dw      codeOFFSET GetSymbolBuf
;        dw      codeOFFSET GetSymbolVal
        dw      0,0                     ; GetSymbolBuf, GetSymbolVal
        dw      codeOFFSET OutAddrS
        dw      codeOFFSET inbuf
        dw      codeOFFSET rprbuf
        dw      codeOFFSET put_ch
        dw      codeOFFSET waitchr
        dw      codeOFFSET inchr
        dw      codeOFFSET ungetc
        dw      codeOFFSET FillAddr
        dw      codeOFFSET PutByte
        dw      codeOFFSET PutBuff
        dw      codeOFFSET GetCache
        dw      codeOFFSET GetByte
        dw      codeOFFSET GetBuff
        dw      codeOFFSET AddrToPhy
        dw      codeOFFSET AddrToLin
        dw      codeOFFSET PrintMemErr
        dw      codeOFFSET CompareAddr
        dw      codeOFFSET GetAddrType
        dw      codeOFFSET GetCurrTask
;        dw      codeOFFSET OpInterpret
        dw      0                       ; OpInterpret
        dw      codeOFFSET ErrBreak
        dw      codeOFFSET RCmdBreak
        dw      codeOFFSET perr
        dw      codeOFFSET perror
        dw      dataOFFSET pTXTstart
        dw      codeOFFSET CheckAddr
        .errnz  ($-DebSASTable) - (size DebSAS)

DataSegmentEnd   first
        end
