antoine-source/appleworksgs/PL/Src/PDBG.S

1 line
5.9 KiB
ArmAsm
Raw Normal View History

2023-03-04 02:45:20 +00:00
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 ; ; _Set