sys7.1-doc-wip/OS/SCSIMgr4pt3/Debug.a
2019-07-27 22:37:48 +08:00

253 lines
7.1 KiB
Plaintext

;==========================================================================
;
; File: Debug.a
;
; Contains: Some useful macros for debugging
;
; Written by: Paul Wolf
;
; Copyright: © 1990-1993 by Apple Computer, Inc., all rights reserved.
;
; Change History (most recent first):
;
; <SM17> 11/22/93 pdw Added useINITDebugger default to on.
; <SM16> 11/22/93 pdw Rolling in from <MCxx>.
; <MC6> 11/10/93 pdw Added ERR_RECORD_ON.
; <MC5> 11/8/93 pdw Better definitions for ROM build.
; <MC4> 11/7/93 pdw Turned off all recording except call recording (SCSIDispatch and
; SCSIAtomic and callbacks).
; <MC3> 10/28/93 pdw New defines.
; <SM15> 10/29/93 DCB <MC> roll-in.
; <MC3> 10/28/93 pdw New defines.
; <SM14> 10/14/93 pdw Debug.a
; <MC2> 10/12/93 pdw Added support for Synchronous data transfers, rewrote State
; Machine, message handling etc.
; <SM13> 9/9/93 pdw Lots of little changes. Name changes, temporary cache_bug
; stuff.
; <SM12> 8/13/93 pdw Added RecordRCMD macro.
; <SM11> 7/17/93 pdw Don't remember.
; <SM10> 7/8/93 pdw Adding StopRecordOnFull.
; <SM9> 6/29/93 pdw Minor stuff.
; <SM8> 5/26/93 PW Adding symbol forAMD.
; <SM7> 5/25/93 DCB Rollin from Ludwig. (The next item below)
; <LW7> 5/21/93 PW Moved definition of Include_Debugger_Names up to before its
; first use. Added DebugStr in addition to IfDebugStr.
; <SM6> 5/5/93 PW Converted names to meanies-friendly names. Updated with latest
; from Ludwig stuff.
; <LW5> 5/1/93 PW Put in RECORD_rCMD and forC96Init definitions (should only be in
; Debug.a now).
; <LW4> 4/30/93 DCB Changing default RECORD_ON to 0 for final Candidate
; <LW2> 3/26/93 PW Added RECORD_ON definition here since this seems like an
; appropriate place for it.
; <SM3> 10/8/92 PW Added GROSS_CHECK default rule. Added IF...ENDIF around
; DebugStr.
; <SM2> 10/5/92 PW Made DebugStr macro use pascal strings.
; <SM1> 7/27/92 PW Initial check-in.
;
;==========================================================================
; <SM3> pdw
;—————————————————————————————
; DefaultTo
;—————————————————————————————
MACRO
DefaultTo &SymbolToDefine, &value
;—————————————————————————————
IF (&TYPE(&SymbolToDefine) = 'UNDEFINED') THEN
&SymbolToDefine: EQU &value
ENDIF
ENDM
; DefaultTo STACK_RECORD_ON, 0
; The idea here is to put the values that you want the final ROM built with here and
; to specify (on your build line or in the .IttInit makefile) any values other than
; these defaults.
IF (&TYPE('DEBUGGING') = 'UNDEFINED') THEN
DEBUGGING: EQU 0
ENDIF
IF (&TYPE('RECORD_NONCACHABLE') = 'UNDEFINED') THEN
RECORD_NONCACHABLE: EQU 0
ENDIF
IF (&TYPE('TAPE_LENGTH') = 'UNDEFINED') THEN
TAPE_LENGTH: EQU 1024
ENDIF
IF (&TYPE('RECORD_ON') = 'UNDEFINED') THEN
RECORD_ON: EQU 0
ENDIF
IF (&TYPE('STACK_RECORD_ON') = 'UNDEFINED') THEN
STACK_RECORD_ON: EQU 0
ENDIF
IF (&TYPE('CALL_RECORD_ON') = 'UNDEFINED') THEN
CALL_RECORD_ON: EQU 1
ENDIF
IF (&TYPE('ERR_RECORD_ON') = 'UNDEFINED') THEN
ERR_RECORD_ON: EQU 1
ENDIF
IF (&TYPE('RECORD_rCMD') = 'UNDEFINED') THEN
RECORD_rCMD: EQU 0
ENDIF
IF (&TYPE('StopRecordOnFull') = 'UNDEFINED') THEN
StopRecordOnFull: EQU 0
ENDIF
IF (&TYPE('forAMD') = 'UNDEFINED') THEN
forAMD: EQU 0
ENDIF
IF (&TYPE('noSCSIInts') = 'UNDEFINED') THEN
noSCSIInts: EQU 0
ENDIF
IF (&TYPE('PARITY_ENABLED') = 'UNDEFINED') THEN
PARITY_ENABLED: EQU 0
ENDIF
IF (&TYPE('GROSS_CHECK') = 'UNDEFINED') THEN
GROSS_CHECK: EQU 0
ENDIF
IF (&TYPE('forC96Init') = 'UNDEFINED') THEN
forC96Init: EQU 0
ENDIF
IF (&TYPE('useINITDebugger') = 'UNDEFINED') THEN
useINITDebugger: EQU 1
ENDIF
IF (&TYPE('GPHYSICAL') = 'UNDEFINED') THEN
GPHYSICAL: EQU 1
ENDIF
IF (&TYPE('INDEXED_IS_FASTER') = 'UNDEFINED') THEN
INDEXED_IS_FASTER: EQU 1
ENDIF
IF (&TYPE('PAGE_SIZE') = 'UNDEFINED') THEN
PAGE_SIZE: EQU 8192
ENDIF
IF (&TYPE('Include_Debugger_Names') = 'UNDEFINED') THEN
Include_Debugger_Names: EQU 1
ENDIF ; <SM3> pdw
; ———————— Macros: ———————————————————————————————————————————————
;—————————————————————————————
; DebugStr
;—————————————————————————————
MACRO
DebugStr &PString
;—————————————————————————————
STRING PASCAL ;
pea #&PString
_debugstr
STRING ASIS ;
ENDM
;—————————————————————————————
; IfDebugStr
;—————————————————————————————
MACRO
IfDebugStr &PString
;—————————————————————————————
STRING PASCAL ;
IF DEBUGGING THEN ;
pea #&PString
_debugstr
ELSE
nop
ENDIF
STRING ASIS ;
ENDM
;—————————————————————————————
; NAME
;—————————————————————————————
MACRO
NAME &PString
;—————————————————————————————
STRING PASCAL
IF Include_Debugger_Names THEN
dc.b $80, &PString
dc.w $0000
STRING ASIS
ENDIF
ENDM
;—————————————————————————————
; RTSNAME
;—————————————————————————————
MACRO
RTSNAME &PString
;—————————————————————————————
STRING PASCAL
IF Include_Debugger_Names THEN
rts
dc.b $80, &PString
dc.w $0000
STRING ASIS
ENDIF
ENDM
;—————————————————————————————
; BraNAME
;—————————————————————————————
MACRO
BraNAME &PString
;—————————————————————————————
STRING PASCAL
IF Include_Debugger_Names THEN
bra.s @bra99
rts
dc.b $80, &PString
dc.w $0000
@bra99
STRING ASIS
ENDIF
ENDM
;—————————————————————————————
; RecCmd
;—————————————————————————————
MACRO
RecCmd &CmdCode,&FileLetter,&EventNumber
; in quotes
;—————————————————————————————
IF RECORD_ON and RECORD_rCMD THEN
pea 'rCMD' ;
move.w #(&FileLetter<<8)+&EventNumber, -(sp)
move.w #&CmdCode, -(sp)
bsr RecordEvent
addq.l #8, sp
ENDIF
ENDM