home *** CD-ROM | disk | FTP | other *** search
- page 78,132
- title Windows debugging monitor
-
- .sall
- ?PLM = 0
- ?WIN = 0
- .xlist
- include cmacros.inc
- .list
-
- .model small
- .code
- .data
- InitSeg segment byte public
- InitSeg ends
-
- DGroup group _TEXT,_DATA,InitSeg
-
- .code
- assume cs:DGroup,ds:DGroup,es:DGroup,ss:DGroup
-
- extrn Monitor:near,PrintMes:near,OutCh:near,Out16:near,Hex:near
- extrn CrLf:near
-
- WinMsg db "WinMsg"," "+80H
- LoadMsg db " Load"," "+80H
- LoadLabs db " Ordinal", " "+80H
- db " Segment", " "+80H
- db " Instance", " "+80H
- MoveLabs db " Segment moving from", " "+80H
- db " to", " "+80H
- DiscardMsg db " Discard segment", " "+80H
- InitHeapMsg db " Heap initialized to", " "+80H
- PrintMsg db " String:", " "+80H
- StartProgMsg db " Start program Id", " "+80H
- EndProgMsg db " End program Id", " "+80H
- EndFocusMsg db " End", " "+80H
- StartFocusMsg db " Start", " "+80H
- FocusMsg db "focus DGroup", " "+80H
- db " Id", " "+80H
- UnknownMsg db " Use unknown", " "+80H
-
- WinSig label byte
- db 0E9H ;near JMP
- dw WinMessage - (100H - 2)
- org WinSig + 5
- db "SEGDEBUG",0
- cbWinSig = $ - WinSig
-
- tWinDisp label word
- dw WinMsg0
- dw WinMsg1
- dw WinMsg2
- dw WinMsg3
- dw WinMsg4
- dw WinMsg5
- dw WinMsg6
- dw WinMsg7
- dw WinMsg8
- dw WinMsg9
- dw WinMsg10
- dw WinMsg11
- dw WinMsg12
- dw WinMsg13
- dw WinMsg14
- LastMsg = ($ - tWinDisp)/2
- dw WinMsg15 ;Unused
-
- cProc WinMessage <FAR>,<ds,si,di>
- ParmW Action
- ParmW p1
- ParmW p2
- ParmW Ordinal
- ParmW SegVal
- ParmW Instance
- cBegin
- mov ax,[Action]
- push cs
- pop ds
- push cs
- pop es
- mov si,offset DGroup:WinMsg
- call PrintMes
- mov ax,[Action]
- mov bx,ax
- cmp ax,10 ;Two digit number?
- jb OneDigit
- aam ;Convert to unpacked BCD
- xchg al,ah
- or al,"0"
- call OutCh
- xchg al,ah
- OneDigit:
- or al,"0"
- call OutCh
- cmp bx,LastMsg ;Bigger than our table?
- jbe MsgOk
- mov bx,LastMsg+1 ;Limit to end of table
- MsgOk:
- shl bx,1 ;Index into table
- jmp [bx].tWinDisp
-
- WinMsg0:
- ;Load new segment
- mov si,offset DGroup:LoadMsg
- call PrintMes
- lds si,dword ptr [p1] ;First arg is pointer to name
- PrintName:
- lodsb
- or al,al
- jz NameDone
- call OutCh
- jmp PrintName
-
- ;SymDeb handles messages 0 - 9. Here's labels for the rest in case we figure
- ;out what they're for.
-
- WinMsg5:
- WinMsg6:
- WinMsg7:
- WinMsg8:
- WinMsg9:
- WinMsg10:
- WinMsg15:
- ;A message we don't understand
- mov si,offset DGroup:UnknownMsg
- call PrintMes
- ;Print two word arguments
- mov dx,[p1]
- call Out16
- mov al,","
- call OutCh
- mov dx,[p2]
- call Out16
- WinMessageExit:
- call CrLf
- NoMessage:
- cEnd WinMessage
-
- NameDone:
- push cs
- pop ds
- mov si,offset DGroup:LoadLabs
- call PrintMes ;Print label
- mov ax,[Ordinal]
- call Hex ;Print 2 hex digits
- call PrintMes
- mov dx,[SegVal]
- call Out16
- call PrintMes
- mov ax,[Instance]
- call Hex
- jmp WinMessageExit
-
- WinMsg1:
- ;Memory movement
- cmp [p2],0 ;Is destination zero?
- jz WinMsg2 ;Same as Msg 2, Discard
- mov si,offset DGroup:MoveLabs
- call PrintMes
- mov dx,[p1] ;First arg is old location
- call Out16
- call PrintMes
- mov dx,[p2]
- call Out16
- jmp WinMessageExit
-
- WinMsg2:
- ;Discard segment
- mov si,offset DGroup:DiscardMsg
- call PrintMes
- mov dx,[p1] ;First arg is segment
- call Out16
- jmp WinMessageExit
-
- WinMsg3:
- ;Heap initialization
- mov si,offset DGroup:InitHeapMsg
- call PrintMes
- mov dx,[p1] ;First arg is pGlobalHeap
- call Out16
- jmp WinMessageExit
-
- WinMsg4:
- ;Print message
- mov si,offset DGroup:PrintMsg
- call PrintMes
- lds si,dword ptr [p1]
- mov cx,[Ordinal]
- jcxz WinMessageExit
- PrintLoop:
- lodsb
- call OutCh
- loop PrintLoop
- push cs
- pop ds
- jmp WinMessageExit
-
- WinMsg11:
- ;Start program
- mov si,offset DGroup:StartProgMsg
- jmp short ProgMsg
-
- WinMsg12:
- ;End program
- mov si,offset DGroup:EndProgMsg
- ProgMsg:
- call PrintMes
- mov ax,[p1] ;First arg is ordinal
- call Hex
- jmp WinMessageExit
-
- WinMsg13:
- ;End focus
- mov si,offset DGroup:EndFocusMsg
- call PrintMes
- mov si,offset DGroup:FocusMsg
- jmp short NewFocus
-
- WinMsg14:
- ;Start focus
- mov si,offset DGroup:StartFocusMsg
- call PrintMes
- NewFocus:
- call PrintMes
- mov dx,[p1] ;First arg is DGroup
- call Out16
- call PrintMes
- mov ax,[p2] ;Second arg is ID
- call Hex
- jmp WinMessageExit
-
-
- ;************************************************************
-
- InitSeg segment
- assume cs:DGroup,ds:Dgroup
-
- push cs
- pop es
- mov di,offset DGroup:Monitor - 5 ;Start of signature area
- mov si,offset DGroup:WinSig
- mov cx,cbWinSig
- rep movsb
- ;Will now fall into next module's init code
- InitSeg ends
-
- end
-