mirror of
https://github.com/elliotnunn/supermario.git
synced 2024-11-29 20:49:19 +00:00
502 lines
12 KiB
Plaintext
502 lines
12 KiB
Plaintext
; File SlotTraps.a
|
||
;
|
||
; Copyright Apple Computer, Inc. 1986-1990
|
||
; All Rights Reserved
|
||
;
|
||
; This file is used in these builds: ROM System
|
||
;
|
||
;implements the interface for register based traps.
|
||
;
|
||
; Change History (most recent first):
|
||
;
|
||
; <5> 7/17/91 JL Moved SlotManager Macro towards front of file. Otherwise build
|
||
; of glue lib with the obsolete glue in it fails.
|
||
; <4> 12/14/90 dba <JDR> move a lot of calls to the obsolete section, including
|
||
; Slot Mgr. and CountADBs
|
||
; <3> 11/5/90 dba move obsolete routines to the end of the file
|
||
; <2> 10/2/90 JAL Some cleanup.
|
||
; modifications:
|
||
; 28 Mar 87 KLH removed SGetColorIcon, SDisposePtr, SMacBoot & SNewPtr.
|
||
; 6 Jun 87 KLH added OpenSlot.
|
||
; 8 Jun 87 KLH GetVideoDefault, SetVideoDefault, GetOSDefault, & SetOSDefault
|
||
; build param blocks. Added GetTimeout & SetTimeout.
|
||
; 24 Jun 87 KLH StripAddress glue changed to work w/o trap.
|
||
; 2 Jul 87 KLH StripSddress time saving flag removed for safety.
|
||
; *** MPW 2.0 ***
|
||
; 18 Aug 87 KLH SIntInstall & SIntRemove parameter order corrected.
|
||
; *** MPW 3.0d2 ***
|
||
; 6 Jan 88 KLH SlotVInstall & SlotVRemove parameter order corrected.
|
||
; *** MPW 3.0d3 ***
|
||
; 9 Feb 88 KLH GetTimeout & SetTimeout use selector in A0.
|
||
; *** MPW 3.0a2 ***
|
||
; 9 Aug 88 KLH Added SFindBigDevBase.
|
||
;--------------------------------------------------------
|
||
|
||
STRING ASIS
|
||
|
||
include 'Traps.a'
|
||
|
||
obsoleteGlue equ 0 ; stuff conditionalized by this can be moved to a separate file
|
||
|
||
ROM85 EQU $28E
|
||
Lo3Bytes EQU $31A ; constant $00FFFFFF [long]
|
||
|
||
; This macro pops the return address into A1, then gets the parameter
|
||
; block pointer and puts it into A0. The selector value is passed to the
|
||
; macro and put into D0. Then the Slot Manager is called. Status returned
|
||
; in D0 is pushed on the stack. Return is made via a JMP (A1).
|
||
|
||
MACRO
|
||
SlotManager
|
||
MOVE.L (SP)+,A1 ;get return address
|
||
MOVE.L (SP)+,A0 ;get param block ptr
|
||
MOVEQ #&SYSLIST[1],D0 ;put selector in D0
|
||
_SlotManager
|
||
MOVE.W D0,(SP) ;push status
|
||
JMP (A1) ;return
|
||
ENDM
|
||
|
||
; PRINCIPAL
|
||
_sReadByte EQU $00
|
||
_sReadWord EQU $01
|
||
_sReadLong EQU $02
|
||
_sGetcString EQU $03
|
||
_sGetBlock EQU $05
|
||
_sFindStruct EQU $06
|
||
_sReadStruct EQU $07
|
||
; SPECIAL
|
||
_sReadInfo EQU $10
|
||
_sReadPRAMrec EQU $11
|
||
_sPutPRAMRec EQU $12
|
||
_sReadFHeader EQU $13
|
||
_sNextsRsrc EQU $14
|
||
_sNextTypesRsrc EQU $15
|
||
_sRsrcInfo EQU $16
|
||
_sCkCardStat EQU $18
|
||
_sReadDrvrName EQU $19
|
||
_sFindDevBase EQU $1B
|
||
_sFindBigDevBase EQU $1C
|
||
; Advanced
|
||
_initSDeclMgr EQU $20
|
||
_sPrimaryInit EQU $21
|
||
_sCardChanged EQU $22
|
||
_sExec EQU $23
|
||
_sOffsetData EQU $24
|
||
_sInitPRAMRecs EQU $25
|
||
_sReadPBSize EQU $26
|
||
_sCalcStep EQU $28
|
||
_sInitsRsrcTable EQU $29
|
||
_sSearchSRT EQU $2A
|
||
_sUpdateSRT EQU $2B
|
||
_sCalcsPointer EQU $2C
|
||
_sGetDriver EQU $2D
|
||
_sPtrToSlot EQU $2E
|
||
_sFindsInfoRecPtr EQU $2F
|
||
_sFindsRsrcPtr EQU $30
|
||
_sDeleteSRTRec EQU $31
|
||
|
||
;Memory Manager
|
||
|
||
;FUNCTION StripAddress(theAddress: Ptr): Ptr;
|
||
|
||
StripAddress FUNC EXPORT
|
||
|
||
MOVE.L (SP)+,A1 ;get the return address
|
||
MOVE.L (SP)+,D0 ;get the address
|
||
|
||
BTST #6,ROM85
|
||
BNE.S @noTrap
|
||
|
||
_StripAddress
|
||
MOVE.L D0,(SP) ;return the stripped address
|
||
JMP (A1)
|
||
|
||
@noTrap
|
||
AND.L Lo3Bytes,D0 ;old fashioned brute force.
|
||
MOVE.L D0,(SP) ;return the stripped address
|
||
JMP (A1)
|
||
|
||
;Apple Desktop Bus
|
||
|
||
;FUNCTION ADBOp(data: Ptr; compRout: ProcPtr; buffer: Ptr; commandNum: Integer): OsErr;
|
||
|
||
ADBOp FUNC EXPORT
|
||
MOVE.L (SP)+,A1 ;get the return address
|
||
MOVE.W (SP)+,D0 ;get command number
|
||
MOVE.L SP,A0 ;point to parameter block on stack
|
||
_ADBOp
|
||
LEA 12(SP),SP ;restore stack to its pristine state
|
||
MOVE.W D0,(SP) ;return error
|
||
|
||
JMP (A1)
|
||
|
||
;FUNCTION GetIndADB(VAR info: ADBDataBlock; devTableIndex: Integer): ADBAddress;
|
||
|
||
GetIndADB FUNC EXPORT
|
||
MOVE.L (SP)+,A1 ;get the return address
|
||
MOVE.W (SP)+,D0 ;get entry index
|
||
MOVE.L (SP)+,A0 ;addr of parameter block, passed as ptr
|
||
_GetIndADB
|
||
MOVE.B D0,(SP) ;return ADB address
|
||
|
||
JMP (A1)
|
||
|
||
;FUNCTION GetADBInfo(VAR info: ADBDataBlock; ADBAddr: ADBAddress): OsErr;
|
||
|
||
GetADBInfo FUNC EXPORT
|
||
MOVE.L (SP)+,A1 ;get the return address
|
||
MOVE.B (SP)+,D0 ;get ADB address
|
||
MOVE.L (SP)+,A0 ;addr of parameter block, passed as ptr
|
||
_GetADBInfo
|
||
MOVE.W D0,(SP) ;return OsErr
|
||
|
||
JMP (A1)
|
||
|
||
;FUNCTION SetADBInfo(VAR info: ADBSetInfoBlock; ADBAddr: ADBAddress): OsErr;
|
||
|
||
SetADBInfo FUNC EXPORT
|
||
MOVE.L (SP)+,A1 ;get the return address
|
||
MOVE.B (SP)+,D0 ;get ADB address
|
||
MOVE.L (SP)+,A0 ;addr of parameter block, passed as ptr
|
||
_SetADBInfo
|
||
MOVE.W D0,(SP) ;return OsErr
|
||
|
||
JMP (A1)
|
||
|
||
;PROCEDURE GetTimeout(VAR count: INTEGER);
|
||
|
||
GetTimeout PROC EXPORT
|
||
|
||
_GetTimeout ; A0 := 0; _InternalWait
|
||
|
||
MOVE.L (SP)+,A1 ; Get the return address
|
||
MOVE.L (SP)+,A0 ; Get the VAR address
|
||
MOVE.W D0,(A0) ; count
|
||
|
||
JMP (A1)
|
||
|
||
;PROCEDURE SetTimeout(count: INTEGER);
|
||
|
||
SetTimeout PROC EXPORT
|
||
|
||
MOVE.L (SP)+,A1 ; Get the return address
|
||
MOVE.W (SP)+,D0 ; count
|
||
_SetTimeout ; A0 := 1; _InternalWait
|
||
|
||
JMP (A1)
|
||
|
||
;FUNCTION OpenSlot(paramBlock: ParmBlkPtr; aSync: BOOLEAN): OSErr;
|
||
|
||
OpenSlot PROC EXPORT
|
||
|
||
Move.L (SP)+,A1 ;get return address
|
||
Move.B (SP)+,D0 ;Get ASync flag.
|
||
Move.L (SP)+,A0 ;get param pointer.
|
||
BNE.S @1
|
||
_Open immed
|
||
BrA.S @2
|
||
@1 _Open async,immed ;no reason they can’t be async.
|
||
@2 Move.W D0,(SP) ;save result
|
||
Jmp (A1) ;return to caller
|
||
|
||
;----------------------------------------------------------------------
|
||
|
||
if obsoleteGlue then
|
||
|
||
;----------------------------------------------------------------------
|
||
|
||
;PROCEDURE GetDefaultStartup(defaultStartPtr: StartDevPtr);
|
||
|
||
GetDefaultStartup PROC EXPORT
|
||
|
||
MOVE.L (SP)+,A1 ;get the return address
|
||
MOVE.L (SP)+,A0 ;addr of parameter block, passed as ptr
|
||
_GetDefaultStartup
|
||
|
||
JMP (A1)
|
||
|
||
;PROCEDURE SetDefaultStartup(defaultStartPtr: DefStartPtr);
|
||
|
||
SetDefaultStartup PROC EXPORT
|
||
|
||
MOVE.L (SP)+,A1 ;get the return address
|
||
MOVE.L (SP)+,A0 ;addr of parameter block, passed as ptr
|
||
_SetDefaultStartup
|
||
|
||
JMP (A1)
|
||
|
||
;PROCEDURE GetVideoDefault(defaultVidPtr: DefVideoPtr);
|
||
|
||
GetVideoDefault PROC EXPORT
|
||
|
||
MOVE.L (SP)+,A1 ;get the return address
|
||
MOVE.L (SP)+,A0 ;addr of parameter block, passed as ptr
|
||
_GetVideoDefault
|
||
|
||
JMP (A1)
|
||
|
||
;PROCEDURE SetVideoDefault(defaultVidPtr: DefVideoPtr);
|
||
|
||
SetVideoDefault PROC EXPORT
|
||
|
||
MOVE.L (SP)+,A1 ;get the return address
|
||
MOVE.L (SP)+,A0 ;addr of parameter block, passed as ptr
|
||
_SetVideoDefault
|
||
|
||
JMP (A1)
|
||
|
||
;PROCEDURE SetOSDefault(defaultOSPtr: DefOSPtr);
|
||
|
||
SetOSDefault PROC EXPORT
|
||
|
||
MOVE.L (SP)+,A1 ;get the return address
|
||
MOVE.L (SP)+,A0 ;addr of parameter block, passed as ptr
|
||
_SetOSDefault
|
||
|
||
JMP (A1)
|
||
|
||
;PROCEDURE GetOSDefault(defaultOSPtr: DefOSPtr);
|
||
|
||
GetOSDefault PROC EXPORT
|
||
|
||
MOVE.L (SP)+,A1 ;get the return address
|
||
MOVE.L (SP)+,A0 ;addr of parameter block, passed as ptr
|
||
_GetOSDefault
|
||
|
||
JMP (A1)
|
||
|
||
;FUNCTION CountADBs: Integer;
|
||
|
||
CountADBs FUNC EXPORT
|
||
MOVE.L (SP)+,A1 ;get the return address
|
||
_CountADBs
|
||
MOVE.W D0,(SP) ;return count
|
||
|
||
JMP (A1)
|
||
|
||
|
||
; { Principal }
|
||
;FUNCTION SReadByte(spBlkPtr: SpBlockPtr): OSErr;
|
||
SReadByte FUNC EXPORT
|
||
SlotManager _sReadByte
|
||
|
||
;FUNCTION SReadWord(spBlkPtr: SpBlockPtr): OSErr;
|
||
SReadWord FUNC EXPORT
|
||
SlotManager _sReadWord
|
||
|
||
;FUNCTION SReadLong(spBlkPtr: SpBlockPtr): OSErr;
|
||
SReadLong FUNC EXPORT
|
||
SlotManager _sReadLong
|
||
|
||
;FUNCTION SGetcString(spBlkPtr: SpBlockPtr): OSErr;
|
||
SGetcString FUNC EXPORT
|
||
SlotManager _sGetcString
|
||
|
||
;FUNCTION SGetBlock(spBlkPtr: SpBlockPtr): OSErr;
|
||
SGetBlock FUNC EXPORT
|
||
SlotManager _sGetBlock
|
||
|
||
;FUNCTION SFindStruct(spBlkPtr: SpBlockPtr): OSErr;
|
||
SFindStruct FUNC EXPORT
|
||
SlotManager _sFindStruct
|
||
|
||
;FUNCTION SReadStruct(spBlkPtr: SpBlockPtr): OSErr;
|
||
SReadStruct FUNC EXPORT
|
||
SlotManager _sReadStruct
|
||
|
||
; { Special }
|
||
;FUNCTION SReadInfo(spBlkPtr: SpBlockPtr): OSErr;
|
||
SReadInfo FUNC EXPORT
|
||
SlotManager _sReadInfo
|
||
|
||
;FUNCTION SReadPRAMRec(spBlkPtr: SpBlockPtr): OSErr;
|
||
SReadPRAMRec FUNC EXPORT
|
||
SlotManager _sReadPRAMRec
|
||
|
||
;FUNCTION SPutPRAMRec(spBlkPtr: SpBlockPtr): OSErr;
|
||
SPutPRAMRec FUNC EXPORT
|
||
SlotManager _sPutPRAMRec
|
||
|
||
;FUNCTION SReadFHeader(spBlkPtr: SpBlockPtr): OSErr;
|
||
SReadFHeader FUNC EXPORT
|
||
SlotManager _sReadFHeader
|
||
|
||
;FUNCTION SNextsRsrc(spBlkPtr: SpBlockPtr): OSErr;
|
||
SNextsRsrc FUNC EXPORT
|
||
SlotManager _sNextsRsrc
|
||
|
||
;FUNCTION SNextTypesRsrc(spBlkPtr: SpBlockPtr): OSErr;
|
||
SNextTypesRsrc FUNC EXPORT
|
||
SlotManager _sNextTypesRsrc
|
||
|
||
;FUNCTION SRsrcInfo(spBlkPtr: SpBlockPtr): OSErr;
|
||
SRsrcInfo FUNC EXPORT
|
||
SlotManager _sRsrcInfo
|
||
|
||
;FUNCTION SCkCardStat(spBlkPtr: SpBlockPtr): OSErr;
|
||
SCkCardStat FUNC EXPORT
|
||
SlotManager _sCkCardStat
|
||
|
||
;FUNCTION SReadDrvrName(spBlkPtr: SpBlockPtr): OSErr;
|
||
SReadDrvrName FUNC EXPORT
|
||
SlotManager _sReadDrvrName
|
||
|
||
;FUNCTION SFindDevBase(spBlkPtr: SpBlockPtr): OSErr;
|
||
SFindDevBase FUNC EXPORT
|
||
SlotManager _sFindDevBase
|
||
|
||
;FUNCTION SFindBigDevBase(spBlkPtr: SpBlockPtr): OSErr;
|
||
SFindBigDevBase FUNC EXPORT
|
||
SlotManager _sFindBigDevBase
|
||
|
||
; { Advanced }
|
||
;FUNCTION InitSDeclMgr(spBlkPtr: SpBlockPtr): OSErr;
|
||
InitSDeclMgr FUNC EXPORT
|
||
SlotManager _initSDeclMgr
|
||
|
||
;FUNCTION SPrimaryInit(spBlkPtr: SpBlockPtr): OSErr;
|
||
SPrimaryInit FUNC EXPORT
|
||
SlotManager _sPrimaryInit
|
||
|
||
;FUNCTION SCardChanged(spBlkPtr: SpBlockPtr): OSErr;
|
||
SCardChanged FUNC EXPORT
|
||
SlotManager _sCardChanged
|
||
|
||
;FUNCTION SExec(spBlkPtr: SpBlockPtr): OSErr;
|
||
SExec FUNC EXPORT
|
||
SlotManager _sExec
|
||
|
||
;FUNCTION SOffsetData(spBlkPtr: SpBlockPtr): OSErr;
|
||
SOffsetData FUNC EXPORT
|
||
SlotManager _sOffsetData
|
||
|
||
;FUNCTION SInitPRAMRecs(spBlkPtr: SpBlockPtr): OSErr;
|
||
SInitPRAMRecs FUNC EXPORT
|
||
SlotManager _sInitPRAMRecs
|
||
|
||
;FUNCTION SReadPBSize(spBlkPtr: SpBlockPtr): OSErr;
|
||
SReadPBSize FUNC EXPORT
|
||
SlotManager _sReadPBSize
|
||
|
||
;FUNCTION SCalcStep(spBlkPtr: SpBlockPtr): OSErr;
|
||
SCalcStep FUNC EXPORT
|
||
SlotManager _sCalcStep
|
||
|
||
;FUNCTION SInitsRsrcTable(spBlkPtr: SpBlockPtr): OSErr;
|
||
SInitsRsrcTable FUNC EXPORT
|
||
SlotManager _sInitsRsrcTable
|
||
|
||
;FUNCTION SSearchSRT(spBlkPtr: SpBlockPtr): OSErr;
|
||
SSearchSRT FUNC EXPORT
|
||
SlotManager _sSearchSRT
|
||
|
||
;FUNCTION SUpdateSRT(spBlkPtr: SpBlockPtr): OSErr;
|
||
SUpdateSRT FUNC EXPORT
|
||
SlotManager _sUpdateSRT
|
||
|
||
;FUNCTION SCalcsPointer(spBlkPtr: SpBlockPtr): OSErr;
|
||
SCalcsPointer FUNC EXPORT
|
||
SlotManager _sCalcsPointer
|
||
|
||
;FUNCTION SGetDriver(spBlkPtr: SpBlockPtr): OSErr;
|
||
SGetDriver FUNC EXPORT
|
||
SlotManager _sGetDriver
|
||
|
||
;FUNCTION SPtrToSlot(spBlkPtr: SpBlockPtr): OSErr;
|
||
SPtrToSlot FUNC EXPORT
|
||
SlotManager _sPtrToSlot
|
||
|
||
;FUNCTION SFindsInfoRecPtr(spBlkPtr: SpBlockPtr): OSErr;
|
||
SFindsInfoRecPtr FUNC EXPORT
|
||
SlotManager _sFindsInfoRecPtr
|
||
|
||
;FUNCTION SFindsRsrcPtr(spBlkPtr: SpBlockPtr): OSErr;
|
||
SFindsRsrcPtr FUNC EXPORT
|
||
SlotManager _sFindsRsrcPtr
|
||
|
||
;FUNCTION SDeleteSRTRec(spBlkPtr: SpBlockPtr): OSErr;
|
||
SDeleteSRTRec FUNC EXPORT
|
||
SlotManager _sDeleteSRTRec
|
||
|
||
;Device Manager Slot Support
|
||
|
||
;FUNCTION SIntInstall(SIntQElemPtr: SQElemPtr; theSlot: Integer ): OsErr;
|
||
|
||
SIntInstall FUNC EXPORT
|
||
|
||
MOVE.L (SP)+,A1 ;get the return address
|
||
MOVE.W (SP)+,D0 ;get slot number
|
||
MOVE.L (SP)+,A0 ;addr of parameter blk
|
||
_SIntInstall
|
||
MOVE.W D0,(SP) ;return error
|
||
|
||
JMP (A1)
|
||
|
||
;FUNCTION SIntRemove(SIntQElemPtr: SQElemPtr; theSlot: Integer): OsErr;
|
||
|
||
SIntRemove FUNC EXPORT
|
||
|
||
MOVE.L (SP)+,A1 ;get the return address
|
||
MOVE.W (SP)+,D0 ;get slot number
|
||
MOVE.L (SP)+,A0 ;addr of parameter blk
|
||
_SIntRemove
|
||
MOVE.W D0,(SP) ;return error
|
||
|
||
JMP (A1)
|
||
|
||
;Vertical Retrace Manager
|
||
|
||
;FUNCTION SlotVInstall(VBLBlockPtr: VBLCBPtr; theSlot: Integer ): OsErr;
|
||
|
||
SlotVInstall FUNC EXPORT
|
||
|
||
MOVE.L (SP)+,A1 ;get the return address
|
||
MOVE.W (SP)+,D0 ;get slot number
|
||
MOVE.L (SP)+,A0 ;addr of vertical retrace control blk
|
||
_SlotVInstall
|
||
MOVE.W D0,(SP) ;return error
|
||
|
||
JMP (A1)
|
||
|
||
;FUNCTION SlotVRemove(VBLBlockPtr: VBLCBPtr; theSlot: Integer): OsErr;
|
||
|
||
SlotVRemove FUNC EXPORT
|
||
|
||
MOVE.L (SP)+,A1 ;get the return address
|
||
MOVE.W (SP)+,D0 ;get slot number
|
||
MOVE.L (SP)+,A0 ;addr of vertical retrace control blk
|
||
_SlotVRemove
|
||
MOVE.W D0,(SP) ;return error
|
||
|
||
JMP (A1)
|
||
|
||
;FUNCTION AttachVBL(theSlot: Integer): OsErr;
|
||
|
||
AttachVBL FUNC EXPORT
|
||
|
||
MOVE.L (SP)+,A1 ;get the return address
|
||
MOVE.W (SP)+,D0 ;get slot number
|
||
_AttachVBL
|
||
MOVE.W D0,(SP) ;return error
|
||
|
||
JMP (A1)
|
||
|
||
;FUNCTION DoVBLTask(theSlot: Integer): OsErr;
|
||
|
||
DoVBLTask FUNC EXPORT
|
||
|
||
MOVE.L (SP)+,A1 ;get the return address
|
||
MOVE.W (SP)+,D0 ;get slot number
|
||
_DoVBLTask
|
||
MOVE.W D0,(SP) ;return error
|
||
|
||
JMP (A1)
|
||
|
||
;----------------------------------------------------------------------
|
||
|
||
ENDIF
|
||
|
||
;----------------------------------------------------------------------
|
||
|
||
END
|