sys7.1-doc-wip/Internal/Asm/egretequ.a
2020-04-26 16:46:44 +08:00

309 lines
13 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

;
; Hacks to match MacOS (most recent first):
;
; <Sys7.1> 8/3/92 Reverted MaxPseudoCmd to disregard the new Egret commands from <SM3> and
; later.
; 9/2/94 SuperMario ROM source dump (header preserved below)
;
Eject
************************************************************************
; EGRET Manager Equates
;
; File: EgretEqu.a
;
; Contains: Equate definitions used by EgretMgr.a
;
; Written by: Gus Andrade, Gary Rensberger
;
; Copyright: © 1990-1992 by Apple Computer, Inc., all rights reserved.
;
; Change History (most recent first):
;
; <SM6> 11/20/92 GS (rbm) Allocated one of the expansion variables in the Cuda
; globals for preserving any existing poll stack. Updated the
; 10ms delay to be a little longer. Renamed the Macsbug continue
; var to PDMDebugCont. for consistancy.
; <SM5> 10/7/92 GS Increase size of Cuda manager globals so that support for
; calling the resume procedure associated with power messages can
; be accessed externally.
; Added equates for debugger continue (Power Message Support).
; Added equates for asynchronous IIC traffic.
; <SM4> 9/18/92 GS Added Time out equates, and added a new Shutdown selector for
; the Macsbug Continue state.
; <SM3> 6/26/92 GS (RBM) Comment now says the WrDFAC is always DFAC mode.
; Eliminated SetDFACmode and replaced it with RdWrIIC. RdWrIIC is
; always I squared C mode. Expanded Egret parameter blocks so
; that the Cuda manager can have room for extensible features…
; Added equate for hardware based delay in SyncAck cycle (see
; CudaInit).
; <SM2> 5/22/92 RB Updated for new values used for Cuda in Pandora.
;
; SuperMario Change History:
;
; <11> 10/28/91 SAM/KSM Rolled in Regatta file.
;
; Regatta Change History:
;
; <3> 6/14/91 SAM (bg) Made this file look like the one in TERROR.
; <1> 6/12/91 SAM Split off from 7.0 GM sources.
;
; 7.0 Change History:
;
; <10> 1/30/91 gbm sab, #38: Change the already including this file variable to
; all uppercase (for security reasons)
; <9> 5/8/90 GA Added Retry Count and Timeout count for SendEgretCmd new
; RetryCount and Timeout support in SendPtype.
; <7> 4/25/90 GA Added equates needed in EgretMgr to fix DFAC bug and Error
; reporting bug.
; <6> 4/10/90 GA Added equates to support the error checking code in EgretMgr.a
; <5> 4/2/90 GA Changing the ElsieDFAC back to $57 AGAIN!!!. The hardware people
; should make up their minds!
; <4> 3/30/90 GA Added equates for EricksonDFAC & ElsieDFAC
; <3> 2/28/90 GMR Modified to match new EgretMgr.a
; <2> 2/3/90 GA first checked in
; <1> 2/3/90 GA first checked in
;
; To Do:
;
************************************************************************
IF &TYPE('__INCLUDINGEGRETEQU__') = 'UNDEFINED' THEN
__INCLUDINGEGRETEQU__ SET 1
;
; Egret parameter block
;
EgretPB RECORD 0,increment
pbCmdType ds.b 1 ; command type
pbCmd ds.b 1 ; Egret command
pbParam ds.b 4 ; Generic parameter (Addr, Time, etc), if needed for this command
pbByteCnt ds.w 1 ; # bytes of send/rcv data, if needed for this command
pbBufPtr ds.l 1 ; ptr to send/receive data, if any
pbFlags ds.b 1 ; Egrets flags (from response packet)
ds.b 1 ; word align
pbResult ds.w 1 ; result code (if any)
pbCompletion ds.l 1 ; ptr to completion routine
EgretPBSize EQU *
ENDR
;________________________________________________________________________________________________
; Globals
EgretGlobals RECORD 0,increment
flags ds.w 1 ; Egret Manager state flags
sendHdrCnt ds.w 1 ; # bytes in command header to send
sendHdrPtr ds.l 1 ; ptr into command header
sendDataCnt ds.w 1 ; # data bytes to send for current cmd
sendDataPtr ds.l 1 ; ptr to next data byte to send
rcvHdrCnt ds.w 1 ; # bytes to receive in response header
rcvHdrIndex ds.w 1 ; current index into receive header buffer
rcvDataCnt ds.w 1 ; # data bytes to receive
rcvDataPtr ds.l 1 ; ptr into receive buffer
rcvHeader ds.b 12 ; temp buffer for response packet
completion ds.l 1 ; ptr to completion routine for current packet
tickComp ds.l 1 ; tick packet completion routine
PDMComp ds.l 1 ; Eclipse PowerDown Message Handler Vector <T2>
adbPb ds.l 1 ; ptr to ADB auto response param block
curPb ds.l 1 ; ptr to current param block
workPb ds.b EgretPB.EgretPBSize ; local parameter block for unsolicited packets
ds.b 4 ; expansion space for the Egret parameter block <SM3><3>
IICComp ds.l 1 ; vector to handler for asynchronous IIC traffic <SM5>
ContinueComp ds.l 1 ; vector to power message continue procedure <SM5>
deferredPDM ds.l 1 ; pointer to PDM deferred task to post alert <SM5>
prevPollStack ds.l 1 ; keep address of any other poll stack <SM6>
SpareComp3 ds.l 1 ; spare vector #3 <SM5>
EgretGlobSize EQU *
ENDR
;________________________________________________________________________________________________
; Response Packet
respPacket RECORD 0,increment ; record describing rcvHeader
length ds.b 1 ; number of bytes in rcvHeader (4+data count)
respType ds.b 1 ; packet type (0=ADB, 3=ticks)
respFlag ds.b 1 ; flags
respCmd ds.b 1 ; command
respData ds.b 8 ; data bytes that came in (ticks, adb data)
ENDR
;________________________________________________________________________________________________
; Record Descriptor for Response Packet Header
;
RespHeader RECORD 0,increment ; record descriptor for Response packet Header <T2>
RespAttn ds.b 1 ; Attention Byte <T2>
RespPktType ds.b 1 ; Packet type <T2>
RespFlags ds.b 1 ; Flags byte <T2>
RespCmd ds.b 1 ; Command number <T2>
RespData ds.b 8 ; Data area for ADB or Time data <T2>
ENDR ; <T2>
;________________________________________________________________________________________________
; Egret8 and Caboose Bit definitions
xcvrSes EQU 3 ; ADBu session PB3
viaFull EQU 4 ; Via full indicator PB4
sysSes EQU 5 ; System session is PB5
;________________________________________________________________________________________________
; Cuda VIA Bit Definitions
TReq EQU 3 ; CUDA transaction PB3 <P1>
vByteAck EQU 4 ; acknowledge byte transfer PB4 <P1>
TIP EQU 5 ; System transaction PB5 <P1>
ACRmode EQU %00001100 ; shift reg mode (input with ext clock)
SRdir EQU 4 ; shift reg direction bit (0=input, 1=output)
; from Cuda, from System
vShift EQU 2 ; shift reg interrupt bit
;
;_______________________________________________________________________
; Egret Manager Flag Bit Definitions
busy EQU 0 ; flag bit 0 means we're busy with a packet
openData EQU 1 ; flag bit 1 means this is an open ended read response
BadPkt EQU 2 ; flag bit 2 means 1= Error Packet in progress <7>
PBPending EQU 3 ; PB aborted and pending <T2>
IdleAckFlag EQU 4 ; flag bit 4 set means an IdleAck pkt expected (Cuda) <P1>
;
;_______________________________________________________________________
; Flag Bits in the ADB Status byte returned from the ADB processor
EgSRQ equ 0 ; bit 0, 1=SRQ asserted
EgTimeOut equ 1 ; bit 1, 1=Active device did not have data available
EgSRQError equ 2 ; bit 2, 1=Device asserted excessive SRQ period
EgBusError equ 3 ; bit 3, 1=Timing error in bit cell was detected
EgAutoPoll equ 6 ; bit 6, 1=Data is from an Auto Poll
EgResponse equ 7 ; bit 7, 1=Response packett in process
;________________________________________________________________________________________________
; Elsie/Erickson DFAC initial settings
ElsieDFAC equ $0057
EricksonDFAC equ $0000
EclipseDFAC equ $0010 ; initial dfac values for Eclipse and Spike <t3> djw
SpikeDFAC equ $0010
;________________________________________________________________________________________________
; Packet types
adbPkt EQU $0000 ; ADB request packet type
pseudoPkt EQU $0001 ; pseudo commands packet type
errorPkt EQU $0002 ; error packets type
tickPkt EQU $0003 ; Egret 1 second tick packet type
PDMPkt equ $0004 ; PowerDown Message Packet (From Egret) <T2>
IICPkt equ $0005 ; asynchronous IIC packet SM5
DoContinueProc equ $00FB ; execute the continue procedure <SM5>
ContinueVectPkt equ $00FC ; initialize the vector with the current continue PROC <SM5>
IICVectPkt equ $00FD ; asynchronous IIC message vector <SM5>
PDMVectPkt equ $00FE ; Eclipse Init PowerDown Message vector <T2>
specialPkt EQU $00FF ; used to install ADB handler/pb
AddrField equ 4 ; ADB address field in most significant nibble
ADBFlushCmd equ %00000001 ; Flush Command
ListenCmd equ %00001000 ; Listen Command
TalkCmd equ %00001100 ; Talk Command
TalkAnR3 equ TalkCmd|3 ; Talk Command - Address N, Register 3
TalkA2R0 equ TalkCmd|(2<<AddrField) ; Talk address 2, register 0
TalkA2R2 equ TalkCmd|(2<<AddrField)|2 ; Talk address 2, register 2
FlushKybd equ ADBFlushCmd|(2<<AddrField) ; flush the keyboard buffer
;
; Shutdown Initiators from SysFlag in Cuda FW.
;
FrmChassisSw equ $01 ; Initiate ShutDown from Chassis Power Switch
FrmKeyBdSw equ $02 ; Initiate ShutDown from KeyBoard Switch
FrmKeySw equ $05 ; Initiate ShutDown from Secure Key Switch
;
; Selectors of the Shutdown Initiator Codes
;
KeySwSecure Equ 2 ; keyswitch from ON to FS
KeySwOn Equ 1 ; keyswithc from FS to ON
KeySwPwrDn Equ 0 ; keyswitch from On to OFF - no User Alert
ChassisSwOff Equ 0 ; Chassis sw Off - no User Alert
KyBdSoftOff Equ 4 ; keyboard sw Off - User alert
;
; Selectors of the Power Down Message
;
PDMTurnOff EQU 0 ; disable PDM
PDMTurnOn EQU 1 ; enable PDM ^
PDMSuspend EQU 2 ; suspend PDM, for SoftOff |
PDMContinue EQU 3 ; resume PDM, for SoftOff <P5>
PDMDebugCont equ 4 ; restore PDM (turn PDM on if OFF & Suspended) <SM6>
;
;________________________________________________________________________________________________
; Pseudo commands
NopCmd equ $00
APoll equ $01 ; start/stop autopoll
Rd6805addr equ $02 ; read 6805 address
RdTime equ $03 ; read real time clock pseudo commmand
RdRomSize equ $04 ; get romsize command
RdRomBase equ $05 ; get rom base address
RdRomHeader equ $06 ; get rom header address
RdPram equ $07 ; read parameter ram
Wr6805Addr equ $08 ; write 6805 address
WrTime equ $09 ; write time command
PwrDown equ $0A ; Erickson powerdown command
WrPwrupTime equ $0B ; Erickson set powerup time
WrPram equ $0C ; write parameter ram
MonoReset equ $0D ; Monostable reset
WrDFAC equ $0E ; write DFAC (always DFAC mode) <SM3>[rbm]<3>
Egretdiags equ $0F ; run egret diagnostics
RdCtlPanel equ $10 ; Sense control panel enable
RdBattery equ $10 ; Sense if battery was changed <P1>
ResetEgret equ $11 ; Egret Cold start command
EnDisVpp equ $12 ; ELSIE enable/disabe VPP
SetIPL equ $12 ; Set IPL level <P1>
EnDisFiles equ $13 ; enable/disable file server flag
SetAutopoll equ $14 ; set autopoll rate
RdPramSize equ $15 ; get parameter ram size
RdAutoRate equ $16 ; get autopoll rate
WrBusDelay equ $17 ; set bus delay constant
RdBusDelay equ $18 ; get busdelay constant
WrDevList equ $19 ; set ADB device list
RdDevList equ $1A ; get ADB device list
Wr1SecMode equ $1B ; set 1 second interrupt mode
EnDisKbdNmi equ $1C ; enable/disable keyboard NMI
EnDisParse equ $1D ; enable/disable post parse R2 A2
WrHangTout equ $1E ; set hang threshold
RdHangTout equ $1F ; get hang threshold
SetDefDFAC equ $20 ; Set Default DFAC String <T2>
EnDisPDM equ $21 ; Enable/Disable PowerDown Message <T2>
RdWrIIC equ $22 ; Read or Write IIC (I sqared C) <SM3>[rbm]<3>
WakeUpMode equ $23 ; Enable/Disable WakeUpMode <P1>
TimerTickle equ $24 ; ShutDown Timer Tickle <P1>
MaxPseudoCmd equ EnDisPDM ; largest possible pseudo command number <P1><Sys7.1>
;
;__________________________________________________________________________________________________
; MISC Equates
InvPseudo equ $0202 ; Invalid Pseudo packet <6>
InvPkt equ $0201 ; Invalid Packet type <6>
Enable equ $00FF ; Nonzero to enable Egret functions <T2>
Disable equ $0000 ; Zero to disable Egret functions <T2>
MaxRetries equ $0100 ; 256 Retries to communicate with Egret in SendEgretCmd<9>
MaxTout equ $2000 ; timeout waiting for Vsr irq from Egret 10millsecs<9>
DelayCnt equ $0068 ; count for register base delay100us routine
EclipseDelay equ 00025 ; Extra delay required for Eclipse <T2>
PollStackSize equ $0020 ; 32 byte buffer for SCC Poll data
Mode3Clock equ $0003 ; Mode 3 packets for clock data
MRUAddr equ $00B3 ; MRU address in Egret/Caboose/Cuda <10>
LRUAddr equ $00B4 ; LRU address in Egret/Caboose/Cuda <10>
hw4msDelay equ 3333 ; constant for 4ms delay in DBRA loop w/ hardware access <SM3><2>
;hw10msDelay equ 9167 ; delay to exceed maximum auto poll period on CUDA. <SM5>
hw10msDelay equ 15000 ; delay to exceed maximum auto poll period on CUDA. <SM6>
ENDIF ; ...already included