;       SCCSID = @(#)debsym.inc 6.1 90/11/17
;***    DEBSYM.INC   Symbol Map Templates
;
;       SCCSID = @(#)debsym.inc 13.7 90/03/09
;
;       Templates in the file are Symdeb compatible as of 12/10/86 ***
;

;       Symbol Map Header Definition Template

SymMapHeader struc
        MapPtr          db      size AddrS DUP (?)
SymMapHeader ends

;       Map Definition Template

MapDef  struc
        MapLink         db      (size SymMapHeader) DUP (?)
        MapDefStart     dw      ?
        MapAbsSize      db      ?       ; flag indicating size of abs symbols
                        db      ?
        MapFlags        dw      ?
        ConCnt          dw      ?       ; count of constants in constant pack.
        ConChain        dw      ?       ; pointer to constant chain.
        GroupCnt        dw      ?       ; count of segments in map.
        GroupChain      dw      ?       ; pointer to first segment definition.
        MaxNameLen      db      ?       ; max symbol name len in map.
        MapNameLen      db      ?       ; map name length in bytes.
MapDef  ends

MapName                 equ     (size MapDef)
MapEndPtr               equ     (word ptr MapDefStart)

MAP_FLAG_ACTIVE         equ     0001h   ; active map if set
MAP_FLAG_WINOS2         equ     0002h   ; set if winos2 map

EndMapDef struc
        EndMapNext      dw      ?
        EndMapVerRel    dw      ?
EndMapDef ends

;       Group Definition Template

GroupDef struc
        GroupLink       dw      ?       ; offset to next segment definition
        SymCnt          dw      ?       ; count of symbols in this segment
        SymChain        dw      ?       ; pointer to symdef chain
        GroupSegNum     dw      ?       ; logical segment number
        GroupTaskNum    dw      ?       ; task number of group
        GroupAddrSel    dw      ?       ; selector value for this segment
        GroupAddrSeg    dw      ?       ; segment value for this segment
        GroupSymSize    db      ?       ; address size for this segment
        GroupAddrType   db      ?       ; address type for this selector/seg
        GroupEndValue   dd      ?       ; last SymDef value
        GroupNameLen    db      ?       ; length in bytes of Segment name.
GroupDef ends

GroupName               equ     (size GroupDef)
GroupAddrLinPhy         equ     (dword ptr GroupAddrSel)

GRP_SIZE_16             equ     0       ; group contains SymDef's
GRP_SIZE_32             equ     1       ; group contains SymDef32's

;       Symbol Definition Template

SymDef  struc
        SymValue        dw      ?       ; numeric value of symbol.
        SymNameLen      db      ?       ; length in bytes of symbol name.
SymDef  ends

SymName                 equ     (size SymDef)

;       32 bit Symbol Definition Template

SymDef32 struc
        SymValue32      dd      ?       ; numeric value of symbol.
        SymNameLen32    db      ?       ; length in bytes of symbol name.
SymDef32 ends

SymName32               equ     (size SymDef32)

;       Argument Structure Definition Template

ArgS    struc
        ArgFlags        db      ?       ; flags to worker routines
                        db      ?       ; for alignment
        ArgBufPtr       dw      ?       ; pointer to Map/Group/Symbol Name
        ArgMatchValue   dd      ?       ; address to match
        ArgAddrPtr      dw      ?       ; pointer to an AddrS structure
        ArgAddrPtr2     dw      ?       ; pointer to an AddrS structure
ArgS    ends

ArgSymValuePtr  equ     ArgAddrPtr2     ; found symbol value AddrS pointer

;       Parameter Frame structure for _Debug_Sym

SegTable struc
        MapAddrS        db      (size AddrS) DUP (?)
        GroupCount      dw      ?
SegTable ends

SegDefs                 equ     (size SegTable)

;       Segment Definition Template

SegDef  struc
        SegDefType      dw      ?
        SegDefSel       dw      ?
        SegDefSeg       dw      ?
        SegDefSegNum    dw      ?
SegDef  ends

SegDefLinPhy            equ     (dword ptr SegDefSel)

;       SegDef.SegDefType definitions

SYM_TYPE_SEG            equ     0001b   ; must be the same as EXPR_TYPE_SEG
SYM_TYPE_SEL            equ     1001b   ; must be the same as EXPR_TYPE_SEL
SYM_TYPE_LIN            equ     0010b   ; must be the same as EXPR_TYPE_LIN
SYM_TYPE_PHY            equ     1010b   ; must be the same as EXPR_TYPE_PHY
SYM_TYPE_BIMODAL        equ     -1

;       Function codes for _Debug_Sym

SYM_LINKMAP             equ     0
SYM_RELINKMAP           equ     1
SYM_UNLINKMAP           equ     2

;       Flags for GetSymbolBuf

MAP_GETMAPNAME          equ     00000001b       ; prefix with map name
MAP_GETGROUP            equ     00000010b       ; prefix with group name
MAP_NEAR_PREV           equ     00000100b       ; find nearest previous
MAP_NEAR_NEXT           equ     00001000b       ; find nearest next
MAP_BRACKET             equ     00010000b       ; PrintNearSym only

;       Maximum size of symbol name

MAX_NAME_SIZE            equ    32

;       Fatal symbol error macro

InternalSymErr  macro   str
        local   strptr
IFDEF   DEBUG
DataSegmentStart
strptr  db      "&str&", 0
DataSegmentEnd
        mov     dx,dataOFFSET strptr
ENDIF
        jmp     SymErr
        endm

NESymStruc  struc
            NE_pNext             dd  0
            NE_SlotCurrSegTable  dw  0
            NE_pSegTable         dd  0
            NE_cbModName         db  0
NESymStruc  ends

