load 'macros.dump' include 'driver.equ' ;----------------------------------------------- ; ; Imported addresses ; ;----------------------------------------------- ;----------------------------------------------- ; ; Forward addresses and entries ; ;----------------------------------------------- ENTRY AbortButton ENTRY AbortText ENTRY BreakButton ENTRY BreakText ENTRY ButtonTxt ENTRY CancelBut ENTRY CancelTxt ENTRY Debug ENTRY DebugMsg ENTRY Int1 ENTRY Int1MsgSTART ENTRY Int2 ENTRY Int2MsgSTART ENTRY OKBut ;keep obj/pdbg INCLUDE 'mac/pdbg.mac' INCLUDE 'tools/pdbgtool.s' ; ; File contains: ; BrakeCheck (brk if option key is down) ; WaitMouse (wait for mouse click) ; Debug (alert w/ various output/tracing...) ; DebugNum (alert prints 1 longint) ; ;--------------------------------------------------------------------------- ; ; BrakeCheck ; BrakeCheck PROC EXPORT EXPORT P_BrakeCheck P_BrakeCheck ; ;Using P_DATA input TheStr:l begin Exit return ENDP ;--------------------------------------------------------------------------- ; ; DebugNum(num:long) ; DebugNum PROC EXPORT ;Using DebugData input var:l begin ; spacelong ; _GetPort ; ; movelong #Generic,DebugMsgText ; ; tool _Long2Hex,in=(var:l,#Int1MsgText:l,#8:w) ; ; call D_SetCursor,in=(#0:w) ; spaceword ; pushlong #SimpAlert ; pushlong #0 ; _Alert ; pla ; ; _SetPort return ENDP ;--------------------------------------------------------------------------- ; ; CkErr ; CkErr PROC EXPORT local foo:b error err tax bcc Borrring begin +b pushlong #ErrString pushword #0 phx stx err lda foo+5 and #$FF pha lda foo+3 pha pushlong #0 jsl Debug return Borrring rtl ErrString STR 'Error / Location:' ENDP ;---------------------------------------------------------------------- ; Debug(msg:ptr; var1:long; var2:long; routine:addr) ; ; USAGE: prints out string located at msg (if zero, prints ; default msg). Prints var1,2 in hex. ; OK button: call routine (if not zero) ; Cancel button: don't call routine ; Abort button: attempt to shut down program ; Break button: execute a brk instruction ; Debug PROC EXPORT ;Using DebugData input Msg:l,var1:l,var2:l,NextRoutine:l begin _SysBeep _SysBeep _SysBeep ; lda Msg ; cmp Msg+2 ; bne Cont ; ; movelong #Generic,Msg ; ;Cont lda (Msg) ; and #$00FF ; sta DebugMsgLen ; movelong Msg,DebugMsgText ; ; pushlong var1 ; pushlong #Int1MsgText ; pushword #8 ; _Long2Hex ; ; pushlong var2 ; pushlong #Int2MsgText ; pushword #8 ; _Long2Hex ; ; spacelong ; _GetPort ; ; call D_SetCursor,in=(#0:w) ; spaceword ; pushlong #DebugAlert ; pushlong #0 ; _Alert ; pla ; ; cmp #2 ; abort msg ; beq die ; cmp #4 ; bne DontDie ; brk ; brl bye ; after the break... (ha!) ;DontDie cmp #1 ; continue w/ debug ; jne bye ; ; lda NextRoutine ; ora NextRoutine+2 ; jeq bye ; ; _SetPort ; pushlong var1 ; pushlong var2 ; ;; ; Hack!!!!! ; lda NextRoutine ; sta Foo+1 ; lda Nextroutine+1 ; sta Foo+2 ; ;Foo jsl ; ; jsl nextroutine ; jmp bye ; ; ;die anop ; _DeskShutdown ; _FMShutdown ; _SFShutdown ; _CtlShutdown ; _DialogShutdown ; _EMShutdown ; _LEShutdown ; _MenuShutdown ; _WindShutdown ; _QDAuxShutdown ; _QDShutdown ; _MTShutdown ; ; PushWord #1 ; _MMShutdown ; _TLShutdown ; ; _Quit DbgQuitParams ; ; ; ;bye _SetPort return ENDP ;--------------------------------------------------------------------------- ; ; PutNum ; PutNum PROC EXPORT input num:w local rgn:l begin +b ; spacelong ; _GetClipHandle ; ; spacelong ; _NewRgn ; pulllong rgn ; ; pushlong rgn ; _SetClipHandle ; ; pushlong #D_BoxRect ; _ClipRect ; ; pushword num ; pushlong #TheSTR ; pushword #4 ; _Int2Hex ; ; pushlong #TheSTR ; pushword #4 ; pushlong #D_BoxRect ; pushword #0 ; _LETextBox ; ; pushlong rgn ; _DisposeRgn ; ; _SetClipHandle ; return ;TheSTR DS 4 ;D_BoxRect DC i'152,1,162,36' ENDP ;---------------------------------------------------------------------- ; DebugData PROC EXPORT EXPORT Generic EXPORT DebugAlert EXPORT OKBut EXPORT ButtonTxt EXPORT AbortButton EXPORT AbortText EXPORT CancelBut EXPORT CancelTxt EXPORT BreakButton EXPORT BreakText EXPORT DebugMsg EXPORT DebugMsgText EXPORT DebugMsgLen EXPORT Int1 EXPORT Int1Msg EXPORT Int1MsgSTART EXPORT Int1MsgText EXPORT Int2 EXPORT Int2Msg EXPORT Int2MsgSTART EXPORT Int2MsgText EXPORT DbgQuitParams EXPORT SimpAlert Generic STR 'DEBUG:' ;Generic STR 'Message? We don''''t need no stinking message!' DebugAlert DC.W 90,140,144,500 DC.W 729 ; a 'unique' ID DC.B %10000000 DC.B %10000000 DC.B %10000000 DC.B %10000000 DC.L OKBut DC.L CancelBut DC.L AbortButton DC.L BreakButton DC.L DebugMsg DC.L Int1 DC.L Int2 DC.L 0 ; terminator OKBut DC.W 1 DC.W 36,295,49,355 DC.W $000A ; Button DC.L ButtonTxt DC.W 0 DC.W 0 DC.L 0 ButtonTxt STR 'Cont.' AbortButton DC.W 2 DC.W 36,165,49,225 DC.W $000A DC.L AbortText DC.W 0 DC.W 0 DC.L 0 AbortText STR 'Abort' CancelBut DC.W 3 DC.W 36,230,49,290 DC.W $000A DC.L CancelTxt DC.W 0 DC.W 0 DC.L 0 CancelTxt STR 'Cancel' BreakButton DC.W 4 DC.W 36,100,49,160 DC.W $000A DC.L BreakText DC.W 0 DC.W 0 DC.L 0 BreakText STR 'Break' DebugMsg DC.W 5 DC.W 10,10,23,350 DC.W $800F DebugMsgText DC.L 0 DebugMsgLen DC.W 0 Int1 DC.W 6 DC.W 23,10,36,150 DC.W $800F Int1Msg DC.L Int1MsgSTART DC.W 0 Int1MsgSTART DC.B 10 DC.B '0x' Int1MsgText DS.B 8 Int2 DC.W 7 DC.W 36,10,49,99 DC.W $800F Int2Msg DC.L Int2MsgSTART DC.W 0 Int2MsgSTART DC.B 10 DC.B '0x' Int2MsgText DS.B 8 DbgQuitParams DC.L 0 DC.W $0000 SimpAlert DC.W 40,140,94,500 DC.W 934 ; a 'unique' ID DC.B %10000000 DC.B %10000000 DC.B %10000000 DC.B %10000000 DC.L OKBut DC.L DebugMsg DC.L Int1 DC.L 0 ; terminator ENDP END