Bring in CubeE sources

Resource forks are included only for .rsrc files. These are DeRezzed into their data fork. 'ckid' resources, from the Projector VCS, are not included.

The Tools directory, containing mostly junk, is also excluded.
This commit is contained in:
Elliot Nunn 2017-09-17 17:09:04 +08:00
commit 4325cdcc78
1820 changed files with 1351740 additions and 0 deletions

138
DeclData/DeclData.make Normal file
View File

@ -0,0 +1,138 @@
#
# File DeclData.make
#
# Contains: Makefile for Declaration ROM.
#
# Written by: Kurt Clark, Chas Spillar, and Tim Nichols
#
# Copyright: © 1992-1993 by Apple Computer, Inc., all rights reserved.
#
# Change History (most recent first):
#
# <SM5> 12/13/93 PN Roll in Kaos and Horrors code to support AJ and Malcom machines.
# <SM4> 9/9/93 pdw Added slots.a to dependencies.
# <SM3> 08-03-93 jmp Added various necessary dependencies that werenÕt previously
# spelled out.
# <SM2> 3/4/93 dwc Added DeclDataPDMMace definition for PDM ENET.
# <1> 2/21/93 kc first checked in
# <SM2> 12-04-92 jmp Added the rules for building VSC (Keystone) DeclData.
EthernetDir = {DeclDir}DeclNet:
SonicDir = {EthernetDir}Sonic:
MaceDir = {EthernetDir}Mace:
VideoDir = {DeclDir}DeclVideo:
GammaDir = {VideoDir}Gamma:
PDMMaceDir = {MaceDir}PDMMaceEnet:
#include {MaceDir}Mace.Make
#include {SonicDir}Sonic.Make
#include {VideoDir}VideoDrivers.Make
#include {PDMMaceDir}PDMEnet.Make
DeclResources = "{RsrcDir}DeclData.rsrc" ¶
"{RsrcDir}PrimaryInit.rsrc" ¶
"{RsrcDir}SecondaryInit.rsrc" ¶
"{RsrcDir}SuperInit.rsrc" ¶
"{RsrcDir}DeclDataMace.rsrc" ¶
"{RsrcDir}DeclDataPDMMace.rsrc" ¶
"{RsrcDir}DeclDataSonic.rsrc" ¶
"{RsrcDir}DeclDataVideo.rsrc" ¶
"{RsrcDir}Gamma.rsrc"
DeclHeaders = "{ObjDir}StandardEqu.d" ¶
"{AIncludes}GestaltEqu.a" ¶
"{AIncludes}ShutDown.a" ¶
"{AIncludes}ROMEqu.a" ¶
"{AIncludes}Video.a" ¶
"{IntAIncludes}DockingEqu.a" ¶
"{IntAIncludes}EgretEqu.a" ¶
"{IntAIncludes}GestaltPrivateEqu.a" ¶
"{IntAIncludes}HardwarePrivateEqu.a" ¶
"{IntAIncludes}IOPrimitiveEqu.a" ¶
"{IntAIncludes}PowerPrivEqu.a" ¶
"{AIncludes}Slots.a" ¶
"{IntAIncludes}SlotMgrEqu.a" ¶
"{IntAIncludes}UniversalEqu.a" ¶
"{IntAIncludes}DepVideoEqu.a" ¶
"{SonicDir}SonicEqu.a"
#
# DeclData
#
"{RsrcDir}DeclData" Ä {DeclResources} "{RsrcDir}RomLink"
"{RsrcDir}RomLink" {DeclResources} -o "{Targ}"
"{RsrcDir}DeclData.rsrc" Ä "{RIncludes}Types.r" ¶
"{IntRIncludes}DepVideoEqu.r" ¶
"{IntRIncludes}HardwarePrivateEqu.r" ¶
"{IntRIncludes}InternalOnlyEqu.r" ¶
"{IntRIncludes}QuickDraw.r" ¶
"{IntRIncludes}ROMLink.r" ¶
"{DeclDir}DeclData.r"
Rez {StdROpts} "{DeclDir}DeclData.r" -o "{Targ}"
# The ROMLinkHeaderBuilder tool is not used.
#"{IntRIncludes}ROMLink.r" Ä "{RsrcDir}ROMLinkHeaderBuilder"
# "{RsrcDir}ROMLinkHeaderBuilder" > {Targ} #This is kinky
#
# PrimaryInit
#
"{RsrcDir}PrimaryInit.rsrc" Ä "{ObjDir}PrimaryInit.a.o"
Link {StdLOpts} {StdAlign} -rt decl=200 "{ObjDir}PrimaryInit.a.o" -o "{Targ}"
"{ObjDir}PrimaryInit.a.o" Ä "{DeclDir}PrimaryInit.a" ¶
{DeclHeaders}
Asm {StdAOpts} -d ForEclipseROM=0,sonic32=1,ctlpad=0,mmu=1 -i "{SonicDir}" "{DeclDir}PrimaryInit.a" -o "{Targ}"
#
# SecondaryInit
#
"{RsrcDir}SecondaryInit.rsrc" Ä "{ObjDir}SecondaryInit.a.o"
Link {StdLOpts} {StdAlign} -rt decl=210 "{ObjDir}SecondaryInit.a.o" -o "{Targ}"
"{ObjDir}SecondaryInit.a.o" Ä "{DeclDir}SecondaryInit.a" ¶
{DeclHeaders}
Asm {StdAOpts} -d ForEclipseROM=0,sonic32=1,ctlpad=0,mmu=1 -i "{SonicDir}" "{DeclDir}SecondaryInit.a" -o "{Targ}"
#
# SuperInit
#
"{RsrcDir}SuperInit.rsrc" Ä "{ObjDir}SuperInit.a.o"
Link {StdLOpts} {StdAlign} -rt decl=220 "{ObjDir}SuperInit.a.o" -o "{Targ}"
"{ObjDir}SuperInit.a.o" Ä "{DeclDir}SuperInit.a" ¶
{DeclHeaders}
Asm {StdAOpts} -d ForEclipseROM=0,sonic32=1,ctlpad=0,mmu=1 -i "{SonicDir}" "{DeclDir}SuperInit.a" -o "{Targ}"
#
# Ethernet
#
"{ObjDir}Loopback.c.o" Ä "{EthernetDir}Loopback.c" ¶
"{CIncludes}TextUtils.h" ¶
"{CIncludes}Memory.h" ¶
"{CIncludes}Devices.h" ¶
"{CIncludes}Files.h" ¶
"{CIncludes}AppleTalk.h" ¶
"{CIncludes}OSUtils.h"
C {StdCOpts} -b -o "{Targ}" "{EthernetDir}Loopback.c"
#
# Gamma Resource
#
"{RsrcDir}Gamma.rsrc" Ä "{RIncludes}Types.r" ¶
"{IntRIncludes}ROMLink.r" ¶
"{GammaDir}Gamma.r"
Rez {StdROpts} "{GammaDir}Gamma.r" -o "{Targ}"

9518
DeclData/DeclData.r Normal file

File diff suppressed because it is too large Load Diff

97
DeclData/DeclNet/802Equ.a Normal file
View File

@ -0,0 +1,97 @@
;
; File: 802Equ.a
;
; Contains: Equates for IEEE network standards
;
; Written by: Kerry E. Lynn, Sean Findley
;
; Copyright: © 1990, 1992 by Apple Computer, Inc., all rights reserved.
;
; Change History (most recent first):
;
; <1> 10/6/92 GDW New location for ROMLink tool.
; <1> 3/26/92 FM first checked in
; <1> 12/14/90 JK Added to build
;
; To Do:
;
;-----------=-----------=-------------------------------=---------------------------------------
; 802Equ.a - Equates for IEEE network standards
;
; Kerry E. Lynn
; Feb 1989
;
; Copyright (C) 1989 by:
;
; Apple Computer, Inc.
; 20525 Mariani Ave.
; Cupertino, CA 95014
;
; All Rights Reserved.
;-----------=-----------=-------------------------------=---------------------------------------
; 24-bit quantities, left justified
AppleCode EQU $08000700 ; Apple's vendor code for 802.2 Individual addr
MultiCode EQU $09000700 ; Apple's vendor code for 802.2 Group addr
; Size of a MAC addr
MACAddrSz EQU 6 ; max size (in bytes) for data link addr
MaxMCastSz EQU MACAddrSz ; max size (in bytes) for multicast addr
;---------------------------------------
; 802.3 MAC packet header
;---------------------------------------
MDstAddr EQU 0 ; Offset to destination address
MSrcAddr EQU MDstAddr+MACAddrSz ; Offset to source address
MLength EQU MSrcAddr+MACAddrSz ; Offset to LLC length
MHdrSize EQU MLength+2 ; 802.3 MAC header size
;---------------------------------------
; 802.2 LLC (Type 1) packet header
;---------------------------------------
LDSAP EQU 0 ; Offset to destination Service Access Point (SAP)
IGBIT EQU 0 ; I/G = 0 if Individual DSAP, = 1 if Group DSAP
LSSAP EQU LDSAP+1 ; Offset to source SAP
CRBIT EQU 0 ; C/R = 0 if Command, = 1 if Response
LCtrl EQU LSSAP+1 ; Offset to LLC CONTROL field (see below)
LHdrSize EQU LCtrl+1
LInfo EQU LHdrSize ; Offset to LLC Information
GlobalSAP EQU $FF
NullSAP EQU 0
;---------------------------------------
; CONTROL field bits for 802.2 Type 1 LLC Protocol Data Units (PDUs)
;---------------------------------------
UI EQU %00000011 ; value for "Unnumbered Information" (P/F bit must be 0)
XID EQU %10101111 ; mask for "Exchange Identification" (P/F bit may be 0 or 1)
TEST EQU %11100011 ; mask for "Test" (P/F bit may be 0 or 1)
PFBIT EQU 4 ; P/F = 0 if Poll (command), = 1 if Final (response)
;---------------------------------------
; XID information field
;---------------------------------------
XIDformat EQU %10000001 ; indicates IEEE basic format
XIDinfo1 EQU %00000001 ; indicates Type 1 AND Class I LLC
XIDinfo2 EQU %00000000 ; receive window size = N/A
XIDinfoSz EQU 3 ; number of bytes in an XID response
;---------------------------------------
; Sub-Network Access Protocol (SNAP) packet header
;---------------------------------------
SType EQU 0 ; 5-byte protocol discriminator
SHdrSize EQU SType+5

View File

@ -0,0 +1,397 @@
;
; File: ATMacros.a
;
; Contains: Assembly macros used by AppleTalk
;
; Written by: Mike Shoemaker
;
; Copyright: © 1990-1993 by Apple Computer, Inc., all rights reserved.
;
; Change History (most recent first):
;
; <SM2> 12/13/93 PN Roll in KAOS and Horror to add support for Malcom and AJ
; <1> 10/6/92 GDW New location for ROMLink tool.
; <SM2> 6/22/92 mal Added some labels to VERSION macro and added VMImmumebit equate.
; <SM3> 5/4/92 CSS moved to ethernet folder to get build to work
; <2> 3/19/92 kc Roll in Terror/Horror Changes.
; <SM1> 2/??/92 kc first checked in
; ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
; Pre-SuperMario ROM comments begin here.
; ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
; <H2> 01/22/92 jmp (BG,Z2) Added some additional macros for new ethernet changes.
; ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
; Pre-Horror ROM comments begin here.
; ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
; <T1> 3/27/91 jmp first checked in
; ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
; Pre-TERROR ROM comments begin here.
; ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
; <8> 1/30/91 mbs cj,#82011: Move years after company name in copyright message.
; <7> 12/17/90 mbs The ALIGN directive does not work for the IIGS assembler. Use
; IF ENDIF to generate an extra dc.b 0 if necessary. Yes except
; for the ALIGN, the entire macro worked under the IIGS
; assembler!.
; <6> 11/28/90 mbs In the VERSION macro, when the release stage is 'released', pad
; the version with two trailing spaces so that the length remains
; the same when changing from an f1 to a Golden Master build.
; <5> 11/26/90 mbs Did not handle 3-digit major version number
; <4> 11/12/90 mbs Steven pointed out that verUs is zero, not 1.
; <3> 11/10/90 mbs Add optional parameter to set the label at the front of the
; version structure.
; <2> 11/09/90 mbs Add 'v' in front of version number in long string
; 11/9/90 mbs First written
;
; To Do:
;
; WARNING -- CAN'T USE IF (__IncludingATalkMacros__ == 'UNDEFINED') because
; 6502 assember barfs and doesn't include the file.
PRINT PUSH, OFF
;==========================================================================================
; VERSION
;
; USAGE:
; VERSION <Name>, <Major Version>, <Minor Version>,
; <release stage>, <Revision level>,
; <Copyright Years> [, <Engineering Suffix> [, <Version Label> ] ]
;
; The name field should be quoted if more than one word.
; The copyright years field may or may not be quoted. The macro works either way
; It is OK to leave the engineering suffix field empty.
;
; The start of the version information is given the Label 'VersionInfo', unless
; you specify the last parameter; then it will be used. It must not be quoted.
;
; Example for EtherTalk 1.2a3q1 copyrighted 1987-1990
;
; VERSION 'EtherTalk', 1, 2, 0, alpha, 3, '1987-1990', 'q1'
;==========================================================================================
ATM_development EQU $20 ; These are used in the 3rd byte of the 4-byte version #
ATM_alpha EQU $40 ; .. to indicate release stage
ATM_beta EQU $60
ATM_final EQU $80
ATM_release EQU $80
ATM_verUS EQU 0
MACRO
VERSION &sName, &nMajor, &nMinor, &nBug, \
&sStage, &nRevision, &sCopyright, &sEngr='', &sLabel0=VersionInfo,&sLabel1=End
&sLabel0 ;Make label for this version information
LCLA &nStage ;Numeric representation of stage
LCLC &cStage ;Character representation of stage
LCLA &nPadBytes ;Add padding at end of record to <K2>
;allow room for expansion if we <K2>
;have to add bug release digits <K2>
;to the version # <K2>
LCLC &StrSetting ;To save current string setting
&StrSetting SETC &SETTING('STRING') ;Save current string setting
STRING PASCAL ;Set string state to Pascal
;
; Do some error checking
;
IF &UPCASE(&sStage)='ALPHA' THEN
&nStage SETA ATM_alpha
&cStage SETC 'a'
ELSEIF &UPCASE(&sStage)='BETA' THEN
&nStage SETA ATM_beta
&cStage SETC 'b'
ELSEIF &UPCASE(&sStage)='DEVELOPMENT' THEN
&nStage SETA ATM_development
&cStage SETC 'd'
ELSEIF &UPCASE(&sStage)='FINAL' THEN
&nStage SETA ATM_final
&cStage SETC 'f'
ELSEIF &UPCASE(&sStage)='RELEASE' THEN
&nStage SETA ATM_release
&cStage SETC 'x'
ELSE
AERROR 'The stage parameter to VERSION must be: development, alpha, beta, final or release'
ENDIF
IF (&nMinor > 15) THEN
AERROR 'The Minor version must be less than 16'
ENDIF
IF (&nBug > 15) THEN
AERROR 'The Bug fix version must be less than 16'
ENDIF
;
; Generate the 4-byte version numbers
;
dc.b &nMajor ;Major version number
dc.b (&nMinor * 16) + &nBug ;Build 2nd byte of version
dc.b &nStage, &nRevision ;stage and revision level
;
; Generate the integer country code
;
dc.w ATM_verUS ;Country Code
;
; Build Version string from major/minor version string
;
LCLC &lShortVer
;
; Make 1st digit of version string
;
IF (&nMajor >= 100) THEN
&lShortVer SETC &CONCAT(&CHR(&nMajor / 100 + $30), \
&CHR((&nMajor MOD 100) / 10 + $30), \
&CHR(&nMajor MOD 10 + $30))
ELSE
IF (&nMajor >= 10) THEN
&lShortVer SETC &CONCAT(&CHR(&nMajor / 10 + $30), &CHR(&nMajor MOD 10 + $30))
ELSE
&lShortVer SETC &CHR(&nMajor + $30)
ENDIF
ENDIF
;
; Append 2nd digit of version number (ie: 1.0)
;
IF (&nMinor >= 10) THEN
&lShortVer SETC &CONCAT(&lShortVer,'.',&CONCAT(&CHR(&nMinor / 10 + $30), &CHR(&nMinor MOD 10 + $30)))
ELSE
&lShortVer SETC &CONCAT(&lShortVer,'.',&CHR(&nMinor + $30))
ENDIF
;
; Append third digit of version number if non-zero (ie: 1.0.2). If zero, leave <K2>
; room for the extra characters at the end of the record <K2>
;
IF (&nBug <> 0) THEN
&nPadBytes SETA 0 ; Will not need padding <K2>
IF (&nBug >= 10) THEN
&lShortVer SETC &CONCAT(&lShortVer,'.',&CONCAT(&CHR(&nBug / 10 + $30), &CHR(&nBug MOD 10 + $30)))
ELSE
&lShortVer SETC &CONCAT(&lShortVer,'.',&CHR(&nBug + $30))
ENDIF
ELSE
&nPadBytes SETA 1 ; Leave room for padding <K2>
ENDIF
; Append stage letter and revision if not a release version.
; For release version, append two spaces. This way the string does not change length
; between an 'f1' build and a GM build.
IF (&cStage <> 'x') THEN
&lShortVer SETC &CONCAT(&lShortVer,&cStage)
IF (&nRevision >= 10) THEN
&lShortVer SETC &CONCAT(&lShortVer,&CONCAT(&CHR(&nRevision / 10 + $30), &CHR(&nRevision MOD 10 + $30)))
ELSE
&lShortVer SETC &CONCAT(&lShortVer,&CHR(&nRevision + $30))
ENDIF
ELSE
&lShortVer SETC &CONCAT(&lShortVer, ' ') ; Append two spaces if release
ENDIF
;
; Emit the short string
;
dc.b '&lShortVer'
; ALIGN directive doesn't exist on IIGS assembler so do it the hard way...
IF ((&LEN(&lShortVer) +1) MOD 2) = 1 THEN
dc.b 0
ENDIF
;
; Trim the beginning and ending quotes from the name, copyright years, and
; engineering suffix if present
;
LCLC &lName
LCLC &lCopyright
LCLC &lEngr
IF &SUBSTR(&sName, 1, 1) = &CHR($27) THEN
&lName SETC &SUBSTR(&sName, 2, &LEN(&sName) - 2)
ELSE
&lName SETC &sName
ENDIF
IF &SUBSTR(&sCopyright, 1, 1) = &CHR($27) THEN
&lCopyright SETC &SUBSTR(&sCopyright, 2, &LEN(&sCopyright) - 2)
ELSE
&lCopyright SETC &sCopyright
ENDIF
IF &SUBSTR(&sEngr, 1, 1) = &CHR($27) THEN
&lEngr SETC &SUBSTR(&sEngr, 2, &LEN(&sEngr) - 2)
ELSE
&lEngr SETC &sEngr
ENDIF
;
; Build the long string
;
LCLC &lLongVer ; Define a local variable to hold it
&lLongVer SETC &CONCAT(&lName,' v',&lShortVer,&lEngr,'; © Apple Computer, Inc. ',&lCopyright)
;
; Emit the long string
;
LCLC &sLongVerLabel ;<K2 start>
LCLC &sLongVerLabelEnd ;
&sLongVerLabel SETC &CONCAT(&sLabel0, 'LongStr') ;
&sLongVerLabel ;
dc.b '&lLongVer' ;
IF ((&LEN(&lLongVer) +1) MOD 2) = 1 THEN ; Align things
dc.b 0
ENDIF
;
; If this is an "xx.x" release rather than an "xx.x.x" release, leave room so that
; if we have to rev the version # to x.x.x, the size of the record will not change.
;
IF (&nPadBytes) THEN
dc.b 0,0,0,0
ENDIF
&sLongVerLabelEnd SETC &CONCAT(&sLongVerLabel, 'End')
&sLongVerLabelEnd
;
; Clean up and we're done
;
LCLC &sEndLabel ;Make label for end of version information
&sEndLabel SETC &CONCAT(&sLabel0, &sLabel1)
&sEndLabel
STRING &StrSetting ;Restore string setting
ENDM
EJECT
;==========================================================================================
; SCCLOCKOUT
;
; Macro for disabling interrupts.
;==========================================================================================
SRIntMaskBits EQU $0700 ; The 3 interrupt level bit in the SR
SRIntMaskBitsCMP EQU $F8FF ; The 3 interrupt level bit in the SR
SRIntLevel6 EQU $0600 ; Level 6 interrupt mask
SRIntLevel6MASK EQU $FEFF ; Level 6 interrupt AND value
SRIntLevel5MASK EQU $FDFF ; Level 5 interrupt AND value <K2>
MACRO
_SCCLOCKOUT
ORI.W #SRIntMaskBits,SR ; Set all of the INT bits
ANDI.W #SRIntLevel6MASK,SR ; Set to priority 6
ENDM
;==========================================================================================
; _SETINTMASK
;
; Macro for setting the interrupt level to an arbitrary level. Pass the level in
; a Data register.
;==========================================================================================
MACRO
_SETINTMASK &sReg
move.w SR,-(SP)
andi.w #SRIntMaskBitsCMP,(SP)
or.w &sReg,(SP)
move.w (SP)+,SR
ENDM
;==========================================================================================
; VSCCEnable
;
; Macro for disabling interrupts.
; Pass address register holding MPP vars, and a temporary Data register
;==========================================================================================
MACRO
_VSCCENABLE &sMPPVarsReg, &tmpReg
MOVE.W SR, &tmpReg
ANDI.W #SRIntMaskBitsCMP,&tmpReg ; Clear all of the INT bits
EORI.W #$2000, &tmpReg ; Toggle the 2000 bit
move.w vSCCEnable(&sMPPVarsReg),-(SP) ; Push vscc enable
EOR.W &tmpReg, (SP) ; Or in the int bits (and toggles 2000)
; Stupid machine won't let memory be the source on an XOR instruction
MOVE.W (SP)+,SR ; Set SR
ENDM
;==========================================================================================
; These Macros & Equates are used to call the multipurpose function dispatcher in the
; Lap Manager. None of these functionn have jack to do with the Lap Manager, but they
; provide a way for code to get the functions without having to link with the library
; containing them. Of course, they require that a Lap Manager be present.
;==========================================================================================
;
; Macro used in following macros
;
MACRO
_L21Common &nVal
LCLC &cLabel ; Used to make a semi-unique label
&cLabel SETC &CONCAT('@L21Ret',&nVal)
pea &cLabel ; Want to return to here
move.l LAPMgrPtr,D0 ; Ptr to Lap Manager
add.l #LAPMgrCall,D0 ; Ptr to dispatch entry point
move.l D0,-(SP) ; Put on stack
move.l #((&nVal << 16) + LInt21Dispatch),D0
rts ; Call Lap Manager
&cLabel
ENDM
;
; Macros to call Lap Manager Dispatch routines
;
; Returns non-zero in D0.L if Extensions are disabled at boot time. Always returns zero on
; System 6. Sets condition codes
MACRO
_LExtensionsDisabled
_L21Common L21ExtensionsDisabled
ENDM
; pascal Handle GetBestResource(OSType theType, short theID)
MACRO
_LGetBestResource
_L21Common L21GetBestResource
ENDM
; pascal Boolean TrapAvailable(short theTrap)
MACRO
_LTrapAvailable
_L21Common L21TrapAvailable
ENDM
;==========================================================================================
; New Macros go here
;==========================================================================================
;
; MACROS for SNMP counters <K2>
;
MACRO
_IncrCount &SNMPCounter
ADDQ.L #1, SNMPVars.&SNMPCounter(A2) ; increment whatever SNMP counter
ENDM
VMImmuneBit EQU 0 ; bit in driver DCE flags to tell VM to leave paramblocks alone
PRINT POP
; END ATMacros.a

View File

@ -0,0 +1,94 @@
;
; File: ENETEqu.a
;
; Contains: Equates for the Ethernet driver
;
; Written by: Sean Findley (Version 1.1a1)
;
; Copyright: © 1990, 1992 by Apple Computer, Inc., all rights reserved.
;
; This file is used in these builds: Mac32
;
; Change History (most recent first):
;
; <SM2> 10/26/92 mal Updated SNMP control codes.
; <1> 10/6/92 GDW New location for ROMLink tool.
; <2> 3/26/92 FM Rolled into reality
; <2> 1/9/91 JK Cleaned up to simplify N&C support.
; <1> 12/14/90 JK Added to build
;
; To Do:
;
IF (&TYPE('MHdrSize') = 'UNDEFINED') THEN
INCLUDE '802Equ.a' ; IEEE equates
ENDIF
; Control codes.
ESetGeneral EQU 253 ; Set "general" mode
EGetInfo EQU 252 ; Get info
ERdCancel EQU 251 ; Cancel read
ERead EQU 250 ; Read
EWrite EQU 249 ; Write
EDetachPH EQU 248 ; Detach protocol handler
EAttachPH EQU 247 ; Attach protocol handler
EAddMulti EQU 246 ; Add a multicast address
EDelMulti EQU 245 ; Delete a multicast address
EOpenSAP EQU 244 ; Open an 802.2 SAP
ECloseSAP EQU 243 ; Close an 802.2 SAP
ELapGetLinkStatus EQU 242 ; Get interface statistics, RFC 1213
EGetDot3CollStats EQU 241 ; Get 802.3 collision statistics, RFC 1284
EGetDot3Statistics EQU 240 ; Get 802.3 statistics, RFC 1284
ESetDot3Entry EQU 239 ; Set 802.3 status & control information
EGetDot3Entry EQU 238 ; Get 802.3 status & control information
FirstENET EQU EGetDot3Entry ; First ENET command
LastENET EQU ESetGeneral ; Last ENET command
; ENET queue element standard structure: arguments passed in the CSParam area
EProtType EQU CSParam ; Offset to protocol type code
EMultiAddr EQU CSParam ; Multicast address (EAddMulti,EDelMulti)
EHandler EQU EProtType+2 ; Offset to protocol handler
EWDSPointer EQU EHandler ; WDS pointer (EWrite)
EBuffPtr EQU EHandler ; Buffer pointer (ERead,EGetInfo)
EKillQEl EQU EHandler ; QEl pointer (ERdCancel)
EBuffSize EQU EBuffPtr+4 ; Buffer size (ERead,EGetInfo)
EDataSize EQU EBuffSize+2 ; Actual data size (Eread)
;---------------------------------------
; Ethernet packet header
;---------------------------------------
EDestAddr EQU 0 ; Offset to destination address
ESrcAddr EQU 6 ; Offset to source address
EType EQU 12 ; Offset to data link type
EHdrSize EQU 14 ; Ethernet header size
EMinDataSz EQU 46 ; Minimum data size
EMaxDataSz EQU 1500 ; Maximum data size
EAddrSz EQU 6 ; Size of an ethernet node address
MAddrSz EQU 8 ; Size of an ethernet multicast address (?)
; These are defined in 802Equ.a
;
ETHdrSize EQU MHdrSize+LHdrSize+SHdrSize
;
; Errors and misc.
;
eLenErr EQU ddpLenErr ; Length error
eMultiErr EQU ddpSktErr ; Multicast address error
EAddrRType EQU 'eadr' ; Alternate address resource type
;
; Link specific 'atlk' AGetInfo call
;
ESpeed EQU 10000000 ; Link speed in bits/sec

157
DeclData/DeclNet/Loopback.c Normal file
View File

@ -0,0 +1,157 @@
/*
File: Loopback.c
Contains: Ethernet loopback test code
Written by: Sean Findley
Copyright: © 1990, 1992 by Apple Computer, Inc., all rights reserved.
Change History (most recent first):
<1> 10/6/92 GDW New location for ROMLink tool.
<SM5> 6/22/92 mal Modified so ptr and size to loopback test data is passed from
the driver since shared by Sonic and Mace drivers.
<SM1> 6/11/92 CS Roll-in changes from Reality:
<2> 6/1/92 DTY Include TextUtils.h for the new home of EqualString.
TextUtils now contains the EqualString prototype, so include it.
<3> 3/26/92 FM Rolled into reality
<2> 2/11/92 RB Use the real EqualString to avoid having to link old C libraries
with this code.
<2> 4/21/91 CCH Rolled in Sean Findley's changes.
<1> 12/14/90 JK Added to build
To Do:
*/
#include <TextUtils.h>
#include "memory.h"
#include "devices.h"
#include "files.h"
#include "appletalk.h"
#include "OSUtils.h"
typedef struct
{
char Addr[6];
} Enet;
typedef struct
{
Enet Destination; /* Ethernet destination */
Enet Source; /* Ethernet source */
unsigned short EProtocoltype; /* Ethernet protocol type */
char testdata[255];
} LBpacket;
typedef union /* parameter block for calling .ENET */
{
CntrlParam ctl; /* for ctl calls */
struct
{
char filler[28];
unsigned short EprotType;
Ptr EBuffPtr;
unsigned short EBuffSize;
unsigned short EDataSize;
} info;
MPPParamBlock ecall;
} Edrvrparms;
#define Ehandler DDP.DDPptrs.listener
#define EWdsPointer DDP.DDPptrs.wdsPointer
#define EKillQEl EBuffPtr
#define ERdCancel 251
#define ERead 250
#define EWrite 249
#define EDetachPH 248
#define EAttachPH 247
#define Ethhdrsz 14
Boolean cmpdata(char *p1, char *p2, short len) /* true = data equal, false = data not equal */
{
short i;
for(i=0;i<len;i++)
{
if(p1[i] != p2[i])
return(false);
}
return(true);
}
killtest(Edrvrparms *pbw, Edrvrparms *pb)
{
pbw->ctl.csCode = ERdCancel;
pbw->info.EKillQEl = (Ptr) pb;
PBControl((ParmBlkPtr) pbw,false);
pbw->ctl.csCode = EDetachPH;
PBControl((ParmBlkPtr) pbw,false);
}
Boolean LOOPBACKTEST(short refnum,Enet *enetaddr, int AppleData, short AppleDataSz)
{
LBpacket LBPR,LBPW;
Edrvrparms pb,pbw;
WDSElement wds[2];
unsigned long secs1,secs2;
pb.ctl.ioCRefNum = refnum;
pb.ctl.ioCompletion = nil;
pb.ctl.csCode = EAttachPH;
pb.info.EprotType = 0x809B;
pb.ecall.Ehandler = nil;
if (PBControl((ParmBlkPtr) &pb,false)) /* attach special protocol using default handler */
return(false);
pb.ctl.csCode = ERead;
pb.info.EBuffPtr = (Ptr) &LBPR;
pb.info.EBuffSize = sizeof(LBpacket);
if (PBControl((ParmBlkPtr) &pb,true)) /* setup a read using default handler */
{
pb.ctl.csCode = EDetachPH;
PBControl((ParmBlkPtr) &pb,false);
return(false);
}
pbw = pb;
wds[0].entryLength = Ethhdrsz + AppleDataSz;
wds[0].entryPtr = (Ptr) &LBPW;
wds[1].entryLength = 0;
LBPW.Destination = *enetaddr;
LBPW.Source = *enetaddr;
LBPW.EProtocoltype = 0x809B;
BlockMove((Ptr)AppleData,LBPW.testdata,AppleDataSz);
pbw.ecall.EWdsPointer = (Ptr) wds;
pbw.ctl.csCode = EWrite;
if (PBControl((ParmBlkPtr) &pbw,false)) /* write a packet to ourself */
{
killtest(&pbw,&pb);
return(false);
}
GetDateTime(&secs1);
while (pb.ctl.ioResult == 1) /* wait for default read to complete or timeout */
{
GetDateTime(&secs2);
if (secs2 - secs1 > 3)
{
killtest(&pbw,&pb);
return(false);
}
}
pbw.ctl.csCode = EDetachPH;
PBControl((ParmBlkPtr) &pbw,false);
if (!cmpdata(LBPR.testdata,LBPW.testdata,AppleDataSz)) /* check data looped back */
return(false);
return(true);
}

View File

@ -0,0 +1,89 @@
/*
File: MACEecfg.r
Contains: 'ecfg' resource templates for MACE built-in ethernet systems
Written by: Mark A. Law
Copyright: © 1992-1993 by Apple Computer, Inc., all rights reserved.
Change History (most recent first):
<1> 6/7/93 kc first checked in
<LW2> 3/21/93 mal Versioned MACE 'ecfg' rsrc record and removed 24-bit MACEBase
field.
To Do:
*/
Type 'ecfg'
{
unsigned integer; /* Record version */
unsigned hex longint; /* 32-bit MACE address */
unsigned hex longint; /* Ethernet PROM address */
unsigned hex byte; /* MACE transmit frame control */
unsigned hex byte; /* MACE receive frame control */
unsigned hex byte; /* MACE xmit/recv fifo config control */
unsigned hex byte; /* MACE MAC config control */
hex string [6]; /* Alternate ethernet address */
unsigned integer; /* Alternate # transmit buffers */
unsigned integer; /* Alternate # receive buffers */
unsigned integer; /* Alternate # receive chains */
};
Resource 'ecfg' (43, "Cyclone33") {
1,
0x50F1C000,
0x50F08000,
0x1,
0,
0x2C,
0x3,
$"",
0,
0,
0
};
Resource 'ecfg' (78, "Cyclone40") {
1,
0x50F1C000,
0x50F08000,
0x1,
0,
0x2C,
0x3,
$"",
0,
0,
0
};
Resource 'ecfg' (60, "Tempest25") {
1,
0x50F1C000,
0x50F08000,
0x1,
0,
0x2C,
0x3,
$"",
0,
0,
0
};
Resource 'ecfg' (79, "Tempest33") {
1,
0x50F1C000,
0x50F08000,
0x1,
0,
0x2C,
0x3,
$"",
0,
0,
0
};

2729
DeclData/DeclNet/Mace/Mace.a Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,77 @@
#
# File Mace.Make
#
# Contains: Makefile for Mace.
#
# Written by: Kurt Clark, Chas Spillar, and Tim Nichols
#
# Copyright: © 1992-1993 by Apple Computer, Inc. All rights reserved.
#
# Change History (most recent first):
#
# <SM2> 6/14/93 kc Roll in Ludwig.
# <LW3> 3/16/93 chp Added a dependency on SysPrivateEqu.a for Mace.a.o.
# <LW2> 1/27/93 mal Add MACE ecfg rsrc.
# <SM2> 11/30/92 SWC Changed TimeEqu.a->Timer.a.
#
"{RsrcDir}DeclDataMace.rsrc" Ä "{ObjDir}MaceEnet.a.o" ¶
"{ObjDir}Mace.a.o" ¶
"{ObjDir}Loopback.c.o" ¶
"{IfObjDir}interface.o"
Link {StdLOpts} {StdAlign} -rt decl=1 -o "{Targ}" ¶
"{ObjDir}MaceEnet.a.o" ¶
"{ObjDir}Mace.a.o" ¶
"{ObjDir}Loopback.c.o" ¶
"{IfObjDir}interface.o"
"{RsrcDir}MACEecfg.rsrc" Ä {MaceDir}MACEecfg.r
Rez {StdROpts} -t rsrc -c RSED "{MaceDir}MACEecfg.r" -o "{Targ}"
"{ObjDir}Enet61.rsrc" Ä "{ObjDir}MaceEnet.a.o" ¶
"{ObjDir}Mace.a.o" ¶
"{ObjDir}Loopback.c.o"
Link {StdLOpts} {StdAlign} -rt enet=61 -o "{Targ}" ¶
-sn Main="Cyclone MACE Ethernet Driver" ¶
-ra "Cyclone MACE Ethernet Driver"=resSysHeap,resPurgeable,resLocked ¶
"{ObjDir}MaceEnet.a.o" ¶
"{ObjDir}Mace.a.o" ¶
"{ObjDir}Loopback.c.o" ¶
"{IfObjDir}interface.o"
"{ObjDir}MaceEnet.a.o" Ä "{MaceDir}MaceEnet.a" ¶
"{MaceDir}MaceEqu.a" ¶
"{MaceDir}VersionMaceEnet.a" ¶
"{EthernetDir}AtalkMacros.a" ¶
"{EthernetDir}ENETEqu.a" ¶
"{EthernetDir}SNMPLAP.a" ¶
"{AIncludes}GestaltEqu.a" ¶
"{AIncludes}Slots.a" ¶
"{AIncludes}SysEqu.a" ¶
"{AIncludes}SysErr.a" ¶
"{AIncludes}Timer.a" ¶
"{AIncludes}Traps.a" ¶
"{IntAIncludes}HardwarePrivateEqu.a"¶
"{IntAIncludes}InternalOnlyEqu.a" ¶
"{IntAIncludes}PSCEqu.a" ¶
"{IntAIncludes}UniversalEqu.a"
Asm {StdAOpts} -i "{MaceDir}" -i "{EthernetDir}" -o "{Targ}" "{MaceDir}MaceEnet.a"
"{ObjDir}Mace.a.o" Ä "{MaceDir}Mace.a" ¶
"{MaceDir}MaceEqu.a" ¶
"{EthernetDir}AtalkMacros.a" ¶
"{EthernetDir}ENETEqu.a" ¶
"{EthernetDir}SNMPLAP.a" ¶
"{AIncludes}GestaltEqu.a" ¶
"{AIncludes}SysEqu.a" ¶
"{AIncludes}SysErr.a" ¶
"{AIncludes}Traps.a" ¶
"{IntAIncludes}SysPrivateEqu.a" ¶
"{IntAIncludes}HardwarePrivateEqu.a"¶
"{IntAIncludes}InternalOnlyEqu.a" ¶
"{IntAIncludes}PSCEqu.a" ¶
"{IntAIncludes}UniversalEqu.a"
Asm {StdAOpts} -i "{MaceDir}" -i "{EthernetDir}" -o "{Targ}" "{MaceDir}Mace.a"

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,336 @@
;
; File: MaceEqu.a
;
; Contains: Equates for accessing the Ethernet Media Access
; Controller (MACE)
;
; Written by: Mark A. Law
;
; Copyright: © 1991-1993 by Apple Computer, Inc. All rights reserved.
;
; This file is used in these builds: Mac32
;
; Change History (most recent first):
;
; <SM6> 6/14/93 kc Roll in Ludwig.
; <LW4> 5/1/93 mal #1082434 Added records for new GetMem & FreeMem rtns.
; <LW3> 3/21/93 mal Versioned record for MACE 'ecfg' rsrc.
; <LW2> 1/27/93 mal Added MACEecfg rsrc support.
; <SM5> 12/4/92 mal Removed OFLO bit from recv pkt status.
; <SM4> 11/19/92 mal Added equ for yet another bit AMD didn't tell us about.
; <SM3> 10/30/92 mal MaceInitParms record change.
; <SM2> 10/13/92 mal -changed status thats passed to RecvRtn to lw
; <1> 10/6/92 GDW New location for ROMLink tool.
; <SM2> 6/22/92 mal Changes to support PSC2's (EVT2) Ethernet DMA receive model.
; <P4> 4/30/92 mal Expanded MaceInitParms record.
; <P3> 4/27/92 mal Added MaceInit parameters record.
; <P2> 3/23/92 mal Added MACE MAC config reg bit defines
;
; ---------------------------------------------------------
; MACE Registers
; ---------------------------------------------------------
MACERegBase EQU $50F1C000 ; Mace Reg Base on Cyclone
MACERegs RECORD 0
MACE_RX_FIFO DS.W 1 ;RD RXData -Read Status first
ORG *+$e
MACE_XMIT_FIFO DS.W 1 ;TX TXData
ORG *+$e
MACE_TX_FRM_CNTRL DS.B 1 ;RD/WR 01=Retry,XMTFCS,AUTOPAD
ORG *+$f
MACE_TX_FRM_STAT DS.B 1 ;RD
ORG *+$f
MACE_TX_RETRY_CNT DS.B 1 ;RD
ORG *+$f
MACE_RX_FRM_CNTRL DS.B 1 ;RD/WR 00 = Not_AutoStripPad
ORG *+$f
MACE_RX_FRM_STAT DS.B 1 ;RD Read 4x to get RX Status of packet
ORG *+$f
MACE_FIFO_FRM_CNT DS.B 1 ;RD Number of frames in FIFO
ORG *+$f
MACE_INT DS.B 1 ;RD_1 Interupt Source bits
ORG *+$f
MACE_INT_MSK DS.B 1 ;RD/WR Interupt Enables
ORG *+$f
MACE_POLL DS.B 1 ;RD Yet another status location
ORG *+$f
MACE_BIU_CNFG DS.B 1 ;RD/WR 20 = normal mode 01 = Soft Reset
ORG *+$f
MACE_FIFO_CNFG DS.B 1
ORG *+$f
MACE_MAC_CNFG DS.B 1 ;Enables
ORG *+$f
MACE_PLS_CNFG DS.B 1 ;RD/WR 0=Normal Mode
ORG *+$f
MACE_PHY_CNFG DS.B 1 ;RD/WR Reserved,Dude.
ORG *+$f
MACE_CHIP_ID_LOW DS.B 1 ;RD Just Reads ID
ORG *+$f
MACE_CHIP_ID_HIGH DS.B 1 ;RD Just Reads ID
ORG *+$f
MACE_ADDR_CNFG DS.B 1 ;RD/WR 04=Phy_Addr, 02=Log_Addr
ORG *+$1f
MACE_LOG_ADDR DS.B 1 ;Load with 6 Zeros
ORG *+$f
MACE_PHY_ADDR DS.B 1 ;Load with Address
ORG *+$2f
MACE_MISSED_PKT_CNT DS.B 1 ;RD
ORG *+$4f
MACE_USER_TEST_REG DS.B 1 ;
ENDR
;
; MACE Interrupt Reg. & Int. Reg. Mask Bit defines
; MACE Int. Reg - Read/Clear; MACE Int. Mask Reg. - Read/Write
;
BABL EQU 6 ; Babble, Xmit timeout error
CERR EQU 5 ; Signal Quality Error (SQE), xmit
RCVCO EQU 4 ; Receive Collision Cnt Overflow
MPCO EQU 2 ; Missed Pkt Cnt Overflow
RCVINT EQU 1 ; Rcv int
XMTINT EQU 0 ; Xmit int
; mask to disable all MACE ints
MaceIntMask EQU (1<<BABL)+(1<<CERR)+(1<<RCVCO)+(1<<MPCO)+(1<<RCVINT)+(1<<XMTINT)
OurIntsMask EQU (1<<RCVINT) ; ignore recv ints
;
; MACE Transmit Frame Status Reg. Bit defines
; Note: ONE and MORE are swapped prior to CURIO B0 MACE
;
XMTSV EQU 7 ; transmit status field valid when 1
UFLO EQU 6 ; underflow - xmit fifo
LCOL EQU 5 ; late collision
MORE EQU 4 ; more than 1 retry needed to xmit
ONE EQU 3 ; exactly 1 retry needed to xmit
DEFER EQU 2 ; transmission defered at least once
LCAR EQU 1 ; loss of carrier
RTRY EQU 0 ; retry
;
; MACE Transmit Frame Control Reg. Bit defines (byte)
;
DRTRY EQU 7 ; disable retry
DXMTFCS EQU 3 ; disable xmit fcs
APADXMT EQU 0 ; enable xmt autopad
; -forces generation of fcs
;
; MACE Receive Frame Control Reg. Bit defines (byte)
;
ASTRIPRCV EQU 0 ; enable rcv autopad stripping
; -forces stripping of fcs
;
; MACE Receive Status Reg. Bit defines (long)
;
; Receive Message Byte Count (byte0)
; Bits 7-0 : Recv Message Byte Count bits 7-0
; Receive Status (byte1)
; Bits 3-0 : Recv Message Byte Count bits 11-8
; Bits 7-4 : Recv Message Status bits
RcvOFLO EQU 7 ; receive fifo overflow
RcvCLSN EQU 6 ; late collision during recv
RcvFRAM EQU 5 ; frame error, non-integer # of bytes
RcvFCS EQU 4 ; frame check sequence error
; Receive Runt Packet Count (byte2)
; -number of runts recv'd since last successfully recv'd pkt
; -maxs at 255
; Receive Collision Count (byte3)
; -number of collisions since last successfully recv'd pkt
; -maxs at 255
;
; MACE Bus Interface Unit Reg. Bit defines (byte)
;
BSWAP EQU 7 ; byte swap mode, 0-Intel, 1-Motorola
; Transmit start point Bits 5-4
XMSTP EQU 4 ; bit shift offset
MACERESET EQU 0 ; software reset
; Transmit start point equates
; -controls when preamble xmit starts
XMTS4 EQU $00 ; start when 4 bytes in FIFO
XMTS16 EQU $10 ; start when 16 bytes in FIFO
XMTS64 EQU $20 ; start when 64 bytes in FIFO
XMTS112 EQU $30 ; start when 112 bytes in FIFO
;
; MACE FIFO Configuration Reg. Bit defines (byte)
; -fifo water mark changes ignored until fw reset bit set
; Transmit FIFO water mark Bits 7-6
XMTFW EQU 6 ; bit shift offset
; Receive FIFO water mark Bits 5-4
RCVFW EQU 4 ; bit shift offset
XMTFWR EQU 3 ; xmit fifo water mark reset
RCVFWR EQU 2 ; recv fifo water mark reset
XMTBRST EQU 1 ; xmit burst
RCVBRST EQU 0 ; recv burst
; FIFO watermark equates
RFW16 EQU $00 ; 16 byte recv FIFO watermark
RFW32 EQU $10 ; 32 byte recv FIFO watermark
RFW64 EQU $20 ; 64 byte recv FIFO watermark
TFW16 EQU $00 ; 16 byte xmit FIFO watermark
TFW32 EQU $40 ; 32 byte xmit FIFO watermark
TFW64 EQU $80 ; 64 byte xmit FIFO watermark
;
; MACE MAC Configuration Reg. Bit defines (byte)
;
PROMISC EQU 7 ; promiscuous mode, recv all valid frames
DXMT2PD EQU 6 ; disable xmit 2-part deferral algorithm
EMBA EQU 5 ; enable modified back-off algorithm
ENXMT EQU 1 ; enable xmit
ENRCV EQU 0 ; enable recv
;
; MACE Physical Layer Signaling Reg. Bit defines (byte)
;
XMTSEL EQU 3 ; xmit mode select
; Port Select Bits 2-1
PORTSEL EQU 1 ; bit shift offset
ENSTS EQU 0 ; enable optional I/O function status
;
; MACE Internal Address Configuration Reg. Bit defines (byte)
;
ADDRCHG EQU 7 ; address change enable
PHYADDR EQU 2 ; physical address select
LOGADDR EQU 1 ; logical address select
;
; MACE User Test Reg. Bit defines (byte)
;
;¥¥¥¥¥ WARNING: DO NOT EVER SET BIT 7 or you'll fry the MACE!!!! ¥¥¥¥¥
; Bit 6 (disable) is set during MACE init to disallow an erroneous and/or
; malicious setting of RTRE.
RTRE EQU 7 ; reserved test register enable
RTRD EQU 6 ; reserved test register disable
;¥¥¥¥¥
RPA EQU 5 ; runt packet accept
FCOLL EQU 4 ; force a collision, use with loopback
RCVFCSE EQU 3 ; receive fcs enable, use with loopback
; Loopback control Bits 2-1, %XX0 ¥¥¥ NOT FOR BIT SHIFTS!
NOLPB EQU %000 ; disable loopback mode
EXTLPB EQU %010 ; external loopback mode
INTLPB EQU %100 ; internal loopback, no MENDEC
MENDECLPB EQU %110 ; internal loopback, with MENDEC
;
; Misc. equates
;
MondoPkt EQU 2000 ; Value > max pkt, used for Recv DMA cnt
CntRegMask EQU $0001ffff ; Ignore upper 15 bits
nobuff EQU -2 ; no xmit buffer available
;¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥ Network Statistics
NetStats RECORD 0 ; network management stats.
TxOK DS.L 1 ; frames transmitted OK
sCollFrame DS.L 1 ; single collision frames
mCollFrame DS.L 1 ; multiple collision frames
CollFrame DS.L 1 ; collision frames
DefTx DS.L 1 ; deferred transmissions
LateColl DS.L 1 ; late collisions
ExcessColl DS.L 1 ; excessive collisions
ExcessDef DS.L 1 ; excessive defferals
InMACTxErr DS.L 1 ; internal MAC transmit errors
RxOK DS.L 1 ; frames received OK
MultiRxOK DS.L 1 ; multicast frames recd OK
BroadRxOK DS.L 1 ; broadcast frames recd OK
FCSerr DS.L 1 ; frame check sequence errors
FAerr DS.L 1 ; frame alignment errors
MPerr DS.L 1 ; missed packet errors
Size EQU *
ENDR
;¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥ General Equates
TalliesPerSec EQU 5000000 ; number of timer ticks/second
TxMaxRetries EQU 4 ; max attempts to retry aborted xmits
Max_Tx_Packets EQU 16 ; maximum # of chained Tx packets
Min_Pkt_Size EQU 60 ; minimum packet size
Min_Rx_Buffs EQU 2 ; minimum # of recv descriptors/buffers
Max_Pkt_Size EQU 1518 ; maximum packet size (inc. CRC)
EOL_Bit EQU 0 ; end-of-link bit
;¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥ For GetMemory call
GetMem RECORD 0
memsize DS.l 1 ; requested size
memoptions DS.l 1 ; requested options
memhndl DS.l 1 ; handle to memory mgr block
memhndla DS.l 1 ; handle to 4 or 8k aligned memory
memhndlasz DS.l 1 ; ptr to 4 or 8k aligned memory size
GetMemSz EQU *
ENDR
Locked EQU 0 ; want locked memory
Contig EQU 1 ; want contiguous memory
CacheOff EQU 2 ; want non-cacheable memory
;¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥ For FreeMemory call
FreeMem RECORD 0
memoptions DS.l 1 ; requested options
memptr DS.l 1 ; ptr to memory mgr block
memptra DS.l 1 ; ptr to 4 or 8k aligned memory
memptrasz DS.l 1 ; 4 or 8k aligned memory size
FreeMemSz EQU *
ENDR
;¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥ Initialization Parameters
MACEInitParms RECORD 0
RecvRtn DS.l 1 ; address of Ethernet receive routine
RecvPrms DS.l 1 ; parms to pass @ receive
XmitRtn DS.l 1 ; address of Ethernet xmit complete routine
XmitPrms DS.l 1 ; parms to pass @ xmit complete
MACECfgPtr DS.l 1 ; ptr to MACE config record
Dot3NetStats DS.l 1 ; ptr to 802.3 statistics array
LAPMIBNetStats DS.l 1 ; ptr to LAP MIB statistics array
EnetAddr DS.l 1 ; ptr to ethernet address
FastMoveRtn DS.l 1 ; ->proc to move memory FAST
IPSize EQU *
ENDR
;¥¥¥¥ Parms passed to .ENET "RecvRtn"
RcvParms RECORD {A6Link}
Size EQU * ; no local vars
A6Link DS.l 2 ; saved A6 and return addr
Parm DS.l 1 ; parm passed to MaceInit
Buff DS.l 1 ; ptr to Mace's buffer containing pkt
Pkt DS.l 1 ; ptr to packet data
Len DS.w 1 ; pkt length
Stat DS.l 1 ; pkt status
; Stat definition:
; Byte 0: Receive Runt Packet Count (Bits 31-24)
; -number of runts recv'd since last successfully recv'd pkt
; -maxs at 255
; Byte 1: Receive Collision Count (Bits 23-16)
; -number of collisions since last successfully recv'd pkt
; -maxs at 255
; Byte 2-3: Receive Status (Bits 15-0)
; Bits 15-7,3-0 : reserved, read as 0's
; Bits 6-4 : Recv Message Status bits
; RcvCLSN EQU 6 ; late collision during recv
; RcvFRAM EQU 5 ; frame error, non-integer # of bytes
; RcvFCS EQU 4 ; frame check sequence error
ParmsSz EQU * - Parm ; len of passed parms
ENDR
Configrsrc EQU 'ecfg' ; rsrc type for MACE config data rsrc
; Mace Configuration Record
MACECfg RECORD 0 ; Config values from config rsrc
MACECfgVers DS.w 1 ; record version
MACEBase DS.l 1 ; Base address of MACE
EnetPROM DS.l 1 ; base address of Address Prom
XmitFrmCtl DS.b 1 ; MACE transmit frame control register value
RecvFrmCtl DS.b 1 ; MACE receive frame control register value
FIFOCfgCtl DS.b 1 ; MACE xmit/recv fifo config control register value
MACCfgCtl DS.b 1 ; MACE MAC config control register value
; The following are optional values; ignored if zero
EnetAddr DS.b 6 ; Alternate Ethernet Address, overrides Address PROM
XmitBuffs DS.w 1 ; Alternate number of transmit buffers
RecvBuffs DS.w 1 ; Alternate number of receive buffers
RecvChains DS.w 1 ; Alternate number of receive "chains"
CfgSize EQU *
ENDR

View File

@ -0,0 +1,83 @@
# Contains: Makefile for PDM MACE Ethernet driver.
#
# Written by: Dave Calvert
#
# Copyright: © 1993 by Apple Computer, Inc., all rights reserved.
#
# Change History (most recent first):
#
# <SM6> 3/5/93 dwc Changed DeclDataPDMMace.rsrc ID to be unique from
# DeclDataMace.rsrc.
# <SM3> 3/4/93 dwc Added DeclDataPDMMace definition for PDM ENET.
# <SM2> 2/25/93 dwc Re-enable loopbacktests and include Interface.o for them.
# <SM2> 2/4/93 RC Took out Loopback.c.o link and fixed {make} to {makedir}
#
#===============================================================================
# Create DeclData Resource for PDM Declaration ROM
#===============================================================================
"{RsrcDir}DeclDataPDMMace.rsrc" Ä "{ObjDir}PDMMaceEnet.a.o" ¶
"{ObjDir}PDMMace.a.o" ¶
"{ObjDir}Loopback.c.o" ¶
"{IfObjDir}interface.o"
Link {StdLOpts} {StdAlign} -rt decl=1 -o "{Targ}" ¶
"{ObjDir}PDMMaceEnet.a.o" ¶
"{ObjDir}PDMMace.a.o" ¶
"{ObjDir}Loopback.c.o" ¶
"{IfObjDir}Interface.o"
"{RsrcDir}PDMENET.rsrc" Ä "{ObjDir}PDMMaceEnet.a.o" ¶
"{ObjDir}PDMMace.a.o" ¶
"{PDMMaceDir}PDMEnet.make" ¶
"{ObjDir}Loopback.c.o" ¶
"{IfObjDir}Interface.o"
Link -t rsrc -c RSED -sn Main="PDM MACE Ethernet Driver" ¶
-ra "PDM MACE Ethernet Driver"=resSysHeap,resPurgeable,resLocked ¶
-rt enet=57 -o {Targ} ¶
"{ObjDir}PDMMaceEnet.a.o" ¶
"{ObjDir}PDMMace.a.o" ¶
"{ObjDir}Loopback.c.o" ¶
"{IfObjDir}Interface.o"
"{RsrcDir}PDMENET57.rsrc" Ä "{ObjDir}PDMMaceEnet.a.o" ¶
"{ObjDir}PDMMace.a.o" ¶
# "{ObjDir}Loopback.c.o" ¶
"{PDMMaceDir}PDMEnet.make"
Link -t rsrc -c RSED -sn Main="PDM MACE Ethernet Driver" ¶
-ra "PDMENET"=resSysHeap,resPurgeable,resLocked ¶
-rt enet=57 -o {Targ} ¶
"{ObjDir}PDMMaceEnet.a.o" ¶
# "{ObjDir}Loopback.c.o" ¶
"{ObjDir}PDMMace.a.o"
#===============================================================================
# Assemble Stuff
#===============================================================================
"{ObjDir}PDMMace.a.o" Ä "{PDMMaceDir}PDMMace.a" ¶
"{PDMMaceDir}PDMMaceEqu.a" ¶
"{IntAIncludes}AMICEqu.a" ¶
"{IntAIncludes}UniversalEqu.a" ¶
"{EthernetDir}ATalkMacros.a" ¶
"{PDMMaceDir}PDMEnet.make"
Asm {StdAOpts} {Defs} -i "{PDMMaceDir}" -i "{EthernetDir}" -o "{Targ}" "{PDMMaceDir}PDMMace.a"
"{ObjDir}PDMMaceEnet.a.o" Ä "{PDMMaceDir}PDMMaceEnet.a" ¶
"{PDMMaceDir}PDMMaceEqu.a" ¶
"{PDMMaceDir}VersionPDMMaceEnet.a" ¶
"{EthernetDir}802Equ.a" ¶
"{EthernetDir}ATalkMacros.a" ¶
"{EthernetDir}ENETEqu.a" ¶
"{EthernetDir}SNMPLAP.a" ¶
"{IntAIncludes}UniversalEqu.a" ¶
"{IntAIncludes}AMICEqu.a" ¶
"{AIncludes}GestaltEqu.a" ¶
"{AIncludes}SysEqu.a" ¶
"{AIncludes}SysErr.a" ¶
"{AIncludes}Traps.a" ¶
"{AIncludes}Slots.a" ¶
"{PDMMaceDir}PDMEnet.make"
Asm {StdAOpts} {Defs} -i "{PDMMaceDir}" -i "{EthernetDir}" -o "{Targ}" "{PDMMaceDir}PDMMaceEnet.a"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,335 @@
;
; File: PDMMaceEqu.a
;
; Contains: Equates for accessing the Ethernet Media Access
; Controller (MACE) for the PDM ENET driver
;
; Written by: Dave Calvert
;
; Copyright: © 1992-1993 by Apple Computer, Inc. All rights reserved.
;
; This file is used in these builds: ROM RISC (PDM ENET)
;
; Change History (most recent first):
;
; <SM10> 6/2/93 GMR Changed some of the init parameters (back to Mark's equates),
; modified the receive record/status definitions.
; <SM9> 5/27/93 dwc Added support for AMIC work-around code.
; <SM8> 5/25/93 dwc Clean up for Alpha.
; <SM7> 5/4/93 dwc Added debug code to work around AMIC's returning FF's on the
; first read.
; <SM6> 4/6/93 dwc Added status/packet logging equate.
; <SM5> 3/24/93 dwc Remove obsolete code and added code to try to recover from
; lowered interrupt level during packet handling.
; <SM4> 3/5/93 dwc Removed some more debugging code.
; <SM3> 2/25/93 dwc Enable receive, remove some debug equates.
; <SM2> 2/24/93 dwc Cleaned up some debug equates, added some more debug equates,
; disabled receive for the PDM D5 ROM build.
; <SM1> 2/4/93 dwc first checked in
;
;
; ---------------------------------------------------------
; MACE Registers
; ---------------------------------------------------------
MACERegBase EQU $50F1C000 ; Mace Reg Base on Cyclone
MACERegs RECORD 0
MACE_RX_FIFO DS.W 1 ;RD RXData -Read Status first
ORG *+$e
MACE_XMIT_FIFO DS.W 1 ;TX TXData
ORG *+$e
MACE_TX_FRM_CNTRL DS.B 1 ;RD/WR 01=Retry,XMTFCS,AUTOPAD
ORG *+$f
MACE_TX_FRM_STAT DS.B 1 ;RD
ORG *+$f
MACE_TX_RETRY_CNT DS.B 1 ;RD
ORG *+$f
MACE_RX_FRM_CNTRL DS.B 1 ;RD/WR 00 = Not_AutoStripPad
ORG *+$f
MACE_RX_FRM_STAT DS.B 1 ;RD Read 4x to get RX Status of packet
ORG *+$f
MACE_FIFO_FRM_CNT DS.B 1 ;RD Number of frames in FIFO
ORG *+$f
MACE_INT DS.B 1 ;RD_1 Interupt Source bits
ORG *+$f
MACE_INT_MSK DS.B 1 ;RD/WR Interupt Enables
ORG *+$f
MACE_POLL DS.B 1 ;RD Yet another status location
ORG *+$f
MACE_BIU_CNFG DS.B 1 ;RD/WR 20 = normal mode 01 = Soft Reset
ORG *+$f
MACE_FIFO_CNFG DS.B 1
ORG *+$f
MACE_MAC_CNFG DS.B 1 ;Enables
ORG *+$f
MACE_PLS_CNFG DS.B 1 ;RD/WR 0=Normal Mode
ORG *+$f
MACE_PHY_CNFG DS.B 1 ;RD/WR Reserved,Dude.
ORG *+$f
MACE_CHIP_ID_LOW DS.B 1 ;RD Just Reads ID
ORG *+$f
MACE_CHIP_ID_HIGH DS.B 1 ;RD Just Reads ID
ORG *+$f
MACE_ADDR_CNFG DS.B 1 ;RD/WR 04=Phy_Addr, 02=Log_Addr
ORG *+$1f
MACE_LOG_ADDR DS.B 1 ;Load with 6 Zeros
ORG *+$f
MACE_PHY_ADDR DS.B 1 ;Load with Address
ORG *+$2f
MACE_MISSED_PKT_CNT DS.B 1 ;RD
ORG *+$4f
MACE_USER_TEST_REG DS.B 1 ;
ENDR
;
; MACE Interrupt Reg. & Int. Reg. Mask Bit defines
; MACE Int. Reg - Read/Clear; MACE Int. Mask Reg. - Read/Write
;
BABL EQU 6 ; Babble, Xmit timeout error
CERR EQU 5 ; Signal Quality Error (SQE), xmit
RCVCO EQU 4 ; Receive Collision Cnt Overflow
MPCO EQU 2 ; Missed Pkt Cnt Overflow
RCVINT EQU 1 ; Rcv int
XMTINT EQU 0 ; Xmit int
; mask to disable all MACE ints
;
; MACE Poll register bits
;
TDTREQ EQU 6 ; Transmit data request
RTDREQ EQU 5 ; Receive data request
;==========================================================================================
; _SETTHEINTMASK
;
; Macro for setting the interrupt level to an arbitrary level. Pass the level in
; a Data register.
;==========================================================================================
MACRO
_SETTHEINTMASK &sReg
move.w SR,-(SP)
or.w &sReg,(SP)
move.w (SP)+,SR
ENDM
MaceIntMask EQU (1<<BABL)+(1<<CERR)+(1<<RCVCO)+(1<<MPCO)+(1<<RCVINT)+(1<<XMTINT)
OurIntsMask EQU (1<<RCVINT) ; Ignore only these interrupts from MACE
;
; MACE Transmit Frame Status Reg. Bit defines
; Note: ONE and MORE are swapped prior to CURIO B0 MACE
;
XMTSV EQU 7 ; transmit status field valid when 1
UFLO EQU 6 ; underflow - xmit fifo
LCOL EQU 5 ; late collision
MORE EQU 4 ; more than 1 retry needed to xmit
ONE EQU 3 ; exactly 1 retry needed to xmit
DEFER EQU 2 ; transmission defered at least once
LCAR EQU 1 ; loss of carrier
RTRY EQU 0 ; retry
;
; MACE Transmit Frame Control Reg. Bit defines (byte)
;
DRTRY EQU 7 ; disable retry
DXMTFCS EQU 3 ; disable xmit fcs
APADXMT EQU 0 ; enable xmt autopad
; -forces generation of fcs
;
; MACE Receive Frame Control Reg. Bit defines (byte)
;
ASTRIPRCV EQU 0 ; enable rcv autopad stripping
; -forces stripping of fcs
;
; MACE Receive Status Reg. Bit defines (long)
;
; Receive Message Byte Count (byte0)
; Bits 7-0 : Recv Message Byte Count bits 7-0
; Receive Status (byte1)
; Bits 3-0 : Recv Message Byte Count bits 11-8
; Bits 7-4 : Recv Message Status bits
RcvOFLO EQU 7 ; receive fifo overflow
RcvCLSN EQU 6 ; late collision during recv
RcvFRAM EQU 5 ; frame error, non-integer # of bytes
RcvFCS EQU 4 ; frame check sequence error
; Receive Runt Packet Count (byte2)
; -number of runts recv'd since last successfully recv'd pkt
; -maxs at 255
; Receive Collision Count (byte3)
; -number of collisions since last successfully recv'd pkt
; -maxs at 255
;
; MACE Bus Interface Unit Reg. Bit defines (byte)
;
BSWAP EQU 7 ; byte swap mode, 0-Intel, 1-Motorola
; Transmit start point Bits 5-4
XMSTP EQU 4 ; bit shift offset
MACERESET EQU 0 ; software reset
; Transmit start point equates
; -controls when preamble xmit starts
XMTS4 EQU $00 ; start when 4 bytes in FIFO
XMTS16 EQU $10 ; start when 16 bytes in FIFO
XMTS64 EQU $20 ; start when 64 bytes in FIFO
XMTS112 EQU $30 ; start when 112 bytes in FIFO
;
; MACE FIFO Configuration Reg. Bit defines (byte)
; -fifo water mark changes ignored until fw reset bit set
; Transmit FIFO water mark Bits 7-6
XMTFW EQU 6 ; bit shift offset
; Receive FIFO water mark Bits 5-4
RCVFW EQU 4 ; bit shift offset
XMTFWR EQU 3 ; xmit fifo water mark reset
RCVFWR EQU 2 ; recv fifo water mark reset
XMTBRST EQU 1 ; xmit burst
RCVBRST EQU 0 ; recv burst
; FIFO watermark equates
RFW16 EQU $00 ; 16 byte recv FIFO watermark
RFW32 EQU $10 ; 32 byte recv FIFO watermark
RFW64 EQU $20 ; 64 byte recv FIFO watermark
TFW16 EQU $00 ; 16 byte xmit FIFO watermark
TFW32 EQU $40 ; 32 byte xmit FIFO watermark
TFW64 EQU $80 ; 64 byte xmit FIFO watermark
;
; MACE MAC Configuration Reg. Bit defines (byte)
;
PROMISC EQU 7 ; promiscuous mode, recv all valid frames
DXMT2PD EQU 6 ; disable xmit 2-part deferral algorithm
EMBA EQU 5 ; enable modified back-off algorithm
ENXMT EQU 1 ; enable xmit
ENRCV EQU 0 ; enable recv
;
; MACE Physical Layer Signaling Reg. Bit defines (byte)
;
XMTSEL EQU 3 ; xmit mode select
; Port Select Bits 2-1
PORTSEL EQU 1 ; bit shift offset
ENSTS EQU 0 ; enable optional I/O function status
;
; MACE Internal Address Configuration Reg. Bit defines (byte)
;
ADDRCHG EQU 7 ; address change enable
PHYADDR EQU 2 ; physical address select
LOGADDR EQU 1 ; logical address select
;
; MACE User Test Reg. Bit defines (byte)
;
;¥¥¥¥¥ WARNING: DO NOT EVER SET BIT 7 or you'll fry the MACE!!!! ¥¥¥¥¥
; Bit 6 (disable) is set during MACE init to disallow an erroneous and/or
; malicious setting of RTRE.
RTRE EQU 7 ; reserved test register enable
RTRD EQU 6 ; reserved test register disable
;¥¥¥¥¥
RPA EQU 5 ; runt packet accept
FCOLL EQU 4 ; force a collision, use with loopback
RCVFCSE EQU 3 ; receive fcs enable, use with loopback
; Loopback control Bits 2-1, %XX0 ¥¥¥ NOT FOR BIT SHIFTS!
NOLPB EQU %000 ; disable loopback mode
EXTLPB EQU %010 ; external loopback mode
INTLPB EQU %100 ; internal loopback, no MENDEC
MENDECLPB EQU %110 ; internal loopback, with MENDEC
;
; Misc. equates
;
MondoPkt EQU 2000 ; Value > max pkt, used for Recv DMA cnt
AddrPROM EQU $50F08000 ; 32 bit address of address PROM
CntRegMask EQU $0001ffff ; Ignore upper 15 bits
nobuff EQU -2 ; no xmit buffer available
;¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥ Network Statistics
NetStats RECORD 0 ; network management stats.
TxOK DS.L 1 ; frames transmitted OK
sCollFrame DS.L 1 ; single collision frames
mCollFrame DS.L 1 ; multiple collision frames
CollFrame DS.L 1 ; collision frames
DefTx DS.L 1 ; deferred transmissions
LateColl DS.L 1 ; late collisions
ExcessColl DS.L 1 ; excessive collisions
ExcessDef DS.L 1 ; excessive defferals
InMACTxErr DS.L 1 ; internal MAC transmit errors
RxOK DS.L 1 ; frames received OK
MultiRxOK DS.L 1 ; multicast frames recd OK
BroadRxOK DS.L 1 ; broadcast frames recd OK
FCSerr DS.L 1 ; frame check sequence errors
FAerr DS.L 1 ; frame alignment errors
MPerr DS.L 1 ; missed packet errors
Size EQU *
ENDR
;¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥ General Equates
TalliesPerSec EQU 5000000 ; number of timer ticks/second
TxMaxRetries EQU 4 ; max attempts to retry aborted xmits
Max_Tx_Packets EQU 16 ; maximum # of chained Tx packets
Min_Pkt_Size EQU 60 ; minimum packet size
Min_Rx_Buffs EQU 2 ; minimum # of recv descriptors/buffers
Max_Pkt_Size EQU 1518 ; maximum packet size (inc. CRC)
EOL_Bit EQU 0 ; end-of-link bit
;¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥ For GetMemory call
Locked EQU 0 ; want locked memory
Contig EQU 1 ; want contiguous memory
CacheOff EQU 2 ; want non-cacheable memory
;¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥ Initialization Parameters
MACEInitParms RECORD 0
RecvRtn DS.l 1 ; address of Ethernet receive routine
RecvPrms DS.l 1 ; parms to pass @ receive
XmitRtn DS.l 1 ; address of Ethernet xmit complete routine
XmitPrms DS.l 1 ; parms to pass @ xmit complete
MACECfgPtr DS.l 1 ; ptr to MACE config record
Dot3NetStats DS.l 1 ; ptr to 802.3 statistics array
LAPMIBNetStats DS.l 1 ; ptr to LAP MIB statistics array
EnetAddr DS.l 1 ; ptr to ethernet address
FastMoveRtn DS.l 1 ; ->proc to move memory FAST
IPSize EQU *
ENDR
;¥¥¥¥ Parms passed to .ENET "RecvRtn"
RcvParms RECORD {A6Link}
Size EQU * ; no local vars
A6Link DS.L 2 ; saved A6 and return addr
Parm DS.L 1 ; parm passed to MaceInit
PktLen DS.L 1 ; pkt length
PktStat DS.L 1 ; pkt status
PktData DS.L 1 ; ptr to packet data
; Byte 0-1: Receive Status (Bits 15-0)
; Bits 15-7,3-0 : reserved, read as 0's
; Bits 6-4 : Recv Message Status bits
; RcvCLSN EQU 6 ; late collision during recv
; RcvFRAM EQU 5 ; frame error, non-integer # of bytes
; RcvFCS EQU 4 ; frame check sequence error
ParmsSz EQU * - Parm ; len of passed parms
ENDR
Configrsrc EQU 'ecfg' ; rsrc type for MACE config data rsrc
; Mace Configuration Record
MACECfg RECORD 0 ; Config values from config rsrc
MACECfgVers DS.w 1 ; record version
MACEBase DS.l 1 ; Base address of MACE
EnetPROM DS.l 1 ; base address of Address Prom
XmitFrmCtl DS.b 1 ; MACE transmit frame control register value
RecvFrmCtl DS.b 1 ; MACE receive frame control register value
FIFOCfgCtl DS.b 1 ; MACE xmit/recv fifo config control register value
MACCfgCtl DS.b 1 ; MACE MAC config control register value
; The following are optional values; ignored if zero
EnetAddr DS.b 6 ; Alternate Ethernet Address, overrides Address PROM
XmitBuffs DS.w 1 ; Alternate number of transmit buffers
RecvBuffs DS.w 1 ; Alternate number of receive buffers
RecvChains DS.w 1 ; Alternate number of receive "chains"
CfgSize EQU *
ENDR

View File

@ -0,0 +1,25 @@
;
; File: VersionMaceEnet.a
;
; Contains: Version information for Mace Ethernet driver for PDM
;
; Written by: Dave Calvert
;
; Copyright: © 1992-1993 by Apple Computer, Inc., all rights reserved.
;
; Change History (most recent first):
;
; <SM3> 5/27/93 dwc Make Rev D8.
; <SM2> 2/24/93 dwc Made version zero for the ROM based version.
; <SM1> 2/4/93 dwc first checked in
;
; To Do:
;
PRINT PUSH, GEN, NOMDIR
;
; ¥¥¥ DO NOT CHANGE parm 9, "MaceEnet", driver code depends on that string!
;
VERSION 'PDM MACE DMA Ethernet Driver', 0, 0, 0, development, 8, '1993', 'q4', MaceEnet
PRINT POP

View File

@ -0,0 +1,45 @@
;
; File: VersionMaceEnet.a
;
; Contains: Version information for Mace Ethernet driver for Cyclone
;
; Written by: Mark A. Law
;
; Copyright: © 1991-1993 by Apple Computer, Inc., all rights reserved.
;
; Change History (most recent first):
;
; <SM10> 7/26/93 mal Changed vers to 1.0.1d1 for first bug fix after 1.0 release.
; <SM9> 6/17/93 kc Roll in Ludwig.
; <LW8> 6/14/93 mal Changed version to 1.0.
; <SM8> 6/14/93 kc Roll in Ludwig.
; <LW7> 5/22/93 mal Change vers to 1.0b7q1 since drvr did change since b6.
; <LW6> 5/3/93 mal Updated to 1.0b6q4
; <LW5> 5/1/93 mal Changed name to 'Built-In Ethernet Driver' and vers to 1.0b6q1.
; <LW4> 3/21/93 mal Updated to b3q2
; <LW3> 2/17/93 mal Updated to 1.0a10q4
; <2> 1/27/93 mal Updated to 1.0a9q3
; <SM7> 12/4/92 mal Updated to 1.0a8q3.
; <SM6> 11/19/92 mal Updated to 1.0a7.
; <SM5> 11/10/92 mal Updated to 1.0a6q1.
; <SM4> 10/30/92 mal Updated to 1.0a5
; <SM3> 10/26/92 mal Updated to 1.0a4q4
; <SM2> 10/13/92 mal changed to 1.0d10q4
; <1> 10/6/92 GDW New location for ROMLink tool.
; <SM4> 9/14/92 mal changed to 1.0d9q6
; <SM3> 7/25/92 mal Changed to 1.0d9q4
; <SM2> 6/22/92 mal Updated to 1.0d8q1.
; <P4> 4/30/92 mal
; <P3> 4/28/92 mal Chg to 1.0D5q1
; <P2> 3/23/92 mal Chg to 1.0d3q4 for 1.0D3 ROM bld.
;
; To Do:
;
PRINT PUSH, GEN, NOMDIR
;
; ¥¥¥ DO NOT CHANGE parm 9, "MaceEnet", driver code depends on that string!
;
VERSION 'Built-In Ethernet Driver', 1, 0, 1, development, 1, '1992-1993', '', MaceEnet
PRINT POP

227
DeclData/DeclNet/SNMPLAP.a Normal file
View File

@ -0,0 +1,227 @@
;
; File: SNMPLAP.a
;
; Contains: Simple Network Management Protocol equates for
; Link Access Protocols
;
; Written by: Mark A. Law and Brad Suinn
;
; Copyright: © 1992 by Apple Computer, Inc. All rights reserved.
;
; Change History (most recent first):
;
; <SM3> 10/26/92 mal Updated to ESD's latest version.
; <SM2> 10/26/92 mal Updated SNMP statistic arrays to latest versions.
; <1> 10/6/92 GDW New location for ROMLink tool.
;
LAPMIBStats RECORD 0,increment
ifVersion DS.L 1 ; Version of LinkStats we support
ifDescr DS.B 256 ; String with info about interface
ifType DS.L 1 ; <8> Change to a Long. Code with type of interface
ifMaxMTU DS.L 1 ; <8> Change to a Long. Largest size of IP datagram that can be tx/recv
ifSpeed DS.L 1 ; Bandwidth in bits/second
ifPhysAddress DS.B 32 ; Interface address
ifAdminStatus DS.L 1 ; <8> Change to a Long. Desired state (1 = up, 2 = down, 3 = testing)
ifOperStatus DS.L 1 ; <8> Change to a Long. Current state (1 = up, 2 = down, 3 = testing)
ifLastChange DS.L 1 ; SysTicks when interface entered current operation state
ifInOctets DS.L 1 ; Total nbr bytes received including framing chars
ifInUcastPkts DS.L 1 ; Nbr of unicast packets received
ifInNUcastPkts DS.L 1 ; Nbr of broad/multi cast packets received
ifInDiscards DS.L 1 ; Nbr of overwrites that occured (NOT USED)
ifInErrors DS.L 1 ; Nbr of pkts recv which contain error
ifInUnknownProtos DS.L 1 ; Nbr of pkts recv discarded cuz of unknown protocol
ifOutOctets DS.L 1 ; Total nbr bytes tx including framing chars
ifOutUcastPkts DS.L 1 ; Nbr of unicast packets tx
ifOutNUcastPkts DS.L 1 ; Nbr of broad/multi cast packets tx
ifOutDiscards DS.L 1 ; Nbr tx pkts discarded (NOT USED)
ifOutErrors DS.L 1 ; Nbr tx pkts not sent due to error
ifOutQLen DS.L 1 ; Current nbr of packets in output queue
LAPMIBStatsSz EQU *
ENDR
; ifAdminStatus and ifOperStatus
ifStatusUp EQU 1
ifStatusDown EQU 2
ifStatusTesting EQU 3
; IfTypes
other EQU 1 ; none of the following
regular1822 EQU 2
hdh1822 EQU 3
ddn_x25 EQU 4
rfc877_x25 EQU 5
ethernet_csmacd EQU 6
iso88023_csmacd EQU 7
iso88024_tokenBus EQU 8
iso88025_tokenRing EQU 9
iso88026_man EQU 10
starLan EQU 11
proteon_10Mbit EQU 12
proteon_80Mbit EQU 13
hyperchannel EQU 14
fddi EQU 15
lapb EQU 16
sdlc EQU 17
ds1 EQU 18 ; T-1
e1 EQU 19 ; european equivalent of T-1
basicISDN EQU 20
primaryISDN EQU 21
propPointToPointSerial EQU 22 ; proprietary serial
ppp EQU 23
softwareLoopback EQU 24
eon EQU 25 ; CLNP over IP
ethernet_3Mbit EQU 26
nsip EQU 27 ; XMS over IP
slip EQU 28 ; generic SLIP
ultra EQU 29 ; ULTRA technologies
ds3 EQU 30 ; T-3
sip EQU 31 ; SMDS
frame_relay EQU 32
;
; EtherNet (802.3) SNMP equates
;
Dot3Entry Record 0,increment
dot3Version DS.l 1 ; Version of LapDot3 entry that we support
dot3Index DS.l 1 ; ifIndex for this driver
dot3InitializeMac DS.l 1 ; Init status (1 = inited, 2 = uninited)
dot3SubLayerStatus DS.l 1 ; Op status of the MAC sublayer (1 = enabled, 2 = disabled)
dot3MulticastReceiveStatus DS.l 1 ; Multicast receive status (1 = enabled, 2 = disabled)
dot3TxEnabled DS.l 1 ; MAC frame tx state (1 = enabled, 2 = disabled)
dot3TestTdrValue DS.l 1 ; Time between TDR start/end
Dot3EntrySz EQU * ; End of Dot3Entry
ENDR
Dot3StatsEntry RECORD 0,increment
dot3StatsVersion DS.l 1 ; Version number
dot3StatsIndex DS.l 1 ; Same as ifIndex (to be left at zero)
dot3StatsAlignmentErrors DS.l 1
dot3StatsFCSErrors DS.l 1
dot3StatsSingleCollisionFrames DS.l 1
dot3StatsMultipleCollisionFrames DS.l 1
dot3StatsSQETestErrors DS.l 1
dot3StatsDeferredTransmissions DS.l 1
dot3StatsLateCollisions DS.l 1
dot3StatsExcessiveCollisions DS.l 1
dot3StatsInternalMacTransmitErrors DS.l 1
dot3StatsCarrierSenseErrors DS.l 1
dot3StatsExcessiveDeferrals DS.l 1
dot3StatsFrameTooLongs DS.l 1
dot3StatsInRangeLengthErrors DS.l 1
dot3StatsOutOfRangeLengthFields DS.l 1
dot3StatsInternalMacReceiveErrors DS.l 1
Dot3StatsEntrySz EQU *
ENDR
Dot3CollEntry RECORD 0,increment
dot3CollVersion DS.l 1 ; Version number
dot3CollIndex DS.l 1 ; Same as ifIndex (to be left at zero)
dot3CollCount DS.l 1
dot3CollFrequencies DS.l 1
Dot3CollEntrySz EQU *
ENDR
;
; TokenRing (802.5) SNMP equates
;
Dot5Entry Record 0,increment
dot5Version DS.l 1 ; Version of LapDot5 entry that we support
dot5Index DS.l 1 ; ifIndex for this driver
dot5Commands DS.l 1 ; always reads as no_op (1)
dot5RingStatus DS.l 1
dot5RingState DS.l 1
dot5RingOpenStatus DS.l 1
dot5RingSpeed DS.l 1
dot5UpStream DS.l 1
dot5ActMonParticipate DS.l 1
dot5Functional DS.l 1
Dot5EntrySz EQU * ; End of Dot5Entry
ENDR
Dot5StatsEntry RECORD 0,increment ; ¥¥
dot5StatsVersion DS.l 1 ; Version number
dot5StatsIndex DS.l 1 ; Same as ifIndex (to be left at zero)
dot5StatsLineErrors DS.l 1
dot5StatsBurstErrors DS.l 1
dot5StatsACErrors DS.l 1
dot5StatsAbortTransErrors DS.l 1
dot5StatsInternalErrors DS.l 1
dot5StatsLostFrameErrors DS.l 1
dot5StatsReceiveCongestions DS.l 1
dot5StatsFrameCopiedErrors DS.l 1
dot5StatsTokenErrors DS.l 1
dot5StatsSoftErrors DS.l 1
dot5StatsHardErrors DS.l 1
dot5StatsSignalLoss DS.l 1
dot5StatsTransmitBeacons DS.l 1
dot5StatsRecoverys DS.l 1
dot5StatsLobeWires DS.l 1
dot5StatsRemoves DS.l 1
dot5StatsSingles DS.l 1
dot5StatsFreqErrors DS.l 1
Dot5StatsEntrySz EQU *
ENDR
Dot5TimerEntry RECORD 0,increment ; ¥¥
dot5TimerVersion DS.l 1 ; Version number
dot5TimerIndex DS.l 1 ; Same as ifIndex (to be left at zero)
dot5TimerReturnRepeat DS.l 1
dot5TimerHolding DS.l 1
dot5TimerQueuePDU DS.l 1
dot5TimerValidTransmit DS.l 1
dot5TimerNoToken DS.l 1
dot5TimerActiveMon DS.l 1
dot5TimerStandbyMon DS.l 1
dot5TimerErrorReport DS.l 1
dot5TimerBeaconTransmit DS.l 1
dot5TimerBeaconReceive DS.l 1
Dot5TimerEntrySz EQU *
ENDR
; dot3InitializeMac
dot3initialized EQU 1
dot3uninitialized EQU 2
; dot3SubLayerStatus, dot3MulticastReceiveStatus
dot3enabled EQU 1
dot3disabled EQU 2
; dot3TxEnabled, dot5ActMonParticipate
dot_true EQU 1
dot_false EQU 2
; dot5Commands
dot5no_op EQU 1
dot5open EQU 2
dot5reset EQU 3
dot5close EQU 4
; dot5RingState
opened EQU 1
closed EQU 2
opening EQU 3
closing EQU 4
openFailure EQU 5
ringFailure EQU 6
; dot5RingOpenStatus
noOpen EQU 1
badParam EQU 2
lobeFailed EQU 3
signalLoss EQU 4
insertionTimeout EQU 5
ringFailed EQU 6
beaconing EQU 7
duplicateMAC EQU 8
requestFailed EQU 9
removeReceived EQU 10
ringopen EQU 11
; dot5RingSpeed
unknown EQU 1
oneMegabit EQU 2
fourMegabit EQU 3
sixteenMegabit EQU 4
SNMPVersion EQU $100 ; used for LAPMIBStats, Dot3Stats, Dot3Entry

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,39 @@
#
# File: Sonic.make
#
# Contains: Makefile for Sonic.
#
# Written by: Kurt Clark, Chas Spillar, and Tim Nichols
#
# Copyright: © 1992 by Apple Computer, Inc., all rights reserved.
#
# Change History (most recent first):
#
"{RsrcDir}DeclDataSonic.rsrc" Ä "{ObjDir}SonicEnet.a.o" ¶
"{ObjDir}Sonic.a.o" ¶
"{ObjDir}Loopback.c.o" ¶
"{IfObjDir}interface.o"
Link {StdLOpts} {StdAlign} -rt decl=1 -o "{Targ}" "{ObjDir}SonicEnet.a.o" ¶
"{ObjDir}Sonic.a.o" ¶
"{ObjDir}Loopback.c.o" ¶
"{IfObjDir}interface.o"
"{ObjDir}SonicEnet.a.o" Ä "{SonicDir}SonicEnet.a" ¶
"{SonicDir}SonicEqu.a" ¶
"{SonicDir}VersionEclipse.a" ¶
"{EthernetDir}AtalkMacros.a" ¶
"{EthernetDir}ENETEqu.a" ¶
"{AIncludes}GestaltEqu.a" ¶
"{AIncludes}Slots.a" ¶
"{AIncludes}SysEqu.a" ¶
"{AIncludes}SysErr.a" ¶
"{AIncludes}ToolUtils.a" ¶
"{AIncludes}Traps.a"
Asm {StdAOpts} -d ForEclipseROM=0,sonic32=1,ctlpad=0,mmu=1 -i "{SonicDir}" -i "{EthernetDir}" -o "{Targ}" "{SonicDir}SonicEnet.a"
"{ObjDir}Sonic.a.o" Ä "{SonicDir}Sonic.a" ¶
"{SonicDir}SonicEqu.a"
Asm {StdAOpts} -d sonic32=1,mmu=1 -i "{SonicDir}" -i "{EthernetDir}" -o "{Targ}" "{SonicDir}Sonic.a"

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,501 @@
;
; File: SonicEqu.a
;
; Contains: Sonic-specific equates
;
; Written by: Sean Findley
;
; Copyright: © 1990, 1992 by Apple Computer, Inc., all rights reserved.
;
; This file is used in these builds: Mac32
;
; Change History (most recent first):
;
; <1> 10/6/92 GDW New location for ROMLink tool.
; <1> 6/12/92 RLM first checked in
; <P2> 02/07/92 jmp (jmp,H2/BG/SJF,Z4) Rolled in SMOVE macro def and SonicAddress
; def.
; <1> 2/4/92 mal first checked in
; ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
; Pre-Pandora ROM comments begin here.
; ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
; <3> 2/26/91 JK Added extended Motorola mode equates.
; <2> 1/30/91 JK Added code review changes.
; <1> 12/14/90 JK Added to build
;
; To Do:
;
; SonicEqu.a - Equates for SONIC
; written by Sean J. Findley Jan. 1990
; Copyright (c) 1990 Apple Computer, Inc.
MACRO
CtlRegPad
IF CTLPAD THEN
ORG *+2
ENDIF
ENDM
MACRO ; <Z4> thru next <Z4>
SMOVE &src,&dest
IF SONIC32 THEN
MOVE.L &src,&dest
ELSE
MOVE.W &src,&dest
ENDIF
ENDM ; <Z4>
;¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥ SONIC Registers
SONICRegs RECORD 0
IF SONIC32 THEN
Command DS.L 1 ; (CR) SONIC control
Data_Config DS.L 1 ; (DCR) packet configuration
Recv_Control DS.L 1 ; (RCR) pkt reception control
Trans_Control DS.L 1 ; (TCR) Transmission control
Int_Mask DS.L 1 ; (IMR) interrupt mask
Int_Status DS.L 1 ; (ISR) interrupts status bits
Upper_TDA DS.L 1 ; (UTDA) upper 16 bits of TDA address
Current_TDA DS.L 1 ; (CTDA) 16 bit ptr to current TDA
Trans_PktSize DS.L 1 ; (TPS) total size of outbound pkt
Trans_FragCount DS.L 1 ; (TFC) transmit fragment count
Trans_PktStart0 DS.L 1 ; (TSA0) lower 16 bit of pkt addr
Trans_PktStart1 DS.L 1 ; (TSA1) upper "
Trans_FragSize DS.L 1 ; (TFS) current fragment size
Upper_RDA DS.L 1 ; (URDA) upper 16 bits of RDA address
Current_RDA DS.L 1 ; (CRDA) 16 bit ptr to current RDA
Recv_RBA0 DS.L 1 ; (CRBA0) lower 16 bit receive addr in RBA
Recv_RBA1 DS.L 1 ; (CRBA1) upper 16 bit recive addr in RBA
Buff_Cnt0 DS.L 1 ; (RBWC0) lower 16 bit of word count in RBA
Buff_Cnt1 DS.L 1 ; (RBWC1) upper "
End_Buff DS.L 1 ; (EOBC) end of buffer word count
Upper_RRA DS.L 1 ; (URRA) upper 16 bits of RRA address
RRA_Start DS.L 1 ; (RSA) 16 bit ptr to RRA
RRA_End DS.L 1 ; (REA) 16 bit ptr to end of RRA
RRA_Read DS.L 1 ; (RRP) where SONIC gets next read resource
RRA_Write DS.L 1 ; (RWP) where host puts new read resources
TRBA0 DS.L 1 ; (TRBA0) used by SONIC
TRBA1 DS.L 1 ; (TRBA1) "
TBWC0 DS.L 1 ; (TBWC0) "
TBWC1 DS.L 1 ; (TBWC1) "
ADDR0 DS.L 1 ; (ADDR0) "
ADDR1 DS.L 1 ; (ADDR1) "
LLFA DS.L 1 ; (LLFA) "
TTDA DS.L 1 ; (TTDA) "
CAM_EntryPtr DS.L 1 ; (CEP) points to CAM cell
CAM_Port2 DS.L 1 ; (CAP2) selects upper 16 bits of CAM cell
CAM_Port1 DS.L 1 ; (CAP1) selects middle 16 bits of CAM cell
CAM_Port0 DS.L 1 ; (CAP0) selects lower 16 bits of CAM cell
CAM_Enable DS.L 1 ; (CE) CAM enable register turns cells on/off
CAM_DescPtr DS.L 1 ; (CDP) 16 bit ptr to current CAM descriptor
CAM_Count DS.L 1 ; (CDC) count of CAM descriptors
Silicon_Rev DS.L 1 ; (SR) rev info on SONIC chip
Timer0 DS.L 1 ; (WT0) lower 16 bits of SONCIC timer
Timer1 DS.L 1 ; (WT1) upper 16 "
Recv_SeqCnt DS.L 1 ; (RSC) receive sequence counter
CRC_Err DS.L 1 ; (CRCT) CRC error count
FAE_Err DS.L 1 ; (FAET) frame alignment error count
MissedPkt_Err DS.L 1 ; (MPT) missed packet error count
MDT DS.L 1 ; (MDT) max. deferral timer
RTC DS.L 1 ; (RTC) receive test control
TTC DS.L 1 ; (TTC) transmit test control
DTC DS.L 1 ; (DTC) DMA test control
CC0 DS.L 1 ; (CC0) CAM comparison 0
CC1 DS.L 1 ; (CC1) CAM comparison 1
CC2 DS.L 1 ; (CC2) CAM comparison 2
CM DS.L 1 ; (CM) CAM match
res1 DS.L 2 ; reserved by National Semiconductor
RBC DS.L 1 ; (RBC) receiver byte count
res2 DS.L 1 ; reserved by National Semiconductor
TBO DS.L 1 ; (TBO) transmit backoff counter
TRC DS.L 1 ; (TRC) transmit random counter
TBM DS.L 1 ; (TBM) transmit backoff mask
res3 DS.L 1 ; reserved by National Semiconductor
Data_Config2 DS.L 1 ; extended data configiguration
ELSE
Command DS.W 1 ; (CR) SONIC control
CtlRegPad
Data_Config DS.W 1 ; (DCR) packet configuration
CtlRegPad
Recv_Control DS.W 1 ; (RCR) pkt reception control
CtlRegPad
Trans_Control DS.W 1 ; (TCR) Transmission control
CtlRegPad
Int_Mask DS.W 1 ; (IMR) interrupt mask
CtlRegPad
Int_Status DS.W 1 ; (ISR) interrupts status bits
CtlRegPad
Upper_TDA DS.W 1 ; (UTDA) upper 16 bits of TDA address
CtlRegPad
Current_TDA DS.W 1 ; (CTDA) 16 bit ptr to current TDA
CtlRegPad
Trans_PktSize DS.W 1 ; (TPS) total size of outbound pkt
CtlRegPad
Trans_FragCount DS.W 1 ; (TFC) transmit fragment count
CtlRegPad
Trans_PktStart0 DS.W 1 ; (TSA0) lower 16 bit of pkt addr
CtlRegPad
Trans_PktStart1 DS.W 1 ; (TSA1) upper "
CtlRegPad
Trans_FragSize DS.W 1 ; (TFS) current fragment size
CtlRegPad
Upper_RDA DS.W 1 ; (URDA) upper 16 bits of RDA address
CtlRegPad
Current_RDA DS.W 1 ; (CRDA) 16 bit ptr to current RDA
CtlRegPad
Recv_RBA0 DS.W 1 ; (CRBA0) lower 16 bit receive addr in RBA
CtlRegPad
Recv_RBA1 DS.W 1 ; (CRBA1) upper 16 bit recive addr in RBA
CtlRegPad
Buff_Cnt0 DS.W 1 ; (RBWC0) lower 16 bit of word count in RBA
CtlRegPad
Buff_Cnt1 DS.W 1 ; (RBWC1) upper "
CtlRegPad
End_Buff DS.W 1 ; (EOBC) end of buffer word count
CtlRegPad
Upper_RRA DS.W 1 ; (URRA) upper 16 bits of RRA address
CtlRegPad
RRA_Start DS.W 1 ; (RSA) 16 bit ptr to RRA
CtlRegPad
RRA_End DS.W 1 ; (REA) 16 bit ptr to end of RRA
CtlRegPad
RRA_Read DS.W 1 ; (RRP) where SONIC gets next read resource
CtlRegPad
RRA_Write DS.W 1 ; (RWP) where host puts new read resources
CtlRegPad
TRBA0 DS.W 1 ; (TRBA0) used by SONIC
CtlRegPad
TRBA1 DS.W 1 ; (TRBA1) "
CtlRegPad
TBWC0 DS.W 1 ; (TBWC0) "
CtlRegPad
TBWC1 DS.W 1 ; (TBWC1) "
CtlRegPad
ADDR0 DS.W 1 ; (ADDR0) "
CtlRegPad
ADDR1 DS.W 1 ; (ADDR1) "
CtlRegPad
LLFA DS.W 1 ; (LLFA) "
CtlRegPad
TTDA DS.W 1 ; (TTDA) "
CtlRegPad
CAM_EntryPtr DS.W 1 ; (CEP) points to CAM cell
CtlRegPad
CAM_Port2 DS.W 1 ; (CAP2) selects upper 16 bits of CAM cell
CtlRegPad
CAM_Port1 DS.W 1 ; (CAP1) selects middle 16 bits of CAM cell
CtlRegPad
CAM_Port0 DS.W 1 ; (CAP0) selects lower 16 bits of CAM cell
CtlRegPad
CAM_Enable DS.W 1 ; (CE) CAM enable register turns cells on/off
CtlRegPad
CAM_DescPtr DS.W 1 ; (CDP) 16 bit ptr to current CAM descriptor
CtlRegPad
CAM_Count DS.W 1 ; (CDC) count of CAM descriptors
CtlRegPad
Silicon_Rev DS.W 1 ; (SR) rev info on SONIC chip
CtlRegPad
Timer0 DS.W 1 ; (WT0) lower 16 bits of SONCIC timer
CtlRegPad
Timer1 DS.W 1 ; (WT1) upper 16 "
CtlRegPad
Recv_SeqCnt DS.W 1 ; (RSC) receive sequence counter
CtlRegPad
CRC_Err DS.W 1 ; (CRCT) CRC error count
CtlRegPad
FAE_Err DS.W 1 ; (FAET) frame alignment error count
CtlRegPad
MissedPkt_Err DS.W 1 ; (MPT) missed packet error count
CtlRegPad
MDT DS.W 1 ; (MDT) max. deferral timer
CtlRegPad
RTC DS.W 1 ; (RTC) receive test control
CtlRegPad
TTC DS.W 1 ; (TTC) transmit test control
CtlRegPad
DTC DS.W 1 ; (DTC) DMA test control
CtlRegPad
CC0 DS.W 1 ; (CC0) CAM comparison 0
CtlRegPad
CC1 DS.W 1 ; (CC1) CAM comparison 1
CtlRegPad
CC2 DS.W 1 ; (CC2) CAM comparison 2
CtlRegPad
CM DS.W 1 ; (CM) CAM match
CtlRegPad
res1 DS.W 2 ; reserved by National Semiconductor
CtlRegPad
RBC DS.W 1 ; (RBC) receiver byte count
CtlRegPad
res2 DS.W 1 ; reserved by National Semiconductor
CtlRegPad
TBO DS.W 1 ; (TBO) transmit backoff counter
CtlRegPad
TRC DS.W 1 ; (TRC) transmit random counter
CtlRegPad
TBM DS.W 1 ; (TBM) transmit backoff mask
CtlRegPad
res3 DS.W 1 ; reserved by National Semiconductor
CtlRegPad
Data_Config2 DS.W 1 ; extended data configiguration
ENDIF
ENDR
;¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥ Content Addressable Memory (CAM) Descriptor Area CDA
CAMDesc RECORD 0
IF SONIC32 THEN
Entry_ptr DS.L 1 ; base zero index to CAM cell
Port2 DS.L 1 ; lower 16 bits in cell
Port1 DS.L 1 ; middle 16 bits in cell
Port0 DS.L 1 ; upper 16 bits in cell
enable DS.L 1 ; CAM cell enable mask
ELSE
Entry_ptr DS.W 1 ; base zero index to CAM cell
Port2 DS.W 1 ; lower 16 bits in cell
Port1 DS.W 1 ; middle 16 bits in cell
Port0 DS.W 1 ; upper 16 bits in cell
enable DS.W 1 ; CAM cell enable mask
ENDIF
CAMDescSz EQU *
ENDR
;¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥ Receive Resource Descriptor Area RRA
RRArec RECORD 0
IF SONIC32 THEN
buff_ptr0 DS.L 1 ; lower 16 bits of RBA address
buff_ptr1 DS.L 1 ; upper 16 bits of RBA address
buff_wc0 DS.L 1 ; lower 16 bits of RBA word count
buff_wc1 DS.L 1 ; upper 16 bits of RBA word count
ELSE
buff_ptr0 DS.W 1 ; lower 16 bits of RBA address
buff_ptr1 DS.W 1 ; upper 16 bits of RBA address
buff_wc0 DS.W 1 ; lower 16 bits of RBA word count
buff_wc1 DS.W 1 ; upper 16 bits of RBA word count
ENDIF
RRArecSz EQU *
ENDR
;¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥ Receive Descriptor Area RDA
Rxpkt RECORD 0
; this link is used to keep rx descriptors on our own list(s) when SONIC is not using them
nextRD DS.L 1 ; internal ptr to next descriptor
isFree DS.B 1 ; = true if desc has been freed
ORG nextRD
IF SONIC32 THEN
status DS.L 1 ; receive status
byte_count DS.L 1 ; size of packet read
pkt_ptr0 DS.L 1 ; lower 16 bits of packet addr. in RBA
pkt_ptr1 DS.L 1 ; upper 16 bits of packet addr. in RBA
seq_no DS.L 1 ; sequence number
link DS.L 1 ; link to other RD
in_use DS.L 1 ; use flag
ELSE
status DS.W 1 ; receive status
byte_count DS.W 1 ; size of packet read
pkt_ptr0 DS.W 1 ; lower 16 bits of packet addr. in RBA
pkt_ptr1 DS.W 1 ; upper 16 bits of packet addr. in RBA
seq_no DS.W 1 ; sequence number
link DS.W 1 ; link to other RD
in_use DS.W 1 ; use flag
ENDIF
RxRDAsize EQU *
ENDR
;¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥ Transmit Descriptor Area TDA
Max_Tx_Frags EQU 16 ; maximum fragments supported for a transmit
Txpkt RECORD 0 ; Transmit Descriptor
; this link is used to keep tx descriptors on our own list when SONIC is not using them
nextTD DS.L 1 ; internal ptr to next descriptor
ORG nextTD
IF SONIC32 THEN
status DS.L 1 ; status info written by SONIC
config DS.L 1 ; pre-transmit config data
pkt_size DS.L 1 ; size of packet
frag_count DS.L 1 ; fragment count
frag_start EQU * ; start of individual fragments
; the following 3 fields are repeated 1..frag_count
frag_ptr0 DS.L 1 ; lower 16 bits of address
frag_ptr1 DS.L 1 ; upper "
frag_size DS.L 1 ; fragment size
frag_esize EQU * - frag_start ; size of individual fragments
ORG * + (Max_Tx_Frags-1) * frag_esize
; allocate rest of fragments
link DS.L 1 ; lower 16 bits of next TD (if any)
ELSE
status DS.W 1 ; status info written by SONIC
config DS.W 1 ; pre-transmit config data
pkt_size DS.W 1 ; size of packet
frag_count DS.W 1 ; fragment count
frag_start EQU * ; start of individual fragments
; the following 3 fields are repeated 1..frag_count
frag_ptr0 DS.W 1 ; lower 16 bits of address
frag_ptr1 DS.W 1 ; upper "
frag_size DS.W 1 ; fragment size
frag_esize EQU * - frag_start ; size of individual fragments
ORG * + (Max_Tx_Frags-1) * frag_esize
; allocate rest of fragments
link DS.W 1 ; lower 16 bits of next TD (if any)
ENDIF
TxTDAsize EQU * ; size of a single frame TD
ENDR
;¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥ Initialization Parameters
SONICinitParms RECORD 0
SONICbase DS.L 1 ; base address of SONIC registers
IntInstall DS.L 1 ; addr of proc that installs interrupt handler
RECVRtn DS.L 1 ; address of receive routine
RECVPrms DS.L 1 ; parms to pass @ receive
TRANRtn DS.L 1 ; address of xmit complete routine
TRANPrms DS.L 1 ; parms to pass @ xmit complete
MemStart DS.L 1 ; address of memory usage area
MemSize DS.L 1 ; size of memory usage area
NumRxBuffs DS.L 1 ; proposed # of receive buffers
IntDisable DS.L 1 ; proc to disable interrupts
IntEnable DS.L 1 ; proc to reenable interrupts
NetStatArray DS.L 1 ; ptr to network statistics array
DataConfig DS.L 1 ; data configuration value
TransAddr DS.L 1 ; ->proc to translate logical->physical address
ParmSize EQU *
ENDR
;¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥ CAM Parameters
CAMparms RECORD 0
SONICPtr DS.L 1 ; SONIC base address <Z4>
EAddr DS.B 6 ; Ethernet address
LoadorClear DS.L 1 ; ­ 0 if adding CAM entry
ParmSize EQU *
ENDR
;¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥ (CR) Command Register Bits
LoadCAM EQU 9 ; load content addressable memory
ReadRRA EQU 8 ; read next read resource descriptor
SoftReset EQU 7 ; do a software reset
StartTimer EQU 5 ; start watchdog timer
StopTimer EQU 4 ; stop "
RxEnable EQU 3 ; receive packets
RxDisable EQU 2 ; stop receiving packets
TxEnable EQU 1 ; transmit packets
TxDisable EQU 0 ; stop transmitting packets
;¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥ (RCR) Receive Control/Status Register Bits
RecvErrors EQU 15 ; accept/reject packets with errors
RecvRunts EQU 14 ; accept/reject runt packets
RecvBroadCast EQU 13 ; accept/reject broadcasts
RecvAll EQU 12 ; turn on/off promiscuious mode
RecvMultiCast EQU 11 ; accept/reject multicasts
NoLoopBack EQU $0000 ; mask for no loopback
MACLoopBack EQU $0200 ; mask for MAC loopback
ENDECLoopBack EQU $0400 ; mask for ENDEC loopback
TxRxLoopBack EQU $0600 ; mask for Transceiver loopback
MultiRecd EQU 8 ; set when multicast is received
BroadRecd EQU 7 ; set when broadcast is received
RBAEmpty EQU 6 ; set when out of buffers in RBA
CarrierSense EQU 5 ; set when net busy and CRS is active
CollisionSense EQU 4 ; set when collision occurs if COL active
CRCErr EQU 3 ; set if packet has CRC error
FramAlignErr EQU 2 ; set if frame not aligned
LoopBackRecd EQU 1 ; set when loopback is received
ReceivedOK EQU 0 ; set upon successful packet reception
;¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥ (TCR) Transmit Control/Status Register Bits
TxProgInt EQU 15 ; generate a software interrupt
OWCTimer EQU 14 ; "out of window collision" timer control
CRCInhibit EQU 13 ; turn on/off FCS field
ExDeferTimer EQU 12 ; turn on/off excessive defer timer
ExcessDefer EQU 10 ; excessive deferrals detected
DeferredTx EQU 9 ; set when packet is being deferred
NoCRS EQU 8 ; CRS not present during transmission
CRSLost EQU 7 ; bad CRS during transmission
ExcessColl EQU 6 ; > 16 collisions detected
OutWindow EQU 5 ; "out of window" collision detected
PktMonitorBad EQU 3 ; packet monitored as bad
FIFOUnderRun EQU 2 ; Tx FIFO underrun
BCMismatch EQU 1 ; TxPkt_size ­ sum(TxFrag_size)
TransmitOK EQU 0 ; packet transmitted successfuly
;¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥ (DCR) Data Configuration Register Bits
EXBUS EQU 15 ; extended bus mode
LatchBusRetry EQU 13 ; LBR
DConfig_Usr1 EQU 12 ; sets/resets pin USR1
DConfig_Usr0 EQU 11 ; sets/resets pin USR0
SynchTerm EQU 10 ; select sync/async input to DMA
WaitCtl0 EQU $0000 ; 0 bus cycles added to DMA
WaitCtl1 EQU $0040 ; 1 bus cycle added to DMA
WaitCtl2 EQU $0080 ; 2 bus cycles added to DMA
WaitCtl3 EQU $00C0 ; 3 bus cycles added to DMA
DataWidth EQU 5 ; 16/32 bit path width for DMA
BlockMode EQU 4 ; DMA block mode selection
RFT2 EQU $0000 ; 2 word recv FIFO threshold
RFT4 EQU $0004 ; 4 word recv FIFO threshold
RFT8 EQU $0008 ; 8 word recv FIFO threshold
RFT12 EQU $000C ; 12 word recv FIFO threshold
TFT4 EQU $0000 ; 4 word trans FIFO threshold
TFT8 EQU $0001 ; 8 word trans FIFO threshold
TFT12 EQU $0002 ; 12 word trans FIFO threshold
TFT14 EQU $0003 ; 14 word trans FIFO threshold
;¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥ (DCR2) Extended Data Configuration Register Bits
EXUSR3 EQU 15 ; extended user bits
EXUSR2 EQU 14
EXUSR1 EQU 13
EXUSR0 EQU 12
;¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥ (ISR) Interrupt Status Register Bits
BusRetry EQU 14 ; set when bus needed retry
LostHeartBeat EQU 13 ; set when heartbeat is lost
DoneLoadCAM EQU 12 ; set when load CAM operation is done
GetProgInt EQU 11 ; set when programmable int. occurs
RecdPkt EQU 10 ; set when a packet has been recd.
TransDone EQU 9 ; set when trans is finished
TransError EQU 8 ; set when trans finished with an error
TimerElapsed EQU 7 ; set when timer reaches zero
EmptyRDA EQU 6 ; set when receive descriptors exhausted
EmptyRRA EQU 5 ; set when receive resources exhausted
RBAOverFLow EQU 4 ; set when buffer area is full
CRCRollover EQU 3 ; set when CRC tally has reached $FFFF
FAERollover EQU 2 ; set when FAE tally has reached $FFFF
MPRollover EQU 1 ; set when MP tally has reached $FFFF
RxFIFORollover EQU 0 ; set when Rx FIFO overflows
OurIntsMask EQU (1 << BusRetry) + \
(1 << RecdPkt) + \
(1 << TransDone) + \
(1 << TimerElapsed) + \
(1 << RxFIFORollover) + \
(1 << RBAOverFlow) + \
(1 << EmptyRRA)
;¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥ Network Statistics
NetStats RECORD 0 ; network management stats.
TxOK DS.L 1 ; frames transmitted OK
sCollFrame DS.L 1 ; single collision frames
mCollFrame DS.L 1 ; multiple collision frames
CollFrame DS.L 1 ; collision frames
DefTx DS.L 1 ; deferred transmissions
LateColl DS.L 1 ; late collisions
ExcessColl DS.L 1 ; excessive collisions
ExcessDef DS.L 1 ; excessive defferals
InMACTxErr DS.L 1 ; internal MAC transmit errors
RxOK DS.L 1 ; frames received OK
MultiRxOK DS.L 1 ; multicast frames recd OK
BroadRxOK DS.L 1 ; broadcast frames recd OK
FCSerr DS.L 1 ; frame check sequence errors
FAerr DS.L 1 ; frame alignment errors
MPerr DS.L 1 ; missed packet errors
Size EQU *
ENDR
;¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥ General Equates
TalliesPerSec EQU 5000000 ; number of timer ticks/second
TxMaxRetries EQU 4 ; max attempts to retry aborted xmits
Max_Tx_Packets EQU 16 ; maximum # of chained Tx packets
Min_Pkt_Size EQU 60 ; minimum packet size
Min_Rx_Buffs EQU 2 ; minimum # of recv descriptors/buffers
Max_Pkt_Size EQU 1518 ; maximum packet size (inc. CRC)
EOL_Bit EQU 0 ; end-of-link bit
Ctl_Mem_Size EQU Txpkt.TxTDAsize*Max_Tx_Packets+ \; up to Max_Tx_Packets chained transmits
RRArec.RRArecSz+ \; 1 RRA descriptor
CAMDesc.CAMDescSz ; 1 CAM descriptor
Min_Mem_Size EQU Ctl_Mem_Size+ \
Max_Pkt_Size*Min_Rx_Buffs+ \; max. size packets
Rxpkt.RxRDAsize*Min_Rx_Buffs; recv. descriptors

View File

@ -0,0 +1,38 @@
;
; File: VersionEclipse.a
;
; Contains: Version information for Eclipse
;
; Written by: Mike Quinn
;
; Copyright: © 1991-1992 by Apple Computer, Inc., all rights reserved.
;
; This file is used in these builds: Mac32
;
; Change History (most recent first):
;
; <SM2> 2/2/92 CSS Rollin Horror stuff:
; <H6> 10/17/92 BG Changed version to final release version.
; <1> 10/6/92 GDW New location for ROMLink tool.
; <SM2> 6/22/92 mal Updated to 1.0.4d3.
; <1> 6/12/92 RLM first checked in
; <P3> 5/13/92 KW (JC,H4) Change driver to support configuration information
; obtained from ecfg resource rather than from using boxflag
; driven tables.
; <P2> 02/07/92 jmp (jmp,H3/BG,6) Updated version numbers for Zydeco.
; <1> 2/4/92 mal first checked in
; ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
; Pre-Pandora ROM comments begin here.
; ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
; <5> 10/22/91 BG/SAM Changed release version number.
; <4> 5/22/91 BG Updated version to reflect ROM beta.
; <3> 4/21/91 CCH Rolled in Sean Findley's changes.
; <2> 3/14/91 BG (actually sf) Updated driver version information.
; <1> 2/11/91 mjq first checked in
;
PRINT PUSH, GEN, NOMDIR
VERSION 'Quadra Ethernet Driver', 1, 0, 4, final, 1, '1990-1992', '', SonicEnet
PRINT POP

View File

@ -0,0 +1,247 @@
/*
File: ATIDeclGamma.r
Contains: xxx put contents here xxx
Written by: xxx put writers here xxx
Copyright: © 1993 by Apple Computer, Inc., all rights reserved.
Change History (most recent first):
<1> 11/5/93 fau first checked in
<1> 10/27/93 fau first checked in
<1> 10/19/93 fau first checked in
*/
//--------------------------------------------------------------------------
//start
//
//Name: ATIDeclGamma.r
//Creator: George D. Wilson Jr.
//Date: 5/19/92
//
//Purpose: Gamma table declarations
//
//Category: Gamma Tables
//File: ATIDeclGamma.r
//
//Detailed: This file contains gamma table definitions for standard
// Apple monitors.
//
//Note:
//
//History:
//
// Date Programmer Modification
// -------- ---------- -----------------------------------------
//
//stop
//------------------------------------------------------------------------*/
#include "ROMLink.r"
#include "Types.r"
//=====================================================================
// Gamma resource tables
//=====================================================================
#define ColorGammaID 2000
#define HiResGammaID 2001
#define GrayGammaID 2002
#define RubikGammaID 2003
resource 'gdir' (700, "_GammaDirHiRes") {{
128, l{"HiResGamma"};
}};
resource 'gdir' (710, "_GammaDir_16") {{
128, l{"HiResGamma"};
129, l{"ColorGamma"};
}};
resource 'node' (720, "ColorGamma") {{
blocksize{};
word {ColorGammaID}; // gamma res ID
cstring{"Page-White Gamma"};
align {2};
word {$0000}; // gVersion
word {$0000}; // gType
word {$0000}; // gFormulaSize
word {$0003}; // gChanCnt
word {$0100}; // gDataCnt
word {$0008}; // gChanWidth
longs{{
$00030609;$0C101012;$13151616;$181B1C1E; // red channel
$1F222326;$282B2C2F;$3234373A;$3C3F4041;
$42434445;$46474749;$4A4B4C4D;$4E4F5051;
$52535454;$56565758;$595A5B5C;$5D5E5F60;
$61626364;$65666768;$696A6B6C;$6D6E6F70;
$71727273;$74757677;$78797A7A;$7B7C7D7E;
$7F818283;$83848586;$8788898A;$8A8B8C8D;
$8E8F9091;$92939394;$95969798;$98999A9B;
$9C9D9E9F;$A0A1A1A2;$A3A4A4A5;$A6A7A8A8;
$A9AAABAC;$ADADAEAF;$B0B1B2B2;$B3B4B5B5;
$B6B7B8B8;$B9BABBBC;$BCBDBEBF;$C0C0C1C2;
$C3C3C4C5;$C6C6C7C8;$C9C9CACB;$CCCDCDCE;
$CFD0D1D1;$D2D3D4D4;$D5D6D7D7;$D8D9DADA;
$DBDCDDDE;$DEDFE0E1;$E1E2E3E4;$E4E5E6E7;
$E7E8E9EA;$EAEBECED;$EEEEEFF0;$F1F1F2F3;
$F4F4F5F6;$F7F8F8F9;$FAFBFBFC;$FDFEFFFF;
}};
longs{{
$00030609;$0C101018;$20202223;$24252728; // green channel
$292C2D2E;$30323437;$383A3D3F;$40414242;
$43444445;$46474849;$4A4A4B4C;$4D4E4F50;
$51525354;$55565758;$595B5C5D;$5E5F6061;
$62636465;$65666768;$696A6B6C;$6D6E6F70;
$71717273;$74747576;$77787979;$7A7B7C7D;
$7E7F8081;$82838484;$85868788;$88898A8B;
$8C8D8E8E;$8F909192;$93939495;$96969798;
$999A9A9B;$9C9D9E9E;$9FA0A1A2;$A2A3A4A5;
$A5A6A7A8;$A8A9AAAB;$ABACADAE;$AFAFB0B1;
$B2B2B3B4;$B5B5B6B7;$B7B8B9BA;$BABBBCBD;
$BDBEBFC0;$C1C1C2C3;$C3C4C5C6;$C6C7C8C9;
$C9CACBCC;$CCCDCECF;$CFD0D1D2;$D2D3D4D4;
$D5D6D6D7;$D8D9D9DA;$DBDCDCDD;$DEDEDFE0;
$E1E1E2E3;$E4E4E5E6;$E6E7E8E9;$E9EAEBEC;
$ECEDEEEF;$EFF0F1F2;$F2F3F4F4;$F5F6F7F7;
}};
longs{{
$00020508;$0A0D1010;$10202022;$23232425; // blue channel
$25272829;$2A2C2D2E;$2F303233;$34363738;
$3A3C3D3F;$40414142;$42434444;$45454647;
$4748494A;$4A4B4C4D;$4D4E4F4F;$51515253;
$54555656;$5758595A;$5B5C5D5E;$5F606061;
$62626364;$64656666;$67686969;$6A6B6C6C;
$6D6E6F6F;$70717272;$73747475;$76777778;
$79797A7B;$7C7C7D7E;$7F808182;$82838484;
$85868687;$8888898A;$8A8B8C8D;$8D8E8F90;
$90919192;$93939495;$95969797;$9899999A;
$9B9B9C9D;$9D9E9FA0;$A0A1A1A2;$A3A3A4A4;
$A5A6A6A7;$A7A8A9A9;$AAABABAC;$ADADAEAF;
$AFB0B0B1;$B2B2B3B3;$B4B5B5B6;$B6B7B8B8;
$B9BABABB;$BBBCBDBD;$BEBFBFC0;$C0C1C2C2;
$C3C3C4C5;$C5C6C6C7;$C8C8C9C9;$CACBCBCC;
$CCCDCECE;$CFD0D0D1;$D1D2D3D3;$D4D4D5D6;
}};
}};
resource 'node' (730, "HiResGamma") {{
blocksize{};
word {HiResGammaID}; // gamma res ID
cstring{"Mac Std Gamma"};
align {2};
word{$0000}; // gVersion
word{$0000}; // gType
word{$0000}; // gFormulaSize
word{$0001}; // gChanCnt
word{$0100}; // gDataCnt
word{$0008}; // gChanWidth
longs{{
$0005090B;$0E101315;$17191B1D;$1E202224;
$2527282A;$2C2D2F30;$31333436;$37383A3B;
$3C3E3F40;$42434445;$4748494A;$4B4D4E4F;
$50515254;$55565758;$595A5B5C;$5E5F6061;
$62636465;$66676869;$6A6B6C6D;$6E6F7071;
$72737475;$76777879;$7A7B7C7D;$7E7F8081;
$81828384;$85868788;$898A8B8C;$8C8D8E8F;
$90919293;$94959596;$9798999A;$9B9B9C9D;
$9E9FA0A1;$A1A2A3A4;$A5A6A6A7;$A8A9AAAB;
$ABACADAE;$AFB0B0B1;$B2B3B4B4;$B5B6B7B8;
$B8B9BABB;$BCBCBDBE;$BFC0C0C1;$C2C3C3C4;
$C5C6C7C7;$C8C9CACA;$CBCCCDCD;$CECFD0D0;
$D1D2D3D3;$D4D5D6D6;$D7D8D9D9;$DADBDCDC;
$DDDEDFDF;$E0E1E1E2;$E3E4E4E5;$E6E7E7E8;
$E9E9EAEB;$ECECEDEE;$EEEFF0F1;$F1F2F3F3;
$F4F5F5F6;$F7F8F8F9;$FAFAFBFC;$FCFDFEFF;
}};
}};
resource 'node' (740, "GrayGamma") {{
blocksize{};
word {GrayGammaID}; // gamma res ID
cstring{"Mac Gray Gamma"};
align {2};
word{$0000}; // gVersion
word{$0000}; // gType
word{$0000}; // gFormulaSize
word{$0001}; // gChanCnt
word{$0100}; // gDataCnt
word{$0008}; // gChanWidth
longs{{
$000A141D;$23262B2E;$30323437;$393B3C3E;
$40414244;$4547484A;$4B4D4E4F;$50515254;
$55565758;$5A5B5C5D;$5E5F6061;$63646566;
$6768696A;$6B6C6D6E;$6F707171;$72737475;
$76777879;$7A7B7C7D;$7E7F8080;$81828384;
$84858687;$88898A8A;$8B8C8D8E;$8F909091;
$92929394;$95969797;$98999A9A;$9B9C9D9E;
$9E9FA0A1;$A1A2A3A3;$A4A5A6A7;$A7A8A9AA;
$AAABACAD;$ADAEAFAF;$B0B1B2B2;$B3B4B4B5;
$B6B6B7B7;$B8B9B9BA;$BBBCBCBD;$BEBEBFC0;
$C0C1C2C2;$C3C4C5C5;$C6C6C7C8;$C8C9CACB;
$CCCDCDCE;$CFCFD0D0;$D1D2D2D3;$D3D4D5D6;
$D6D7D7D8;$D9D9DADA;$DBDCDDDD;$DEDFDFE0;
$E0E1E2E3;$E3E4E5E5;$E6E6E7E7;$E8E8E9EA;
$EAEBEBEC;$EDEDEEEF;$F0F0F1F2;$F2F3F4F4;
$F5F5F6F7;$F7F8F9FA;$FAFBFCFC;$FDFEFEFF;
}};
}};
resource 'node' (750, "RubikGamma") {{
blocksize{};
word {RubikGammaID}; // gamma res ID
cstring{"Mac RGB Gamma"};
align {2};
word{$0000}; // gVersion
word{$0000}; // gType
word{$0000}; // gFormulaSize
word{$0001}; // gChanCnt
word{$0100}; // gDataCnt
word{$0008}; // gChanWidth
longs{{
$05070809;$0B0C0D0F;$10111214;$15161819;
$1A1C1D1E;$20212223;$24262829;$2A2C2D2F;
$30313334;$36373839;$3A3C3D3E;$40414243;
$44454648;$494B4C4D;$4E4F5051;$52535455;
$5758595A;$5B5C5D5E;$5F606163;$63656567;
$67696A6B;$6C6D6E6F;$70717273;$74757677;
$78797A7A;$7B7C7D7E;$7F818283;$83848586;
$8788898A;$8B8C8D8E;$8E909091;$92939394;
$95969798;$999A9B9C;$9D9E9FA0;$A0A1A2A3;
$A4A4A5A6;$A7A8A9AA;$AAACADAD;$AEAEB0B1;
$B2B3B3B4;$B5B6B7B8;$B9B9BABB;$BCBDBEBF;
$BFC0C1C2;$C2C3C4C5;$C6C7C8C9;$CACBCCCD;
$CDCECECF;$D0D1D2D3;$D3D4D5D6;$D6D7D8D8;
$D9DADBDC;$DDDEDEDF;$E0E1E1E2;$E3E4E4E5;
$E6E7E7E8;$E9EAEBEC;$EDEEEEEF;$EFF0F1F2;
$F3F3F4F5;$F6F7F8F8;$F9F9FAFB;$FCFDFEFF;
}};
}};

View File

@ -0,0 +1,168 @@
/*
File: ATIDeclMonitors.r
Contains: xxx put contents here xxx
Written by: xxx put writers here xxx
Copyright: © 1993 by Apple Computer, Inc., all rights reserved.
Change History (most recent first):
<1> 11/5/93 fau first checked in
<1> 10/27/93 fau first checked in
<1> 10/19/93 fau first checked in
*/
//--------------------------------------------------------------------------
//start
//
//Name: ATIDeclMonitors.r
//Creator: George D. Wilson Jr.
//Date: 9/19/92
//
//Purpose: Defintions for ATI monitors declaration ROM
//
//Category: Gamma Tables
//File: ATIDeclMonitors.r
//
//Detailed: This file contains definitions for video modes for the ATI
// VRAM PCI card.
//
//Note:
//
//History:
//
// Date Programmer Modification
// -------- ---------- -----------------------------------------
//
//stop
//------------------------------------------------------------------------*/
#include "ROMLink.r"
#include "Types.r"
#include "InternalOnlyEqu.r" //skanky stuff
#include "ATIDefROM.r"
//=====================================================================
// _VideoType
//=====================================================================
resource 'styp' (520, "_VideoType") {
catDisplay, //Video sResource : <Category>
typVideo, // <Type>
drSwApple, // <DrvrSw>
drHwATI // <DrvrHw>
};
//=====================================================================
// _VideoName
//=====================================================================
resource 'cstr' (530, "_VideoName") {
"Display_Video_Apple_ATI"
};
//=====================================================================
// Driver directory
//=====================================================================
resource 'ddir' (530, "_VidDrvrDir") {{
sMacOS68020, l{"_sATIDrvrDir"}; //References the Macintosh-OS 68020 driver.
}};
resource 'node' (535, "_sATIDrvrDir") {{
blocksize{};
include{match{{file{$$Shell("RsrcDir")"DeclDataVideo.rsrc"};
type{'decl'};
id{112};}}};
}};
//=====================================================================
// _sRsrc_VideoHR_ATI for Hi-Res monitor
//=====================================================================
resource 'srsc' (500, "_sRsrc_VideoHR_ATI") {{
sRsrcType, l{"_VideoType"}; //References the sResource Type.
sRsrcName, l{"_VideoName"}; //References the sResource Name.
sRsrcDrvrDir, l{"_VidDrvrDir"}; //References the driver directory.
sRsrcFlags, d{6};
sRsrcHWDevId, d{1}; //The hardware device Id.
minorBaseOS, long{defMinorBase}; //References the Minor Base Offset.
minorLength, long{defMinorLength}; //References the Minor Base Length.
sGammaDir, a{"_GammaDir_HR"}; //References the Gamma resource for 13"
oneBitMode, l{"_EightBitModeHR1024"}; //References the first mode parameters.
}};
//=====================================================================
// _sRsrc_VideoHR_Diamond for Hi-Res monitor for Diamond
//=====================================================================
resource 'srsc' (505, "_sRsrc_VideoHR_Diamond") {{
sRsrcType, l{"_VideoType"}; //References the sResource Type.
sRsrcName, l{"_VideoName"}; //References the sResource Name.
sRsrcDrvrDir, l{"_VidDrvrDir"}; //References the driver directory.
sRsrcFlags, d{6};
sRsrcHWDevId, d{1}; //The hardware device Id.
minorBaseOS, long{defMinorBase}; //References the Minor Base Offset.
minorLength, long{defMinorLength}; //References the Minor Base Length.
sGammaDir, a{"_GammaDir_HR"}; //References the Gamma resource for 13"
oneBitMode, l{"_EightBitModeHR640"}; //References the first mode parameters.
}};
//=====================================================================
//=====================================================================
// Hi-Res vidParms records
//=====================================================================
//=====================================================================
//=====================================================================
// Eight-Bit per pixel parameter list for Hi-Res
//=====================================================================
resource 'vmod' (550, "_EightBitModeHR1024") {{
mVidParams, l{"_EightVidParamsHR1024"}; //References the eight-bit mode parameter record.
mPageCnt, d{1}; //The page count.
mDevType, d{clutType}; //The device type.
}};
resource 'vdev' (550, "_EightVidParamsHR1024") {
eightmBaseOffset,
1024, //RowBytes
{eightmBounds_THR,eightmBounds_LHR,eightmBounds_BHR,eightmBounds_RHR},
eightVersion, //bmVersion
0, //packType not used
0, //packSize not used
eightmHRes, //bmHRes
eightmVRes, //bmVRes
eightPixelType, //bmPixelType
eightPixelSize, //bmPixelSize
eightCmpCount, //bmCmpCount
eightCmpSize, //bmCmpSize
eightmPlaneBytes //bmPlaneBytes
};
resource 'vmod' (555, "_EightBitModeHR640") {{
mVidParams, l{"_EightVidParamsHR640"}; //References the eight-bit mode parameter record.
mPageCnt, d{1}; //The page count.
mDevType, d{clutType}; //The device type.
}};
resource 'vdev' (555, "_EightVidParamsHR640") {
eightmBaseOffset,
640, //RowBytes
{eightmBounds_THR,eightmBounds_LHR,eightmBounds_BHR,eightmBounds_RHR},
eightVersion, //bmVersion
0, //packType not used
0, //packSize not used
eightmHRes, //bmHRes
eightmVRes, //bmVRes
eightPixelType, //bmPixelType
eightPixelSize, //bmPixelSize
eightCmpCount, //bmCmpCount
eightCmpSize, //bmCmpSize
eightmPlaneBytes //bmPlaneBytes
};

View File

@ -0,0 +1,133 @@
/*
File: ATIVideoROM.r
Contains: xxx put contents here xxx
Written by: xxx put writers here xxx
Copyright: © 1993 by Apple Computer, Inc., all rights reserved.
Change History (most recent first):
<1> 11/5/93 fau first checked in
<1> 10/27/93 fau first checked in
<1> 10/19/93 fau first checked in
*/
//--------------------------------------------------------------------------
//start
//
//Name: ATIVideoROM.r
//Creator: George D. Wilson Jr.
//Date: 9/19/92
//
//Purpose: Declaration ROM for ATI system
//
//Category: DeclROM
//File: ATIVideoROM.r
//
//Detailed: This file defines the declaration information for the ATI
// mother board. Currently this system defines only the video display
// portion of the system.
//
//Note:
//
//History:
//
// Date Programmer Modification
// -------- ---------- -----------------------------------------
// 10/13/93 George W. Cleaned up some not used resources.
//
//stop
//------------------------------------------------------------------------*/
#include "ROMLink.r"
#include "Types.r"
#include "InternalOnlyEqu.r" //skanky stuff
#include "DepVideoEqu.r"
#include "ATIDefROM.r" //Video driver equates
//
//=====================================================================
// BEGIN Declaration ROM
//=====================================================================
//*************************************************************
//Constants
//*************************************************************
#define TheBoardId $0575 //the Board Id (Special ATI Mother board)
//----------- sResource Directory //<Id OF>
#define sRsrc_Board 1 //Board sResource {May be any number in [0..127]}
#define sRsrc_Video 128 //Video sResource {May be any number in [128..254]}
//=====================================================================
// Directory
//=====================================================================
resource 'sdir' (270, "_sRsrcATIDir") {{
sRsrc_Board, l{"_sRsrc_BdATI"}; //References the board sResource.
sRsrc_VideoHR_ATI, a{"_sRsrc_VideoHR_ATI"}; //References the video sResource Hi-Res
sRsrc_VideoHR_Diamond, a{"_sRsrc_VideoHR_Diamond"}; //References the video sResource Hi-Res
}};
//=============================================================
// sRsrc_Board List - the Board sResource
//=============================================================
resource 'boar' (280, "_sRsrc_BdATI") {{
sRsrcType, l{"_BoardType"}; //References the sResource type
sRsrcName, c{"PCI Video"}; //Official product name
sRsrcIcon, a{"_VidICONCyclone"}; //A new icon
boardId, d{TheBoardId}; //The board Id.
primaryInit, l{"_sPInitRec"}; //References the Primary init record.
vendorInfo, l{"_VendorInfo"}; //References the OPTIONAL Vendor information list.
}};
//=============================================================
// _BoardType - Board type and category
//=============================================================
resource 'styp' (290, "_BoardType") {
catBoard, //<Category> CatBoard ALWAYS = $0001 for bd srsrc
typBoard, //<Type> TypBoard ALWAYS = $0000 for bd srsrc
0, //<DrvrSw> CatBoard ALWAYS = $0000 for bd srsrc
0 //<DrvrHw> CatBoard ALWAYS = $0000 for bd srsrc
};
//=====================================================================
// Primary Init Record
//=====================================================================
resource 'node' (418, "_sPInitRec") {{
blocksize{};
include{match{{file{$$Shell("RsrcDir")"DeclDataVideo.rsrc"};
type{'decl'};
id{110};}}};
}};
//=====================================================================
// Vendor Info record
//=====================================================================
resource 'vend' (420, "_VendorInfo") {{
vendorId, c{"Apple Computer, Inc."};
revLevel, c{"1.0D1x02"};
partNum, c{"0010"};
}};
//=====================================================================
// Format/Header Block
//=====================================================================
resource 'form' (128, "Root") {
l{"_sRsrcDir"},
1, // Should put "romRevision = 1" in ROMLink.r
appleFormat,
0,
$0F
};

View File

@ -0,0 +1,238 @@
/*
File: ATIDefROM.r
Contains: xxx put contents here xxx
Written by: xxx put writers here xxx
Copyright: © 1993 by Apple Computer, Inc., all rights reserved.
Change History (most recent first):
<1> 11/5/93 fau first checked in
<1> 10/27/93 fau first checked in
<1> 10/19/93 fau first checked in
*/
//--------------------------------------------------------------------------
//start
//
//Name: ATIDefROM.r
//Creator: George D. Wilson Jr.
//Date: 9/19/92
//
//Purpose: Defintions for ATI monitors declaration ROM.
//
//Category: Header File
//File: ATIDefROM.r
//
//Detailed: This file contains definitions for video modes for the Apple
// 13" and 16" monitors.
//
//Note:
//
//History:
//
// Date Programmer Modification
// -------- ---------- -----------------------------------------
//
//stop
//------------------------------------------------------------------------*/
#define clutType 0 // 0 if lookup table
#define fixedType 1 // 1 if fixed table
#define directType 2 // 2 if direct values
#define defPixelType 0 // pixeltype=chunky
#define ChunkyDirect 16 // pixelType=ChunkyDirect
#define defmDevType clutType // clutType = 0
#define sRsrc_VideoHR_ATI $80 // Video parameter sResource id
#define sRsrc_Video16 $81 // Video parameter sResource id
#define sRsrc_VideoHR_Diamond $90
//*************************************************************
//Constants
//*************************************************************
//
// Parameter definitions {For Primary init}
//
#define defScrnRow $0080 //Bytes per pixel line
#define defMinorBase 0 //Video RAM Offset is 0
#define defMinorLength $4B000 //Video RAM length is $40000
#define defBaseOffset $00000000 //Offset for ROM
//=============================================================================
// Parameter definitions One bit-per-pixel Hi-Res 13"
//=============================================================================
#define onemBaseOffset defBaseOffset //Offset to base of video RAM
#define onemRowBytesHR $0050 //Rowbytes
#define onemBounds_THR 0 //Bounds.Top
#define onemBounds_LHR 0 //Bounds.Left
#define onemBounds_BHR 480 //Bounds.Bottom
#define onemBounds_RHR 640 //Bounds.Right
#define oneVersion 0 //Version = 0
#define onemHRes $480000 //Horizontal Pixels/inch
#define onemVRes $480000 //Vertical pixels/inch
#define onePixelType clutType //0 = Chunky
#define onePixelSize 1 //Number of bits per pixel
#define oneCmpCount 1 //Number of components in pixel
#define oneCmpSize 1 //Number of bits per component
#define onemPlaneBytes 0 //Offset from one plane to the next.
#define onemPageCnt 1 //Total number of pages
#define onemVertRefRate 67 //Vert refresh rate
#define onemDevType 0 //0 = CLUTType
//=============================================================================
// Parameter definitions Two bit-per-pixel
//=============================================================================
#define twomBaseOffset defBaseOffset //Offset to base of video RAM
#define twomRowBytesHR $00A0 //Rowbytes
#define twomBounds_THR 0 //Bounds.Top
#define twomBounds_LHR 0 //Bounds.Left
#define twomBounds_BHR 480 //Bounds.Bottom
#define twomBounds_RHR 640 //Bounds.Right
#define twoVersion 0 //Version = 0
#define twomHRes $480000 //Horizontal Pixels/inch
#define twomVRes $480000 //Vertical pixels/inch
#define twoPixelType clutType //0 = Chunky
#define twoPixelSize 2 //Number of bits per pixel
#define twoCmpCount 1 //Number of components in pixel
#define twoCmpSize 2 //Number of bits per component
#define twomPlaneBytes 0 //Offset from one plane to the next.
#define twomPageCnt 1 //Total number of pages
#define twomVertRefRate 67 //Vert refresh rate
#define twomDevType 0 //0 = CLUTType
//=============================================================================
// Parameter definitions Four bit-per-pixel
//=============================================================================
#define fourmBaseOffset defBaseOffset //Offset to base of video RAM
#define fourmRowBytesHR $0140 //Rowbytes
#define fourmBounds_THR 0 //Bounds.Top
#define fourmBounds_LHR 0 //Bounds.Left
#define fourmBounds_BHR 480 //Bounds.Bottom
#define fourmBounds_RHR 640 //Bounds.Right
#define fourVersion 0 //Version = 0
#define fourmHRes $480000 //Horizontal Pixels/inch
#define fourmVRes $480000 //Vertical pixels/inch
#define fourPixelType clutType //0 = Chunky
#define fourPixelSize 4 //Number of bits per pixel
#define fourCmpCount 1 //Number of components in pixel
#define fourCmpSize 4 //Number of bits per component
#define fourmPlaneBytes 0 //Offset from one plane to the next.
#define fourmPageCnt 1 //Total number of pages
#define fourmVertRefRate 67 //Vert refresh rate
#define onemDevType 0 //0 = CLUTType
//=============================================================================
// Parameter definitions Eight bit-per-pixel
//=============================================================================
#define eightmBaseOffset defBaseOffset //Offset to base of video RAM
#define eightmRowBytesHR $0400 //Rowbytes
#define eightmBounds_THR 0 //Bounds.Top
#define eightmBounds_LHR 0 //Bounds.Left
#define eightmBounds_BHR 480 //Bounds.Bottom
#define eightmBounds_RHR 640 //Bounds.Right
#define eightVersion 0 //Version = 0
#define eightmHRes $480000 //Horizontal Pixels/inch
#define eightmVRes $480000 //Vertical pixels/inch
#define eightPixelType clutType //0 = Chunky
#define eightPixelSize 8 //Number of bits per pixel
#define eightCmpCount 1 //Number of components in pixel
#define eightCmpSize 8 //Number of bits per component
#define eightmPlaneBytes 0 //Offset from one plane to the next.
#define eightmPageCnt 1 //Total number of pages
#define eightmVertRefRate 67 //Vert refresh rate
#define onemDevType 0 //0 = CLUTType
//=============================================================================
// Parameter definitions Sixteen bit-per-pixel
//=============================================================================
#define sixteenmBaseOffset defBaseOffset //Offset to base of video RAM
#define sixteenmRowBytesHR $0500 //Rowbytes
#define sixteenmBounds_THR 0 //Bounds.Top
#define sixteenmBounds_LHR 0 //Bounds.Left
#define sixteenmBounds_BHR 480 //Bounds.Bottom
#define sixteenmBounds_RHR 640 //Bounds.Right
#define sixteenVersion 0 //Version = 0
#define sixteenmHRes $480000 //Horizontal Pixels/inch
#define sixteenmVRes $480000 //Vertical pixels/inch
#define sixteenPixelType $10 //0 = Chunky $10 = Direct
#define sixteenPixelSize 16 //Number of bits per in pixel
#define sixteenCmpCount 3 //Number of components in pixel
#define sixteenCmpSize 5 //Number of bits per component
#define sixteenmPlaneBytes 0 //Offset from one plane to the next.
#define sixteenmPageCnt 1 //Total number of pages
#define sixteenmVertRefRate 67 //Vert refresh rate
#define sixteenmDevType ChunkyDirect //0 = CLUTType
//=============================================================================
// Parameter definitions One bit-per-pixel
//=============================================================================
#define onemRowBytes16 104 //Rowbytes
#define onemBounds_T16 0 //Bounds.Top
#define onemBounds_L16 0 //Bounds.Left
#define onemBounds_B16 624 //Bounds.Bottom
#define onemBounds_R16 832 //Bounds.Right
//=============================================================================
// Parameter definitions Two bit-per-pixel
//=============================================================================
#define twomRowBytes16 208 //Rowbytes
#define twomBounds_T16 0 //Bounds.Top
#define twomBounds_L16 0 //Bounds.Left
#define twomBounds_B16 624 //Bounds.Bottom
#define twomBounds_R16 832 //Bounds.Right
//=============================================================================
// Parameter definitions Four bit-per-pixel
//=============================================================================
#define fourmRowBytes16 416 //Rowbytes
#define fourmBounds_T16 0 //Bounds.Top
#define fourmBounds_L16 0 //Bounds.Left
#define fourmBounds_B16 624 //Bounds.Bottom
#define fourmBounds_R16 832 //Bounds.Right
//=============================================================================
// Parameter definitions Eight bit-per-pixel
//=============================================================================
#define eightmRowBytes16 832 //Rowbytes
#define eightmBounds_T16 0 //Bounds.Top
#define eightmBounds_L16 0 //Bounds.Left
#define eightmBounds_B16 624 //Bounds.Bottom
#define eightmBounds_R16 832 //Bounds.Right
//=====================================================================
// Video parameter sRsrc resource IDs
//=====================================================================
#define sRsrcVidATIHR $80 // Hi-Res 1,2,4,8,16bpp
#define sRsrcVidATI16 $81 // 16" 1,2,4,8bpp
#define sRsrcVidATIFP $82 // 15" full page
#define sRsrcVidATI12 $83 // 12" monochrome?????
//=====================================================================
// Special defines for SuperMario Build
//=====================================================================
//#define sRsrcUnknownDir 1 // sRsrc Directory for unknown CPUs.
//#define sRsrcUnknownBd 1 // Unknown board sRsrc.
//#define sRsrcBFBasedDir $7F // CPUs supported (or thought about) in the Zydeco ROM.
//#define sRsrc_Vid_DAFB_HRa $C8 // HiRes 8,16,32
//#define sRsrc_Vid_DAFB_LPa $C6 // GoldFish 8,16,32
//#define BoardspIDShift 1 // board spID shift value
//#define sRsrc_BdSpike boxQuadra700+BoardspIDShift // (16+BoardspIDShift)

View File

@ -0,0 +1,464 @@
;
; File: ATIDrvr.a
;
; Contains: xxx put contents here xxx
;
; Written by: xxx put writers here xxx
;
; Copyright: © 1993 by Apple Computer, Inc., all rights reserved.
;
; Change History (most recent first):
;
; <1> 11/5/93 fau first checked in
; <1> 10/27/93 fau first checked in
; <1> 10/19/93 fau first checked in
;
;
;--------------------------------------------------------------------------
;start
;
;Name: ATIDrvr.a
;Creator: George D. Wilson Jr.
;Date: 4/24/92
;
;Purpose: Driver header for the ATI graphics driver.
;
;Category: Driver Header
;File: ATIDrvr.a
;
;Exports: Open - Driver open routine.
; Control - Driver control routine.
; Status - Driver status routine.
; Close - Driver close routine.
; intHandler - ATI VBL interrupt handler.
;
;Locals: done - Common driver exit routine.
;
;Detailed: This file is the assembly front end to the high level
; ATI driver routines. Most routines within this module
; simply setup a call to a high level routine of the same type.
; The only exception to this "Open". Open performs almost
; all the driver and variable initalization.
;
;Note:
;
;History:
;
; Date Programmer Modification
; -------- ---------- -----------------------------------------
;
;stop
;------------------------------------------------------------------------*/
;--------------------------------------------------------------------------
;
; Includes
;
;------------------------------------------------------------------------*/
include 'QuickDraw.a'
include 'Traps.a'
include 'SysEqu.a'
include 'ToolUtils.a'
include 'SysErr.a'
include 'ATIHdr.a'
;--------------------------------------------------------------------------
;
; Imported Variables
;
;------------------------------------------------------------------------*/
globals RECORD 0,INCREMENT
ALIGN 2
globalsSize EQU *-globals
ENDR
Enable EQU 1 ; Turn ATI interrupts on
true EQU 1 ; Boolean true
false EQU 0 ; Boolean false
;--------------------------------------------------------------------------
;
; Imported Procedures
;
;------------------------------------------------------------------------*/
IMPORT OpenDRVR ; High level 'C' open routine
IMPORT ControlDRVR ; High level 'C' control routine
IMPORT StatusDRVR ; High level 'C' status routine
IMPORT CloseDRVR ; High level 'C' close routine
IMPORT DrvrSlotIntHandlerNuBus ; High level 'C' interrupt handler
;--------------------------------------------------------------------------
;
; Local Equates
;
;------------------------------------------------------------------------*/
rSave reg d1-d7/a0-a6 ; Saved registers
;--------------------------------------------------------------------------
;
; Exported Procedures
;
;------------------------------------------------------------------------*/
;--------------------------------------------------------------------------
;
; Driver Headers
;
; *** WARNING: No code must be placed before these headers. ***
;
;------------------------------------------------------------------------*/
ATI MAIN EXPORT
IMPORT Open
IMPORT Close
IMPORT Control
IMPORT Status
ATIDrvr
dc.w $4C00 ; Flags: locked,bye,stat,ctl
dc.w 0 ; Periodic call interval
dc.w 0 ; Not an ornament
dc.w 0 ; No menu
dc.w Open-ATIDrvr ; Open routine offset
dc.w 0 ; Prime routine offset
dc.w Control-ATIDrvr ; Control routine offset
dc.w Status-ATIDrvr ; Status routine offset
dc.w Close-ATIDrvr ; Close routine offset
STRING PASCAL
_DCB_DriverNameATI ; Name of driver
ALIGN 2
_DCW_Version ; Version number of driver
ENDP
;--------------------------------------------------------------------------
;
; Beginning of Procedure Definitions
;
;------------------------------------------------------------------------*/
;--------------------------------------------------------------------------
;start
;
;Name: done
;Creator: George D. Wilson Jr.
;Date: 4/24/92
;
;Purpose: Common exit routine.
;
;Category: Driver Done Handler
;File: ATIDrvr.a
;
;Calls: none
;
;Called By: Open, Close, Status, Control
;
;Entry: A0 - Parameter block pointer.
; A1 - Driver DCE pointer.
;
;Alters: ioResult - In parameter block will be altered.
;
;Exit: D0 - Result code (also copied into parameter block)
;
;Algorithm: If the "noQueueBit" bit is set in the ioTrap field of the
; parameter block, the I/O call is immediate, and exit via
; an RTS instruction. Immediate calls don't go through IODone,
; since the parameter block isn't queued.
;
; If ioResult is less than or equal to zero, return via a
; jump to the Device Manager's IODone routine.
;
; If ioResult is greater than zero, indicating that the I/O
; call is not yet done, return is via an RTS instruction.
;
;History:
;
; Date Programmer Modification
; -------- ---------- ---------------------------------------
;
;stop
;------------------------------------------------------------------------*/
done PROC
bclr #drvrActive,dCtlFlags+1(a1) ; always clear busy bit
move.w ioResult(a0),d0 ; get ioResult
tst.w d0 ; is the call done?
bgt.s @byRts ; no - exit via RTS instr.
btst #noQueueBit-8,ioTrap(a0) ; is the call immediate?
bne.s @byRts ; br if so - exit via RTS instr.
move.l JIODone,-(sp) ; call is done; return to IODone
@byRts
; _Debugger ; MacsBug
rts ;
ENDP
;--------------------------------------------------------------------------
;start
;
;Name: IntHandlerNuBus
;Creator: George D. Wilson Jr.
;Date: 4/24/92
;
;Purpose: ATI interrupt handler.
;
;Category: Slot Interrupt Handler
;File: ATIDrvr.a
;
;Called By: Mac exception handler
;
;Alters:
;
;Detailed: This is the low level entry point for the interrupt generated
; by the cursor VBL.
;
; Currently this routine is called by the 'intMeister' interrupt
; system. It determines which ATI interrupt generated the
; exception and calls the appropriate routine registered.
;
;Note: Keep a eye on this routine if the hardware or the 'intMeister'
; change.
;
;History:
;
; Date Programmer Modification
; -------- ---------- ----------------------------------------
;
;stop
;------------------------------------------------------------------------*/
IntHandlerNuBus PROC EXPORT
; _Debugger
moveq #kOurSlotNum,d0
move.l JVBLTask,a0 ; Make the cursor move
jsr (a0)
moveq #1,d0
@noVBL rts
ENDP
;--------------------------------------------------------------------------
;start
;
;Name: Open
;Creator: George D. Wilson Jr.
;Date: 4/24/92
;
;Purpose: Performs low level driver open functions.
;
;Category: Driver Entry Point.
;File: ATIDrvr.c
;
;Calls: OpenDRVR, done
;
;Entry: a1 - Our driver DCE.
;
;Alters: dCtlStorage - Will be set to the global data storage
; for our driver if everything is OK.
;
; ioResult(a0) - The ioResult field of the parameter
; block will contain a driver error code
; or 'noErr' if everything went OK.
;
;Exit: d0 - Contains a driver error code or 'noErr'
; if everything went OK.
;
;Detailed: This routine leaves all the hard work to the high level routine.
; It expects the high level to indicate the success or failure by
; leaving a result code in D0.
;
;History:
;
; Date Programmer Modification
; -------- ---------- -----------------------------------------
;
;stop
;------------------------------------------------------------------------*/
Open PROC
WITH globals
movem.l rSave,-(sp) ; Save regs
move.l a1,-(sp) ; push DCE pointer
move.l a0,-(sp) ; push parm block pointrt
jsr OpenDRVR ; call C code
add #8,sp ; drop arguments
movem.l (sp)+,rSave ; Restore registers
move.w d0,ioResult(a0) ; Store the result code
bra done
ENDP
;--------------------------------------------------------------------------
;start
;
;Name: Close
;Creator: George D. Wilson Jr.
;Date: 4/24/92
;
;Purpose: Performs driver close function.
;
;Category: Driver Entry Point.
;File: ATIDrvr.c
;
;Calls: close, done
;
;Entry: a0 - Pointer to callers parameter block.
;
; a1 - Pointer to our driver DCE.
;
;Alters: ioResult(a0) - The result field of the parameter block
; is set to the value returned from the
; high level call. The high level routine
; leaves its result in D0.
;
;Exit: d0 - Has a driver error code left by the high level routine.
;
;Detailed: When a driver close call is made this routine passes the
; callers parameter block in A0 and the driver DCE in A1 and
; calls the high level routine. The high routine handles everything.
;
; The high level routine should return a driver error code in D0.
;
;History:
;
; Date Programmer Modification
; -------- ---------- -----------------------------------------
;
;stop
;------------------------------------------------------------------------*/
Close PROC
; _Debugger ; MacsBug
movem.l rSave,-(sp) ; Save regs
move.l a1,-(sp) ; push DCE pointer
move.l a0,-(sp) ; push parm block pointer
jsr CloseDRVR ; call C code
add #8,sp ; drop arguments
movem.l (sp)+,rSave ; Restore registers
move.w d0,ioResult(a0) ; Store the result code
bra done
ENDP
;--------------------------------------------------------------------------
;start
;
;Name: Status
;Creator: George D. Wilson Jr.
;Date: 4/24/92
;
;Purpose: Performs driver status functions.
;
;Category: Driver Entry Point.
;File: ATIDrvr.c
;
;Calls: status, done
;
;Entry: a0 - Pointer to callers parameter block.
;
; a1 - Pointer to our driver DCE.
;
;Alters: ioResult(a0) - The result field of the parameter block
; is set to the value returned from the
; high level call. The high level routine
; leaves its result in D0.
;
;Exit: d0 - Has a driver error code or 'noErr'.
;
;Detailed: This routine is simply an assembly language interface
; to the higher level status routine. It pushs a
; pointer to the callers parameter and then pushs
; a pointer to the driver DCE onto the stack.
;
; The high level routine should return a driver error
; code in D0.
;
;History:
;
; Date Programmer Modification
; -------- ---------- -----------------------------------------
;
;stop
;------------------------------------------------------------------------*/
Status PROC
movem.l rSave,-(sp) ; Save regs
move.l a1,-(sp) ; push DCE pointer
move.l a0,-(sp) ; push parm block pointer
jsr StatusDRVR ; call C code
add #8,sp ; drop arguments
movem.l (sp)+,rSave ; Restore registers
move.w d0,ioResult(a0) ; Store the result code
bra done
ENDP
;--------------------------------------------------------------------------
;start
;
;Name: Control
;Creator: George D. Wilson Jr.
;Date: 4/24/92
;
;Purpose: Performs driver control functions.
;
;Category: Driver Entry Point.
;File: ATIDrvr.c
;
;Calls: control, done
;
;Entry: a0 - Pointer to callers parameter block.
;
; a1 - Pointer to our driver DCE.
;
;Alters: ioResult(a0) - The result field of the parameter block
; is set to the value returned from the
; high level call. The high level routine
; leaves its result in D0.
;
;Exit: d0 - Has a driver error code or 'noErr'.
;
;Detailed: This routine is simply an assembly language interface
; to the higher level control routine. It pushs a
; pointer to the callers parameter and then pushs
; a pointer to the driver DCE onto the stack.
;
; The high level routine should return a driver error
; code in D0.
;
;History:
;
; Date Programmer Modification
; -------- ---------- -----------------------------------------
;
;stop
;------------------------------------------------------------------------*/
Control PROC
movem.l rSave,-(sp) ; Save regs
move.l a1,-(sp) ; push DCE pointer
move.l a0,-(sp) ; push parm block pointrt
jsr ControlDRVR ; call C code
add #8,sp ; drop arguments
movem.l (sp)+,rSave ; Restore registers
move.w d0,ioResult(a0) ; Store the result code
bra done
ENDP
END
;--------------------------------------------------------------------------
;
; End of Module
;
;------------------------------------------------------------------------*/

View File

@ -0,0 +1,610 @@
/*
File: ATIDrvr.c
Contains: xxx put contents here xxx
Written by: xxx put writers here xxx
Copyright: © 1993 by Apple Computer, Inc., all rights reserved.
Change History (most recent first):
<1> 11/5/93 fau first checked in
<1> 10/27/93 fau first checked in
<1> 10/19/93 fau first checked in
*/
/*-------------------------------------------------------------------------
*start
*
*Name: ATIDriver.c
*Creator: George D. Wilson Jr.
*Date: 8/15/93
*
*Purpose: Main interface file for ATI video driver.
*
*Category: Macintosh driver
*File: ATIDrvr.c
*
*Exports: OpenDRVR - Handles initialization of driver.
* CloseDRVR - Handles shutdown of driver.
* ControlDRVR - Handles driver control calls.
* StatusDRVR - Handles driver status calls.
* WaitForVBL - Returns when vertical blanking is active.
*
*Locals:
*
*Detailed:
*
*Note:
*
*History:
*
* Date Programmer Modification
* -------- ---------- -----------------------------------------
*
*stop
*-----------------------------------------------------------------------*/
/*-------------------------------------------------------------------------
*
* Includes
*
*-----------------------------------------------------------------------*/
#include <Types.h>
#include <Video.h>
#include <Devices.h>
#include <Errors.h>
#include <OSUtils.h>
#include <Slots.h>
#include <Memory.h>
#include <Retrace.h>
#include "ATIStdTypes.h"
#include "ATI.h"
#include "ATIDrvr.h"
#include "ATIVideo.h"
#include "NubEqu.h"
/*-------------------------------------------------------------------------
*
* Imported Procedures
*
*-----------------------------------------------------------------------*/
extern UInt16 GetRowBytes(UInt8 monitorID, UInt8 videoMode, UInt8 theSlot);
extern void IntHandlerNuBus();
/*-------------------------------------------------------------------------
*
* Exported Procedures
*
*-----------------------------------------------------------------------*/
UInt16 OpenDRVR (CntrlParam *pb, AuxDCEPtr dce);
UInt16 CloseDRVR (CntrlParam *pb, DCtlPtr dce);
UInt16 ControlDRVR (CntrlParam *pb, DCtlPtr dce);
UInt16 StatusDRVR (CntrlParam *pb, DCtlPtr dce);
/*-------------------------------------------------------------------------
*
* Beginning of Procedure Definitions
*
*-----------------------------------------------------------------------*/
/*-------------------------------------------------------------------------
*start
*
*Name: WaitForVBL
*Creator: George D. Wilson Jr.
*Date: 3/20/92
*
*Purpose:
*
*Category:
*File:
*
*Calls:
*
*Called By:
*
*Entry:
*
*Alters:
*
*Exit:
*
*Detailed:
*
*Algorithm:
*
*Note:
*
*History:
*
* Date Programmer Modification
* -------- ---------- -----------------------------------------
*
*stop
*-----------------------------------------------------------------------*/
void WaitForVBL()
{
short i=0;
i = i+1;
// DebugStr("\pWaitForVBL");
} /* End of WaitForVBL */
/*-------------------------------------------------------------------------
*start
*
*Name: InstallInterruptRoutine
*Creator: George D. Wilson Jr.
*Date: 3/20/92
*
*Purpose:
*
*Category:
*File:
*
*Calls:
*
*Called By:
*
*Entry:
*
*Alters:
*
*Exit:
*
*Detailed:
*
*Algorithm:
*
*Note:
*
*History:
*
* Date Programmer Modification
* -------- ---------- -----------------------------------------
*
*stop
*-----------------------------------------------------------------------*/
void InstallInterruptRoutine(DCtlPtr dce)
{
// OSErr err;
globalsPtr g;
// UInt32 intHi;
// DebugStr("\pInstallInterruptRoutine");
g = (globalsPtr) *(dce->dCtlStorage);
// RegisterNubInt(kVideoLineInt,(InterruptHdlr) IntHandlerNuBus,(long) dce);
g->gInterruptsEnabled = kVBLInterruptEnabled;
} /* End of InstallInterruptRoutine */
/*-------------------------------------------------------------------------
*start
*
*Name: RemoveInterruptRoutine
*Creator: George D. Wilson Jr.
*Date: 3/20/92
*
*Purpose:
*
*Category:
*File:
*
*Calls:
*
*Called By:
*
*Entry:
*
*Alters:
*
*Exit:
*
*Detailed:
*
*Algorithm:
*
*Note:
*
*History:
*
* Date Programmer Modification
* -------- ---------- -----------------------------------------
*
*stop
*-----------------------------------------------------------------------*/
void RemoveInterruptRoutine(DCtlPtr dce)
{
// OSErr err;
globalsPtr g;
// DebugStr("\pRemoveInterruptRoutine");
g = (globalsPtr) *(dce->dCtlStorage);
if ( g->gInterruptsEnabled ) {
WaitForVBL();
if ( *(long*)(kMySlot | kNMRQDisable) );
// RemoveNubInt(kVideoLineInt);
g->gInterruptsEnabled = kVBLInterruptDisabled;
}
}
/*-------------------------------------------------------------------------
*start
*
*Name: OpenDRVR
*Creator: George D. Wilson Jr.
*Date: 3/20/92
*
*Purpose:
*
*Category:
*File:
*
*Calls:
*
*Called By:
*
*Entry:
*
*Alters:
*
*Exit:
*
*Detailed:
*
*Algorithm:
*
*Note:
*
*History:
*
* Date Programmer Modification
* -------- ---------- -----------------------------------------
*
*stop
*-----------------------------------------------------------------------*/
UInt16 OpenDRVR (CntrlParam *pb, AuxDCEPtr dce)
{
#pragma unused(pb)
globalsPtr g;
Handle globs;
UInt16 i;
SpBlock spPb;
// OSErr err;
SPRAMRecord sPRAM;
UInt8 videoMode;
// DebugStr("\pOpenDRVR");
globs = nil;
ResrvMem(GLOBALSSIZE);
globs = NewHandleSysClear(GLOBALSSIZE);
if ( globs == nil ) return(openErr);
dce->dCtlStorage = globs;
HLock(globs);
g = (globalsPtr) *(globs);
//==========================================================================
// Zero all global data stuff
//==========================================================================
g->gGammaPtr = nil;
g->gCurrentPage = kOurVidPage;
g->gCurrentMode = kFirstVideoMode; // 8 bpp Fix this later ¥¥¥
g->gBaseAddr = (Ptr) (kATIVRAMAddr);
g->gFBBaseAddr = (Ptr) (kATIVRAMAddr);
g->gInterruptsEnabled = kVBLInterruptEnabled;
g->gMonoOnly = false; // Device supports color ¥¥¥
g->gLuminanceMode = false; // Current mode is color ¥¥¥
g->gDirectMode = false;
g->gNumLines = kNumLines480; // 13" is 480 ¥¥¥
g->gBigSlotNum = dce->dCtlSlot;
g->gSlotNum = dce->dCtlSlot;
videoMode = kFirstVideoMode;
spPb.spSlot = g->gSlotNum;
spPb.spResult = &sPRAM;
#if 0
err = SReadPRAMRec(&spPb);
if ( err == noErr ) { // Did we get our PRAM?
g->gMonitorID = sPRAM.vendorUse4; // No save the monitor ID
g->gCurrentMode = sPRAM.vendorUse1; // Use the first video mode
if ( g->gCurrentMode > kFirstVideoMode ) {
g->gDirectMode = true;
}
}
#else
g->gDirectMode = false;
g->gMonitorID = kRGB1312; // No save the monitor ID
g->gCurrentMode = kFirstVideoMode;
#endif
g->gRowBytes = GetRowBytes(g->gMonitorID,g->gCurrentMode,g->gSlotNum);
//==========================================================================
// Get or build gamma table
//==========================================================================
g->gGammaPtr = (GammaTablePtr) NewPtrSysClear(sizeof(GammaTable));
if ( g->gGammaPtr ) {
g->gGammaPtr->gFormulaSize = 0;
g->gGammaPtr->gChanCnt = 1;
g->gGammaPtr->gDataCnt = 3;
g->gGammaPtr->gDataCnt = 256;
g->gGammaPtr->gDataWidth = 0x0008;
for ( i = 0; i < kNumCLUTEntries; i++ ) {
g->gGammaPtr->gFormulaData[i] = i;
}
}
#ifndef ROM
// InitNubInts();
// InitNubIntMgr();
#endif
// InstallInterruptRoutine(dce);
#ifdef ROM
// err = AttachVBL(0x0E);
#endif
return(noErr); // Say open was successful
}
/*-------------------------------------------------------------------------
*start
*
*Name: CloseDRVR
*Creator: George D. Wilson Jr.
*Date: 3/20/92
*
*Purpose:
*
*Category:
*File:
*
*Calls:
*
*Called By:
*
*Entry:
*
*Alters:
*
*Exit:
*
*Detailed:
*
*Algorithm:
*
*Note:
*
*History:
*
* Date Programmer Modification
* -------- ---------- -----------------------------------------
*
*stop
*-----------------------------------------------------------------------*/
UInt16 CloseDRVR (CntrlParam *pb, DCtlPtr dce)
{
#pragma unused(pb)
globalsPtr g;
UInt8 mmuMode;
// DebugStr("\pCloseDRVR");
g = (globalsPtr) *(dce->dCtlStorage);
mmuMode = true32b;
SwapMMUMode(&mmuMode);
DoDisableVideo(g->gBigSlotNum); // Turn the video system off
if ( g->gGammaPtr ) { // If we have a gamma table
DisposPtr((Ptr) (g->gGammaPtr)); // Release the memory
}
if ( g->gInterruptsEnabled ) { // If cursor interrupts are enabled
// RemoveInterruptRoutine(dce); // Disable them
}
SwapMMUMode(&mmuMode);
DisposHandle(dce->dCtlStorage); // Release driver globals storage
return(noErr); // Say open was successful
}
/*-------------------------------------------------------------------------
*start
*
*Name: ControlDRVR
*Creator: George D. Wilson Jr.
*Date: 3/20/92
*
*Purpose:
*
*Category:
*File:
*
*Calls:
*
*Called By:
*
*Entry:
*
*Alters:
*
*Exit:
*
*Detailed:
*
*Algorithm:
*
*Note:
*
*History:
*
* Date Programmer Modification
* -------- ---------- -----------------------------------------
*
*stop
*-----------------------------------------------------------------------*/
UInt16 ControlDRVR (CntrlParam *pb, DCtlPtr dce)
{
Int16 message; // The control call being made
OSErr err;
globalsPtr g;
UInt8 mmuMode;
// DebugStr("\pControlDRVR");
g = (globalsPtr) *(dce->dCtlStorage);
mmuMode = true32b;
SwapMMUMode(&mmuMode);
message = pb->csCode;
switch ( message ) {
case cscReset:
err = DoVideoReset((VDPgInfoPtr) *((UInt32 *) &(pb->csParam[0])), dce);
break;
// case cscKillIO:
// err = DoKillIO((VDPgInfoPtr) *((UInt32 *) &(pb->csParam[0])), dce);
// break;
case cscSetMode:
err = DoSetVideoMode((VDPgInfoPtr) *((UInt32 *) &(pb->csParam[0])), dce);
break;
case cscSetEntries:
err = DoSetEntries((VDSetEntryPtr) *((UInt32 *) &(pb->csParam[0])), dce);
break;
case cscSetGamma:
err = DoSetGamma((VDGamRecPtr) *((UInt32 *) &(pb->csParam[0])), dce);
break;
case cscGrayScreen:
err = DoGrayPage((VDPgInfoPtr) *((UInt32 *) &(pb->csParam[0])), dce);
break;
case cscSetGray:
err = DoSetGray((VDGrayPtr) *((UInt32 *) &(pb->csParam[0])), dce);
break;
case cscSetInterrupt:
err = DoSetInterrupt((VDPgInfoPtr) *((UInt32 *) &(pb->csParam[0])), dce);
break;
case cscDirectSetEntries:
err = DoDirectSetEntries((VDSetEntryPtr) *((UInt32 *) &(pb->csParam[0])), dce);
break;
case cscSetDefaultMode:
err = DoSetDefaultMode((VDDefModePtr) *((UInt32 *) &(pb->csParam[0])), dce);
break;
case 200:
err = noErr;
break;
default: err = controlErr;
} // End switch
pb->ioResult = err;
SwapMMUMode(&mmuMode);
return(err);
}
/*-------------------------------------------------------------------------
*start
*
*Name: StatusDRVR
*Creator: George D. Wilson Jr.
*Date: 3/20/92
*
*Purpose:
*
*Category:
*File:
*
*Calls:
*
*Called By:
*
*Entry:
*
*Alters:
*
*Exit:
*
*Detailed:
*
*Algorithm:
*
*Note:
*
*History:
*
* Date Programmer Modification
* -------- ---------- -----------------------------------------
*
*stop
*-----------------------------------------------------------------------*/
UInt16 StatusDRVR (CntrlParam *pb, DCtlPtr dce)
{
Int16 message; // The control call being made
OSErr err; // Error code returned from routine
globalsPtr g;
UInt8 mmuMode;
// DebugStr("\pStatusDRVR");
g = (globalsPtr) *(dce->dCtlStorage);
mmuMode = true32b;
SwapMMUMode(&mmuMode);
message = pb->csCode;
err = statusErr; // Standard error code
switch ( message ) {
case cscGetMode:
err = DoGetMode((VDPgInfoPtr) *((UInt32 *) &(pb->csParam[0])), dce);
break;
case cscGetEntries:
err = DoGetEntries((VDSetEntryPtr) *((UInt32 *) &(pb->csParam[0])), dce);
break;
case cscGetPageCnt:
err = DoGetPages((VDPgInfoPtr) *((UInt32 *) &(pb->csParam[0])), dce);
break;
case cscGetBaseAddr:
err = DoGetBaseAddr((VDPgInfoPtr) *((UInt32 *) &(pb->csParam[0])), dce);
break;
case cscGetGray:
err = DoGetGray((VDGrayPtr) *((UInt32 *) &(pb->csParam[0])), dce);
break;
case cscGetInterrupt:
err = DoGetInterrupt((VDPgInfoPtr) *((UInt32 *) &(pb->csParam[0])), dce);
break;
case cscGetGamma:
err = DoGetGamma((VDGamRecPtr) *((UInt32 *) &(pb->csParam[0])), dce);
break;
case cscGetDefaultMode:
err = DoGetDefaultMode((VDDefModePtr) *((UInt32 *) &(pb->csParam[0])), dce);
break;
} // End switch
pb->ioResult = err; // Pass result code on
SwapMMUMode(&mmuMode);
return(err);
}
/*-------------------------------------------------------------------------
*
* End of Module
*
*-----------------------------------------------------------------------*/

View File

@ -0,0 +1,304 @@
/*
File: ATIDrvr.h
Contains: xxx put contents here xxx
Written by: xxx put writers here xxx
Copyright: © 1993 by Apple Computer, Inc., all rights reserved.
Change History (most recent first):
<1> 11/5/93 fau first checked in
<1> 10/27/93 fau first checked in
<1> 10/19/93 fau first checked in
*/
/*-------------------------------------------------------------------------
*start
*
*Name: ATIDrvr.h
*Creator: George D. Wilson Jr.
*Date: 3/17/92
*
*Purpose: Contains structures and defines for the RISC video driver.
*
*Category: Header File
*File: ATIDrvr.h
*
*Detailed:
*
*Note:
*
*History:
*
* Date Programmer Modification
* -------- ---------- -----------------------------------------
*
*stop
*-----------------------------------------------------------------------*/
#define ATI 1 // Indicate we are for ATI hardware
#define kNumPages 1 // Number of video pages
#define kOurVidPage 0 // The video page we use Always 0 on Quadra
#define kVBLInterruptEnabled 0 // VBL interrupts enabled return value
#define kVBLInterruptDisabled 1 // VBL interrupts disenabled return value
#define kDAFBHWID 0x001C // DAFB hardware device ID
#define kRowBytes138bpp 0x400 // Apple 13" rowbytes 8bpp
// #define kRowBytes1316bpp 0x500 // Apple 13" rowbytes 16bpp
// #define kRowBytes1324bpp 0xA00 // Apple 13" rowbytes 24bpp
#define kNumLines480 480 //
#define kNumCLUTEntries 256 // Number of entries in the CLUT
#define kSuper9 0x90000000
#define kSuperA 0xA0000000
#define kSuperB 0xB0000000
#define kSuperC 0xC0000000
#define kSuperD 0xD0000000
#define kSuperE 0xE0200000
#define kSlot9 0x09000000
#define kSlotA 0x0A000000
#define kSlotB 0x0B000000
#define kSlotC 0x0C000000
#define kSlotD 0x0D000000
#define kSlotE 0x0E000000
#define kMySlot kSlotE // Used to access ATI with Nub601
#ifdef ROM
#define kMySlot8 0x00 // Used to access ATI sResource structs
#else
#define kMySlot8 0x0E // Used to access ATI with Nub601
#endif
#define kMySuperSlot kSuperE // Used to access ATI with Nub601
#define kFirstVideoMode 0x80
#define kSecondVideoMode 0x81
#define kThirdVideoMode 0x82
#define kFourthVideoMode 0x83
#define kFifthVideoMode 0x84
#define kSixthVideoMode 0x85
//===============================================================================
// Below are the bit patterns to write into memory for each of the supported
// bit depths.
//===============================================================================
#define kOneBitPattern 0xAAAAAAAA
#define kTwoBitPattern 0xCCCCCCCC
#define kFourBitPattern 0xF0F0F0F0
#define kEightBitPattern 0xFF00FF00
#define kSixTeenBitPattern 0xFFFF0000
#define kThirtyTwoBitPattern 0xFFFFFFFF
#define kGrayCLUTValue 0x00808080 // Value to gray the CLUT
#define kRedLumValue 0x4CCC
#define kGreenLumValue 0x970A
#define kBlueLumValue 0x1C29
//===============================================================================
// The following definitions define the number of long word writes to
// to do to fill one line of video on the 13" monitor.
// This should be changed later to be monitor indepentent.
//===============================================================================
#define kOneBitBytes 0x14 // Number of long writes for one bpp
#define kTwoBitBytes 0x28 // Number of long writes for two bpp
#define kFourBitBytes 0x50 // Number of long writes for four bpp
#define kEightBitBytes 0xA0 // Number of long writes for eight bpp
#define kSixTeenBitBytes 0x140 // Number of long writes for sixteen bpp
#define kThirtyTwoBitBytes 0x280 // Number of long writes for thirty two bpp
#define kMonoDevice 0x01 // Monochrome device
#define kNonMonoDevice 0x00 // Non luminance mapping device
// #define kNumLines 480 // Number of lines on a 13"
//==========================================================================
// Sense line decode values
//==========================================================================
#define kSenseLineReset 0x00000007 // Drives all lines low
#define kSenseLineAMask 0x00000006 // Drives the A bit
#define kSenseLineBMask 0x00000005 // Drives the B bit
#define kSenseLineCMask 0x00000003 // Drives the C bit
#define kSenseLineMask 0x00000070 // Only the first three bits are used
#define kMonitorNotConnected 0x07 // No monitor or extended value
#define kRGB21 0x00 // 21" RGB display 1152x870 100.0 MHz
#define kFullPage 0x01 // Full page display 640x870 57.28 MHz
#define kRGB12 0x02 // 12" RGB display 512x384 15.67 MHz
#define kTwoPage 0x03 // Two page display 1152x870 100.0 MHz
#define kNTSC 0x04 // NTSC display varxvar 12.27 MHz
#define kRGB15 0x05 // 15" RGB display 640x870 57.28 MHz
#define kRGB1312 0x06 // Hi-Res 13" & 12" displays 30.24 MHz
#define k16SenseACode 0x02 // Value received from A mask
#define k16SenseBCode 0x05 // Value received from B mask
#define k16SenseCCode 0x02 // Value received from C mask
//==========================================================================
// Slot manager defines for the timing sResources
//==========================================================================
#define kATIVidParmSpId 0x7E // Resource id for the all ATI video systems
#define kNoMonitorConnected 0xFF // No Monitor connected to system
#define kRGB1312Connected 0x80 // Hi-Res sRsrc ID
#define kRGB16Connected 0x81 // 16" sRsrc ID
#define kRGB21Connected 0x82 // sRsrc ID
#define kFullPageConnected 0x83 // sRsrc ID
#define kRGB12Connected 0x84 // sRsrc ID
#define kTwoPageConnected 0x85 // sRsrc ID
#define kNTSCConnected 0x86 // sRsrc ID
#define kRGB15Connected 0x87 // sRsrc ID
#define kEndeavorParmSpId 0x80 // Resource id of Endeavor SBlock
#define kACDCParmSpId 0x81 // Resource id of ACDC SBlock
#define kSwatchParmSpId 0x82 // Resource id of Swatch SBlock
//==========================================================================
// Definition of default mode data structure
//==========================================================================
struct VDDefMode {
UInt8 csID;
};
typedef struct VDDefMode VDDefMode;
typedef VDDefMode *VDDefModePtr, **VDDefModeHandle;
#define kVDDefModeSize (sizeof(VDDefMode))
//==========================================================================
// Exported status routines
//==========================================================================
OSErr DoGetBaseAddr(VDPgInfoPtr pgPtr, DCtlPtr dce);
OSErr DoGetDefaultMode(VDDefModePtr dfPtr, DCtlPtr dce);
OSErr DoGetEntries(VDSetEntryPtr pgPtr, DCtlPtr dce);
OSErr DoGetGamma(VDGamRecPtr gPtr, DCtlPtr dce);
OSErr DoGetGray(VDGrayPtr pgPtr, DCtlPtr dce);
OSErr DoGetInterrupt(VDPgInfoPtr flgPtr, DCtlPtr dce);
OSErr DoGetMode(VDPgInfoPtr pgPtr, DCtlPtr dce);
OSErr DoGetPages(VDPgInfoPtr pgPtr, DCtlPtr dce);
//==========================================================================
// Exported control routines
//==========================================================================
OSErr DoVideoReset(VDPgInfoPtr pgPtr, DCtlPtr dce);
OSErr DoSetVideoMode(VDPgInfoPtr pgPtr, DCtlPtr dce);
OSErr DoSetEntries(VDSetEntryPtr pgPtr, DCtlPtr dce);
OSErr DoSetGamma(VDGamRecPtr pgPtr, DCtlPtr dce);
OSErr DoGrayPage(VDPgInfoPtr pgPtr, DCtlPtr dce);
OSErr DoSetGray(VDGrayPtr pgPtr, DCtlPtr dce);
OSErr DoSetInterrupt(VDPgInfoPtr pgPtr, DCtlPtr dce);
OSErr DoDirectSetEntries(VDSetEntryPtr pgPtr, DCtlPtr dce);
OSErr DoSetDefaultMode(VDDefModePtr dfPtr, DCtlPtr dce);
//==========================================================================
// Definition of slot manager vendor PRAM data structure
//==========================================================================
struct SPRAMRecord {
UInt16 boardID;
UInt8 vendorUse1;
UInt8 vendorUse2;
UInt8 vendorUse3;
UInt8 vendorUse4;
UInt8 vendorUse5;
UInt8 vendorUse6;
};
typedef struct SPRAMRecord SPRAMRecord;
typedef SPRAMRecord *SPRAMRecordPtr, **SPRAMRecordHandle;
#define kSPRAMRecordSize (sizeof(SPRAMRecord))
//==========================================================================
// Definition of gamma table data structure
//==========================================================================
struct GammaTable {
short gVersion; // gamma version number
short gType; // gamma data type
short gFormulaSize; // Formula data size
short gChanCnt; // number of channels of data
short gDataCnt; // number of values/channel
short gDataWidth; // bits/corrected value (data packed to next larger byte size)
char gFormulaData[255*3]; // data for formulas followed by gamma values
};
typedef struct GammaTable GammaTable;
typedef GammaTable *GammaTablePtr, **GammaTableHandle;
#define kGammaTableSize (sizeof(GammaTable))
struct ACDCVidParms {
UInt8 pbcr0ValueFirstMode;
UInt8 pbcr1ValueFirstMode;
UInt8 pbcr0ValueSecondMode;
UInt8 pbcr1ValueSecondMode;
UInt8 pbcr0ValueThirdMode;
UInt8 pbcr1ValueThirdMode;
};
typedef struct ACDCVidParms ACDCVidParms;
typedef struct ACDCVidParms *ACDCVidParmsPtr;
typedef struct ACDCVidParms **ACDCVidParmsHdl;
#define ACDCVIDPARMSSIZE ((UInt32) sizeof(ACDCVidParms))
struct endeavorVidParms {
UInt8 MRegValue;
UInt8 NRegValue;
};
typedef struct endeavorVidParms endeavorVidParms;
typedef struct endeavorVidParms *endeavorVidParmsPtr;
typedef struct endeavorVidParms **endeavorVidParmsHdl;
#define ENDEAVORVIDPARMSSIZE ((UInt32) sizeof(endeavorVidParms))
struct globals {
GammaTablePtr gGammaPtr;
Ptr gBaseAddr;
Ptr gFBBaseAddr;
Boolean gInterruptsEnabled;
Boolean gMonoOnly;
Boolean gLuminanceMode;
Boolean gDirectMode;
UInt16 gNumLines;
UInt16 gRowBytes;
UInt16 gCurrentPage;
UInt32 gBigSlotNum;
UInt8 gMonitorID;
UInt8 gSlotNum;
UInt8 gCurrentMode;
SlotIntQElement qElem;
};
typedef struct globals globals;
typedef struct globals *globalsPtr;
typedef struct globals **globalsH;
#define GLOBALSSIZE ((UInt32) sizeof(globals))
//==========================================================================
// Utility routines
//==========================================================================
void RemoveInterruptRoutine(DCtlPtr dce);
void InstallInterruptRoutine(DCtlPtr dce);
void DoDisableVideo(UInt32 theSlot);
/*-------------------------------------------------------------------------
*
* End of Module
*
*-----------------------------------------------------------------------*/

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,84 @@
;
; File: ATIHdr.a
;
; Contains: xxx put contents here xxx
;
; Written by: xxx put writers here xxx
;
; Copyright: © 1993 by Apple Computer, Inc., all rights reserved.
;
; Change History (most recent first):
;
; <1> 11/5/93 fau first checked in
; <1> 10/27/93 fau first checked in
; <1> 10/19/93 fau first checked in
;
;
;--------------------------------------------------------------------------
;start
;
;Name: ATIHdr.a
;Creator: George D. Wilson Jr.
;Date: 4/24/92
;
;Purpose: Common equates and defines for ATI driver.
;
;Category: Driver Header include file
;File: ATIHdr.a
;
;Detailed: This assembly include file contains common equates for
; the version information of the ATI video driver
; and PrimaryInit.
;
;History:
;
; Date Programmer Modification
; -------- ---------- -----------------------------------------
;
;stop
;------------------------------------------------------------------------*/
kOurSlotNum EQU $E ;; The slot of the Nub Card
; -------------------------------------------------------------------
; +++++++++++++++++++++++ Version Control Constants +++++++++++++++++
; -------------------------------------------------------------------
gbla &numericVersion ; Numeric Version Number
&numericVersion seta $1000
gblc &textVersion ; Textual Version Number
&textVersion setc '1.0D1x1'
gblc &driverName
&driverName setc 'Display_Video_Apple_ATI' ; Driver name
; -------------------------------------------------------------------
; Macros for Accessing Version and Name Constants
; -------------------------------------------------------------------
MACRO
_DCB_RevLevel
gblc &textVersion
DC.B '&textVersion'
ENDM
MACRO
_DCB_DriverNameATI
gblc &driverName
DC.B '.&driverName'
ENDM
MACRO
_DCW_Version
gbla &numericVersion
DC.W &numericVersion
ENDM
;--------------------------------------------------------------------------
;
; End of Module
;
;------------------------------------------------------------------------*/

View File

@ -0,0 +1,87 @@
;
; File: ATIPrimaryInit.a
;
; Contains: xxx put contents here xxx
;
; Written by: xxx put writers here xxx
;
; Copyright: © 1993 by Apple Computer, Inc., all rights reserved.
;
; Change History (most recent first):
;
; <1> 11/5/93 fau first checked in
; <1> 10/27/93 fau first checked in
; <1> 10/19/93 fau first checked in
;
;
;--------------------------------------------------------------------------
;start
;
;Name: PrimaryInit.a
;Creator: George D. Wilson Jr.
;Date: 8/10/93
;
;Purpose: Does the jump into the high C PrimaryInit code.
;
;Category: INIT Point.
;File: PrimaryInit.a
;
;Calls: REALMAIN
;
;Entry: a0 - Pointer to slot exec parameter block.
;
;Alters: See high level code for alters.
;
;Detailed: This entry point pushes the slot exec parameter block
; onto the stack and jumps to the high level C. It upon
; returning from the C routine simply returns with an rts.
;
;History:
;
; Date Programmer Modification
; -------- ---------- -----------------------------------------
;
;stop
;------------------------------------------------------------------------*/
;--------------------------------------------------------------------------
;
; Includes
;
;------------------------------------------------------------------------*/
INCLUDE 'ROMEqu.a' ;Declaration ROM equates
INCLUDE 'Slots.a' ;Declaration ROM equates
;--------------------------------------------------------------------------
;
; Main Entry Point
;
;------------------------------------------------------------------------*/
Begin MAIN EXPORT
IMPORT REALMAIN
DC.B sExec2
DC.B sCPU68020
DC.W 0
DC.L theCode-* ; Offset to executable
theCode
WITH SEBlock,SpBlock
move.l a0,-(sp) ; Move the SEBlock on stack
jsr REALMAIN ; Call high level C code
addq.l #4,sp ; Drop arguments
rts
ENDP
END
;--------------------------------------------------------------------------
;
; End of Module
;
;------------------------------------------------------------------------*/

View File

@ -0,0 +1,546 @@
/*
File: ATIPrimaryInit.c
Contains: xxx put contents here xxx
Written by: xxx put writers here xxx
Copyright: © 1993 by Apple Computer, Inc., all rights reserved.
Change History (most recent first):
<1> 11/5/93 fau first checked in
<1> 10/27/93 fau first checked in
<1> 10/19/93 fau first checked in
*/
/*-------------------------------------------------------------------------
*start
*
*Name: PrimaryInit.c
*Creator: George D. Wilson Jr.
*Date: 4/23/92
*
*Purpose: Main interface file for ATI video driver primary init.
*
*Category: Macintosh driver
*File: PrimaryInit.c
*
*Exports: main - Main entry point for primary init.
*
*Detailed:
*
*Note:
*
*History:
*
* Date Programmer Modification
* -------- ---------- -----------------------------------------
*
*stop
*-----------------------------------------------------------------------*/
/*-------------------------------------------------------------------------
*
* Includes
*
*-----------------------------------------------------------------------*/
#include <Types.h>
#include <Video.h>
#include <Devices.h>
#include <Errors.h>
#include <OSUtils.h>
#include <Slots.h>
#include <Memory.h>
#include "ATIStdTypes.h"
#include "ATI.h"
#include "ATIDrvr.h"
#include "ATIVideo.h"
/*-------------------------------------------------------------------------
*
* Imported Procedures
*
*-----------------------------------------------------------------------*/
extern void PruneMonitors(UInt16 cardType, UInt8 theSlot);
extern UInt16 GetRowBytes(UInt8 monitorID, UInt8 videoMode, UInt8 theSlot);
extern UInt16 GetNumLines(UInt8 monitorID, UInt8 videoMode, UInt8 theSlot);
extern void DoProgramTiming(UInt32 slotNum, Ptr baseAddr, UInt8 monitorID,
UInt8 videoMode, UInt8 ourSlot, UInt16 rowBytes,
Boolean enableInterrupts);
extern void DoEnableVideo(UInt32 theSlot);
/*-------------------------------------------------------------------------
*start
*
*Name: SenseLineCheck
*Creator: George D. Wilson Jr.
*Date: 5/21/92
*
*Purpose: Returns the currently connected monitor code.
*
*Category:
*File: PrimaryInit.c
*
*Calls:
*
*Called By:
*
*Entry:
*
*Alters:
*
*Exit: UInt8 - Returns the sRsrc id of the monitor family connected.
*
*Detailed:
*
*Algorithm:
*
*Note:
*
*History:
*
* Date Programmer Modification
* -------- ---------- -----------------------------------------
* 9/28/93 George W. Added default return of 13" display.
*
*stop
*-----------------------------------------------------------------------*/
UInt8
SenseLineCheck(UInt32 theSlot)
{
UInt32 *SenseRegPtr;
UInt32 senseLineVal1,senseLineVal2,senseLineVal3;
// DebugStr("\pSenseLineCheck");
return(kRGB1312Connected); // ¥¥¥ ATI hack
SenseRegPtr = (UInt32 *) (theSlot | kATISenseLineBase);
senseLineVal1 = *SenseRegPtr; // Read the sense lines
senseLineVal1 &= kSenseLineMask; // Mask off the sense line bits
senseLineVal1 >= kSenseLineShift;
switch ( senseLineVal1 ) {
case kMonitorNotConnected:
*SenseRegPtr = (kSenseLineAMask); // Set all lines to ones
// *SenseRegPtr = (kSenseLinesReg); // Causes sense lines to be read
senseLineVal1 = *SenseRegPtr; // Read the sense lines
senseLineVal1 &= kSenseLineMask; // Mask off the sense line bits
senseLineVal1 >= kSenseLineShift; // Move bits to bottom
*SenseRegPtr = (kSenseLineBMask); // Set all lines to ones
// *SenseRegPtr = (kSenseLinesReg); // Causes sense lines to be read
senseLineVal2 = *SenseRegPtr; // Read the sense lines
senseLineVal2 &= kSenseLineMask; // Mask off the sense line bits
senseLineVal2 >= kSenseLineShift; // Move bits to bottom
*SenseRegPtr = (kSenseLineCMask); // Set all lines to ones
// *SenseRegPtr = (kSenseLinesReg); // Causes sense lines to be read
senseLineVal3 = *SenseRegPtr; // Read the sense lines
senseLineVal3 &= kSenseLineMask; // Mask off the sense line bits
senseLineVal3 >= kSenseLineShift; // Move bits to bottom
if ( (senseLineVal1 == kSenseLineAMask) &&
(senseLineVal2 == kSenseLineBMask) &&
(senseLineVal3 == kSenseLineCMask) ) {
return(kMonitorNotConnected);
}
if ( (senseLineVal1 == k16SenseACode) &&
(senseLineVal2 == k16SenseBCode) &&
(senseLineVal3 == k16SenseCCode) ) {
return(kRGB16Connected);
}
return(kMonitorNotConnected);
break;
case kRGB1312:
return(kRGB1312Connected);
break;
default: return(kMonitorNotConnected);
}
} /* End of SenseLineCheck */
void RampCLUT (UInt8 devID, UInt16 cardType)
{
UInt32 i;
UInt8 *clutAddrReg;
UInt8 *clutData;
// UInt32 dummy;
// DebugStr("\pRampClut");
IOLongWrite(0xF2800000, (devID << 12) | 4);
*(unsigned char *)(0xF2C00000) = 0x3;
PerformPCIHack();
if (cardType == kATIVendorID) {
clutAddrReg = (UInt8 *) kDAC_W_INDEX;
clutData = (UInt8 *) kDAC_DATA; // Point to data register
*clutAddrReg = 0; // Point to the first entry
PerformPCIHack();
for ( i = 0; i < 256; i++ ) {
*clutData = kGrayCLUTValue;
PerformPCIHack();
*clutData = kGrayCLUTValue;
PerformPCIHack();
*clutData = kGrayCLUTValue;
PerformPCIHack();
}
}
if (cardType == kDiamondVendorID) {
unsigned char *writeReg;
unsigned char *dataReg;
writeReg = (unsigned char *)(0xF20003C8); // kRamWrite
dataReg = (unsigned char *)(0xF20003C9); // kPaletteData
*writeReg = 0;
PerformPCIHack();
for (i = 0; i < 256; i++) {
*dataReg = (unsigned char)i; // red
PerformPCIHack();
*dataReg = (unsigned char)i; // green
PerformPCIHack();
*dataReg = (unsigned char)i; // blue
PerformPCIHack();
}
}
IOLongWrite(0xF2800000, (devID << 12) | 4);
*(unsigned char *)(0xF2C00000) = 0x2;
PerformPCIHack();
} /* End of RampClut */
/*-------------------------------------------------------------------------
*start
*
*Name: GrayPage
*Creator: George D. Wilson Jr.
*Date: 3/30/92
*
*Purpose:
*
*Category:
*File: PrimaryInit.c
*
*Calls:
*
*Called By:
*
*Entry:
*
*Alters:
*
*Exit:
*
*Detailed:
*
*Algorithm:
*
*Note:
*
*History:
*
* Date Programmer Modification
* -------- ---------- -----------------------------------------
*
*stop
*-----------------------------------------------------------------------*/
OSErr GrayPage(Ptr baseAddr, UInt16 rowBytes, UInt8 depth, UInt16 numLines)
{
UInt32 grayPattern;
UInt32 numWrites;
Ptr linePtr;
UInt32 *dumbPtr;
UInt16 i,j;
#if 0
Ptr myPtr;
UInt16 k, huh, huh1;
#endif
// DebugStr("\pGrayPage");
switch ( depth ) {
case 1: grayPattern = kOneBitPattern; break;
case 2: grayPattern = kTwoBitPattern; break;
case 4: grayPattern = kFourBitPattern; break;
case 8: grayPattern = kEightBitPattern; break;
case 16: grayPattern = kSixTeenBitPattern; break;
case 32: grayPattern = kThirtyTwoBitPattern; break;
}
numWrites = rowBytes / 4;
linePtr = (Ptr) baseAddr;
if ( depth == 32 ) {
for ( i = 0; i < numLines; i++ ) {
dumbPtr = (UInt32 *) linePtr;
for ( j = 0; j < numWrites; j++ ) {
*dumbPtr++ = grayPattern;
grayPattern = ~grayPattern;
}
linePtr += rowBytes;
grayPattern = ~grayPattern;
}
} else {
for ( i = 0; i < numLines; i++ ) {
dumbPtr = (UInt32 *) linePtr;
for ( j = 0; j < numWrites; j++ ) {
*dumbPtr++ = grayPattern;
}
linePtr += rowBytes;
grayPattern = ~grayPattern;
}
}
// code to dump the DACs into the frame buffer.
// 16x16 rectangles each with a different pixel value.
#if 0
huh = 0;
for (i = 0; i < numLines; i++) {
linePtr = (Ptr) baseAddr + (i * rowBytes);
myPtr = linePtr;
huh1 = huh;
for (j = 0; j < 16; j++) {
for (k = 0; k < 40; k++) {
*myPtr = huh1;
myPtr++;
}
huh1++;
}
if (i % 30 == 0 && i > 0) {
huh += 16;
}
}
#endif
return(noErr);
} /* End of GrayPage */
void CalcSlotBaseAddr (UInt8 slot, UInt32 *baseAddr32, UInt32 *baseAddrFB32)
{
UInt8 slotNum;
slotNum = slot;
*baseAddr32 = ((UInt32) (0x0F0 | slotNum) << 24);
*baseAddrFB32 = (UInt32) ((0x0F00 | (slotNum << 4) | slotNum) << 20);
}
/*-------------------------------------------------------------------------
*start
*
*Name: REALMAIN
*Creator: George D. Wilson Jr.
*Date: 5/21/92
*
*Purpose: Main entry point for the ATI primary init.
*
*Category: Entry Point
*File: PrimaryInit.c
*
*Calls:
*
*Called By:
*
*Entry:
*
*Alters:
*
*Exit: UInt8
*
*Detailed:
*
*Algorithm:
*
*Note:
*
*History:
*
* Date Programmer Modification
* -------- ---------- -----------------------------------------
* 5/21/92 George W. Added sense line logic.
*
*stop
*-----------------------------------------------------------------------*/
void REALMAIN (SEBlock *aSEBlockPtr)
{
Ptr baseAddr=0;
Ptr baseAddrFB;
UInt16 rowBytes;
UInt32 slotNum;
UInt8 slot;
UInt8 mmuMode;
UInt8 theMonitorID;
SpBlock spPb;
OSErr err;
SPRAMRecord sPRAM;
UInt8 videoMode=0;
UInt16 numLines;
UInt16 depth;
UInt16 cardType;
mmuMode = true32b;
SwapMMUMode(&mmuMode);
slot = aSEBlockPtr->seSlot; // Get out slot number
slotNum = kMySuperSlot;
#if 0
PruneMonitors(theMonitorID,slot);
if ( (theMonitorID < kRGB1312Connected) ||
(theMonitorID > kRGB16Connected) ) { // We only support 13"
aSEBlockPtr->seStatus = -1;
return; // All done get out
}
// CalcSlotBaseAddr(slot,&baseAddr,&baseAddrFB);
baseAddr = (Ptr) (kBaseAddress | kMySuperSlot);
baseAddrFB = (Ptr) (kBaseAddress | kMySlot | 0xF0000000);
videoMode = kFirstVideoMode;
spPb.spSlot = slot;
spPb.spResult = &sPRAM;
err = SReadPRAMRec(&spPb);
if ( err == noErr ) { // Did we get our PRAM?
if ( sPRAM.vendorUse4 != theMonitorID ) { // Is this the same monitor as last time?
sPRAM.vendorUse4 = theMonitorID; // No save the monitor ID
spPb.spsPointer = (Ptr) &sPRAM; // Heres the PRAM record to save
err = SPutPRAMRec(&spPb); // Save it for ever
} else { // Yes
if ( (sPRAM.vendorUse1 >= kFirstVideoMode) || // Range check mode value
(sPRAM.vendorUse1 >= kFifthVideoMode) ) {
videoMode = sPRAM.vendorUse1; // If mode value is funny save default.
}
}
}
rowBytes = GetRowBytes(theMonitorID,videoMode,slot);
numLines = GetNumLines(theMonitorID,videoMode,slot);
DoProgramTiming(kMySuperSlot,(Ptr) kBaseAddress,
theMonitorID,videoMode,slot, rowBytes,false);
depth = GetBitDepth(theMonitorID,videoMode,slot);
GrayPage(baseAddrFB,rowBytes,8,numLines);
RampCLUT();
DoEnableVideo(slotNum);
#else
//====================================================
// New funky code for ATI card
//====================================================
slot = FindPCICard(&cardType); // Search some slots for ATI
if ( slot == 0x00 ) {
aSEBlockPtr->seStatus = -1;
return; // All done get out
}
err = EnableIOAccess(slot, true, cardType);
if ( err != noErr ) {
aSEBlockPtr->seStatus = -1;
return; // All done get out
}
{
OSErr err;
SpBlock spPb;
char *p;
short i;
p = (char *) &spPb;
for ( i = 0; i < sizeof(SpBlock); i++ ) *p++ = 0;
spPb.spSlot = 0x00;
if ( cardType == kATIVendorID) { // look for ATI
spPb.spID = 0x90; // id of board sRsrc to delete
}
if ( cardType == kDiamondVendorID) { // look for Diamond
spPb.spID = 0x80; // The id of the board sRsrc
}
err = SDeleteSRTRec(&spPb);
}
theMonitorID = SenseLineCheck(slotNum);
if ( theMonitorID == kNoMonitorConnected ) { // No monitor
aSEBlockPtr->seStatus = -1;
return; // All done get out
}
videoMode = kFirstVideoMode;
spPb.spSlot = slot;
spPb.spResult = &sPRAM;
#if 0
err = SReadPRAMRec(&spPb);
if ( err == noErr ) { // Did we get our PRAM?
if ( sPRAM.vendorUse4 != theMonitorID ) { // Is this the same monitor as last time?
sPRAM.vendorUse4 = theMonitorID; // No save the monitor ID
spPb.spsPointer = (Ptr) &sPRAM; // Heres the PRAM record to save
err = SPutPRAMRec(&spPb); // Save it for ever
} else { // Yes
if ( (sPRAM.vendorUse1 >= kFirstVideoMode) || // Range check mode value
(sPRAM.vendorUse1 >= kFifthVideoMode) ) {
videoMode = sPRAM.vendorUse1; // If mode value is funny save default.
}
}
}
#endif
if (cardType == kATIVendorID) {
UInt32 data;
UInt16 *ioReg;
ioReg = (UInt16 *) kMEM_CFG; // Memory config IO register
data = WByteSwap(*ioReg); // Get existing data
data |= (kATIVRAMAddr >> 16) | k4MegAperture; // Set the VRAM base address
data &= 0x0000FFFF;
*ioReg = WByteSwap(data); // Write new stuff
PerformPCIHack();
ioReg = (UInt16 *) kLOCAL_CNTL; //
*ioReg = WByteSwap(0x00A2); // Write new stuff
PerformPCIHack();
baseAddr = (Ptr) kATIVRAMAddr; // should equal kDiamondFBBase
baseAddrFB = (Ptr) kATIVRAMAddr;
depth = 8; // Default for now is 8bpp
rowBytes = 1024;
numLines = 480;
GrayPage(baseAddrFB,rowBytes,depth,numLines);
RampCLUT(slot,kATIVendorID);
SlamRegisters(slot);
}
else {
baseAddr = (Ptr) kDiamondFBBase; // should equal kATIVRAMAddr
baseAddrFB = (Ptr) kDiamondFBBase;
depth = 8; // Default for now is 8bpp
rowBytes = 640;
numLines = 480;
GoDiamond640x480x8Apple(slot);
GrayPage(baseAddrFB,rowBytes,depth,numLines);
}
#endif
aSEBlockPtr->seStatus = noErr;
SwapMMUMode(&mmuMode);
}

View File

@ -0,0 +1,616 @@
/*
File: ATISlotUtils.c
Contains: xxx put contents here xxx
Written by: xxx put writers here xxx
Copyright: © 1993 by Apple Computer, Inc., all rights reserved.
Change History (most recent first):
<1> 11/5/93 fau first checked in
<1> 10/27/93 fau first checked in
<1> 10/19/93 fau first checked in
*/
/*-------------------------------------------------------------------------
*start
*
*Name: ATISlotUtils.c
*Creator: George D. Wilson Jr.
*Date: 6/19/92
*
*Purpose: Contains routines to works with video slot resources
*
*Category:
*File: ATISlotUtils.c
*
*Exports: MonitorIDToSpID
* FindVideoTimingStruct
* GetTimingSBlock
* GetBitDepth
* GetRowBytes
* GetNumLines
* PruneMonitors
*
*Locals:
*
*Detailed:
*
*Note:
*
*History:
*
* Date Programmer Modification
* -------- ---------- -----------------------------------------
*
*stop
*-----------------------------------------------------------------------*/
/*-------------------------------------------------------------------------
*
* Includes
*
*-----------------------------------------------------------------------*/
#include <Types.h>
#include <Video.h>
#include <Devices.h>
#include <Errors.h>
#include <OSUtils.h>
#include <Slots.h>
#include <Memory.h>
#include "NubEqu.h"
#include "ATIStdTypes.h"
#include "ATIDrvr.h"
/*-------------------------------------------------------------------------
*
* Imported Variables
*
*-----------------------------------------------------------------------*/
/*-------------------------------------------------------------------------
*
* Imported Procedures
*
*-----------------------------------------------------------------------*/
/*-------------------------------------------------------------------------
*
* Local Typedefs and Defines
*
*-----------------------------------------------------------------------*/
/*-------------------------------------------------------------------------
*
* Exported Variables
*
*-----------------------------------------------------------------------*/
/*-------------------------------------------------------------------------
*
* Exported Procedures
*
*-----------------------------------------------------------------------*/
/*-------------------------------------------------------------------------
*
* Local Variables
*
*-----------------------------------------------------------------------*/
/*-------------------------------------------------------------------------
*
* Beginning of Procedure Definitions
*
*-----------------------------------------------------------------------*/
/*-------------------------------------------------------------------------
*start
*
*Name: MonitorIDToSpID
*Creator: George D. Wilson Jr.
*Date: 6/12/92
*
*Purpose: Transforms a monitor id into the appropriate slot resource id.
*
*Category:
*File: ATISlotUtils.c
*
*Calls:
*
*Called By:
*
*Entry:
*
*Alters:
*
*Exit: UInt8
*
*Detailed:
*
*Algorithm:
*
*Note: Today the monitor identification is the slot manager spId.
* You must be careful not get the header file used here out of
* sync with the declaration ROM assembler file.
*
* We only have values for the 13" RGB currently.
*
*History:
*
* Date Programmer Modification
* -------- ---------- -----------------------------------------
*
*stop
*-----------------------------------------------------------------------*/
UInt8
MonitorIDToSpID(UInt8 monitorId)
{
// UInt8 spId;
// DebugStr("\pMonitorIDToSpID");
return(monitorId);
} /* End of MonitorIDToSpID */
/*-------------------------------------------------------------------------
*start
*
*Name: GetNumLines
*Creator: George D. Wilson Jr.
*Date: 6/22/92
*
*Purpose: Returns the number of vertical lines for the specified monitor/mode.
*
*Category:
*File: ATISlotUtils.c
*
*Calls:
*
*Called By:
*
*Entry: rowBytes - If the video parameters structure couldn't be
* located zero is returned. Otherwise a 16 bit
* value indicating the number of vertical lines
* is returned.
*
*Alters:
*
*Exit: UInt16
*
*Detailed:
*
*Algorithm:
*
*Note:
*
*History:
*
* Date Programmer Modification
* -------- ---------- -----------------------------------------
*
*stop
*-----------------------------------------------------------------------*/
UInt16
GetNumLines(UInt8 monitorID, UInt8 videoMode, UInt8 theSlot)
{
OSErr err;
// UInt8 spId;
SpBlock spPb;
char *p;
short i;
VPBlockPtr vpPtr;
Rect bounds;
// DebugStr("\pGetNumLines");
return(kNumLines480);
p = (char *) &spPb;
for ( i = 0; i < sizeof(SpBlock); i++ ) *p++ = 0;
spPb.spSlot = theSlot;
spPb.spID = MonitorIDToSpID(monitorID); // The id of the monitor sRsrc
err = SRsrcInfo(&spPb); // Find it, it better be there
if ( err != noErr ) return(0); // Something bad has happened
spPb.spID = videoMode; // Find the structure for the mode
err = SFindStruct(&spPb); // Go find it
if ( err != noErr ) return(0); // Couldn't structure
spPb.spID = mVidParams; // Get the video mode structure
err = SGetBlock(&spPb);
if ( err != noErr ) return(0); // Couldn't structure
vpPtr = (VPBlockPtr) spPb.spResult;
bounds = vpPtr->vpBounds; // Save screen bounds value
DisposPtr((Ptr) spPb.spResult);
return(bounds.bottom-bounds.top);
} /* End of GetNumLines */
/*-------------------------------------------------------------------------
*start
*
*Name: GetBitDepth
*Creator: George D. Wilson Jr.
*Date: 6/22/92
*
*Purpose: Returns the bit depth for the specified monitor/mode.
*
*Category:
*File: ATISlotUtils.c
*
*Calls:
*
*Called By:
*
*Entry:
*
*Alters:
*
*Exit: UInt16
*
*Detailed:
*
*Algorithm:
*
*Note:
*
*History:
*
* Date Programmer Modification
* -------- ---------- -----------------------------------------
*
*stop
*-----------------------------------------------------------------------*/
UInt16
GetBitDepth(UInt8 monitorID, UInt8 videoMode, UInt8 theSlot)
{
OSErr err;
// UInt8 spId;
SpBlock spPb;
char *p;
short i;
VPBlockPtr vpPtr;
UInt16 depth;
// DebugStr("\pGetBitDepth");
return(8);
p = (char *) &spPb;
for ( i = 0; i < sizeof(SpBlock); i++ ) *p++ = 0;
spPb.spSlot = theSlot;
spPb.spID = MonitorIDToSpID(monitorID); // The id of the monitor sRsrc
err = SRsrcInfo(&spPb); // Find it, it better be there
if ( err != noErr ) return(0); // Something bad has happened
spPb.spID = videoMode; // Find the structure for the mode
err = SFindStruct(&spPb); // Go find it
if ( err != noErr ) return(0); // Couldn't structure
spPb.spID = mVidParams; // Get the video mode structure
err = SGetBlock(&spPb);
if ( err != noErr ) return(0); // Couldn't structure
vpPtr = (VPBlockPtr) spPb.spResult;
depth = vpPtr->vpPixelSize; // Save depth
DisposPtr((Ptr) spPb.spResult);
return(depth);
} /* End of GetBitDepth */
/*-------------------------------------------------------------------------
*start
*
*Name: GetRowBytes
*Creator: George D. Wilson Jr.
*Date: 6/22/92
*
*Purpose: Returns the rowBytes value for the specified monitor and mode.
*
*Category:
*File: ATISlotUtils.c
*
*Calls:
*
*Called By:
*
*Entry: rowBytes - If the video parameters structure couldn't be
* located zero is returned. Otherwise a 16 bit
* value indicating the rowbytes for the mode is
* returned.
*
*Alters:
*
*Exit: UInt16
*
*Detailed:
*
*Algorithm:
*
*Note:
*
*History:
*
* Date Programmer Modification
* -------- ---------- -----------------------------------------
*
*stop
*-----------------------------------------------------------------------*/
UInt16
GetRowBytes(UInt8 monitorID, UInt8 videoMode, UInt8 theSlot)
{
OSErr err;
// UInt8 spId;
SpBlock spPb;
char *p;
short i;
VPBlockPtr vpPtr;
UInt16 rowBytes;
unsigned long data;
IOLongWrite(0xF2800000, 0x02 << 12);
data = LByteSwap(*(unsigned long *)0xF2C00000); // Get Vendor ID
if ( data == (0x1002 | (0x4158 << 16)) ) { // look for ATI
return(1024);
}
if ( data == (0x100E | (0x9001 << 16)) ) { // look for Diamond
return(640);
}
return(640);
p = (char *) &spPb;
for ( i = 0; i < sizeof(SpBlock); i++ ) *p++ = 0;
spPb.spSlot = theSlot;
spPb.spID = MonitorIDToSpID(monitorID); // The id of the monitor sRsrc
err = SRsrcInfo(&spPb); // Find it, it better be there
if ( err != noErr ) return(0); // Something bad has happened
spPb.spID = videoMode; // Find the structure for the mode
err = SFindStruct(&spPb); // Go find it
if ( err != noErr ) return(0); // Couldn't structure
spPb.spID = mVidParams; // Get the video mode structure
err = SGetBlock(&spPb);
if ( err != noErr ) return(0); // Couldn't structure
vpPtr = (VPBlockPtr) spPb.spResult;
rowBytes = vpPtr->vpRowBytes; // Save rowBytes value
DisposPtr((Ptr) spPb.spResult);
return(rowBytes);
} /* End of GetRowBytes */
/*-------------------------------------------------------------------------
*start
*
*Name: FindVideoTimingStruct
*Creator: George D. Wilson Jr.
*Date: 6/12/92
*
*Purpose: Locates the proper sRsrc for the given monitor.
*
*Category:
*File: ATISlotUtils.c
*
*Calls:
*
*Called By:
*
*Entry:
*
*Alters:
*
*Exit: Ptr
*
*Detailed:
*
*Algorithm:
*
*Note:
*
*History:
*
* Date Programmer Modification
* -------- ---------- -----------------------------------------
*
*stop
*-----------------------------------------------------------------------*/
Ptr
FindVideoTimingStruct(UInt8 monitorID, UInt8 theSlot)
{
OSErr err;
// UInt8 spId;
SpBlock spPb;
char *p;
short i;
// DebugStr("\pFindVideoTimingStruct");
p = (char *) &spPb;
for ( i = 0; i < sizeof(SpBlock); i++ ) *p++ = 0;
spPb.spSlot = theSlot;
#ifdef ROM
spPb.spID = 0x11; // The id of the board sRsrc
#else
spPb.spID = 0x01;
#endif
err = SRsrcInfo(&spPb); // Find it, it better be there
if ( err != noErr ) return(nil); // Something bad has happened
spPb.spID = kATIVidParmSpId; // So far we only know about this one
err = SFindStruct(&spPb); // Go find it
if ( err != noErr ) return(nil); // Couldn't locate ATI video tree
spPb.spID = MonitorIDToSpID(monitorID); // Point to a specific monitor timimg set
err = SFindStruct(&spPb); // Go find it
if ( err != noErr ) return(nil); // There is no monitor of that type
return((Ptr) spPb.spsPointer); // Return slot pointer
} /* End of FindVideoTimingStruct */
/*-------------------------------------------------------------------------
*start
*
*Name: GetTimingSBlock
*Creator: George D. Wilson Jr.
*Date: 6/12/92
*
*Purpose: Returns a pointer to the SBlock with all timing parameters.
*
*Category:
*File: ATISlotUtils.c
*
*Calls:
*
*Called By:
*
*Entry:
*
*Alters:
*
*Exit: Ptr - If the proper SBlock is located a pointer to the
* block of data is returned. If the block chould
* not be located nil is returned.
*
*Detailed: It is the responsibility of the caller of this routine to
* dispose of the pointer returned.
*
*Algorithm:
*
*Note:
*
*History:
*
* Date Programmer Modification
* -------- ---------- -----------------------------------------
*
*stop
*-----------------------------------------------------------------------*/
Ptr
GetTimingSBlock(UInt8 monitorID, UInt8 videoMode, UInt8 timingSelector, UInt8 ourSlot)
{
OSErr err;
Ptr vidParmPtr;
SpBlock spPb;
char *p;
short i;
// DebugStr("\pGetTimingSBlock");
p = (char *) &spPb;
for ( i = 0; i < sizeof(SpBlock); i++ ) *p++ = 0;
vidParmPtr = FindVideoTimingStruct(monitorID,ourSlot);
if ( vidParmPtr ) {
spPb.spsPointer = vidParmPtr;
spPb.spID = timingSelector;
if ( timingSelector == kSwatchParmSpId ) {
spPb.spID = kSwatchParmSpId;
err = SFindStruct(&spPb);
if ( err != noErr ) return(nil);
spPb.spID = videoMode;
}
err = SGetBlock(&spPb);
if ( err == noErr ) {
return((Ptr) spPb.spResult);
}
}
return(nil);
} /* End of GetTimingSBlock */
/*-------------------------------------------------------------------------
*start
*
*Name: PruneMonitors
*Creator: George D. Wilson Jr.
*Date: 6/19/92
*
*Purpose: Removes the unused monitors timing sResources
*
*Category:
*File: ATISlotUtils.c
*
*Calls:
*
*Called By:
*
*Entry: monitorID - The monitor identifer to keep around.
*
* theSlot - The slot we are operating out of
*
*Alters:
*
*Exit: void
*
*Detailed:
*
*Algorithm:
*
*Note:
*
*History:
*
* Date Programmer Modification
* -------- ---------- -----------------------------------------
*
*stop
*-----------------------------------------------------------------------*/
void
PruneMonitors(UInt16 cardType, UInt8 theSlot)
{
OSErr err;
// UInt8 spId;
SpBlock spPb;
char *p;
short i;
p = (char *) &spPb;
for ( i = 0; i < sizeof(SpBlock); i++ ) *p++ = 0;
spPb.spSlot = theSlot; // should be 0x00
if ( cardType == 0x1002) { // look for ATI
spPb.spID = 0x90;
}
if ( cardType == 0x100E) { // look for Diamond
spPb.spID = 0x80; // The id of the board sRsrc
}
err = SDeleteSRTRec(&spPb);
} /* End of PruneMonitors */
/*-------------------------------------------------------------------------
*
* End of Module
*
*-----------------------------------------------------------------------*/

View File

@ -0,0 +1,174 @@
/*
File: ATIStdTypes.h
Contains: xxx put contents here xxx
Written by: xxx put writers here xxx
Copyright: © 1993 by Apple Computer, Inc., all rights reserved.
Change History (most recent first):
<1> 11/5/93 fau first checked in
<1> 10/27/93 fau first checked in
<1> 10/19/93 fau first checked in
*/
//==================================================================================
//
// File: ATIStdTypes
//
// Description: This file defines standard types, constants and macros that can
// be used to produce portable C code. The following is a list of suggested
// coding style guidelines:
//
// ¥ Precede constant names with a "k": kMyConstant
// ¥ Precede global names with a "g": gMyGlobal
// ¥ Capitalize macro names: MY_NEAT_MACRO
// ¥ Capitalize the first letter of each word in typedefs, filenames and
// subroutines: MyTypedef, MyFile.c, MySuperSubroutine()
// ¥ Capitalize the first letter of each word except the first in variables:
// myWindowPtr
// ¥ Avoid using C's ambiguous intrinsic types like "int", use these instead:
// Uint8, Int32, etc., or define your own for clarity
// ¥ Include a copyright notice (see below)
// ¥ Define function prototypes and include argument names in prototypes:
// void MyFooBar(Int32 refCon, const Ptr string, Boolean *success);
// ¥ Use enums for a set of constants:
// typedef enum { kRed = 1, kGreen = 2, kBlue = 3 } ColorComponent;
// ¥ Ensure that header files cannot be included more than once, so use:
// #ifndef __MYHEADERFILE__
// #define __MYHEADERFILE__
// header body
// #endif __MYHEADERFILE__
//
// ¥ Put clear headers at the top of every file and before every subroutine
// ¥ Write in ANSI C! (only caveat - it's okay to use // for comments)
//
// Creator: Brian Heaney
//
// Copyright: © 1992-1993 by Apple Computer, Inc., all rights reserved.
//
// Change History (most recent first):
//
// Date Programmer Modification
// ------- ---------- -----------------------------------------------
// 5/5/92 B. Heaney Created file
//
//==================================================================================
#ifndef __StdTypes__
#define __StdTypes__
#ifndef __TYPES__
#include <Types.h> // Just to make sure we get the basics
#endif
//==================================================================================
//
// Substitutes for Instrinsic Types
//
//==================================================================================
typedef char Int8; // Signed 8-bit integer
typedef short Int16; // Signed 16-bit integer
typedef long Int32; // Signed 32-bit integer
typedef unsigned char UInt8; // Unsigned 8-bit integer
typedef unsigned short UInt16; // Unsigned 16-bit integer
typedef unsigned long UInt32; // Unsigned 32-bit integer
typedef float Float32; // Single-precision floating point
typedef double Float64; // Double-precision floating point
typedef Int8 *Int8Ptr, **Int8Handle;
typedef Int16 *Int16Ptr, **Int16Handle;
typedef Int32 *Int32Ptr, **Int32Handle;
typedef UInt8 *UInt8Ptr, **UInt8Handle;
typedef UInt16 *UInt16Ptr, **UInt16Handle;
typedef UInt32 *UInt32Ptr, **UInt32Handle;
typedef Float32 *Float32Ptr, **Float32Handle;
typedef Float64 *Float64Ptr, **Float64Handle;
//==================================================================================
//
// Useful Constants
//
//==================================================================================
typedef enum { kIsOk = false, kNotOk = true };
typedef enum { kSuccess = 0, kFailure = -1 }; // Function return codes
//==================================================================================
//
// Range limits of each type of integer
//
//==================================================================================
#define kMinInt8 ((Int8) (1<<7))
#define kMaxInt8 (~kMinInt8)
#define kMaxUInt8 ((UInt8) -1)
#define kMinInt16 ((Int16) (1<<15))
#define kMaxInt16 (~kMinInt8)
#define kMaxUInt16 ((UInt16) -1)
#define kMinInt32 ((Int32) (1<<31))
#define kMaxInt32 (~kMinInt8)
#define kMaxUInt32 ((UInt32) -1)
//==================================================================================
//
// Useful Arithmetic Macros
//
//==================================================================================
#define ABS(x) ( (x) < 0 ? -(x) : (x) )
#define MAX(x,y) ( (x) > (y) ? (x) : (y) )
#define MIN(x,y) ( (x) < (y) ? (x) : (y) )
#define SQR(x) ( (x) * (x) )
#define CLAMP(x,min,max) ( ((x) > (max)) ? (max) : ((x) < (min)) ? (min) : (x) )
// ASR(operand,shift): Arithmetic Shift Right Macro
// C does not guarrantee that '>>' on a negative operaand will
// perform an arithmetic shift (i.e., preserve the sign bit).
// Note: "shift" must be positive.
#define ASR(operand,shift) ( ((operand) >= 0) ? ((operand) >> (shift)) : \
(~((~(operand)) >> (shift))) )
//==================================================================================
//
// Useful Bit-Field Macros
//
// Note that the "bit" argument refers to a bit number and
// he "mask" argument refers to a maskword, ie.,
// #define kDMADoneBit 7
// #define kDMADoneMask 1<<kDMADoneBit
//
//==================================================================================
#define MAKEMASK(bit) ( 1<<(bit) )
#define ANDMASK(word,mask) ( (word) & (mask) )
#define ANDBIT(word,bit) ( ANDMASK(word,MAKEMASK(bit)) )
#define SETMASK(word,mask) ( (word) | (mask) )
#define SETBIT(word,bit) ( SETMASK(word,MAKEMASK(bit)) )
#define CLEARMASK(word,mask) ( (word) & ~(mask) )
#define CLEARBIT(word,bit) ( CLEARMASK(word,MAKEMASK(bit)) )
#define LSB(mask,bit) { \
for (bit=0; !ANDBIT(mask,bit) && bit < 31; bit++ ) ; \
}
#define MSB(mask,bit) { \
for (bit=31; !ANDBIT(mask,bit) && bit > 0; bit-- ) ; \
}
#endif __StdTypes__

View File

@ -0,0 +1,99 @@
/*
File: ATIVideo.h
Contains: xxx put contents here xxx
Written by: xxx put writers here xxx
Copyright: © 1993-1994 by Apple Computer, Inc., all rights reserved.
Change History (most recent first):
<SM2> 1/5/94 kc Add Function ProtoTypes to prevent compiler warnings.
<1> 11/5/93 fau first checked in
<1> 10/27/93 fau first checked in
<1> 10/19/93 fau first checked in
*/
/*-------------------------------------------------------------------------
*start
*
*Name: ATIVideo.h
*Creator: George D. Wilson Jr.
*Date: 9/30/92
*
*Purpose: Contains special definitions for the ATI video system.
*
*Category: Header File
*File: ATIVideo.h
*
*Detailed:
*
*Note:
*
*History:
*
* Date Programmer Modification
* -------- ---------- -----------------------------------------
*
*stop
*-----------------------------------------------------------------------*/
//#include "Nub601.h"
#define kBaseAddress 0x00000000 // Base address of frame buffer for ATI
#define k1bppEntries 0x01 // Number of CLUT entries for 1 bpp
#define k2bppEntries 0x03 // Number of CLUT entries for 2 bpp
#define k4bppEntries 0x0F // Number of CLUT entries for 4 bpp
#define k8bppEntries 0xFF // Number of CLUT entries for 8 bpp
#define k16bppEntries 0xFF // Number of CLUT entries for 8 bpp
#define k24bppEntries 0xFF // Number of CLUT entries for 8 bpp
#define kSenseLineShift 0x04 // ATI sense line shift amount
//==========================================================================
// MMIC monitor values
//==========================================================================
#define kMMIC15Code 0x01 // MMIC Video reg value for 15"
#define kMMIC12Code 0x02 // MMIC Video reg value for 12"
#define kMMIC13Code 0x06 // MMIC Video reg value for 13"
#define kMMIC16Code 0x09 // MMIC Video reg value for 16"
//==========================================================================
// Ariel bit depth values
//==========================================================================
#define kArial1BPPCode 0x01 // MMIC Video reg value for 15"
#define kArial2BPPCode 0x02 // MMIC Video reg value for 12"
#define kArial4BPPCode 0x06 // MMIC Video reg value for 13"
#define kArial8BPPCode 0x09 // MMIC Video reg value for 16"
#define kArial16BPPCode 0x09 // MMIC Video reg value for 16"
//==========================================================================
// ATI hardware video defines
//==========================================================================
#define kDACBaseAddr 0xF9800000 // ACDC address
// #define kADDCBaseAddr (kMySuperSlot | kMazdaLowSpeedBase | 0x00400000)
#define kArielBaseAddr (kMySuperSlot | 0x00000000)
#define kMMICBaseAddr (kMySuperSlot | 0x00000000)
#define kDACAddrReg (kArielBaseAddr | 0x18)
#define kDACDataReg (kArielBaseAddr | 0x38)
#define kDACConfigReg (kArielBaseAddr | 0x58)
#define kDACTestReg (kArielBaseAddr | 0x78)
#define kMMICBaseAddr 0x00000000
#define kATISenseLineBase (kMMICBaseAddr )
//==========================================================================
// ATI Function ProtoTypes
//==========================================================================
void WaitForVBL(void);
OSErr SlamRegisters(UInt8);

View File

@ -0,0 +1,592 @@
/*
File: ATIVideoImp.c
Contains: xxx put contents here xxx
Written by: xxx put writers here xxx
Copyright: © 1993 by Apple Computer, Inc., all rights reserved.
Change History (most recent first):
<1> 11/5/93 fau first checked in
<1> 10/27/93 fau first checked in
<1> 10/19/93 fau first checked in
*/
/*-------------------------------------------------------------------------
*start
*
*Name: ATIVideoImp.c
*Creator: George D. Wilson Jr.
*Date: 6/19/92
*
*Purpose: Contains ATI specific video routines.
*
*Category: Video Hardware Implementation
*File: ATIVideoImp.c
*
*Exports: DoProgramDAC
* DoProgramDACGamma
* DoBuildLinearRamp
* DoGammaCorrectCLUT
* DoProgramEndeavor
* DoProgramACDC
* DoProgramSwatch
* DoEnableVideo
* DoDisableVideo
*
*Locals:
*
*Detailed:
*
*Note:
*
*History:
*
* Date Programmer Modification
* -------- ---------- -----------------------------------------
*
*stop
*-----------------------------------------------------------------------*/
/*-------------------------------------------------------------------------
*
* Includes
*
*-----------------------------------------------------------------------*/
#include <Types.h>
#include <Video.h>
#include <Devices.h>
#include <Errors.h>
#include <OSUtils.h>
#include <Slots.h>
#include <Memory.h>
#include "NubEqu.h"
#include "ATIStdTypes.h"
#include "ATIDrvr.h"
#include "ATIVideo.h"
/*-------------------------------------------------------------------------
*
* Imported Variables
*
*-----------------------------------------------------------------------*/
/*-------------------------------------------------------------------------
*
* Imported Procedures
*
*-----------------------------------------------------------------------*/
extern Ptr FindVideoTimingStruct(UInt8 monitorID, UInt8 theSlot);
extern Ptr GetTimingSBlock(UInt8 monitorID, UInt8 videoMode, UInt8 timingSelector, UInt8 ourSlot);
extern void PruneMonitors(UInt8 monitorID, UInt8 theSlot);
/*-------------------------------------------------------------------------
*
* Local Typedefs and Defines
*
*-----------------------------------------------------------------------*/
/*-------------------------------------------------------------------------
*
* Exported Variables
*
*-----------------------------------------------------------------------*/
/*-------------------------------------------------------------------------
*
* Exported Procedures
*
*-----------------------------------------------------------------------*/
/*-------------------------------------------------------------------------
*
* Local Variables
*
*-----------------------------------------------------------------------*/
/*-------------------------------------------------------------------------
*
* Beginning of Procedure Definitions
*
*-----------------------------------------------------------------------*/
/*-------------------------------------------------------------------------
*start
*
*Name: DoProgramDAC
*Creator: George D. Wilson Jr.
*Date: 5/28/92
*
*Purpose: Sends the specified CLUT to the hardware CLUT.
*
*Category:
*File: ATIDrvrImp.c
*
*Calls:
*
*Called By:
*
*Entry:
*
*Alters:
*
*Exit: void
*
*Detailed:
*
*Algorithm:
*
*Note:
*
*History:
*
* Date Programmer Modification
* -------- ---------- -----------------------------------------
*
*stop
*-----------------------------------------------------------------------*/
void
DoProgramDAC(ColorSpecPtr ctPtr, UInt16 numEntries, UInt16 start, Boolean indexMode)
{
UInt32 i;
UInt32 *clutReg;
UInt32 *clutAddrReg;
UInt32 dummy;
// DebugStr("\pDoProgramDAC");
// bogus code
return;
clutAddrReg = (UInt32 *) kDACAddrReg;
clutReg = (UInt32 *) kDACDataReg; // Point to data register
if ( indexMode ) { // Fill specific CLUT entries
WaitForVBL();
for ( i = 0; i < numEntries; i++ ) {
*clutAddrReg = ctPtr[i].value; // Point to specific CLUT entry
dummy = *clutAddrReg; // HW funnies.
*clutReg = ctPtr[i].rgb.red;
*clutReg = ctPtr[i].rgb.green;
*clutReg = ctPtr[i].rgb.blue;
}
} else { // Fill the CLUT sequencially
*clutAddrReg = start; // Goto the proper clut entry
dummy = *clutAddrReg; // HW funnies.
WaitForVBL();
for ( i = 0; i < numEntries; i++ ) {
*clutReg = ctPtr[i].rgb.red;
*clutReg = ctPtr[i].rgb.green;
*clutReg = ctPtr[i].rgb.blue;
}
}
} /* End of DoProgramDAC */
/*-------------------------------------------------------------------------
*start
*
*Name: DoProgramDACGamma
*Creator: George D. Wilson Jr.
*Date: 5/28/92
*
*Purpose: Programs the specified gamma table into the CLUT DAC.
*
*Category:
*File: ATIDrvrImp.c
*
*Calls:
*
*Called By:
*
*Entry:
*
*Alters:
*
*Exit: void
*
*Detailed:
*
*Algorithm:
*
*Note:
*
*History:
*
* Date Programmer Modification
* -------- ---------- -----------------------------------------
*
*stop
*-----------------------------------------------------------------------*/
void
DoProgramDACGamma(GammaTablePtr gammaPtr)
{
char *redGammaPtr;
UInt32 i;
UInt32 *clutReg;
UInt32 *clutAddrReg;
UInt32 dummy;
UInt16 numEntries;
// DebugStr("\pDoProgramDACGamma");
// bogus
return;
clutAddrReg = (UInt32 *) kDACAddrReg;
clutReg = (UInt32 *) kDACDataReg; // Point to data register
*clutAddrReg = 0; // Point to first CLUT entry
dummy = *clutAddrReg; // HW funnies.
redGammaPtr = gammaPtr->gFormulaData;
redGammaPtr += gammaPtr->gFormulaSize;
numEntries = gammaPtr->gDataCnt;
WaitForVBL();
for ( i = 0; i < numEntries; i++ ) {
*clutReg = redGammaPtr[i];
*clutReg = redGammaPtr[i];
*clutReg = redGammaPtr[i];
}
} /* End of DoProgramDACGamma */
/*-------------------------------------------------------------------------
*start
*
*Name: DoBuildLinearRamp
*Creator: George D. Wilson Jr.
*Date: 5/28/92
*
*Purpose: Sets the specified color spec array to a linear ramp.
*
*Category:
*File: ATIDrvrImp.c
*
*Calls:
*
*Called By:
*
*Entry:
*
*Alters:
*
*Exit: void
*
*Detailed:
*
*Algorithm:
*
*Note:
*
*History:
*
* Date Programmer Modification
* -------- ---------- -----------------------------------------
*
*stop
*-----------------------------------------------------------------------*/
void
DoBuildLinearRamp (ColorSpecPtr ctPtr)
{
UInt16 i;
// DebugStr("\pDoBuildLinearRamp");
for ( i = 0; i < kNumCLUTEntries; i++ ) {
ctPtr[i].value = i;
ctPtr[i].rgb.red = ctPtr[i].rgb.green = ctPtr[i].rgb.blue = i << 8;
}
} /* End of DoBuildLinearRamp */
/*-------------------------------------------------------------------------
*start
*
*Name: DoGammaCorrectCLUT
*Creator: George D. Wilson Jr.
*Date: 5/27/92
*
*Purpose: Applies the specified gamma table to the CLUT passed.
*
*Category:
*File: ATIDrvrImp.c
*
*Calls:
*
*Called By:
*
*Entry:
*
*Alters:
*
*Exit: void
*
*Detailed:
*
*Algorithm:
*
*Note:
*
*History:
*
* Date Programmer Modification
* -------- ---------- -----------------------------------------
*
*stop
*-----------------------------------------------------------------------*/
void
DoGammaCorrectCLUT(UInt16 numEntries, ColorSpecPtr orgCLUTPtr,
ColorSpecPtr corrCLUTPtr,GammaTablePtr gammaPtr)
{
char *redGammaPtr;
char *greenGammaPtr;
char *blueGammaPtr;
UInt16 red,green,blue;
UInt16 i;
// DebugStr("\pDoGammaCorrectCLUT");
for ( i = 0; i < numEntries; i++ ) { // Copy all the needed entries
corrCLUTPtr[i].value = orgCLUTPtr[i].value;
corrCLUTPtr[i].rgb.red = orgCLUTPtr[i].rgb.red;
corrCLUTPtr[i].rgb.green = orgCLUTPtr[i].rgb.green;
corrCLUTPtr[i].rgb.blue = orgCLUTPtr[i].rgb.blue;
}
redGammaPtr = gammaPtr->gFormulaData;
redGammaPtr += gammaPtr->gFormulaSize;
if ( gammaPtr->gChanCnt == 1 ) { // If single channel gamma table
greenGammaPtr = redGammaPtr; // Point all other channels to red
blueGammaPtr = redGammaPtr;
}
if ( gammaPtr->gChanCnt == 3 ) { // If triple channel gamma table
greenGammaPtr = redGammaPtr + gammaPtr->gDataCnt;
blueGammaPtr = greenGammaPtr + gammaPtr->gDataCnt;
}
for ( i = 0; i < numEntries; i++ ) { // Gamma correct each entry
red = corrCLUTPtr[i].rgb.red;
red >>= 8; // Rotate high order bits down
if ( corrCLUTPtr[i].rgb.red & 0x0080 ) { // If low order high bit was set
if ( red != 0x00FF ) red += 1; // If we won't overflow add one
}
green = corrCLUTPtr[i].rgb.green;
green >>= 8; // Rotate high order bits down
if ( corrCLUTPtr[i].rgb.green & 0x0080 ) { // If low order high bit was set
if ( green != 0x00FF ) green += 1; // If we won't overflow add one
}
blue = corrCLUTPtr[i].rgb.blue;
blue >>= 8; // Rotate high order bits down
if ( corrCLUTPtr[i].rgb.blue & 0x0080 ) { // If low order high bit was set
if ( blue != 0x00FF ) blue += 1; // If we won't overflow add one
}
corrCLUTPtr[i].rgb.red = redGammaPtr[red];
corrCLUTPtr[i].rgb.green = greenGammaPtr[green];
corrCLUTPtr[i].rgb.blue = blueGammaPtr[blue];
}
} /* End of DoGammaCorrectCLUT */
//===========================================================================
// Hardware specific routines.
//===========================================================================
/*-------------------------------------------------------------------------
*start
*
*Name: DoProgramTiming
*Creator: George D. Wilson Jr.
*Date: 4/16/92
*
*Purpose: Programs the Arial and MMIC hardware for the ATI video system.
*
*Category:
*File: ATIDrvrImp.c
*
*Calls:
*
*Called By:
*
*Entry:
*
*Alters:
*
*Exit:
*
*Detailed:
*
*Algorithm:
*
*Note:
*
*History:
*
* Date Programmer Modification
* -------- ---------- -----------------------------------------
*
*stop
*-----------------------------------------------------------------------*/
void DoProgramTiming (UInt32 slotNum, Ptr baseAddr, UInt8 monitorID,
UInt8 videoMode, UInt8 ourSlot, UInt16 rowBytes,
Boolean enableInterrupts)
{
#pragma unused (baseAddr, ourSlot, rowBytes, enableInterrupts)
UInt8 *DACRegPtr;
UInt8 *MMICRegPtr;
UInt8 DACValue;
UInt8 MMICValue;
// DebugStr("\pDoProgramTiming");
// bogus
return;
DACRegPtr = (UInt8 *) (slotNum | kArielBaseAddr);
MMICRegPtr = (UInt8 *) (slotNum | kMMICBaseAddr);
switch ( videoMode ) {
case kFirstVideoMode: DACValue = kArial1BPPCode; break;
case kSecondVideoMode: DACValue = kArial2BPPCode; break;
case kThirdVideoMode: DACValue = kArial4BPPCode; break;
case kFourthVideoMode: DACValue = kArial8BPPCode; break;
case kFifthVideoMode: DACValue = kArial16BPPCode; break;
}
switch ( monitorID ) {
case kRGB1312Connected: MMICValue = kMMIC13Code; break;
case kRGB16Connected: MMICValue = kMMIC16Code; break;
case kRGB15Connected: MMICValue = kMMIC15Code; break;
case kRGB12Connected: MMICValue = kMMIC12Code; break;
}
*DACRegPtr = DACValue;
*MMICRegPtr = MMICValue;
} /* End of DoProgramTiming */
/*-------------------------------------------------------------------------
*start
*
*Name: DoEnableVideo
*Creator: George D. Wilson Jr.
*Date: 4/17/92
*
*Purpose: Turns the video curcuitry on for ATI hardware.
*
*Category:
*File: ATIDrvrImp.c
*
*Calls:
*
*Called By:
*
*Entry:
*
*Alters:
*
*Exit:
*
*Detailed:
*
*Algorithm:
*
*Note:
*
*History:
*
* Date Programmer Modification
* -------- ---------- -----------------------------------------
*
*stop
*-----------------------------------------------------------------------*/
void DoEnableVideo(UInt32 theSlot)
{
UInt32 *SashaRegPtr;
// DebugStr("\pDoEnableVideo");
// bogus
return;
SashaRegPtr = (UInt32 *) (theSlot | kSashaBase);
*SashaRegPtr = (kOutputCtl | kPixelDataOutEn |
kAcDcCSYNCEnable | kAcDcCBLANKEnable |
kAcDcSYNCEnable | kAcDcLoadClkEnable);
*SashaRegPtr = (kSwatchSoftReset | kNormal);
*SashaRegPtr = (kVidPipeReset | kNormal);
} /* End of DoEnableVideo */
/*-------------------------------------------------------------------------
*start
*
*Name: DoDisableVideo
*Creator: George D. Wilson Jr.
*Date: 4/17/92
*
*Purpose: Turns the video curcuitry off for ATI hardware.
*
*Category:
*File: ATIDrvrImp.c
*
*Calls:
*
*Called By:
*
*Entry:
*
*Alters:
*
*Exit:
*
*Detailed:
*
*Algorithm:
*
*Note:
*
*History:
*
* Date Programmer Modification
* -------- ---------- -----------------------------------------
*
*stop
*-----------------------------------------------------------------------*/
void DoDisableVideo(UInt32 theSlot)
{
UInt32 *SashaRegPtr;
// DebugStr("\pDoDisableVideo");
// bogus
return;
SashaRegPtr = (UInt32 *) (theSlot | kSashaBase);
*SashaRegPtr = (kOutputCtl |
kAcDcCSYNCDisable | kAcDcCBLANKDisable |
kAcDcSYNCDisable | kAcDcLoadClkDisable);
*SashaRegPtr = (kSwatchSoftReset | kNormal);
*SashaRegPtr = (kVidPipeReset | kNormal);
} /* End of DoDisableVideo */
/*-------------------------------------------------------------------------
*
* End of Module
*
*-----------------------------------------------------------------------*/

View File

@ -0,0 +1,461 @@
/*
File: Diamond.c
Contains: xxx put contents here xxx
Written by: xxx put writers here xxx
Copyright: © 1994 by Apple Computer, Inc., all rights reserved.
Change History (most recent first):
<1> 1/18/94 CP first checked in
*/
/* Diamond.c */
/*
* C Source Code to drive Diamond board
*/
#include <Types.h>
#include <Quickdraw.h>
#include <Types.h>
#include <Errors.h>
#include <OSUtils.h>
#include "ATIStdTypes.h"
#include "ATI.h"
// vclk = 0x4F349B; // supposedly the value for 39.5 MHz (wrong!)
// vclk = 0x47BCB4; // for a (pre-non-divided) dotclock of 30.24 MHz
// vclk = 0x47BC34; // for a (pre-non-divided) dotclock of 60.48 MHz
// vclk = 0x4D8527; // for a (pre-non-divided) dotclock of 17.457 MHz
void GoDiamond640x480x8VGA(UInt8 devID)
{
unsigned long memSize = 0x2000001; // bing
unsigned long depth = 8; // bing
unsigned long rowBytes = (depth >> 3) * 640; // bing
#if 0
// For now, enable slot D on Bandit 0
*(unsigned long *)0xF2800000 = LByteSwap(0x0848); // Tell Bandit which device
PerformPCIHack();
*(unsigned long *)0xF2C00000 = LByteSwap(0x6000000C); // Set VRAM address in PCI base reg
PerformPCIHack();
#endif
IOLongWrite(0xF2800000, (devID << 12) | 4);
*(unsigned char *)(0xF2C00000) = 0x3;
PerformPCIHack();
IOLongWrite(0xF2800000, (devID << 12) | 0x10);
IOLongWrite(0xF2C00000, kDiamondVRAMAddr);
IOLongWrite(0xF2800000, (devID << 12) | 0x14);
IOLongWrite(0xF2C00000, kDiamondIOAddr);
IOLongWrite(kDiamondInterruptEnable, 0x80); // disable interrupts
IOLongWrite(kDiamondRefreshPeriod, 0x186); // rfperiod
IOLongWrite(kDiamondRasMax, 0xFA); // rlmax
IOLongWrite(kDiamondMemConfig, 0x2); // bing
IOLongWrite(kDiamondSysConfig, 0x563000); // bing
SetupDACDiamond(0x45A8BCD0, depth); // bing
// vga 13"
IOLongWrite(kDiamondHorzLength, 0xC7); // bing
IOLongWrite(kDiamondHorzSyncRisingEdge, 0x17); // bing
IOLongWrite(kDiamondHorzBlankRisingEdge, 0x21); // bing
IOLongWrite(kDiamondHorzBlankFallingEdge, 0xC1); // bing
IOLongWrite(kDiamondHorzCounterPreload, 0x00); // bing
IOLongWrite(kDiamondVertLength, 0x20D); // bing
IOLongWrite(kDiamondVertSyncRisingEdge, 0x01); // bing
IOLongWrite(kDiamondVertBlankRisingEdge, 0x19); // bing
IOLongWrite(kDiamondVertBlankFallingEdge, 0x1F9); // bing
// apple timings
#if 0
IOLongWrite(kDiamondHorzLength, 199); // bing
IOLongWrite(kDiamondHorzSyncRisingEdge, 22); // bing
IOLongWrite(kDiamondHorzBlankRisingEdge, 34); // bing
IOLongWrite(kDiamondHorzBlankFallingEdge, 193); // bing
IOLongWrite(kDiamondHorzCounterPreload, 0x00); // bing
IOLongWrite(kDiamondVertLength, 525); // bing
IOLongWrite(kDiamondVertSyncRisingEdge, 2); // bing
IOLongWrite(kDiamondVertBlankRisingEdge, 34); // bing
IOLongWrite(kDiamondVertBlankFallingEdge, 514); // bing
#endif
IOLongWrite(kDiamondVertCounterPreload, 0x00); // bing
IOLongWrite(kDiamondScreenRepaintTiming, 0x1E5); // bing
// Enable sync's out the connector
*(unsigned char *)(0xF20003C4) = 0x12; // for 0x03C5, offset 0x12
*(unsigned char *)(0xF20003C5) |= 0x10; // bit 4
IOLongWrite(kDiamondPlaneMask, 0xFF);
IOLongWrite(kDiamondDrawMode, 0xA);
// write X and Y minimum (both equal 0)
IOLongWrite(kDiamondWindowMinimum, 0);
// write X maximum (rowBytes - 1) and Y maximum (memSize/rowBytes - 1)
IOLongWrite(kDiamondWindowMaximum,
((rowBytes - 1) << 16) | ((memSize / rowBytes) - 1));
IOLongWrite(0xF2800000, (devID << 12) | 4);
*(unsigned char *)(0xF2C00000) = 0x02;
PerformPCIHack();
}
void GoDiamond640x480x8Apple(UInt8 devID)
{
unsigned long memSize = 0x2000001; // bing
unsigned long depth = 8; // bing
unsigned long rowBytes = (depth >> 3) * 640; // bing
#if 0
// For now, enable slot D on Bandit 0
*(unsigned long *)0xF2800000 = LByteSwap(0x0848); // Tell Bandit which device
PerformPCIHack();
*(unsigned long *)0xF2C00000 = LByteSwap(0x6000000C); // Set VRAM address in PCI base reg
PerformPCIHack();
#endif
IOLongWrite(0xF2800000, (devID << 12) | 4);
*(unsigned char *)(0xF2C00000) = 0x3;
PerformPCIHack();
IOLongWrite(0xF2800000, (devID << 12) | 0x10);
IOLongWrite(0xF2C00000, kDiamondVRAMAddr);
IOLongWrite(0xF2800000, (devID << 12) | 0x14);
IOLongWrite(0xF2C00000, kDiamondIOAddr);
SetupDACDiamond(0x47BCB4D0, depth); // bing
IOLongWrite(kDiamondMemConfig, 0x2); // bing
IOLongWrite(kDiamondSysConfig, 0x563000); // bing
// apple 13"
IOLongWrite(kDiamondHorzSyncRisingEdge, 15); // bing
IOLongWrite(kDiamondHorzBlankRisingEdge, 39); // bing
IOLongWrite(kDiamondHorzBlankFallingEdge, 199); // bing
IOLongWrite(kDiamondHorzLength, 215); // bing
IOLongWrite(kDiamondHorzCounterPreload, 0x00); // bing
IOLongWrite(kDiamondVertSyncRisingEdge, 3); // bing
IOLongWrite(kDiamondVertBlankRisingEdge, 42); // bing
IOLongWrite(kDiamondVertBlankFallingEdge, 522); // bing
IOLongWrite(kDiamondVertLength, 525); // bing
IOLongWrite(kDiamondVertCounterPreload, 0x00); // bing
IOLongWrite(kDiamondScreenRepaintTiming, 0x1E5); // bing
IOLongWrite(kDiamondDrawMode, 0xA);
IOLongWrite(kDiamondPlaneMask, 0xFF);
// write X and Y minimum (both equal 0)
IOLongWrite(kDiamondWindowMinimum, 0);
// write X maximum (rowBytes - 1) and Y maximum (memSize/rowBytes - 1)
IOLongWrite(kDiamondWindowMaximum,
((rowBytes - 1) << 16) | ((memSize / rowBytes) - 1));
IOLongWrite(0xF2800000, (devID << 12) | 4);
*(unsigned char *)(0xF2C00000) = 0x02;
PerformPCIHack();
}
static void SetupDACDiamond(unsigned long vclk, unsigned long depth)
{
short i;
unsigned char *writeReg;
unsigned char *dataReg;
unsigned char cursorCmd;
unsigned char vp, hp; // vertical/horizontal sync polarity
unsigned char getThisDone;
*(unsigned char *)(kBT485Reg0) = 0x82; // 8 bit operation (intead of 6)
PerformPCIHack();
*(unsigned char *)(kBT485Reg2) = 0x30; // PCLK1; data from 32 bit port
PerformPCIHack();
*(unsigned char *)(kRamWrite) = 0x01; // enable command register 3 access
PerformPCIHack();
cursorCmd = (vclk & 0x20) ? 0x08 : 0;
*(unsigned char *)(kBT485Reg3) = cursorCmd;
PerformPCIHack();
switch(depth) {
case 8:
// set DAC into 8 bits per pixel
*(unsigned char *)(kBT485Reg1) = 0x40;
break;
case 16:
// set DAC into 16 bits per pixel
*(unsigned char *)(kBT485Reg1) = 0x30;
break;
case 24:
case 32:
// set DAC into 24/32 bits per pixel
*(unsigned char *)(kBT485Reg1) = 0x10;
break;
}
PerformPCIHack();
*(unsigned char *)(kPixelMask) = 0xFF; // pixel mask register
PerformPCIHack();
// setup up clock bits
vp = (vclk & 0x80) ? NEGATIVE : POSITIVE;
hp = (vclk & 0x40) ? NEGATIVE : POSITIVE;
// Enable sync's out the connector
*(unsigned char *)(0xF20003C4) = 0x12; // for 0x03C5, offset 0x12
getThisDone = *(unsigned char *)0xF20003C5;
PerformPCIHack();
*(unsigned char *)(0xF20003C5) = getThisDone | 0x10;
SetupClockDiamond(vclk >> 8);
#if 0
SetupClockDiamond(0x65D83D); // mem clock = 25Mhz
SetupClockDiamond(0x67B83C);
#endif
SetupClockDiamond(vclk >> 8);
#if 0
*(unsigned char *)(0xF20003C2) = (ReadClockReg()) | (hp << 6) | (vp << 7);
#endif
// a magic number: set bits 6 and 7 to 0 for negative sync polarity
*(unsigned char *)(0xF20003C2) = 0xC;
PerformPCIHack();
if (depth == 8) {
writeReg = (unsigned char *)(0xF20003C8); // kRamWrite
dataReg = (unsigned char *)(0xF20003C9); // kPaletteData
*writeReg = 0;
PerformPCIHack();
for (i = 0; i < 256; i++) {
*dataReg = i; // red
PerformPCIHack();
*dataReg = i; // green
PerformPCIHack();
*dataReg = i; // blue
PerformPCIHack();
}
}
}
unsigned char ReadClockReg(void)
{
unsigned char *ClockSelReg = (unsigned char *)(0xF20003C2);
unsigned char ret;
ret = (*(ClockSelReg + 0xA)); // 0x03C2 is really read from 0x03CC
PerformPCIHack();
return ret;
}
void WriteClockReg(unsigned char whatever, unsigned char serialData, unsigned char serialClock)
{
unsigned char *ClockSelReg = (unsigned char *)(0xF20003C2);
*ClockSelReg = (whatever | (serialData << 3) | (serialClock << 2));
PerformPCIHack();
}
void SetupClockDiamond(unsigned long vclk)
{
short x;
unsigned char whatever;
// Read the current clock reg value to save off bits [7..4] and [1..0]
whatever = ReadClockReg() & 0xF3;
// unlock the clock chip
WriteClockReg(whatever, 1, 1); // Raise the Data bit and the clock bit
for (x = 0; x < 5; x++)
{
WriteClockReg(whatever, 1, 0); // Lower the clock
WriteClockReg(whatever, 1, 1); // Raise the clock
}
// Finish Unlocking
WriteClockReg(whatever, 1, 0);
WriteClockReg(whatever, 0, 0);
WriteClockReg(whatever, 0, 1);
// Start bits
WriteClockReg(whatever, 0, 0); // Clock: hi-lo
WriteClockReg(whatever, 0, 1); // Clock: lo-hi
// Manchester encoding:
// Set SerialData to !vclk[0]; Drop SerialClk to 0; Set SerialData to vclk; Set SerialClock to 1
for (x = 0; x < 24; x++)
{
// write out the inverse of the vclk bit
WriteClockReg(whatever, (vclk & 1) ? 0 : 1, 1);
WriteClockReg(whatever, (vclk & 1) ? 0 : 1, 0);
// write out the vclk bit
WriteClockReg(whatever, (vclk & 1) , 0);
WriteClockReg(whatever, (vclk & 1) , 1);
vclk >>= 1;
}
// Stop bits
WriteClockReg(whatever, 1, 1);
WriteClockReg(whatever, 1, 0);
WriteClockReg(whatever, 1, 1);
}
void GoDiamond640x480x8AppleOld(UInt8 devID);
void GoDiamond640x480x8AppleOld(UInt8 devID)
{
unsigned char *clutData;
unsigned char *clutAddrReg;
unsigned char cursorCmd;
int i;
IOLongWrite(0xF2800000, (devID << 12) | 4);
*(unsigned char *)(0xF2C00000) = 0x3;
PerformPCIHack();
IOLongWrite(0xF2800000, (devID << 12) | 0x10);
IOLongWrite(0xF2C00000, kDiamondVRAMAddr);
IOLongWrite(0xF2800000, (devID << 12) | 0x14);
IOLongWrite(0xF2C00000, kDiamondIOAddr);
// Configure memory space appropriately
IOLongWrite( kDiamondMemConfig, 0x2);
// IOLongWrite( kDiamondSysConfig, (0x6 << 17) | (1 << 13) | (1 << 12));
IOLongWrite( kDiamondSysConfig, (0x563000)); // RowBytes of 640 hardcoded
// Draw Engine parameters
IOLongWrite( kDiamondWindowMinimum, 0);
IOLongWrite( kDiamondWindowMaximum, (639 << 16) | ((0x2000001 / 640) - 1));
IOLongWrite( kDiamondScreenRepaintTiming, 0x1E5);
*(unsigned char *)(0xF2009800) = 0x40; // set DAC into 8 bits per pixel
// set to 0x30 for 16 bpp
// set to 0x10 for 32 bpp
PerformPCIHack();
*(unsigned char *)(0xF2009402) = 0x82; // 8 bit operation (instead of 6)
PerformPCIHack();
*(unsigned char *)(0xF2009801) = 0x32; // PCLK1; data from 32 bit port
PerformPCIHack();
*(unsigned char *)(0xF20003C6) = 0xFF; // pixel mask register
PerformPCIHack();
cursorCmd = 0x04 & !0x08; // 64x64 bit cursor;
// disable 2 times clock
*(unsigned char *)(0xF20003C8) = 0x01; // enable command register 3 access
PerformPCIHack();
*(unsigned char *)(0xF2009802) = cursorCmd;
PerformPCIHack();
clutAddrReg = (UInt8 *)(0xF20003C8); // Point to write-index register
clutData = (UInt8 *)(0xF20003C9); // Point to data register
*clutAddrReg = 0; // Point to the first entry
for ( i = 0; i < 256; i++ ) {
*clutData = i;
PerformPCIHack();
*clutData = i;
PerformPCIHack();
*clutData = i;
PerformPCIHack();
}
// SetupClockW9000();
{
unsigned long data = 0x47BCB4; // for a (pre-non-divided) dotclock of 30.24 MHz
short x;
unsigned char whatever;
// Read the current clock reg value to save off bits [7..4] and [1..0]
whatever = ReadClockReg() & 0xF3;
// unlock the clock chip
WriteClockReg(whatever, 1, 1); // Raise the Data bit and the clock bit
for (x = 0; x < 5; x++)
{
WriteClockReg(whatever, 1, 0); // Lower the clock
WriteClockReg(whatever, 1, 1); // Raise the clock
}
// Finish Unlocking
WriteClockReg(whatever, 1, 0);
WriteClockReg(whatever, 0, 0);
WriteClockReg(whatever, 0, 1);
// Start bits
WriteClockReg(whatever, 0, 0); // Clock: hi-lo
WriteClockReg(whatever, 0, 1); // Clock: lo-hi
// Manchester encoding:
// Set SerialData to !data[0]; Drop SerialClk to 0; Set SerialData to data; Set SerialClock to 1
for (x = 0; x < 24; x++)
{
// write out the inverse of the data bit
WriteClockReg(whatever, (data & 1) ? 0 : 1, 1);
WriteClockReg(whatever, (data & 1) ? 0 : 1, 0);
// write out the data bit
WriteClockReg(whatever, (data & 1) , 0);
WriteClockReg(whatever, (data & 1) , 1);
data >>= 1;
}
// Stop bits
WriteClockReg(whatever, 1, 1);
WriteClockReg(whatever, 1, 0);
WriteClockReg(whatever, 1, 1);
// Enable sync's out the connector
*(unsigned char *)(0xF20003C4) = 0x12; // for 0x03C5, offset 0x12
*(unsigned char *)(0xF20003C5) |= 0x10; // bit 4
}
IOLongWrite( kDiamondHorzSyncRisingEdge, 15);
IOLongWrite( kDiamondHorzBlankRisingEdge, 39);
IOLongWrite( kDiamondHorzBlankFallingEdge, 199);
IOLongWrite( kDiamondHorzLength, 215);
IOLongWrite( kDiamondVertSyncRisingEdge, 3);
IOLongWrite( kDiamondVertBlankRisingEdge, 42);
IOLongWrite( kDiamondVertBlankFallingEdge, 522);
IOLongWrite( kDiamondVertLength, 525);
IOLongWrite(0xF2800000, (devID << 12) | 4);
*(unsigned char *)(0xF2C00000) = 0x2;
PerformPCIHack();
}

View File

@ -0,0 +1,115 @@
/*
File: Diamond.h
Contains: xxx put contents here xxx
Written by: xxx put writers here xxx
Copyright: © 1994 by Apple Computer, Inc., all rights reserved.
Change History (most recent first):
<1> 1/18/94 CP first checked in
*/
/* Diamond.h */
/*
* Diamond board with Weitek 9000 controller header file
*/
#define NEGATIVE 0
#define POSITIVE 1
#define kDiamondCommandVal (kMemoryAccess | kReadWaitCycle)
#define kDiamondVendorID 0x100E
#define kDiamondDeviceID 0x9001
#define kDiamondIOBaseAddr 0x9000
#define kDiamondIOAddr (0x1 | kDiamondIOBaseAddr)
#define kDiamondVRAMAddr 0xE0000000 // same place as ATI
#define kDiamondFBBase (kDiamondVRAMAddr + (1 << 21)) // page 45 Direct frame buffer
#define kDiamondRegBase (kDiamondVRAMAddr + (0x2 << 19))// page 45 control registers
#define kDiamondDrawRegBase (kDiamondVRAMAddr + (0x3 << 19))// page 45 control registers
#define kDiamondMemConfig (kDiamondRegBase + (0x180 + (1 << 2)))
#define kDiamondRefreshPeriod (kDiamondRegBase + (0x180 + (2 << 2)))
#define kDiamondRasMax (kDiamondRegBase + (0x180 + (4 << 2)))
#define kDiamondSysConfig (kDiamondRegBase + (0x1 << 2))
#define kDiamondInterrupt (kDiamondRegBase + (0x2 << 2))
#define kDiamondInterruptEnable (kDiamondRegBase + (0x3 << 2))
#define kDiamondHorzCounter (kDiamondRegBase + (0x100 + (1 << 2)))
#define kDiamondHorzLength (kDiamondRegBase + (0x100 + (2 << 2)))
#define kDiamondHorzSyncRisingEdge (kDiamondRegBase + (0x100 + (3 << 2)))
#define kDiamondHorzBlankRisingEdge (kDiamondRegBase + (0x100 + (4 << 2)))
#define kDiamondHorzBlankFallingEdge (kDiamondRegBase + (0x100 + (5 << 2)))
#define kDiamondHorzCounterPreload (kDiamondRegBase + (0x100 + (6 << 2)))
#define kDiamondVertCounter (kDiamondRegBase + (0x100 + (7 << 2)))
#define kDiamondVertLength (kDiamondRegBase + (0x100 + (8 << 2)))
#define kDiamondVertSyncRisingEdge (kDiamondRegBase + (0x100 + (9 << 2)))
#define kDiamondVertBlankRisingEdge (kDiamondRegBase + (0x100 + (10 << 2)))
#define kDiamondVertBlankFallingEdge (kDiamondRegBase + (0x100 + (11 << 2)))
#define kDiamondVertCounterPreload (kDiamondRegBase + (0x100 + (12 << 2)))
#define kDiamondScreenRepaintAddress (kDiamondRegBase + (0x100 + (13 << 2)))
#define kDiamondScreenRepaintTiming (kDiamondRegBase + (0x100 + (14 << 2)))
#define kDiamondScreenRefreshTiming (kDiamondRegBase + (0x100 + (15 << 2)))
#define kDiamondStatus (kDiamondDrawRegBase + 0x0)
#define kDiamondStatusIssue_qbN (1 << 31)
#define kDiamondStatusBusy (1 << 30)
#define kDiamondStatusPicked (1 << 7)
#define kDiamondStatusPixelSoftware (1 << 6)
#define kDiamondStatusBlitSoftware (1 << 5)
#define kDiamondStatusQuadSoftware (1 << 4)
#define kDiamondStatusQuadConcave (1 << 3)
#define kDiamondStatusQuadHidden (1 << 2)
#define kDiamondStatusQuadVisible (1 << 1)
#define kDiamondStatusQuadIntersects (1 << 0)
#define kDiamondForegroundColor (kDiamondDrawRegBase + (0x200 + (0 << 2)))
#define kDiamondBackgroundColor (kDiamondDrawRegBase + (0x200 + (1 << 2)))
#define kDiamondPlaneMask (kDiamondDrawRegBase + (0x200 + (2 << 2)))
#define kDiamondDrawMode (kDiamondDrawRegBase + (0x200 + (3 << 2)))
#define kDiamondPatternOriginX (kDiamondDrawRegBase + (0x200 + (4 << 2)))
#define kDiamondPatternOriginY (kDiamondDrawRegBase + (0x200 + (5 << 2)))
#define kDiamondRaster (kDiamondDrawRegBase + (0x200 + (6 << 2)))
#define kDiamondPixel8 (kDiamondDrawRegBase + (0x200 + (7 << 2)))
#define kDiamondWindowMinimum (kDiamondDrawRegBase + (0x200 + (8 << 2)))
#define kDiamondWindowMaximum (kDiamondDrawRegBase + (0x200 + (9 << 2)))
#define kDiamondPattern0_1 (kDiamondDrawRegBase + (0x200 + (21<< 2)))
#define kDiamondPattern2_3 (kDiamondDrawRegBase + (0x200 + (22<< 2)))
#define kDiamondPattern4_5 (kDiamondDrawRegBase + (0x200 + (23<< 2)))
#define kDiamondPattern6_7 (kDiamondDrawRegBase + (0x200 + (24<< 2)))
#define kDiamondPattern8_9 (kDiamondDrawRegBase + (0x200 + (25<< 2)))
#define kDiamondPattern10_11 (kDiamondDrawRegBase + (0x200 + (26<< 2)))
#define kDiamondPattern12_13 (kDiamondDrawRegBase + (0x200 + (27<< 2)))
#define kDiamondPattern14_15 (kDiamondDrawRegBase + (0x200 + (28<< 2)))
#define kBT485Reg0 (kDiamondIOBaseAddr | 0xF2000402)
#define kBT485Reg1 (kDiamondIOBaseAddr | 0xF2000800)
#define kBT485Reg2 (kDiamondIOBaseAddr | 0xF2000801)
#define kBT485Reg3 (kDiamondIOBaseAddr | 0xF2000802)
#define kPixelMask (0xF20003C6)
#define kVgaMisc (0xF20003C2)
#define kVgaIndexRead (0xF20003C4)
#define kVgaIndexWrite (0xF20003C5)
#define kRamRead (0xF20003C7)
#define kRamWrite (0xF20003C8)
#define kPaletteData (0xF20003C9)
void InitDiamond(void);
void SetupDACDiamond(unsigned long, unsigned long);
unsigned char ReadClockReg(void);
void WriteClockReg(unsigned char whatever, unsigned char serialData, unsigned char serialClock);
void SetupClockDiamond(unsigned long);
void GoDiamond640x480x8VGA(UInt8);
void GoDiamond640x480x8Apple(UInt8);

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,707 @@
/*
File: PCIUtil.c
Contains: xxx put contents here xxx
Written by: xxx put writers here xxx
Copyright: © 1993 by Apple Computer, Inc., all rights reserved.
Change History (most recent first):
<1> 11/5/93 fau first checked in
<1> 10/27/93 fau first checked in
<1> 10/19/93 fau first checked in
*/
/*-------------------------------------------------------------------------
*start
*
*Name: PrimaryInit.c
*Creator: George D. Wilson Jr.
*Date: 4/23/92
*
*Purpose: Main interface file for ATI video driver primary init.
*
*Category: Macintosh driver
*File: PrimaryInit.c
*
*Exports: main - Main entry point for primary init.
*
*Detailed:
*
*Note:
*
*History:
*
* Date Programmer Modification
* -------- ---------- -----------------------------------------
*
*stop
*-----------------------------------------------------------------------*/
/*-------------------------------------------------------------------------
*
* Includes
*
*-----------------------------------------------------------------------*/
#include <Types.h>
#include <Errors.h>
#include <OSUtils.h>
#include "ATIStdTypes.h"
#include "ATI.h"
/*-------------------------------------------------------------------------
*
* Imported Procedures
*
*-----------------------------------------------------------------------*/
/*-------------------------------------------------------------------------
*
* Beginning of Procedure Definitions
*
*-----------------------------------------------------------------------*/
/*-------------------------------------------------------------------------
*start
*
*Name: PerformPCIHack
*Creator: George D. Wilson Jr.
*Date: 9/22/93
*
*Purpose: Does a read of the CPU ID for the PCI IO problem.
*
*Category:
*File: PCIUtil.c
*
*Calls:
*
*Called By:
*
*Entry:
*
*Alters:
*
*Exit: void
*
*Detailed:
*
*Algorithm:
*
*Note:
*
*History:
*
* Date Programmer Modification
* -------- ---------- -----------------------------------------
*
*stop
*-----------------------------------------------------------------------*/
void
PerformPCIHack()
{
UInt8 *ioReg;
volatile UInt8 dumb;
// DebugStr("\pPerformPCIHack");
ioReg = (UInt8 *) kCPUIDReg;
dumb = *ioReg; // Read CPU ID for PCI hack
dumb = *ioReg; // Read CPU ID for PCI hack
} /* End of PerformPCIHack */
/*-------------------------------------------------------------------------
*start
*
*Name: LByteSwap
*Creator: George D. Wilson Jr.
*Date: 9/13/93
*
*Purpose: Does bytes swapping for endianess of 32 bits
*
*Category:
*File: PCIUtil.c
*
*Calls:
*
*Called By:
*
*Entry:
*
*Alters:
*
*Exit: UInt32
*
*Detailed:
*
*Algorithm:
*
*Note:
*
*History:
*
* Date Programmer Modification
* -------- ---------- -----------------------------------------
*
*stop
*-----------------------------------------------------------------------*/
UInt32
LByteSwap(UInt32 theLong)
{
UInt32 Temp;
// DebugStr("\pLByteSwap");
Temp = ((theLong & 0x000000ff) << 24);
Temp += (((theLong >> 8) & 0x000000ff) << 16);
Temp += (((theLong >> 16) & 0x000000ff) << 8);
Temp += ((theLong >> 24) & 0x000000ff);
return(Temp);
} /* End of LByteSwap */
/*-------------------------------------------------------------------------
*start
*
*Name: WByteSwap
*Creator: George D. Wilson Jr.
*Date: 9/13/93
*
*Purpose: Does bytes swapping for endianess of 16 bits
*
*Category:
*File: PCIUtil.c
*
*Calls:
*
*Called By:
*
*Entry:
*
*Alters:
*
*Exit: UInt16
*
*Detailed:
*
*Algorithm:
*
*Note:
*
*History:
*
* Date Programmer Modification
* -------- ---------- -----------------------------------------
*
*stop
*-----------------------------------------------------------------------*/
UInt16
WByteSwap(UInt16 theWord)
{
UInt16 Temp;
// DebugStr("\pWByteSwap");
Temp = ((theWord & 0x00ff) << 8);
Temp += ((theWord >> 8) & 0x00ff);
return(Temp);
} /* End of WByteSwap */
/*-------------------------------------------------------------------------
*start
*
*Name: IOByteWrite
*Creator: George D. Wilson Jr.
*Date: 9/13/93
*
*Purpose: Writes a byte to the specified IO register.
*
*Category:
*File: PCIUtil.c
*
*Calls:
*
*Called By:
*
*Entry:
*
*Alters:
*
*Exit: void
*
*Detailed:
*
*Algorithm:
*
*Note:
*
*History:
*
* Date Programmer Modification
* -------- ---------- -----------------------------------------
* 9/22/93 George W. Added PCI IO hack
*
*stop
*-----------------------------------------------------------------------*/
void
IOByteWrite(UInt32 theReg, UInt8 theByte)
{
UInt8 *ioReg;
// DebugStr("\pIOByteWrite");
ioReg = (UInt8 *) theReg;
*ioReg = theByte;
PerformPCIHack();
} /* End of IOByteWrite */
/*-------------------------------------------------------------------------
*start
*
*Name: IOWordWrite
*Creator: George D. Wilson Jr.
*Date: 9/13/93
*
*Purpose: Writes a word to the specified IO register.
*
*Category:
*File: PCIUtil.c
*
*Calls:
*
*Called By:
*
*Entry:
*
*Alters:
*
*Exit: void
*
*Detailed:
*
*Algorithm:
*
*Note:
*
*History:
*
* Date Programmer Modification
* -------- ---------- -----------------------------------------
* 9/22/93 George W. Added PCI IO hack
*
*stop
*-----------------------------------------------------------------------*/
void
IOWordWrite(UInt32 theReg, UInt16 theWord)
{
UInt16 *ioReg;
// DebugStr("\pIOWordWrite");
ioReg = (UInt16 *) theReg;
*ioReg = WByteSwap(theWord);
PerformPCIHack();
} /* End of IOWordWrite */
void IOLongWrite(unsigned long theReg, unsigned long bogus)
{
unsigned long *ioReg;
ioReg = (unsigned long *) theReg;
*ioReg = LByteSwap(bogus);
PerformPCIHack();
}
/*-------------------------------------------------------------------------
*start
*
*Name: FindPCICard
*Creator: George D. Wilson Jr.
*Date: 9/13/93
*
*Purpose: Searches all PCI slots for the ATI graphics card.
*
*Category:
*File: PCIUtil.c
*
*Calls:
*
*Called By:
*
*Entry:
*
*Alters:
*
*Exit: UInt8
*
*Detailed:
*
*Algorithm:
*
*Note:
*
*History:
*
* Date Programmer Modification
* -------- ---------- -----------------------------------------
*
*stop
*-----------------------------------------------------------------------*/
UInt8
FindPCICard(UInt16 *type)
{
UInt32 *configRegPtr;
UInt32 *dataRegPtr;
UInt32 data;
UInt32 someValue;
// DebugStr("\pFindPCICard");
configRegPtr = (UInt32 *) kConfigAddressReg;
dataRegPtr = (UInt32 *) kConfigDataReg;
someValue = kPCIVendorIDOffset | (kSecondPCISlot << 12);
*configRegPtr = LByteSwap(someValue); // Tell Bandit which device
data = LByteSwap(*dataRegPtr); // Get Vendor ID
if ( data == (kATIVendorID | (kATIDeviceID << 16)) ) {
*type = kATIVendorID;
return(kSecondPCISlot);
}
if ( data == (kDiamondVendorID | (kDiamondDeviceID << 16)) ) {
*type = kDiamondVendorID;
return(kSecondPCISlot);
}
return(0); // No card found
} /* End of FindPCICard */
/*-------------------------------------------------------------------------
*start
*
*Name: EnableIOAccess
*Creator: George D. Wilson Jr.
*Date: 9/13/93
*
*Purpose: Enables or disables PCI IO/Mem access for a specific PCI card.
*
*Category:
*File: PCIUtil.c
*
*Calls:
*
*Called By:
*
*Entry:
*
*Alters:
*
*Exit: OSErr
*
*Detailed:
*
*Algorithm:
*
*Note:
*
*History:
*
* Date Programmer Modification
* -------- ---------- -----------------------------------------
*
*stop
*-----------------------------------------------------------------------*/
OSErr
EnableIOAccess(UInt8 devID, Boolean enable, UInt16 type)
{
#pragma unused (enable)
UInt32 *configRegPtr;
UInt8 *dataByteRegPtr;
UInt32 *dataLongRegPtr;
UInt32 someValue;
// DebugStr("\pEnableIOAccess");
configRegPtr = (UInt32 *) kConfigAddressReg;
dataByteRegPtr = (UInt8 *) kConfigDataReg;
dataLongRegPtr = (UInt32 *) kConfigDataReg;
someValue = (devID << 12) | kPCICommandOffset; // Set the PCI device
*configRegPtr = LByteSwap(someValue); // Tell Bandit which device
*dataByteRegPtr = 0x03; // Enable Memory accesses
if (type == kATIVendorID) {
someValue = (devID << 12) | kPCIBaseReg1Offset; // Set the PCI base address reg
*configRegPtr = LByteSwap(someValue); // Tell Bandit which device
*dataLongRegPtr = LByteSwap(kATIVRAMAddr); // Set VRAM address in PCI base reg
}
if (type == kDiamondVendorID) {
someValue = (devID << 12) | kPCIBaseReg1Offset; // Set the PCI base address reg
*configRegPtr = LByteSwap(someValue); // Tell Bandit which device
*dataLongRegPtr = LByteSwap(kDiamondVRAMAddr); // Set VRAM address in PCI base reg
someValue = (devID << 12) | kPCIBaseReg2Offset; // Set the PCI base address reg
*configRegPtr = LByteSwap(someValue); // Tell Bandit which device
*dataLongRegPtr = LByteSwap(kDiamondIOAddr); // Set IO base address in PCI base reg
}
return(noErr);
} /* End of EnableIOAccess */
/*-------------------------------------------------------------------------
*start
*
*Name: SlamRegisters
*Creator: George D. Wilson Jr.
*Date: 9/13/93
*
*Purpose: Set all needed ATI graphics registers.
*
*Category:
*File: PCIUtil.c
*
*Calls:
*
*Called By:
*
*Entry:
*
*Alters:
*
*Exit: OSErr
*
*Detailed:
*
*Algorithm:
*
*Note:
*
*History:
*
* Date Programmer Modification
* -------- ---------- -----------------------------------------
*
*stop
*-----------------------------------------------------------------------*/
OSErr
SlamRegisters(UInt8 devID)
{
IOLongWrite(0xF2800000, (devID << 12) | 4);
*(unsigned char *)(0xF2C00000) = 0x3;
PerformPCIHack();
IOByteWrite(PCI_CNTL, 0xFC);
IOByteWrite(kAPERTURE_CNTL, 0x4C);
IOByteWrite(kADVFUNC_CNTL, 0x01);
IOWordWrite(kMISC_OPTIONS, 0x70A8);
IOByteWrite(kADVFUNC_CNTL, 0x01);
IOWordWrite(kEXT_GE_CONFIG, 0x4010);
IOWordWrite(kSUBSYS_CNTL, kRESET_GE);
IOWordWrite(kSUBSYS_CNTL, kNORMAL_GE);
ATIWaitForIdle();
IOWordWrite(kCLOCK_SEL, 0x1251);
ATIReset68800();
ATIWaitForIdle();
//====================================
// DAC Stuff
//====================================
// IOWordWrite(kEXT_GE_CONFIG,0x1000);
// IOWordWrite(kDAC_MASK,0x03);
// IOWordWrite(kEXT_GE_CONFIG,0x2000);
// IOWordWrite(kDAC_R_INDEX,0x00);
// IOWordWrite(kEXT_GE_CONFIG,0x3000);
// IOWordWrite(kDAC_W_INDEX,0x2D);
// IOWordWrite(kEXT_GE_CONFIG,0x0000);
// IOWordWrite(kDAC_MASK,0xFF);
#if 0
IOByteWrite(kH_TOTAL,0x63);
IOByteWrite(kH_DISP,0x4F);
IOByteWrite(kH_SYNC_STRT,0x52);
IOByteWrite(kH_SYNC_WID,0x2C);
IOWordWrite(kV_TOTAL,0x0418);
IOWordWrite(kV_DISP,0x03BF);
IOWordWrite(kV_SYNC_STRT,0x03DF);
IOWordWrite(kV_SYNC_WID,0x0022);
#endif
ATISetSyncRegisters();
ATIWaitForIdle();
IOByteWrite(kDISP_CNTL,0x23); // 0x22
IOWordWrite(kHORIZONTAL_OVERSCAN, 0);
IOWordWrite(kVERTICAL_OVERSCAN, 0);
IOWordWrite(kOVERSCAN_COLOR_8_BLUE, 0);
IOWordWrite(kOVERSCAN_COLOR_GREEN_RED, 0);
IOByteWrite(kSHADOW_CTL, 0x7F);
IOByteWrite(kSHADOW_SET, 0);
IOWordWrite(kMULTIFUNC_CNTL, kSCISSOR_TOP | 0);
IOWordWrite(kMULTIFUNC_CNTL, kSCISSOR_LEFT | 0);
IOWordWrite(kMULTIFUNC_CNTL, kSCISSOR_BOTTOM | 0x5FF);
IOWordWrite(kMULTIFUNC_CNTL, kSCISSOR_RIGHT | 0x5FF);
IOWordWrite(kSRC_Y_DIR, 1);
IOWordWrite(kWRT_MASK, 0xFFFF);
IOWordWrite(kDEST_CMP_FN, 0);
IOWordWrite(kDP_CONFIG, kDP_CONFIG_WRITE |
kDP_CONFIG_POLY_FILL_DISABLE |
kDP_CONFIG_READ_MODE_COLOR_DATA |
kDP_CONFIG_ENABLE_DRAW |
kDP_CONFIG_MONO_SRC_ALWAYS1 |
kDP_CONFIG_BG_COLOR_SRC_BG |
kDP_CONFIG_DATA_WIDTH_16 |
kDP_CONFIG_MSB_FIRST |
kDP_CONFIG_FG_COLOR_SRC_FG);
IOWordWrite(kFRGD_MIX, kCOLOR_SRC_FG |
kMIX_FN_S);
// IOWordWrite(0x7AEE + ATIIOBase,0x4010);
IOLongWrite(0xF2800000, (devID << 12) | 4);
*(unsigned char *)(0xF2C00000) = 0x2;
PerformPCIHack();
return(noErr);
} /* End of SlamRegisters */
/*-------------------------------------------------------------------------
*
* End of Module
*
*-----------------------------------------------------------------------*/
void ATIReset68800 (void)
{
IOWordWrite(kCRT_OFFSET_LOW, 0);
IOWordWrite(kCRT_OFFSET_HIGH, 0);
IOWordWrite(kCRT_PITCH, 0x80);
IOWordWrite(kGE_OFFSET_LOW, 0);
IOWordWrite(kGE_OFFSET_HIGH, 0);
IOWordWrite(kGE_PITCH, 0x80);
IOWordWrite(kHORIZONTAL_OVERSCAN, 0);
IOWordWrite(kVERTICAL_OVERSCAN, 0);
IOWordWrite(kOVERSCAN_COLOR_8_BLUE, 0);
IOWordWrite(kOVERSCAN_COLOR_GREEN_RED, 0);
IOWordWrite(kCURSOR_OFFSET_HIGH, 0);
IOWordWrite(kDAC_MASK, 0xFF);
}
void ATISetSyncRegisters (void)
{
#if 0
IOByteWrite(kH_TOTAL,0x63);
IOByteWrite(kH_DISP,0x4F);
IOByteWrite(kH_SYNC_STRT,0x52);
IOByteWrite(kH_SYNC_WID,0x2C);
IOWordWrite(kV_TOTAL,0x0418);
IOWordWrite(kV_DISP,0x03BF);
IOWordWrite(kV_SYNC_STRT,0x03DF);
IOWordWrite(kV_SYNC_WID,0x0022);
#endif
IOByteWrite(kH_TOTAL, 0x63);
IOByteWrite(kH_DISP, 0x4F);
IOByteWrite(kH_SYNC_STRT, 0x52);
IOByteWrite(kH_SYNC_WID, 0x2C);
IOWordWrite(kV_TOTAL, 0x0418);
IOWordWrite(kV_DISP, 0x03BF);
IOWordWrite(kV_SYNC_STRT, 0x03DF); // 0x03D6
IOWordWrite(kV_SYNC_WID, 0x0022);
}
void ATIFix688111Bug (void)
{
unsigned char clockSelect;
short cx;
clockSelect = *(unsigned char *)kCLOCK_SELECT;
clockSelect |= 1;
IOByteWrite(kCLOCK_SELECT, clockSelect);
ATIWaitForIdle();
/* set all pixel clock values to fix bug in 18811 clock chip */
for (cx = 0; cx < 16; cx++) {
clockSelect = (cx << 2) | 0x1;
IOByteWrite(kCLOCK_SELECT, clockSelect);
}
IOWordWrite(kCLOCK_SELECT,
kCLOCK_SELECT_ENABLE_8514 |
kCLOCK_SELECT_FREQ(4) |
kCLOCK_SELECT_DIV_2 |
kCLOCK_SELECT_FIFO_DEPTH(2) |
kCLOCK_SELECT_COMPOSITE_SYNC);
}
long ATIWaitForIdle (void)
{
unsigned long loopCount;
unsigned char fifoBusy;
unsigned char geBusy;
loopCount = 0xFFFF;
fifoBusy = *(unsigned char *)kEXT_FIFO_STATUS;
while (loopCount > 0 && fifoBusy & 1) {
fifoBusy = *(unsigned char *)kEXT_FIFO_STATUS;
loopCount--;
}
if (loopCount == 0) {
return 0;
}
loopCount = 0xFFFF;
geBusy = *(unsigned char *)kGE_STAT_BUSY;
while (loopCount > 0 && geBusy & kGE_BUSY) {
geBusy = *(unsigned char *)kGE_STAT_BUSY;
loopCount--;
}
if (loopCount == 0) {
return 0;
}
return 1;
}

View File

@ -0,0 +1,848 @@
;
; File: ApolloDriver.a
;
; Contains: This file contains the video driver for use by the Macintosh
; OS on the Apollo hardware
;
; Written by: Mike Puckett.
;
; Copyright: © 1991-1992 by Apple Computer, Inc. All rights reserved.
;
; Change History (most recent first):
;
; <SM3> 11/5/92 SWC Changed VideoEqu.a->Video.a and ShutdownEqu.a->Shutdown.a.
; <SM2> 11/2/92 kc Don't include SonicEqu.a
; <1> 10/6/92 GDW New location for ROMLink tool.
; <1> 3/30/92 JSM first checked in
; <6> 5/22/91 jmp Code Review changes: For consistency, did a StripAddress on
; VidOpenÕs copy of the privates; eliminated the redundant clears
; and checks for the the driver copy of the fixed-entry clut; and
; replaced #0Õs with #noErrÕs where appropriate.
; <5> 5/15/91 jmp SetInterrupt wasnÕt checking the input value correctly -- it was
; doing a csMode(A3) instead of csMode(A2). So, it would either
; enable (0) or disable (1), depending on whether csMode(A3) was
; non-zero or not. Also, GetInterrupt returned -1.w (instead of
; 1.b) for disabled, so some test tools were confused; so, I now
; just return 1.b when interrupts are disabled.
; <4> 5/10/91 jmp Fixed a bug in GetInterrupt where I wasnÕt returning the
; interrupt status, but instead was writing into my private
; storage! Fixed the error-handling code in VidOpen. Fixed a bug
; in GetEntries where A0 was not loaded properly. Made GetEntries
; 32-bit clean. GetEntries was trashing A1, so async calls were
; failing (i.e., jumping thru IODone requires A1 to be pointing to
; the AuxDCE). Indexed GetEntries didnÕt work at all because I
; was checking for indexed via A3 instead of A2! Made the Control
; & Status dispatchers 32-bit clean. SaveMode was never being
; setup! Code review changes: Eliminated SetEntries &
; SetDefaultMode, and fixed GetDefaultMode.
; <3> 4/17/91 jmp Updated comments and cleaned up the fixed-device support.
; <2> 2/15/91 jmp Added everything! The only things left to are: 1) Need to
; change VISA names to Eagle names once Gus/Jim/Celia update the
; equate files and 2) Need to get the fixed device stuff working
; properly.
; <1> 2/10/91 jmp First checked into TERROR ROM.
;
; To Do:
;
; 1) Need to change VISA names in interrupt handling code to Eagle names.
; This entails touching SetInterrupt, WaitVSync, and BeginIH.
;
STRING C
PRINT OFF
LOAD 'StandardEqu.d'
INCLUDE 'DockingEqu.a'
INCLUDE 'EgretEqu.a'
INCLUDE 'GestaltEqu.a'
INCLUDE 'GestaltPrivateEqu.a'
INCLUDE 'HardwarePrivateEqu.a'
INCLUDE 'IOPrimitiveEqu.a'
INCLUDE 'PowerPrivEqu.a'
INCLUDE 'ROMEqu.a'
INCLUDE 'Video.a'
INCLUDE 'SlotMgrEqu.a'
INCLUDE 'ShutDown.a'
; INCLUDE 'SonicEqu.a'
INCLUDE 'UniversalEqu.a'
INCLUDE 'DepVideoEqu.a'
PRINT ON
SEG '_sApolloDriver'
BLANKS ON
STRING ASIS
MACHINE MC68020
; This is device storage which is stored in the dCtlStorage field of the AuxDCE.
ApolloVidPrivates RECORD 0
saveBaseAddr DS.L 1 ; the screen base address
saveSQElPtr DS.L 1 ; the SQ element pointer (for _SIntRemove)
saveFixedCLUT DS.L 1 ; pointer to fixed-entry CLUT
saveNumFixedEntries DS.W 1 ; number of entries in fixed CLUT (zero based)
saveMode DS.W 1 ; the current mode setting
GFlags DS.W 1 ; flags word
ApolloVidPrivSize EQU *
ENDR
LApolloDriver MAIN EXPORT
WITH spBlock,SlotIntQElement
;-------------------------------------------------------------------
; Video Driver Header
;-------------------------------------------------------------------
;
ApolloDrvr DC.W $4C00 ; ctl,status,needsLock
DC.W 0,0,0 ; not an ornament
; Entry point offset table
DC.W ApolloVidOpen-ApolloDrvr ; open routine
DC.W ApolloDrvr-ApolloDrvr ; no prime
DC.W ApolloVidCtl-ApolloDrvr ; control
DC.W ApolloVidStatus-ApolloDrvr ; status
DC.W ApolloVidClose-ApolloDrvr ; close
STRING Pascal
ApolloVidTitle
DC.B '.Display_Video_Apple_Apollo'
STRING ASIS
ALIGN 2 ; make sure we're word aligned
DC.W CurApolloDrvrVersion ; version
**********************************************************************
*
* ApolloVidOpen allocates private storage for the device in the AuxDCE and locks
* it down for perpetuity. Also, install the simulated interrupt handler and
* start it going.
*
* Entry: A0 = param block pointer
* A1 = AuxDCE pointer
*
* Locals: A3 = pointer to private storage
*
**********************************************************************
WITH VDPageInfo,ApolloVidPrivates
ApolloVidOpen
;
; Allocate private storage (since block is CLEAR, GFlags are zeroed) and get
; a pointer to it in A3.
;
MOVEQ #ApolloVidPrivSize,D0 ; get size of parameters
_ResrvMem ,SYS ; make room as low as possible
MOVEQ #ApolloVidPrivSize,D0 ; get size of parameters
_NewHandle ,SYS,CLEAR ; get some memory for private storage
BNE @OpError1 ; => return an error in open
MOVE.L A0,dCtlStorage(A1) ; save returned handle in AuxDCE
_HLock ; and lock it down forever
MOVE.L (A0),D0 ; Get a 32-bit clean pointer
_StripAddress ; to our privates into A3.
Move.l D0,A3
MOVE.L dCtlDevBase(A1),saveBaseAddr(A3) ; save the screen base address
; Get and install the interrupt handler. Call the EnableVGuts utility code to do
; this. This utility also starts the interrupts going. If there is an error
; condition, EnableVGuts returns with Z-bit cleared.
;
MOVEQ #sqHDSize,D0 ; allocate a slot queue element
_NewPtr ,SYS,CLEAR ; get it from system heap cleared
BNE.S @OpError2 ; if not allocated, return bad
MOVE.L A0,saveSQElPtr(A3) ; save the SQ element pointer.
BSR ApolloEnableVGuts ; do it
BNE.S @OpError2 ;
; For doing GetEntries, we need to get our fixed-entry CLUT from the Slot Manager.
;
With spBlock
Suba #spBlockSize,Sp ; Make an SpBlock on the stack and
Move.l Sp,A0 ; get a pointer to it in A0.
Move.b dCtlSlot(A1),spSlot(A0) ; Get the slotnumber.
Move.b dCtlSlotID(A1),spID(A0) ; Get the spID of video sRsrc.
Clr.b spExtDev(A0) ;
_sRsrcInfo ; Try to get the spsPointer.
Bne.s @OpError3 ; WeÕre dead if this fails.
Move.b #firstVidMode,spID(A0) ; Look for our mode entry.
_sFindStruct ; If we donÕt find it, then
Bne.s @OpError3 ; weÕre dead.
Move.b #mTable,spID(A0) ; Get our fixed-entry CLUT.
_sGetBlock ; If we donÕt get it, then
Bne.s @OpError3 ; weÕre dead.
Move.l spResult(A0),A0 ; Get ptr to fixed-entry CLUT
Move.w ctSize(A0),saveNumFixedEntries(A3) ; Save the number of entries.
Lea ctTable(A0),A0 ; Get ptr to table, and
Move.l A0,saveFixedCLUT(A3) ; save it.
Adda #spBlockSize,Sp ; restore stack
EndWith
; ThereÕs only one vidMode, so save it now because SetMode doesnÕt need to.
;
Move.w #firstVidMode,saveMode(A3)
; All done!
;
@AllDone MOVEQ #noErr,D0 ; no error
@EndOpen RTS ; return
@OpError3 ADD.W #spBlockSize,SP ; release the spBlock
@OpError2 MOVE.L dCtlStorage(A1),A0 ; get the private storage back
_DisposHandle ; release the driver private storage
@OpError1 MOVE.L #OpenErr,D0 ; say can't open driver
BRA.S @EndOpen
ENDWITH
**********************************************************************
*
* Video Driver Control Call Handler. There are ten calls:
*
* (0) Reset (VAR mode, page: INTEGER; VAR BaseAddr: Ptr);
* (1) KillIO
* (2) SetMode(mode, page: INTEGER; VAR BaseAddr: Ptr);
* (3) SetEntries ( Table: Ptr; Start,Count : integer );
* (4) SetGamma ( Table : Ptr );
* (5) GrayPage (page);
* (6) SetGray (csMode = 0 for color, 1 for gray)
* (7) SetInterrupt ( csMode = 0 for enable, 1 for disable)
* (8) DirectSetEntries (not implemented)
* (9) SetDefaultMode
*
* Entry: A0 = param block pointer
* A1 = AuxDCE pointer
* Uses: A2 = ptr to cs parameters (ie. A2 <- csParam(A0))
* A3 = scratch (doesn't need to be preserved)
* A4 = scratch (must be preserved)
* D0-D3 = scratch (don't need to be preserved)
*
* Exit: D0 = error code
*
**********************************************************************
;
; Decode the call
;
ApolloVidCtl
MOVEM.L A0/A1,-(SP) ; Preserve exit registers.
MOVE.L csParam(A0),A2 ; A2 <- Ptr to control parameters
MOVE.L dCtlStorage(A1),A3 ; A3 <- Ptr to private storage
MOVE.L (A3),D0 ;
_StripAddress ;
MOVE.L D0,A3 ;
MOVE.W csCode(A0),D0 ; get the opCode
CMP.W #9,D0 ; IF csCode NOT IN [0..9] THEN
BHI.S ApolloCtlBad ; Error, csCode out of bounds
MOVE.W ApolloCtlJumpTbl(PC,D0.W*2),D0 ; Get the relative offset to the routine
JMP ApolloCtlJumpTbl(PC,D0.W) ; GOTO the proper routine
ApolloCtlJumpTbl
DC.W ApolloVidReset-ApolloCtlJumpTbl ; $00 => VidReset
DC.W ApolloCtlGood-ApolloCtlJumpTbl ; $01 => KillIO
DC.W ApolloSetVidMode-ApolloCtlJumpTbl ; $02 => SetVidMode
DC.W ApolloCtlBad-ApolloCtlJumpTbl ; $03 => SetEntries (not needed)
DC.W ApolloCtlBad-ApolloCtlJumpTbl ; $04 => SetGamma (not needed)
DC.W ApolloGrayPage-ApolloCtlJumpTbl ; $05 => GrayPage
DC.W ApolloCtlBad-ApolloCtlJumpTbl ; $06 => SetGray (not needed)
DC.W ApolloSetInterrupt-ApolloCtlJumpTbl ; $07 => SetInterrupt
DC.W ApolloCtlBad-ApolloCtlJumpTbl ; $08 => DirectSetEntries (not needed)
DC.W ApolloCtlBad-ApolloCtlJumpTbl ; $09 => SetDefaultMode (not needed)
ApolloCtlBad MOVEQ #controlErr,D0 ; else say we don't do this one
BRA.S ApolloCtlDone ; and return
ApolloCtlGood MOVEQ #noErr,D0 ; return no error
ApolloCtlDone MOVEM.L (SP)+,A0/A1 ; Restore exit registers.
BRA ApolloExitDrvr
ApolloVidReset
;---------------------------------------------------------------------
;
; Reset the card to its default
;
;---------------------------------------------------------------------
WITH VDPageInfo,ApolloVidPrivates
MOVE #FirstVidMode,csMode(A2) ; return default mode
MOVE #FirstVidMode,saveMode(A3) ; remember FirstVidMode as the requested mode
CLR.W csPage(A2) ; return page zero
MOVE.L saveBaseAddr(A3),csBaseAddr(A2) ; return the base address
BSR ApolloGrayScreen ; paint the screen gray
BRA.S ApolloCtlGood ; => no error
ENDWITH
ApolloSetVidMode
;---------------------------------------------------------------------
;
; Set the card to the specified mode and page. If it's not 1-bit
; mode, page zero, then return an error
;
; If the card is already set to the specified mode, then do nothing.
;
;---------------------------------------------------------------------
WITH VDPageInfo,ApolloVidPrivates
CMP.W #FirstVidMode,csMode(A2) ; is it one-bit (the first and only)
BNE.S ApolloCtlBad ; => not a valid mode
TST.W csPage(A2) ; it is page zero?
BNE.S ApolloCtlBad ; => not a valid page
MOVE.L saveBaseAddr(A3),csBaseAddr(A2) ; return the base address
BRA ApolloCtlGood ; => return no error
ENDWITH
ApolloSetEntries
;---------------------------------------------------------------------
;
; Since Apollo has no color table, thereÕs nothing do here. Return a ctl
; bad result (but do it up above in the control dispatcher, since it
; saves a few bytes.
;
;---------------------------------------------------------------------
ApolloSetGamma
;---------------------------------------------------------------------
;
; Since Apollo has no color table, there's no opportunity to set the
; gamma correction in this hardware. Return a ctl bad result (but
; do it up above in the control dispatcher, since it saves a few bytes.
;
;---------------------------------------------------------------------
ApolloGrayPage
;---------------------------------------------------------------------
;
; Clear the specified page in the current mode to gray
;
; A0 = Ptr to private storage
; A1 = Ptr to AuxDCE
; A2 = Ptr to cs parameter record
;
;---------------------------------------------------------------------
WITH VDPageInfo,ApolloVidPrivates
TST.W csPage(A2) ; Is it requesting page zero?
BNE ApolloCtlBad
BSR ApolloGrayScreen ; paint the screen gray
BRA ApolloCtlGood ; => return no error
ENDWITH
ApolloSetGray
;---------------------------------------------------------------------
;
; Since Apollo has no color table, there's no opportunity to set
; luminence mapping in this hardware. Return a ctl bad result (but
; do it up above in the control dispatcher, since it saves a few bytes.
;
;---------------------------------------------------------------------
ApolloSetInterrupt
;---------------------------------------------------------------------
;
; Enable (csMode = 0) or disable (csMode = non-zero) VBL interrupts
;
; As a future performance enhancement, interrupts on the card can be
; disabled or enabled from software. For instance, if the cursor is
; not on a screen, and there is nothing in the Slot Interrupt Queue
; for that device, interrupts may be disabled reducing interrupt
; overhead for the system.
;
; The slot interrupt queue element is always allocated by the Open call.
; This routine just inserts and removes it from the slot interrupt task queue.
;
; A1 = Ptr to AuxDCE
; A2 = Ptr to cs parameter record
; A3 = Ptr to private storage
;
;---------------------------------------------------------------------
WITH VDPageInfo,ApolloVidPrivates
Tst.b csMode(A2) ; If csMode = 0, then we are
Beq.s @EnableThem ; enabling VBL interrupts.
; This is the code that disables VBL interrupts, then removes the interrupt handler.
;
Bsr.s ApolloDisableVGuts ; Do disabling activities, and
Bra ApolloCtlGood ; return noErr.
; This is the code that installs and enables the interrupt handler.
;
@EnableThem
Bsr.s ApolloEnableVGuts ; Do enabling activites, and
Bne ApolloCtlBad ; flag problem on errors;
Bra ApolloCtlGood ; otherwise, return noError.
; The following two routines are used by SetInterrupt as well as by Open/Close. So,
; their names donÕt have @Õs in front of them, and they return via Rts instructions.
;
ApolloDisableVGuts
Bset #IntDisFlag,GFlags(A3) ; Set disabled flag to true.
Move.w Sr,-(Sp) ; Preserve the status register.
Moveq #7,D0 ; Get mask into D0.
And.b (Sp),D0 ; Get the current interrupt level.
Subq.b #2,D0 ; If interrupt level ³ 2,
Bge.s @Ok ; then donÕt change.
Ori.w #$0200,Sr ; Otherwise, raise it above level 2,
Andi.w #$FAFF,Sr ; and make it level 2.
@Ok
Bsr ApolloWaitVSync ; To be safe, wait for NEXT VBL to occur.
MOVE.L VISA,A0 ; Point to the VISA base.
MOVE.B #$40,RvSEnb(A0) ; Set slot 0 interrupt disabled (slot 0 bit+set/clear to 0).
Move.w (Sp)+,Sr ; Restore status register/interrupt level.
Clr.w D0 ; Setup for removing slot $0 interrupt handler.
Move.l saveSQElPtr(A3),A0 ; Get the SQ element ptr.
_SIntRemove ; Remove the interrupt handler.
Rts ; Return home.
ApolloEnableVGuts
Bclr #IntDisFlag,GFlags(A3) ; Set disabled flag to false.
Move.l saveSQElPtr(A3),A0 ; Get the queue element.
Lea ApolloBeginIH,A2 ; Save pointer to interrupt handler.
Move.w #siQType,sqType(A0) ; Setup queue ID.
Move.l A2,sqAddr(A0) ; Setup routine address.
Move.l A3,SQParm(A0) ; Cache ApolloVidPrivates.
Clr.w D0 ; Do it for slot $0.
_SIntInstall
Bne.s @IntBad
MOVE.L VISA,A0 ; Point to the VISA base.
MOVE.B #$C0,VsSEnb(A0) ; Set slot 0 interrupt enabled (slot 0 bit+set/clear to 1).
Cmp D0,D0 ; Clear z-bit for good result.
@IntBad Rts ; Return home.
ENDWITH
ApolloSetDefaultMode
;---------------------------------------------------------------------
;
; Since Apollo only has one video sRsrc and itÕs already set, just return
; a ctl bad result (but do it up above in the control dispatcher, since
; it saves a few bytes.
;
;---------------------------------------------------------------------
**********************************************************************
*
* VideoClose releases the device's private storage and removes the
* interrupt handler.
*
*
* Entry: A0 = param block pointer
* A1 = AuxDCE pointer
*
* Other: A2 = temporary AuxDCE pointer copy
*
**********************************************************************
WITH ApolloVidPrivates
ApolloVidClose
MOVE.L dCtlStorage(A1),A3 ; A3 <- Ptr to private storage
MOVE.L (A3),D0 ;
_StripAddress ;
MOVE.L D0,A3 ;
Bsr ApolloDisableVGuts ; Call utility to deactivate interrupts.
Move.l saveSQElPtr(A3),A0 ; Dispose of the slot interrupt queue element ptr
_DisposPtr
Move.l saveFixedCLUT(A3),A0 ; Dispose of our fixed-entry CLUT.
_DisposPtr
MOVE.L dCtlStorage(A1),A0 ; Dispose of the private storage
_DisposHandle ;
MOVEQ #noErr,D0 ; no error
RTS ; and return
ENDWITH
**********************************************************************
*
* Video Driver Status Call Handler. Right now there are ten calls:
*
* (0) Error
* (1) Error
* (2) GetMode
* (3) GetEntries
* (4) GetPage
* (5) GetPageBase
* (6) GetGray
* (7) GetInterrupt
* (8) GetGamma
* (9) GetDefaultMode
*
* Entry: A0 = param block
* A1 = AuxDCE pointer
* Uses: A2 = cs parameters
* A3 = pointer to private storage
* D0-D3 = scratch (don't need to be preserved)
*
* Exit: D0 = error code
*
**********************************************************************
ApolloVidStatus
MOVEM.L A0/A1,-(SP) ; Preserve exit registers.
MOVE.L csParam(A0),A2 ; A2 <- Ptr to control parameters
MOVE.L dCtlStorage(A1),A3 ; A3 <- Ptr to private storage
MOVE.L (A3),D0 ;
_StripAddress ;
MOVE.L D0,A3 ;
MOVE.W csCode(A0),D0 ; get routine selector
CMP.W #9,D0 ;IF csCode NOT IN [0..9] THEN
BHI.S ApolloStatBad ; Error, csCode out of bounds.
MOVE.W ApolloStatJumpTbl(PC,D0.W*2),D0 ;Get the relative offset to the routine.
JMP ApolloStatJumpTbl(PC,D0.W) ;GOTO the proper routine.
ApolloStatJumpTbl
DC.W ApolloStatBad-ApolloStatJumpTbl ;$00 => Error
DC.W ApolloStatBad-ApolloStatJumpTbl ;$01 => Error
DC.W ApolloGetMode-ApolloStatJumpTbl ;$02 => GetMode
DC.W ApolloGetEntries-ApolloStatJumpTbl ;$03 => GetEntries
DC.W ApolloGetPage-ApolloStatJumpTbl ;$04 => GetPage
DC.W ApolloGetPageBase-ApolloStatJumpTbl ;$05 => GetPageBase
DC.W ApolloStatBad-ApolloStatJumpTbl ;$06 => GetGray (not needed)
DC.W ApolloGetInterrupt-ApolloStatJumpTbl ;$07 => GetInterrupt
DC.W ApolloStatBad-ApolloStatJumpTbl ;$08 => GetGamma (not needed)
DC.W ApolloGetDefaultMode-ApolloStatJumpTbl ;$09 => GetDefaultMode
ApolloStatBad MOVEQ #statusErr,D0 ; else say we don't do this one
BRA.S ApolloStatDone ; and return
ApolloStatGood MOVEQ #noErr,D0 ; return no error
ApolloStatDone MOVEM.L (SP)+,A0/A1 ; Restore exit registers.
BRA ApolloExitDrvr
ApolloGetMode
;---------------------------------------------------------------------
;
; Return the current mode
;
; Inputs : A2 = pointer to csParams
; A3 = pointer to private storage
;
;---------------------------------------------------------------------
WITH ApolloVidPrivates,VDPageInfo
MOVE.W saveMode(A3),csMode(A2) ; return the mode
CLR.W csPage(A2) ; return the page number
MOVE.L saveBaseAddr(A3),csBaseAddr(A2) ; and the base address
BRA.S ApolloStatGood ; => return no error
ENDWITH
ApolloGetEntries
;---------------------------------------------------------------------
;
; Fake the current contents of the CLUT. There isn't really a clut around,
; but that's no reason not to return a reasonable looking response
;
; Inputs : A2 = pointer to csParams
; A3 = pointer to privates
;
; For Apollo the color table is fixed. So, weÕll always return good values
; as long as there is a reasonable looking color table around.
;
; Idea: If weÕre in indexed mode, weÕll cycle thru the input
; table. While doing this, weÕll ignore all entries
; whose value fields are out of range. For entries
; whose value field are in range, weÕll return the
; appropriate rgb fields.
;
; If weÕre in sequential mode, we just need to write out
; the number of entries we know about.
;
;---------------------------------------------------------------------
With ApolloVidPrivates
Move.l csTable(A2),D0 ; If we were handed a nil pointer,
Beq ApolloStatBad ; then hike.
_StripAddress ; Otherwise, make it 32-bit clean.
Move.l D4,-(Sp) ; Save work register.
; Calculate the index rangeÉ
;
Move.w saveNumFixedEntries(A3),D3 ; Get number of entries to check against.
Move.w csCount(A2),D4 ; Get the number of entries to set,
Bmi.s @GEErr ; and hike if itÕs out of range.
Cmp.w D3,D4 ; If D4-D3 > 0 (count > # of entries),
Bhi.s @GEErr ; then hike.
Move.w D4,D2 ; Otherwise, copy the count.
Move.l D0,A0 ; Get pointer to input table.
Cmp.w #indexEntries,csStart(A2) ; If table accesses are to be indexed,
Beq.s @GECom ; then go on.
Move.w D4,D1 ; Otherwise, sequence thru table from
Add.w csStart(A2),D2 ; csStart thru csCount entries.
; The following code is BAD, BAD, BAD! We should build our own table here so
; as to NOT mess up the userÕs data. But all the previous Apple video drivers
; have done the same thing, so weÕll continue the trend for now.
@TableLoop Move.w D2,value(A0,D1*colorSpecSize) ; Write the index into the table.
Subq #1,D2 ; Decrement index.
Dbra D1,@TableLoop
@GECom
@Repeat Move.w value(A0),D1 ; Get the NEXT table position into D1.
Cmp.w D3,D1 ; If this position is out of range,
Bhi.s @Until ; then go on.
Move.l saveFixedCLUT(A3),A1 ; Point to start of fixed CLUT.
Lea (A1,D1*colorSpecSize),A1 ; Index into right entry.
Move.w rgb+red(A1),rgb+red(A0) ; Copy red,
Move.w rgb+green(A1),rgb+green(A0) ; green,
Move.w rgb+blue(A1),rgb+blue(A0) ; blue.
@Until Addq #colorSpecSize,A0 ; Point to next entry in input ColorTable.
Dbra D4,@Repeat
Move.l (Sp)+,D4 ; Restore work register.
Bra ApolloStatGood ; Return noError.
@GEErr Move.l (Sp)+,D4 ; Restore work register.
Bra ApolloStatBad ; Return statError.
EndWith
ApolloGetPage
;---------------------------------------------------------------------
;
; Return the number of pages in the specified mode.
;
;---------------------------------------------------------------------
WITH ApolloVidPrivates,VDPageInfo
CMP.W #FirstVidMode,csMode(A2) ; this mode, or else
BNE ApolloStatBad ; oh,oh
MOVE.W #OBMPagesApollo,csPage(A2) ; return page count
BRA ApolloStatGood ; => return no error
ENDWITH
ApolloGetPageBase
;---------------------------------------------------------------------
;
; Return the base address for the specified page in the current mode
;
;---------------------------------------------------------------------
WITH ApolloVidPrivates,VDPageInfo
MOVE.W csPage(A2),D0 ; get the requested page
BNE ApolloStatBad ; => no, just return
MOVE.L saveBaseAddr(A3),csBaseAddr(A2) ; return the base address
BRA ApolloStatGood ; => return no error
ENDWITH
ApolloGetGray
;---------------------------------------------------------------------
;
; No CLUT, so this routine returns an status error. It's implemented
; in the Status dispatch table above.
;
;---------------------------------------------------------------------
ApolloGetInterrupt
;---------------------------------------------------------------------
;
; Return a boolean in csMode, set true if VBL interrupts are disabled
;
;---------------------------------------------------------------------
WITH ApolloVidPrivates,VDPageInfo
Btst #IntDisFlag,GFlags(A3) ; If interrupts are enabled (zero)
Beq.s @IsOn ; then return enabled state.
Move.b #1,csMode(A2) ; Otherwise, return disabled.
Bra ApolloStatGood
@IsOn
Clr.b csMode(A2) ; Return enabled state.
Bra ApolloStatGood ; return noErr
ENDWITH
ApolloGetGamma
;---------------------------------------------------------------------
;
; No CLUT, so this routine returns an status error. It's implemented
; in the Status dispatch table above.
;
;---------------------------------------------------------------------
ApolloGetDefaultMode
;---------------------------------------------------------------------
;
; Read the card default mode from slot pRAM.
;
; A1 = Ptr to AuxDCE
; A2 = Ptr to cs parameter record
; A3 = Ptr to private storage
;
;---------------------------------------------------------------------
; For most video drivers, we look in pRAM to see what the last
; configuration set was. However, for Apollo, there only one
; mode possible, so we just return that value here.
WITH VDPageInfo ; GDW1
MOVE.B dCtlSlotID(A1),csMode(A2) ; return the result
BRA ApolloStatGood ;
ENDWITH ; GDW1
;---------------------------------------------------------------------
;
; Exit from Control or Status.
;
; A0 = Ptr to param block.
; A1 = Ptr to AuxDCE.
; D0 = error code.
;
;---------------------------------------------------------------------
ApolloExitDrvr BTST #NoQueueBit,ioTrap(A0) ; no queue bit set?
BEQ.S ApolloGoIODone ; => no, not immediate
RTS ; otherwise, it was an immediate call
ApolloGoIODone MOVE.L JIODone,-(Sp) ; Get the IODone address,
Rts ; and go there.
;=====================================================================
;
; Utilities
;
;=====================================================================
;---------------------------------------------------------------------
;
; Wait for vertical blanking. Interrupts are raised to level-2 around
; this routine.
;
; A1 = AuxDCE POINTER
; A3 = pointer to private storage
;---------------------------------------------------------------------
ApolloWaitVSync
Movem.l A0/D0,-(Sp) ; Save work registers.
MOVE.L VISA,A0 ; Point to VISA.
MOVE.B #$40,VsSInt(A0) ; Clear the interrupt, just in case,
; since the intHndlr can't get
; called here.
ADDA #VsSInt,A0 ; Point to interrupt register.
@0 MOVE.B (A0),D0 ; Read the Vert-Sync state.
BTST #6,D0 ;
BNE.S @0 ; Repeat until it goes hi.
Movem.l (Sp)+,A0/D0 ; Restore registers.
Rts
ApolloGrayScreen
;---------------------------------------------------------------------
;
; Fill the screen with a 50% dithered gray pattern.
; A3 = driver private storage
;
; All registers are preserved
;
WITH ApolloVidPrivates
MOVEM.L D0/D2/D3/A0/A1,-(SP) ; save all registers
MOVE.L #OneBitGray,D3 ; get the one-bit gray pattern
MOVE.L saveBaseAddr(A3),A0 ; get the frame buffer base address
MOVE.W #defmBounds_BApollo-1,D0 ; get the # of rows
@NxtRow MOVE.W #(OBMApolloRB/4)-1,D2 ; get the # of longs/row
@NxtLong MOVE.L D3,(A0)+ ; write gray
DBRA D2,@NxtLong ; for each scanline
NOT.L D3 ; invert pattern on next row
DBRA D0,@NxtRow ; for each row
MOVEM.L (SP)+,D0/D2/D3/A0/A1 ; restore registers
RTS
ENDWITH
;-------------------------------------------------------------
; The Interrupt handler Apollo Built-In Video
;-------------------------------------------------------------
; On entry A1 contains the pointer to the driver's private storage
; D0-D3/A0-A3 have been preserved.
ApolloBeginIH
MOVE.L VISA,A0 ; Point to VISA.
MOVE.B #$40,VsSInt(A0) ; Clear the interrupt.
Clr.w D0 ; Setup for slot $0 VBLTask.
Move.l JVBLTask,A0
Jsr (A0)
Moveq #1,D0 ; Tell the caller that interrupt was handled,
Rts ; and return.
ENDWITH
END

View File

@ -0,0 +1,765 @@
/*
File: CSCDeclVideo.r
Contains: DeclData info for the CSC hardware.
Written by: Mike Puckett, January 12, 1993.
Copyright: © 1993-1994 by Apple Computer, Inc., all rights reserved.
Change History (most recent first):
<SM4> 1/24/94 rab Changed MinorLength_640x400b to MinorLength640x400 to match
DepVideoEqu and sync with Kaos.
<SM3> 1/4/94 PN Add additional support for the rest of CSC panels from Kaos.
<SM2> 12/13/93 PN Roll in KAOs and Horror changes to support Malcom and AJ
machines
<1> 01-12-93 jmp first checked in
*/
//-------------------------------------------------------------
// Includes/Equates
//-------------------------------------------------------------
#include "Types.r"
#define _NO_SINL_ // DonÕt need 'SINL' resource here.
#include "ROMLink.r"
#undef _NO_SINL_
#include "DepVideoEqu.r"
#include "HardwarePrivateEqu.r"
#include "InternalOnlyEqu.r"
#include "Quickdraw.r"
// This #define's are a stopgap measure for now.
#define firstVidMode 0x80
#define secondVidMode 0x81
#define thirdVidMode 0x82
#define fourthVidMode 0x83
#define fifthVidMode 0x84
#define sixthVidMode 0x85
//-------------------------------------------------------------
// CSC sRsrc Directory
//-------------------------------------------------------------
resource 'sdir' (6000, "_sRsrcCSCDir") {{
sRsrc_BdEscher, l{"_sRsrc_BdEscher"}; // Board sResources
sRsrc_BdBlackBird, l{"_sRsrc_BdBlackBird"};
sRsrc_BdYeager, l{"_sRsrc_BdYeager"};
// Functional sRsrcs for CSC-based video.
//
sRsrc_Vid_CSC_C_S_TFT_399, l{"_sRsrc_Vid_CSC_640x399_TFT"}; // 1,2,4,8,16 $80
sRsrc_Vid_CSC_C_S_TFT_480, l{"_sRsrc_Vid_CSC_640x480_TFT"}; // 1,2,4,8 $81
sRsrc_Vid_CSC_C_S_TFT_399a, l{"_sRsrc_Vid_CSC_640x399_TFT"}; // 1,2,4,8,16 $82
sRsrc_Vid_CSC_C_S_TFT_480a, l{"_sRsrc_Vid_CSC_640x480_TFT"}; // 1,2,4,8
sRsrc_Vid_CSC_C_D_STN_480, l{"_sRsrc_Vid_CSC_640x480_STN"}; // 1,2,4,8 $85
sRsrc_Vid_CSC_C_S_TFT_399b, l{"_sRsrc_Vid_CSC_640x399_TFT"}; // 1,2,4,8,16
sRsrc_Vid_CSC_C_S_TFT_480b, l{"_sRsrc_Vid_CSC_640x480_TFT"}; // 1,2,4,8
sRsrc_Vid_CSC_C_S_TFT_399c, l{"_sRsrc_Vid_CSC_640x399_TFT"}; // 1,2,4,8,16
sRsrc_Vid_CSC_C_S_TFT_480c, l{"_sRsrc_Vid_CSC_640x480_TFT"}; // 1,2,4,8
sRsrc_Vid_CSC_C_S_TFT_399d, l{"_sRsrc_Vid_CSC_640x399_TFT"}; // 1,2,4,8,16
sRsrc_Vid_CSC_C_S_TFT_480d, l{"_sRsrc_Vid_CSC_640x480_TFT"}; // 1,2,4,8
sRsrc_Vid_CSC_G_D_STN_400, l{"_sRsrc_Vid_CSC_640x400Gray"}; // 1,2,4
sRsrc_Vid_CSC_G_S_TFT_400, l{"_sRsrc_Vid_CSC_640x400Gray"}; // 1,2,4
sRsrc_Vid_CSC_G_D_STN_480, l{"_sRsrc_Vid_CSC_640x480Gray"}; // 1,2,4
sRsrc_Vid_CSC_G_S_TFT_480, l{"_sRsrc_Vid_CSC_640x480GrayTFT"}; // 1,2,4,8
sRsrc_Vid_CSC_C_S_TFT_399y, l{"_sRsrc_Vid_CSC_640x399_TFT"}; // 1,2,4,8,16
sRsrc_Vid_CSC_C_S_TFT_480y, l{"_sRsrc_Vid_CSC_640x480_TFT"}; // 1,2,4,8
sRsrc_Vid_CSC_G_D_STN_400y, l{"_sRsrc_Vid_CSC_640x400Gray"}; // 1,2,4
sRsrc_Vid_CSC_G_S_TFT_400y, l{"_sRsrc_Vid_CSC_640x400Gray"}; // 1,2,4
// Miscellaneous sRsrcs for CSC.
//
sRsrc_CPUMac030, a{"_sRsrc_CPUMac030"}; // CPU sRsrcs.
sRsrc_CPUMac040, a{"_sRsrc_CPUMacO40"};
sRsrc_Sonic, a{"_sRsrc_Sonic"}; // Sonic sRrsc.
}};
//-------------------------------------------------------------
// Board sRsrc List
//-------------------------------------------------------------
resource 'boar' (6010,"_sRsrc_BdEscher") {{
sRsrcType, a{"_BoardType"};
sRsrcName, c{"CSC Built-in Video"};
BoardId, d{EscherBoardID};
PrimaryInit, a{"_sCSCPrimaryInit"};
VendorInfo, a{"_VendorInfo"};
sRsrcVidNames,l{"_CSCVidNameDir"};
sVidParmDir, l{"_VidParmDir_CSC"};
}};
resource 'boar' (6020,"_sRsrc_BdBlackBird") {{
sRsrcType, a{"_BoardType"};
sRsrcName, c{"CSC-2 Built-In Video"};
BoardId, d{BlackBirdBdID};
PrimaryInit, a{"_sCSCPrimaryInit"};
VendorInfo, a{"_VendorInfo"};
sRsrcVidNames,l{"_CSCVidNameDir"};
sVidParmDir, l{"_VidParmDir_CSC"};
}};
resource 'boar' (6030,"_sRsrc_BdYeager") {{
sRsrcType, a{"_BoardType"};
sRsrcName, c{"CSC-3 Built-In Video"};
BoardId, d{YeagerBoardID};
PrimaryInit, a{"_sCSCPrimaryInit"};
VendorInfo, a{"_VendorInfo"};
sRsrcVidNames,l{"_CSCVidNameDir"};
sVidParmDir, l{"_VidParmDir_CSC"};
}};
//-------------------------------------------------------------
// Video Name Directory
//-------------------------------------------------------------
resource 'vdir' (6000, "_CSCVidNameDir") {{
sRsrc_Vid_CSC_C_S_TFT_399, l{"_sName_ColorLCD"};
sRsrc_Vid_CSC_C_S_TFT_480, l{"_sName_BigCLCD"};
sRsrc_Vid_CSC_C_S_TFT_399a, l{"_sName_ColorLCD"};
sRsrc_Vid_CSC_C_S_TFT_480a, l{"_sName_BigCLCD"};
sRsrc_Vid_CSC_C_D_STN_480, l{"_sName_BigCLCD"};
sRsrc_Vid_CSC_C_S_TFT_399b, l{"_sName_ColorLCD"};
sRsrc_Vid_CSC_C_S_TFT_480b, l{"_sName_BigCLCD"};
sRsrc_Vid_CSC_C_S_TFT_399c, l{"_sName_ColorLCD"};
sRsrc_Vid_CSC_C_S_TFT_480c, l{"_sName_BigCLCD"};
sRsrc_Vid_CSC_C_S_TFT_399d, l{"_sName_ColorLCD"};
sRsrc_Vid_CSC_C_S_TFT_480d, l{"_sName_BigCLCD"};
sRsrc_Vid_CSC_G_D_STN_400, l{"_sName_GrayLCD400"};
sRsrc_Vid_CSC_G_S_TFT_400, l{"_sName_GrayLCD400"};
sRsrc_Vid_CSC_G_D_STN_480, l{"_sName_GrayLCD480"};
sRsrc_Vid_CSC_G_S_TFT_480, l{"_sName_GrayLCD480x"};
sRsrc_Vid_CSC_C_S_TFT_399y, l{"_sName_ColorLCD"};
sRsrc_Vid_CSC_C_S_TFT_480y, l{"_sName_BigCLCD"};
sRsrc_Vid_CSC_G_D_STN_400y, l{"_sName_GrayLCD400"};
sRsrc_Vid_CSC_G_S_TFT_400y, l{"_sName_GrayLCD400"};
}};
resource 'vmna' (6000,"_sName_ColorLCD") {128, "640 x 400, Thousands of Colors"};
resource 'vmna' (6010,"_sName_BigCLCD") {129, "640 x 480, 256 Colors or Grays"};
resource 'vmna' (6020,"_sName_GrayLCD400") {130, "640 x 400, 16 Grays"};
resource 'vmna' (6030,"_sName_GrayLCD480") {131, "640 x 480, 16 Grays"};
resource 'vmna' (6040,"_sName_GrayLCD480x") {132, "640 x 480, 64 Grays"};
//-------------------------------------------------------------
// Functional sResources
//-------------------------------------------------------------
resource 'srsc' (6000,"_sRsrc_Vid_CSC_640x399_TFT") {{
sRsrcType, l{"_VideoTypeCSC"};
sRsrcName, l{"_VideoNameCSC"};
sRsrcDrvrDir, l{"_VidDrvrDirCSC"};
sRsrcFlags, d{(0|(1<<f32BitMode)|(1<<fOpenAtStart))};
sRsrcHWDevID, d{1};
MinorBaseOS, l{"_MinorBaseCSC"};
MinorLength, l{"_MinorLength_640x400"};
sGammaDir, a{"_GammaDir_CSC_TFT"};
sVidAttributes, d{(0|(1<<fLCDScreen)|(1<<fBuiltInDisplay)|(1<<fDefaultColor)|(1<<fActiveBlack)|(1<<fDimMinAt1))};
FirstVidMode, a{"_OBMHR399"};
SecondVidMode, a{"_TBMHR399"};
ThirdVidMode, a{"_FBMHR399"};
FourthVidMode, a{"_EBMHR399"};
FifthVidMode, a{"_D16BMHR399"};
}};
//----------------------------------
resource 'srsc' (6010,"_sRsrc_Vid_CSC_640x480_TFT") {{
sRsrcType, l{"_VideoTypeCSC"};
sRsrcName, l{"_VideoNameCSC"};
sRsrcDrvrDir, l{"_VidDrvrDirCSC"};
sRsrcFlags, d{(0|(1<<f32BitMode)|(1<<fOpenAtStart))};
sRsrcHWDevID, d{1};
MinorBaseOS, l{"_MinorBaseCSC"};
MinorLength, l{"_MinorLength_640x480"};
sGammaDir, a{"_GammaDir_CSC_TFT"};
sVidAttributes, d{(0|(1<<fLCDScreen)|(1<<fBuiltInDisplay)|(1<<fDefaultColor)|(1<<fActiveBlack)|(1<<fDimMinAt1))};
FirstVidMode, a{"_OBMHR"};
SecondVidMode, a{"_TBMHR"};
ThirdVidMode, a{"_FBMHR"};
FourthVidMode, a{"_EBMHR"};
}};
//----------------------------------
resource 'srsc' (6020,"_sRsrc_Vid_CSC_640x480GrayTFT") {{
sRsrcType, l{"_VideoTypeCSC"};
sRsrcName, l{"_VideoNameCSC"};
sRsrcDrvrDir, l{"_VidDrvrDirCSC"};
sRsrcFlags, d{(0|(1<<f32BitMode)|(1<<fOpenAtStart))};
sRsrcHWDevID, d{1};
MinorBaseOS, l{"_MinorBaseCSC"};
MinorLength, l{"_MinorLength_640x480"};
//sGammaDir, a{"_GammaDir_CSC_Linear"};
sVidAttributes, d{(0|(1<<fLCDScreen)|(1<<fBuiltInDisplay)|(1<<fDefaultColor)|(1<<fActiveBlack)|(0<<fDimMinAt1))};
FirstVidMode, a{"_OBMHR"};
SecondVidMode, a{"_TBMHR"};
ThirdVidMode, a{"_FBMHR"};
FourthVidMode, a{"_EBMHR"};
}};
resource 'srsc' (6030,"_sRsrc_Vid_CSC_640x480_STN") {{
sRsrcType, l{"_VideoTypeCSC"};
sRsrcName, l{"_VideoNameCSC"};
sRsrcDrvrDir, l{"_VidDrvrDirCSC"};
sRsrcFlags, d{(0|(1<<f32BitMode)|(1<<fOpenAtStart))};
sRsrcHWDevID, d{1};
MinorBaseOS, l{"_MinorBaseCSC"};
MinorLength, l{"_MinorLength_640x480"};
//sGammaDir, a{"_GammaDir_CSC_Linear"};
sVidAttributes, d{(0|(1<<fLCDScreen)|(1<<fBuiltInDisplay)|(1<<fDefaultColor)|(1<<fActiveBlack))};
FirstVidMode, a{"_OBMHR"};
SecondVidMode, a{"_TBMHR"};
ThirdVidMode, a{"_FBMHR"};
FourthVidMode, a{"_EBMHR"};
}};
resource 'srsc' (6040,"_sRsrc_Vid_CSC_640x400Gray") {{
sRsrcType, l{"_VideoTypeCSC"};
sRsrcName, l{"_VideoNameCSC"};
sRsrcDrvrDir, l{"_VidDrvrDirCSC"};
sRsrcFlags, d{(0|(1<<f32BitMode)|(1<<fOpenAtStart))};
sRsrcHWDevID, d{1};
MinorBaseOS, l{"_MinorBaseGSC"};
MinorLength, l{"_MinorLengthGSCLCD"};
sVidAttributes, d{(0|(1<<fLCDScreen)|(1<<fBuiltInDisplay)|(1<<fDefaultColor)|(1<<fActiveBlack)|(0<<fDimMinAt1))};
FirstVidMode, a{"_OBMLCD"};
SecondVidMode, a{"_TBMLCD"};
ThirdVidMode, a{"_FBMLCD"};
}};
resource 'srsc' (6050,"_sRsrc_Vid_CSC_640x480Gray") {{
sRsrcType, l{"_VideoTypeCSC"};
sRsrcName, l{"_VideoNameCSC"};
sRsrcDrvrDir, l{"_VidDrvrDirCSC"};
sRsrcFlags, d{(0|(1<<f32BitMode)|(1<<fOpenAtStart))};
sRsrcHWDevID, d{1};
MinorBaseOS, l{"_MinorBaseCSC"};
MinorLength, l{"_MinorLengthGSC480"};
sVidAttributes, d{(0|(1<<fLCDScreen)|(1<<fBuiltInDisplay)|(1<<fDefaultColor)|(1<<fActiveBlack)|(0<<fDimMinAt1))};
FirstVidMode, a{"_OBMLCD480"};
SecondVidMode, a{"_TBMLCD480"};
ThirdVidMode, a{"_FBMLCD480"};
}};
//-------------------------------------------------------------
// Resource Types
//-------------------------------------------------------------
resource 'styp' (6000, "_VideoTypeCSC") {CatDisplay, TypVideo, DrSwApple, DrHwCSC};
//-------------------------------------------------------------
// Resource Names
//-------------------------------------------------------------
resource 'cstr' (6000, "_VideoNameCSC") {"Display_Video_Apple_CSC"};
//-------------------------------------------------------------
// Driver Directory
//-------------------------------------------------------------
resource 'ddir' (6000, "_VidDrvrDirCSC") {{
sMacOS68020, l{"_sCSCDrvrDir"};
}};
resource 'node' (6000,"_sCSCDrvrDir") {{
blocksize{};
include{match{{file{$$Shell("RsrcDir")"DeclDataVideo.rsrc"};
type{'decl'};
id{6000};}}};
}};
//-------------------------------------------------------------
// Minor/Major Bases/Lengths
//-------------------------------------------------------------
resource 'long' (6000,"_MinorBaseCSC") {defMinorBase};
resource 'long' (6005,"_MinorBaseGSC") {defMinorBase};
resource 'long' (6010,"_MinorLength_640x400") {MinorLength_640x400};
resource 'long' (6040,"_MinorLength_640x480") {MinorLength_640x480};
resource 'long' (6050,"_MinorLengthGSCLCD") {MinorLengthGSCLCD};
resource 'long' (6060,"_MinorLengthGSC480") {MinorLengthGSC480};
//-------------------------------------------------------------
// Video Parameters
//-------------------------------------------------------------
resource 'list' (6000, "_VidParmDir_CSC") {{
sRsrc_Vid_CSC_C_S_TFT_399, l{"_sVidParams_CSC_C_S_TFT_399"}; // Color, TFT, Single-Drive, 640x480 [Sharp-Escher]
sRsrc_Vid_CSC_C_S_TFT_480, l{"_sVidParams_CSC_C_S_TFT_480"};
sRsrc_Vid_CSC_C_S_TFT_399a, l{"_sVidParams_CSC_C_S_TFT_399a"}; // Color, TFT, Single-Drive, 640x480 [Sharp]
sRsrc_Vid_CSC_C_S_TFT_480a, l{"_sVidParams_CSC_C_S_TFT_480a"};
sRsrc_Vid_CSC_C_D_STN_480, l{"_sVidParams_CSC_C_D_STN_480"}; // 640x480-sized Panels
sRsrc_Vid_CSC_C_S_TFT_399b, l{"_sVidParams_CSC_C_S_TFT_399b"}; // Color, TFT, Single-Drive, 640x480 [NEC]
sRsrc_Vid_CSC_C_S_TFT_480b, l{"_sVidParams_CSC_C_S_TFT_480b"};
sRsrc_Vid_CSC_C_S_TFT_399c, l{"_sVidParams_CSC_C_S_TFT_399c"}; // Color, TFT, Single-Drive, 640x480 [Hosiden]
sRsrc_Vid_CSC_C_S_TFT_480c, l{"_sVidParams_CSC_C_S_TFT_480c"};
sRsrc_Vid_CSC_C_S_TFT_399d, l{"_sVidParams_CSC_C_S_TFT_399d"}; // Color, TFT, Single-Drive, 640x480 [Toshiba]
sRsrc_Vid_CSC_C_S_TFT_480d, l{"_sVidParams_CSC_C_S_TFT_480d"};
sRsrc_Vid_CSC_G_D_STN_400, l{"_sVidParams_CSC_G_D_STN_400"}; // Gray, STN, Dual-Drive, 640x400 [Sharp-Escher]
sRsrc_Vid_CSC_G_S_TFT_400, l{"_sVidParams_CSC_G_S_TFT_400"}; //Gray, TFT, Single-Drive, 640x400 [Hosiden-Escher]
sRsrc_Vid_CSC_G_D_STN_480, l{"_sVidParams_CSC_G_D_STN_480"}; // Gray, STN, Dual-Drive, 640x480 [Sharp]
sRsrc_Vid_CSC_G_S_TFT_480, l{"_sVidParams_CSC_G_S_TFT_480"}; //Gray, TFT, Single-Drive, 640x480 [Hosiden]
sRsrc_Vid_CSC_C_S_TFT_399y, l{"_sVidParams_CSC_C_S_TFT_399y"}; // Color, TFT, Single-Drive, 640x480 [Sharp]
sRsrc_Vid_CSC_C_S_TFT_480y, l{"_sVidParams_CSC_C_S_TFT_480y"};
sRsrc_Vid_CSC_G_D_STN_400y, l{"_sVidParams_CSC_G_D_STN_400y"}; // Gray, STN, Dual-Drive, 640x400 [Sharp-Yeager]
sRsrc_Vid_CSC_G_S_TFT_400y, l{"_sVidParams_CSC_G_S_TFT_400y"}; //Gray, TFT, Single-Drive, 640x400 [Hosiden-Yeager]
}};
//
// Color, TFT, Single-Drive, 640x480 Panel in 640x399 mode for ÒThousandsÓ (CSC) [Sharp]
//
resource 'node' (6004,"_sVidParams_CSC_C_S_TFT_399") {{
blocksize{};
bytes{{FifthVidMode;FifthVidMode;}}; // MaxModes: 512K,1Meg
words{{(defmBounds_BLCD-1)-1;}}; // 480 Rows.
bytes{{$01;$05;}}; // PanelType, PanelSetup
bytes{{$08;$09;$02;$0D;}}; // HSkew Hi/Lo, VSkew Hi/Lo
bytes{{$00;$00;$01;$06;$05}}; // ACDClk Hi/Lo, LP Start/Width, FLMControl
bytes{{$08}}; // DataOutForm
bytes{{$00;$00;$00;$00;$00;$00}}; // 1pp
bytes{{$01;$00;$00;$01;$00;$00}}; // 2pp
bytes{{$06;$00;$00;$05;$0A;$05}}; // 4pp
bytes{{$05;$0A;$05;$05;$0A;$05}}; // 8pp
bytes{{$04;$0A;$05;$04;$0A;$05}}; // 16pp
}};
//
// Color, TFT, Single-Drive, 640x480 (CSC) [Sharp]
//
resource 'node' (6006,"_sVidParams_CSC_C_S_TFT_480") {{
blocksize{};
bytes{{FourthVidMode;FourthVidMode;}}; // MaxModes: 512K,1Meg
words{{defmBounds_BBigLCD-1;}}; // 480 Rows.
bytes{{$05;$07;}}; // PanelType, PanelSetup
bytes{{$08;$09;$02;$04;}}; // HSkew Hi/Lo, VSkew Hi/Lo
bytes{{$00;$00;$01;$06;$05}}; // ACDClk Hi/Lo, LP Start/Width, FLMControl
bytes{{$08}}; // DataOutForm
bytes{{$00;$00;$00;$00;$00;$00}}; // 1pp
bytes{{$01;$00;$00;$01;$00;$00}}; // 2pp
bytes{{$06;$00;$00;$04;$0A;$05}}; // 4pp
bytes{{$05;$0A;$05;$04;$0A;$05}}; // 8pp
}};
//
// Color, TFT, Single-Drive, 640x480 Panel in 640x399 mode for ÒThousandsÓ (CSC) [Sharp]
//
resource 'node' (6008,"_sVidParams_CSC_C_S_TFT_399a") {{
blocksize{};
bytes{{FifthVidMode;FifthVidMode;}}; // MaxModes: 512K,1Meg
words{{(defmBounds_BLCD-1)-1;}}; // 480 Rows.
bytes{{$01;$06;}}; // PanelType, PanelSetup
bytes{{$08;$0A;$02;$0D;}}; // HSkew Hi/Lo, VSkew Hi/Lo
bytes{{$00;$00;$01;$06;$05}}; // ACDClk Hi/Lo, LP Start/Width, FLMControl
bytes{{$08}}; // DataOutForm
bytes{{$00;$00;$00;$00;$00;$00}}; // 1pp
bytes{{$04;$0A;$05;$04;$0A;$05}}; // 2pp
bytes{{$04;$0A;$05;$04;$0A;$05}}; // 4pp
bytes{{$04;$0A;$05;$05;$0A;$05}}; // 8pp
bytes{{$04;$0A;$05;$04;$0A;$05}}; // 16pp
}};
//
// Color, TFT, Single-Drive, 640x480 (CSC) [Sharp]
//
resource 'node' (6010,"_sVidParams_CSC_C_S_TFT_480a") {{
blocksize{};
bytes{{FourthVidMode;FourthVidMode;}}; // MaxModes: 512K,1Meg
words{{defmBounds_BBigLCD-1;}}; // 480 Rows.
bytes{{$05;$07;}}; // PanelType, PanelSetup
bytes{{$08;$0A;$02;$04;}}; // HSkew Hi/Lo, VSkew Hi/Lo
bytes{{$00;$00;$01;$06;$05}}; // ACDClk Hi/Lo, LP Start/Width, FLMControl
bytes{{$08}}; // DataOutForm
bytes{{$00;$00;$00;$00;$00;$00}}; // 1pp
bytes{{$04;$0A;$05;$04;$0A;$05}}; // 2pp
bytes{{$04;$0A;$05;$04;$0A;$05}}; // 4pp
bytes{{$04;$0A;$05;$05;$0A;$05}}; // 8pp
}};
//
// 640x480 Parameters (CSC)
//
resource 'node' (6020,"_sVidParams_CSC_C_D_STN_480") {{
blocksize{};
bytes{{FourthVidMode;FourthVidMode;}}; // MaxModes: 512K,1Meg
words{{defmBounds_BBigLCD-1;}}; // 480 Rows.
bytes{{$0D;$04;}}; // PanelType, PanelSetup
bytes{{$00;$0D;$00;$00;}}; // HSkew Hi/Lo, VSkew Hi/Lo
bytes{{$00;$00;$01;$01;$00}}; // ACDClk Hi/Lo, LP Start/Width, FLMControl
bytes{{$06}}; // DataOutForm
bytes{{$03;$06;$03;$03;$06;$03}}; // 1pp
bytes{{$03;$06;$03;$03;$06;$03}}; // 2pp
bytes{{$03;$06;$03;$03;$06;$03}}; // 4pp
bytes{{$03;$06;$03;$03;$06;$03}}; // 8pp
}};
//
// Color, TFT, Single-Drive, 640x480 Panel in 640x399 mode for ÒThousandsÓ (CSC) [NEC]
//
resource 'node' (6030,"_sVidParams_CSC_C_S_TFT_399b") {{
blocksize{};
bytes{{FifthVidMode;FifthVidMode;}}; // MaxModes: 512K,1Meg
words{{(defmBounds_BLCD-1)-1;}}; // 480 Rows.
bytes{{$01;$05;}}; // PanelType, PanelSetup
bytes{{$0A;$0A;$03;$0F;}}; // HSkew Hi/Lo, VSkew Hi/Lo
bytes{{$00;$00;$01;$06;$05}}; // ACDClk Hi/Lo, LP Start/Width, FLMControl
bytes{{$08}}; // DataOutForm
bytes{{$00;$00;$00;$00;$00;$00}}; // 1pp
bytes{{$06;$00;$00;$07;$00;$00}}; // 2pp
bytes{{$06;$00;$00;$07;$00;$00}}; // 4pp
bytes{{$06;$00;$00;$06;$00;$00}}; // 8pp
bytes{{$06;$00;$00;$06;$00;$00}}; // 16pp
}};
//
// Color, TFT, Single-Drive, 640x480 (CSC) [NEC]
//
resource 'node' (6040,"_sVidParams_CSC_C_S_TFT_480b") {{
blocksize{};
bytes{{FourthVidMode;FourthVidMode;}}; // MaxModes: 512K,1Meg
words{{defmBounds_BBigLCD-1;}}; // 480 Rows.
bytes{{$05;$07;}}; // PanelType, PanelSetup
bytes{{$08;$0A;$02;$04;}}; // HSkew Hi/Lo, VSkew Hi/Lo
bytes{{$00;$00;$01;$06;$05}}; // ACDClk Hi/Lo, LP Start/Width, FLMControl
bytes{{$08}}; // DataOutForm
bytes{{$00;$00;$00;$00;$00;$00}}; // 1pp
bytes{{$06;$00;$00;$07;$00;$00}}; // 2pp
bytes{{$06;$00;$00;$07;$00;$00}}; // 4pp
bytes{{$06;$00;$00;$06;$00;$00}}; // 8pp
}};
//
// Color, TFT, Single-Drive, 640x480 Panel in 640x399 mode for ÒThousandsÓ (CSC) [Hosiden]
//
resource 'node' (6050,"_sVidParams_CSC_C_S_TFT_399c") {{
blocksize{};
bytes{{FifthVidMode;FifthVidMode;}}; // MaxModes: 512K,1Meg
words{{(defmBounds_BLCD-1)-1;}}; // 480 Rows.
bytes{{$01;$05;}}; // PanelType, PanelSetup
bytes{{$08;$0A;$02;$0D;}}; // HSkew Hi/Lo, VSkew Hi/Lo
bytes{{$00;$00;$02;$02;$05}}; // ACDClk Hi/Lo, LP Start/Width, FLMControl
bytes{{$08}}; // DataOutForm
bytes{{$00;$00;$00;$00;$00;$00}}; // 1pp
bytes{{$04;$0A;$05;$04;$0A;$05}}; // 2pp
bytes{{$04;$0A;$05;$04;$0A;$05}}; // 4pp
bytes{{$04;$0A;$05;$04;$0A;$05}}; // 8pp
bytes{{$04;$0A;$05;$04;$0A;$05}}; // 16pp
}};
//
// Color, TFT, Single-Drive, 640x480 (CSC) [Hosiden]
//
resource 'node' (6060,"_sVidParams_CSC_C_S_TFT_480c") {{
blocksize{};
bytes{{FourthVidMode;FourthVidMode;}}; // MaxModes: 512K,1Meg
words{{defmBounds_BBigLCD-1;}}; // 480 Rows.
bytes{{$05;$07;}}; // PanelType, PanelSetup
bytes{{$08;$0A;$00;$06;}}; // HSkew Hi/Lo, VSkew Hi/Lo
bytes{{$00;$00;$02;$02;$05}}; // ACDClk Hi/Lo, LP Start/Width, FLMControl
bytes{{$08}}; // DataOutForm
bytes{{$00;$00;$00;$00;$00;$00}}; // 1pp
bytes{{$04;$0A;$05;$04;$0A;$05}}; // 2pp
bytes{{$04;$0A;$05;$04;$0A;$05}}; // 4pp
bytes{{$04;$0A;$05;$04;$0A;$05}}; // 8pp
}};
//
// Color, TFT, Single-Drive, 640x480 Panel in 640x399 mode for ÒThousandsÓ (CSC) [Toshiba]
//
resource 'node' (6070,"_sVidParams_CSC_C_S_TFT_399d") {{
blocksize{};
bytes{{FifthVidMode;FifthVidMode;}}; // MaxModes: 512K,1Meg
words{{(defmBounds_BLCD-1)-1;}}; // 480 Rows.
bytes{{$01;$05;}}; // PanelType, PanelSetup
bytes{{$08;$0A;$02;$05;}}; // HSkew Hi/Lo, VSkew Hi/Lo
bytes{{$00;$00;$01;$06;$0F}}; // ACDClk Hi/Lo, LP Start/Width, FLMControl
bytes{{$08}}; // DataOutForm
bytes{{$00;$00;$00;$00;$00;$00}}; // 1pp
bytes{{$04;$0A;$05;$04;$0A;$05}}; // 2pp
bytes{{$04;$0A;$05;$04;$0A;$05}}; // 4pp
bytes{{$04;$0A;$05;$04;$0A;$05}}; // 8pp
bytes{{$04;$0A;$05;$04;$0A;$05}}; // 16pp
}};
//
// Color, TFT, Single-Drive, 640x480 (CSC) [Toshiba]
//
resource 'node' (6080,"_sVidParams_CSC_C_S_TFT_480d") {{
blocksize{};
bytes{{FourthVidMode;FourthVidMode;}}; // MaxModes: 512K,1Meg
words{{defmBounds_BBigLCD-1;}}; // 480 Rows.
bytes{{$05;$07;}}; // PanelType, PanelSetup
bytes{{$08;$0A;$02;$05;}}; // HSkew Hi/Lo, VSkew Hi/Lo
bytes{{$00;$00;$01;$06;$0F}}; // ACDClk Hi/Lo, LP Start/Width, FLMControl
bytes{{$08}}; // DataOutForm
bytes{{$00;$00;$00;$00;$00;$00}}; // 1pp
bytes{{$04;$0A;$05;$04;$0A;$05}}; // 2pp
bytes{{$04;$0A;$05;$04;$0A;$05}}; // 4pp
bytes{{$04;$0A;$05;$05;$0A;$05}}; // 8pp
}};
//
// Gray, STN, Dual-Drive, 640x400 (CSC) [Sharp-Escher]
//
resource 'node' (6100,"_sVidParams_CSC_G_D_STN_400") {{
blocksize{};
bytes{{ThirdVidMode;ThirdVidMode;}}; // MaxModes: 512K,1Meg
words{{defmBounds_BLCD-1;}}; // 480 Rows.
bytes{{$0B;$00;}}; // PanelType, PanelSetup
bytes{{$00;$02;$00;$00;}}; // HSkew Hi/Lo, VSkew Hi/Lo
bytes{{$00;$00;$01;$01;$00}}; // ACDClk Hi/Lo, LP Start/Width, FLMControl
bytes{{$04}}; // DataOutForm
bytes{{$00;$00;$00;$06;$00;$00}}; // 1pp
bytes{{$00;$00;$00;$02;$05;$0A}}; // 2pp
bytes{{$00;$00;$00;$03;$05;$0A}}; // 4pp
}};
//
// Gray, TFT, Single-Drive, 640x400 (CSC) [Hosiden-Escher]
//
resource 'node' (6110,"_sVidParams_CSC_G_S_TFT_400") {{
blocksize{};
bytes{{ThirdVidMode;ThirdVidMode;}}; // MaxModes: 512K,1Meg
words{{defmBounds_BLCD-1;}}; // 480 Rows.
bytes{{$03;$00;}}; // PanelType, PanelSetup
bytes{{$00;$02;$00;$00;}}; // HSkew Hi/Lo, VSkew Hi/Lo
bytes{{$00;$00;$01;$01;$00}}; // ACDClk Hi/Lo, LP Start/Width, FLMControl
bytes{{$07}}; // DataOutForm
bytes{{$00;$00;$00;$00;$00;$00}}; // 1pp
bytes{{$00;$00;$00;$00;$00;$00}}; // 2pp
bytes{{$00;$00;$00;$04;$0A;$05}}; // 4pp
}};
//
// Gray, STN, Dual-Drive, 640x480 (CSC) [Sharp]
//
resource 'node' (6120,"_sVidParams_CSC_G_D_STN_480") {{
blocksize{};
bytes{{ThirdVidMode;ThirdVidMode;}}; // MaxModes: 512K,1Meg
words{{defmBounds_BBigLCD-1;}}; // 480 Rows.
bytes{{$0F;$00;}}; // PanelType, PanelSetup
bytes{{$00;$02;$00;$00;}}; // HSkew Hi/Lo, VSkew Hi/Lo
bytes{{$00;$00;$01;$01;$00}}; // ACDClk Hi/Lo, LP Start/Width, FLMControl
bytes{{$04}}; // DataOutForm
bytes{{$00;$00;$00;$06;$00;$00}}; // 1pp
bytes{{$00;$00;$00;$02;$05;$0A}}; // 2pp
bytes{{$00;$00;$00;$03;$05;$0A}}; // 4pp
}};
//
// Gray, TFT, Single-Drive, 640x480 (CSC) [Hosiden]
//
resource 'node' (6130,"_sVidParams_CSC_G_S_TFT_480") {{
blocksize{};
bytes{{FourthVidMode;FourthVidMode;}}; // MaxModes: 512K,1Meg
words{{defmBounds_BBigLCD-1;}}; // 480 Rows.
bytes{{$05;$00;}}; // PanelType, PanelSetup
bytes{{$00;$02;$00;$00;}}; // HSkew Hi/Lo, VSkew Hi/Lo
bytes{{$00;$00;$01;$01;$00}}; // ACDClk Hi/Lo, LP Start/Width, FLMControl
bytes{{$07}}; // DataOutForm
bytes{{$00;$00;$00;$00;$00;$00}}; // 1pp
bytes{{$00;$00;$00;$00;$00;$00}}; // 2pp
bytes{{$00;$00;$00;$00;$00;$00}}; // 4pp
bytes{{$00;$00;$00;$05;$0A;$05}}; // 8pp
}};
//
// Color, TFT, Single-Drive, 640x480 Panel in 640x399 mode for ÒThousandsÓ (CSC) [Sharp-Yeager]
//
resource 'node' (6140,"_sVidParams_CSC_C_S_TFT_399y") {{
blocksize{};
bytes{{FifthVidMode;FifthVidMode;}}; // MaxModes: 512K,1Meg
words{{(defmBounds_BLCD-1)-1;}}; // 480 Rows.
bytes{{$01;$05;}}; // PanelType, PanelSetup
bytes{{$08;$09;$02;$0D;}}; // HSkew Hi/Lo, VSkew Hi/Lo
bytes{{$00;$00;$01;$06;$05}}; // ACDClk Hi/Lo, LP Start/Width, FLMControl
bytes{{$08}}; // DataOutForm
bytes{{$00;$00;$00;$00;$00;$00}}; // 1pp
bytes{{$01;$00;$00;$01;$00;$00}}; // 2pp
bytes{{$06;$00;$00;$05;$0A;$05}}; // 4pp
bytes{{$05;$0A;$05;$05;$0A;$05}}; // 8pp
bytes{{$04;$0A;$05;$04;$0A;$05}}; // 16pp
}};
//
// Color, TFT, Single-Drive, 640x480 (CSC) [Sharp-Yeager]
//
resource 'node' (6150,"_sVidParams_CSC_C_S_TFT_480y") {{
blocksize{};
bytes{{FourthVidMode;FourthVidMode;}}; // MaxModes: 512K,1Meg
words{{defmBounds_BBigLCD-1;}}; // 480 Rows.
bytes{{$05;$07;}}; // PanelType, PanelSetup
bytes{{$08;$09;$02;$04;}}; // HSkew Hi/Lo, VSkew Hi/Lo
bytes{{$00;$00;$01;$06;$05}}; // ACDClk Hi/Lo, LP Start/Width, FLMControl
bytes{{$08}}; // DataOutForm
bytes{{$00;$00;$00;$00;$00;$00}}; // 1pp
bytes{{$01;$00;$00;$01;$00;$00}}; // 2pp
bytes{{$06;$00;$00;$04;$0A;$05}}; // 4pp
bytes{{$05;$0A;$05;$04;$0A;$05}}; // 8pp
}};
//
// Gray, STN, Dual-Drive, 640x400 (CSC) [Sharp-Yeager]
//
resource 'node' (6160,"_sVidParams_CSC_G_D_STN_400y") {{
blocksize{};
bytes{{ThirdVidMode;ThirdVidMode;}}; // MaxModes: 512K,1Meg
words{{defmBounds_BLCD-1;}}; // 480 Rows.
bytes{{$0B;$00;}}; // PanelType, PanelSetup
bytes{{$00;$0B;$00;$00;}}; // HSkew Hi/Lo, VSkew Hi/Lo
bytes{{$00;$00;$01;$01;$00}}; // ACDClk Hi/Lo, LP Start/Width, FLMControl
bytes{{$04}}; // DataOutForm
bytes{{$00;$00;$00;$06;$00;$00}}; // 1pp
bytes{{$00;$00;$00;$02;$05;$0A}}; // 2pp
bytes{{$00;$00;$00;$03;$05;$0A}}; // 4pp
}};
//
// Gray, TFT, Single-Drive, 640x400 (CSC) [Hosiden-Yeager]
//
resource 'node' (6170,"_sVidParams_CSC_G_S_TFT_400y") {{
blocksize{};
bytes{{ThirdVidMode;ThirdVidMode;}}; // MaxModes: 512K,1Meg
words{{defmBounds_BLCD-1;}}; // 480 Rows.
bytes{{$03;$00}}; // PanelType, PanelSetup
bytes{{$00;$0B;$00;$00;}}; // HSkew Hi/Lo, VSkew Hi/Lo
bytes{{$00;$00;$01;$01;$00}}; // ACDClk Hi/Lo, LP Start/Width, FLMControl
bytes{{$07}}; // DataOutForm
bytes{{$00;$00;$00;$00;$00;$00}}; // 1pp
bytes{{$00;$00;$00;$00;$00;$00}}; // 2pp
bytes{{$00;$00;$00;$04;$0A;$05}}; // 4pp
}};
//-------------------------------------------------------------
// PrimaryInit
//-------------------------------------------------------------
resource 'node' (6200,"_sCSCPrimaryInit") {{
blocksize{};
include{match{{file{$$Shell("RsrcDir")"DeclDataVideo.rsrc"};
type{'decl'};
id{6030};}}};
}};

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,803 @@
;
; File: CSCPrimaryInit.a
;
; Written by: Mike Puckett, December 20, 1992.
;
; Copyright: © 1991-1993 by Apple Computer, Inc., all rights reserved.
;
; Change History (most recent first):
;
; <SM2> 12/13/93 PN Roll in KAOs and Horror changes to support Malcom and AJ
; machines
; <1> 01-12-93 jmp first checked in
; <H2> 01-05-93 jmp Added some temporary family modes to test out 16bpp.
; <1> 12-23-92 jmp first checked in
PRINT OFF
LOAD 'StandardEqu.d'
INCLUDE 'HardwarePrivateEqu.a'
INCLUDE 'ROMEqu.a'
INCLUDE 'Video.a'
INCLUDE 'SlotMgrEqu.a'
INCLUDE 'SonicEqu.a'
INCLUDE 'UniversalEqu.a'
INCLUDE 'DockingEqu.a'
INCLUDE 'PowerPrivEqu.a'
INCLUDE 'DepVideoEqu.a'
PRINT ON
SEG '_sCSCPrimaryInit'
BLANKS ON
STRING ASIS
MACHINE MC68020
CSCPrimaryInit Main Export
;---------------------------------------------------------------------
; Header
;---------------------------------------------------------------------
Dc.b sExec2 ; Header
Dc.b sCPU68020
Dc.w 0
Dc.l BeginCSCInit-*
;---------------------------------------------------------------------
; Local variables, definitions, etc....
;---------------------------------------------------------------------
With SEBlock,SPBlock
CSCFrame Record {A6Link},Decrement
Return Ds.l 1 ; Return address.
A6Link Ds.l 1 ; Saved A6.
spBlk Ds SPBlock ; SpBlock for generic use.
sPRAMBlk Ds.b SizeSPRAMRec ; sPRAMRec for generic use.
configParamsPtr Ds.l 1 ; Pointer to configruation parameters.
vidParamsPtr Ds.l 1 ; Pointer to video parameters.
mscBaseAddr Ds.l 1 ; DonÕt want to look up MSCÕs address more than once.
prodID Ds.b 1 ; For easily distinguishing between products.
disableLCD Ds.b 1 ; When true, weÕre shutting the LCD down.
CSCFSize Equ *
Endr
Endwith
CSCProdCnfgRec Record 0 ;
memConfig Ds.b 1 ; Physical VRAM configuration type.
refreshRate Ds.b 1 ; The desired refresh rate.
vramControl Ds.b 1 ; CPU/VRAM interface control.
Ds.b 1 ; <pad>
CSCProdCnfgSize Equ *
Endr
CSCVRAMCnfgRec Record 0 ;
sRsrcID Ds.b 1 ; sRsrc ID for this VRAM configuration.
modeID Ds.b 1 ; Favored modeID (depth).
boxID Ds.b 1 ; BoxFlag to write out.
Ds.b 1 ; <pad>
familiesOffset Ds.w 1 ; Offset to family mode table.
CSCVRAMCnfgSize Equ *
Endr
With MiniGamma,CSCVRAMCnfgRec
CSCCnfgRec Record 0
gammaTbl Ds.b GT_Size ; Mini-gamma table (defined in PrimaryInit.a).
CSCCnfgHdrSize Equ *
csc512KVRAM Ds.b CSCVRAMCnfgSize ; 512K vRAM preferences.
CSCCnfgRecSize Equ *
Endr
CSCCnfgTblSize Equ (8*CSCCnfgRec.CSCCnfgRecSize) ; 0..7 (8) Panel IDs per table.
Endwith
;---------------------------------------------------------------------
; Utils
;---------------------------------------------------------------------
;---------------------------------------------------------------------
;
; PruneList
;
; Loops thru a table of sRsrcIDs comparing the ÒkeeperÓ with each
; of the entries in the table. Those IDs that donÕt match
; the keeper are pruned.
;
; -> D0: sRsrcID of the ÒkeeperÓ
; -> A0: pointer to appropriately filled-out SpBlock
; -> A1: pointer to list of sRsrcIDs
;
; Trashes: D0-D1/A1.
;
With SpBlock
CSCPruneList
Move.b D0,-(Sp) ; Remember the ID of the Òkeeper.Ó
Move.w (A1)+,D1 ; Get the zero-based counter into D1.
@Repeat Move.b (A1)+,D0 ; Get an sRsrc ID.
Cmp.b (Sp),D0 ; If itÕs the keeper,
Beq.s @Until ; then donÕt prune it.
Move.b D0,spID(A0) ; Otherwise, prune it.
_sDeleteSRTRec
@Until Dbra D1,@Repeat ; Loop until done.
Tst.b (Sp)+ ; Clean up the stack.
Rts ; Return to caller.
Endwith
;---------------------------------------------------------------------
;
; BuildFamilyList
;
; Loops thru a table of sRsrcIDs comparing the ÒkeeperÓ with each
; of the entries in the table. Those IDs that donÕt match
; the keeper are inserted back in as disabled.
;
; -> D0: sRsrcID of the ÒkeeperÓ
; -> A0: pointer to appropriately filled-out SpBlock
; -> A1: pointer to list of sRsrcIDs
;
; Trashes: D0-D1/A1.
;
With SpBlock
CSCBuildFamilyList
Move.b D0,-(Sp) ; Remember the ID of the Òkeeper.Ó
Move.w (A1)+,D1 ; Get the zero-based counter into D1.
@Repeat Move.b (A1)+,D0 ; Get an sRsrc ID.
Cmp.b (Sp),D0 ; If itÕs the keeper,
Beq.s @Until ; then leave it alone.
Move.b D0,spID(A0) ; Otherwise, load that sRsrc ID.
Clr.l spsPointer(A0) ; Tell the Slot Manager that itÕs in ROM.
Move.l #1,spParamData(A0) ; Say that we want it disabled.
Clr.w spRefNum(A0) ; Say that thereÕs no driver yet.
_InsertSRTRec ; Do it!
@Until Dbra D1,@Repeat ; Loop until done.
Tst.b (Sp)+ ; Clean up the stack.
Rts ; Return to caller.
Endwith
;---------------------------------------------------------------------
; Main
;---------------------------------------------------------------------
With SEBlock,SPBlock,CSCFrame
BeginCSCInit
;
; Set up initial ÒvendorÓ status.
;
Link A6,#CSCFSize ; Allocate stack space for locals.
Move.w #seSuccess,seStatus(A0) ; Just say that weÕre okay.
;
; Perform some generic initializations.
;
Clr.b spBlk.spSlot(A6) ; Built-in video is always Slot $0.
Clr.b spBlk.spExtDev(A6) ; Why ask why? Just clear this guy.
Move.l UnivInfoPtr,A4 ; Keep a pointer to ProductInfo.
;
; Initialize the BoardID part of the Slot $0 pRAM if necessary, and prune the board sResources.
;
With SP_Params,ProductInfo,VideoInfo
Lea spBlk(A6),A0 ; Point A0 at our local SpBlock.
Lea sPRAMBlk(A6),A2 ; Get a pointer to our local SPRAMBlock.
Move.l A2,spResult(A0) ; Put our pointer in the SpBlock.
_sReadPRAMRec ; Read Slot $0Õs pRAM.
Move.l A4,A3 ; Copy the ProductInfo pointer.
Adda.l VideoInfoPtr(A3),A3 ; Point to the VideoInfo record.
Tst.w SP_BoardID(A2) ; If the board ID is non-zero,
Bne.s @PruneBoardSRsrc ; then just go on.
Move.b BoardSRsrcID(A3),spID(A0) ; Get the appropriate board sRsrc ID.
_sRsrcInfo ; Get the spsPointer.
Move.b #BoardID,spID(A0) ; Set up to get the correct board ID.
_sReadWord ; Get it.
Move.w spResult+2(A0),SP_BoardID(A2) ; Save the board ID into pRAM.
Move.l A2,spsPointer(A0) ; Point to the pRAM param block.
_InitSlotPRAM ; Write it out.
@PruneBoardSRsrc
Lea CSCSpIDTbl,A1 ; Point to the table of supported board sRsrcs.
Move.b BoardSRsrcID(A3),D0 ; Get the sRsrc ID of the keeper into D0.
Move.b D0,prodID(A6) ; (Remember the sRsrc ID for later.)
Bsr.s CSCPruneList ; Call our pruning utility.
;
; Set up the right CPU sResource. We only recognize Õ030 and Õ040 CPUs; all others
; are ignored (i.e., the CPU sResources are all deleted in that case).
;
Move.b CPUFlag,D1 ; Get the CPUFlag (680x0-flag) for compares.
Lea @CPUTable,A1 ; Get pointer to the table of valid CPU types.
@CPULoop Move.b (A1)+,D0 ; Pick up the next CPU type.
Beq.s @EndPruneCPUSRsrcs ; If weÕre done, leave.
Move.b (A1)+,spID(A0) ; Assume we wonÕt find a match.
Cmp.b D0,D1 ; But, if they do match,
Beq.s @SkipDelete ; then just go on.
_sDeleteSRTRec ; Otherwise, delete non-matching CPU sRsrc type.
@SkipDelete Bra.s @CPULoop ; And loop until done.
@CPUTable Dc.b cpu68030,sRsrc_CPUMac030
Dc.b cpu68040,sRsrc_CPUMac040
Dc.b 0,0
@EndPruneCPUSRsrcs
;
; HereÕs where we actually get the CSC video going, or we decide whether to just shut
; things down. WeÕll end up shutting things down if we either donÕt recognize the
; type of LCD attached (which is highly unlikely, since the LCDs are built-in), or
; the LCD is currently in an unuseable state. For example, Escher could be
; docked into a Gemini or an Atlantis, or, in BlackbirdÕs case, the lid could
; just be closed.
;
CSCVideoInit
Clr.l vidParamsPtr(A6) ; DonÕt try to throw away non-existent storage.
; Get some useful values up front.
;
Movea.l A4,A3 ; Copy the ProductInfo pointer.
Adda.l ProductInfo.DecoderInfoPtr(A3),A3 ; Point to the base address table.
Movea.l DecoderInfo.VDACAddr(A3),A3 ; Get the CSC base address into A3.
; First, disable the video interrupts sources as well as the power planes.
;
TestFor MSCChipBit ; If we donÕt have an MSC,
Beq.s @NoMSC ; then just go on.
Movea.l A4,A2 ; Copy the ProductInfo pointer.
Adda.l ProductInfo.DecoderInfoPtr(A2),A2 ; Point to the BaseAddr table.
Movea.l DecoderInfo.RBVAddr(A2),A2 ; Point to the MSCÕs base address.
Move.l A2,mscBaseAddr(A6) ; Save it for later.
Move.b #(0<<ifIRQ)|(1<<RvIRQ0En),MSCSlotIER(A2) ; Disable CSC interrupts.
Bclr #MSCLCDReset,MSCClkCntl(A2) ; Turn off CSC clock inputÉ
_CSCMinDelay ; Éwait for at least 32 PixClks, and
Bset #MSCLCDReset,MSCClkCntl(A2) ; Éturn CSC clock input back on to complete reset.
@NoMSC
Clr.b CSCDisplayStatus(A3) ; Disable CSC interrupt source.
Clr.b CSCPanelSetup(A3) ; Disable the panel power.
; Size the amount of VRAM. When done, D4 is set to one of {0,1}, where 0=512K,1=1024K.
; (Note: CSC supports a variety of VRAM types and configuration. At the moment,
; though, weÕll just simply say thereÕs 512K.)
;
;
With CSCProdCnfgRec
Lea CSCProdTable,A1 ; Point to the CSC ProductTable.
Move.w #CSCProdCnfgSize,D0 ; Get the size of each entry into D0.
Moveq #0,D1 ; Clear D1 for good measure.
Move.b prodID(A6),D1 ; Get the product ID.
Subq #1,D1 ; Normalize it.
Mulu D1,D0 ; Multiply by the right entry.
Adda.w D0,A1 ; Skip to the entry we want.
Move.b memConfig(A1),CSCMemConfig(A3) ; Set up for the right VRAM configuration.
Move.b refreshRate(A1),CSCRefreshRate(A3) ; Set up the refresh rate.
Move.b vramControl(A1),CSCVRAMControl(A3) ; Interface the VRAM correctly to the CPU.
Moveq #0,D4 ; Just say thereÕs 512K of VRAM for now.
Endwith
; Sense the type of panel to drive. For now, we have no extended-sense panels, so we just
; do a passive read of the panel senselines.
;
Moveq #0,D6 ; Initialize the senseline register.
Move.b #tristateCSC,CSCPanelIDControl(A3) ; Make the senselines inputs.
_CSCMinDelay ; Wait a moment.
Move.b CSCPanelID(A3),D6 ; Read Õem.
; Pick up the favored configuration based on the amount of VRAM and the type of display sensed or assumed.
;
With CSCVRAMCnfgRec,CSCCnfgRec
Lea CSCConfigTable,A1 ; Point to the CSC configuration table.
Move.w #CSCCnfgTblSize,D0 ; Get the size of each table into D0.
Moveq #0,D1 ; Clear D1 for good measure.
Move.b prodID(A6),D1 ; Get the product ID.
Subq #1,D1 ; Normalize it.
Mulu D1,D0 ; Multiply by the right entry.
Adda.w D0,A1 ; Skip to the entry we want.
Move.w #CSCCnfgRecSize,D0 ; Get the size of each entry into D0.
Mulu D6,D0 ; Multiply it by the right entry.
Adda.w D0,A1 ; Skip to the entry we want.
Move.l A1,configParamsPtr(A6) ; Save it for later.
Adda.w #CSCCnfgHdrSize,A1 ; Skip past the header.
Move.w #CSCVRAMCnfgSize,D0 ; Get the size of the VRAM entries.
Mulu D4,D0 ; Multiply by the right entry.
Adda.w D0,A1 ; Skip to the right VRAM entry.
Move.b modeID(A1),D7 ; Get the default mode (depth).
Move.b sRsrcID(A1),D5 ; Get the default sRsrcID.
Cmp.b #sRsrc_CSC_NeverMatch,D5 ; If weÕve come up with an unknown configuration, <K18>
Beq.s @NoAdjustBoxflag ; then skip boxflag adjustment. <K18>
Move.b boxID(A1),BoxFlag ; Set the BoxFlag value based on the PanelID.
@NoAdjustBoxflag
Endwith
; Next, check to see whether or not we should even bring up the CSC.
;
WITH PMgrRec, pmCommandRec
Movea.l PMgrBase,A2 ; point to Power Manager variables
Bclr #ignoreClamshell,PmgrFlags3(A2) ; reset ignore clamshell
Subq #4,Sp ; Make room for the docking result.
Move.l #dockDockingAttr,-(Sp) ; Say that we want the attributes.
Clr.l -(Sp) ; No params.
_DockingDispatch ; Call the Docking Manager.
Move.l (Sp)+,D0 ; Get the attributes.
Btst #dockNoLCDScreen,D0 ; Find out if the LCD is in a useable state.
Beq.s @ClamLook ; can use LCD, but check clamshell first
Bra.s @ClamDone ; set the flag to ignore LCD
;------------------------------------------------------------------------------------------------------ <H28>
; this code checks to see if we're docked, if we have external video, and if the clamshell is closed: |
; in such a case, we want to allow the system to boot on the external monitor but disable the internal v
; monitor and ignore the state of the clamshell switch
@ClamLook Subq.w #4,SP ; result
Move.l #dockHardwareAttr,-(SP) ; docking selector = get hardware attributes
Clr.l -(SP) ; params = nil
_DockingDispatch ; call the handler
Move.l (SP)+,D0
Btst #dockHasVideo,D0 ; do we have external video power?
Beq.s @EndDockChk ; nope, so skip case to ignore clamshell
Clr.w -(SP)
Move.l SP,-(SP) ; pmRBuffer
Move.l (SP),-(SP) ; pmSBuffer
Clr.w -(SP) ; pmLength = 0
Move.w #readExtSwitches,-(SP) ; pmCommand
Movea.l SP,A0 ; point to the parameter block
_PMgrOp ; get the clamshell info
Lea pmRBuffer+4(SP),SP ; toss the parameter block
Btst #clamshell,(SP)+ ; is the clamshell closed?
Beq.s @EndDockChk ; -> nope, all done
Bset #ignoreClamshell,PmgrFlags3(A2) ; set ignore clamshell
@ClamDone St disableLCD(A6) ; don't use internal LCD
Move.b #sRsrc_CSC_NeverMatch,D5 ; Make sure all the sResources get pruned.
Bra @SetConfig ; Skip the dynamic config code.
@EndDockChk
;------------------------------------------------------------------------------------------------------ <H28>
ENDWITH
; Initialize built-in videoÕs pRAM.
;
With SP_Params
@InitPRAM
Lea sPRAMBlk(A6),A2 ; Point to the sPRAM block.
Move.b SP_Flags(A2),D0 ; Copy the flags byte.
Bfins D4,D0{spVRamBits:numSPVRamBits} ; Load the amount of VRAM.
Move.b D0,SP_Flags(A2) ; Remember how much VRAM we setup for.
Bclr #spFamilyChanged,SP_Flags(A2) ; Always reset the family-changed bit.
Beq.s @EndScrnChk ; If it was already reset, then just go on.
Move.w #drHwCSC,ScrnInval ; Remind ourselves to manually update the 'scrn' resource (so disk can make things right).
@EndScrnChk Move.b D6,SP_MonID(A2) ; Remember which panel we sensed (or assumed).
Cmp.b SP_DfltConfig(A2),D5 ; If this is the same configuration/family we had last time,
Beq.s @WritePRAM ; then just write out the minimal pRAM info.
Move.b D5,SP_LastConfig(A2) ; Set the identification configuration.
Move.b D5,SP_DfltConfig(A2) ; Set the default/family configuration.
Move.b D7,SP_Depth(A2) ; Set the default depth for this configuration.
@WritePRAM Lea spBlk(A6),A0 ; Point to the slot param block.
Move.l A2,spsPointer(A0) ; Set up the pRAM parameter block.
_sPutPRAMRec ; Write out Slot $0Õs pRAM.
Move.b SP_LastConfig(A2),D5 ; Get the right (family member) sRsrc into D5.
Endwith
; First, prune all of the video sResources except for the selected one. If there are no families, then weÕre done.
; Otherwise, weÕre either done (because weÕve come up with an unknown configuration), or we re-insert all the members
; of the selected configurationÕs family as disabled.
;
With CSCVRAMCnfgRec,CSCCnfgRec
@SetConfig
Lea spBlk(A6),A0 ; Point A0 at our local SpBlock.
Lea CSCModeList,A1 ; Point to the table of supported video sRsrcs.
Move.b D5,D0 ; Get the sRsrcID of the keeper into D0.
Bsr CSCPruneList ; Call our pruning utility.
Cmp.b #sRsrc_CSC_NeverMatch,D5 ; If weÕve come up with an unknown configuration,
Beq CSCExit ; then weÕre now done.
Move.l configParamsPtr(A6),A1 ; Point to this configÕs parameters.
Adda.w #CSCCnfgHdrSize,A1 ; Skip past the header.
Move.w #CSCVRAMCnfgSize,D0 ; Get the size of the VRAM entries.
Mulu D4,D0 ; Multiply by the right entry.
Adda.w D0,A1 ; Skip to the right VRAM entry.
Move.w familiesOffset(A1),D0 ; If there arenÕt any families,
Beq.s @EndConfig ; then just go on.
Move.l configParamsPtr(A6),A1 ; Point back to this configÕs parameters.
Adda.w D0,A1 ; Point to the table of supported families.
Move.b D5,D0 ; Get the sRsrcID of the keeper into D0.
Bsr CSCBuildFamilyList ; Call our family-building utility.
@EndConfig
Endwith
; Initialize the video hardware.
;
With CSCVidParams,MiniGamma
Clr.w spID(A0) ; Start looking at spID 0, no external devices.
Clr.b spTBMask(A0) ; Only look for the board sRsrc.
Move.w #catBoard,spCategory(A0) ; Look for: catBoard,
Move.w #typBoard,spCType(A0) ; typBoard,
Clr.w spDrvrSW(A0) ; 0,
Clr.w spDrvrHW(A0) ; 0.
Clr.l spParamData(A0) ; (The board sRsrc must be enabled.)
Bset #foneslot,spParamData+3(A0) ; Limit search to this slot 0.
_GetTypeSRsrc ; Get the spsPointer.
Move.b #sVidParmDir,spID(A0) ; Look for the video parameters directory.
_sFindStruct
Move.b D5,spID(A0) ; Look in the directory for this configÕs params.
_sGetBlock
Move.l spResult(A0),A1 ; Get a pointer to the vidParams.
Move.l A1,vidParamsPtr(A6) ; Save for later disposal.
; Set up the CSC and the Palette (if necessary).
;
Move.b cscvpPanelType(A1),CSCPanelType(A3) ; Set up for the attached panel.
Move.b cscvpPanelSetup(A1),CSCPanelSetup(A3) ;
Move.b cscvpDataOutForm(A1),CSCDataOutputForm(A3) ; Set up the framebuffer.
Move.b cscvpGFRCControl(A1),CSCFRCControl(A3) ;
Move.b cscvpGPolyMAdj(A1),CSCPolyMAdj(A3) ;
Move.b cscvpGPolyNAdj(A1),CSCPolyNAdj(A3) ;
Move.b cscvpHSkewHi(A1),CSCHSkewHi(A3) ; Set up the H/V timing.
Move.b cscvpHSkewLo(A1),CSCHSkewLo(A3) ;
Move.b cscvpVSkewHi(A1),CSCVSkewHi(A3) ;
Move.b cscvpVSkewLo(A1),CSCVSkewLo(A3) ;
Move.b cscvpACDClkHi(A1),CSCACDClkHi(A3) ; Set up the clocking.
Move.b cscvpACDClkLo(A1),CSCACDClkLo(A3) ;
Move.b cscvpLPStart(A1),CSCLPStart(A3) ;
Move.b cscvpLPWidth(A1),CSCLPWidth(A3) ;
Move.b cscvpFLMControl(A1),CSCFLMControl(A3) ;
Clr.b CSCDisplayDataForm(A3) ; Set the panel into 1-bpp mode.
Clr.b CSCGTweak(A3) ; Clear the GTweak register.
Cmpi.b #sRsrc_Vid_CSC_G_D_STN_400,D5 ; If weÕre on a fixed panel,
Beq.s @STNTweak ; then just go gray the screen.
Cmpi.b #sRsrc_Vid_CSC_G_D_STN_400y,D5 ;
Beq.s @STNTweak ;
Cmpi.b #sRsrc_Vid_CSC_G_D_STN_480,D5 ;
Beq.s @STNTweak ;
Cmpi.b #sRsrc_Vid_CSC_G_S_TFT_400,D5 ;
Beq.s @TFTTweak ;
Cmpi.b #sRsrc_Vid_CSC_G_S_TFT_400y,D5 ;
Beq.s @TFTTweak ;
Move.b #CSCNoMask,CSCMaskReg(A3) ; Enable all video data in the Palette.
Move.l A3,A2 ; Copy the base address of CSC.
Adda.w #CSCDataReg,A2 ; Point to the Palette data register.
Move.l configParamsPtr(A6),A5 ; Point to the config parameters.
Move.b #$00,CSCAddrRegW-CSCDataReg(A2) ; Setup to write 1bpp white.
Move.b whiteRed(A5),(A2) ; Write: Red,
Move.b whiteGreen(A5),(A2) ; Green,
Move.b whiteBlue(A5),(A2) ; Blue.
Move.b #$80,CSCAddrRegW-CSCDataReg(A2) ; Setup to write 1bpp black.
Move.b blackRed(A5),(A2) ; Write: Red,
Move.b blackGreen(A5),(A2) ; Green,
Move.b blackBlue(A5),(A2) ; Blue.
Bra.s @GrayScreen ;
; Gray the VRAM.
;
@TFTTweak Bset #CSCInvertVRAM,CSCGTweak(A3) ; Invert the VRAM data (for double blacks).
@STNTweak Bset #CSCBetterDither,CSCGTweak(A3) ; Make the dither patterning look better!
@GrayScreen Movea.l A4,A2 ; Copy the ProductInfo pointer.
Adda.l ProductInfo.VideoInfoPtr(A2),A2 ; Point to the VideoInfo record.
Move.l VideoInfo.VRAMLogAddr32(A2),A2 ; Point to the base of VRAM.
Moveq #true32b,D0 ; Set up to flip into 32-bit addressing mode.
_SwapMMUMode ; Do flip.
Move.b D0,-(Sp) ; Save previous addressing mode.
Move.w cscvpNumRows(A1),D3 ; Get the number of rows.
Move.w D3,D0 ; Remember them.
Move.l #OneBitGray,D2 ; Set the 1bpp gray pattern.
@NxtRow Move.w #(OBMLCDRB/4-1),D1 ; Get the number of longwords/row.
@NxtLong Move.l D2,(A2)+ ; Write out gray to the frame bufferÉ
Dbra D1,@NxtLong ; Éfor each scanline.
Not.l D2 ; Invert the pattern for the next row.
Dbra D3,@NxtRow ; Repeat for each row.
Cmpi.w #(defmBounds_BLCD-1)-1,D0 ; If weÕre not doing the 16bpp Ò400-lineÓ panel,
Bne.s @SwapBack ; then just go on.
Moveq #IndexedBlack,D2 ; Set up to write out black to the bottom-most line.
Move.w #(OBMLCDRB/4-1),D1 ; Get the number of longwords/row.
@LastLine Move.l D2,(A2)+ ; Write out black to the last line ofÉ
Dbra D1,@LastLine ; Éto whole last line.
@SwapBack Move.b (Sp)+,D0 ; Set up to flip back to previous addressing mode.
_SwapMMUMode ; Do flip.
Move.b #CSCUnblank,CSCDisplayStatus(A3) ; Unblank the video display.
Bset #CSCPnlPwr,CSCPanelSetup(A3) ; Turn on the power.
_CSCMaxDelay ; Wait 50 ms.
Endwith
; Now that the CSC is set up (i.e., either fully programmed for the attached LCD, or is
; completely shutdown), we need to make sure that the panelÕs backlighting is
; appropriately set up.
;
CSCExit
TestFor MSCChipBit ; If we donÕt have an MSC,
Beq.s @NoMSC ; then just go on.
Movea.l mscBaseAddr(A6),A0 ; Get the MSC base address.
Tst.b disableLCD(A6) ; If weÕll be using the LCD screen,
Beq.s @UseLCD1 ; then just go on.
Bclr #MSCLCDReset,MSCClkCntl(A0) ; Otherwise, turn off CSC clock input.
Bra.s @Dont ; And keep the CSC interrupts off.
@UseLCD1 Move.b #(1<<ifIRQ)|(1<<RvIRQ0En),MSCSlotIER(A0) ; Allow CSC interrupts to occur.
@Dont
@NoMSC Moveq #screenOn-256,D0 ; Assume weÕll be using the LCD.
Tst.b disableLCD(A6) ; If we are, then
Beq.s @UseLCD2 ; just go on.
Moveq #screenOff,D0 ; Otherwise, say that weÕre shutting it down.
@UseLCD2
Move.b D0,-(Sp) ; Put the on/off switch into the buffer.
Move.l Sp,-(Sp) ; pmRBuffer
Move.l (Sp),-(Sp) ; pmSBuffer
Move.w #1,-(Sp) ; pmLength = 1
Move.w #power1Cntl,-(Sp) ; pmCommand
Movea.l Sp,A0 ; Point to the param block.
_PMgrOp ; Turn the LCD screen on/off.
Lea pmCommandRec.pmRBuffer+4+2(Sp),Sp ; Toss the param block.
; Clean up and go home.
;
Move.l vidParamsPtr(A6),D0 ; If the vidParamsPtr is nil,
Beq.s @CSCDone ; then just leave.
Movea.l D0,A0 ; Dispose of the vidParams pointer.
_DisposPtr
@CSCDone
Unlk A6 ; De-allocate local stack frame.
Rts ; Return to caller.
Endwith
;---------------------------------------------------------------------
; Data
;---------------------------------------------------------------------
Align 4
; The CSCSpIDTbl is a list of all the board sRsrcIDs supported in the CSC
; sRsrc directory. It is used to prune all the unnecessary board sRsrcs.
;
; The CSCModeList is used to prune the various functional sRsrcs.
;
CSCSpIDTbl Dc.w EndCSCSpIDTbl-BeginCSCSpIDTbl-1
BeginCSCSpIDTbl
Dc.b sRsrc_BdEscher
Dc.b sRsrc_BdBlackBird
Dc.b sRsrc_BdYeager
Dc.b 0
EndCSCSpIDTbl
Align 4
CSCModeList Dc.w EndCSCML-BeginCSCML-2
BeginCSCML
Dc.b sRsrc_Vid_CSC_C_S_TFT_399,sRsrc_Vid_CSC_C_S_TFT_480 ; Escher
Dc.b sRsrc_Vid_CSC_G_D_STN_400
Dc.b sRsrc_Vid_CSC_G_S_TFT_400
Dc.b sRsrc_Vid_CSC_C_S_TFT_399a,sRsrc_Vid_CSC_C_S_TFT_480a ; Blackbird
Dc.b sRsrc_Vid_CSC_C_S_TFT_399b,sRsrc_Vid_CSC_C_S_TFT_480b
Dc.b sRsrc_Vid_CSC_C_S_TFT_399c,sRsrc_Vid_CSC_C_S_TFT_480c
Dc.b sRsrc_Vid_CSC_C_S_TFT_399d,sRsrc_Vid_CSC_C_S_TFT_480d
Dc.b sRsrc_Vid_CSC_C_D_STN_480
Dc.b sRsrc_Vid_CSC_G_D_STN_480
Dc.b sRsrc_Vid_CSC_G_S_TFT_480
Dc.b sRsrc_Vid_CSC_C_S_TFT_399y,sRsrc_Vid_CSC_C_S_TFT_480y ; Yeager
Dc.b sRsrc_Vid_CSC_G_D_STN_400y
Dc.b sRsrc_Vid_CSC_G_S_TFT_400y
Dc.b 0 ; Pad for word-alignment.
EndCSCML
Align 4
; In order to support family modes, we list all the members of each
; family in a table. These tables are below.
;
C_S_TFT_480_L Dc.w EndC_S_TFT_480-BeginC_S_TFT_480-1
BeginC_S_TFT_480
Dc.b sRsrc_Vid_CSC_C_S_TFT_480,sRsrc_Vid_CSC_C_S_TFT_399
EndC_S_TFT_480
C_S_TFT_480_AL Dc.w EndC_S_TFT_480a-BeginC_S_TFT_480a-1
BeginC_S_TFT_480a
Dc.b sRsrc_Vid_CSC_C_S_TFT_480a,sRsrc_Vid_CSC_C_S_TFT_399a
EndC_S_TFT_480a
C_S_TFT_480_BL Dc.w EndC_S_TFT_480b-BeginC_S_TFT_480b-1
BeginC_S_TFT_480b
Dc.b sRsrc_Vid_CSC_C_S_TFT_480b,sRsrc_Vid_CSC_C_S_TFT_399b
EndC_S_TFT_480b
C_S_TFT_480_CL Dc.w EndC_S_TFT_480c-BeginC_S_TFT_480c-1
BeginC_S_TFT_480c
Dc.b sRsrc_Vid_CSC_C_S_TFT_480c,sRsrc_Vid_CSC_C_S_TFT_399c
EndC_S_TFT_480c
C_S_TFT_480_DL Dc.w EndC_S_TFT_480d-BeginC_S_TFT_480d-1
BeginC_S_TFT_480d
Dc.b sRsrc_Vid_CSC_C_S_TFT_480d,sRsrc_Vid_CSC_C_S_TFT_399d
EndC_S_TFT_480d
Align 4
; The CSCProdTable is an array of configuration parameters indexed by
; bthe board sRsrc ID. This allows us to distinguish between the various
; CSC-based CPUs by product. At the moment, there are only Eschers
; and Blackbirds, and both of their tables are the same for now.
;
CSCProdTable
; Mem,Refresh,VRAM,<pad>
; -----------------
Dc.b $02,$02,$00,0 ; Escher Configuration.
Dc.b $02,$02,$05,0 ; Blackbird.
Dc.b $02,$02,$02,0 ; Yeager.
Align 4
; The CSCConfigTable is an array of configuration parameters indexed
; by panel ID. Within each set of panel parameters is a set of parameters
; that are indexed by the amount of VRAM available. These parameters
; are used in setting up the intial values of the Palette and selecting
; the right functional sRsrc per panel per VRAM configuration.
;
With CSCCnfgRec
CSCConfigTable
C_S_TFT_480_Tbl Dc.b $00,$FF,$00,$FF,$00,$FF,0,0 ; Mini-gamma table. [Color, TFT, Single-Drive, 640x480, Sharp]
Dc.b sRsrc_Vid_CSC_C_S_TFT_480,FourthVidMode ; 512K VRAM prefs.
Dc.b boxPowerBookDuo270c,0 ; BoxFlag.
Dc.w C_S_TFT_480_L-C_S_TFT_480_Tbl ; Offset to family modes.
Dcb.b CSCCnfgRecSize,sRsrc_CSC_NeverMatch ; ID=1 [Unused]
Dcb.b CSCCnfgRecSize,sRsrc_CSC_NeverMatch ; ID=2 [Unused]
Dcb.b CSCCnfgRecSize,sRsrc_CSC_NeverMatch ; ID=3 [Unused]
G_S_TFT_400_Tbl Dc.b $00,$FF,$00,$00,$00,$00,0,0 ; Mini-gamma table. [Gray, TFT, Single-Drive, 640x400, Hosiden]
Dc.b sRsrc_Vid_CSC_G_S_TFT_400,ThirdVidMode ; 512K VRAM prefs.
Dc.b boxPowerBookDuo270c,0 ; BoxFlag.
Dc.w 0 ; No family modes.
Dcb.b CSCCnfgRecSize,sRsrc_CSC_NeverMatch ; ID=5 [Unused]
G_D_STN_400_Tbl Dc.b $00,$FF,$00,$00,$00,$00,0,0 ; Mini-gamma table. [Gray, STN, Dual-Drive, 640x400, Sharp]
Dc.b sRsrc_Vid_CSC_G_D_STN_400,SecondVidMode ; 512K VRAM prefs.
Dc.b boxPowerBookDuo270c,0 ; BoxFlag.
Dc.w 0 ; No family modes.
Dcb.b CSCCnfgRecSize,sRsrc_CSC_NeverMatch ; ID=7, No-Connect. [No Panel Connected]
;---------------------------------------------------------------------
C_S_TFT_480_A Dc.b $00,$FF,$00,$FF,$00,$FF,0,0 ; Mini-gamma table. [Color, TFT, Single-Drive, 640x480, Sharp]
Dc.b sRsrc_Vid_CSC_C_S_TFT_480a,FourthVidMode ; 512K VRAM prefs.
Dc.b boxBlackbird,0 ; BoxFlag.
Dc.w C_S_TFT_480_AL-C_S_TFT_480_A ; Offset to family modes.
C_D_STN_480 Dc.b $00,$FF,$00,$FF,$00,$FF,0,0 ; Mini-gamma table. [Color, STN, Dual-Drive, 640x480, Sharp]
Dc.b sRsrc_Vid_CSC_C_D_STN_480,FourthVidMode ; 512K VRAM prefs.
Dc.b boxBlackbird,0 ; BoxFlag.
Dc.w 0 ; No family modes.
C_S_TFT_480_B Dc.b $00,$FF,$00,$FF,$00,$FF,0,0 ; Mini-gamma table. [Color, TFT, Single-Drive, 640x480, NEC]
Dc.b sRsrc_Vid_CSC_C_S_TFT_480b,FourthVidMode ; 512K VRAM prefs.
Dc.b boxBlackbird,0 ; BoxFlag.
Dc.w C_S_TFT_480_BL-C_S_TFT_480_B ; Offset to family modes.
C_S_TFT_480_C Dc.b $00,$FF,$00,$FF,$00,$FF,0,0 ; Mini-gamma table. [Color, TFT, Single-Drive, 640x480, Hosiden]
Dc.b sRsrc_Vid_CSC_C_S_TFT_480c,FourthVidMode ; 512K VRAM prefs.
Dc.b boxBlackbird,0 ; BoxFlag.
Dc.w C_S_TFT_480_CL-C_S_TFT_480_C ; Offset to family modes.
C_S_TFT_480_D Dc.b $00,$FF,$00,$FF,$00,$FF,0,0 ; Mini-gamma table. [Color, TFT, Single-Drive, 640x480, Toshiba]
Dc.b sRsrc_Vid_CSC_C_S_TFT_480d,FourthVidMode ; 512K VRAM prefs.
Dc.b boxBlackbird,0 ; BoxFlag.
Dc.w C_S_TFT_480_DL-C_S_TFT_480_D ; Offset to family modes.
G_D_STN_480_Tbl Dc.b $00,$FF,$00,$00,$00,$00,0,0 ; Mini-gamma table. [Gray, STN, Dual-Drive, 640x480, Sharp]
Dc.b sRsrc_Vid_CSC_G_D_STN_480,SecondVidMode ; 512K VRAM prefs.
Dc.b boxBlackbird,0 ; BoxFlag.
Dc.w 0 ; No family modes.
G_S_TFT_480_Tbl Dc.b $00,$FF,$00,$00,$00,$00,0,0 ; Mini-gamma table. [Gray, TFT, Single-Drive, 640x480, Hosiden]
Dc.b sRsrc_Vid_CSC_G_S_TFT_480,FourthVidMode ; 512K VRAM prefs.
Dc.b boxBlackbird,0 ; BoxFlag.
Dc.w 0 ; No family modes.
Dcb.b CSCCnfgRecSize,sRsrc_CSC_NeverMatch ; ID=7, No-Connect. [No Panel Connected]
;---------------------------------------------------------------------
C_S_TFT_480_Y Dc.b $00,$FF,$00,$FF,$00,$FF,0,0 ; Mini-gamma table. [Color, TFT, Single-Drive, 640x480, Sharp]
Dc.b sRsrc_Vid_CSC_C_S_TFT_480,FourthVidMode ; 512K VRAM prefs.
Dc.b boxYeagerC,0 ; BoxFlag.
Dc.w C_S_TFT_480_L-C_S_TFT_480_Y ; Offset to family modes.
Dcb.b CSCCnfgRecSize,sRsrc_CSC_NeverMatch ; ID=1 [Unused]
Dcb.b CSCCnfgRecSize,sRsrc_CSC_NeverMatch ; ID=2 [Unused]
Dcb.b CSCCnfgRecSize,sRsrc_CSC_NeverMatch ; ID=3 [Unused]
G_S_TFT_400_Y Dc.b $00,$FF,$00,$00,$00,$00,0,0 ; Mini-gamma table. [Gray, TFT, Single-Drive, 640x400, Hosiden-Yeager]
Dc.b sRsrc_Vid_CSC_G_S_TFT_400y,ThirdVidMode ; 512K VRAM prefs.
Dc.b boxYeagerG,0 ; BoxFlag.
Dc.w 0 ; No family modes.
Dcb.b CSCCnfgRecSize,sRsrc_CSC_NeverMatch ; ID=5 [Unused]
G_D_STN_400_Y Dc.b $00,$FF,$00,$00,$00,$00,0,0 ; Mini-gamma table. [Gray, STN, Dual-Drive, 640x400, Sharp-Yeager]
Dc.b sRsrc_Vid_CSC_G_D_STN_400y,SecondVidMode ; 512K VRAM prefs.
Dc.b boxYeagerFSTN,0 ; BoxFlag. <H45>
Dc.w 0 ; No family modes.
Dcb.b CSCCnfgRecSize,sRsrc_CSC_NeverMatch ; ID=7, No-Connect. [No Panel Connected]
Endwith
End

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,450 @@
/*
File: Gamma.r
Contains: Resource declarations for Balloon Help Resource types
Copyright: © 1989-1992, 1994 by Apple Computer, Inc., all rights reserved.
Change History (most recent first):
<SM2> 1/4/94 PN Add CSC_TFT_Gamma.
<1> 10/6/92 GDW New location for ROMLink tool.
*/
//=====================================================================
// Includes
//=====================================================================
#include "ROMLink.r"
#include "Types.r"
//=====================================================================
// Gamma Directory
//=====================================================================
#define ColorGammaID (2000)
#define HiResGammaID (2001)
#define GrayGammaID (2002)
#define RubikGammaID (2003)
#define NTSCGammaID (2004)
#define CSCTFTGammaID (2010)
resource 'node' (2595, "_GammaDir_19") {{
include{l{"_GammaDir_GF"}};
}};
resource 'node' (2600, "_GammaDir_GF") {{
include{l{"_GammaDir_RGBFP"}};
}};
resource 'node' (2605, "_GammaDir_RGBFP") {{
include{l{"_GammaDir_RGB2P"}};
}};
resource 'node' (2610, "_GammaDir_RGB2P") {{
include{l{"_GammaDir_DAFB_RGB2P"}};
}};
resource 'node' (2615, "_GammaDir_DAFB_RGB2P") {{
include{l{"_GammaDir_DAFB_RGBFP"}};
}};
resource 'node' (2620, "_GammaDir_DAFB_RGBFP") {{
include{l{"_GammaDir_DAFB_LP"}};
}};
resource 'node' (2625, "_GammaDir_DAFB_LP") {{
include{l{"_GammaDir_DAFB_19"}};
}};
resource 'list' (2630, "_GammaDir_DAFB_19") {{
128, l{"HiResGamma"};
129, l{"ColorGamma"};
}};
resource 'node' (2635, "_GammaDir_HR") {{
include{l{"_GammaDir_VGA"}};
}};
resource 'node' (2640, "_GammaDir_VGA") {{
include{l{"_GammaDirRbvHR"}};
}};
resource 'node' (2645, "_GammaDirRbvHR") {{
include{l{"_GammaDirElsHR"}};
}};
resource 'node' (2650, "_GammaDirElsHR") {{
include{l{"_GammaDir_DAFB_HR"}};
}};
resource 'node' (2655, "_GammaDir_DAFB_HR") {{
include{l{"_GammaDir_DAFB_VGA"}};
}};
resource 'gdir' (2660, "_GammaDir_DAFB_VGA") {{
128, l{"HiResGamma"};
}};
resource 'node' (2665, "_GammaDir_FP") {{
include{l{"_GammaDir_2P"}};
}};
resource 'node' (2670, "_GammaDir_2P") {{
include{l{"_GammaDir_DAFB_FP"}};
}};
resource 'node' (2675, "_GammaDir_DAFB_FP") {{
include{l{"_GammaDir_DAFB_2P"}};
}};
resource 'gdir' (2680, "_GammaDir_DAFB_2P") {{
128, l{"GrayGamma"};
}};
resource 'node' (2685, "_GammaDir_GS") {{
include{l{"_GammaDirRbvGS"}};
}};
resource 'node' (2690, "_GammaDirRbvGS") {{
include{l{"_GammaDirElsGS"}};
}};
resource 'node' (2695, "_GammaDirElsGS") {{
include{l{"_GammaDirRbvSE"}};
}};
resource 'node' (2700, "_GammaDirRbvSE") {{
include{l{"_GammaDir_DAFB_GS"}};
}};
resource 'gdir' (2705, "_GammaDir_DAFB_GS") {{
128, l{"RubikGamma"};
}};
resource 'gdir' (2710, "_GammaDir_NTSC") {{
128, l{"HiResGamma"};
129, l{"NTSCGamma"};
}};
resource 'gdir' (2715, "_GammaDir_CSC_TFT") {{
128, l{"CSC_TFT_Gamma"};
}};
//=====================================================================
// ColorGamma
//=====================================================================
resource 'node' (2715, "ColorGamma") {{
blocksize{};
word {ColorGammaID}; // gamma res ID
cstring {"Page-White Gamma"};
align{2};
word {$0000}; // gVersion
word {$0000}; // gType
word {$0000}; // gFormulaSize
word {$0003}; // gChanCnt
word {$0100}; // gDataCnt
word {$0008}; // gChanWidth
longs{{
$00030609;$0C101012;$13151616;$181B1C1E; // red channel
$1F222326;$282B2C2F;$3234373A;$3C3F4041;
$42434445;$46474749;$4A4B4C4D;$4E4F5051;
$52535454;$56565758;$595A5B5C;$5D5E5F60;
$61626364;$65666768;$696A6B6C;$6D6E6F70;
$71727273;$74757677;$78797A7A;$7B7C7D7E;
$7F818283;$83848586;$8788898A;$8A8B8C8D;
$8E8F9091;$92939394;$95969798;$98999A9B;
$9C9D9E9F;$A0A1A1A2;$A3A4A4A5;$A6A7A8A8;
$A9AAABAC;$ADADAEAF;$B0B1B2B2;$B3B4B5B5;
$B6B7B8B8;$B9BABBBC;$BCBDBEBF;$C0C0C1C2;
$C3C3C4C5;$C6C6C7C8;$C9C9CACB;$CCCDCDCE;
$CFD0D1D1;$D2D3D4D4;$D5D6D7D7;$D8D9DADA;
$DBDCDDDE;$DEDFE0E1;$E1E2E3E4;$E4E5E6E7;
$E7E8E9EA;$EAEBECED;$EEEEEFF0;$F1F1F2F3;
$F4F4F5F6;$F7F8F8F9;$FAFBFBFC;$FDFEFFFF;
}};
longs{{
$00030609;$0C101018;$20202223;$24252728; // green channel
$292C2D2E;$30323437;$383A3D3F;$40414242;
$43444445;$46474849;$4A4A4B4C;$4D4E4F50;
$51525354;$55565758;$595B5C5D;$5E5F6061;
$62636465;$65666768;$696A6B6C;$6D6E6F70;
$71717273;$74747576;$77787979;$7A7B7C7D;
$7E7F8081;$82838484;$85868788;$88898A8B;
$8C8D8E8E;$8F909192;$93939495;$96969798;
$999A9A9B;$9C9D9E9E;$9FA0A1A2;$A2A3A4A5;
$A5A6A7A8;$A8A9AAAB;$ABACADAE;$AFAFB0B1;
$B2B2B3B4;$B5B5B6B7;$B7B8B9BA;$BABBBCBD;
$BDBEBFC0;$C1C1C2C3;$C3C4C5C6;$C6C7C8C9;
$C9CACBCC;$CCCDCECF;$CFD0D1D2;$D2D3D4D4;
$D5D6D6D7;$D8D9D9DA;$DBDCDCDD;$DEDEDFE0;
$E1E1E2E3;$E4E4E5E6;$E6E7E8E9;$E9EAEBEC;
$ECEDEEEF;$EFF0F1F2;$F2F3F4F4;$F5F6F7F7;
}};
longs{{
$00020508;$0A0D1010;$10202022;$23232425; // blue channel
$25272829;$2A2C2D2E;$2F303233;$34363738;
$3A3C3D3F;$40414142;$42434444;$45454647;
$4748494A;$4A4B4C4D;$4D4E4F4F;$51515253;
$54555656;$5758595A;$5B5C5D5E;$5F606061;
$62626364;$64656666;$67686969;$6A6B6C6C;
$6D6E6F6F;$70717272;$73747475;$76777778;
$79797A7B;$7C7C7D7E;$7F808182;$82838484;
$85868687;$8888898A;$8A8B8C8D;$8D8E8F90;
$90919192;$93939495;$95969797;$9899999A;
$9B9B9C9D;$9D9E9FA0;$A0A1A1A2;$A3A3A4A4;
$A5A6A6A7;$A7A8A9A9;$AAABABAC;$ADADAEAF;
$AFB0B0B1;$B2B2B3B3;$B4B5B5B6;$B6B7B8B8;
$B9BABABB;$BBBCBDBD;$BEBFBFC0;$C0C1C2C2;
$C3C3C4C5;$C5C6C6C7;$C8C8C9C9;$CACBCBCC;
$CCCDCECE;$CFD0D0D1;$D1D2D3D3;$D4D4D5D6;
}};
}};
//=====================================================================
// HiResGamma
//=====================================================================
resource 'node' (2720, "HiResGamma") {{
blocksize{};
word {HiResGammaID}; // gamma res ID
cstring {"Mac Std Gamma"};
align{2};
word {$0000}; // gVersion
word {$0000}; // gType
word {$0000}; // gFormulaSize
word {$0001}; // gChanCnt
word {$0100}; // gDataCnt
word {$0008}; // gChanWidth
longs{{
$0005090B;$0E101315;$17191B1D;$1E202224;
$2527282A;$2C2D2F30;$31333436;$37383A3B;
$3C3E3F40;$42434445;$4748494A;$4B4D4E4F;
$50515254;$55565758;$595A5B5C;$5E5F6061;
$62636465;$66676869;$6A6B6C6D;$6E6F7071;
$72737475;$76777879;$7A7B7C7D;$7E7F8081;
$81828384;$85868788;$898A8B8C;$8C8D8E8F;
$90919293;$94959596;$9798999A;$9B9B9C9D;
$9E9FA0A1;$A1A2A3A4;$A5A6A6A7;$A8A9AAAB;
$ABACADAE;$AFB0B0B1;$B2B3B4B4;$B5B6B7B8;
$B8B9BABB;$BCBCBDBE;$BFC0C0C1;$C2C3C3C4;
$C5C6C7C7;$C8C9CACA;$CBCCCDCD;$CECFD0D0;
$D1D2D3D3;$D4D5D6D6;$D7D8D9D9;$DADBDCDC;
$DDDEDFDF;$E0E1E1E2;$E3E4E4E5;$E6E7E7E8;
$E9E9EAEB;$ECECEDEE;$EEEFF0F1;$F1F2F3F3;
$F4F5F5F6;$F7F8F8F9;$FAFAFBFC;$FCFDFEFF;
}};
}};
//=====================================================================
// GrayGamma
//=====================================================================
resource 'node' (2725, "GrayGamma") {{
blocksize{};
word {GrayGammaID}; // gamma res ID
cstring {"Mac Gray Gamma"};
align{2};
word {$0000}; // gVersion
word {$0000}; // gType
word {$0000}; // gFormulaSize
word {$0001}; // gChanCnt
word {$0100}; // gDataCnt
word {$0008}; // gChanWidth
longs{{
$000A141D;$23262B2E;$30323437;$393B3C3E;
$40414244;$4547484A;$4B4D4E4F;$50515254;
$55565758;$5A5B5C5D;$5E5F6061;$63646566;
$6768696A;$6B6C6D6E;$6F707171;$72737475;
$76777879;$7A7B7C7D;$7E7F8080;$81828384;
$84858687;$88898A8A;$8B8C8D8E;$8F909091;
$92929394;$95969797;$98999A9A;$9B9C9D9E;
$9E9FA0A1;$A1A2A3A3;$A4A5A6A7;$A7A8A9AA;
$AAABACAD;$ADAEAFAF;$B0B1B2B2;$B3B4B4B5;
$B6B6B7B7;$B8B9B9BA;$BBBCBCBD;$BEBEBFC0;
$C0C1C2C2;$C3C4C5C5;$C6C6C7C8;$C8C9CACB;
$CCCDCDCE;$CFCFD0D0;$D1D2D2D3;$D3D4D5D6;
$D6D7D7D8;$D9D9DADA;$DBDCDDDD;$DEDFDFE0;
$E0E1E2E3;$E3E4E5E5;$E6E6E7E7;$E8E8E9EA;
$EAEBEBEC;$EDEDEEEF;$F0F0F1F2;$F2F3F4F4;
$F5F5F6F7;$F7F8F9FA;$FAFBFCFC;$FDFEFEFF;
}};
}};
//=====================================================================
// RubikGamma
//=====================================================================
resource 'node' (2730, "RubikGamma") {{
blocksize{};
word {RubikGammaID}; // gamma res ID
cstring {"Mac RGB Gamma"};
align{2};
word {$0000}; // gVersion
word {$0000}; // gType
word {$0000}; // gFormulaSize
word {$0001}; // gChanCnt
word {$0100}; // gDataCnt
word {$0008}; // gChanWidth
longs{{
$05070809;$0B0C0D0F;$10111214;$15161819;
$1A1C1D1E;$20212223;$24262829;$2A2C2D2F;
$30313334;$36373839;$3A3C3D3E;$40414243;
$44454648;$494B4C4D;$4E4F5051;$52535455;
$5758595A;$5B5C5D5E;$5F606163;$63656567;
$67696A6B;$6C6D6E6F;$70717273;$74757677;
$78797A7A;$7B7C7D7E;$7F818283;$83848586;
$8788898A;$8B8C8D8E;$8E909091;$92939394;
$95969798;$999A9B9C;$9D9E9FA0;$A0A1A2A3;
$A4A4A5A6;$A7A8A9AA;$AAACADAD;$AEAEB0B1;
$B2B3B3B4;$B5B6B7B8;$B9B9BABB;$BCBDBEBF;
$BFC0C1C2;$C2C3C4C5;$C6C7C8C9;$CACBCCCD;
$CDCECECF;$D0D1D2D3;$D3D4D5D6;$D6D7D8D8;
$D9DADBDC;$DDDEDEDF;$E0E1E1E2;$E3E4E4E5;
$E6E7E7E8;$E9EAEBEC;$EDEEEEEF;$EFF0F1F2;
$F3F3F4F5;$F6F7F8F8;$F9F9FAFB;$FCFDFEFF;
}};
}};
//=====================================================================
// CSC_TFTGamma
//=====================================================================
resource 'node' (2733, "CSC_TFT_Gamma") {{
blocksize{};
word {CSCTFTGammaID}; // gamma res ID
cstring {"Active Color LCD Gamma"};
align{2};
word {$0000}; // gVersion
word {$0000}; // gType
word {$0000}; // gFormulaSize
word {$0001}; // gChanCnt
word {$0100}; // gDataCnt
word {$0008}; // gChanWidth
longs{{
$0005090B;$0E101315;$17191B1D;$1E202224;
$2528282A;$2C2D2F30;$31333436;$37383A3B;
$3C3E3F42;$4448494A;$4B4D4E4F;$50515254;
$55565758;$59595A5A;$5B5C5E5F;$60616263;
$64656667;$68696A6B;$6C6D6D6E;$6F707172;
$73747576;$77787A7C;$7E808284;$8687888A;
$8C8E9092;$94969899;$9A9B9B9C;$9D9E9FA0;
$A1A2A3A4;$A5A6A7A8;$A9A9AAAA;$ABABABAC;
$ACADADAE;$AEAFAFB0;$B0B0B1B1;$B2B2B3B3;
$B4B4B4B5;$B5B6B6B7;$B7B8B9BA;$BBBCBCBD;
$BEBFC0C1;$C2C3C4C5;$C6C7C8C8;$C9C9CACA;
$CACBCBCC;$CDCDCDCE;$CECFCFD0;$D0D1D2D3;
$D3D4D4D5;$D5D6D6D7;$D7D8D9D9;$DADBDCDC;
$DDDEDFDF;$E0E1E1E2;$E3E4E4E5;$E6E7E7E8;
$E9E9EAEA;$EBEBECEC;$EDEDEEEE;$EEEFEFF0;
$F1F2F3F4;$F5F6F7F8;$F9FAFBFC;$FCFDFEFF;
}};
}};
//=====================================================================
// NTSCGamma
//=====================================================================
resource 'node' (2735, "NTSCGamma") {{
blocksize{};
word {NTSCGammaID}; // gamma res ID
cstring {"NTSC/PAL Gamma"};
align{2};
word {$0000}; // gVersion
word {$0000}; // gType
word {$0000}; // gFormulaSize
word {$0003}; // gChanCnt
word {$0100}; // gDataCnt
word {$0008}; // gChanWidth
longs{{
$00000000;$00000000;$00000000;$00000001; // red channel
$01010101;$01010101;$01020202;$02020202;
$03030303;$03040404;$04050505;$05060606;
$06070707;$08080809;$09090A0A;$0B0B0B0C;
$0C0D0D0D;$0E0E0F0F;$10101111;$12121313;
$14141516;$16171718;$19191A1A;$1B1C1C1D;
$1E1E1F20;$21212223;$23242526;$27272829;
$2A2B2B2C;$2D2E2F30;$31313233;$34353637;
$38393A3B;$3C3D3E3F;$40414243;$44454647;
$494A4B4C;$4D4E4F51;$52535455;$5758595A;
$5B5D5E5F;$61626364;$6667696A;$6B6D6E6F;
$71727475;$7778797B;$7C7E7F81;$82848587;
$898A8C8D;$8F919294;$9597999A;$9C9E9FA1;
$A3A5A6A8;$AAACADAF;$B1B3B5B6;$B8BABCBE;
$C0C2C4C5;$C7C9CBCD;$CFD1D3D5;$D7D9DBDD;
$DFE1E3E5;$E7EAECEE;$F0F2F4F6;$F8FBFDFF;
}};
longs{{
$00000000;$00000000;$00000000;$00000001; // blue channel
$01010101;$01010101;$01020202;$02020202;
$03030303;$03040404;$04050505;$05060606;
$06070707;$08080809;$09090A0A;$0B0B0B0C;
$0C0D0D0D;$0E0E0F0F;$10101111;$12121313;
$14141516;$16171718;$19191A1A;$1B1C1C1D;
$1E1E1F20;$21212223;$23242526;$27272829;
$2A2B2B2C;$2D2E2F30;$31313233;$34353637;
$38393A3B;$3C3D3E3F;$40414243;$44454647;
$494A4B4C;$4D4E4F51;$52535455;$5758595A;
$5B5D5E5F;$61626364;$6667696A;$6B6D6E6F;
$71727475;$7778797B;$7C7E7F81;$82848587;
$898A8C8D;$8F919294;$9597999A;$9C9E9FA1;
$A3A5A6A8;$AAACADAF;$B1B3B5B6;$B8BABCBE;
$C0C2C4C5;$C7C9CBCD;$CFD1D3D5;$D7D9DBDD;
$DFE1E3E5;$E7EAECEE;$F0F2F4F6;$F8FBFDFF;
}};
longs{{
$00000000;$00000000;$00000000;$00000001; // green channel
$01010101;$01010101;$01020202;$02020202;
$03030303;$03040404;$04050505;$05060606;
$06070707;$08080809;$09090A0A;$0B0B0B0C;
$0C0D0D0D;$0E0E0F0F;$10101111;$12121313;
$14141516;$16171718;$19191A1A;$1B1C1C1D;
$1E1E1F20;$21212223;$23242526;$27272829;
$2A2B2B2C;$2D2E2F30;$31313233;$34353637;
$38393A3B;$3C3D3E3F;$40414243;$44454647;
$494A4B4C;$4D4E4F51;$52535455;$5758595A;
$5B5D5E5F;$61626364;$6667696A;$6B6D6E6F;
$71727475;$7778797B;$7C7E7F81;$82848587;
$898A8C8D;$8F919294;$9597999A;$9C9E9FA1;
$A3A5A6A8;$AAACADAF;$B1B3B5B6;$B8BABCBE;
$C0C2C4C5;$C7C9CBCD;$CFD1D3D5;$D7D9DBDD;
$DFE1E3E5;$E7EAECEE;$F0F2F4F6;$F8FBFDFF;
}};
}};

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,897 @@
;
; File: TimDriver.a
;
; Contains: This file contains the video driver for use by the Macintosh
; OS for the Jaws (TIM) hardware.
;
; Written by: David A. Fung/Mike Puckett
;
; Copyright: © 1990-91 by Apple Computer, Inc. All rights reserved.
;
; Change History (most recent first):
;
; <SM3> 11/5/92 SWC Changed VideoEqu.a->Video.a and ShutdownEqu.a->Shutdown.a.
; <SM2> 11/2/92 kc Don't include SonicEqu.a.
; <1> 10/6/92 GDW New location for ROMLink tool.
; <SM4> 09-03-92 jmp (jmp,H2) Corrected .s vs. non-.s branches and odd-alignment
; problems.
; <1> 3/30/92 JSM first checked in
; <10> 6/10/91 djw Add NeedsGoodBye Kiss csCode to Control, to close driver
; <9> 6/5/91 jmp In VidOpen, I now try to re-open the Backlight driver, because
; it might have been closed. In VidClose, I now close the
; Backlight driver and gray the screen; this is to support a new &
; improved method of restarting and shutting donw the system
; (i.e., to prevent desktop persistence on restart).
; <8> 5/22/91 jmp Code Review changes: For consistency, did a StripAddress on
; VidOpenÕs copy of the privates; eliminated the redundant clears
; and checks for the the driver copy of the fixed-entry clut; and
; replaced #0Õs with #noErrÕs where appropriate.
; <7> 5/15/91 jmp SetInterrupt wasnÕt checking the input value (supposed to be
; either 0 or 1), but instead was just looking at D0; so, it would
; either enable (0) or disable (1), depending on whether D0.w was
; non-zero or not. GetInterrupt returned -1.w (instead of 1.b)
; for the disabled state, so some test tools were getting
; confused; so, I now just return 1.b when interrupts are
; disabled.
; <6> 5/10/91 jmp Made the GrayScreen code more universal (for things like
; DB-Lite) by swapping into 32-bit mode prior to accessing the
; framebuffer.
; <5> 5/10/91 jmp Fixed a bug in GetEntries where A0 was not loaded properly.
; Made GetEntries 32-bit clean. GetEntries was trashing A1, so
; async calls were failing (i.e., jumping thru IODone requires A1
; to be pointing to the AuxDCE). Indexed GetEntries didnÕt work
; at because I was checking for index vs. sequential off A3
; instead of A2! Made the Control & Status dispatchers 32-bit
; clean. SaveMode was never being set up! From the code review:
; Changed the TimeMgr task to micro-second base and fixed
; frequency at approximately 60.15Hz; eliminated SetEntries &
; SetDefaultMode and fixed GetDefaultMode.
; <4> 4/17/91 jmp Updated various comments, and cleaned up the fixed-device
; support.
; <3> 4/15/91 djw Fix trashed register bug in interrupt handler, Enabled fixed
; depth code in Open.
; <2> 2/15/91 jmp Started looking into making TIM a fixed device, but need to get
; working properly -- commented out for now. Also, need to look
; at VidClose for last VBL problem.
; <1> 12/8/90 HJR First time for Terror.
; <3> 9/13/90 MSH Waimea is gone, long live TIM
; <2> 4/19/90 DAF Correct header (I almost got it right...)
; <1> 4/19/90 DAF Added WaimeaDriver.a for the first time
;
;-------------------------------------------------------------------
; Mod History :
;
; 17Apr90 DAF New today (spawned from ElsieDriver.a)
;
;-------------------------------------------------------------------
STRING C
PRINT OFF
LOAD 'StandardEqu.d'
INCLUDE 'DockingEqu.a'
INCLUDE 'EgretEqu.a'
INCLUDE 'GestaltEqu.a'
INCLUDE 'GestaltPrivateEqu.a'
INCLUDE 'HardwarePrivateEqu.a'
INCLUDE 'IOPrimitiveEqu.a'
INCLUDE 'PowerPrivEqu.a'
INCLUDE 'ROMEqu.a'
INCLUDE 'Video.a'
INCLUDE 'SlotMgrEqu.a'
INCLUDE 'ShutDown.a'
; INCLUDE 'SonicEqu.a'
INCLUDE 'UniversalEqu.a'
INCLUDE 'DepVideoEqu.a'
PRINT ON
SEG '_sTimDriver'
BLANKS ON
STRING ASIS
MACHINE MC68020
kTIMVBLTime EQU -16626 ; 60.14742 Hz using the microsecond timer.
; This is device storage which is stored in the dCtlStorage field of the AuxDCE.
TIMVidPrivates RECORD 0
saveBaseAddr DS.L 1 ; the screen base address
saveFixedCLUT DS.L 1 ; pointer to fixed-entry CLUT
saveNumFixedEntries DS.W 1 ; number of entries in fixed CLUT (zero based)
saveMode DS.W 1 ; the current mode setting
GFlags DS.W 1 ; flags word
TTask DS.B tmXQSize ; extended time manager task block
IntDisableFlag DS.W 1 ; this word is non-zero when the VBL interrupt
; simulator is disabled
TIMVidPrivSize EQU *
ENDR
LTimDriver MAIN EXPORT
;-------------------------------------------------------------------
; Video Driver Header
;-------------------------------------------------------------------
;
TIMDrvr DC.W $5C00 ; ctl,status,needsLock,needsGoodBye
DC.W 0,0,0 ; not an ornament
; Entry point offset table
DC.W TIMVidOpen-TIMDrvr ; open routine
DC.W TIMDrvr-TIMDrvr ; no prime
DC.W TIMVidCtl-TIMDrvr ; control
DC.W TIMVidStatus-TIMDrvr ; status
DC.W TIMVidClose-TIMDrvr ; close
STRING Pascal
TIMVidTitle DC.B '.Display_Video_Apple_TIM'
STRING ASIS
ALIGN 2 ; make sure we're word aligned
DC.W CurTimDrvrVersion ; version
;
; According to CARDS & DRIVERS, video drivers are supposed to shut off
; video at close time Òto avoid the persistence of the desktop
; during reboots.Ó Since we canÕt really turn TIMÕs video off,
; we must simulate it by turning off the backlighting and writing
; white (because itÕs an LCD screen) to the frame buffer. Also,
; because the video driver might be closed and then re-opened
; prior to a reboot (AUX?), we must always re-open the backlight
; driver in the video driverÕs open routine. And, for this reason,
; when we close the backlight driver, we do NOT remove itÕs DCE,
; and do we donÕt dispose of the driver. NOTE: On the first
; time thru (i.e., after startup or restart), the Backlight driver
; will not have been installed yet, so our attempting to open it
; in our open routine will fail, which is okay. This may change
; in the future.
;
String Pascal
TIMBackLite Dc.b '.Backlight' ; Name of Backlight Driver for TIM.
String Asis
Align 2
**********************************************************************
*
* TIMVidOpen allocates private storage for the device in the AuxDCE and locks
* it down for perpetuity. Also, install the simulated interrupt handler and
* start it going.
*
* Entry: A0 = param block pointer
* A1 = AuxDCE pointer
*
* Locals: A3 = pointer to private storage
*
**********************************************************************
WITH VDPageInfo,TIMVidPrivates,spBlock
TIMVidOpen
;
; Allocate private storage (since block is CLEAR, GFlags are zeroed) and get
; a pointer to it in A3.
;
MOVEQ #TIMVidPrivSize,D0 ; get size of parameters
_ResrvMem ,SYS ; make room as low as possible
MOVEQ #TIMVidPrivSize,D0 ; get size of parameters
_NewHandle ,SYS,CLEAR ; get some memory for private storage
BNE @OpError1 ; => return an error in open
MOVE.L A0,dCtlStorage(A1) ; save returned handle in AuxDCE
_HLock ; and lock it down forever (this includes a Time Mgr QElem)
MOVE.L (A0),A3 ; get a pointer to it
MOVE.L (A0),D0 ; Get a 32-bit clean pointer
_StripAddress ; to our privates into A3.
Move.l D0,A3
MOVE.L dCtlDevBase(A1),saveBaseAddr(A3) ; save the screen base address
;
; TIM doesn't have a normal slot interrupt handler since the LCD doesn't really interrupt! We simulate
; the interrupt with a timer task that goes off at 60.14742 Hz.
LEA TIMBeginIH,A0 ; get a pointer to the interrupt simulation timer task code
MOVE.L A0,tmAddr+TTask(A3) ; put it in the time task
LEA TTask(A3),A0 ; get a pointer to the timer queue element
Move.l #'eada',(A0) ; Put in the magic signature to prevent VM from deferring us.
_InsXTime ; Install the task (fixed frequency).
; Note that IntDisableFlag is clear from the NewHandle above which ÒenablesÓ the interrupt.
BSR TIMEnableVGuts ; turn on and prime the interrupt simulator
; For doing GetEntries, we need to get our fixed-entry CLUT from the Slot Manager.
;
With spBlock
Suba #spBlockSize,Sp ; Make an SpBlock on the stack and
Move.l Sp,A0 ; get a pointer to it in A0.
Move.b dCtlSlot(A1),spSlot(A0) ; Get the slotnumber.
Move.b dCtlSlotID(A1),spID(A0) ; Get the spID of video sRsrc.
Clr.b spExtDev(A0) ;
_sRsrcInfo ; Try to get the spsPointer.
Bne.s @OpError2 ; WeÕre dead if this fails.
Move.b #firstVidMode,spID(A0) ; Look for our mode entry.
_sFindStruct ; If we donÕt find it, then
Bne.s @OpError2 ; weÕre dead.
Move.b #mTable,spID(A0) ; Get our fixed-entry CLUT.
_sGetBlock ; If we donÕt get it, then
Bne.s @OpError2 ; weÕre dead.
Move.l spResult(A0),A0 ; Get ptr to fixed-entry CLUT
Move.w ctSize(A0),saveNumFixedEntries(A3) ; Save the number of entries.
Lea ctTable(A0),A0 ; Get ptr to table, and
Move.l A0,saveFixedCLUT(A3) ; save it.
Adda #spBlockSize,Sp ; restore stack
EndWith
; ThereÕs only one vidMode, so save it now because SetMode doesnÕt need to.
;
Move.w #firstVidMode,saveMode(A3)
; Attempt to re-open the Backlight driver because it might have been closed
; if someone (AUX?) closed us and then tried to reopen us prior to
; rebooting. Currently, this call will fail the first time thru
; because video is installed before backlighting on boot.
;
Sub.w #ioQElSize,Sp ; Get a param block on the stack.
Move.l Sp,A0 ; Point to it.
Lea TIMBackLite,A1 ; Get pointer to Backlight driver name.
Move.l A1,ioFileName(A0) ; Load it.
_Open ; Open the driver.
Add.w #ioQElSize,Sp ; Restore the stack.
; All done!
;
@AllDone MOVEQ #noErr,D0 ; no error
@EndOpen RTS ; return
@OpError2 ADDA #spBlockSize,SP ; release the spBlock
LEA TTask(A3),A0 ; get the time manager task block
_RmvTime ; remove this element from the queue
MOVE.L dCtlStorage(A1),A0 ; get the private storage back
_DisposHandle
@OpError1 MOVE.L #OpenErr,D0 ; say can't open driver
BRA.S @EndOpen
ENDWITH
**********************************************************************
*
* Video Driver Control Call Handler. There are ten calls:
*
* (-1) GoodBye kiss <t10>
* (0) Reset (VAR mode, page: INTEGER; VAR BaseAddr: Ptr);
* (1) KillIO
* (2) SetMode(mode, page: INTEGER; VAR BaseAddr: Ptr);
* (3) SetEntries ( Table: Ptr; Start,Count : integer );
* (4) SetGamma ( Table : Ptr );
* (5) GrayPage (page);
* (6) SetGray (csMode = 0 for color, 1 for gray)
* (7) SetInterrupt ( csMode = 0 for enable, 1 for disable)
* (8) DirectSetEntries (not implemented)
* (9) SetDefaultMode
*
* Entry: A0 = param block pointer
* A1 = AuxDCE pointer
* Uses: A2 = ptr to cs parameters (ie. A2 <- csParam(A0))
* A3 = scratch (doesn't need to be preserved)
* A4 = scratch (must be preserved)
* D0-D3 = scratch (don't need to be preserved)
*
* Exit: D0 = error code
*
**********************************************************************
;
; Decode the call
;
TIMVidCtl
MOVEM.L A0/A1,-(SP) ; Preserve exit registers.
MOVE.L csParam(A0),A2 ; A2 <- Ptr to control parameters
MOVE.L dCtlStorage(A1),A3 ; A3 <- Ptr to private storage
MOVE.L (A3),D0 ;
_StripAddress ;
MOVE.L D0,A3 ;
MOVE.W csCode(A0),D0 ; get the opCode
ADDQ.W #1,D0 ; offset opCode by 1 <t10>
CMP.W #10,D0 ; IF csCode NOT IN [0..10] THEN <t10>
BHI.S TIMCtlBad ; Error, csCode out of bounds
MOVE.W TIMCtlJumpTbl(PC,D0.W*2),D0 ; Get the relative offset to the routine
JMP TIMCtlJumpTbl(PC,D0.W) ; GOTO the proper routine
TIMCtlJumpTbl
DC.W TIMGoodBye-TIMCtlJumpTbl ; $FF => NeedGoodBye Kiss <t10>
DC.W TIMVidReset-TIMCtlJumpTbl ; $00 => VidReset
DC.W TIMCtlGood-TIMCtlJumpTbl ; $01 => KillIO
DC.W TIMSetVidMode-TIMCtlJumpTbl ; $02 => SetVidMode
DC.W TIMCtlBad-TIMCtlJumpTbl ; $03 => SetEntries (not needed)
DC.W TIMCtlBad-TIMCtlJumpTbl ; $04 => SetGamma (not needed)
DC.W TIMGrayPage-TIMCtlJumpTbl ; $05 => GrayPage
DC.W TIMCtlBad-TIMCtlJumpTbl ; $06 => SetGray (not needed)
DC.W TIMSetInterrupt-TIMCtlJumpTbl ; $07 => SetInterrupt
DC.W TIMCtlBad-TIMCtlJumpTbl ; $08 => DirectSetEntries (not needed)
DC.W TIMCtlBad-TIMCtlJumpTbl ; $09 => SetDefaultMode (not needed)
TIMCtlBad MOVEQ #controlErr,D0 ; else say we don't do this one
BRA.S TIMCtlDone ; and return
TIMCtlGood MOVEQ #noErr,D0 ; return no error
TIMCtlDone MOVEM.L (SP)+,A0/A1 ; Restore exit registers.
BRA TIMExitDrvr
TIMGoodBye ; <t10>
;---------------------------------------------------------------------
;
; Upon the GoodBye Kiss, close the video driver
;
;---------------------------------------------------------------------
BSR.S TIMVidClose ; make the driver close call
BRA.S TIMCtlGood ; => no error
TIMVidReset
;---------------------------------------------------------------------
;
; Reset the card to its default
;
;---------------------------------------------------------------------
WITH VDPageInfo,TIMVidPrivates
MOVE #FirstVidMode,csMode(A2) ; return default mode
MOVE #FirstVidMode,saveMode(A3) ; remember FirstVidMode as the requested mode
CLR.W csPage(A2) ; return page zero
MOVE.L saveBaseAddr(A3),csBaseAddr(A2) ; return the base address
BSR TIMGrayScreen ; paint the screen gray
BRA.S TIMCtlGood ; => no error
ENDWITH
TIMSetVidMode
;---------------------------------------------------------------------
;
; Set the card to the specified mode and page. If it's not 1-bit
; mode, page zero, then return an error
;
; If the card is already set to the specified mode, then do nothing.
;
;---------------------------------------------------------------------
WITH VDPageInfo,TIMVidPrivates
CMP.W #FirstVidMode,csMode(A2) ; is it one-bit (the first and only)
BNE.S TIMCtlBad ; => not a valid mode
TST.W csPage(A2) ; it is page zero?
BNE.S TIMCtlBad ; => not a valid page
MOVE.L saveBaseAddr(A3),csBaseAddr(A2) ; return the base address
BRA.S TIMCtlGood ; => return no error
ENDWITH
TIMSetEntries
;---------------------------------------------------------------------
;
; Since TIM has no color table, thereÕs nothing do here. Return a ctl
; bad result (but do it up above in the control dispatcher, since it
; saves a few bytes.
;
;---------------------------------------------------------------------
TIMSetGamma
;---------------------------------------------------------------------
;
; Since TIM has no color table, there's no opportunity to set the
; gamma correction in this hardware. Return a ctl bad result (but
; do it up above in the control dispatcher, since it saves a few bytes.
;
;---------------------------------------------------------------------
TIMGrayPage
;---------------------------------------------------------------------
;
; Clear the specified page in the current mode to gray
;
; A1 = Ptr to AuxDCE
; A2 = Ptr to cs parameter record
; A3 = Ptr to private storage
;
;---------------------------------------------------------------------
WITH VDPageInfo,TIMVidPrivates
TST.W csPage(A2) ; Is it requesting page zero?
BNE.S TIMCtlBad
BSR TIMGrayScreen ; paint the screen gray
BRA.S TIMCtlGood ; => return no error
ENDWITH
TIMSetGray
;---------------------------------------------------------------------
;
; Since TIM has no color table, there's no opportunity to set
; luminence mapping in this hardware. Return a ctl bad result (but
; do it up above in the control dispatcher, since it saves a few bytes.
;
;---------------------------------------------------------------------
TIMSetInterrupt
;---------------------------------------------------------------------
;
; Enable (csMode = 0) or disable (csMode = non-zero) VBL interrupts
;
; As a future performance enhancement, interrupts on the card can be
; disabled or enabled from software. For instance, if the cursor is
; not on a screen, and there is nothing in the Slot Interrupt Queue
; for that device, interrupts may be disabled reducing interrupt
; overhead for the system.
;
; The slot interrupt queue element is always allocated by the Open call.
; This routine just inserts and removes it from the slot interrupt task queue.
;
; A1 = Ptr to AuxDCE
; A2 = Ptr to cs parameter record
; A3 = Ptr to private storage
;
;---------------------------------------------------------------------
WITH VDPageInfo,TIMVidPrivates
Move.b csMode(A2),D0 ; get mode
Ext.w D0 ; extend for word-sized flag
MOVE.W D0,IntDisableFlag(A3) ; save it
BNE.S TIMSIDone ; if disabling, setting the flag word is all that's needed
; if enabling interrupt simulator, then we need to prime the timer task
BSR.S TIMEnableVGuts ; call common code
TIMSIDone
BRA.S TIMCtlGood ; and go home
TIMEnableVGuts ;
MOVE.L A1,-(SP) ; jPrimeTime trashes A1 <3> djw
LEA TTask(A3),A0 ; get time task block in A0
MOVE.L #kTIMVBLTime,D0 ; delay for about 1/60th of a second
MOVE.L jPrimeTime,A1 ; point straight at the Time Manager dispatch vector
JSR (A1) ; start the delay going
MOVEA.L (SP)+,A1 ; <3> djw
RTS ; return home
ENDWITH
TIMSetDefaultMode
;---------------------------------------------------------------------
;
; Since TIM only has one video sRsrc and itÕs already set, just return
; a ctl bad result (but do it up above in the control dispatcher, since
; it saves a few bytes.
;
;---------------------------------------------------------------------
**********************************************************************
*
* VideoClose releases the device's private storage and removes the
* interrupt handler.
*
*
* Entry: A0 = param block pointer
* A1 = AuxDCE pointer
*
* Other: A2 = temporary AuxDCE pointer copy
*
**********************************************************************
WITH TIMVidPrivates
TIMVidClose
MOVE.L dCtlStorage(A1),A3 ; A3 <- Ptr to private storage
MOVE.L (A3),D0 ;
_StripAddress ;
MOVE.L D0,A3 ;
; Shut off VBL interrupts.
;
MOVE.W #1,IntDisableFlag(A3) ; set this word to ÒdisableÓ interrupts
LEA TTask(A3),A0 ; get the time manager task block
_RmvTime ; remove this element from the queue
; Close the Backlight driver.
;
Sub.w #ioQElSize,Sp ; Get a param block on the stack.
Move.l Sp,A0 ; Point to it.
Lea TIMBackLite,A1 ; Get pointer to Backlight driver name.
Move.l A1,ioFileName(A0) ; Load it.
_Open ; Open driver to get the refNum.
Bne.s @SkipClose ; If open fails, donÕt try to close it.
_Close ; Otherwise, close it.
@SkipClose
Add.w #ioQElSize,Sp ; Restore the stack.
; Gray the screen.
;
Bsr TimGrayScreen ; Gray the screen.
; Dispose of all storage.
;
Move.l saveFixedCLUT(A3),A0 ; Dispose of our fixed-entry CLUT.
_DisposPtr
MOVE.L dCtlStorage(A1),A0 ; Dispose of the private storage
_DisposHandle ;
MOVEQ #noErr,D0 ; no error
RTS ; and return
ENDWITH
**********************************************************************
*
* Video Driver Status Call Handler. Right now there are ten calls:
*
* (0) Error
* (1) Error
* (2) GetMode
* (3) GetEntries
* (4) GetPage
* (5) GetPageBase
* (6) GetGray
* (7) GetInterrupt
* (8) GetGamma
* (9) GetDefaultMode
*
* Entry: A0 = param block
* A1 = AuxDCE pointer
* Uses: A2 = cs parameters
* A3 = pointer to private storage
* D0-D3 = scratch (don't need to be preserved)
*
* Exit: D0 = error code
*
**********************************************************************
TIMVidStatus
MOVEM.L A0/A1,-(SP) ; Preserve exit registers.
MOVE.L csParam(A0),A2 ; A2 <- Ptr to control parameters
MOVE.L dCtlStorage(A1),A3 ; A3 <- Ptr to private storage
MOVE.L (A3),D0 ;
_StripAddress ;
MOVE.L D0,A3 ;
MOVE.W csCode(A0),D0 ; get routine selector
CMP.W #9,D0 ;IF csCode NOT IN [0..9] THEN
BHI.S TIMStatBad ; Error, csCode out of bounds.
MOVE.W TIMStatJumpTbl(PC,D0.W*2),D0 ;Get the relative offset to the routine.
JMP TIMStatJumpTbl(PC,D0.W) ;GOTO the proper routine.
TIMStatJumpTbl
DC.W TIMStatBad-TIMStatJumpTbl ;$00 => Error
DC.W TIMStatBad-TIMStatJumpTbl ;$01 => Error
DC.W TIMGetMode-TIMStatJumpTbl ;$02 => GetMode
DC.W TIMGetEntries-TIMStatJumpTbl ;$03 => GetEntries
DC.W TIMGetPage-TIMStatJumpTbl ;$04 => GetPage
DC.W TIMGetPageBase-TIMStatJumpTbl ;$05 => GetPageBase
DC.W TIMStatBad-TIMStatJumpTbl ;$06 => GetGray (not needed)
DC.W TIMGetInterrupt-TIMStatJumpTbl ;$07 => GetInterrupt
DC.W TIMStatBad-TIMStatJumpTbl ;$08 => GetGamma (not needed)
DC.W TIMGetDefaultMode-TIMStatJumpTbl ;$09 => GetDefaultMode
TIMStatBad MOVEQ #statusErr,D0 ; else say we don't do this one
BRA.S TIMStatDone ; and return
TIMStatGood MOVEQ #noErr,D0 ; return no error
TIMStatDone MOVEM.L (SP)+,A0/A1 ; Restore exit registers.
BRA TIMExitDrvr
TIMGetMode
;---------------------------------------------------------------------
;
; Return the current mode
;
; Inputs : A2 = pointer to csParams
; A3 = pointer to private storage
;
;---------------------------------------------------------------------
WITH TIMVidPrivates,VDPageInfo
MOVE.W saveMode(A3),csMode(A2) ; return the mode
CLR.W csPage(A2) ; return the page number
MOVE.L saveBaseAddr(A3),csBaseAddr(A2) ; and the base address
BRA.S TIMStatGood ; => return no error
ENDWITH
TIMGetEntries
;---------------------------------------------------------------------
;
; Fake the current contents of the CLUT. There isn't really a clut around,
; but that's no reason not to return a reasonable looking response
;
; Inputs : A2 = pointer to csParams
; A3 = pointer to privates
;
; For TIM the color table is fixed. So, weÕll always return good values
; as long as there is a reasonable looking color table around.
;
; Idea: If weÕre in indexed mode, weÕll cycle thru the input
; table. While doing this, weÕll ignore all entries
; whose value fields are out of range. For entries
; whose value field are in range, weÕll return the
; appropriate rgb fields.
;
; If weÕre in sequential mode, we just need to write out
; the number of entries we know about.
;
;---------------------------------------------------------------------
With TimVidPrivates
Move.l csTable(A2),D0 ; If we were handed a nil pointer,
Beq.s TIMStatBad ; then hike.
_StripAddress ; Otherwise, make it 32-bit clean.
Move.l D4,-(Sp) ; Save work register.
; Calculate the index rangeÉ
;
Move.w saveNumFixedEntries(A3),D3 ; Get number of entries to check against.
Move.w csCount(A2),D4 ; Get the number of entries to set,
Bmi.s @GEErr ; and hike if itÕs out of range.
Cmp.w D3,D4 ; If D4-D3 > 0 (count > # of entries),
Bhi.s @GEErr ; then hike.
Move.w D4,D2 ; Otherwise, copy the count.
Move.l D0,A0 ; Get pointer to input table.
Cmp.w #indexEntries,csStart(A2) ; If table accesses are to be indexed,
Beq.s @GECom ; then go on.
Move.w D4,D1 ; Otherwise, sequence thru table from
Add.w csStart(A2),D2 ; csStart thru csCount entries.
; The following code is BAD, BAD, BAD! We should build our own table here so
; as to NOT mess up the userÕs data. But all the previous Apple video drivers
; have done the same thing, so weÕll continue the trend for now.
@TableLoop Move.w D2,value(A0,D1*colorSpecSize) ; Write the index into the table.
Subq #1,D2 ; Decrement index.
Dbra D1,@TableLoop
@GECom
@Repeat Move.w value(A0),D1 ; Get the NEXT table position into D1.
Cmp.w D3,D1 ; If this position is out of range,
Bhi.s @Until ; then go on.
Move.l saveFixedCLUT(A3),A1 ; Point to start of fixed CLUT.
Lea (A1,D1*colorSpecSize),A1 ; Index into right entry.
Move.w rgb+red(A1),rgb+red(A0) ; Copy red,
Move.w rgb+green(A1),rgb+green(A0) ; green,
Move.w rgb+blue(A1),rgb+blue(A0) ; blue.
@Until Addq #colorSpecSize,A0 ; Point to next entry in input ColorTable.
Dbra D4,@Repeat
Move.l (Sp)+,D4 ; Restore work register.
Bra.s TimStatGood ; Return noError.
@GEErr Move.l (Sp)+,D4 ; Restore work register.
Bra.s TimStatBad ; Return statError.
EndWith
TIMGetPage
;---------------------------------------------------------------------
;
; Return the number of pages in the specified mode.
;
;---------------------------------------------------------------------
WITH TIMVidPrivates,VDPageInfo
CMP.W #FirstVidMode,csMode(A2) ; this mode, or else
BNE TIMStatBad ; oh,oh
MOVE.W #OBMPagesLCD,csPage(A2) ; return page count
BRA TIMStatGood ; => return no error
ENDWITH
TIMGetPageBase
;---------------------------------------------------------------------
;
; Return the base address for the specified page in the current mode
;
;---------------------------------------------------------------------
WITH TIMVidPrivates,VDPageInfo
MOVE.W csPage(A2),D0 ; get the requested page
BNE TIMStatBad ; => no, just return
MOVE.L saveBaseAddr(A3),csBaseAddr(A2) ; return the base address
BRA TIMStatGood ; => return no error
ENDWITH
TIMGetGray
;---------------------------------------------------------------------
;
; No CLUT, so this routine returns an status error. It's implemented
; in the Status dispatch table above.
;
;---------------------------------------------------------------------
TIMGetInterrupt
;---------------------------------------------------------------------
;
; Return a boolean in csMode, set true if VBL interrupts are disabled
;
;---------------------------------------------------------------------
WITH TIMVidPrivates,VDPageInfo
TST.W IntDisableFlag(A3) ; test the interrupt state
BEQ.S @isOn ; if not on,
MOVE.B #1,csMode(A2) ; then return disabled state.
BRA TIMStatGood ;
@isOn
CLR.B csMode(A2) ; return enabled state
BRA TIMStatGood
ENDWITH
TIMGetGamma
;---------------------------------------------------------------------
;
; No CLUT, so this routine returns an status error. It's implemented
; in the Status dispatch table above.
;
;---------------------------------------------------------------------
TIMGetDefaultMode
;---------------------------------------------------------------------
;
; Read the card default mode from slot pRAM.
;
; A1 = Ptr to AuxDCE
; A2 = Ptr to cs parameter record
; A3 = Ptr to private storage
;
;---------------------------------------------------------------------
; For most video drivers, we look in pRAM to see what the last
; configuration set was. However, for TIM, there only one
; mode possible, so we just return that value here.
WITH VDPageInfo ; GDW1
MOVE.B dCtlSlotID(A1),csMode(A2) ; return the result
BRA TimStatGood ;
ENDWITH ; GDW1
;---------------------------------------------------------------------
;
; Exit from Control or Status.
;
; A0 = Ptr to param block.
; A1 = Ptr to AuxDCE.
; D0 = error code.
;
;---------------------------------------------------------------------
TIMExitDrvr BTST #NoQueueBit,ioTrap(A0) ; no queue bit set?
BEQ.S TIMGoIODone ; => no, not immediate
RTS ; otherwise, it was an immediate call
TIMGoIODone MOVE.L JIODone,-(Sp) ; Get the IODone address,
Rts ; and go there.
;=====================================================================
;
; Utilities
;
;=====================================================================
TIMGrayScreen
;---------------------------------------------------------------------
;
; Fill the screen with a 50% dithered gray pattern.
; A3 = driver private storage
;
; All registers are preserved
;
WITH TIMVidPrivates
MOVEM.L D0/D2/D3/A0/A1,-(SP) ; save all registers
Moveq #true32b,D0 ; Set up to flip into 32-bit mode.
_SwapMMUMode ; Flip.
Move.b D0,-(Sp) ; Save previous mode.
MOVE.L #OneBitGray,D3 ; get the one-bit gray pattern
MOVE.L saveBaseAddr(A3),A0 ; get the frame buffer base address
MOVE.W #defmBounds_BLCD-1,D0 ; get the # of rows
@NxtRow MOVE.W #(OBMLCDRB/4)-1,D2 ; get the # of longs/row
@NxtLong MOVE.L D3,(A0)+ ; write gray
DBRA D2,@NxtLong ; for each scanline
NOT.L D3 ; invert pattern on next row
DBRA D0,@NxtRow ; for each row
Move.b (Sp)+,D0 ; Restore previous addressing mode.
_SwapMMUMode
MOVEM.L (SP)+,D0/D2/D3/A0/A1 ; restore registers
RTS
ENDWITH
;-----------------------------------------------------------------------------
; The Interrupt handler for the TIM Built-In Video
;
; Since it doesn't make much sense for an LCD system to have all the
; interrupt related hardware that the CRT systems have since there
; really isn't a blanking interval anyway. On this machine we
; simulate the slot interrupt system with a timer task. We still
; call the slot VBL task queue so slot VBL tasks get called.
;-----------------------------------------------------------------------------
;
; The new time manager sets A1 to point to the TTask block on entry
;
TIMBeginIH
MOVE.L A1,-(SP) ; save A1 (it's trashed by JVBLTask)
CLR.W D0 ; set slot zero in D0
MOVE.L JVBLTask,A0 ; call the VBL task manager
JSR (A0) ; with slot # in D0
MOVEA.L (SP)+,A1 ; restore A1 (ptr to TTask block) <3> djw
TST.W tmXQSize(A1) ; test the flag word to see if ÒinterruptsÓ are on
; WARNING! - this field must be immediately after the TTask elem
BNE.S @Done ; if ­ 0, then ÒinterruptsÓ are disabled, so don't reprime
MOVEA.L A1,A0 ; get time task block addr in A0 <3> djw
MOVE.L #kTIMVBLTime,D0 ; delay for about 1/60th of a second
MOVE.L jPrimeTime,A1 ; point straight at the Time Manager dispatch vector
JSR (A1) ; start the delay going
@Done
RTS ; and return to caller
END

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,367 @@
#
# File: VideoDrivers.make
#
# Contains: Makefile for Video.
#
# Written by: Kurt Clark, Chas Spillar, and Tim Nichols
#
# Copyright: © 1992-1993 by Apple Computer, Inc., all rights reserved.
#
# Change History (most recent first):
#
# <SM7> 11/10/93 fau Update from SuperMunggio <SMG2>.
# <SMG2> 10/27/93 fau Added support for the ATI card on TNT.
# <SM6> 09-23-93 jmp Added GestaltEqu.a to SonoraÕs dependency list.
# <SM5> 9/9/93 pdw Added slots.a to dependencies.
# <SM4> 08-03-93 jmp Added various necessary dependencies that werenÕt previously
# spelled out.
# <SM3> 6/14/93 kc Roll in Ludwig.
# <LW5> 5/19/93 fau Added CivicPict2 to the DeclVideo.rsrc and made Rez use a -t and
# -c options.
# <LW4> 4/30/93 fau Added CivicPict to the DeclDataVideo.rsrc
# <LW3> 4/27/93 fau W/r to Bug #1081554, I updated the dependencies of the video
# drivers to include the actual source files!
# <LW2> 2/16/93 fau Added CivicPrimaryInit dependency to CivicDriver.
# <SM2> 3/31/93 kc Delete duplicate definition of VideoDir.
# <SM2> 01-12-93 jmp Added support for CSC.
SonicDir = {DeclDir}DeclNet:Sonic:
VideoDriverDir = {Sources}Drivers:Video:
ApolloVideoDir = {VideoDir}Apollo:
CivicVideoDir = {VideoDir}Civic:
CSCVideoDir = {VideoDir}CSC:
DAFBVideoDir = {VideoDir}DAFB:
DBLiteVideoDir = {VideoDir}DBLite:
RBVVideoDir = {VideoDir}RBV:
SonoraVideoDir = {VideoDir}Sonora:
TimVideoDir = {VideoDir}Tim:
V8VideoDir = {VideoDir}V8:
ATIVideoDir = {VideoDir}ATI:
CommonHeaders = "{ObjDir}StandardEqu.d" ¶
"{IntAIncludes}HardwarePrivateEqu.a" ¶
"{AIncludes}ROMEqu.a" ¶
"{AIncludes}Video.a" ¶
"{IntAIncludes}SlotMgrEqu.a" ¶
"{AIncludes}Slots.a" ¶
"{IntAIncludes}UniversalEqu.a" ¶
"{IntAIncludes}DepVideoEqu.a"
#
# Video Resource
#
"{RsrcDir}DeclDataVideo.rsrc" Ä "{VideoDir}VideoDrivers.r" ¶
"{RsrcDir}ApolloDriver.rsrc" ¶
"{RsrcDir}CivicDeclVideo.rsrc" ¶
"{RsrcDir}CivicDriver.rsrc" ¶
"{RsrcDir}CivicPict.rsrc" ¶
"{RsrcDir}CivicPict2.rsrc" ¶
"{RsrcDir}CivicPrimaryInit.rsrc" ¶
"{RsrcDir}CSCDeclVideo.rsrc" ¶
"{RsrcDir}CSCDriver.rsrc" ¶
"{RsrcDir}CSCPrimaryInit.rsrc" ¶
"{RsrcDir}DAFBDriver.rsrc" ¶
"{RsrcDir}DBLiteDriver.rsrc" ¶
"{RsrcDir}RBVDriver.rsrc" ¶
"{RsrcDir}SonoraDriver.rsrc" ¶
"{RsrcDir}SonoraDeclVideo.rsrc" ¶
"{RsrcDir}SonoraPrimaryInit.rsrc" ¶
"{RsrcDir}TimDriver.rsrc" ¶
"{RsrcDir}V8Driver.rsrc" ¶
"{RsrcDir}ATIDeclVideo.rsrc" ¶
"{RsrcDir}ATIDeclMonitors.rsrc" ¶
"{RsrcDir}ATIDriver.rsrc" ¶
"{RsrcDir}ATIPrimaryInit.rsrc"
Rez -t rsrc -c RSED {StdROpts} -s {RsrcDir} "{VideoDir}VideoDrivers.r" -o "{Targ}"
#
# Apollo Video Driver
#
"{RsrcDir}ApolloDriver.rsrc" Ä "{ObjDir}ApolloDriver.a.o"
Link {StdLOpts} {StdAlign} -rt decl=10 "{ObjDir}ApolloDriver.a.o" -o "{RsrcDir}ApolloDriver.rsrc"
"{ObjDir}ApolloDriver.a.o" Ä "{ApolloVideoDir}ApolloDriver.a" ¶
{CommonHeaders}
Asm {StdAOpts} -o "{ObjDir}ApolloDriver.a.o" "{ApolloVideoDir}ApolloDriver.a"
#
# Civic Video Driver
#
CivicHeaders = {CommonHeaders}
"{RsrcDir}CivicDeclVideo.rsrc" Ä "{CivicVideoDir}CivicDeclVideo.r" ¶
"{IntRIncludes}DepVideoEqu.r" ¶
"{IntRIncludes}HardwarePrivateEqu.r" ¶
"{IntRIncludes}InternalOnlyEqu.r" ¶
"{IntRIncludes}Quickdraw.r" ¶
"{IntRIncludes}ROMLink.r"
Rez -t rsrc -c RSED {StdROpts} "{CivicVideoDir}CivicDeclVideo.r" -o "{RsrcDir}CivicDeclVideo.rsrc"
"{RsrcDir}CivicDriver.rsrc" Ä "{ObjDir}CivicDriver.a.o" ¶
"{ObjDir}CivicPrimaryInit.a.o"
Link {StdLOpts} {StdAlign} -rt decl=20 "{ObjDir}CivicDriver.a.o" -o "{RsrcDir}CivicDriver.rsrc"
"{ObjDir}CivicDriver.a.o" Ä "{CivicVideoDir}CivicDriver.a" ¶
"{ObjDir}CivicPrimaryInit.a.o" ¶
{CivicHeaders}
Asm {StdAOpts} -o "{ObjDir}CivicDriver.a.o" "{CivicVideoDir}CivicDriver.a"
"{RsrcDir}CivicPrimaryInit.rsrc" Ä "{ObjDir}CivicPrimaryInit.a.o"
Link {StdLOpts} {StdAlign} -rt decl=30 "{ObjDir}CivicPrimaryInit.a.o" -o "{RsrcDir}CivicPrimaryInit.rsrc"
"{ObjDir}CivicPrimaryInit.a.o" Ä "{CivicVideoDir}CivicPrimaryInit.a" ¶
{CivicHeaders}
Asm {StdAOpts} -o "{ObjDir}CivicPrimaryInit.a.o" "{CivicVideoDir}CivicPrimaryInit.a"
"{RsrcDir}CivicPict.rsrc" Ä "{ObjDir}CivicPict.a.o"
Link {StdLOpts} {StdAlign} -rt decl=32 "{ObjDir}CivicPict.a.o" -o "{RsrcDir}CivicPict.rsrc"
"{ObjDir}CivicPict.a.o" Ä "{CivicVideoDir}CivicPict.a"
Asm {StdAOpts} -o "{ObjDir}CivicPict.a.o" "{CivicVideoDir}CivicPict.a"
"{RsrcDir}CivicPict2.rsrc" Ä "{ObjDir}CivicPict2.a.o"
Link {StdLOpts} {StdAlign} -rt decl=33 "{ObjDir}CivicPict2.a.o" -o "{RsrcDir}CivicPict2.rsrc"
"{ObjDir}CivicPict2.a.o" Ä "{CivicVideoDir}CivicPict2.a"
Asm {StdAOpts} -o "{ObjDir}CivicPict2.a.o" "{CivicVideoDir}CivicPict2.a"
#
# CSC Video Code
#
"{RsrcDir}CSCDeclVideo.rsrc" Ä "{CSCVideoDir}CSCDeclVideo.r" ¶
"{IntRIncludes}DepVideoEqu.r" ¶
"{IntRIncludes}HardwarePrivateEqu.r" ¶
"{IntRIncludes}InternalOnlyEqu.r" ¶
"{IntRIncludes}Quickdraw.r" ¶
"{IntRIncludes}ROMLink.r"
Rez {StdROpts} "{CSCVideoDir}CSCDeclVideo.r" -o "{RsrcDir}CSCDeclVideo.rsrc"
"{RsrcDir}CSCDriver.rsrc" Ä "{ObjDir}CSCDriver.a.o" ¶
"{ObjDir}CSCPrimaryInit.a.o"
Link {StdLOpts} {StdAlign} -rt decl=6000 "{ObjDir}CSCDriver.a.o" -o "{RsrcDir}CSCDriver.rsrc"
"{ObjDir}CSCDriver.a.o" Ä "{CSCVideoDir}CSCDriver.a" ¶
{CommonHeaders}
Asm {StdAOpts} -o "{ObjDir}CSCDriver.a.o" "{CSCVideoDir}CSCDriver.a"
"{RsrcDir}CSCPrimaryInit.rsrc" Ä "{ObjDir}CSCPrimaryInit.a.o"
Link {StdLOpts} {StdAlign} -rt decl=6030 "{ObjDir}CSCPrimaryInit.a.o" -o "{RsrcDir}CSCPrimaryInit.rsrc"
"{ObjDir}CSCPrimaryInit.a.o" Ä "{CSCVideoDir}CSCPrimaryInit.a" ¶
{CommonHeaders}
Asm {StdAOpts} -d ForEclipseROM=0,sonic32=1,ctlpad=0,mmu=1 -i "{DeclDir}DeclNet:Sonic:" -o "{ObjDir}CSCPrimaryInit.a.o" "{CSCVideoDir}CSCPrimaryInit.a"
#
# DAFB Video Driver
#
"{RsrcDir}DAFBDriver.rsrc" Ä "{ObjDir}DAFBDriver.a.o"
Link {StdLOpts} {StdAlign} -rt decl=40 "{ObjDir}DAFBDriver.a.o" -o "{RsrcDir}DAFBDriver.rsrc"
"{ObjDir}DAFBDriver.a.o" Ä "{DAFBVideoDir}DAFBDriver.a" ¶
{CommonHeaders}
Asm {StdAOpts} -o "{ObjDir}DAFBDriver.a.o" "{DAFBVideoDir}DAFBDriver.a"
#
# DBLite Video Driver
#
"{RsrcDir}DBLiteDriver.rsrc" Ä "{ObjDir}DBLiteDriver.a.o"
Link {StdLOpts} {StdAlign} -rt decl=50 "{ObjDir}DBLiteDriver.a.o" -o "{RsrcDir}DBLiteDriver.rsrc"
"{ObjDir}DBLiteDriver.a.o" Ä "{DBLiteVideoDir}DBLiteDriver.a" ¶
{CommonHeaders}
Asm {StdAOpts} -o "{ObjDir}DBLiteDriver.a.o" "{DBLiteVideoDir}DBLiteDriver.a"
#
# RBV Video Driver
#
"{RsrcDir}RBVDriver.rsrc" Ä "{ObjDir}RBVDriver.a.o"
Link {StdLOpts} {StdAlign} -rt decl=60 "{ObjDir}RBVDriver.a.o" -o "{RsrcDir}RBVDriver.rsrc"
"{ObjDir}RBVDriver.a.o" Ä "{RBVVideoDir}RBVDriver.a" ¶
{CommonHeaders}
Asm {StdAOpts} -o "{ObjDir}RBVDriver.a.o" "{RBVVideoDir}RBVDriver.a"
#
# Sonora Video Driver
#
SonoraHeaders = "{IntAIncludes}AMICEqu.a" ¶
"{IntAIncludes}EgretEqu.a" ¶
"{AIncludes}GestaltEqu.a" ¶
"{IntAIncludes}IOPrimitiveEqu.a" ¶
"{SonicDir}SonicEqu.a" ¶
{CommonHeaders}
"{RsrcDir}SonoraDeclVideo.rsrc" Ä "{SonoraVideoDir}SonoraDeclVideo.r" ¶
"{IntRIncludes}DepVideoEqu.r" ¶
"{IntRIncludes}HardwarePrivateEqu.r" ¶
"{IntRIncludes}InternalOnlyEqu.r" ¶
"{IntRIncludes}Quickdraw.r" ¶
"{IntRIncludes}ROMLink.r"
Rez {StdROpts} "{SonoraVideoDir}SonoraDeclVideo.r" -o "{RsrcDir}SonoraDeclVideo.rsrc"
"{RsrcDir}SonoraDriver.rsrc" Ä "{ObjDir}SonoraDriver.a.o"
Link {StdLOpts} {StdAlign} -rt decl=70 "{ObjDir}SonoraDriver.a.o" -o "{RsrcDir}SonoraDriver.rsrc"
"{ObjDir}SonoraDriver.a.o" Ä "{SonoraVideoDir}SonoraDriver.a" ¶
{SonoraHeaders}
Asm {StdAOpts} -o "{ObjDir}SonoraDriver.a.o" "{SonoraVideoDir}SonoraDriver.a"
"{RsrcDir}SonoraPrimaryInit.rsrc" Ä "{ObjDir}SonoraPrimaryInit.a.o"
Link {StdLOpts} {StdAlign} -rt decl=80 "{ObjDir}SonoraPrimaryInit.a.o" -o "{RsrcDir}SonoraPrimaryInit.rsrc"
"{ObjDir}SonoraPrimaryInit.a.o" Ä "{SonoraVideoDir}SonoraPrimaryInit.a" ¶
{SonoraHeaders}
Asm {StdAOpts} -d ForEclipseROM=0,sonic32=1,ctlpad=0,mmu=1 -i "{SonicDir}" -o "{ObjDir}SonoraPrimaryInit.a.o" "{SonoraVideoDir}SonoraPrimaryInit.a"
#
# Tim Video Driver
#
"{RsrcDir}TimDriver.rsrc" Ä "{ObjDir}TimDriver.a.o"
Link {StdLOpts} {StdAlign} -rt decl=90 "{ObjDir}TimDriver.a.o" -o "{RsrcDir}TimDriver.rsrc"
"{ObjDir}TimDriver.a.o" Ä "{TimVideoDir}TimDriver.a" ¶
{CommonHeaders}
Asm {StdAOpts} -o "{ObjDir}TimDriver.a.o" "{TimVideoDir}TimDriver.a"
#
# V8 Video Driver
#
"{RsrcDir}V8Driver.rsrc" Ä "{ObjDir}V8Driver.a.o"
Link {StdLOpts} {StdAlign} -rt decl=100 "{ObjDir}V8Driver.a.o" -o "{RsrcDir}V8Driver.rsrc"
"{ObjDir}V8Driver.a.o" Ä "{V8VideoDir}V8Driver.a" ¶
{CommonHeaders}
Asm {StdAOpts} -o "{ObjDir}V8Driver.a.o" "{V8VideoDir}V8Driver.a"
#
# ATI Video Driver
#
ATIHeaders = "{ATIVideoDir}ATIDrvr.h" ¶
"{ATIVideoDir}ATIStdTypes.h" ¶
"{ATIVideoDir}ATIVideo.h" ¶
"{ATIVideoDir}ATI.h" ¶
"{ATIVideoDir}Diamond.h" ¶
{CommonHeaders}
"{RsrcDir}ATIDeclVideo.rsrc" Ä "{ATIVideoDir}ATIDeclVideo.r" ¶
"{ATIVideoDir}ATIDeclMonitors.r" ¶
"{IntRIncludes}DepVideoEqu.r" ¶
"{IntRIncludes}HardwarePrivateEqu.r" ¶
"{IntRIncludes}InternalOnlyEqu.r" ¶
"{IntRIncludes}Quickdraw.r" ¶
"{IntRIncludes}ROMLink.r"
Rez {StdROpts} "{ATIVideoDir}ATIDeclVideo.r" -o "{RsrcDir}ATIDeclVideo.rsrc"
#===================================================================
# Build the supported monitors file
#===================================================================
"{RsrcDir}ATIDeclMonitors.rsrc" Ä "{ATIVideoDir}ATIDeclMonitors.r" ¶
"{ATIVideoDir}ATIDefROM.r" ¶
"{ATIVideoDir}ATIDeclVideo.r"
Rez {StdROpts} "{ATIVideoDir}ATIDeclMonitors.r" -o "{RsrcDir}ATIDeclMonitors.rsrc"
#===================================================================
# Build the ATI Primary INIT file
#===================================================================
"{RsrcDir}ATIPrimaryInit.rsrc" Ä "{ObjDir}ATIPrimaryInit.a.o" ¶
"{ObjDir}ATIPrimaryInit.c.o" ¶
"{ObjDir}PCIUtil.c.o" ¶
"{ObjDir}Diamond.c.o"
Link {StdLOpts} {StdAlign} -rt decl=110 ¶
"{ObjDir}ATIPrimaryInit.a.o" ¶
"{ObjDir}ATIPrimaryInit.c.o" ¶
"{ObjDir}PCIUtil.c.o" ¶
"{ObjDir}Diamond.c.o" ¶
-o "{RsrcDir}ATIPrimaryInit.rsrc"
"{ObjDir}ATIPrimaryInit.a.o" Ä "{ATIVideoDir}ATIPrimaryInit.a"
asm {StdAOpts} -o "{ObjDir}ATIPrimaryInit.a.o" "{ATIVideoDir}ATIPrimaryInit.a"
"{ObjDir}ATIPrimaryInit.c.o" Ä "{ATIVideoDir}ATIPrimaryInit.c" {ATIHeaders}
C {StdCOpts} -o "{ObjDir}ATIPrimaryInit.c.o" "{ATIVideoDir}ATIPrimaryInit.c"
"{ObjDir}Diamond.c.o" Ä "{ATIVideoDir}Diamond.c" {ATIHeaders}
C {StdCOpts} -o "{ObjDir}Diamond.c.o" "{ATIVideoDir}Diamond.c"
#===================================================================
# Build the ATI driver
#===================================================================
"{RsrcDir}ATIDriver.rsrc" Ä "{ObjDir}ATIDrvr.a.o" ¶
"{ObjDir}ATIDrvr.c.o" ¶
"{ObjDir}ATISlotUtils.c.o" ¶
"{ObjDir}ATIVideoImp.c.o" ¶
"{ObjDir}ATIDrvrImp.c.o" ¶
"{ObjDir}PCIUtil.c.o"
Link {StdLOpts} {StdAlign} -rt decl=112 ¶
"{ObjDir}ATIDrvr.a.o" ¶
"{ObjDir}ATIDrvr.c.o" ¶
"{ObjDir}ATIDrvrImp.c.o" ¶
"{ObjDir}ATISlotUtils.c.o" ¶
"{ObjDir}ATIVideoImp.c.o" ¶
"{ObjDir}PCIUtil.c.o" ¶
-o "{RsrcDir}ATIDriver.rsrc"
"{ObjDir}ATIDrvr.a.o" Ä "{ATIVideoDir}ATIDrvr.a" ¶
"{ATIVideoDir}ATIHdr.a"
Asm {StdAOpts} -case on -o "{ObjDir}ATIDrvr.a.o" "{ATIVideoDir}ATIDrvr.a"
"{ObjDir}ATIDrvr.c.o" Ä "{ATIVideoDir}ATIDrvr.c" {ATIHeaders}
C {StdCOpts} -o "{ObjDir}ATIDrvr.c.o" "{ATIVideoDir}ATIDrvr.c"
"{ObjDir}ATIDrvrImp.c.o" Ä "{ATIVideoDir}ATIDrvrImp.c" {ATIHeaders}
C {StdCOpts} -o "{ObjDir}ATIDrvrImp.c.o" "{ATIVideoDir}ATIDrvrImp.c"
"{ObjDir}ATISlotUtils.c.o" Ä "{ATIVideoDir}ATISlotUtils.c" {ATIHeaders}
C {StdCOpts} -o "{ObjDir}ATISlotUtils.c.o" "{ATIVideoDir}ATISlotUtils.c"
"{ObjDir}ATIVideoImp.c.o" Ä "{ATIVideoDir}ATIVideoImp.c" {ATIHeaders}
C {StdCOpts} -o "{ObjDir}ATIVideoImp.c.o" "{ATIVideoDir}ATIVideoImp.c"
#===================================================================
# Build the extras
#===================================================================
"{ObjDir}PCIUtil.c.o" Ä "{ATIVideoDir}PCIUtil.c" {ATIHeaders}
C {StdCOpts} -o "{ObjDir}PCIUtil.c.o" "{ATIVideoDir}PCIUtil.c"
#
# The following should be in the video drivers folder.
#
VideoDriverObjs = "{ObjDir}JMFBDriver.a.o" ¶
"{ObjDir}JMFBPrimaryInit.a.o" ¶
"{ObjDir}TFBDriver.a.o" ¶
"{ObjDir}TFBPrimaryInit.a.o"
"{LibDir}VideoDriver.lib" Ä {VideoDriverObjs}
Lib {LibOpts} {VideoDriverObjs} -o "{Targ}"
"{ObjDir}JMFBDriver.a.o" Ä "{VideoDriverDir}JMFBDepVideoEqu.a" ¶
"{VideoDriverDir}JMFBDriver.a" ¶
"{IntAIncludes}ComVideoEqu.a"
Asm {StdAOpts} -o "{Targ}" "{VideoDriverDir}JMFBDriver.a"
"{ObjDir}JMFBPrimaryInit.a.o" Ä "{VideoDriverDir}JMFBDepVideoEqu.a" ¶
"{VideoDriverDir}JMFBPrimaryInit.a" ¶
"{IntAIncludes}ComVideoEqu.a"
Asm {StdAOpts} -o "{Targ}" "{VideoDriverDir}JMFBPrimaryInit.a"
"{ObjDir}TFBDriver.a.o" Ä "{VideoDriverDir}TFBDepVideoEqu.a" ¶
"{VideoDriverDir}TFBDriver.a" ¶
"{IntAIncludes}ComVideoEqu.a"
Asm {StdAOpts} -o "{Targ}" "{VideoDriverDir}TFBDriver.a"
"{ObjDir}TFBPrimaryInit.a.o" Ä "{VideoDriverDir}TFBDepVideoEqu.a" ¶
"{VideoDriverDir}TFBPrimaryInit.a" ¶
"{IntAIncludes}ComVideoEqu.a"
Asm {StdAOpts} -o "{Targ}" "{VideoDriverDir}TFBPrimaryInit.a"

View File

@ -0,0 +1,47 @@
/*
File: VideoDrivers.r
Contains: The includes to build a giant Ò.rsrcÓ file.
Copyright: © 1989-1993 by Apple Computer, Inc., all rights reserved.
Change History (most recent first):
<SM5> 11/10/93 fau Update from SuperMunggio <SMG2>.
<SMG2> 10/27/93 fau Added the ATI resources to the list.
<SM4> 6/14/93 kc Roll in Ludwig.
<LW3> 5/19/93 fau Added CivicPict2.rsrc to the list.
<LW2> 4/30/93 fau Added CivicPict.rsrc to the list.
<SM3> 01-12-93 jmp Added initial support for CSC.
<SM2> 11/2/92 kc Change ObjDir to RsrcDir and add not 'SINL'.
<1> 10-17-92 jmp first checked in
*/
#include "Types.r"
#include "ROMLink.r"
include $$Shell("RsrcDir")"ApolloDriver.rsrc" not 'SINL';
include $$Shell("RsrcDir")"CivicDeclVideo.rsrc" not 'SINL';
include $$Shell("RsrcDir")"CivicDriver.rsrc" not 'SINL';
include $$Shell("RsrcDir")"CivicPict.rsrc" not 'SINL';
include $$Shell("RsrcDir")"CivicPict2.rsrc" not 'SINL';
include $$Shell("RsrcDir")"CivicPrimaryInit.rsrc" not 'SINL';
include $$Shell("RsrcDir")"CSCDeclVideo.rsrc" not 'SINL';
include $$Shell("RsrcDir")"CSCDriver.rsrc" not 'SINL';
include $$Shell("RsrcDir")"CSCPrimaryInit.rsrc" not 'SINL';
include $$Shell("RsrcDir")"DAFBDriver.rsrc" not 'SINL';
include $$Shell("RsrcDir")"DBLiteDriver.rsrc" not 'SINL';
include $$Shell("RsrcDir")"RBVDriver.rsrc" not 'SINL';
include $$Shell("RsrcDir")"SonoraDriver.rsrc" not 'SINL';
include $$Shell("RsrcDir")"SonoraDeclVideo.rsrc" not 'SINL';
include $$Shell("RsrcDir")"SonoraPrimaryInit.rsrc" not 'SINL';
include $$Shell("RsrcDir")"TimDriver.rsrc" not 'SINL';
include $$Shell("RsrcDir")"V8Driver.rsrc" not 'SINL';
include $$Shell("RsrcDir")"ATIDeclVideo.rsrc" not 'SINL';
include $$Shell("RsrcDir")"ATIDriver.rsrc" not 'SINL';
include $$Shell("RsrcDir")"ATIDeclMonitors.rsrc" not 'SINL';
include $$Shell("RsrcDir")"ATIPrimaryInit.rsrc" not 'SINL';
/*
include $$Shell("RsrcDir")".rsrc";
*/

3566
DeclData/PrimaryInit.a Normal file

File diff suppressed because it is too large Load Diff

582
DeclData/SecondaryInit.a Normal file
View File

@ -0,0 +1,582 @@
;
; File: SecondaryInit.a
;
; Written by: Mike Puckett, October 3, 1991
;
; Copyright: © 1988-1993 by Apple Computer, Inc. All rights reserved.
;
; Change History (most recent first):
;
; <SM5> 12/13/93 PN Roll in KAOS and Horror to add support for Malcom and AJ
; <SM4> 08-03-93 jmp Updated sources to reflect necessary changes from HORROR.
; <SM3> 01-11-93 jmp Updated various BoxFlag names.
; <SM2> 10/28/92 SWC Changed VideoEqu.a->Video.a and ShutdownEqu.a->Shutdown.a.
; <1> 10/6/92 GDW New location for ROMLink tool.
; <SM5> 09-03-92 jmp (jmp,H9) Corrected .s vs. non-.s branches and odd-alignment
; problems.
; (ag,H8) Change to use new power manger calling convention.
; (jmp,H7) Needed to add Wombat-class CPUs to those that need to
; run the Sound-Input VBL-killer code.
; <SM4> 6/4/92 KW (djw,H6) moved power mgr code to after EndSecondaryInit label so
; the code would be called. (ag,H5) Added call to power dispatch
; to allow power manager code execution at secondary init time.
; <SM3> 5/16/92 kc Roll in Horror Changes. Comments follow:
; <H4> 01/29/92 jmp (jmp,Z4) Added in some code that eliminates the System 7 TunerÕs
; secure-mode unfriendly keyboard patches.
; <2> 3/31/92 JSM Rolled this file into Reality.
; <H3> 01/27/92 jmp (BG,Z3) Added miscellaneous Zydeco-specific SoundMgr fixes.
; <H2> 01/22/92 jmp (jmp,Z2) Added a way to temporarily disable the altsense code.
; <H1> 10/24/91 jmp first checked in
;---------------------------------------------------------------------
STRING C
PRINT OFF
LOAD 'StandardEqu.d'
INCLUDE 'DockingEqu.a'
INCLUDE 'EgretEqu.a'
INCLUDE 'GestaltEqu.a'
INCLUDE 'GestaltPrivateEqu.a'
INCLUDE 'HardwarePrivateEqu.a'
INCLUDE 'IOPrimitiveEqu.a'
INCLUDE 'PowerPrivEqu.a'
INCLUDE 'ROMEqu.a'
INCLUDE 'Video.a'
INCLUDE 'SlotMgrEqu.a'
INCLUDE 'ShutDown.a'
INCLUDE 'SonicEqu.a'
INCLUDE 'UniversalEqu.a'
INCLUDE 'DepVideoEqu.a'
PRINT ON
SEG '_sSecondaryInitRec'
MACHINE MC68020
LSecondaryInit PROC
;---------------------------------------------------------------------
; Header
;---------------------------------------------------------------------
Dc.b sExec2 ; code revision
Dc.b sCPU68020 ; CPU type is 68020
Dc.w 0 ; reserved
DC.L BeginSecondaryInit-* ; offset to code
;---------------------------------------------------------------------
; Local variables, definitions, etc....
;---------------------------------------------------------------------
SInitStackFrame Record {A6Link},Decrement
Return Ds.l 1 ; Return address.
A6Link Ds.l 1 ; Saved A6.
spBlk Ds SpBlock ; SpBlock for generic use.
sPRAMBlk Ds.b SizesPRAMRec ; SpRAMRec for generic use.
theDrHwID Ds.w 1 ; The DrHwID in use.
theBoardID Ds.b 1 ; The boardID in use.
Ds.b 1 ; <pad>
SInitStackSize Equ *
Endr
GestaltSelectorFrame Record {A6Link},Decrement
Result Ds.w 1 ; The Gestalt OSErr result.
GSFStartParams Equ *
Selector Ds.l 1 ; Selector, OSType.
ResponsePtr Ds.l 1 ; Response, VAR-type.
GSFParamSize Equ GSFStartParams-*
Return Ds.l 1 ; Return address.
A6Link Ds.l 1 ; Save A6.
Org
GSFSize Equ *
ENDR
;---------------------------------------------------------------------
; Data
;---------------------------------------------------------------------
; This is the VBL from System 7.0.1 ({SoundMgr}SoundMgrPatch.a) that is unnecessary
; on the Quadra 950.
SndVBLTask ; 7.0.1 System Disk Sound VBL Task (stored as data here)
dc.w $317C, $001E, $000A ; MOVE.W #$001E,$000A(A0)
dc.w $2278, $0CC0 ; MOVEA.L $0CC0,A1
dc.w $40E7 ; MOVE SR,-(A7)
dc.w $007C, $0700 ; ORI.W #$0700,SR
dc.w $4A29, $0F09 ; TST.B $0F09(A1)
dc.w $6706 ; BEQ.S *+$0008
dc.w $4A29, $0F29 ; TST.B $0F29(A1)
dc.w $661A ; BNE.S *+$001C
dc.w $137C, $0001, $0F09 ; MOVE.B #$01,$0F09(A1)
dc.w $137C, $0001, $0F29 ; MOVE.B #$01,$0F29(A1)
dc.w $4229, $0F09 ; CLR.B $0F09(A1)
dc.w $4229, $0F29 ; CLR.B $0F29(A1)
dc.w $317C, $0001, $000A ; MOVE.W #$0001,$000A(A0)
dc.w $46DF ; MOVE (A7)+,SR
dc.w $4E75 ; RTS
SndVBLSize equ *-SndVBLTask ;
; The System 7.0 Tuner is not secure-switch friendly. So, we need to tell it to not apply the
; ÒputterÓ keyboard fixes. This routine is installed into the System heap as a Gestalt proc; it
; is not executed from within this file.
;
With GestaltSelectorFrame
FixKBFix
Link A6,#GSFSize ; Set up a Gestalt-style stackframe.
Move.l ResponsePtr(A6),A0 ; Get a pointer to the response variable.
Move.l #(1<<gestaltKeyboardFix),D0 ; Say that the keyboard fix is unnecessary.
Move.l D0,(A0) ; Return it.
Move.w #noErr,Result(A6) ; We donÕt need to return an error here.
Unlk A6 ; Clean up the stackframe.
Move.l (Sp)+,A0 ; Get the return address.
addq #GSFParamSize,Sp ; Do Pascal-stlye clean up.
Jmp (A0) ; Return to caller.
EndKBFix
Endwith
; On the sucky FSTN LCD Panels, we want to alert the System (for WDEFs, CDEFs, etcÉ) that they
; may not want to do deep gray drawing in wide areas. This routine is used as either
; a new Gestalt selector or a replacement if it already exists. It doesnÕt get called
; from within this file, so itÕs just data here.
;
With GestaltSelectorFrame
NewGraysFlicker
Link A6,#GSFSize ; Set up a Gestalt-style stackframe.
Lea OldGraysFlicker,A0 ; Point to the holder of the original response.
Move.l (A0),D0 ; Get that value.
Movea.l ResponsePtr(A6),A0 ; Get a pointer to the response variable.
Ori.l #(1<<0),D0 ; Say that the Slot 0 screen flickers.
Move.l D0,(A0) ; Return it.
Move.w #noErr,Result(A6) ; We donÕt need to return an error here.
Unlk A6 ; Clean up the stackframe.
Move.l (Sp)+,A0 ; Get the return address.
addq #GSFParamSize,Sp ; Do Pascal-stlye clean up.
Jmp (A0) ; Return to caller.
OldGraysFlicker Dc.l 0 ; Previous value.
EndNewGraysFlicker
Endwith
;---------------------------------------------------------------------
; Utils
;---------------------------------------------------------------------
;---------------------------------------------------------------------
;
; Routine: ChkScrn
;
; Inputs: D0.w - contains theDrHwID
;
; Outputs: None
;
; Destroys: A0-A2/D0-D1
;
; Function: Classically, the Monitors control panel writes out an
; 'scrn' resource that would flip us into 1bpp (i.e.,
; mode $80) on family mode changes. We attempt to
; solve that problem here by re-writing the appropriate
; value into the 'scrn' resource itself.
;
; Note: Because this is a shared SecondaryInit, we do all of
; this somewhat obscurely by using the ScrnInval (VidType)
; and VidMode lo-memory globals as a single word-sized
; value. It is the job of the individual PrimaryInits
; to write out the appropriate DrHwID if a family
; mode change has occurred since the last re-boot. Since
; all of our DrHwIDs are actually byte-sized, the ScrnInval
; byte is generally cleared, which keeps the ROM version
; of CheckDevicesInit from whacking us back into 1bpp.
; If this werenÕt a shared SecondaryInit we would (more
; appropriately) use Slot PRAM for this sort of thing.
;
; ScrnInval & VidMode arenÕt used during the boot-up
; process so this sort of hacking is okay.
;---------------------------------------------------------------------
With SInitStackFrame,SpBlock,ScrnRecord,SP_Params
ChkScrn Cmp.w ScrnInval,D0 ; If 'scrn' resource doesnÕt need validating by us,
Bne @EndScrn ; then just go on.
Move.w #-1,ScrnInval ; Clean up after ourselves.
; Check to see that Slot 0 video is actually runningÉ
;
Lea spBlk(A6),A0 ; Point to our spBlock.
Clr.b spId(A0) ; Begin at id 0.
Clr.b spTBMask(A0) ; No mask in search.
Move.w #catDisplay,spCategory(A0) ; Look for: Display,
Move.w #typVideo,spCType(A0) ; Video,
Move.w #drSwApple,spDrvrSW(A0) ; Apple,
Move.w D0,spDrvrHW(A0) ; <DrHwID>.
Clr.l spParamData(A0) ; Look only for enabled sRsrcs.
_GetTypeSRsrc ; If we didnÕt find ourselves,
Bne.s @EndScrn ; then just go on.
; Check to see if thereÕs an 'scrn' resource availableÉ
;
Clr.l -(Sp) ; Make room for the function result.
Move.l #'scrn',-(Sp) ; Push desired resource type.
Clr.w -(Sp) ; Resource ID = 0.
_GetResource ; Get the resource.
Move.l (Sp)+,D0 ; Get the resource handle.
Beq.s @EndScrn ; If nil, then just go on.
Move.l D0,-(Sp) ; Save Handle for _ReleaseResource call.
Movea.l D0,A2 ; Save it for easy access later on.
Movea.l D0,A0 ; Set up to lock it down for now.
_HNoPurge ; Make it non-purgeable andÉ
_HLock ; Élock it down.
; Check to see if weÕre in the 'scrn' resourceÉ
;
Movea.l (A0),A0 ; Get a pointer to the 'scrn' resource.
Move.w (A0)+,D0 ; Get the number of 'scrn' records to search.
Subq #1,D0 ; Make it zero-based.
@ScrnLoop Tst.w srSlot(A0) ; If this entry is for Slot 0,
Beq.s @ChkDrHwID ; then check the drHwID.
Adda.w #ScrnRecSize,A0 ; Otherwise, point A0 at the next entry.
Dbra D0,@ScrnLoop ; Loop until done.
Bra.s @EndScrnChk ; We couldnÕt find our 'scrn' entry, so just go on.
@ChkDrHwID Move.w theDrHwID(A6),D0 ; Get our drHwID back into D0.
Cmp.w srDrvrHW(A0),D0 ; If the drHwIDs donÕt match,
Bne.s @EndScrnChk ; then just go on.
; Make sure the depth (mode) setting is correctÉ
;
Lea sPRAMBlk(A6),A1 ; Point to our sPRAM block.
Moveq #0,D0 ; Clear D0 for good measure.
Move.b SP_Depth(A1),D0 ; Get the mode weÕd like to be at.
Cmp.w srMode(A0),D0 ; If the modes match,
Beq.s @EndScrnChk ; then just go on.
Move.w D0,srMode(A0) ; Otherwise, write out what we want.
Move.l A2,-(Sp) ; Set up to mark our change.
_ChangedResource ; Do it.
Move.l A2,-(Sp) ; Set up to write our change out.
_WriteResource ; Do it.
; Clean up and go homeÉ
;
@EndScrnChk _ReleaseResource ; Release the ÔscrnÕ resource.
@EndScrn Rts ; And return home.
Endwith
;---------------------------------------------------------------------
; Main
;---------------------------------------------------------------------
With SInitStackFrame,SEBlock,SpBlock
BeginSecondaryInit
Link A6,#SInitStackSize ; Allocate some space on the stack.
Move.w #seSuccess,seStatus(A0) ; No reason to fail here.
; Perform some generic intializations.
Clr.b spBlk.spSlot(A6) ; This is always a slot 0 SecondaryInit.
Clr.b spBlk.spExtDev(A6) ; DonÕt ask why, always clear this guy.
With ProductInfo,VideoInfo,SP_Params
Lea spBlk(A6),A0 ; Point to our spBlock.
Lea sPRAMBlk(A6),A2 ; Point to a sPRAM block.
Move.l A2,spResult(A0) ; Set up read buffer.
_sReadPRAMRec ; Read Slot 0Õs pRAM.
Movea.l UnivInfoPtr,A0 ; Point to the ProductInfo record.
Adda.l VideoInfoPtr(A0),A0 ; Point to the VideoInfo record.
Move.w DrvrHwID(A0),D0 ; Get the DrHwID.
Move.w D0,theDrHwID(A6) ; Remember it for later.
Move.b BoardSRsrcID(A0),theBoardID(A6) ; Remember the board ID.
Endwith
; For built-in videoÕs that support it, go seek out and cleanse the 'scrn' resource if it is
; invalid. Note: This is generally used to prevent family-mode swapping from forcing the
; screen back to 1bpp due to a historical oversight on the part of the Monitors control
; panel.
;
Bsr.s ChkScrn ; D0.w contains theDrHwID.
; We canÕt read the keyboard without lots of non-generic stuff during PrimaryInit, so we do that
; here. The reason we are doing this is to temporarily disable the type-6 multimode support.
; To be consistent with the System, we use the shift key to disable.
;
With SP_Params,SpBlock
Cmpi.w #drHwDAFB,theDrHwID(A6) ; If weÕre using the DAFB driver,
Beq.s @AltSense ; then do the AltSense stuff.
Cmpi.w #drHwSonora,theDrHwID(A6) ; If weÕre using the Sonora driver,
Beq.s @AltSense ; then do the AltSense stuff.
Bra.s @EndAltSense ; Otherwise, keep going.
@AltSense Lea sPRAMBlk(A6),A2 ; Point to a sPRAM block.
Lea spBlk(A6),A0 ; Point to our spBlock.
Move.b SP_AltSense(A2),D0 ; Get the alternate senseID pRAM byte into D0.
Move.b D0,D4 ; Save it for later.
Andi.b #spAltSenseValidMask,D0 ; If the alternate senseID is not valid,
Beq.s @ChkForRestore ; just go on.
Movem.l KeyMap,D0-D3 ; Get the KeyMap.
Bclr #7,D3 ; Clear off the power key.
Bclr #1,D1 ; Clear off capslock key.
Bclr #0,D1 ; Clear off and test the shift key.
Beq.s @EndAltSense ; DonÕt disable if shift key is not held down.
Or.l D1,D0 ; Also, donÕt disable if
Or.l D2,D0 ; various other stray
Or.l D3,D0 ; keys are being.
Bne.s @EndAltSense ; held down
Move.b D4,D0 ; Get the alternate senseID pRAM byte again.
Andi.b #spAltSenseMask,D0 ; Strip off the validation code.
Ori.b #spAltSenseDisable,D0 ; Temporarily disable the alternate senseID.
Move.b D0,SP_AltSense(A2) ;
Move.l A2,spsPointer(A0) ; Set up parameter block.
_sPutPRAMRec ; Write pRAM out.
_SDRestart ; Restart the machine.
@ChkForRestore Move.b D4,D0 ; Get the alternate senseID pRAM byte again.
Andi.b #spAltSenseDisable,D0 ; If it is not the temporary disable code,
Beq.s @EndAltSense ; then just go on.
Move.b D4,D0 ; Get the alternate senseID pRAM byte again.
Andi.b #spAltSenseMask,D0 ; Strip off the validation bits.
Ori.b #spAltSenseValidMask,D0 ; Re-validate the alternate senseID byte.
Move.b D0,SP_AltSense(A2) ;
Move.l A2,spsPointer(A0) ; Set up parameter block.
_sPutPRAMRec ; Write pRAM out.
EndWith
@EndAltSense
; We only want the following to execute on CPUs with caboose keyswitches. We are telling the
; System 7 Tuner to not load itÕs secure-mode unfriendly version of the Keyboard fixes.
;
; Note: The method used below to ÒfixÓ the System 7 Tuner is actually incomplete. We really
; should check to see if the gestaltBugFixAttrs selector actually exists, and if so, use
; _ReplaceGestalt to OR-in the fact that we donÕt want the keyboard fix (gestaltKeyboardFix)
; to be applied. Instead, we ÒknowÓ that if the gestaltBugFixAttrs does exist, then the
; problem we are addressing here must have already been fixed.
Move.l #KeySwMask,D0 ; Get isolation mask ready. <4>
And.l UnivROMFlags,D0 ; Grab keyswitch bits in UnivROMFlags. <4>
Sub.l #KeyswCaboose,D0 ; Do we have a Keyswitch? <4>
Bne.s @EndKBFixes ; No, skip keyboard fixes. <4>
Move.l #gestaltBugFixAttrs,D0 ; Setup to load the bug-fix selector.
_Gestalt ; Try to load it.
Beq.s @EndKBFixes ; If itÕs there, assume itÕs okay.
Lea FixKBFix,A1 ; Point to the beginning of the keyboard fix.
Lea EndKBFix,A0 ; Point to the end of the keyboard fix.
Sub.l A1,A0 ; Determine the keyboard fix size.
Move.l A0,D0 ; Set up for _NewPtr (size in D0).
Move.l D0,D1 ; Save the size for BlockMove.
_NewPtr Sys ; Attempt to get a block in the System heap.
Bne.s @EndKBFixes ; If failed, just go on.
Lea FixKBFix,A1 ; Otherwise, point back at keyboard fix.
Exg A0,A1 ; Set up for BlockMove (A0=Src,A1=Dest).
Move.l D1,D0 ; D0 is size of block to move.
_BlockMove ; Do it.
Move.l A1,D2 ; Save System heap address for later if necessary.
Move.l #gestaltBugFixAttrs,D0 ; Setup to install bug-fix selector.
Exg A1,A0 ; Point to keyboard fix in System heap.
_NewGestalt ; Do it.
@ChkForErr Beq.s @EndKBFixes ; If the call worked, just go on.
Movea.l D2,A0 ; Otherwise, point to System heap code.
_DisposPtr ; And throw it away.
@EndKBFixes
; There are two parts to the following pieces of code. For the first piece, we want to execute on the
; Quadra 950 and the Wombat-class machines running the System 7.0.1 version of the Sound Manager.
; Supposed, the problem that this code addresses will be fixed in Cube-E. For the second piece,
; we only want to run on the Qudara 950.
;
kSndMgrVersion EQU $02018000 ; System 7.0.1 Version of the Sound Manager.
TestFor djMEMCChipBit ; If weÕre on a Wombat-class CPU, then
Bne.s @StrtSndFix ; apply this fix.
cmpi.b #boxQuadra950,BoxFlag ; are we a Quadra 950?
Bne.s @EndSoundFixes ; nope ... we're outta here
@StrtSndFix
clr.l -(sp) ; make room for PASCAL return value
_SndSoundManagerVersion ; get current soundMgr version
move.l (sp)+,d0 ; retrieve returned value
cmpi.l #kSndMgrVersion,d0 ; are we the 7.0.1 soundmgr?
bne.s @EndSoundFixes ; nope ... we're outta here
;
; This will go and hunt down the Sound VBL Task and kill it. The reason for that is
; that in the Zydeco ROM, the "problem" this attempted to fix is fixed for real, so
; this VBL is no longer needed.
move sr,-(a7) ; save the status register
ori.w #$0100,sr ; mask off vbl interrupts
lea VBLQueue,a1 ; A1 points to the queue
lea qHead-vblink(a1),a0 ; setup to fetch head of list
@VBLloop move.l vblink(a0),d0 ; advance to next block
beq.s @VBLDone ; if queue is empty, exit
movea.l d0,a0 ; get pointer to next VBL control block
move.l vblAddr(a0),a1 ; get pointer to their code
lea SndVBLTask,a2 ; get pointer to our code
move.w #(SndVBLSize/2-1),d0 ; size of code
@checkLoop cmp.w (a1)+,(a2)+ ; compare source bytes
dbne d0,@checkLoop ; until not equal or out of bytes to check
bne.s @VBLloop ; not found - keep looking
_VRemove ; REMOVE the VBL
@VBLDone move (a7)+,sr ; restore interrupts
; We also want to UNpatch the InputSelect routine for the Quadra 950, since it
; shouldn't have been patched out in 7.0.1 ANYWAY, and we fixed a problem in the
; Q950 ROM routine, so we should use that one.
cmpi.b #boxQuadra950,BoxFlag ; are we a Quadra 950?
bne.s @EndSoundFixes ; nope ... we're outta here
With ExpandMemRec,ProductInfo
Move.l UnivInfoPtr,A0 ; Point to the ProductInfo table.
Adda.l SndControlPtr(A0),A0 ; Point to the sound primitives.
Adda.l sndInputSelect*4(A0),A0 ; Point to the input-select routine.
Move.l A0,D0 ; Save pointer.
movea.l expandMem,a0 ; get base of ExpandMemRec
movea.l emSndPrimitives(a0),a0 ; get base of SoundMgr Primitives Tbl
move.l D0,sndInputSelect*4(a0) ; replace input select mechanism with ROM one
Endwith
@EndSoundFixes
; The Standard WDEF that shipped in the gybly for the Darts and DBLite had a fix which explicitely
; looked for the GSC hardware and then for a particular kind of screen. WeÕre replacing that
; kind of thing with a Gestalt call that returns whether or not the screen sucks. We do that
; here. Since the Darts and DBLite have already shipped, we donÕt include them here.
;
; Note: If weÕre on an Escher/Yeager and weÕre docked to an Atlantis or DuoDock, then weÕve already
; shut the CSC down at this point, and weÕll get a bus error if we try to talk to it. So,
; we first check to see if the CSC has been reset or not. If it hasnÕt, then we just skip
; all this.
;
With ProductInfo,DecoderInfo
Cmpi.w #drHwCSC,theDrHwID(A6) ; If weÕre not using the CSC driver,
Bne @EndScreenSucks ; then just leave.
Movea.l UnivInfoPtr,A0 ; Point to the ProductInfo table.
Adda.l DecoderInfoPtr(A0),A0 ; Point to the base address table.
TestFor MSCChipBit ; If we have an MSC,
Bne.s @MSC ; then hop to it.
TestFor PrattExists ; If we have a Pratt,
Bne.s @Pratt ; then hop to it.
Bra.s @EndScreenSucks ; Otherwise, just leave.
@MSC Movea.l RBVAddr(A0),A1 ; Point to the MSCÕs base address.
Btst #MSCLCDReset,MSCClkCntl(A1) ; If CSC hasnÕt been reset,
Beq.s @EndScreenSucks ; then just leave.
Movea.l VDACAddr(A0),A1 ; Point to the CSC base address.
Move.b CSCPanelID(A1),D0 ; Read the panel ID.
Cmpi.b #isG_D_STN_640x400,D0 ; If weÕre are using the sucky screen,
Beq.s @FixIt ; then say so.
Bra.s @EndScreenSucks ; Otherwise, just leave.
@Pratt Movea.l VDACAddr(A0),A1 ; Point to the CSC base address.
Move.b CSCPanelID(A1),D0 ; Read the panel ID.
Cmpi.b #isG_D_STN_640x480,D0 ; If we arenÕt using the sucky screen,
Bne.s @EndScreenSucks ; then just leave.
@FixIt Moveq #0,D2 ; Assume we wonÕt be replacing the selector.
Move.l #gestaltGraysFlicker,D0 ; Setup to load the sucky-screen selector.
_Gestalt ; If itÕs not already loaded, then
Bne.s @AddInNew ; just add it in.
Lea OldGraysFlicker,A1 ; Point to the old-response value holder.
Move.l A0,(A1) ; Fill it up with the old response.
Moveq #1,D2 ; Remember that weÕll be replacing.
@AddInNew Lea NewGraysFlicker,A1 ; Point to the beginning of the flicker code.
Lea EndNewGraysFlicker,A0 ; Point to its end.
Sub.l A1,A0 ; Determine the size.
Move.l A0,D0 ; Set up for _NewPtr (size in D0).
Move.l D0,D1 ; Save the size for BlockMove.
_NewPtr Sys ; Attempt to get a block in the System heap.
Bne.s @EndScreenSucks ; If failed, just go on.
Lea NewGraysFlicker,A1 ; Otherwise, point back at the code.
Exg A0,A1 ; Set up for BlockMove (A0=Src,A1=Dest).
Move.l D1,D0 ; D0 is size of block to move.
_BlockMove ; Do it.
Move.l A1,D3 ; Save System heap address for later if necessary.
Move.l #gestaltGraysFlicker,D0 ; Setup to install the new/replacement selector.
Exg A1,A0 ; Point to the code in the System heap.
Tst.l D2 ; If weÕre supposed to be replacing,
Bne.s @ReplaceIt ; then call the replacement trap.
_NewGestalt ; Otherwise, call new.
Bra.s @ChkForErr ; See if there was an error.
@ReplaceIt _ReplaceGestalt ; Call replace.
@ChkForErr Beq.s @EndScreenSucks ; If the call worked, just go on.
Movea.l D3,A0 ; Otherwise, point to System heap code.
_DisposPtr ; And throw it away.
@EndScreenSucks
Endwith
;---------------------------------------------------------------------
;
; <H5> Call Powermanager Secondary Init. Power manager uses this entry point
; to execute code which MUST be run after patches.
;
IF hasPwrControls THEN
PowerMgr2Init
IF isUniversal THEN
TestFor hwCbPwrMgr ; check for power manager
beq.s @exitPwrMgr ; if no pmgr skip
ENDIF
With PowerDispRec,PMgrHookDispRec
moveq #((PSecondaryInit << 16) | \; secondary init selector <H8>
(PMgrHookDisp << 0)),d0 ; call pmgr hook <H8>
_PowerDispatch ; call power manager
Endwith
@exitPwrMgr
ENDIF
Unlk A6 ; Restore link.
Rts ; Go home.
_EndsSecondaryInitRec
ENDP
END

112
DeclData/SuperInit.a Normal file
View File

@ -0,0 +1,112 @@
;
; File: SuperInit.a
;
; Written by: Mike Puckett, October 28, 1991.
;
; Contains: The code that determines which sRsrc directory directory
; to select.
;
; Copyright: © 1991-1992 by Apple Computer, Inc., all rights reserved.
;
; This file is used in these builds: Mac32
;
; Change History (most recent first):
;
; <SM2> 10/28/92 SWC Changed VideoEqu.a->Video.a and ShutdownEqu.a->Shutdown.a.
; <1> 10/6/92 GDW New location for ROMLink tool.
; <SM2> 6/4/92 KW (jmp,H7) Changed the ÒsRsrcZydecoDirÓ name to the more generic
; ÒsRsrcBFBasedDirÓ (BF=BoxFlag) name.
; <SM1> 5/2/92 kc Roll in Horror. Comments follow:
; <H6> 01/11/92 jmp Eliminated the dependencies on BoxFlag.
; <H5> 12/16/91 HJR Fix header.
; <H3> 12/12/91 jmp Added support for DBLiteLC.
; <H2> 11/27/91 jmp Added support for Sonora-based machines.
; <1> 10/29/91 jmp first checked in
;---------------------------------------------------------------------
; Notes
;---------------------------------------------------------------------
; In an effort to keep things simple (yet eliminate the use of BoxFlag),
; the VideoInfo data structure has been modified to contain two new
; fields. One of these fields contains the particular sRsrc directory
; directory (or Super sRsrc directory) to select. However, some CPUs
; donÕt have built-in video (e.g., the IIfx), so, by definition, those
; CPUs should be placed into the BoxFlag-based sRsrc directory. The other
; field is a Òway outÓ in cases where BoxFlag is necessary -- i.e., it
; contains the BoardSRsrcID. For CPUs that fall into the BoxFlag-based
; sRsrc directory, this field is just zero, indicating that the
; board sRsrc is a derivative of BoxFlag. Where the BoardSRsrcID
; field of VideoInfo is non-zero, this is the board sRsrc ID of
; particular family of CPUs using the same video controller.
;---------------------------------------------------------------------
STRING C
PRINT OFF
LOAD 'StandardEqu.d'
INCLUDE 'DockingEqu.a'
INCLUDE 'EgretEqu.a'
INCLUDE 'GestaltEqu.a'
INCLUDE 'GestaltPrivateEqu.a'
INCLUDE 'HardwarePrivateEqu.a'
INCLUDE 'IOPrimitiveEqu.a'
INCLUDE 'PowerPrivEqu.a'
INCLUDE 'ROMEqu.a'
INCLUDE 'Video.a'
INCLUDE 'SlotMgrEqu.a'
INCLUDE 'ShutDown.a'
INCLUDE 'SonicEqu.a'
INCLUDE 'UniversalEqu.a'
INCLUDE 'DepVideoEqu.a'
PRINT ON
SEG '_sSuperInitRec'
MACHINE MC68020
;---------------------------------------------------------------------
; Header
;---------------------------------------------------------------------
lSuperInit PROC
Dc.b sExec2 ; Header
Dc.b sCPU68020
Dc.w 0
Dc.l BeginSuperInit-*
;---------------------------------------------------------------------
; Local variables, definitions, etc....
;---------------------------------------------------------------------
;---------------------------------------------------------------------
; Data
;---------------------------------------------------------------------
;---------------------------------------------------------------------
; Main
;---------------------------------------------------------------------
With SEBlock,ProductInfo,VideoInfo
BeginSuperInit
Clr.w seStatus(A0) ; Flag that there are no problems (zero in hi-byte of seStatus).
Move.b #sRsrcBFBasedDir,D0 ; Just assume the BoxFlag-based sRsrc directory for now.
Move.l UnivInfoPtr,A1 ; Get a pointer to the Universal Info.
Adda.l VideoInfoPtr(A1),A1 ; Point to the VideoInfo.
Cmpa.l #0,A1 ; If there is no VideoInfo record,
Beq.s @Done ; then weÕre done.
Move.b SuperSRsrcDirID(A1),D0 ; Otherwise, use the defined Super sRsrcDir ID.
@Done Move.b D0,seStatus+1(A0) ; Return the super sRsrc directory id.
Rts ; Go home.
EndWith
_EndsSuperInitRec
ENDP
END

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,53 @@
#
# File: VideoDrivers.make
#
# Contains: Makefile for Video.
#
# Written by: Kurt Clark, Chas Spillar, and Tim Nichols
#
# Copyright: © 1992-1993 by Apple Computer, Inc., all rights reserved.
#
# Change History (most recent first):
#
# <SM5> 12/13/93 PN Roll in Kaos and Horror to add support for AJ and Malcom
# machines
# <SM6> 09-23-93 jmp Added GestaltEqu.a to SonoraÕs dependency list.
# <SM5> 9/9/93 pdw Added slots.a to dependencies.
# <SM4> 08-03-93 jmp Added various necessary dependencies that werenÕt previously
# spelled out.
# <SM3> 6/14/93 kc Roll in Ludwig.
# <LW5> 5/19/93 fau Added CivicPict2 to the DeclVideo.rsrc and made Rez use a -t and
# -c options.
# <LW4> 4/30/93 fau Added CivicPict to the DeclDataVideo.rsrc
# <LW3> 4/27/93 fau W/r to Bug #1081554, I updated the dependencies of the video
# drivers to include the actual source files!
# <LW2> 2/16/93 fau Added CivicPrimaryInit dependency to CivicDriver.
# <SM2> 3/31/93 kc Delete duplicate definition of VideoDir.
# <SM2> 01-12-93 jmp Added support for CSC.
VSCVideoDir = {DeclDir}VSCDeclData:
CommonHeaders = "{ObjDir}StandardEqu.d" ¶
"{IntAIncludes}HardwarePrivateEqu.a" ¶
"{AIncludes}ROMEqu.a" ¶
"{AIncludes}Video.a" ¶
"{IntAIncludes}SlotMgrEqu.a" ¶
"{AIncludes}Slots.a" ¶
"{IntAIncludes}UniversalEqu.a" ¶
"{IntAIncludes}DepVideoEqu.a"
#
# DeclData
#
"{RsrcDir}VSCDriver.rsrc" Ä "{ObjDir}VSCDeclData.a.o" "{VSCVideoDir}VSCDeclData.make"
link {StdLOpts} {StdAlign} -rt decl=1 "{ObjDir}VSCDeclData.a.o" -o "{RsrcDir}VSCDriver.rsrc"
"{ObjDir}VSCDeclData.a.o" Ä "{VSCVideoDir}VSCDriver.a" ¶
"{VSCVideoDir}VSCPrimaryInit.a" ¶
"{VSCVideoDir}VSCDockingHandler.a" ¶
"{VSCVideoDir}VSCDeclData.a" ¶
{CommonHeaders}
Asm {StdAOpts} -o "{ObjDir}VSCDeclData.a.o" "{VSCVideoDir}VSCDeclData.a"

View File

@ -0,0 +1,831 @@
;
; File: VSCDockingHandler.a
;
; Contains: a docking handler to support Dartanian's built-in VSC video
;
; Written by: Steve Christensen, Helder Ramalho, Dave Wong, Andy Gong (anyone else?)
; Rewritten: Mike Puckett, July 15, 1993.
; Copyright: © 1992-1993 by Apple Computer, Inc. All rights reserved.
;
; Change History (most recent first):
;
; <SM2> 12/13/93 PN Roll in KAOs and Horror changes to support Malcom and AJ
; machines
; <1> 12-04-92 jmp first checked in
; ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
; Pre-SuperMario comments begin here.
; ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
; <H2> 6/1/92 HJR Fix Header.
; <H1> 6/1/92 HJR first checked in
VidLowPwrFrame Record 0, Decrement
VidLowPwrCntBlk Ds.b IOVQElSize ; control call parm block
VidLowPwrVDPageInfo Ds.b VDPageInfo ; params
VidLowPwrFrameSize Equ * ; size of frame
Endr
;__________________________________________________________________________________________________
;
; FUNCTION DockSelect(selector:OSType; params:LONGINT):LONGINT;
;
; Control/info handler for Dartanian/BlackBird.
; - selector is the index into the docking handler tables
; - params is any required input parameter
;
; DockSelect returns the result of the selector.
;
; Trashes: D0-D2, A0-A1
;__________________________________________________________________________________________________
DockSelect
Move.l (Sp)+,D2 ; Pop the return addressÉ
Movea.l (Sp)+,A0 ; Éand the input params
Move.l (Sp)+,D0 ; Éand the selector.
Lea SelectorTable-4,A1 ; Point to the start of the table.
@FindStatSelector
Addq #4,A1 ; Skip over the previous function result.
Move.l (A1)+,D1 ; If weÕre at the end of the function table,
Beq.s @FindCtlSelector ; then check the other one.
Cmp.l D1,D0 ; If this isnÕt the right selector,
Bne.s @FindStatSelector ; then keep looking.
Move.l (A1),D1 ; Get the function result into D1.
@Done Move.l D1,(Sp) ; Stuff the funtion result onto the stack.
Movea.l D2,A0 ; Restore the return address.
Jmp (A0) ; And return.
@FindCtlSelector
Addq #4,A1 ; Skip over the function result/routine offset.
Move.l (A1)+,D1 ; If weÕre at the end of this table,
Beq.s @Done ; then we just leave.
Cmp.l D1,D0 ; If this isnÕt the right selector,
Bne.s @FindCtlSelector ; then keep looking.
Adda.l (A1),A1 ; Get offset to routine.
Jsr (A1) ; Jump to it.
Move.l D0,D1 ; Copy result.
Bra.s @Done ; Vamoose.
SelectorTable
; Selector Function result
; -------- ---------------
;
Dc.l dockSCCPorts, ((1<<dockSCCModemPort)|\ ; Modem port is available.
(0<<dockSCCPrinterPort)) ; Printer port isnÕt available.
Dc.l dockROMVersion ; Set the ROMÉ
Dc.b $02,$00,$40,1 ; Éversion number.
Dc.l 0, 0 ; -- EOT --
; Selector Routine Offset
; -------- --------------
;
Dc.l dockHardwareAttr, HardwareStuff - * - 4 ; Determine HardwareStuff.
Dc.l dockDockingAttr, DockingStuff - * - 4 ; Determine DockingStuff.
Dc.l dockSCCReadAddr, GetSCCReadAddr - * - 4 ; Get the SCC read address.
Dc.l dockSCCWriteAddr, GetSCCWriteAddr - * - 4 ; Get the SCC write address.
Dc.l dockSCSIDiskMode, SDMStatus - * - 4 ; Determine status of SCSIDiskMode (SDM).
Dc.l dockNuBusConnectors, NuBusStuff - * - 4 ; Determine whether we should return Slot #0 or not.
Dc.l dockInit, InitStuff - * - 4 ; Perform early/wake initializations.
Dc.l dockSleepSave, SleepStuff - * - 4 ; Sleep Õem.
Dc.l dockWakeupRestore, WakeupStuff - * - 4 ; Wake Õem.
Dc.l dockFlush, FlushStuff - * - 4 ; Wipe Õem.
Dc.l 0, 0 ; -- EOT --
;----------------------------------------------------------------------------------
;
; HardwareStuff - routine to determine hardware attributes (status call)
;
; Inputs - A0: input parameter (none defined for this call)
;
; Outputs - D0: hardware attributes
;
;----------------------------------------------------------------------------------
HardwareStuff
Move.l #((1<<dockHasSCC)|\ ; Say the we always have SCC forÉ
(1<<dockWakeSCC)|\ ; Éugly historical hack reasons.
(1<<dockWakeVideo)),D0 ; Internal and/or external video will always be available on wake.
; For this handler, the only thing that can change (and that we can do anything
; about) is video. So, those are the only bits we really deal with here.
;
Btst #vscVideoPower,VSCBase+vscClockPower ; If the video plane is currently powered off,
Beq.s @EndVidChk ; then just go on.
Ori.l #(1<<dockHasVideo),D0 ; Otherwise, say external video is powered.
@EndVidChk
Rts
;----------------------------------------------------------------------------------
;
; DockingStuff - routine to determine docking attributes (status call)
;
; Inputs - A0: input parameter (none defined for this call)
;
; Outputs - D0: docking attributes
;
;----------------------------------------------------------------------------------
DockingStuff
; Return that we can always wake up and that we can always sleep. Also, always
; return that we can PowerCycle, that we can always use the LCD screen, and
; that we are not a dockingStation.
;
Moveq #((0<<dockNoSleep) |\
(0<<dockNoWakeup) |\
(0<<dockNoPowerCycle) |\
(0<<dockNoLCDScreen) |\
(0<<dockingStation)),D0
Rts
;----------------------------------------------------------------------------------
;
; GetSCCRead/WriteAddr - routine to return the SCC read and write addresses.
;
; Inputs - None
;
; Outputs - D0: The SCC read/write address.
;
; Note: We shouldnÕt have to deal with the SCC ports in this handler, but
; the single-port arbitration stuff relies solely on the Docking
; Handler. Strickly speaking, this Docking Handler is only for
; the built-in external video. Ugh!
;
;----------------------------------------------------------------------------------
GetSCCReadAddr
Move.l SCCRd,D0 ; Return the SCC read address.
Rts
GetSCCWriteAddr
Move.l SCCWr,D0 ; Return the SCC write address.
Rts
;----------------------------------------------------------------------------------
;
; SDMStatus - routine to SCSI Disk Mode (status call)
;
; Inputs - A0: input parameter (meaningless for status calls)
;
; Outputs - D0: SCSI Disk Mode status
;
; Note: This probably shouldnÕt be here, but it is. This handler is
; supposed to only have to deal with video. Hack, hack, hack.
;
;----------------------------------------------------------------------------------
SDMStatus
Moveq #((1<<dockSDMExists)|\ ; Say that we support SDM.
(0<<dockSDMCable)),D0 ; Default to no cable.
Movea.l VIA,A0 ; Point to the VIA.
Moveq #1<<vSDMCable,D1 ; Mask off the cable sense bit.
And.b vBufB(A0),D1 ; Get it.
Btst #vSDMCable,D1 ; If thereÕs no cable attached,
Bne.s @Finished ; then just go on.
Addq.b #(1<<dockSDMCable),D0 ; Otherwise, say itÕs present.
@Finished Rts
;----------------------------------------------------------------------------------
;
; NuBusStuff - routine to do return NuBus ÒconnectorsÓ (status call)
;
; Inputs - none
;
; Outputs - returns none or Slot 0
;
;----------------------------------------------------------------------------------
;
With PmgrPramRec
NuBusStuff
Moveq #VidMode,D0 ; Say that we want the VidMode byte.
Bsr ReadPMgrPRAM ; Get it.
Bne.s @DoSlot0 ; If weÕre supposed to return Slot #0, then do so.
Moveq #0,D0 ; Otherwise, donÕt.
Bra.s @Finished ;
@DoSlot0 Moveq #(1<<dockSlot0),D0 ; Say we need to redo Slot #0.
@Finished Rts
Endwith
;----------------------------------------------------------------------------------
;
; InitStuff - routine to do docking initialization (control call)
;
; Inputs - a0: input parameter, indicates sleep wakeup or normal init
;
; Outputs - d0: will return zero at init time; will return non-zero
; on wakeup if the world has changed
;
;----------------------------------------------------------------------------------
;
InitStuff
Move.l A0,D0 ; Get the input flags.
Btst #dockWorldChanged,D0 ; If we got the early wake-up call,
Bne.s @CheckWorld ; then go check the world.
Btst #dockWakeupInit,D0 ; If weÕre simply waking up, then
Bne.s @Done ; just leave.
Bsr DetectExtDisplay ; Otherwise, go look for an ext. display.
@Done Moveq #0,D0 ; Say that we were successful.
Rts ; And vamoose.
; Generally speaking, the Docking Manager wants to know if ÒbulkÓ changes have occurred. In
; our case, bulk changes never occur (that is, the ÒbarÓ is permenantly attatched). So,
; we just want to find out if paticular changes have occurred. Specifically, we want
; to know if the state of the int./ext. video has changed. And, if so, we report this
; information back to the Docking Manager.
;
With PmgrPramRec
@CheckWorld
Bsr DetectExtDisplay ; Go look for an ext. display.
Lea ExtVidState,A0 ; Point to the ext. save-state variable.
Cmp.w (A0),D0 ; If the ext. world hasnÕt changed, then
Beq.s @ChkInt ; check the int. world.
Bra.s @ForceInt ; Otherwise, force the DockingMgr to deal w/Slot #0.
; If we got here, then the external display state hasnÕt changed. So, before we simply tell
; tell the Docking Manager to do nothing, we check to see if the internal display
; state has changed. We do this by comparing the state of the lid with the state
; of the built-in internal video. If the state of the lid matches the state
; of built-in internal video (e.g., lid down and video off), then we simply tell
; the docking manager to do nothing. However, if the state of the lid does
; not match the state of built-in internal video (e.g., lid up and video off),
; then we tell the Docking Manager to go change the world. We also pass this information
; back to ourselves (via PowerMgr pRAM).
;
@ChkInt Bsr GetLidState ; Get the state of the lid.
Move.b D0,-(Sp) ; Save the state.
Moveq #0,D0 ; Say we want Slot #0
Move.w #drHwCSC,D0 ; Say we want CSC.
Swap D0 ; Set up for call.
Bsr GetSlotDevRefNum ; Do it.
Ext.l D0 ; Normalize result into hiword.
Swap D0 ; Get hiword into loword.
Cmp.b (Sp)+,D0 ; If lidState == vidState, then
Beq.s @Done ; just leave.
@ForceInt Moveq #VidMode,D0 ; Say we want to write the VidMode byte.
Moveq #-1,D1 ; Set the redo-slot-0 flag.
Bsr WritePMgrPRAM ; Do it.
Moveq #(1<<dockWorldChanged),D0 ; Say the world changed.
Rts
Endwith
;----------------------------------------------------------------------------------
;
; SleepStuff - routine to save bar's hardware state (control call)
;
; Inputs - none
;
; Outputs - D0: pointer to hardware state, or error flag (-1)
;
;----------------------------------------------------------------------------------
With VDPageInfo,VidLowPwrFrame
SleepStuff
Lea ExtVidState,A0 ; Point to the ext. save-state variable.
Move.w #indexedNoConnect,(A0) ; Assume nobodyÕs home.
Link A6,#VidLowPwrFrameSize ; Allocate some local storage on the stack.
; Get a the external driverÕs refNum if itÕs around.
;
Clr.l -(Sp) ; Make room for docking result.
Move.l #dockDockingSlot,-(Sp) ; Say we want the docking slot number.
Clr.l -(Sp) ; No params.
_DockingDispatch ; Call the Docking Manager.
Move.l (Sp)+,D0 ; Get the docking slot number into D0.
Swap D0 ; Save it.
Move.w #drHwVSC,D0 ; Get the drHwID.
Swap D0 ; Set up for utility call.
Bsr GetSlotDevRefNum ; If ext. video is not around,
Beq.s @NoExtVid ; then donÕt call it.
; Call video driver to power down VSCÉ
;
Lea VidLowPwrCntBlk(A6),A0 ; Point to parameter block space.
Move.w D0,ioRefNum(A0) ; Load the driver refNum.
Clr.w ioVRefNum(A0) ; No driver vRefNum.
Move.w #cscSleepWake,csCode(A0) ; Set up for cscSleepWake.
Lea VidLowPwrVDPageInfo(a6),a1 ; Point to the csParam record.
Move.l A1,csParam(A0) ; Load it.
Clr.w csMode(A1) ; Set mode to sleep the VSC.
_Control ; Do it.
Beq.s @Finished ; If successful, then go on.
@NoExtVid Moveq #-1,D0 ; Otherwise, return failure.
Bra.s @Done ; And leave.
@Finished Moveq #0,D0 ; We didnÕt need any special storage.
Lea ExtVidState,A0 ; Point to the save-state variable.
Move.w csMode(A1),(A0) ; Save the state.
@Done Unlk A6 ; Release our stack frame.
Rts
Endwith
;----------------------------------------------------------------------------------
;
; WakeupStuff - routine to do docking cleanup (control call)
;
; Inputs - A0: pointer to hardware state, or error flag (-1)
;
; Outputs - D0: wakeup result (always zero)
;
;----------------------------------------------------------------------------------
With VDPageInfo,VDSetEntryRecord,VidLowPwrFrame
WakeupStuff
Move.l A0,D0 ; Get status from sleep.
Cmpi.l #-1,D0 ; If we failed to sleep,
Beq @Done ; then just leave.
Lea ExtVidState,A0 ; Point to the ext. save-state variable.
Cmpi.w #indexedNoConnect,(A0) ; If the world changed (or nobodyÕs home),
Beq @Done ; then just leave.
Link A6,#VidLowPwrFrameSize ; Allocate some local storage on the stack.
; Get a the external driverÕs refNum if itÕs around.
;
Move.w #drHwVSC,D0 ; Get the drHwID for VSC.
Swap D0 ; Save it.
Move.w #dockSlotE,D0 ; Get the slot number. (We could call the Docking Manager, but why?)
Bsr GetSlotDevRefNum ; If ext. video is not around (shouldnÕt happen),
Beq.s @Finished ; then donÕt call it.
; Call video driver to power up VSCÉ
;
Lea VidLowPwrCntBlk(A6),A0 ; Point to parameter block space.
Move.w D0,ioRefNum(A0) ; Load the driver refNum.
Clr.w ioVRefNum(A0) ; No driver vRefNum.
Move.w #cscSleepWake,csCode(A0) ; Set up for cscSleepWake.
Lea VidLowPwrVDPageInfo(A6),A1 ; Point to the csParam record.
Move.l A1,csParam(A0) ; Load it.
Move.w #-1,csMode(A1) ; Set mode to wake up the VSC.
_Control ; If we failed to wake up,
Bne.s @Finished ; then just leave.
Move.w ioRefNum(A0),D0 ; Get the driverÕs refNum.
Movea.l Devicelist,A2 ; Get the DeviceList Handle.
Movea.l (A2),A2 ; Make it a pointer.
@DevLoop Cmp.w gdRefNum(A2),D0 ; If this is the right gDevice,
Beq.s @SetEm ; then call SetEntries.
Move.l gdNextGD(A2),D1 ; Otherwise, get the next gDevice.
Beq.s @Finished ; If itÕs nil, then weÕre done.
Movea.l D1,A2 ; Otherwise, copy the gDevice Handle.
Movea.l (A2),A2 ; Make it a pointer.
Bra.s @DevLoop ; Loop until done.
@SetEm Movea.l gdPMap(A2),A2 ; Get the gDeviceÕs pixMapÕsÉ
Movea.l (A2),A2 ; Écurrent colorTable.
Movea.l pmTable(A2),A2 ; (If this were a direct device, weÕd punt here.)
Move.l A0,D1 ; Save the ioPB ptr.
Movea.l A2,A0 ; Set up toÉ
_HLock ; Élock down the colorTable.
Move.l A0,-(Sp) ; Save the Handle for _HUnlock.
Movea.l (A0),A2 ; Turn it into a pointer.
Movea.l D1,A0 ; Restore ioPB ptr.
Clr.w csStart(A1) ; Set csStart to 0.
Move.w ctSize(A2),csCount(A1) ; Set csCount to pmTable.ctSize.
Lea ctTable(A2),A2 ; Get a pointer to the pmTabl.ctTable.
Move.l A2,csTable(A1) ; Copy it to the csParam block.
Move.w #cscSetEntries,csCode(A0) ; Set up for SetEntries.
_Control ,Immed ; Do it.
Movea.l (Sp)+,A0 ; Set up toÉ
_HUnlock ; Éunlock the colorTable Handle.
@Finished Unlk A6 ; Release our local stack storage.
@Done Moveq #0,D0 ; Always return zero.
Rts
Endwith
;----------------------------------------------------------------------------------
;
; FlushStuff - routine to do docking finalŽ (status call)
;
; Inputs - A0: input parameter (meaningless for status calls)
;
; Outputs - D0: wipe result (always zero)
;
;----------------------------------------------------------------------------------
;
With PmgrPramRec
FlushStuff
Moveq #VidMode,D0 ; Say we want to write the VidMode byte.
Moveq #0,D1 ; Reset the redo-slot-0 flag.
Bsr WritePMgrPRAM ; Do it.
Moveq #0,D0 ; Return zero.
Rts ; And leave.
Endwith
;=====================================================================
; Data
;=====================================================================
; We need to remember what the state of built-in external video
; is prior to going to sleep so that we can see if it has
; changed across the sleep-wake transition.
;
ExtVidState Dc.w indexedNoConnect ; Records the state of built-in external video across sleep.
;=====================================================================
; Utils
;=====================================================================
;---------------------------------------------------------------------
;
; Routine: Delay100
;
; Inputs: a0 - Ptr to VIA1 base
;
; Outputs: none
;
; Destroys: d0
;
; Function: Delays around 100 us, for reading sense lines on VSC.
;---------------------------------------------------------------------
Delay100 move.w TimeVIADB,d0
lsr.w #3,d0 ; 125 us delay
@wait tst.b (a0)
dbra d0,@wait
rts
;---------------------------------------------------------------------
; This routine reads the VSC/Jet sense lines. On entry, A4 should point to the VSC/Jet base address, D6
; should contain $03, $05, $06, or $07 to indicate the type of extended sense weÕre doing, and
; the CPU should have been put into 32-bit addressing mode. On exit, D6 contains the appropriate
; extended sense code.
;
; Note: The idea behind the extended-sense-line ($07) algorithm is as follows: First, drive sense line
; ÒaÓ and read the values of ÒbÓ and Òc.Ó Next, drive sense line ÒbÓ and read the values of ÒaÓ
; and Òc.Ó Finally, drive sense line ÒcÓ and read the values of ÒaÓ and Òb.Ó In this way, a
; six-bit number of the form bc/ac/ab is generated. The other extended-sense algorithms are
; identical to that of $07, except one of the three lines doesnÕt need to be driven. For example,
; with $03, ÒaÓ doesnÕt need to be driven. With $05, ÒbÓ doesnÕt need to be driven, and
; with $06, ÒcÓ doesnÕt need to be driven.
;---------------------------------------------------------------------
DoExtendedSense
Movem.l A0/D0-D1,-(Sp) ; Save work registers.
Moveq #0,D1 ; Use D1 to store extended-sense code.
Moveq #0,D0 ; Use D0 as temp from reads.
move.l VIA,a0 ; for delays
; Drive a, Read bc
;
Cmpi.b #indexedSense2P,D6 ; If this is not a type-3 extended sense,
Bne.s @DriveA ; then go ahead and drive A.
Move.b D6,D0 ; Otherwise, write out the assumed value,
Bra.s @EndA ; and go on.
@DriveA move.b #VSCAMask,VSC_MonID(a4) ; abc <- 011
bsr Delay100 ; delay 100 us
move.b VSC_MonID(a4),d0 ; Read the sense lines into d0.
lsr.b #4,d0 ; Shift the senseline inputs down.
@EndA move.b D0,D1 ; 00 00 BC
lsl.b #2,D1 ; 00 BC 00
; Drive b, Read ac
;
Cmpi.b #indexedSenseRGBFP,D6 ; If this is not a type-5 extended sense,
Bne.s @DriveB ; then go ahead and drive B.
Move.b D6,D0 ; Otherwise, write out the assumed value,
Bra.s @EndB ; and go on.
@DriveB move.b #VSCBMask,VSC_MonID(a4) ; abc <- 101
bsr Delay100 ; delay 100 us
move.b VSC_MonID(a4),d0 ; Read the sense lines into d0.
lsr.b #4,d0 ; Shift the senseline inputs down.
@EndB bclr #VSCSenseLineA,d0 ; A0C becomes
beq.s @OrIn ; A0C or
bset #VSCSenseLineB,d0 ; A1C
@OrIn or.b d0,D1 ; 00 BC AC
lsl.b #2,D1 ; BC AC 00
; Drive c, Read ab
;
Cmpi.b #indexedSenseHR,D6 ; If this is not a type-6 extened sense,
Bne.s @DriveC ; then go ahead and drive C.
Move.b D6,D0 ; Otherwise, write out the assumed value,
Bra.s @EndC ; and go on.
@DriveC move.b #VSCCMask,VSC_MonID(a4) ; abc -> 110
bsr Delay100 ; delay 100 us
move.b VSC_MonID(a4),d0 ; Read the sense lines into d0.
lsr.b #4,d0 ; AB0
@EndC lsr.b #1,d0 ; 0AB
or.b d0,D1 ; BC AC AB
Move.b D1,D6 ; Save the extended-sense code.
Movem.l (Sp)+,A0/D0-D1 ; Restore work registers.
Rts ; Return to caller.
; In a ÒclassicÓ video card setup, weÕd normally perform the follwing code in the PrimaryInit.
; However, because we have a clamshell on Blackbird, we need to know whether or not it will
; be closed. If the clamshell is closed, we generally want to keep video turned off on the
; LCD, but only if some sort of external video is running. So, we check here to see if
; thereÕs a display attatched to the external video connector. If there is a display attached,
; then we just leave video power on. Otherwise, we turn it off, and the hardware attributes
; then return that no external video is available.
;
; No registers are trashed, but D0 returns the detected display code.
;
DetectExtDisplay
@ExtDispRegs Reg A0-A4/D1/D6 ; Define and save theÉ
Movem.l @ExtDispRegs,-(Sp) ; Éregisters used here.
; Get some useful values up front.
;
lea VSCVideoBase,a4 ; Get the video base address into a4.
lea AIV3Base,a3 ; Point to AIV3 base.
; First, disable the VBL interrupts.
;
Bset #VidPwrEn,AIV3PwrEn(a3) ; Turn on video power planeÉ
Clr.b VSC_VidCtrl(A4) ; Ébut shut off syncs, dot clock, etcÉ.
Move.w #500-1,D0 ; It takes approximately 500µsÉ
@Wait500 Tst.b ([VIA]) ; Éfor the power-on signal to
Dbra D0,@Wait500 ; Épropagate thru the video circuitry.
Bset #vidReset,VSC_Test(A4) ; Reset the video subsystem byÉ
Bclr #vidReset,VSC_Test(A4) ; Étoggling the reset bit.
move.b #(1<<slotVBL),AIV3SlotEn(a3) ; Disable built-in (slot E) videoÕs VBLs.
moveq #2,d0 ; default (reset) value
move.b d0,VSC_HFP(a4) ; set horizontal front porch
move.b d0,VSC_HS(a4) ; set horizontal sync
move.b d0,VSC_HBP(a4) ; set horizontal back porch
move.b d0,VSC_HA(a4) ; set horizontal active dots
move.b d0,VSC_SyncA(a4) ; set SyncA dots
move.w d0,VSC_VFP(a4) ; set vertical front porch
move.w d0,VSC_VS(a4) ; set vertical sync lines
move.w d0,VSC_VBP(a4) ; set vertical back porch
move.w d0,VSC_VA(a4) ; set vertical active lines
clr.b VSC_Test(a4) ; clear test register
;-------------------------------------------------------
; Sense the type of display to drive.
;-------------------------------------------------------
With SP_Params,SpBlock
Suba.w #spBlockSize,Sp ; Make a slot parameter block on stack.
Movea.l Sp,A0 ; Get pointer to parm block now.
Move.b #dockSlotE,spSlot(A0) ; Put slot # into pBlock (We could call the Docking Manager, but why?)
Clr.b spExtDev(A0) ; Why ask why, just clear this guy.
Suba.w #SizesPRAMRec,Sp ; Allocate block for pRAM record.
Move.l Sp,spResult(A0) ; Point to it.
Movea.l Sp,A2 ; Save it.
_sReadPRAMRec ; Read slot PRAM.
moveq #0,d6 ; clear our id reg
move.b VSC_MonID(a4),d6 ; Read the sense lines into d6.
lsr.b #4,d6 ; Shift the senseline inputs down.
Cmpi.b #indexedSenseHR,D6 ; If we got a type-6, then do the
Beq.s @ExtendedHR ; extended Hi-Res stuff.
Cmpi.b #indexedNoConnect,D6 ; If we got a type-7, then do the
Beq.s @ExtendedNoConnect ; extended no-connect stuff.
Bra @EndSense ; Otherwise, the display is indexed and we handle it in the table.
@ExtendedHR
Bsr DoExtendedSense ; Do the extended type-6 algorithm.
Lea @XT6Table,A1 ; Point to the table of extended type-6 codes.
@XT6Loop Move.b (A1)+,D0 ; Pick up the next supported extended type-6 code.
Bmi.s @EndExtHR ; If weÕre at the end of the list, then just leave.
Move.b (A1)+,D1 ; Pick up the indexed version of the extended code.
Cmp.b D0,D6 ; If we didnÕt find a match, then
Bne.s @XT6Loop ; just keep looping.
Move.b D1,D6 ; Translate the extended code into its indexed version.
Bra @EndSense ; And move on.
@EndExtHR Move.b #indexedSenseHR,D6 ; Say that a type-6 display is connected.
Move.b SP_AltSense(A2),D0 ; Get the alternate senseID pRam byte.
Andi.b #spAltSenseValidMask,D0 ; If it is valid, then just pretend that
Bne.s @DoMonID ; the monID monitor is attached.
Bra.s @EndSense ; Otherwise, just say an HR display is attached.
@DoMonID Move.b SP_AltSense(A2),D6 ; Get the no-connect pRam byte.
Andi.b #spAltSenseMask,D6 ; Strip the validation code.
Bra.s @EndSense ; Skip the rest.
@ExtendedNoConnect
Bsr DoExtendedSense ; Do the extended no-connect algorithm.
Lea @XNCTable,A1 ; Point to the table of extended no-connect codes.
@XNCLoop Move.b (A1)+,D0 ; Pick up the next supported extended no-connnect code.
Bmi.s @EndNoConnect ; If weÕre at the end of the list, then just leave.
Move.b (A1)+,D1 ; Pick up the indexed version of the extended code.
Cmp.b D0,D6 ; If we didnÕt find a match, then
Bne.s @XNCLoop ; just keep looping.
Move.b D1,D6 ; Translate the extended code into its indexed version.
Bra.s @EndSense ; And move on.
@EndNoConnect Move.b #indexedNoConnect,D6 ; Say that nothingÕs connected.
Bclr #VidPwrEn,AIV3PwrEn(a3) ; And turn off video power.
Bra.s @EndSense
@XNCTable Dc.b extendedSenseVGA,indexedSenseVGA
Dc.b extendedSenseGF,indexedSenseGF
Dc.b -1,-1
@XT6Table Dc.b extendedMSB1,indexedSenseMSB1
Dc.b extendedMSB2,indexedSenseMSB2
Dc.b extendedMSB3,indexedSenseMSB3
Dc.b -1,-1
@EndSense clr.b VSC_MonID(a4) ; set ID lines to 0 to tri-state them.
Move.b D6,SP_MonID(A2) ; Write the MonID into pRAM buffer.
Move.l A2,spsPointer(A0) ; Set up parameter block.
_sPutPRAMRec ; Write the new record out.
Adda.w #SizesPRAMRec+spBlockSize,Sp ; Deallocate buffer.
Moveq #0,D0 ; Clear D0 for good measure.
Move.b D6,D0 ; Return the detected ext. display code.
Movem.l (Sp)+,@ExtDispRegs ; Restore the registers used here.
Rts ; And vamoose.
Endwith
;---------------------------------------------------------------------
;
; Routine: GetLidState
;
; Inputs: None.
;
; Outputs: D0.b - zero if lid is closed, -1 if lid is open.
;
; Destroys: A0/D0.
;
; Function: Returns the driver refNum of a needed device if that
; device happens to be in a particular slot.
;---------------------------------------------------------------------
;
With PMgrRec, pmCommandRec
GetLidState
Clr.w -(Sp) ; Allocate buffer on stack.
Move.l Sp,-(Sp) ; pmRBuffer
Move.l (Sp),-(Sp) ; pmSBuffer
Clr.w -(Sp) ; pmLength = 0
Move.w #readExtSwitches,-(SP) ; pmCommand
Movea.l SP,A0 ; Point to the parameter block.
_PMgrOp ; Get the clamshell info.
Lea pmRBuffer+4(Sp),Sp ; Toss the parameter block.
Btst #clamshell,(Sp)+ ; Is the clamshell closed?
Seq D0 ; Set up result.
Rts
Endwith
;---------------------------------------------------------------------
;
; Routine: GetSlotDevRefNum
;
; Inputs: D0.w (lo) - slot number to search.
; D0.w (hi) - drHwID of device.
;
; Outputs: D0.w (lo) - if non-zero, refNum of deviceÕs driver.
;
; Destroys: A0/D0.
;
; Function: Returns the driver refNum of a needed device if that
; device happens to be in a particular slot.
;---------------------------------------------------------------------
;
With SpBlock
GetSlotDevRefNum
Suba.w #SpBlockSize,Sp ; Allocate an SpBlock.
Movea.l Sp,A0 ; Point to the SpBlock on the stack.
Move.b D0,spSlot(A0) ; Set the slot number to search in.
Swap D0 ; Load the DrHwID.
Clr.b spId(A0) ; Begin at id 0.
Clr.b spExtDev(A0) ; No external device.
Clr.b spTBMask(A0) ; No mask in search.
Move.w #catDisplay,spCategory(A0) ; Look for: Display,
Move.w #typVideo,spCType(A0) ; Video,
Move.w #drSwApple,spDrvrSW(A0) ; Apple,
Move.w D0,spDrvrHW(A0) ; <DrHwID>.
Clr.l spParamData(A0) ; Look only for enabled sRsrcs.
Bset #foneslot,spParamData+3(A0) ; Limit search to this slot.
_GetTypeSRsrc ; If we found it, then
Beq.s @FoundDevice ; say so.
Moveq #0,D0 ; Otherwise, say the device isnÕt loaded.
Bra.s @Done ;
@FoundDevice Move.w spRefNum(A0),D0 ; Get the refNum into D0.
@Done Adda.w #SpBlockSize,Sp ; Restore the stack.
Rts ; And vamoose.
Endwith
;---------------------------------------------------------------------
;
; Routine: ReadPMgrPRAM
;
; Inputs: D0.l - PRAM address.
;
; Outputs: D0.b - byte read
;
; Destroys: A0/D0.
;
; Function: Reads a byte of PowerMgr PRAM.
;---------------------------------------------------------------------
;
With PmgrRec
ReadPMgrPRAM
Movea.l PMgrBase,A0 ; Point to the Power ManagerÕs globals.
Add.b PRAMBase(A0),D0 ; Get the absolute PRAM address.
Swap D0 ; Save it.
Addq #1,D0 ; Say we want one byte.
Swap D0 ; Save it.
Clr.b -(Sp) ; Make space for a buffer on the stack.
Movea.l Sp,A0 ; Point to it.
_ReadXPRAM ; Read the byte.
Move.b (Sp)+,D0 ; Return it.
Rts
Endwith
;---------------------------------------------------------------------
;
; Routine: WritePMgrPRAM
;
; Inputs: D0.l - PRAM address.
; D1.b - byte to write.
;
; Outputs: None.
;
; Destroys: A0/D0.
;
; Function: Writes a byte of PowerMgr PRAM (but doesnÕt set the dirty flag).
;---------------------------------------------------------------------
;
With PmgrRec
WritePMgrPRAM
Movea.l PMgrBase,A0 ; Point to the Power ManagerÕs globals.
Add.b PRAMBase(A0),D0 ; Get the absolute PRAM address.
Swap D0 ; Save it.
Addq #1,D0 ; Say we want one byte.
Swap D0 ; Save it.
Move.b D1,-(Sp) ; Push the byte to write onto the stack.
Movea.l Sp,A0 ; Point to it.
_WriteXPRAM ; Write it.
Tst.b (Sp)+ ; Clean up the stack.
Rts
Endwith

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,668 @@
;
; File: VSCEqu.a
;
; Contains: VSC Equates
;
; Written by: Russ Emmons
;
; Copyright: © 1992-1993 by Apple Computer, Inc., all rights reserved.
;
; Change History (most recent first):
;
; <SM2> 12/13/93 PN Roll in KAOs and Horror changes to support Malcom and AJ
; machines
; <1> 12-04-92 jmp first checked in
; ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
; Pre-SuperMario comments begin here.
; ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
; <H3> 6/30/92 HJR Changed vidPowerSelect to cscLowPwrSelect. Turned on hasMotPLL
; since Dartanian has a Motorola part.
; <H2> 5/7/92 HJR Added vidPowerSelect to the Control Call list.
; <1> 4/24/92 HJR first checked in
; <6> 3/3/92 RLE add some scc equates
; <5> 2/27/92 RLE add register defs to support new scsi disk mode scheme
; <4> 2/20/92 RLE changes to registers for scsi disk mode, eject, lock
; <3> 2/13/92 RLE add more vsc registers
; <2> 2/12/92 RLE add clock/power signals
; <1> 2/12/92 RLE first checked in
;
;
;--------------------------------------------------------------------
; chip base addresses
;--------------------------------------------------------------------
hasMotPLL EQU 1 ; Dartanian does have a Motorola PLL
kDBLiteVBLTime EQU -16626 ; 60.14742 Hz using the microsecond timer.
vscBase EQU $FEE00000 ; base of the VSC on Deskbar/Gemini
vscSCSIAddr EQU $FEE02000 ; SCSI registers base address
vscSCSIDMAAddr EQU $FEE04000 ; SCSI DMA base address (if any)
vscSCSIHskAddr EQU $FEE06000 ; SCSI handshake base address
vscSCCAddr EQU $FEE08000 ; SCC base address
;--------------------------------------------------------------------
; miscellaneous control/status
;--------------------------------------------------------------------
vscPortB EQU $00 ; VSC Port B Data Register
busLock EQU $01 ; 0=prevent NuBus from asking for processor bus
tma1 EQU $04 ; NuBus error code
tma0 EQU $05 ; NuBus error code
;--------------------------------------------------------------------
; VSC Interrupts
;--------------------------------------------------------------------
vscIFR EQU $03 ; VSC interrupt flag register
scsiDRQ EQU $00 ; 1=DMA request from SCSI chip
anySlot EQU $01 ; 1=interrupt pending from VBL or NuBus slot
scsiIRQ EQU $03 ; 1=interrupt pending from SCSI chip
vscIRQ EQU $07 ; 1=one or more bits 0-6 are set
;--------------------------------------------------------------------
; VSC Interrupt Enables
;--------------------------------------------------------------------
vscIER EQU $13 ; VSC interrupt enable register
scsiDRQEn EQU $00 ; 1=interrupts enabled from SCSI DMA Requests
anySlotEn EQU $01 ; 1=interrupts enabled from VBL or NuBus slot
ejectEn EQU $02 ; 1=interrupts enabled from eject mechanism
scsiEn EQU $03 ; 1=interrupts enabled from SCSI chip
enetEn EQU $04 ; 1=interrupts enabled from SONIC
setEnable EQU $07 ; /1=set interrupt enables corresponding to 1's in bits 0-6
; \0=clear interrupt enables corresponding to 1's in bits 0-6
;--------------------------------------------------------------------
; VSC Configuration
;--------------------------------------------------------------------
vscConfig EQU $10 ; VSC configuration register
;--------------------------------------------------------------------
; power and clock control
;--------------------------------------------------------------------
vscClockPower EQU $21 ; VSC register
vscVideoPower EQU $00 ; 1=turn on video power
vscSCCclock EQU $01 ; 1=turn on SCC clock
vscSCSIreset EQU $02 ; 1=let SCSI chip run
vscSWIMctl EQU $03 ; 1=SWIM signals active, 0=SWIM signals tri-stated
; Misc equatesÉ
;
CurVSCDrvrVersion EQU $0002 ; Dart is 0.0; Disk is 0.1; BB is 0.2.
ROMSize EQU $10000 ; config ROM section size in bytes, required for fHeader block
ROMRevLevel Equ CurVSCDrvrVersion
seSuccess EQU 1 ; sucessful sExec
ClrDepthBitsMask EQU $F8 ; bit mask to clear Ariel control register screen
; depth bits (top 5 bits)
indexEntries EQU -1 ; -1 mode for Get/SetEntries.
burnInSiz EQU $0004 ; Number of bytes in pRAM for burn-in signature.
burnInLoc EQU $00FC ; Where burn-in signature starts in pRAM.
burnInSig EQU 'RNIN' ; The burn-in signature.
burnInSigAlt Equ 'SRNN' ; The alternate burn-in signature.
burnInSig12 Equ 'RN12' ; These are the new burn-in signatures. They
burnInSig13 Equ 'RN13' ; define all the Apple-produced displays.
burnInSig15 Equ 'RN15' ; We could define similar signatures for
burnInSig16 Equ 'RN16' ; things like VGA, NTSC, and PAL, but the
burnInSig19 Equ 'RN19' ; factory probably couldnÕt use them anyway.
burnInSig21 Equ 'RN21'
; Timing mode constants for Display Manager MultiMode support
; Corresponding .h equates are in DisplaysPriv.h
; .a equates are in DepVideoEqu.a
; .r equates are in DepVideoEqu.r
timingInvalid Equ 0 ; Unknown timingÉ force user to confirm.
timingApple12 Equ 130 ; 512x384 (60 Hz) Rubik timing.
timingApple12x Equ 135 ; 560x384 (60 Hz) Rubik-560 timing.
timingApple13 Equ 140 ; 640x480 (67 Hz) HR timing.
timingApple13x Equ 145 ; 640x400 (67 Hz) HR-400 timing.
timingAppleVGA Equ 150 ; 640x480 (60 Hz) VGA timing.
timingApple15 Equ 160 ; 640x870 (75 Hz) FPD timing.
timingApple15x Equ 165 ; 640x818 (75 Hz) FPD-818 timing.
timingApple16 Equ 170 ; 832x624 (75 Hz) GoldFish timing.
timingAppleSVGA Equ 180 ; 800x600 (56 Hz) SVGA timing.
timingApple1Ka Equ 190 ; 1024x768 (60 Hz) VESA 1K-60Hz timing.
timingApple1Kb Equ 200 ; 1024x768 (70 Hz) VESA 1K-70Hz timing.
timingApple19 Equ 210 ; 1024x768 (75 Hz) Apple 19" RGB.
timingApple21 Equ 220 ; 1152x870 (75 Hz) Apple 21" RGB.
timingAppleNTSC_ST Equ 230 ; 512x384 (60 Hz, interlaced, non-convolved).
timingAppleNTSC_FF Equ 232 ; 640x480 (60 Hz, interlaced, non-convolved).
timingAppleNTSC_STconv Equ 234 ; 512x384 (60 Hz, interlaced, convolved).
timingAppleNTSC_FFconv Equ 236 ; 640x480 (60 Hz, interlaced, convolved).
timingApplePAL_ST Equ 238 ; 640x480 (50 Hz, interlaced, non-convolved).
timingApplePAL_FF Equ 240 ; 768x576 (50 Hz, interlaced, non-convolved).
timingApplePAL_STconv Equ 242 ; 640x480 (50 Hz, interlaced, non-convolved).
timingApplePAL_FFconv Equ 244 ; 768x576 (50 Hz, interlaced, non-convolved).
MACRO
_CLUTDelay
; tst.b ([VIA],0)
Nop
ENDM
; Various extra Control/Status calls used by built-in video
;
cscSyncOnGreen Equ 128 ; Used for enabling/disabling sync on green.
cscAltSense Equ 131 ; Used for enabling sRsrcs via the alternate sense pRAM byte.
cscPowerSelect Equ 132 ; Turn on/off power to the video circuitry (VSC/Jet/Keystone).
cscSleepWake Equ 134 ; Sleep/Wake the video circuitry (in some cases, could be the same as cscPowerSelect).
powerSelSig Equ 'powr' ; Signature returned in csData by the cscPowerSelect status call.
sleepWakeSig Equ 'slwk' ; Signature returned in csData by the cscSleepWake status call.
; Slot pRAM
;
; Slot pRam is used in various ways. The first two bytes are used by the Slot Manager to record
; the slotÕs boardID. The remaining bytes are left undefined by the Slot Manager. Built-in
; video uses Slot pRam as follows:
;
SP_Params RECORD 0
SP_BoardID ds.w 1 ; BoardID.
SP_Depth ds.b 1 ; spID of Depth (Mode). (vendorUse1)
SP_LastConfig ds.b 1 ; spID of last boot-up configuration. (vendorUse2)
SP_DfltConfig ds.b 1 ; spID of default configurationÉ (vendorUse3)
SP_MonID ds.b 1 ; Sense code of last display. (vendorUse4)
SP_Flags ds.b 1 ; Various flags. (vendorUse5)
SP_AltSense Ds.b 1 ; Alternate senseID byte. (vendorUse6)
SP_Size EQU *
; Slot pRAM flag bits
;
spSyncOnGreen Equ 0 ; True if weÕre supposed to put sync on green.
spAltSenseEnb Equ 1 ; True if AltSense was used before (for keeping SOG state).
spVRAMBit0 Equ 2 ; These two bits are used to encode the amount ofÉ
spVRAMBit1 Equ 3 ; ÉvRAM currently available.
numSPVRamBits Equ 2 ; Width for Bfins/Bfext of spVRAMBits
spVRAMBits Equ 31-spVRAMBit1 ; Offset for Bfins/Bfext.
spUseAltClk Equ 4 ; True if we have a Puma instead of a Clifton/Clifton+.
spFamilyChanged Equ 5 ; True if the family mode changed; always reset during PrimaryInit.
spAltSenseValidMask Equ $40 ; Upper two bits must be valid in order to use lower six.
spAltSenseMask Equ $3F ; Lower six bits are the indexed (mapped) sense code.
spAltSenseDisable Equ $80 ; Bits used for temporarily disabling the alternate senseID.
ENDR
; Definition of each of the entries in the ÔscrnÕ resource.
;
ScrnRecord RECORD 0
srDrvrHW ds.w 1 ; Hardware id of video card.
srSlot ds.w 1 ; Slot number.
srDCtlDevBase ds.l 1 ; DCtlDevBase (baseAddr) from AuxDCE.
srMode ds.w 1 ; Mode (spID) of depth.
srFlagMask ds.w 1 ; ????
srFlags ds.w 1 ; GDevice flags.
srColorTable ds.w 1 ; RsrcID of desired ÔclutÕ.
srGammaTable ds.w 1 ; RsrcID of desicred ÔgamaÕ.
srRect ds.w 4 ; GDevice rectangle.
srCtlCount ds.w 1 ; ????
ScrnRecSize EQU *
ENDR
;
; Various VSC equatesÉ
;
; The following record describes the video parameters for VSC built-in video. The first
; set of parameters are for the PLL (clock generator) chip. The other parameters are
; for graying the screen, setting up sRsrcs, etcÉ.
;
VSCVidParams RECORD 0
vvpClockWord ds.l 1 ; PLL serial bit config word
vvpBitCount ds.w 1 ; # bits to send in config word
VVPClkSize Equ *
vvpHFP ds.b 1 ; horiz. front porch
vvpHS ds.b 1 ; horiz. sync
vvpHBP ds.b 1 ; horiz. back porch
vvpHA ds.b 1 ; horiz. active dots
vvpSyncA ds.b 1 ; SyncA
vvpVFP ds.b 2 ; vert. front porch
vvpVS ds.b 2 ; vert. sync
vvpVBP ds.b 2 ; vertical back porch
vvpVA ds.b 2 ; vertical active lines
vvpMaxModeBase EQU *
vvp512Max ds.b 1 ; max mode for 512K VRAM
vvp1024Max ds.b 1 ; max mode for 1024K VRAM
ds.b 1 ; <pad>
vvpNumRows ds.w 1 ; Number of rows (-1).
vvPHdrSize EQU *
vvp1bppRowBytes ds.w 1 ; 1bpp rowbytes.
vvp2bppRowBytes ds.w 1 ; 2bpp rowbytes.
vvp4bppRowBytes ds.w 1 ; 4bpp rowbytes.
vvp8bppRowBytes ds.w 1 ; 8bpp rowbytes.
vvp16bppRowBytes ds.w 1 ; 16bpp rowbytes.
VVPSize EQU *
ENDR
;--------------------------------------------------------------------------------------
; The senselines for VSC-based systems are very similar to Sonora. Bits 0-2, when set,
; are active, and are driven to the state of bit 3. When bits 0-2 are clear, the sense line
; outputs are tri-stated.
;--------------------------------------------------------------------------------------
VSCSenseLineA EQU 2 ; Numbers for bit-I/O on VSC senselines.
VSCSenseLineB EQU 1 ;
VSCSenseLineC EQU 0 ;
VSCAMask EQU %0100 ; Masks for reading/writing VSC senselines.
VSCBMask EQU %0010 ;
VSCCMask EQU %0001 ;
;--------------------------------------------------------------------------------------
; VSC supports several displays that are in the ÒextendedÓ sense line range. Since the raw
; values that come back from doing the extended sense-line algorithm do not map into a nice
; tablular form like the ÒnormalÓ sense line codes do, we map the few extended-sense-line displays
; that we support into the bottom of the normal sense line table.
;
; Notes: The ÒnormalÓ sense displays fall in the range of 0..7, where 7 means Ògo try the
; extended sense codes.Ó So, we map the extended sense codes from 8 (yeah, we have
; blank entry).
;
; Radius exploits the fact that the extended sense algorithm is generally only tried
; when a 7 is read back. That is, for their two TPD displays (one color, the other
; monochrome), they use 3 as the trigger for doing the extended sense algorithm. To
; distinguish the two displays from each other, they just reverse the polarity of the
; the diode on sense lines b & c. (Note: This technique could be used for sense
; codes 5 and 6, too.)
;
; So, it should be noted, that there are four types of extended sense codes. We
; just use types 3, 6, and 7; type 5 is reserved.
;
;--------------------------------------------------------------------------------------
extended2P Equ $35 ; Raw Extended Sense for the Two-Page Display.
extended2PRdRGB Equ $31 ; Raw Extended Sense for RadiusÕ Color TPD.
extended2PRdMono Equ $34 ; Raw Extended Sense for RadiusÕ Mono TPD.
extendedRGBFP Equ $1E ; Raw Extended Sense for the RGB Full-Page Display.
extendedHR Equ $2B ; Raw Extended Sense for the Hi-Res Display (type-6 extended sense).
extendedMSB1 Equ $03 ; Raw Extended Sense for Band-1 Multiscan Displays (14", GS thru GF).
extendedMSB2 Equ $0B ; Raw Extended Sense for Band-2 Multiscan Displays (17", HR thru 19).
extendedMSB3 Equ $23 ; Raw Extended Sense for Band-3 Multiscan Displays (20", HR thru 2P).
extendedNoConnect Equ $3F ; Raw Extended Sense for no connect.
extendedSensePALBox Equ $00 ; Raw Extended Sense for PAL Encoder.
extendedSenseNTSC Equ $14 ; Raw Extended Sense for NTSC Encoder.
extendedSenseVGA Equ $17 ; Raw Extended Sense for VGA.
extendedSenseLP Equ $2D ; Raw Extended Sense for GoldFish.
extendedSenseGF Equ $2D ; Raw Extended Sense for GoldFish.
extendedSensePAL Equ $30 ; Raw Extended Sense for PAL.
extendedSense19 Equ $3A ; Raw Extended Sense for Third-Party 19Ó Displays.
indexedSenseRGB2P Equ 0 ; For switching to 16bpp.
indexedSenseFP Equ 1 ; For Mono-Only configs.
indexedSenseRubik Equ 2 ; For factory burn-in testing.
indexedSense2P Equ 3 ; For Mono-Only configs.
indexedSenseNTSC Equ 4 ; To Map NTSC encoder boxes to NTSC displays.
indexedSenseRGBFP Equ 5 ; For switching to 16bpp.
indexedSenseHR Equ 6 ; DAF said we should do HR for the factory.
indexedNoConnect Equ 7 ; (Here for consistency only.)
indexedSenseVGA Equ 8 ; Mapped Sense For VGA.
indexedSensePAL Equ 9 ; Mapped Sense For PAL.
indexedSenseLP Equ 10 ; Mapped Sense For GoldFish.
indexedSenseGF Equ 10 ; Mapped Sense For GoldFish.
indexedSense19 Equ 11 ; Mapped Sense For 19" Displays.
indexedSenseMSB1 Equ 12 ; Mapped Sense For Band-1 Multiscan Displays.
indexedSenseMSB2 Equ 13 ; Mapped Sense For Band-2 Multiscan Displays.
indexedSenseMSB3 Equ 14 ; Mapped Sense For Band-3 Multiscan Displays.
; Flags within GFlags word
GrayFlag EQU 15 ; luminance mapped if GFlags(GrayFlag) = 1
IntDisFlag EQU 14 ; interrupts disabled if GFlags(IntFlag) =1
IsMono EQU 13 ; true if monochrome only display (Portrait)
UseSeq EQU 12 ; true if sequence mode SetEntries
PsuedoIndex EQU 11 ; true if SetEntries request was mapped to indexed from sequential
; (due to screen depth hardware requirements)
IsDirect EQU 10 ; true if direct video mode, else chunkyIndexed
IsSleeping Equ 9 ; True if CPU is sleeping.
;---------------------------------------------------
;
; Rowbytes, page count, and bounds constants
;
;---------------------------------------------------
; rowbytes constants for the Mac II Hi-Res monitor/VGA monitor
;
OBMHRRB EQU 80 ; rowbytes for one-bit mode
TBMHRRB EQU 160 ; rowbytes for two-bit mode
FBMHRRB EQU 320 ; rowbytes for four-bit mode
EBMHRRB EQU 640 ; rowbytes for eight-bit mode
; rowbytes constants for the Mono/RGB Full-Page Display
;
OBMFPRB EQU 80 ; rowbytes for one-bit mode
TBMFPRB EQU 160 ; rowbytes for two-bit mode
FBMFPRB EQU 320 ; rowbytes for four-bit mode
EBMFPRB EQU 640 ; rowbytes for eight-bit mode
; rowbytes constants for the noninterlaced Apple // GS (Rubik) Monitor
;
OBMGSRB EQU 64 ; rowbytes for one-bit mode
TBMGSRB EQU 128 ; rowbytes for two-bit mode
FBMGSRB EQU 256 ; rowbytes for four-bit mode
EBMGSRB EQU 512 ; rowbytes for eight-bit mode
; rowbytes constants for the GoldFish Display
;
OBMGFRB EQU 104 ; rowbytes for one-bit mode
TBMGFRB EQU 208 ; rowbytes for two-bit mode
FBMGFRB EQU 416 ; rowbytes for four-bit mode
EBMGFRB EQU 832 ; rowbytes for eight-bit mode
; rowbytes constants for the SuperVGA Display
;
OBMSVGARB EQU 100 ; rowbytes for one-bit mode
TBMSVGARB EQU 200 ; rowbytes for two-bit mode
FBMSVGARB EQU 400 ; rowbytes for four-bit mode
EBMSVGARB EQU 800 ; rowbytes for eight-bit mode
; rowbytes constants for VESA 1024x768 60Hz
;
OBM1KRB Equ 128 ; rowbytes for one-bit mode
TBM1KRB Equ 256 ; rowbytes for two-bit mode
FBM1KRB Equ 512 ; rowbytes for four-bit mode
; page counts for all (maybe one of these days weÕll support more than one page?)
;
OBMPagesHR EQU 1
TBMPagesHR EQU 1
FBMPagesHR EQU 1
EBMPagesHR EQU 1
OBMPagesFP EQU 1
TBMPagesFP EQU 1
FBMPagesFP EQU 1
EBMPagesFP EQU 1
OBMPagesGS EQU 1
TBMPagesGS EQU 1
FBMPagesGS EQU 1
EBMPagesGS EQU 1
OBMPagesGF EQU 1
TBMPagesGF EQU 1
FBMPagesGF EQU 1
EBMPagesGF EQU 1
OBMPagesSVGA EQU 1
TBMPagesSVGA EQU 1
FBMPagesSVGA EQU 1
EBMPagesSVGA EQU 1
OBMPages1K EQU 1
TBMPages1K EQU 1
FBMPages1K EQU 1
EBMPages1K EQU 1
;------------------------
; Bounds constants
;------------------------
; for the Mac II Hi-Res Monitor
;
defmBounds_THR EQU 0 ; top
defmBounds_LHR EQU 0 ; left
defmBounds_BHR EQU 480 ; bottom
defmBounds_RHR EQU 640 ; right
; for the Full Page Display
;
defmBounds_TFP EQU 0 ; top
defmBounds_LFP EQU 0 ; left
defmBounds_BFP EQU 870 ; bottom
defmBounds_RFP EQU 640 ; right
; for the Full Page Display (alternate size)
;
defmBounds_TFPb EQU 0 ; top
defmBounds_LFPb EQU 0 ; left
defmBounds_BFPb EQU 818 ; bottom
defmBounds_RFPb EQU 640 ; right
; for the noninterlaced Apple // GS Monitor
;
defmBounds_TGS EQU 0 ; top
defmBounds_LGS EQU 0 ; left
defmBounds_BGS EQU 384 ; bottom
defmBounds_RGS EQU 512 ; right
; for VGA-compatible displays
;
defmBounds_TVGA EQU 0 ; top
defmBounds_LVGA EQU 0 ; left
defmBounds_BVGA EQU 480 ; bottom
defmBounds_RVGA EQU 640 ; right
; for SuperVGA-compatible displays
;
defmBounds_TSVGA EQU 0 ; top
defmBounds_LSVGA EQU 0 ; left
defmBounds_BSVGA EQU 600 ; bottom
defmBounds_RSVGA EQU 800 ; right
; for Landscape Page (Goldfish) displays
;
defmBounds_TGF EQU 0 ; top
defmBounds_LGF EQU 0 ; left
defmBounds_BGF EQU 624 ; bottom
defmBounds_RGF EQU 832 ; right
; for 19Ó displays
;
defmBounds_T1K EQU 0 ; top
defmBounds_L1K EQU 0 ; left
defmBounds_B1K EQU 768 ; bottom
defmBounds_R1K EQU 1024 ; right
;
; screen resolution in dpi (fixed format)
;
HResHR EQU $480000 ; 72 HPixels/inch
VResHR EQU $480000 ; 72 VPixels/inch
HResFP EQU $500000 ; 80 HPixels/inch
VResFP EQU $500000 ; 80 VPixels/inch
HResGS EQU $480000 ; 72 HPixels/inch
VResGS EQU $480000 ; 72 VPixels/inch
HResLP EQU $480000 ; 72 HPixels/inch
VResLP EQU $480000 ; 72 VPixels/inch
HResGF EQU $480000 ; 72 HPixels/inch
VResGF EQU $480000 ; 72 VPixels/inch
HResSVGA EQU $480000 ; 72 HPixels/inch
VResSVGA EQU $480000 ; 72 VPixels/inch
HRes1K EQU $480000 ; 72 HPixels/inch
VRes1K EQU $480000 ; 72 VPixels/inch
;---------------------------------------------------
;
; Miscellaneous constants
;
;---------------------------------------------------
IndexedBlack EQU -1 ; black for indexed modes
DirectBlack EQU 0 ; black for direct modes
IndexedWhite EQU 0 ; white for indexed modes
DirectWhite EQU -1 ; white for direct modes
OneBitGray EQU $AAAAAAAA
TwoBitGray EQU $CCCCCCCC
FourBitGray EQU $F0F0F0F0
EightBitGray EQU $FF00FF00
SixteenBitGray EQU $0000FFFF
GrayPatSize EQU 4
defVersion EQU 0 ; Version = 0
defPixelType EQU 0 ; pixeltype=chunky
ChunkyDirect EQU 16 ; pixelType=ChunkyDirect
defCmpCount EQU 1 ; Number of components in pixel
defmPlaneBytes EQU 0 ; Offset from one plane to the next
defmDevType EQU clutType ; clutType = 0
defMinorBase EQU 0 ; Video RAM Offset is 0
;----------------------------------------------------------------------------------
; Here are the minor lengths for VSC
;----------------------------------------------------------------------------------
MinorLength_VSC_FPa EQU (FBMFPRB*defmBounds_BFP)
MinorLength_VSC_FPb EQU (EBMFPRB*defmBounds_BFPb)
MinorLength_VSC_GS EQU (EBMGSRB*defmBounds_BGS)
MinorLength_VSC_HR EQU (EBMHRRB*defmBounds_BHR)
MinorLength_VSC_GF EQU (EBMGFRB*defmBounds_BGF)
MinorLength_VSC_SVGA EQU (EBMSVGARB*defmBounds_BSVGA)
MinorLength_VSC_1K Equ (FBM1KRB*defmBounds_B1K)
defmBaseOffset EQU $100000 ; Offset to base of video RAM
;--------------------------------------------------------------------
; Various hardware equates.
;--------------------------------------------------------------------
AIV3Base EQU $FEE00000 ; base address of AIV3 (Apple Integrated VIA 3)
AIV3SlotInt EQU $0002
slotC EQU 3
slotD EQU 4
slotVBL EQU 6
AIV3PortBData Equ $0000
pumaId Equ 0
syncOnGreenCtl Equ 6
AIV3PortBDir Equ $0001
pumaIdDir Equ 0
syncOnGreenDir Equ 6
AIV3Int EQU $0003
AIV3cfg EQU $0010 ; configuration register in AIV3
SpeedCtl Equ 0 ; If set, adds wait states for 33MHz CPUs.
BufCtl Equ 1 ; If set, combines video and general purpose buffers.
SClock Equ 5 ; Used to clock in serial data.
SData Equ 6 ; The data to be clocked in.
AIV3SlotEn EQU $0012 ; slot interrupt enable register
VBLIntEn EQU 6 ; enable bit for VSC video's VBL
AIV3IntEn EQU $0013 ; interrupt enable register
AIV3PwrEn EQU $0021 ; Power/clock control register
VidPwrEn EQU 0 ; enables video power plane.
SCCClkEn EQU 1 ; enables SCC 3.67 MHZ clock
SCSIRstEn EQU 2 ; enables SCSI Reset line
FloppyCtlEn EQU 3 ; enables SWIM II signals
FloppyPwrEn EQU 4 ; enables floppy power plane
VDACBase EQU AIV3Base+$0E000 ; Base address of our VDAC
VSCVideoBase EQU $FEEFE000 ; Base address of video registers in VSC
VSC_MonID EQU $0004 ; monitor ID register
VSC_Depth EQU $0008 ; pixel depth register
VSC_BusInt EQU $000C ; RAM cycle timing parameters
VSC_VidCtrl EQU $0010 ; video enable register
VSCEnB0 EQU 0 ; bank 0 enable
VSCEnB1 EQU 1 ; bank 1 enable
VSCEnHSync EQU 2 ; horiz. sync enable
VSCEnVSync EQU 3 ; vert. sync enable
VSCEnCSync EQU 4 ; comp. sync enable
VSCblankBit EQU 5 ; video blank enable
VSCEnDotClk EQU 6 ; video dot clock enable
VSCExtMuxDelay EQU 7 ; no external mux delay
VSC_IntClear EQU $0014 ; any write will clear VBL interrupt
VSC_HFP EQU $0040
VSC_HS EQU $0044
VSC_HBP EQU $0048
VSC_HA EQU $004C
VSC_SyncA EQU $0050
VSC_VFP EQU $0054
VSC_VS EQU $0058
VSC_VBP EQU $005C
VSC_VA EQU $0060
VSC_Test EQU $0070
vidReset Equ 5
VRAMBase EQU $FE100000 ; Base address of VRAM (512K-1Meg)
Nuchip33Base EQU $50F28000 ; Base address of Nuchip33
NormalTrans EQU 0 ; pass addresses with normal nubus translation
NoTrans EQU 1 ; pass addresses without translation
IF hasMotPLL THEN
firstCtrl EQU $1E05 ; Start PLL program sequence
postCtrl EQU $1E04 ; Indicate end of user data
finalCtrl EQU $1E00 ; Terminate sequence
ctrlCount EQU $D ; Bit count for each control data word
ELSE
firstCtrl EQU $1E0D ; Start PLL program sequence
postCtrl EQU $1E0C ; Indicate end of user data
finalCtrl EQU $1E08 ; Terminate sequence
ctrlCount EQU $D ; Bit count for each control data word
ENDIF
;--------------------------------------------------------------------
; sResource ID's for the config ROM
;--------------------------------------------------------------------
sRsrc_Board EQU $01 ; The Board sRsrc ID
sRsrc_Vid_VSC_FPb EQU $80 ; Full-Page 1,2,4,8
sRsrc_Vid_VSC_FPa EQU $81 ; Full-Page 1,2,4
sRsrc_Vid_VSC_GS EQU $82 ; Rubik 1,2,4,8
sRsrc_Vid_VSC_RGBFPb EQU $84 ; RGB Full-Page 1,2,4,8
sRsrc_Vid_VSC_RGBFPa EQU $85 ; RGB Full-Page 1,2,4
sRsrc_Vid_VSC_HR EQU $86 ; HiRes 1,2,4,8
sRsrc_Vid_VSC_MSB1 Equ $87 ; MSB1 -> HR
sRsrc_Vid_VSC_VGA EQU $88 ; VGA 1,2,4,8
sRsrc_Vid_VSC_SVGA EQU $89 ; Super VGA 1,2,4,8
sRsrc_Vid_VSC_GF EQU $8A ; GoldFish 1,2,4,8
sRsrc_Vid_VSC_MSB2 Equ $8B ; MSB2 -> MSB3 -> GF
sRsrc_Vid_VSC_1K Equ $8C ; VESA (1024x768, 60 Hz), 1,2,4
sRsrc_Docking EQU $F0 ; docking functional sRsrc
sRsrc_VSC_NeverMatch EQU $FE ; The ÒnullÓ VSC sRsrc.

View File

@ -0,0 +1,681 @@
;---------------------------------------------------------------------
;
; File: VSCPrimaryInit.a
;
; Written by: Gary Rensberger, based on Mike Puckets Sonora PrimaryInit. Jan 4, 1992
;
; Copyright: © 1988-1993 by Apple Computer, Inc. All rights reserved.
;
; Change History (most recent first):
;
; <SM2> 12/13/93 PN Roll in KAOs and Horror changes to support Malcom and AJ
; machines
; <1> 12-04-92 jmp first checked in
; ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
; Pre-SuperMario comments begin here.
; ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
; <H7> 7/14/92 HJR Enable CSync back on VGA monitors.
; <H6> 7/13/92 HJR Disable CSync on VGA monitors. Reverse polarity of PmgrExtVidOn
; and call PmgrHook if Video is enabled.
; <H5> 6/30/92 HJR General Cleanup.
; <H4> 6/1/92 HJR Check if charger is installed. If not, kill power to external
; video and notify user that something is wrong. Also if video is
; disable, return error so that slot manager can mark slot as
; being bad.
; <H3> 5/7/92 HJR Changed VideoBase to VSCVideoBase.
; <H2> 4/27/92 HJR Turn off clocks to the VSC if no monitor is detected.
; <1> 4/24/92 HJR first checked in
; <12> 3/5/92 RLE turn off change <10> for Deskbars
; <11> 3/5/92 GMR Fixed a0 register trash bug from change <9>
; <10> 3/4/92 RLE set up nuchip33 to pass Nubus accesses in superslot 6, slot E,
; and superslot E to DB Lite system without translation
; <9> 3/4/92 GMR Now properly setting clock after alternate family mode detected.
; <8> 2/27/92 RLE turn off eject and ethernet interrupt enables
; <7> 2/13/92 RLE move power plane stuff into secondary init where the scc init
; will take place
; <6> 2/6/92 RLE renamed board ID so it works with either Gemini or Deskbar
; <5> 1/31/92 GMR Made the slot interrupt handler more robust.
; <4> 1/31/92 RLE fix stoopid power plane bset bug
; <3> 1/30/92 RLE turn on all power planes, setup new SCC base addresses (until
; docking stuff in place)
; <2> 1/30/92 GMR Now installs a slot E handler for NuBus slots C and D.
; <1> 1/28/92 GMR first checked in
;---------------------------------------------------------------------
;---------------------------------------------------------------------
; Header
;---------------------------------------------------------------------
dc.b sExec2 ; Header
dc.b sCPU68020
dc.w 0
dc.l BeginVSCInit-*
;---------------------------------------------------------------------
; Local variables, definitions, etc....
;---------------------------------------------------------------------
WITH SEBlock,SPBlock
VSCFrame RECORD {A6Link},Decrement
Return ds.l 1 ; Return address.
A6Link ds.l 1 ; Saved A6.
memMode ds.l 1 ; 24/32 bit (from swapMMUMode)
spBlk ds SPBlock ; SpBlock for generic use.
sPRAMBlk ds.b SizeSPRAMRec ; sPRAMRec for generic use.
vidParamsPtr ds.l 1 ; Pointer to video parameters.
configParamsPtr ds.l 1 ; Pointer to config parameters.
startingConfig Ds.b 1 ; Used to determine if we need to reload configs.
Ds.b 1 ; <pad>
SFSize EQU *
ENDR
ENDWITH
VRAMConfigRec RECORD 0 ;
sRsrcID ds.b 1 ; Default sRsrc ID for this vRam configuration.
alt1 ds.b 1 ; Éfamily mode alternative 1,
alt2 ds.b 1 ; Éfamily mode alternative 2,
alt3 ds.b 1 ; Éfamily mode alternative 3.
modeID ds.b 1 ; Favored modeID (depth).
ds.b 1 ; <pad>
VRAMConfigSize EQU *
ENDR
MiniGamma RECORD 0 ; Entries for mini gamma table used in VSCInit.
blackRed ds.b 1 ; Red
whiteRed ds.b 1 ;
blackGreen ds.b 1 ; Green
whiteGreen ds.b 1 ;
blackBlue ds.b 1 ; Blue
whiteBlue ds.b 1 ;
ds.b 2 ; <pad>
GT_Size EQU *
ENDR
WITH MiniGamma,VRAMConfigRec
VSCConfigRec Record 0
gammaTbl ds.b GT_Size ; Mini-gamma table
SConfigHdrSize EQU *
s512KVRAM ds.b VRAMConfigSize ; 512K vRAM preferences.
SConfigRecSize EQU *
ENDR
ENDWITH
;=====================================================================
; Utils
;=====================================================================
;---------------------------------------------------------------------
;
; Routine: PruneList
;
; Inputs: d0.b - sRsrcID of the ÒkeeperÓ
; d3.l - sRsrcID of 4 family-mode alternates
; a0 - pointer to appropriately filled-out SpBlock
; a1 - pointer to list of sRsrcIDs
;
; Outputs: none
;
; Destroys: d0-d2/a1
;
; Function: Loops thru a table of sRsrcIDs comparing the ÒkeeperÓ with each
; of the entries in the table. Those IDs that donÕt match
; the keeper or alternate ID's are pruned. Those that don't match
; the keeper, but match one of the alternate ID's will be disabled.
;---------------------------------------------------------------------
WITH SpBlock
PruneList move.b d0,-(sp) ; Remember the ID of the Òkeeper.Ó
move.w (a1)+,d1 ; Get the zero-based counter into D1.
Move.l D3,D2 ; Get the list of family modes.
Andi.l #$00FFFFFF,D2 ; Remember if there are any alternatives.
@repeat move.b (a1)+,d0 ; Get an sRsrc ID.
cmp.b (sp),d0 ; If itÕs the keeper,
beq.s @until ; then donÕt prune it.
move.b d0,spID(a0) ; else, set ID so we can prune/disable it
Tst.l D2 ; If there are no family-mode alternatives,
Beq.s @delete ; then just do the delete.
rol.l #8,d3
cmp.b d0,d3 ; else, see if it's an alternate family member
beq.s @disable ; yes, then disable it
rol.l #8,d3
cmp.b d0,d3 ; see if it's the other alternate family member
beq.s @disable ; yes, then disable it
rol.l #8,d3
cmp.b d0,d3 ; else, see if it's an alternate family member
beq.s @disable ; yes, then disable it
rol.l #8,d3
cmp.b d0,d3 ; see if it's the other alternate family member
beq.s @disable ; yes, then disable it
@delete _sDeleteSRTRec
@until dbra d1,@Repeat ; Loop until done.
bra.s @exit
@disable move.l #1,spParamData(a0) ; Setup to disable this mode.
clr.l spsPointer(a0) ; Not a RAM sRsrc.
_SetsRsrcState ; Set it.
bra.s @until
@exit tst.b (sp)+ ; Clean up the stack.
rts ; Return to caller.
ENDWITH
;---------------------------------------------------------------------
;
; Routine: Delay8ms
;
; Inputs: a0 - Ptr to VIA1 base
;
; Outputs: none
;
; Destroys: d0
;
; Function: Delays around 8 us, for ensuring PLL is programmed correctly.
;---------------------------------------------------------------------
Delay8ms move.w TimeVIADB,d0
lsl.w #3,d0 ; 8 ms delay
@wait tst.b (a0)
dbra d0,@wait
rts
;---------------------------------------------------------------------
;
; Routine: SendPLLData
;
; Inputs: a3 - Ptr to AIV3 base
; d0.l - Data to shift out
; d1.w - Number of bits to shift out minus 1 (n-1)
;
; Outputs: none
;
; Destroys: d0-d2
;
; Function: Sends the specified data to the PLL through the VIA (AIV3).
;---------------------------------------------------------------------
SendPLLData Move.l D3,-(Sp) ; Save D3 (as itÕs a global).
rol.l #6,d0 ; First, move starting bit into bit 6.
@nextBit move.l d0,d3 ; Get the data.
andi.b #(1<<SData),d3 ; Only keep bit 6 (the data bit).
move.b AIV3cfg(a3),d2 ; Get the current reg value.
andi.b #((1<<SpeedCtl)++\ ; Keep the wait state bit.
(1<<BufCtl)),d2 ; Keep buffer control bit.
or.b d3,d2 ; Add in data bit.
move.b d2,AIV3cfg(a3) ; Write the data bit.
ori.b #(1<<SClock),d2 ; Set up toÉ
move.b d2,AIV3cfg(a3) ; Éreset the clock line.
ror.l #1,d0 ; Prep next bit.
dbra.w d1,@nextBit
Bclr #SClock,AIV3Cfg(A3) ; Clear the clock andÉ
Bclr #SData,AIV3Cfg(A3) ; Édata lines for good measure.
Move.l (Sp)+,D3 ; Restore D3.
rts ; And leave.
;---------------------------------------------------------------------
;
; Routine: SetDotClock
;
; Inputs: a3 - Ptr to AIV3 base
; a1 - ptr to config word.l/bit count.w
;
; Outputs: a1 - bumped past clock info, points to VSC parameters
;
; Destroys: d0-d2
;
; Function: Loads the PLL with a value pointed to by a1. a1+4 = # bits to load
;---------------------------------------------------------------------
With VSCFrame,VSCVidParams
SetDotClock move.l a0,-(sp) ; save regs
move.l VIA,a0 ; VIA base in a0 for delays
Moveq #0,D0 ; Clear out high-order word of D0.
move.w #firstCtrl,d0 ; first control word
moveq #CtrlCount,d1 ; count
bsr.s SendPLLData ; send it serially
move.l (a1)+,d0 ; serial config word
move.w (a1)+,d1 ; count
bne.s @sendData
move.w #postCtrl,d0 ; if count 0, special case (use default)
moveq #CtrlCount,d1 ; count
bsr.s SendPLLData ; send it serially
bsr Delay8ms ; delay at least 5 ms before sending final word
move.w #postCtrl,d0 ; final control word
moveq #CtrlCount,d1 ; count
bsr.s SendPLLData ; send it serially
bra.s @exit ; and exit
@sendData bsr.s SendPLLData ; send it serially
move.w #postCtrl,d0 ; post control word
moveq #CtrlCount,d1 ; count
bsr.s SendPLLData ; send it serially
bsr Delay8ms ; delay at least 8 ms before sending final word
move.w #finalCtrl,d0 ; final control word
moveq #CtrlCount,d1 ; count
bsr.s SendPLLData ; send it serially
@exit move.l (sp)+,a0 ; restore a0 <11>
rts
Endwith
;==================================================================================================
; Routine: PrimaryInit
;
; Inputs:
;
; Ouputs:
;
; May destroy: d0-d7,a0-a6
;
; Uses A3 - ptr to AIV3 base
; A4 - ptr to VSC's video register base
;==================================================================================================
WITH SEBlock,SPBlock,VSCFrame
BeginVSCInit
; Set up initial ÒvendorÓ status.
link a6,#SFSize ; Allocate stack space for locals.
move.w #seSuccess,seStatus(a0) ; Just say that weÕre okay.
;
; Perform some generic initializations.
;
move.b seSlot(A0),spBlk.spSlot(a6) ; Get our slot number from the Slot Manager.
clr.b spBlk.spExtDev(a6) ; Why ask why? Just clear this guy.
;
; Initialize the BoardID part of the Slot $E pRAM if necessary, and prune the board sResources.
;
With SP_Params
lea spBlk(a6),a0 ; Point A0 at our local SpBlock.
lea sPRAMBlk(a6),a2 ; Get a pointer to our local SPRAMBlock.
move.l a2,spResult(a0) ; Put our pointer in the SpBlock.
_sReadPRAMRec ; Read Slot $EÕs pRAM.
tst.w SP_BoardID(a2) ; If the board ID is non-zero,
bne.s @VSCVideoInit ; then just go on.
move.b #sRsrc_Board,spID(a0) ; Otherwise, look for the appropriate board sRsrc.
_sRsrcInfo ; Get the spsPointer.
move.b #BoardID,spID(a0) ; Set up to get the correct board ID.
_sReadWord ; Get it.
move.w spResult+2(a0),SP_BoardID(a2) ; Save the board ID into pRAM.
move.l A2,spsPointer(a0) ;
_InitSlotPRAM ;
; In a ÒclassicÓ PrimaryInit, this is the point in the code where would actually go out to
; detect the kind of display that is connected. However, since that has already been
; done for us by the Docking Manager, we just read the indexed MonID from PRAM here.
@VSCVideoInit
Moveq #0,D6 ; Clear out the indexed display ID reg.
Move.b SP_MonID(A2),D6 ; Load the indexed display ID.
ENDWITH
; Get some useful values up front.
;
lea VSCVideoBase,a4 ; Get the video base address into a4.
lea AIV3Base,a3 ; Point to AIV3 base.
;-------------------------------------------------------
; WeÕll size VRAM later if necessary. For now, just assume
; 512K. See the VRAM sizing notes below.
;-------------------------------------------------------
Moveq #0,D4 ; Assume thereÕs 512K of VRAM for now.
;-------------------------------------------------------
; Get the video parameters for this monitor (1bbp) and use to setup the dot-clock
; so we can then size VRAM.
;-------------------------------------------------------
WITH VRAMConfigRec,VSCConfigRec
lea VSCConfigTable,a1 ; Point to the VSC configuration table.
move.w #SConfigRecSize,d0 ; Get the size of each entry into D0.
mulu d6,d0 ; Multiply it by the right entry.
adda.l d0,a1 ; Skip to the entry we want.
move.l a1,configParamsPtr(a6) ; Save it for later.
adda.l #SConfigHdrSize,a1 ; Skip past the header.
move.w #VRAMConfigSize,d0 ; Get the size of the VRAM entries.
mulu d4,d0 ; Multiply by the right entry.
adda.l d0,a1 ; Skip to the right VRAM entry.
Move.b sRsrcID(A1),D5 ; Get an ÒokayÓ sRsrcID into D5.
move.b modeID(a1),d7 ; Get the default mode (depth).
move.l sRsrcID(a1),d3 ; get both family ID's (if any) in d3 (for disabling)
Clr.l vidParamsPtr(A6) ; Remember that we havenÕt loaded in vidParams yet.
Cmpi.b #sRsrc_VSC_NeverMatch,D5 ; If itÕs the null one, then
Beq @SetConfig ; just get ready to leave.
lea spBlk(a6),a0 ; Point A0 at our local SpBlock.
move.b #sRsrc_Board,spID(a0) ; Get the board sRsrc ID that we need.
_sRsrcInfo
move.b #sVidParmDir,spID(a0) ; Look for the video parameters directory.
_sFindStruct
move.b D5,spID(a0) ; Look in the directory for this configÕs params.
_sGetBlock
move.l spResult(a0),a1 ; Get a pointer to the vidParams for this config.
move.l a1,vidParamsPtr(a6) ; Save for later disposal.
Move.b D5,startingConfig(A6) ; Remember which config we started with.
ENDWITH
;-------------------------------------------------------
; Set up the dot-clock chip based on our monitor type.
;-------------------------------------------------------
bsr SetDotClock ; setup the dot clock to default config
;-------------------------------------------------------
; Size the amount of VRAM. When done, d4 is set to one of {0,1}, where 0=512K,1=1024K.
; Note: On the Darts and BlackBird, only 512K of VRAM is installed, so we just
; Skip this check.
;-------------------------------------------------------
move.b #((1<<VSCenB0)+(0<<VSCenB1)+\ ; enable both banks of VRAM before we size
(1<<VSCEnDotClk)),VSC_VidCtrl(a4) ; enable the dot clock
;-------------------------------------------------------
; Initialize built-in videoÕs PRAM.
;-------------------------------------------------------
WITH SP_Params
Move.b SP_Flags(A2),D0 ; Copy the flags byte.
Bfins D4,D0{spVRamBits:numSPVRamBits} ; Load the amount of vRAM.
Move.b D0,SP_Flags(A2) ; Remember how much vRAM we setup for.
cmp.b SP_DfltConfig(a2),d5 ; If this is the same configuration we had last time,
beq.s @WritePRAM ; then just go on.
@Reconfig move.b d5,SP_DfltConfig(a2) ; Set the identification configuration (as THIS one).
move.b d5,SP_LastConfig(a2) ; Make this the current config also.
move.b d7,SP_Depth(a2) ; Set the default depth for this configuration.
@WritePRAM move.l a2,spsPointer(a0) ; Set up the PRAM parameter block.
_sPutPRAMRec ; Write out Slot $EÕs pRAM.
move.b SP_LastConfig(a2),d5 ; Get requested ID into D5.
@SetConfig lea VSCModeList,a1 ; Point to the table of supported video sResources.
move.b d5,d0 ; Get the sRsrc ID of the keeper into D0.
lea spBlk(a6),a0 ; Point A0 at our local SpBlock.
bsr.s PruneList ; Call our pruning utility.
Endwith
;-------------------------------------------------------
; Now that everything is set up, we need to determine whether a known configuration is out there.
; If so, we continue with the normal PrimaryInit process. Otherwise, we shut things down and
; leave.
;-------------------------------------------------------
Cmpi.b #sRsrc_VSC_NeverMatch,D5 ; If weÕve got a known configuration,
Bne.s @EndConfig ; then just go on.
Bclr #VidPwrEn,AIV3PwrEn(a3) ; Only turn off video power.
Bra VSCExit ; And leave.
@EndConfig
;-------------------------------------------------------
; Initialize the video hardware (VSC and Ariel)
;-------------------------------------------------------
WITH VSCVidParams,MiniGamma
Movea.l vidParamsPtr(a6),A0 ; Get the vidParams pointer.
Cmp.b startingConfig(A6),D5 ; If this isnÕt the config we started with,
Bne.s @NewConfig ; then go reload.
Movea.l A0,A1 ; Get the vidParams pointer into A1.
Adda.w #VVPClkSize,A1 ; Skip past the dot-clock fields.
Bra.s @VidTiming ; Go set up the timing.
@NewConfig _DisposPtr ; Dispose of the earlier vidParams.
lea spBlk(a6),a0 ; Point A0 at our local SpBlock.
move.b #sRsrc_Board,spID(a0) ; Get the board sRsrc ID that we need.
_sRsrcInfo
move.b #sVidParmDir,spID(a0) ; Look for the video parameters directory.
_sFindStruct
move.b d5,spID(a0) ; Look in the directory for this configÕs params.
_sGetBlock
move.l spResult(a0),a1 ; Get a pointer to the correct vidParams.
move.l a1,vidParamsPtr(a6) ; Save for later disposal.
Bclr #VSCEnDotClk,VSC_VidCtrl(A4) ; Disable external access to the dot clock.
Bsr SetDotClock ; Reprogram the dot-clock for this config.
Bset #VSCEnDotClk,VSC_VidCtrl(A4) ; Re-enable access to the dot-clock.
@VidTiming move.b (a1)+,VSC_HFP(a4) ; set horizontal front porch
move.b (a1)+,VSC_HS(a4) ; set horizontal sync
move.b (a1)+,VSC_HBP(a4) ; set horizontal back porch
move.b (a1)+,VSC_HA(a4) ; set horizontal active dots
move.b (a1)+,VSC_SyncA(a4) ; set SyncA dots
move.w (a1)+,VSC_VFP(a4) ; set vertical front porch
move.w (a1)+,VSC_VS(a4) ; set vertical sync lines
move.w (a1)+,VSC_VBP(a4) ; set vertical back porch
move.w (a1)+,VSC_VA(a4) ; set vertical active lines
move.b #$07,VSC_BusInt(a4) ; set vram to BlackBird Specs *HJR* (7 for new Pratt, 5 for old)
@done
Movea.l vidParamsPtr(A6),A1 ; Re-point to start of vidParams.
clr.b VSC_Depth(a4) ; Set the frame buffer controller 1bpp.
lea VDACBase,a2 ; Get the base address of the VDAC.
move.b #$08,ArielConfigReg(a2) ; Set the CLUT/DAC to 1bpp, master mode, no overlay.
adda.w #ArielDataReg,a2 ; Point to the CLUT/DAC data register.
move.l configParamsPtr(a6),a5 ; Point to the config parameters.
move.b #$7F,ArielAddrReg-ArielDataReg(a2) ; Setup to write 1bpp white.
_CLUTDelay ;
move.b whiteRed(a5),(a2)
move.b whiteGreen(a5),(a2)
move.b whiteBlue(a5),(a2)
_CLUTDelay ;
move.b #$FF,ArielAddrReg-ArielDataReg(a2) ; Setup to write 1bpp black.
_CLUTDelay ;
move.b blackRed(a5),(a2)
move.b blackGreen(a5),(a2)
move.b blackBlue(a5),(a2)
;-------------------------------------------------------
; Gray the screen.
;-------------------------------------------------------
moveq #true32b,d0 ; Set up to flip into 32-bit addressing mode.
_SwapMMUMode ; Do the flip.
move.l d0,memMode(a6) ; save old mode
lea VRAMBase,a2 ; Point to the base of VRAM.
move.w vvpNumRows(a1),d3 ; Get the number of rows.
move.l #OneBitGray,d2 ; Set the 1bpp gray pattern.
@nextRow moveq #0,d1
move.w vvp1bppRowBytes(a1),d1 ; Get the number of bytes/row.
move.w d1,d0
andi.w #$03,d0 ; d0 = Rem(bytes/row DIV 4)
lsr.w #2,d1 ; d1 = Int(longs/row)
bra.s @cntLong
@nextLong move.l d2,(a2)+ ; Write out gray to the frame bufferÉ
@cntLong dbra d1,@nextLong ; Éfor each scanline.
bra.s @cntByte
@nextByte move.b d2,(a2)+ ; finish remainder (if any) with bytes
@cntByte dbra d0,@nextbyte
not.l d2 ; Invert the pattern for the next row.
dbra d3,@nextRow ; Repeat for each row.
move.l memMode(a6),d0 ; restore old mode
_SwapMMUMode ; Do the flip.
ENDWITH
;-------------------------------------------------------
; Turn on video now
;-------------------------------------------------------
; First, turn on the syncsÉ
;
move.b VSC_VidCtrl(a4),d0
ori.b #((1<<VSCEnCSync)+\ ; enable composite syncÉ
(1<<VSCEnVSync)+(1<<VSCEnHSync)+\ ; enable h/v syncÉ
(1<<VSCExtMuxDelay)),d0 ; enable ???
move.b d0,VSC_VidCtrl(a4) ; Do it.
; Next, wait a few frames to let the monitor catch up with usÉ
;
Moveq #5-1,D1 ; WeÕre going to wait 5 VBLs.
@WaitBlank Clr.b VSC_IntClear(A4) ; Clear the current VBL.
@SyncLoop Btst #slotVBL,AIV3SlotInt(A3) ; If itÕs not pending (0=pending),
Bne.s @SyncLoop ; then keep looping.
Dbra D1,@WaitBlank ; Keep loop Õtil done.
; Finally, letÕs show that video.
;
Ori.b #(1<<VSCblankBit),VSC_VidCtrl(A4) ; Enable blanking.
;-------------------------------------------------------
; Clean up and go home.
;-------------------------------------------------------
VSCExit
Move.l vidParamsPtr(A6),D0 ; If the vidParamsPtr is nil,
Beq.s @LastChance ; then just go on.
Movea.l D0,A0 ; Dispose of the vidParams pointer.
_DisposPtr
@LastChance
move.b #((0<<setEnable)|\
(1<<ejectEn)|\
(1<<enetEn)),vscBase+vscIER
unlk a6 ; De-allocate local stack frame.
rts ; Return to caller.
ENDWITH
ALIGN 4
;---------------------------------------------------------------------
; Lists all video functional sRsrc's used for pruning/disabling.
;---------------------------------------------------------------------
VSCModeList dc.w EndVSCML-BeginVSCML-1
BeginVSCML
dc.b sRsrc_Vid_VSC_FPa, sRsrc_Vid_VSC_FPb
dc.b sRsrc_Vid_VSC_GS
dc.b sRsrc_Vid_VSC_RGBFPa, sRsrc_Vid_VSC_RGBFPb
dc.b sRsrc_Vid_VSC_HR
dc.b sRsrc_Vid_VSC_VGA
dc.b sRsrc_Vid_VSC_GF
dc.b sRsrc_Vid_VSC_SVGA
dc.b sRsrc_Vid_VSC_MSB1, sRsrc_Vid_VSC_MSB2
dc.b sRsrc_Vid_VSC_1K
EndVSCML
ALIGN 4
; The VSCConfigTable is an array of configuration parameters indexed
; by monitor type. Within each set of monitor parameters is a set
; of parameters that are indexed by the amount of vRAM available. These
; paramters are used in setting up the intial values of the CLUT and
; selecting the right functional sRsrc per monitor per vRAM configuration.
;
WITH VSCConfigRec
VSCConfigTable
dcb.b SConfigRecSize,sRsrc_VSC_NeverMatch ; [0] Vesuvio (Not Supported)
dc.b $00,$00,$00,$00,$00,$FF,0,0 ; [1] Mono Full-Page
dc.b sRsrc_Vid_VSC_FPa,sRsrc_Vid_VSC_FPb,0,0 ; 512K params
Dc.b ThirdVidMode,0 ;
dc.b $05,$FF,$05,$FF,$05,$FF,0,0 ; [2] Rubik
dc.b sRsrc_Vid_VSC_GS,0,0,0 ; 512K params
Dc.b FourthVidMode,0 ;
dcb.b SConfigRecSize,sRsrc_VSC_NeverMatch ; [3] Mono Two-Page (Not Supported)
dcb.b SConfigRecSize,sRsrc_VSC_NeverMatch ; [4] NTSC (Not Supported)
dc.b $00,$FF,$00,$FF,$00,$FF,0,0 ; [5] RGB Full-Page
dc.b sRsrc_Vid_VSC_RGBFPa,sRsrc_Vid_VSC_RGBFPb,0,0 ; 512K params
Dc.b ThirdVidMode,0 ;
dc.b 00,$FF,$00,$FF,$00,$FF,0,0 ; [6] High-Res RGB/Mono
dc.b sRsrc_Vid_VSC_HR,0,0,0 ; 512K params
Dc.b FourthVidMode,0 ;
dcb.b SConfigRecSize,sRsrc_VSC_NeverMatch ; [7] (Skip, no-connect)
dc.b $00,$FF,$00,$FF,$00,$FF,0,0 ; [8] VGA
dc.b sRsrc_Vid_VSC_VGA,sRsrc_Vid_VSC_SVGA,sRsrc_Vid_VSC_1K,0 ; 512K params
Dc.b FourthVidMode,0 ;
dcb.b SConfigRecSize,sRsrc_VSC_NeverMatch ; [9] PAL (Not Supported)
dc.b $00,$FF,$00,$FF,$00,$FF,0,0 ; [10] GoldFish
dc.b sRsrc_Vid_VSC_GF,0,0,0 ; 512K params
Dc.b FourthVidMode,0 ;
dcb.b SConfigRecSize,sRsrc_VSC_NeverMatch ; [11] 19" (Not Supported)
dc.b $00,$FF,$00,$FF,$00,$FF,0,0 ; [12] MSB1
dc.b sRsrc_Vid_VSC_MSB1,sRsrc_Vid_VSC_GS,sRsrc_Vid_VSC_GF,0 ; 512K params
Dc.b FourthVidMode,0 ;
dc.b $00,$FF,$00,$FF,$00,$FF,0,0 ; [13] MSB2
dc.b sRsrc_Vid_VSC_MSB2,sRsrc_Vid_VSC_HR,sRsrc_Vid_VSC_1K,0 ; 512K params
Dc.b FourthVidMode,0 ;
dc.b $00,$FF,$00,$FF,$00,$FF,0,0 ; [14] MSB3
dc.b sRsrc_Vid_VSC_MSB2,sRsrc_Vid_VSC_HR,sRsrc_Vid_VSC_1K,0 ; 512K params
Dc.b FourthVidMode,0 ;
ENDWITH

View File

@ -0,0 +1,182 @@
;
; File: SecondaryInit.a -> VSCSecondaryInit.a
;
; Contains: Some code to whack the 'scrn' resource on family mode switches.
;
; Written by: Russ Emmons
;
; Copyright: © 1988-1993 by Apple Computer, Inc., all rights reserved.
;
; Change History (most recent first):
;
; <1> 12/14/93 PN first checked in
; <1> 07-19-93 jmp first checked in
; ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
; Pre-Kaos Proj comments begin here.
; ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
; <4> 06-24-93 jmp Since the CheckDevicesInit actually runs AFTER we do, we now
; just fix the family-mode 'scrn' resource to have the right bit
; depth -- this way, we donÕt blow away the userÕs setup.
; <3> 06-14-93 jmp Performed general file clean up.
; <2> 06-11-93 jmp Added code that removes the 'scrn' resource if it is invalid.
; ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
; Pre-NuBrawl Proj comments begin here.
; ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
; <3> 03-17-93 jmp Ripped out even more stuff. If I remember, IÕm going to pull
; this from DeclData!
; ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
; Pre-Atlantis ROM comments begin here.
; ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
; <2> 7/2/92 RLE remove CTB stuff
; <1> 5/5/92 RLE first checked in
;
;----------------------------------------------------------------------------
; Header
;----------------------------------------------------------------------------
dc.b sExec2 ; Header
dc.b sCPU68020
dc.w 0
dc.l BeginSInit-*
;---------------------------------------------------------------------
; Local variables, definitions, etc....
;---------------------------------------------------------------------
SInitStackFrame Record {A6Link},Decrement
Return Ds.l 1 ; Return address.
A6Link Ds.l 1 ; Saved A6.
spBlk Ds SpBlock ; SpBlock for generic use.
sPRAMBlk Ds.b SizesPRAMRec ; SpRAMRec for generic use.
SInitStackSize Equ *
Endr
;----------------------------------------------------------------------------
; Utilities
;----------------------------------------------------------------------------
;---------------------------------------------------------------------
;
; Routine: ChkScrn
;
; Inputs: None
;
; Outputs: None
;
; Destroys: A0-A2/D0-D2
;
; Function: Classically, the Monitors control panel writes out an
; 'scrn' resource that would flip us into 1bpp (i.e.,
; mode $80) on family mode changes. We attempt to
; solve that problem here by re-writing the appropriate
; value into the 'scrn' resource itself.
;---------------------------------------------------------------------
With SInitStackFrame,SpBlock,ScrnRecord,SP_Params
ChkScrn Lea spBlk(A6),A0 ; Point to our spBlock.
Lea sPRAMBlk(A6),A2 ; Point to a sPRAM block.
Move.l A2,spResult(A0) ; Set up read buffer.
_sReadPRAMRec ; Read our SlotÕs pRAM.
Bclr #spFamilyChanged,SP_Flags(A2) ; Always reset the family-changed bit.
Beq @EndScrn ; If it was already reset, then go on.
; Check to see our video is actually runningÉ
;
Clr.b spId(A0) ; Begin at id 0.
Clr.b spTBMask(A0) ; No mask in search.
Move.w #catDisplay,spCategory(A0) ; Look for: Display,
Move.w #typVideo,spCType(A0) ; Video,
Move.w #drSwApple,spDrvrSW(A0) ; Apple,
Move.w #drHwVSC,spDrvrHW(A0) ;
Clr.l spParamData(A0) ; Look only for enabled sRsrcs.
_GetTypeSRsrc ; If we didnÕt find ourselves,
Bne.s @EndScrn ; then just go on.
Move.l A2,spsPointer(A0) ; Set up to write out Slot PRAMÉ
_sPutPRAMRec ; Éto clear the spFamilyChanged bit.
Moveq #0,D2 ; Clear D2 for good measure.
Move.b spSlot(A0),D2 ; Remember our slot number.
; Check to see if thereÕs an 'scrn' resource availableÉ
;
Clr.l -(Sp) ; Make room for the function result.
Move.l #'scrn',-(Sp) ; Push desired resource type.
Clr.w -(Sp) ; Resource ID = 0.
_GetResource ; Get the resource.
Move.l (Sp)+,D0 ; Get the resource handle.
Beq.s @EndScrn ; If nil, then just go on.
Move.l D0,-(Sp) ; Save Handle for _ReleaseResource call.
Movea.l D0,A2 ; Save it for easy access later on.
Movea.l D0,A0 ; Set up to lock it down for now.
_HNoPurge ; Make it non-purgeable andÉ
_HLock ; Élock it down.
; Check to see if weÕre in the 'scrn' resourceÉ
;
Movea.l (A0),A0 ; Get a pointer to the 'scrn' resource.
Move.w (A0)+,D0 ; Get the number of 'scrn' records to search.
Subq #1,D0 ; Make it zero-based.
@ScrnLoop Cmp.b srSlot(A0),D0 ; If this entry is for our slot number,
Beq.s @ChkDrHwID ; then check the drHwID.
Adda.w #ScrnRecSize,A0 ; Otherwise, point A0 at the next entry.
Dbra D0,@ScrnLoop ; Loop until done.
Bra.s @EndScrnChk ; We couldnÕt find our 'scrn' entry, so just go on.
@ChkDrHwID
Move.w #drHwVSC,D0 ; Get our drHwID back into D0.
Cmp.w srDrvrHW(A0),D0 ; If the drHwIDs donÕt match,
Bne.s @EndScrnChk ; then just go on.
; Make sure the depth (mode) setting is correctÉ
;
Lea sPRAMBlk(A6),A1 ; Point to our sPRAM block.
Moveq #0,D0 ; Clear D0 for good measure.
Move.b SP_Depth(A1),D0 ; Get the mode weÕd like to be at.
Cmp.w srMode(A0),D0 ; If the modes match,
Beq.s @EndScrnChk ; then just go on.
Move.w D0,srMode(A0) ; Otherwise, write out what we want.
Move.l A2,-(Sp) ; Set up to mark our change.
_ChangedResource ; Do it.
Move.l A2,-(Sp) ; Set up to write our change out.
_WriteResource ; Do it.
; Clean up and go homeÉ
;
@EndScrnChk _ReleaseResource ; Release the ÔscrnÕ resource.
@EndScrn Rts ; And return home.
Endwith
;----------------------------------------------------------------------------
; Main
;----------------------------------------------------------------------------
With SEBlock,SInitStackFrame
BeginSInit
Link A6,#SInitStackSize ; Allocate some space on the stack.
Move.w #seSuccess,seStatus(A0) ; No reason to fail here.
; Perform some generic intializations.
;
Move.b seSlot(A0),spBlk.spSlot(A6) ; Get our slot number from the Slot Manager.
Clr.b spBlk.spExtDev(A6) ; DonÕt ask why, always clear this guy.
; Check to see if the 'scrn' resource needs updating.
;
Bsr.s ChkScrn ; Whack the 'scrn' resource if necessary.
; Clean up and go home.
;
Unlk A6
Rts
Endwith

View File

@ -0,0 +1,60 @@
#
# File: Backlight.make
#
# Contains: Makefile for Backlight.
#
# Written by: ricardo batista
#
# Copyright: © 1992-1993 by Apple Computer, Inc., all rights reserved.
#
# Change History (most recent first):
#
# <SM2> 12/13/93 PN Roll in KAOs and Horror changes to support Malcom and AJ
# machines
# <SM2> 2/11/93 CSS Update from Horror. Add "backlightinput.c.o" and
# "backlightcpu.c.o" to the build.
# <1> 12/18/92 RB first checked in
# <SM1> 11/14/92 rb New today
#___________________________________________________________________________________________________
# Backlight driver
BL_DRVR_OBJ = "{ObjDir}backlight.c.o" ¶
"{ObjDir}backlight.a.o"
"{ObjDir}backlight.a.o" Ä "{AIncludes}SysEqu.a" ¶
"{AIncludes}SysErr.a" ¶
"{BackLightDir}backlight.a"
Asm -o {Targ} "{BackLightDir}backlight.a" {StdAOpts}
"{ObjDir}backlight.c.o" Ä "{BackLightDir}backlight.h" ¶
"{BackLightDir}PowerMgr.h" ¶
"{CIncludes}SysEqu.h" ¶
"{CIncludes}memory.h" ¶
"{CIncludes}OSEvents.h" ¶
"{CIncludes}devices.h" ¶
"{CIncludes}errors.h" ¶
"{CIncludes}retrace.h" ¶
"{CIncludes}Shutdown.h" ¶
"{BackLightDir}backlight.c"
C -o {Targ} "{BackLightDir}backlight.c" {StdCOpts}
"{ObjDir}register.c.o" Ä "{BackLightDir}backlight.h" ¶
"{BackLightDir}PowerMgr.h" ¶
"{BackLightDir}register.c"
C -o {Targ} "{BackLightDir}register.c" {StdCOpts}
"{RsrcDir}Backlight.DRVW" Ä {BL_DRVR_OBJ}
Link -o {Targ} -rt "DRVW"=-16511 -sg backlight ¶
"{Libraries}DRVRRuntime.o" ¶
{BL_DRVR_OBJ}
"{RsrcDir}Backlight.RSRC" Ä {BL_DRVR_OBJ} ¶
"{RsrcDir}Backlight.DRVW" ¶
"{BackLightDir}backlight.r"
Rez -o {Targ} {StdROpts} "{BackLightDir}backlight.r" ¶
-d Obj="¶"{RsrcDir}Backlight.DRVW¶""

190
Drivers/Backlight/PWM.c Normal file
View File

@ -0,0 +1,190 @@
/*
File: PWM.c
Contains: This file contains the hardware specific routines to control a PWM-based
interface found on Asahi, TIM, DB-Lite.
Written by: Andy Gong x6595
Copyright: © 1990-1993 by Apple Computer, Inc., all rights reserved.
Change History (most recent first):
<SM3> 2/11/93 CSS Update from Horror. Comments follow:
<H10> 6/30/92 ag Moved cpu depended initialization code to cpu.c file, input
routines to input.c, and table routines to backlight.c file.
<H9> 5/26/92 ag Added write to PONTI to turnoff backlight through PONTI bit.
<H8> 5/7/92 ag Use new table record for min/max limits. Added new entry for
Dartanian.
<H7> 4/24/92 ag set default to single table operation except on TIM (LC). added
new vector for custom input control to handle hardware
dependencies.
<H6> 12/17/91 SWC Added boxDBLiteLC to the list in InitPWMControls. Grouped boxTIM
and boxDartanian since their code is identical.
<H5> 12/16/91 HJR Added boxDartanian to the list.
<H4> 9/10/91 SWC Changed Get_AtoD to get the current setting of the up/down
buttons.
<H3> 8/27/91 SWC Changed references to get/set contrast to use get/set brightness
on machines other than TIM. On TIM, they used the contrast
command to control screen brightness. Added PWM table for
DB-Lite.
<H2> 8/5/91 SWC Changed Get_AtoD to use GetScreenCmd to get the current contrast
instead of reading from the A-D if not on TIM.
<3> 3/24/92 JSM Nuke boxFlag codenames.
<2> 3/23/92 JSM OSEvents.h is obsolete, use Events.h.
<1> 10/24/91 SAM/KSM Rolled in Regatta file.
Regatta Change History:
<6> 8/29/91 SAM (ag) changed power manager call "BatteryStatusImmCmd" for more
responsiveness.
<5> 7/18/91 SAM (ag) changed initialization code. converted to table only brightness
levels.
<4> 6/30/91 SAM Merged from TERROR [<4><5><6><7><8>].
<3> 6/14/91 SAM (ag) Turnoff backlight at close. Changed low power handling
code, to rescale pot to lower range.
<1> 5/15/91 SAM Split off from TERRORProj.
Terror Change History:
<8> 6/27/91 ag fixed bug with init powerbook 100, initialize table based data
only on table based hardware.
<7> 6/27/91 ag centralize table determination code "LowTable".
<6> 6/27/91 ag code clean up.
<5> 6/26/91 ag added support for table change as a function of charger and
voltage.
<4> 6/24/91 ag Changed look up table size to byte elements. Added software
scale control. Added software setting controls. Added software
table control.
<3> 6/10/91 ag Changed low power handling code, to rescale pot to lower range.
<2> 6/5/91 ag turnoff backlight at close
*/
/*page*/
/************************************/
/*** INCLUDE FILES DECLARATIONS ***/
#include <SysEqu.h>
#include <types.h>
#include <memory.h>
#include <Events.h>
#include <devices.h>
#include <errors.h>
#include <retrace.h>
#include <Shutdown.h>
#include <stdlib.h>
#include "PowerMgr.h"
#include "backlight.h"
/*page
***************************************************************************************************
** PWM software ***********************************************************************************
***************************************************************************************************
*/
OSErr InitPWMControls(driverGlobalPtr globalPtr)
{
unsigned int startvalue;
/* initialize dual table variables */
if (globalPtr->dualTable)
{
globalPtr->slewLimit = true; /* maximum change per/accrun */
(*globalPtr->tableProc)(globalPtr); /* determine table based on current charger state */
};
/* initialize backlight hardware */
startvalue = (*globalPtr->userInputProc)(globalPtr); /* <H8> */
globalPtr->userBrightness = -1;
globalPtr->userBrightness = (*globalPtr->setlevelproc)(startvalue,globalPtr); /* <H8> */
return(noErr);
};
/*
***************************************************************************************************
*
*
***************************************************************************************************
*/
int PWMCloseRoutine (driverGlobalPtr globalPtr)
{
(*globalPtr->setlevelproc)(globalPtr->settingTable->minimum,globalPtr);
return(0);
};
/*page
***************************************************************************************************
*
* The control routineÉ
*
* return:
* noErr - task completed successfully
* controlErr - illegal control selector
*
*
***************************************************************************************************
*/
OSErr PWMControl(CntrlParam *ctlPB,driverGlobalPtr globalPtr) /* 'open' entry point */
{
int error;
int tempvalue;
error = noErr;
if (!globalPtr->disableHWinput) /* if hardware not disabled, error */
error = controlErr;
else
switch(ctlPB->csCode)
{
case kSetScreenBrightness: /* set brightness level */
tempvalue = ctlPB->csParam[0];
globalPtr->userBrightness = (*globalPtr->setlevelproc)(tempvalue,globalPtr);
break;
default:
error = controlErr;
};
return(error);
};
/*
***************************************************************************************************
*
*
***************************************************************************************************
*/
int SetPWM(int new,driverGlobalPtr globalPtr)
{
PMgrPBlock pb; /* power manager pb */
unsigned char val; /* hardware value setting */
PEG_TO_LIMITS(new, globalPtr->maximumTable[globalPtr->powerRange], globalPtr->settingTable->minimum); /* <H8> use new tables */ /* limit value to valid range */
val = globalPtr->settingTable->table[new]; /* look up value from table */
if ((globalPtr->userBrightness >= 0) && (val == globalPtr->lastHWSetting)) return(new);/* nothing to do; 90/05/15 just turn on; 90/07/02 avoid touching */
if (globalPtr->slewChange)
{
if (abs(globalPtr->lastHWSetting - val) > globalPtr->slewLimit)
val = globalPtr->lastHWSetting + ((globalPtr->lastHWSetting > val) ? -globalPtr->slewLimit : globalPtr->slewLimit);
else
globalPtr->slewChange = false;
};
globalPtr->lastHWSetting = val; /* save the new hardware setting */
pb.pmgrCmd = SetBrightnessCmd; /* everyone else uses "set brightness" */
pb.pmgrCnt = 1;
pb.pmgrXPtr = &val;
pb.pmgrRPtr = nil;
PMgr(&pb); /* set the pwm */
return(new); /* return the current value */
};

View File

@ -0,0 +1,145 @@
/*
File: PowerMgr.h
Contains: Portable Macintosh Control Panel
Power Manager Interim Equates
Written by: Andy Gong x6595
Copyright: © 1991, 1993 by Apple Computer, Inc., all rights reserved.
Change History (most recent first):
<SM2> 2/11/93 CSS Update from Horror. Comments follow <H4-H2>:
<H4> 6/30/92 ag Added new PowerManager command.
<H3> 8/26/91 SWC Fixed <2> (conflict with procedure name in driver).
<H2> 8/26/91 SWC Added definitions for the get/set brightness commands.
<6> 10/30/91 JSM Add a few more comments, remove some power manager commands,
misc. macros, and definition of Sleep(), none of which are used.
<5> 10/29/91 SAM Removed stuff not used by the backlight driver. Reincluded
Power.h from 7.0 change <2>.
<4> 10/28/91 SAM Rolled in Regatta file.
Regatta History (most recent first):
<3> 8/29/91 SAM (ag) added BatteryStatusImmCmd for non-filtered values. This was
a problem with asahi input (samples 1 second averaged).
<2> 6/30/91 SAM Merged from TERROR [<2>].
<1> 5/15/91 SAM Split off from TERRORProj.
Terror Change History:
<2> 6/26/91 ag changed global values to unsigned char.
<1> 1/23/91 ag first checked in
7.0 Change History:
<2> 8/19/91 JSM Include public Power.h, remove stuff thatÕs in Power.h (except
for BOnIgnoreModem(), which for some reason isnÕt there), remove
other stuff that doesnÕt appear to be used in the backlight
driver at all. An interesting result of this: all the PowerMgr
routines defined here were C functions, when they are actually
Pascal functions (as defined in Power.h). This fixed a bug in
DRVROpen() in backlight.c which calls SleepQInstall() and was
mistakenly cleaning up too much on the stack. This really wasn't
a problem, though, since it happened just before an unlink which
fixed up the stack correctly.
<1> 2/22/91 ag roll 1.0 backlight driver into 7.0
*/
#include <retrace.h>
#include <Power.h>
/* Power Manager globals from InternalOnlyEqu.a */
typedef struct {
char SleepTime;
char HDTimeout;
struct QHdr SleepQHdr;
char SysTaskFlag;
char LastLevel;
char SaveSpeedo;
char Charger;
char SleepFlags;
char TimeOutdirtyFlag;
Ptr WakeVector;
Ptr HDvector;
int LastAct;
int LastHd;
unsigned char LowWarn; /* <t2> ag this is an unsigned value */
unsigned char Cutoff; /* <t2> ag this is an unsigned value */
Ptr BNmQEntry[9];
char BatQ[8];
char lpMSGvalid;
char IdleFlagCnt;
unsigned char BatAvg; /* <t2> ag this is an unsigned value */
char NTSCcopy;
char pmfree[2];
Ptr RAMwatchPtr;
Ptr ROMwatchPtr;
char watchCrsr;
char BatQIndex;
Ptr SleepNetHook;
Ptr vBatInt;
Ptr vEnvInt;
char WakeWarn;
char Level4Cnt;
Handle lpSICNHndl;
Str255 *(lpSTRPtr[4]);
VBLTask BatVBLTask;
VBLTask SwVBLTask;
} PmgrGlobals;
/* MachineType returned by SysEnvirons for Portable */
#define envPortable 8
/* Power Manager commands */
#define PowerControlCmd 0x10
#define PowerStatusCmd 0x18
#define ModemSetCmd 0x50
#define ScreenSetCmd 0x40
#define SetBrightnessCmd 0x41
#define GetScreenCmd 0x48
#define GetBrightnessCmd 0x49
#define ModemStatusCmd 0x58
#define BatteryStatusCmd 0x68
#define BatteryStatusImmCmd 0x69 /* <H4> command to read immediate not averaged values */
#define SetWTimeCmd 0x80
#define DisableWTimeCmd 0x82
#define ReadWTimeCmd 0x88
/* Masks for ModemStatusCmd and ModemSetCmd */
#define kModemOn 0x01
#define kModemPortA 0x02
#define kModemWakeup 0x04
#define kModemInstalled 0x08
#define kModemRingDetect 0x10
#define kModemOnHook 0x20
/* Parameter block for PMgr calls */
typedef struct {
short pmgrCmd, pmgrCnt;
Ptr pmgrXPtr, pmgrRPtr;
} PMgrPBlock;
typedef PMgrPBlock *PMgrPBPtr;
/* Glue for PMgr calls */
pascal OSErr PMgr(PMgrPBPtr pbp)={0x205F,0xA085,0x3E80};
/*
move.l (sp)+,a0
_PMgrOp
move d0,(sp)
*/
pascal OSErr Sleep()={0x7002,0xA08A};
/*
moveq #2,d0
_Sleep
*/
/* access to Power Manager's local variables */
#define PMgrLBase 0xd18
#define PMgrLocal(offset) (*((char *)(*((long *)PMgrLBase)+(offset))))
#define TOdirtyFlag 0x11
/* #define BatAvg 0x52 */

View File

@ -0,0 +1,518 @@
/*
File: register.c
Contains: Register control for backlight.
Written by: Andy Gong x6595
Copyright: © 1991-1993 by Apple Computer, Inc., all rights reserved.
Change History (most recent first):
<SM5> 12/13/93 PN Roll in KAOs and Horror changes to support Malcom and AJ
machines
<SM4> 2/11/93 CSS Update from Horror. Comments follow:
<H4> 6/30/92 ag Moved cpu depended initialization code to cpu.c file, and input
routines to input.c.
<H3> 5/7/92 ag Use new table record for min/max limits.
<H2> 4/24/92 ag return error from initialization.
<2> 3/23/92 JSM OSEvents.h is obsolete, use Events.h.
<1> 10/24/91 SAM/KSM Rolled in Regatta file.
Regatta Change History:
<8> 8/21/91 SAM Undid the last mod. Using GetKeys again.
<7> 8/19/91 SAM (ag) added a key repeat delay to the key processing stuff.
<6> 7/30/91 SAM (ag) removed special initialization code in set brightness,
changed type of pram value to int to allow for negative error
check.
<5> 7/18/91 SAM (ag) cleaned up initialization code.
<4> 6/30/91 SAM Merged from TERROR [<5>].
<3> 6/14/91 SAM (ag) added support in set level routine to handle passing in an
illegal value as a flag to indicated initialization. Changed low
power handling, get input and set output routines will key off
of power state.
<1> 5/15/91 SAM Split off from TERRORProj.
Terror Change History:
<5> 6/24/91 ag Changed init code to initialize to user value. Changed calling
structure for setting backlight. Changed lookup tables to byte
size elements.
<4> 6/10/91 ag Changed low power handling, get input and set output routines
will key off of power state.
<3> 5/10/91 ag added support in set level routine to handle passing in an
illegal value as a flag to indicated initialization.
<2> 4/23/91 ag cleaned up init code, moved initial code to main (backlight.c).
*/
#define PORTABLE_HW 0xFC0202
/*page*/
/************************************/
/*** INCLUDE FILES DECLARATIONS ***/
#include <SysEqu.h>
#include <types.h>
#include <traps.h>
#include <memory.h>
#include <Events.h>
#include <OSUtils.h>
#include <devices.h>
#include <errors.h>
#include <Shutdown.h>
#include <Stdlib.h>
#include "PowerMgr.h"
#include "backlight.h"
void SleepEntry();
// *** backlight stuff
#define ON_BIT 0x02 /* 0 = off, 1 = on*/
#define L_CS_BIT 0x20 /* 0 = select chip to accept data */
#define COUNTDN_BIT 0x40 /* 0 = down, 1 = up */
#define COUNT_BIT 0x80 /* 1 - 0 - 1 pulsed to count */
#define ALL_BITS COUNT_BIT + COUNTUP_BIT + L_CS_BIT
#define SELECT(backlightreg,value) value &= (~L_CS_BIT); *backlightreg = value
#define DESELECT(backlightreg,value) value |= L_CS_BIT ; *backlightreg = value
#define MAXSTROBECOUNT 256
#define MAXPOTVALUE 255 /* maximum value of digital pot */
#define MINPOTVALUE 0 /* maximum value of digital pot */
/* brightness boundaries */
#define kMaxBrightness 30 /* <5> maximum brightness */
#define kMinBrightness 0 /* minimum brightness */
#define REPEATTIME 5
#define REPEATTHRESHOLD 1
#define BACKLIGHT_ON true
#define BACKLIGHT_OFF false
#define SLEEPQELEMENTTYPE 16
// *** keyboard stuff
#define KEYDOWNTEST(keynum,map) (map[keynum >> 3] & (1 << (keynum % 8)))
#define KEYDOWNBYTETEST(bytenum,keymask,map) (map[bytenum] & keymask)
#define UPARROW 0x7E
#define DOWNARROW 0x7D
#define RIGHTARROW 0x7C
#define LEFTARROW 0x7B
#define BYTEMASK_7_CTL 0x88
#define BYTEMASK_7_OPT 0x44
#define BYTEMASK_7_SFT 0x11
typedef struct
{
long oldvector;
char keysActive;
char keymodifiers;
short unused;
} posteventtype, *posteventtypeptr;
extern setTableType PortableTbl5V;
int GetBacklightInfo(short mask, short shift);
void SaveBacklightInfo(short new,short mask, short shift);
TurnOnOff(Boolean on);
setNewKeys(int keycombo);
/*page
***************************************************************************************************
** Register control software **********************************************************************
***************************************************************************************************
*/
OSErr InitRegControls(driverGlobalPtr globalPtr)
{
int SetBrightness();
int KbdControl();
int RegisterClose();
unsigned int pramBrightness;
void ShutdownBacklight();
if (BACKLIGHTSIGREG & TABLE_5V) globalPtr->settingTable = &PortableTbl5V;
globalPtr->keycodes = GetPramKeyData();
pramBrightness = GetPramBrightness(); /* get pram setting */
setNewKeys(globalPtr->keycodes);
if (pramBrightness < 0) /* check for valid brightness value */
{
pramBrightness = globalPtr->settingTable->minimum+1; /* <H3> load default brightness */
SaveBrightness(globalPtr->settingTable->minimum+1); /* <H3> validate, as save new brightness */
};
globalPtr->userBrightness = globalPtr->settingTable->maximum; /* <H3> */
globalPtr->userBrightness = SetBrightness(globalPtr->settingTable->minimum,globalPtr); /* <H3> initialize pot */
globalPtr->userBrightness = SetBrightness(pramBrightness,globalPtr); /* set brightness level */
if (BACKLIGHTSIGREG == BACKLIGHTSIG_UPGRD)
{
globalPtr->sleepQelement.sleepQType = SLEEPQELEMENTTYPE;
globalPtr->sleepQelement.sleepQProc = (ProcPtr) SleepEntry;
SleepQInstall(&globalPtr->sleepQelement); /* install sleep task */
};
ShutDwnInstall( (ShutDwnProcPtr) ShutdownBacklight,sdRestartOrPower); /* install shutdown task */
return(noErr);
};
/*page
***************************************************************************************************
*
*
***************************************************************************************************
*/
void StrobeCount(char *backlightreg, int number, unsigned char value)
{
int index;
if (!number) return; /* return if no strobes */
value |= COUNT_BIT; /* start with count inactive */
for (index = (number << 1); index; index--) /* <15> write twice for each pulse <90/08/01>*/
{
value ^= COUNT_BIT; /* toggle count bit */
*backlightreg = value; /* write value */
}
};
/*page
***************************************************************************************************
*
*
***************************************************************************************************
*/
void ShutdownBacklight()
{
TurnOnOff(BACKLIGHT_OFF);
};
/*page
***************************************************************************************************
*
* This sleep task is necessary due to the fact CPU hardware changed the design of the board and
* power to the backlight is nolonger turned off by the hardware at sleep or shutdown (yuck!).
* Therefore software MUST turn off the backlight for now. ( 90/07/20 ag )
*
*
***************************************************************************************************
*/
void Sleep_Task(driverGlobalPtr globalPtr, int selector)
{
#define SLEEPQELEMENTTYPE 16
#define SLEEP_REQUEST 1
#define SLEEP_DEMAND 2
#define SLEEP_WAKEUP 3
#define SLEEP_REQ_ABORT 4
switch (selector)
{
case SLEEP_DEMAND:
globalPtr->vbl_ok = false;
TurnOnOff(BACKLIGHT_OFF);
break;
case SLEEP_WAKEUP:
if (globalPtr->userBrightness) TurnOnOff(BACKLIGHT_ON);
globalPtr->vbl_ok = true;
break;
case SLEEP_REQ_ABORT:
case SLEEP_REQUEST:
default:
break;
};
};
/*
***************************************************************************************************
*
*
***************************************************************************************************
*/
TurnOnOff(Boolean on)
{
unsigned char regvalue;
char *backlightreg;
Boolean onBitHigh;
backlightreg = (Ptr) PORTABLE_HW;
onBitHigh = (BACKLIGHTSIGREG & ON_HIGH);
regvalue = COUNT_BIT + L_CS_BIT; /* start with count and CS inactive */
if ((onBitHigh && on) || (!onBitHigh && !on))
regvalue |= ON_BIT; /* upgrade has opposite polarity */
*backlightreg = regvalue; /* write value */
};
/*page
***************************************************************************************************
*
*
***************************************************************************************************
*/
int SetBrightness(int new, driverGlobalPtr globalPtr)
{
unsigned char regvalue;
int strobes;
char *backlightreg;
char signature;
Boolean onBitHigh;
Boolean countDownBit;
int current;
unsigned char tablevalue;
Boolean initialize;
initialize = (globalPtr->userBrightness < 0);
PEG_TO_LIMITS(new, globalPtr->maximumTable[globalPtr->powerRange], globalPtr->settingTable->minimum); /* <H3> limit value to valid range */
current = (initialize)
? globalPtr->settingTable->minimum /* <H3> */
: globalPtr->userBrightness;
tablevalue = globalPtr->settingTable->table[new]; /* <H3> look up value from table */
if (!initialize && (tablevalue == globalPtr->lastHWSetting) )
return(new); /* nothing to do; 90/05/15 just turn on; 90/07/02 avoid touching */
/* setup control bits */
signature = BACKLIGHTSIGREG;
onBitHigh = (signature & ON_HIGH);
countDownBit = (signature & COUNT_DWNBIT);
backlightreg = (Ptr) PORTABLE_HW;
regvalue = COUNT_BIT + L_CS_BIT; /* start with count and CS inactive */
if ((onBitHigh && (new != globalPtr->settingTable->minimum)) || (!onBitHigh && (new == globalPtr->settingTable->minimum))) /* <H3> */
regvalue |= ON_BIT; /* upgrade has opposite polarity */
if ((countDownBit && (new <= current)) || (!countDownBit && (new >= current)))
regvalue |= COUNTDN_BIT; /* set the count down bit if new > current */
strobes = (new == globalPtr->settingTable->minimum) /* <H3> */
? MAXSTROBECOUNT /* if minimum, bang against stops */
: abs(globalPtr->lastHWSetting - tablevalue);
SELECT(backlightreg,regvalue); /* assert chip select */
StrobeCount(backlightreg,strobes,regvalue); /* strobe count line */
DESELECT(backlightreg,regvalue); /* deassert chip select */
globalPtr->lastHWSetting = tablevalue; /* save the hardware setting */
return(new);
};
/*page
***************************************************************************************************
*
* bit 2 1 0
* +-----+-----+-----+
* | | | |
* | opt | sft | ctl |
* | | | |
* +-----+-----+-----+
*
* 90/12/18 ag recoded key down check.
*
*
*
***************************************************************************************************
*/
Boolean KeysDown(int value, char kbdmap[])
{
#define CONTROLBIT 0x01;
#define SHIFTBIT 0x02;
#define OPTIONBIT 0x04;
int keysDown;
if (!value) return (false); /* no key combinations */
keysDown = 0;
if (kbdmap[7] & BYTEMASK_7_CTL) keysDown += CONTROLBIT;
if (kbdmap[7] & BYTEMASK_7_SFT) keysDown += SHIFTBIT;
if (kbdmap[7] & BYTEMASK_7_OPT) keysDown += OPTIONBIT;
return((keysDown == value));
};
/*page
***************************************************************************************************
*
*
***************************************************************************************************
*/
int KbdControl (driverGlobalPtr globalPtr)
{
char kbdmap[16];
int delta;
int returnValue;
int maximum;
returnValue = globalPtr->userBrightness;
maximum = globalPtr->maximumTable[globalPtr->powerRange];
if (globalPtr->userBrightness > maximum)
return(maximum);
GetKeys((KeyMap) &kbdmap[0]);
// postdataptr = &postEventData;
// if (!postdataptr->keysActive)
if (!KeysDown(globalPtr->keycodes,kbdmap))
{
globalPtr->mousedownTicks = 0; /* no mouse event */
globalPtr->kbdactive = false; /* kbd control cancel */
}
else
{
globalPtr->mousedownTicks += 1; /* increment mouse down time */
if (globalPtr->mousedownTicks > ((globalPtr->kbdactive) ? REPEATTIME : REPEATTHRESHOLD) )
{
globalPtr->kbdactive = true;
globalPtr->mousedownTicks = 1;
delta = 0;
if (KEYDOWNTEST(UPARROW,kbdmap) || KEYDOWNTEST(RIGHTARROW,kbdmap)) delta = 1;
if (KEYDOWNTEST(DOWNARROW,kbdmap) || KEYDOWNTEST(LEFTARROW,kbdmap)) delta = -1;
if ((globalPtr->userBrightness+delta) > maximum)
delta = 0;
if ((globalPtr->userBrightness+delta) < 0 )
delta = 0;
returnValue = globalPtr->userBrightness + delta;
};
};
return(returnValue);
};
/*page
***************************************************************************************************
*
*
***************************************************************************************************
*/
int RegisterClose (driverGlobalPtr globalPtr)
{
globalPtr->userBrightness = globalPtr->settingTable->maximum; /* <H3> */
globalPtr->userBrightness = SetBrightness(globalPtr->settingTable->minimum,globalPtr); /* <H3> initialize pot */
SleepQRemove(&globalPtr->sleepQelement); /* remove sleep task */
ShutDwnRemove( (ShutDwnProcPtr) ShutdownBacklight); /* remove shutdown task */
// NSetTrapAddress(postdataptr->oldvector,_PostEvent,OSTrap);
return(0);
};
/*page
***************************************************************************************************
*
* The control routineÉ
*
* return:
* noErr - task completed successfully
* controlErr - illegal control selector
*
*
***************************************************************************************************
*/
OSErr RegisterControl(CntrlParam *ctlPB,driverGlobalPtr globalPtr) /* 'open' entry point */
{
#pragma unused (ctlPB)
int error;
int tempvalue;
error = noErr;
switch(ctlPB->csCode)
{
case kSetScreenBrightness: /* set brightness level */
tempvalue = ctlPB->csParam[0];
globalPtr->userBrightness = (*globalPtr->setlevelproc)(tempvalue,globalPtr);
break;
case kSaveScreenBrightness: /* save brightness level */
SaveBrightness(globalPtr->userBrightness);
break;
case kSetBrightnessKeys:
tempvalue = ctlPB->csParam[0];
globalPtr->keycodes = tempvalue & KEY_VALUE_MASK; /* limit value to key code range */
setNewKeys(globalPtr->keycodes);
break;
case kSavePKeys:
SaveKeyData(globalPtr->keycodes);
break;
default:
error = controlErr;
};
return(error);
};
/*page
***************************************************************************************************
*
* The status routineÉ
*
* return:
* noErr - task completed successfully
* statusErr - illegal control selector
*
***************************************************************************************************
*/
OSErr RegisterStatus(CntrlParam *ctlPB,driverGlobalPtr globalPtr) /* 'open' entry point */
{
short error;
error = noErr;
switch(ctlPB->csCode)
{
case kGetBrightnessKeys: /* return current saved brightness */
ctlPB->csParam[0] = globalPtr->keycodes;
break;
case kGetPBacklight:
ctlPB->csParam[0] = GetPramBrightness();
break;
case kGetPKey:
ctlPB->csParam[0] = GetPramKeyData();
break;
default:
error = statusErr;
};
return(error);
}
setNewKeys(int keycombo)
{
char newKey;
newKey = 0;
if (keycombo & 0x01) newKey |= 0x10;
if (keycombo & 0x02) newKey |= 0x02;
if (keycombo & 0x04) newKey |= 0x08;
};

View File

@ -0,0 +1,630 @@
;
; File: backlight.a
;
; Contains: backlight driver low level glue
;
; Written by: Andy Gong 4-6595
;
; Copyright: © 1990-1993 by Apple Computer, Inc., all rights reserved.
;
; Change History (most recent first):
;
; <SM4> 12/13/93 PN Roll in KAOs and Horror changes to support Malcom and AJ
; machines
; <SM3> 11/8/93 JRH boxDBLite16 is now boxPowerBookDuo250. boxDBLite20 is now
; boxPenLite. boxEscher25 is now boxYeagerFSTN. boxEscher33 is now
; boxPowerBookDuo270C.
; <SM2> 2/11/93 CSS Updated some code names to real names, and include
; boxflags from InternalOnlyEqu.a rather than from
; backlightequ.a. Update from Horror. Comments follow:
; <H10> 1/21/93 RLE add support for Escher
; <H9> 7/13/92 SWC Yet another pass at the DBLite table. Deja vu, eh?
; <H8> 6/30/92 ag Added cpu info tables for cpu dependent information.
; <H7> 5/7/92 ag Changed the structure of the backlight tables. Included in the
; tables are a header which indicates the minimun and maximum
; values.
; <H6> 4/10/92 SWC Yet another pass at the DBLite table.
; <H5> 3/4/92 SWC Next pass at the DBLite table.
; <H4> 2/12/92 SWC Changed the DB-Lite table limits to have a narrower range of
; values.
; <H3> 9/10/91 SWC Changed the DB-Lite table to have a span of 0..127 instead of
; 0..255 since the backlight values don't go that high.
; <H2> 8/26/91 SWC Added a PWM lookup table for DB-Lite.
; <9> 10/28/91 SAM Rolled in Regatta file.
;
; Regatta Change History:
;
; <6> 8/29/91 SAM (ag) changed asahi look up table to avoid 1-4 because the new
; backlight sometimes flickers at these settings.
; <5> 7/18/91 SAM (ag) added asahi look up table.
; <4> 6/30/91 SAM Merged from Terror [<3><4>]
; <3> 6/14/91 SAM (ag) added new table for low power scaling.
; <1> 5/15/91 SAM Split off from TERRORProj.;
;
; Change History 7.0:
;
; <8> 11/10/90 ag added 5 volt table
; <7> 11/8/90 ag changed range of table because of reduced slider range. slider
; is 0 to 29 now
; <6> 11/7/90 ag bump up maximum value
; <5> 9/25/90 ag added sleep queue entry point for turning on and off the
; backlight during wakeup and sleep.
; <4> 9/12/90 ag Added backlight setting lookup table to increase backlight
; brightness
; <3> 8/29/90 ag added lookup table for the brightness values.
; <1+> 8/15/90 ag removing sleep stuff
; 90/03/15 ag new today
;
; To Do:
;
;_______________________________________________________________________
BLANKS ON
PRINT OFF
INCLUDE 'SysEqu.a'
INCLUDE 'SysErr.a'
INCLUDE 'HardwarePrivateEqu.a'
INCLUDE 'PowerPrivEqu.a'
INCLUDE 'Traps.a'
INCLUDE 'InternalOnlyEqu.a' ; <SM2> CSS
INCLUDE 'backlightequ.a'
PRINT ON
CASE OBJECT
MACHINE MC68020
IMPORT VBL_Task
IMPORT Sleep_Task
STRING PASCAL
;-----------------------------------------------------------------------------------
; glue for vbl task
;
;
;
VBLEntry PROC EXPORT
move.l a0,-(sp) ; param block
jsr VBL_Task
move.l (sp)+,a0 ; param block
rts
;-----------------------------------------------------------------------------------
;
;
;
;
SleepEntry PROC EXPORT
move.l d0,-(sp) ; sleep selector
move.l a0,-(sp) ; parameter block pointer
jsr Sleep_Task ; call sleep task
move.l (sp)+,a0
move.l (sp)+,d0
clr.l d0
rts ;
;--------------------------------------------------------------------------------------------------------------
;
GetBkltPrimInfo proc export
with PmgrRec,PmgrPrimitivesRec
movea.l PmgrBase,a0 ; point to power manager globals
LoadTbl BklightTblPtr,a0,a0 ; get backlight table pointer in a0
move.l a0,d0 ; move pointer to d0 for C return
rts
END
;-----------------------------------------------------------------------------------
;
PortableTable7V PROC EXPORT
dc.w 0 ; minimum value <H7>
dc.w @end - @start ; <H7>
@start dc.b 0 ; 0 <H7>
dc.b 1 ; 1
dc.b 2 ; 2
dc.b 3 ; 3
dc.b 4 ; 4
dc.b 5 ; 5
dc.b 6 ; 6
dc.b 7 ; 7
dc.b 8 ; 8
dc.b 9 ; 9
dc.b 10 ; 10
dc.b 11 ; 11
dc.b 12 ; 12
dc.b 13 ; 13
dc.b 14 ; 14
dc.b 15 ; 15
dc.b 16 ; 16
dc.b 17 ; 17
dc.b 18 ; 18
dc.b 19 ; 19
dc.b 20 ; 20
dc.b 21 ; 21
dc.b 22 ; 22
dc.b 23 ; 23
dc.b 25 ; 24
dc.b 28 ; 25
dc.b 32 ; 26
dc.b 36 ; 27
dc.b 40 ; 28
dc.b 45 ; 29
@end dc.b 50 ; 30 <H7>
;--------------------------------------------------------------------------------------------------------------
;
PortableTbl5V PROC EXPORT
dc.w 0 ; minimum value <H7>
dc.w @end - @start ; <H7>
@start
dc.b 0 ; 0 <H7>
dc.b 2 ; 1
dc.b 5 ; 2
dc.b 7 ; 3
dc.b 9 ; 4
dc.b 11 ; 5
dc.b 13 ; 6
dc.b 15 ; 7
dc.b 17 ; 8
dc.b 19 ; 9
dc.b 21 ; 10
dc.b 23 ; 11
dc.b 25 ; 12
dc.b 27 ; 13
dc.b 29 ; 14
dc.b 31 ; 15
dc.b 33 ; 16
dc.b 35 ; 17
dc.b 37 ; 18
dc.b 39 ; 19
dc.b 42 ; 20
dc.b 45 ; 21
dc.b 48 ; 22
dc.b 51 ; 23
dc.b 54 ; 24
dc.b 58 ; 25
dc.b 62 ; 26
dc.b 66 ; 27
dc.b 70 ; 28
dc.b 75 ; 29
@end dc.b 80 ; 30 <H7>
;--------------------------------------------------------------------------------------------------------------
;
asahiTbl PROC EXPORT
dc.w 0 ; minimum value <H7>
dc.w @end - @start ; <H7>
@start dc.b 0 ; 0 <H7>
dc.b 1 ; 1
dc.b 2 ; 2
dc.b 3 ; 3
dc.b 4 ; 4
dc.b 5 ; 5
dc.b 6 ; 6
dc.b 7 ; 7
dc.b 8 ; 8
dc.b 9 ; 9
dc.b 10 ; 10
dc.b 11 ; 11
dc.b 12 ; 12
dc.b 13 ; 13
dc.b 14 ; 14
dc.b 15 ; 15
dc.b 16 ; 16
dc.b 17 ; 17
dc.b 18 ; 18
dc.b 19 ; 19
dc.b 20 ; 20
dc.b 21 ; 21
dc.b 22 ; 22
dc.b 23 ; 23
dc.b 24 ; 24
dc.b 25 ; 25
dc.b 26 ; 26
dc.b 27 ; 27
dc.b 28 ; 28
dc.b 29 ; 29
dc.b 30 ; 30
@end dc.b 31 ; 31 <H7>
;--------------------------------------------------------------------------------------------------------------
;
timTbl PROC EXPORT
dc.w 0 ; minimum value <H7>
dc.w @end - @start ; <H7>
@start dc.b 31 ; 0 <H7>
dc.b 30 ; 1
dc.b 29 ; 2
dc.b 28 ; 3
dc.b 27 ; 4
dc.b 26 ; 5
dc.b 25 ; 6
dc.b 24 ; 7
dc.b 23 ; 8
dc.b 22 ; 9
dc.b 21 ; 10
dc.b 20 ; 11
dc.b 19 ; 12
dc.b 18 ; 13
dc.b 17 ; 14
dc.b 16 ; 15
dc.b 15 ; 16
dc.b 14 ; 17
dc.b 13 ; 18
dc.b 12 ; 19
dc.b 11 ; 20
dc.b 10 ; 21
dc.b 9 ; 22
dc.b 8 ; 23
dc.b 7 ; 24
dc.b 6 ; 25
dc.b 5 ; 26
dc.b 4 ; 27
dc.b 3 ; 28
dc.b 2 ; 29
dc.b 1 ; 30
@end dc.b 0 ; 31 <H7>
;--------------------------------------------------------------------------------------------------------------
;
timTblLow PROC EXPORT
dc.w 0 ; minimum value <H7>
dc.w @end - @start ; <H7>
@start dc.b 31 ; 0 <H7>
dc.b 30 ; 1
dc.b 30 ; 2
dc.b 29 ; 3
dc.b 28 ; 4
dc.b 28 ; 5
dc.b 27 ; 6
dc.b 26 ; 7
dc.b 25 ; 8
dc.b 25 ; 9
dc.b 24 ; 10
dc.b 23 ; 11
dc.b 22 ; 12
dc.b 22 ; 13
dc.b 21 ; 14
dc.b 20 ; 15
dc.b 20 ; 16
dc.b 19 ; 17
dc.b 18 ; 18
dc.b 17 ; 19
dc.b 17 ; 20
dc.b 16 ; 21
dc.b 15 ; 22
dc.b 14 ; 23
dc.b 14 ; 24
dc.b 13 ; 25
dc.b 12 ; 26
dc.b 11 ; 27
dc.b 11 ; 28
dc.b 11 ; 29
dc.b 10 ; 30
@end dc.b 10 ; 31 <H7>
;--------------------------------------------------------------------------------------------------------------
;
PortableMaxTbl PROC EXPORT ; power range
dc.w 30 ; 0
dc.w 15 ; 1
dc.w 15 ; 2
dc.w 7 ; 3
dc.w 3 ; 4
;--------------------------------------------------------------------------------------------------------------
;
PWMMaxTbl PROC EXPORT
dc.w 31 ; 0
dc.w 15 ; 1
dc.w 15 ; 2
dc.w 7 ; 3
dc.w 3 ; 4
;--------------------------------------------------------------------------------------------------------------
;
PotInputRangeShiftTblPWM PROC EXPORT
dc.w 0 ; 0
dc.w 1 ; 1
dc.w 1 ; 2
dc.w 2 ; 3
dc.w 3 ; 4
;--------------------------------------------------------------------------------------------------------------
;
dbTbl PROC EXPORT ; <H2>
dc.w 0 ; minimum value <H7>
dc.w @end - @start ; <H7>
@start DC.B 127 ; 0 <H7>
DC.B 89 ; 1
DC.B 87 ; 2
DC.B 86 ; 3
DC.B 84 ; 4
DC.B 82 ; 5
DC.B 81 ; 6
DC.B 79 ; 7
DC.B 77 ; 8
DC.B 76 ; 9
DC.B 74 ; 10
DC.B 71 ; 11
DC.B 69 ; 12
DC.B 67 ; 13
DC.B 66 ; 14
DC.B 64 ; 15
DC.B 62 ; 16
DC.B 61 ; 17
DC.B 59 ; 18
DC.B 57 ; 19
DC.B 56 ; 20
DC.B 54 ; 21
DC.B 52 ; 22
DC.B 51 ; 23
DC.B 49 ; 24
DC.B 47 ; 25
DC.B 46 ; 26
DC.B 44 ; 27
DC.B 42 ; 28
DC.B 41 ; 29
DC.B 39 ; 30
@end DC.B 38 ; 31 <H7>
;--------------------------------------------------------------------------------------------------------------
;
DartTable proc export
dc.w 0 ; minimum value
dc.w @end - @start
@start dc.b 3 ; 0
dc.b 2 ; 1
dc.b 1 ; 2
@end dc.b 0 ; 3
;
;
DartMaxTbl PROC EXPORT ; power range
dc.w 3 ; 0
dc.w 2 ; 1
dc.w 2 ; 2
dc.w 1 ; 3
dc.w 0 ; 4
;--------------------------------------------------------------------------------------------------------------
;
; generic exit for non-supported functions
;
StandardExit PROC EXPORT
rts
;--------------------------------------------------------------------------------------------------------------
;
; list to supported cpu's (boxflags)
;
cpuTable PROC EXPORT
dc.w boxPortable
dc.l Portableinfo - cpuTable
dc.w boxPowerBook100
dc.l PowerBook100info - cpuTable
dc.w boxPowerBookDuo250 ; <SM3>
dc.l PowerBookDuoinfo - cpuTable
dc.w boxDBLite20
dc.l PowerBookDuoinfo - cpuTable
dc.w boxPowerBookDuo210
dc.l PowerBookDuoinfo - cpuTable
dc.w boxPowerBookDuo230
dc.l PowerBookDuoinfo - cpuTable
dc.w boxPowerBook140 ; cpu id
dc.l PowerBook170info - cpuTable
dc.w boxPowerBook170 ; cpu id
dc.l PowerBook170info - cpuTable
dc.w boxPowerBook180
dc.l PowerBook180info - cpuTable
dc.w boxPowerBook160
dc.l PowerBook180info - cpuTable
dc.w boxYeagerFSTN ; <SM3>
dc.l PowerBookDuoinfo - cpuTable
dc.w boxPowerBookDuo270C ; <SM3>
dc.l PowerBookDuoinfo - cpuTable
dc.w -1
;--------------------------------------------------------------------------------------------------------------
;
;
import StandardExit
import SetBrightness,KbdControl,InitRegControls,RegisterClose,RegisterControl,RegisterStatus
import SetPWM,PotControl,InitPWMControls,PWMCloseRoutine,PWMControl,GenericStatus,PortableBacklightValue
import SetDart,GetDart,InitTimControls,InitDartControls,PowerMgrPot,ChargerAdjust
import PGE_button
with backlightflags
;--------------------------------------------------------------------------------------------------------------
;
;
Portableinfo
dc.l (0 << disableHWinput)\ ; operating flag (stops user input)
+(0 << kbdactive)\ ; operating flag (kbd control inprogress)
+(1 << vbl_ok)\ ; operating flag (allow vbl operations)
+(0 << flyByWire)\ ; config flag (hardware input)
+(0 << freeflag)\ ; (n/a) unused flag
+(0 << dualTable)\ ; config flag (use multi tables)
+(0 << lowTable)\ ; operating flag (currently using low table)
+(0 << slewChange) ; operating flag (table transition inprogress)
dc.l SetBrightness - Portableinfo ; set routine
dc.l KbdControl - Portableinfo ; get user input routine
dc.l InitRegControls - Portableinfo ; initialization routine
dc.l RegisterClose - Portableinfo ; close routine
dc.l RegisterControl - Portableinfo ; control routine
dc.l RegisterStatus - Portableinfo ; status routine
dc.l StandardExit - Portableinfo ; (n/a) charger state change routine
dc.l PortableMaxTbl - Portableinfo ; table of maximum value for different power ranges
dc.l PortableTable7V - Portableinfo ; low range table
dc.l PortableTable7V - Portableinfo ; high range table
dc.l PowerMgrPot - Portableinfo ; hardware dependent var
dc.w 1 ; vbl count SampleRate
dc.w 0 ; (n/a) lowThreshold
dc.w 0 ; (n/a) hiThreshold
;--------------------------------------------------------------------------------------------------------------
;
;
PowerBook100info
dc.l (0 << disableHWinput)\ ; operating flag (stops user input)
+(0 << kbdactive)\ ; operating flag (kbd control inprogress)
+(1 << vbl_ok)\ ; operating flag (allow vbl operations)
+(1 << flyByWire)\ ; config flag (hardware input)
+(0 << freeflag)\ ; unused flag
+(0 << dualTable)\ ; config flag (use multi tables)
+(0 << lowTable)\ ; operating flag (currently using low table)
+(0 << slewChange) ; operating flag (table transition inprogress)
dc.l SetPWM - PowerBook100info ; set routine
dc.l PotControl - PowerBook100info ; get user input routine
dc.l InitPWMControls - PowerBook100info ; initialization routine
dc.l PWMCloseRoutine - PowerBook100info ; close routine
dc.l PWMControl - PowerBook100info ; control routine
dc.l GenericStatus - PowerBook100info ; status routine
dc.l StandardExit - PowerBook100info ; (n/a) charger state change routine
dc.l PWMMaxTbl - PowerBook100info ; table of maximum value for different power ranges
dc.l asahiTbl - PowerBook100info ; low range table
dc.l asahiTbl - PowerBook100info ; high range table
dc.l PortableBacklightValue- PowerBook100info; hardware dependent var
dc.w 10 ; vbl count SampleRate
dc.w 0 ; (n/a) lowThreshold
dc.w 0 ; (n/a) hiThreshold
;--------------------------------------------------------------------------------------------------------------
;
;
HITABLETHRESHOLD170 equ (685 - 512)
LOWTABLETHRESHOLD170 equ (675 - 512)
PowerBook170info
dc.l (0 << disableHWinput)\ ; operating flag (stops user input)
+(0 << kbdactive)\ ; (n/a) operating flag (kbd control inprogress)
+(1 << vbl_ok)\ ; operating flag (allow vbl operations)
+(1 << flyByWire)\ ; config flag (hardware input)
+(1 << freeflag)\ ; (n/a)
+(0 << dualTable)\ ; config flag (use multi tables)
+(0 << lowTable)\ ; operating flag (currently using low table)
+(0 << slewChange) ; operating flag (table transition inprogress)
dc.l SetPWM - PowerBook170info ; set routine
dc.l PotControl - PowerBook170info ; get user input routine
dc.l InitTimControls - PowerBook170info ; initialization routine
dc.l PWMCloseRoutine - PowerBook170info ; close routine
dc.l PWMControl - PowerBook170info ; control routine
dc.l GenericStatus - PowerBook170info ; status routine
dc.l ChargerAdjust - PowerBook170info ; charger state change routine
dc.l PWMMaxTbl - PowerBook170info ; table of maximum value for different power ranges
dc.l timTblLow - PowerBook170info ; low range table
dc.l timTbl - PowerBook170info ; high range table
dc.l PowerMgrPot - PowerBook170info ; hardware dependent var
dc.w 10 ; vbl count SampleRate
dc.w LOWTABLETHRESHOLD170 ; voltage threshold before switching from high to low table
dc.w HITABLETHRESHOLD170 ; voltage threshold before switching from low to high table
;--------------------------------------------------------------------------------------------------------------
;
;
PowerBook180info
dc.l (0 << disableHWinput)\ ; operating flag (stops user input)
+(0 << kbdactive)\ ; (n/a) operating flag (kbd control inprogress)
+(1 << vbl_ok)\ ; operating flag (allow vbl operations)
+(1 << flyByWire)\ ; config flag (hardware input)
+(1 << freeflag)\ ; (n/a)
+(1 << dualTable)\ ; config flag (use multi tables)
+(0 << lowTable)\ ; operating flag (currently using low table)
+(0 << slewChange) ; operating flag (table transition inprogress)
dc.l SetPWM - PowerBook180info ; set routine
dc.l PotControl - PowerBook180info ; get user input routine
dc.l InitPWMControls - PowerBook180info ; initialization routine
dc.l PWMCloseRoutine - PowerBook180info ; close routine
dc.l PWMControl - PowerBook180info ; control routine
dc.l GenericStatus - PowerBook180info ; status routine
dc.l ChargerAdjust - PowerBook180info ; charger state change routine
dc.l PWMMaxTbl - PowerBook180info ; table of maximum value for different power ranges
dc.l timTblLow - PowerBook180info ; low range table
dc.l timTbl - PowerBook180info ; high range table
dc.l PowerMgrPot - PowerBook180info ; hardware dependent var
dc.w 10 ; vbl count SampleRate
dc.w LOWTABLETHRESHOLD170 ; voltage threshold before switching from high to low table
dc.w HITABLETHRESHOLD170 ; voltage threshold before switching from low to high table
PowerBook180infoHWControl
dc.l (0 << disableHWinput)\ ; operating flag (stops user input)
+(0 << kbdactive)\ ; operating flag (kbd control inprogress)
+(1 << vbl_ok)\ ; operating flag (allow vbl operations)
+(1 << flyByWire)\ ; config flag (hardware input)
+(1 << freeflag)\
+(0 << dualTable)\ ; config flag (use multi tables)
+(0 << lowTable)\ ; operating flag (currently using low table)
+(0 << slewChange) ; operating flag (table transition inprogress)
dc.l SetPWM - PowerBook180info ; set routine
dc.l PotControl - PowerBook180info ; get user input routine
dc.l InitDartControls - PowerBook180info ; initialization routine
dc.l PWMCloseRoutine - PowerBook180info ; close routine
dc.l PWMControl - PowerBook180info ; control routine
dc.l GenericStatus - PowerBook180info ; status routine
dc.l 0 ; (n/a) charger state change routine
dc.l DartMaxTbl - PowerBook180info ; table of maximum value for different power ranges
dc.l DartTable - PowerBook180info ; low range table
dc.l DartTable - PowerBook180info ; high range table
dc.l PowerMgrPot - PowerBook180info ; hardware dependent var
dc.w 10 ; vbl count SampleRate
dc.w 0 ; (n/a) lowThreshold
dc.w 0 ; (n/a) hiThreshold
;--------------------------------------------------------------------------------------------------------------
;
;
PowerBookDuoinfo
dc.l (0 << disableHWinput)\ ; operating flag (stops user input)
+(0 << kbdactive)\ ; operating flag (kbd control inprogress)
+(1 << vbl_ok)\ ; operating flag (allow vbl operations)
+(1 << flyByWire)\ ; config flag (hardware input)
+(1 << freeflag)\
+(0 << dualTable)\ ; config flag (use multi tables)
+(0 << lowTable)\ ; operating flag (currently using low table)
+(0 << slewChange) ; operating flag (table transition inprogress)
dc.l SetPWM - PowerBookDuoinfo ; set routine
dc.l PotControl - PowerBookDuoinfo ; get user input routine
dc.l InitPWMControls - PowerBookDuoinfo ; initialize routine
dc.l PWMCloseRoutine - PowerBookDuoinfo ; close routine
dc.l PWMControl - PowerBookDuoinfo ; control routine
dc.l GenericStatus - PowerBookDuoinfo ; status routine
dc.l StandardExit - PowerBookDuoinfo ; (n/a) charger state change routine
dc.l PWMMaxTbl - PowerBookDuoinfo ; table of maximum value for different power ranges
dc.l dbTbl - PowerBookDuoinfo ; low range table
dc.l dbTbl - PowerBookDuoinfo ; high range table
dc.l PGE_button - PowerBookDuoinfo ; hardware dependent var
dc.w 10 ; vbl count SampleRate
dc.w 0 ; (n/a) lowThreshold
dc.w 0 ; (n/a) hiThreshold
END

View File

@ -0,0 +1,585 @@
/*
File: backlight.c
Contains: driver for backlight.
Written by: Andy Gong x6595
Copyright: © 1990-1993 by Apple Computer, Inc., all rights reserved.
Change History (most recent first):
<SM6> 12/13/93 PN Roll in KAOs and Horror changes to support Malcom and AJ
machines
<SM5> 9/2/93 SKH Update from Horror.
<SM4> 2/11/93 CSS Update from Horror. Comments follow <H5-H2>:
<H5> 11/9/92 ag Corrected compare statement. The compiler generated a long
compare, so we must type cast the value to avoid the mismatch in
types.
<H4> 6/30/92 ag Use cpu info tables for configuring cpu dependent information.
<H3> 4/24/92 ag added support for error returns on hardware initialization.
this will return an open error on unknown hardware.
<H2> 8/5/91 SWC Make InitPWMControls the default init choice in DRVROpen so that
proc vectors are always initialized.
<12> 3/30/92 JSM Rolled this file into SuperMario project.
<11> 3/24/92 JSM Nuke boxFlag codenames.
<10> 3/23/92 JSM OSEvents.h is obsolete, use Events.h.
<9> 10/28/91 SAM Rolled in Regatta file.
Regatta Change History:
<9> 8/19/91 SAM ÒunusedÓ and unused local var in Prime.
<8> 8/19/91 SAM (ag) Removed async bit clear
<7> 8/8/91 SAM (ag) fixed backlight driver to handle new box flags.
<6> 7/30/91 SAM (ag) fixed low power dimming code in software only controls.
<5> 7/18/91 SAM (ag) convert async calls to sync calls, use box flag to determine
hardware.
<4> 6/30/91 SAM Merged from TERROR [<10><11><12><13>].
<3> 6/14/91 SAM (ag) added init of backlight in open. fixed initialization code.
passin new initializtion value which will tell the hardware
specific code to initialize. Changed low power handling code,
and added version number function in status. Reduce power on
non-flybywire controlled hardware during low power.
<1> 5/15/91 SAM Split off from TERRORProj.
Terror Change History:
<13> 6/26/91 ag added support for table change as a function of charger and
voltage.
<12> 6/25/91 ag removed unused local variables.
<11> 6/25/91 ag cleaned up vbl task.
<10> 6/24/91 ag Cleaned up low power handling. Added support for version status
call, and table switching call.
<9> 6/11/91 ag reduce power on non-flybywire controlled hardware during low
power.
<8> 6/10/91 ag Changed low power handling code, and added version number
function in status.
<7> 5/10/91 ag fixed initialization code. passin new initializtion value which
will tell the hardware specific code to initialize.
<6> 4/23/91 ag added init of backlight in open.
<5> 4/2/91 ag restructed driver for hardware independence.
<4> 3/19/91 ag change id of portable from gestalt call to rombase call.
<3> 3/19/91 ag Changed pram location of backlight setting to match the new parm
layout.
<2> 3/3/91 ag changed base of pram locations, cleaned up open code, set error
on fly-by-wire illegal selectors.
<1> 1/23/91 ag first checked in
<19+> 12/18/90 ag code cleanup
<2> 8/19/91 JSM Use PmgrBase defined in PowerMgr.h, replace some defines with
ones already in Power.h.
<19> 11/13/90 ag fix for ROM power manager changes
<17> 11/9/90 ag changed default value
<16> 11/9/90 ag changed default to off
<15> 11/9/90 ag fixed low power vbl stuff, changed multiplier in strobe routine.
<14> 11/8/90 ag change the storage method for the backlight value. the 5 bits
will now store the value of the backlight +1. the +1 offset
allows us to detect the first boot condition. on the first
boot, the pram will be initialize to default conditions, which
is 0 the backlight pram location. the macros have been adjusted
to handle the offset invisable to the routines.
<13> 90/11/07 ag fixed bug with precheck of ram disk (include current disk )
<11> 9/26/90 ag added change to set pot at ABSOLUTE minimum if backlight is set
to off. added remove code to close call.
<10> 9/25/90 ag added universal support for different version of the backlight.
<9> 9/12/90 ag Added support for addition Control and Status calls. Now
installs a shutdown task to turn off the backlight on showdown
and restart.
<8> 8/29/90 ag added support for backlight table lookup instead of straight
values.
<7> 8/23/90 ag fixed key equivalent bug in driver.
<6> 8/22/90 ag added status & control calls, added dynamic maximum handling
90/08/22 ag added additional control and status calls
added dynamic maximum handling
<3> 8/15/90 ag adding range feature to status call
90/08/01 ag adjust for CCFL backlight, pot adjust from 0 - 62
90/07/27 ag changed for fit the 3.0 c compiler and include files
90/07/20 ag changed the name and sense of vbl semaphore (now vbl_ok)
changed universal routines to macros
90/03/14 ag new today
To Do:
*/
/*page*/
/************************************/
/*** INCLUDE FILES DECLARATIONS ***/
#include <SysEqu.h>
#include <Types.h>
#include <Memory.h>
#include <Events.h>
#include <Devices.h>
#include <Errors.h>
#include <Retrace.h>
#include <Strings.h>
#include <Shutdown.h>
#include <StdLib.h>
#include "PowerMgr.h"
#include "backlight.h"
/**************************************/
/*** PRAM routines ***/
pascal void ReadXPram (short startbyte,
short numBytes,
char *buffer)
= {0x205F,0x201F,0xA051};
pascal void WriteXPram (short startbyte,
short numBytes,
char *buffer)
= {0x205F,0x201F,0xA052};
/**************************************/
/*** LOCAL STRUCTURE DECLARATIONS ***/
#define Larger(x,y) (x > y) ? x : y
/****************************************/
/*** FORWARD ROUTINES DECLARATIONS ***/
void VBLEntry();
PowerChange (driverGlobalPtr globalPtr, int currentLevel);
UserAdjust (driverGlobalPtr globalPtr);
cpuDependentInfoPtr GetBkltPrimInfo();
/*page
***************************************************************************************************
*
* The open routine
*
* return:
* noErr
* openErr
*
*
***************************************************************************************************
*/
pascal OSErr DRVROpen(CntrlParam *ctlPB,DCtlPtr dCtl) /* 'open' entry point */
{
#pragma unused (ctlPB)
register driverGlobalPtr globalPtr; /* pointer to globals */
PmgrGlobals **pmgrglobalhdl; /* handle to power manager globals */
OSErr error;
cpuDependentInfoType *cpuinfo;
OSErr (*openProc)();
cpuinfo = GetBkltPrimInfo();
if (!cpuinfo) return(openErr);
globalPtr = (driverGlobalPtr) NewPtrSysClear(sizeof(driverGlobaltypes));
if (!globalPtr) return(openErr); /* not enough memory, return error */
pmgrglobalhdl = (PmgrGlobals **) 0x0D18; /* handle to power manager globals */
dCtl->dCtlStorage = (Handle) globalPtr; /* set context to my global data area */
/* setup variables */
globalPtr->version = DRIVERVERSION; /* driver version number, in globals for easy patching */
*((unsigned int *)(((int)&(globalPtr->version)) + sizeof(globalPtr->version))) = cpuinfo->bkltinfo->flags;
globalPtr->lowThreshold = cpuinfo->bkltinfo->lowThreshold; /*low hysteresis threshold */
globalPtr->hiThreshold = cpuinfo->bkltinfo->hiThreshold; /* high hysteresis threshold */
globalPtr->userInputSampleRate = cpuinfo->bkltinfo->userInputSampleRate; /* sample every 160ms */
globalPtr->lastLevel = (*pmgrglobalhdl)->LastLevel; /* get current power level */
// globalPtr->userRange = 0; /* allow full power level */
globalPtr->powerRange = Larger(globalPtr->lastLevel,globalPtr->userRange);
/* initialize tables */
globalPtr->maximumTable = (short *) (cpuinfo->bkltroutines->maxTable);
globalPtr->settingTableLow = (setTableType *) (cpuinfo->bkltroutines->lowTable); /* <H8> */
globalPtr->settingTableHigh = (setTableType *) (cpuinfo->bkltroutines->hiTable); /* <H8> */
globalPtr->settingTable = globalPtr->settingTableHigh;
/* initialize vectors */
globalPtr->setlevelproc = (intFunction) (cpuinfo->bkltroutines->setProc); /* proc to set level */
globalPtr->userInputProc = (intFunction) (cpuinfo->bkltroutines->getProc); /* proc to read user input */
openProc = (osFunction) (cpuinfo->bkltroutines->open); /* routine to close pwm hardware */
globalPtr->closeProc = (intFunction) (cpuinfo->bkltroutines->close); /* routine to close pwm hardware */
globalPtr->controlProc = (osFunction) (cpuinfo->bkltroutines->control); /* passed control routine */
globalPtr->statusProc = (osFunction) (cpuinfo->bkltroutines->status); /* passed status routine */
globalPtr->hardwareDependentPtr = (Ptr) (cpuinfo->bkltroutines->hwDependentVar);
globalPtr->tableProc = (voidFunction) (cpuinfo->bkltroutines->tableProc);
/* call custom initialization routine */
if (openProc)
{
error = (*openProc)(globalPtr);
if (error)
{
DisposPtr((Ptr) globalPtr); /* release memory */
dCtl->dCtlStorage = NULL;
return(error); /* clear out saved value for next open */
};
};
globalPtr->brightnessVbl.globals = (Ptr) globalPtr;
globalPtr->brightnessVbl.vblpb.qType = vType;
globalPtr->brightnessVbl.vblpb.vblAddr = (VBLProcPtr) VBLEntry; /* cvbl is the address of the C routine */
globalPtr->brightnessVbl.vblpb.vblCount = globalPtr->userInputSampleRate;
globalPtr->brightnessVbl.vblpb.vblPhase = 0;
VInstall((QElemPtr) &globalPtr->brightnessVbl.vblpb); /* install vbl task */
return(noErr); /* if "you are here", we completed without error */
}
/*page
***************************************************************************************************
*
* The close routine.
* Release resources allocated and deinstall any install routines.
*
* return:
* noErr
*
***************************************************************************************************
*/
pascal OSErr DRVRClose(CntrlParam *ctlPB,DCtlPtr dCtl) /* 'open' entry point */
{
#pragma unused (ctlPB)
register driverGlobalPtr globalPtr; /* pointer to driver globals */
globalPtr = (driverGlobalPtr) dCtl->dCtlStorage; /* set context to my global data area */
globalPtr->slewChange = false; /* always turn off slew during close <H6> */
VRemove((QElemPtr) &globalPtr->brightnessVbl.vblpb); /* remove vbl task */
if (globalPtr->closeProc != NULL) /* if hw close proc É */
(*globalPtr->closeProc)(globalPtr); /* É call close proc */
DisposPtr((Ptr) globalPtr); /* release memory */
dCtl->dCtlStorage = NULL; /* clear out saved value for next open */
return(noErr); /* exit without event */
}
/*page
***************************************************************************************************
*
* The prime routineÉ
*
* return:
* ioErr
*
***************************************************************************************************
*
*/
pascal OSErr DRVRPrime(CntrlParam *ctlPB,DCtlPtr dCtl) /* 'open' entry point */
{
#pragma unused (ctlPB)
#pragma unused (dCtl)
return(ioErr);
}
/*page
***************************************************************************************************
*
* The control routineÉ
*
* return:
* noErr - task completed successfully
* controlErr - illegal control selector
*
*
***************************************************************************************************
*/
pascal OSErr DRVRControl(CntrlParam *ctlPB,DCtlPtr dCtl) /* 'open' entry point */
{
int error;
register driverGlobalPtr globalPtr;
int tempvar;
globalPtr = (driverGlobalPtr) dCtl->dCtlStorage; /* set context to my global data area */
globalPtr->vbl_ok = false;
error = noErr;
switch(ctlPB->csCode)
{
case kCdevActive:
globalPtr->disableHWinput = (ctlPB->csParam[0]) ? true : false;
break;
case kSetRange:
tempvar = ctlPB->csParam[0]; /* get the user range */
PEG_TO_LIMITS(tempvar, kMaxRangeValue, kMinRangeValue); /* limit value to valid range */
globalPtr->userRange = tempvar; /* set the user range */
globalPtr->powerRange = Larger(globalPtr->lastLevel,globalPtr->userRange); /* pick the higher range number */
globalPtr->userBrightness = (*globalPtr->setlevelproc)(globalPtr->userBrightness,globalPtr); /* adjust backlight with new range */
break;
case kSetTable:
if (!globalPtr->dualTable)
{
error = controlErr;
break; /* if only 1 table, nothing to do */
};
globalPtr->settingTable = (ctlPB->csParam[0]) /* set table lookup */
? globalPtr->settingTableHigh /* if non zero, use high value table */
: globalPtr->settingTableLow; /* if zero, use low value table */
globalPtr->userBrightness = (*globalPtr->setlevelproc)(globalPtr->userBrightness,globalPtr); /* adjust backlight with new range */
break;
default:
error = (*globalPtr->controlProc)(ctlPB,globalPtr); /* check for hw specific features */
};
globalPtr->vbl_ok = true;
return(error);
};
/*page
***************************************************************************************************
*
* The generic control routine É
*
* return:
* controlErr - illegal control selector
*
***************************************************************************************************
*/
OSErr GenericControl(CntrlParam *ctlPB,driverGlobalPtr globalPtr)
{
#pragma unused (ctlPB,globalPtr)
return(controlErr);
}
/*page
***************************************************************************************************
*
* The status routineÉ
*
* return:
* noErr - task completed successfully
* statusErr - illegal control selector
*
***************************************************************************************************
*/
pascal OSErr DRVRStatus(CntrlParam *ctlPB,DCtlPtr dCtl) /* 'open' entry point */
{
#pragma unused (dCtl)
short error; /* return value */
register driverGlobalPtr globalPtr; /* pointer to driver global vars */
error = noErr; /* start with no errors */
globalPtr = (driverGlobalPtr) dCtl->dCtlStorage; /* set context to my global data area */
globalPtr->vbl_ok = false; /* disable vbl task */
switch(ctlPB->csCode)
{
case kGetUserInput:
ctlPB->csParam[0] = globalPtr->
userInputProc( globalPtr ); /* Get the button inputs */
break;
case KGetVersion:
ctlPB->csParam[0] = globalPtr->version; /* return current driver version */
break;
case kGetScreenBrightness: /* <H4> return current saved brightness */
ctlPB->csParam[0] = globalPtr->userBrightness;
break;
case kGetBrightnessRange: /* <H4> return range of brightness values */
ctlPB->csParam[0] = globalPtr->settingTable->maximum;/* <H4> using new tables, return max setting */
ctlPB->csParam[1] = globalPtr->settingTable->minimum;/* <H4> using new tables, return min setting */
break;
case kGetMaximum: /* <H4> */
ctlPB->csParam[0] = globalPtr->maximumTable[globalPtr->powerRange];
break;
default:
error = (*globalPtr->statusProc)(ctlPB,globalPtr);
};
globalPtr->vbl_ok = true;
return(error);
}
/*page
***************************************************************************************************
*
* The generic status routine É
*
* return:
* statusErr - illegal control selector
*
***************************************************************************************************
*/
OSErr GenericStatus(CntrlParam *ctlPB,driverGlobalPtr globalPtr)
{
#pragma unused (ctlPB,globalPtr)
return(statusErr);
}
/*page
***************************************************************************************************
*
* vbl task to periodically check for changes:
* 1 - user input
* 2 - power level changes
* 3 - charger state changes
*
***************************************************************************************************
*/
void VBL_Task(Ptr pbPtr)
{
PmgrGlobals **pmgrglobalhdl; /* handle to power manager globals */
register driverGlobalPtr globalPtr; /* pointer to driver globals */
int currentPowerLevel;
pmgrglobalhdl = (PmgrGlobals **) 0x0D18; /* handle to power manager globals */
globalPtr = (driverGlobalPtr) ( *(driverGlobalPtr *)(((unsigned long) pbPtr) - 4));
globalPtr->brightnessVbl.vblpb.vblCount = globalPtr->userInputSampleRate; /* reactivate the vbl element */
if (globalPtr->vbl_ok == false) return; /* if currently in use, don't touch */
/* check for charger change and table adjustment */
if (globalPtr->tableProc)
(*globalPtr->tableProc)(globalPtr); /* determine table based on current charger state */
/* Check for hardware input */
if (!globalPtr->disableHWinput)
UserAdjust(globalPtr); /* check for user adjustments */
currentPowerLevel = (*pmgrglobalhdl)->LastLevel;
if ((currentPowerLevel != 2) && (globalPtr->lastLevel != currentPowerLevel)) /* check for power state change */
PowerChange(globalPtr,currentPowerLevel); /* adjust backlight to new power level */
return;
};
/*page
***************************************************************************************************
*
* procedure to check for user input. calls hardware proc to read user input. calls hardware proc to
* set level to user desired level.
*
***************************************************************************************************
*/
UserAdjust (driverGlobalPtr globalPtr)
{
int userinput; /* hardware control setting */
int oldBrightness; /* current backlight setting */
CntrlParam controlpb; /* iopb */
oldBrightness = globalPtr->userBrightness; /* save the old value for comparison */
userinput = (*globalPtr->userInputProc)(globalPtr); /* get user intput */
globalPtr->userBrightness = (*globalPtr->setlevelproc)(userinput,globalPtr); /* set to level to user input */
if (!globalPtr->flyByWire && (globalPtr->userBrightness != oldBrightness)) /* check for save of update */
{
controlpb.csCode = kSaveScreenBrightness; /* save the setting in pram */
(*globalPtr->controlProc)(&controlpb,globalPtr); /* call hw save routine */
};
};
/*page
***************************************************************************************************
*
* procedure to handle changes in power levels. if the power level is in reserved or if software
* is artificially reducing the range of levels, this routine handles the initial change.
*
***************************************************************************************************
*/
PowerChange (driverGlobalPtr globalPtr, int currentPowerLevel)
{
int userInput; /* current user input setting */
Boolean lowerPower; /* current power lower than last reading */
lowerPower = (globalPtr->lastLevel < currentPowerLevel); /* is the new power state lower than before */
globalPtr->lastLevel = currentPowerLevel; /* save the current level */
globalPtr->powerRange = Larger(globalPtr->lastLevel,globalPtr->userRange);
userInput = (*globalPtr->userInputProc)(globalPtr); /* get adjusted user input */
if (lowerPower && currentPowerLevel) /* if power down and maximum changed , take action */
{
if (!globalPtr->flyByWire && userInput) /* if only software controls and backlight on */
{
userInput >>= 1; /* reduce power by 1/2 */
if (!userInput) userInput = 1; /* insure at least on */
};
};
globalPtr->userBrightness = (*globalPtr->setlevelproc)(userInput,globalPtr);
};
/*page
***************************************************************************************************
*
*
***************************************************************************************************
*/
/*page
***************************************************************************************************
*
*
***************************************************************************************************
*/
unsigned int LowTable (driverGlobalPtr globalPtr)
{
PmgrGlobals **pmgrglobalhdl; /* handle to power manager globals */
Boolean wasLowTable; /* current table being used */
Boolean hiTable; /* use hi level table now */
pmgrglobalhdl = (PmgrGlobals **) 0x0D18; /* handle to power manager globals */
wasLowTable = globalPtr->lowTable; /* current table */
hiTable = false; /* assume low table */
if ((wasLowTable && ((*pmgrglobalhdl)->BatAvg >= globalPtr->hiThreshold)) ||
(!wasLowTable && ((*pmgrglobalhdl)->BatAvg >= globalPtr->lowThreshold)))
{
hiTable = (*pmgrglobalhdl)->Charger & 0x01; /* qualify table with charger */
};
return(hiTable ? 0 : 1); /* return 1 if low table, 0 if high */
};
/*page
***************************************************************************************************
*
*
***************************************************************************************************
*/
void ChargerAdjust (driverGlobalPtr globalPtr)
{
unsigned int oldTable;
oldTable = globalPtr->lowTable; /* save the current table being used */
globalPtr->lowTable = LowTable(globalPtr); /* get the new table to use */
if (globalPtr->lowTable == oldTable) return; /* are we changing tables ???, no exit */
globalPtr->slewChange = true; /* if change, set tmp slew on */
globalPtr->settingTable = globalPtr->lowTable ? globalPtr->settingTableLow :globalPtr->settingTableHigh ;
};

View File

@ -0,0 +1,267 @@
/*
File: backlight.h
Contains: definitions for backlight driver
Written by: Andy Gong x6595
Copyright: © 1990-1994 by Apple Computer, Inc., all rights reserved.
Change History (most recent first):
<SM7> 1/5/94 kc Add Function ProtoTypes to prevent compiler warnings.
<SM6> 12/13/93 PN Roll in KAOs and Horror changes to support Malcom and AJ
machines
<SM5> 9/2/93 SKH Roll in changes from Horror
<SM4> 2/11/93 CSS Remove boxflags from this file.
Update from Horror. Comments follow <H10-2>:
<H10> 1/21/93 RLE add Escher box flags
<H9> 6/30/92 ag Added new type definitions.
<H8> 5/7/92 ag Added new type definitions to accomodate table changes.
<H7> 4/24/92 ag added new hardware dependent field for general use by hardware
dependent code. added new typedefs to allow for easier type
conhersion.
<H6> 12/17/91 SWC Added boxDBLiteLC.
<H5> 12/16/91 HJR Added boxDartanian.
<H4> 11/5/91 SWC Fixed boxDBLite again because we got pushed out to a new value.
<H3> 9/10/91 SWC Fixed boxAsahi and boxDBLite to reflect final values.
<H2> 8/5/91 SWC Added boxDBLite to list of CPUs we work with.
<8> 3/30/92 JSM Rolled this file into SuperMario project.
<7> 3/24/92 JSM Nuke boxFlag codenames.
<6> 10/28/91 SAM Rolled in Regatta file.
Regatta Change History:
<7> 8/8/91 SAM (ag) Updated boxFlag constants in this file (yuk!)
<6> 7/30/91 SAM (ag) changed version to 1.0.2
<5> 7/18/91 SAM (ag) added box flag constants, changed global definitions
<4> 6/30/91 SAM Merged from TERROR [<4><5>].
<3> 6/14/91 SAM (ag) Added sample interval field to global definition.
<1> 5/15/91 SAM Split off from TERRORProj.
Terror Change History:
<5> 6/26/91 ag added support for table change as a function of charger and
voltage. New fields in global include slewing flags and rates,
procedure proc definition to call to handle table changes, and
voltage thresholds for hysteresis on table changes.
<4> 6/24/91 ag Added table pointer elements and other variables to global data
structure. Added new define for range set call.
<3> 6/10/91 ag Added sample interval field to global definition.
<2> 4/2/91 ag added definitions for globals.
<1> 1/23/91 ag first checked in
<5> 11/8/90 ag change range of backlight, max now 30
<4> 9/25/90 ag added asahi support
<1+> 8/15/90 ag adding get range function to status call
90/07/27 ag new today
*/
/*
*
* VERSION 0xMMmm
* MM - Major Version number
* mm - minor Version number
*
*/
#define DRIVERMAJORVERSION 0x0100
#define DRIVERMINORVERSION 0x0001
#define DRIVERVERSION (DRIVERMAJORVERSION + DRIVERMINORVERSION)
/* Control Calls */
#define KCONTROLCALL 0x4300
#define kSetScreenBrightness (KCONTROLCALL + 1)
#define kSaveScreenBrightness (KCONTROLCALL + 2)
#define kCdevActive (KCONTROLCALL + 3)
#define kSetBrightnessKeys (KCONTROLCALL + 4)
#define kSavePKeys (KCONTROLCALL + 5)
#define kSetRange (KCONTROLCALL + 6)
#define kSetTable (KCONTROLCALL + 7)
/* Status Calls */
#define KSTATUSCALL 0x5300
#define kGetScreenBrightness (KSTATUSCALL + 1)
#define kGetBrightnessKeys (KSTATUSCALL + 2)
#define kGetBrightnessRange (KSTATUSCALL + 3)
#define kGetPBacklight (KSTATUSCALL + 4)
#define kGetPKey (KSTATUSCALL + 5)
#define kGetMaximum (KSTATUSCALL + 6)
#define KGetVersion (KSTATUSCALL + 7)
#define kGetUserInput (KSTATUSCALL + 8)
/* range limits */
#define kMaxRangeValue 4
#define kMinRangeValue 0
/* key bits */
#define kBacklightControl 0x01
#define kBacklightShift 0x02
#define kBacklightOption 0x04
#define INVALID_BRIGHTNESS -1
/* ID routines */
#define DRIVERNAME ".Backlight"
#define BACKLIGHTSIGREG (* ((char *) 0xFC0200))
#define BACKLIGHTSIG_ARUBA ((char) 0xA5)
#define BACKLIGHTSIG_UPGRD ((char) 0xA3)
#define BACKLIGHTSIG_ASAHI ((char) 0xAD)
/*
* aruba 0 1 0 1
* upgrade 0 0 1 1
* ashsi 1 1 0 1
*
* +---+---+---+---+---+---+---+---+
* | 1 | 0 | 1 | 0 | x | x | x | x |
* +---+---+---+---+---+---+---+---+
* ^ ^ ^ ^
* | | | |
* PWM -------------+ | | |
* ON BIT POSITIVE ------+ | |
* 5 Volt Table -----------+ |
* COUNT Up ---------------------+
*
*
*/
#define PWM_CTL 0x08
#define ON_HIGH 0x04
#define TABLE_5V 0x02
#define COUNT_DWNBIT 0x01
#define KEY_MASK 0xE0 /* key mask */
#define KEY_VALUE_MASK 0x07 /* mask for set value */
#define VALUE_MASK 0x1F /* signature mask */
#define JAWS_SPEED_FSTN_REG_PTR ((unsigned char *) 0x50FB4000)
#define JAWS_25MHZ 0x01
#define JAWS_FSTN 0x02
#define PORTABLE_BACKLIGHT() ((BACKLIGHTSIGREG == BACKLIGHTSIG_ARUBA) || (BACKLIGHTSIGREG == BACKLIGHTSIG_UPGRD) || (BACKLIGHTSIGREG == BACKLIGHTSIG_ASAHI))
typedef struct
{
Ptr globals;
VBLTask vblpb;
} vblstruct;
typedef struct
{
short minimum;
short maximum;
unsigned char table[];
} setTableType; /* <H8> new structure for tables */
typedef struct
{
SleepQRec sleepQelement; /* sleep queue element, MUST stay on top */
vblstruct brightnessVbl; /* vbl element for background functions */
unsigned short version;
unsigned int reserved :24; /* unused flags */
unsigned int slewChange :1; /* unused flags */
unsigned int lowTable :1; /* unused flags */
unsigned int dualTable :1; /* unused flags */
unsigned int freeflag :1; /* call pmgr AtoD instead of temp status */
unsigned int flyByWire :1; /* is this software control throught hardware input controls */
unsigned int vbl_ok :1; /* allow background functions */
unsigned int kbdactive :1; /* used for kbd repeat, indicated kbd currently adj backlight */
unsigned int disableHWinput :1; /* flag used to enable user input scanning */
int (*setlevelproc)(); /* pointer to set backlight routine */
int (*userInputProc)(); /* pointer to read user control routine */
OSErr (*controlProc)();
OSErr (*statusProc)();
int (*closeProc)(); /* pointer to shutdown routine */
void (*tableProc)(); /* pointer to shutdown routine */
short slewLimit;
unsigned short lowThreshold;
unsigned short hiThreshold;
setTableType *settingTable; /* <H8> pointer to record now */
setTableType *settingTableLow; /* <H8> pointer to record now */
setTableType *settingTableHigh; /* <H8> pointer to record now */
short *maximumTable;
short lastLevel; /* last power level */
short powerRange; /* battery power range */
short userRange; /* user power range */
short userInputSampleRate; /* rate of sampling user input (ticks) */
short userBrightness; /* user requested brightness */
short lastHWSetting;
short mousedownTicks; /* first notice of mouse down in tick count */
short keycodes; /* key combinations */
short lastatod; /* last raw a to d value */
Ptr hardwareDependentPtr; /* private storage for hardware dependent code */
} driverGlobaltypes, *driverGlobalPtr;
typedef struct
{
int setProc;
int getProc;
int open;
int close;
int control;
int status;
int tableProc;
int maxTable;
int lowTable;
int hiTable;
int hwDependentVar;
} *cpuBkltRoutinePtr;
typedef struct
{
unsigned long flags;
short userInputSampleRate;
unsigned short lowThreshold; /*low hysteresis threshold */
unsigned short hiThreshold ; /* high hysteresis threshold */
} *cpuBkltInfoPtr;
typedef struct
{
cpuBkltRoutinePtr bkltroutines;
cpuBkltInfoPtr bkltinfo;
} cpuDependentInfoType,*cpuDependentInfoPtr;
#define PEG_TO_LIMITS(value,max,min) value = (value > max) ? max : (value < min) ? min : value
#define GetPramBrightness() ( GetBacklightInfo(VALUE_MASK, 0) - 1 )
#define GetPramKeyData() GetBacklightInfo(KEY_MASK, 5)
/* add backlight value offset */
#define SaveBrightness(new) SaveBacklightInfo(new+1,VALUE_MASK, 0)
#define SaveKeyData(new) SaveBacklightInfo(new,KEY_MASK, 5)
/* <H8> new ponti defintions */
#define PONTILMPCTLREG *((unsigned char *) 0x50f96C00)
#define PONTILMPON 0
#define PONTILMPHWCTL 1
#define PONTILMPMUX0 2
#define PONTILMPMUX1 3
typedef int (*intFunction)();
typedef OSErr (*osFunction)();
typedef void (*voidFunction)();
int abs(int);
unsigned char GetPortableValues(int parameter);
OSErr InitPWMControls(driverGlobalPtr globalPtr);
unsigned char Get_AtoD(int channel);
unsigned char Get_PGEButton(int channel);
int SetPWM(int new, driverGlobalPtr globalPtr);

View File

@ -0,0 +1,75 @@
/*
File: backlight.r
Contains: resource header for backlight driver
Written by: Andy Gong
Copyright: © 1991 by Apple Computer, Inc., all rights reserved.
Change History (most recent first):
*** Rolled into 7.0
<2> 1/24/91 ag changed to pass in directory.
<1> 1/24/91 ag first checked in
To Do:
*/
/*
* Define header for driver resource
*
*/
type 'DRVW' {
boolean = 0; /* unused */
boolean dontNeedLock, needLock; /* lock drvr in memory */
boolean dontNeedTime, needTime; /* for periodic action */
boolean dontNeedGoodbye, needGoodbye; /* call before heap reinit*/
boolean noStatusEnable, statusEnable; /* responds to status */
boolean noCtlEnable, ctlEnable; /* responds to control */
boolean noWriteEnable, writeEnable; /* responds to write */
boolean noReadEnable, readEnable; /* responds to read */
byte = 0; /* low byte of drvrFlags word unused */
unsigned integer; /* driver delay (ticks) */
integer; /* desk acc event mask */
integer; /* driver menu ID */
unsigned integer = 50; /* offset to DRVRRuntime open */
unsigned integer = 54; /* offset to DRVRRuntime prime */
unsigned integer = 58; /* offset to DRVRRuntime control*/
unsigned integer = 62; /* offset to DRVRRuntime status */
unsigned integer = 66; /* offset to DRVRRuntime close */
pstring[31]; /* driver name */
hex string; /* driver code (use $$resource(...)) */
};
type 'DRVR' as 'DRVW'; /* Map 'DRVW' => 'DRVR' */
/*
* Header for backlight driver
*
*/
resource 'DRVR' (-16511, ".Backlight", sysheap) {
needLock,
dontNeedTime,
dontNeedGoodbye,
statusEnable,
ctlEnable, /* Desk accessories only do Control calls */
noWriteEnable,
noReadEnable,
0, /* drvrDelay - Wake up 60 ticks */
0, /* drvrEMask */
0, /* drvrMenu */
".Backlight", /* drvrName */
/*
* This directive inserts the contents of the DRVW resource
* produced by linking DRVRRuntime.o with our DA code
*/
$$resource(Obj, 'DRVW', -16511)
};

View File

@ -0,0 +1,82 @@
/*
File: input.c
Contains: This file contains the hardware specific user input routines for backlight control.
Written by: Andy Gong x6595
Copyright: © 1991-1993 by Apple Computer, Inc. All rights reserved.
This file is used in these builds: ROM
Change History (most recent first):
<1> 12/14/93 PN first checked in
<K2> 7/27/93 ag removed unused code.
<1> 7/27/93 ag first checked in
<1> 6/30/92 ag new today
*/
/*page*/
/************************************/
/*** INCLUDE FILES DECLARATIONS ***/
#include <SysEqu.h>
#include <types.h>
#include <memory.h>
#include <OSEvents.h>
#include <devices.h>
#include <errors.h>
#include <retrace.h>
#include <Strings.h>
#include <Shutdown.h>
#include <stdlib.h>
#include "PowerMgr.h"
#include "backlight.h"
#define READ_ATOD_CHANNEL 0xD8
#define READ_BUTTON_VALUE 0xD9
#define Larger(x,y) (x > y) ? x : y
/*page
***************************************************************************************************
*
* The generic control routine É
*
* return:
* controlErr - illegal control selector
*
***************************************************************************************************
*/
OSErr BkltGenericControl(CntrlParam *ctlPB,driverGlobalPtr globalPtr)
{
#pragma unused (ctlPB,globalPtr)
return(controlErr);
}
/*page
***************************************************************************************************
*
* The generic status routine É
*
* return:
* statusErr - illegal control selector
*
***************************************************************************************************
*/
OSErr BkltGenericStatus(CntrlParam *ctlPB,driverGlobalPtr globalPtr)
{
#pragma unused (ctlPB,globalPtr)
return(statusErr);
}

View File

@ -0,0 +1,177 @@
/*
File: cpu.c
Contains: This file contains the hardware specific routines to control a PWM-based
interface found on Asahi, TIM, DB-Lite.
Written by: Andy Gong x6595
Copyright: © 1991-1992 by Apple Computer, Inc. All rights reserved.
This file is used in these builds: ROM
Change History (most recent first):
<SM1> 2/11/93 CSS Checked in from Horror.
<1> 6/5/91 ag Moved data
*/
/*page*/
/************************************/
/*** INCLUDE FILES DECLARATIONS ***/
#include <SysEqu.h>
#include <types.h>
#include <errors.h>
#include "PowerMgr.h"
#include "backlight.h"
#define BACKLIGHT_POT_CHANNEL 0
#define STATUS 0
#define POWERBYTE 1
#define TEMPBYTE 2
/*page
===================================================================================================
== asahi software =================================================================================
===================================================================================================
*/
/*page
***************************************************************************************************
*
*
***************************************************************************************************
*/
unsigned char PortableBacklightValue()
{
return(GetPortableValues(TEMPBYTE));
};
/*page
===================================================================================================
== TIM software ===================================================================================
===================================================================================================
*/
OSErr InitTimControls(driverGlobalPtr globalPtr)
{
/* setup default values */
if ((*JAWS_SPEED_FSTN_REG_PTR & JAWS_FSTN) == 0)
globalPtr->dualTable = true; /* support high/low table */
return(InitPWMControls(globalPtr));
};
/*page
***************************************************************************************************
*
*
***************************************************************************************************
*/
unsigned char PowerMgrPot()
{
return(Get_AtoD(BACKLIGHT_POT_CHANNEL));
};
/*page
===================================================================================================
== DB software ====================================================================================
===================================================================================================
*/
/*page
***************************************************************************************************
*
*
***************************************************************************************************
*/
unsigned char PGE_button()
{
return(Get_PGEButton(BACKLIGHT_POT_CHANNEL));
};
/*page
===================================================================================================
== Dart software =================================================================================
===================================================================================================
*/
extern setTableType BacklightTblDart;
/*page
***************************************************************************************************
*
* SetDart - <H8> backlight set routine for Dartanian with Ponti ACIC
*
*
***************************************************************************************************
*/
int SetDart(int new,driverGlobalPtr globalPtr)
{
unsigned char newvalue;
unsigned char oldvalue;
PEG_TO_LIMITS(new, globalPtr->maximumTable[globalPtr->powerRange], globalPtr->settingTable->minimum); /* <H8> use new tables */ /* limit value to valid range */
newvalue = globalPtr->settingTable->table[new]; /* shift bits into the correct position */
if ((globalPtr->lastHWSetting) == newvalue) return (new);
globalPtr->lastHWSetting = newvalue;
newvalue <<= PONTILMPMUX0; /* shift bits into the correct position */
oldvalue = PONTILMPCTLREG;
oldvalue &= ~(0x03 << PONTILMPMUX0 | 0x01 << PONTILMPON); /* mask out lamp values */
newvalue |= oldvalue; /* or in the other bits into the new value */
if (new) newvalue |= (1 << PONTILMPON);
PONTILMPCTLREG = newvalue;
return (new);
};
/*page
***************************************************************************************************
*
* GetDart - backlight get routine for Dartanian with Ponti ACIC
*
***************************************************************************************************
*/
int GetDart (driverGlobalPtr globalPtr)
{
int userinput;
switch(globalPtr->powerRange)
{
case 1:
case 2: userinput = 2; break;
case 3: userinput = 1; break;
case 4: userinput = 0; break;
default: userinput = 3;
};
return(userinput);
}
OSErr InitDartControls(driverGlobalPtr globalPtr)
{
/* setup default values */
PONTILMPCTLREG |= 0x01 << PONTILMPON; /* turn on backlight to enable sense bit */
if (PONTILMPCTLREG & (0x01 << PONTILMPHWCTL)) /* check for hardare controls */
{
SetPWM(29,globalPtr); /* kludge for orca based units */
globalPtr->setlevelproc = SetDart; /* proc to set level */
globalPtr->userInputProc = GetDart; /* proc to read user input */
};
return(InitPWMControls(globalPtr));
};

View File

@ -0,0 +1,26 @@
;
; File: backlightequ.a
;
; Contains: redundant equates
;
; Written by: a ghost
;
; Copyright: © 1993 by Apple Computer, Inc., all rights reserved.
;
; Change History (most recent first):
;
; <SM1> 2/9/93 CSS Update from Horror, and remove boxflags from here.
; <H2> 1/21/93 RLE add Escher box flags
;
;
backlightflags RECORD 0,Increment
disableHWinput ds.b 1 ;
kbdactive ds.b 1 ; /* used for kbd repeat, indicated kbd currently adj backlight */
vbl_ok ds.b 1 ; /* allow background functions */
flyByWire ds.b 1 ; /* is this software control throught hardware input controls */
freeflag ds.b 1 ; /* call pmgr AtoD instead of temp status */
dualTable ds.b 1 ; /* unused flags */
lowTable ds.b 1 ; /* unused flags */
slewChange ds.b 1 ; /* unused flags */
endr

View File

@ -0,0 +1,139 @@
/*
File: input.c
Contains: This file contains the hardware specific user input routines for backlight control.
Written by: Andy Gong x6595
Copyright: © 1991-1992 by Apple Computer, Inc. All rights reserved.
This file is used in these builds: ROM
Change History (most recent first):
<SM1> 2/11/93 CSS Checked in from Horror.
<1> 6/30/92 ag new today
*/
/*page*/
/************************************/
/*** INCLUDE FILES DECLARATIONS ***/
#include <SysEqu.h>
#include <types.h>
#include <errors.h>
#include "PowerMgr.h"
#include "backlight.h"
#define READ_ATOD_CHANNEL 0xD8
#define READ_BUTTON_VALUE 0xD9
extern short PotInputRangeShiftTblPWM[];
/*page
***************************************************************************************************
*
*
***************************************************************************************************
*/
unsigned char Get_AtoD(int channel)
{
PMgrPBlock pb; /* power manager pb */
char atodChannel; /* a to d channel to read [0-8] */
unsigned char value; /* return value */
OSErr error; /* pmgr error */
atodChannel = channel; /* load channel value into buffer */
pb.pmgrCmd = READ_ATOD_CHANNEL; /* load read channel command */
pb.pmgrCnt = 1; /* transmit buffer count is 1 byte */
pb.pmgrXPtr = &atodChannel; /* pointer to transmit buffer */
pb.pmgrRPtr = &value; /* pointer to receive buffer */
error = PMgr(&pb);
return( (error) ? 0 : value);
};
/*page
***************************************************************************************************
*
*
***************************************************************************************************
*/
unsigned char Get_PGEButton(int channel)
{
PMgrPBlock pb; /* power manager pb */
char atodChannel; /* a to d channel to read [0-8] */
unsigned char value; /* return value */
OSErr error; /* pmgr error */
atodChannel = channel; /* load channel value into buffer */
pb.pmgrCmd = READ_BUTTON_VALUE; /* load read channel command */
pb.pmgrCnt = 1; /* transmit buffer count is 1 byte */
pb.pmgrXPtr = &atodChannel; /* pointer to transmit buffer */
pb.pmgrRPtr = &value; /* pointer to receive buffer */
error = PMgr(&pb);
return( (error) ? 0 : value);
};
/*page
***************************************************************************************************
*
*
***************************************************************************************************
*/
unsigned char GetPortableValues(int parameter)
{
PMgrPBlock pb; /* power manager pb */
OSErr err; /* power manager error */
unsigned char rbuf[3]; /* buffer for send command */
pb.pmgrCmd = BatteryStatusImmCmd; /* on old pmgr, read battery status (immediate not averaged) */
pb.pmgrCnt = 0;
pb.pmgrXPtr = nil;
pb.pmgrRPtr = rbuf;
err = PMgr(&pb);
return( (err) ? 0 : rbuf[parameter]); /* return 0 if error, else read value */
}
/*page
***************************************************************************************************
*
*
***************************************************************************************************
*/
int PotControl (driverGlobalPtr globalPtr)
{
#pragma unused (globalPtr)
unsigned int potvalue;
potvalue = (* (intFunction)(globalPtr->hardwareDependentPtr))();
if (abs(globalPtr->lastatod - potvalue) <= 5) /* was the change less than 100mv */
potvalue = globalPtr->lastatod; /* is less than, the use old value */
globalPtr->lastatod = potvalue; /* update last a to d value */
potvalue >>= 3; /* scale to 0 to 31 */
if (potvalue) /* if non-zero, check for subrange limiting */
{
potvalue >>= PotInputRangeShiftTblPWM[globalPtr->powerRange]; /* rescale in low power levels */
if (!potvalue) potvalue = 1; /* make sure we don't change the backlight state */
};
return(potvalue);
};

View File

@ -0,0 +1,265 @@
;
; File: backlightpatch.a
;
; Contains: patches backlight
;
; Copyright: © 1991 by Apple Computer, Inc., all rights reserved.
;
; Change History (most recent first):
;
; <3> 10/28/91 SAM Rolled in Regatta file.
;
; Regatta Change History:
;
; <4> 8/19/91 SAM (ag) removed code to patch rom driver (not needed any more).
; <3> 8/8/91 SAM Changed the InstallProc conditional so that it only installs on
; original portables only.
; <2> 8/8/91 SAM (ag) Changed something. It's not clear what, exactly.
; <1> 5/15/91 SAM Split off from TERRORProj.
;
;
;
load 'StandardEqu.d'
include 'LinkedPatchMacros.a'
include 'HardwarePrivateEqu.a'
include 'ATalkEqu.a'
include 'UniversalEqu.a'
STRING PASCAL
;------------------------------------------------------------------------------------------
;
; BklightInstall - install and open the backlight driver if available
;
;------------------------------------------------------------------------------------------
SignatureReg equ $FC0200 ; address of backlight signature
SignatureAruba equ $A5 ; signature for aruba backlight
SignatureUpgrd equ $A3 ; signature for upgrade backlight
SignatureAsahi equ $AD ; signature for asahi backlight
DriverID equ -16511 ; id of driver resource
DriverType equ 'DRVR' ; resource type of driver
ROMs Portable
BklightInstall InstallProc (Portable)
TestFor hwCbPwrMgr
beq.s @exit ; if not power manager, exit
lea #'.Backlight',A1 ; load pointer to driver name
; is there a driver to patch ???
; bsr OpenDRVR ; attempt to open backlight driver (a1/d0)
; beq patchDriver
; should we install a driver from the system file ???
move.l #DriverType,d1 ; load resource type in d1
move.w #DriverID,d2 ; load resource id in d2
move.l #SignatureReg,a0 ; point a0 to signature register
cmpi.b #SignatureAruba,(a0) ; check for aruba signature
beq.s installDriver
cmpi.b #SignatureUpgrd,(a0) ; check for upgrade signature
beq.s installDriver
cmpi.b #SignatureAsahi,(a0) ; check for derringer signature
beq.s installDriver
@exit rts ; no backlight, exit
;------------------------------------------------------------------------------------------
;
; installDriver - get the backlight driver from the system file. install and open the
; driver in the first available slot after entry 48
;
; input
; a1 - pointer to pascal name string
; d1 - Resource Type
; d2 - Resource ID
;
; output
; none
;
; usage
; d a0 - utable ptr/dce pointer
; d a1 - Handle to resource
; d a2 - pointer to pascal name string
; d d0 - Resource Type
; d1 - Resource Type
; d2 - Resource ID
;
installDriver move.l a1,a2 ; move name ptr to a2 for safe keeping
bsr.s GetDetachRes ; get and detach resource (d1,d1/a1)
beq.s @exit ; exit if no handle
bsr.s FirstEntryFree ; get ref num of first free entry (/d0,d1)
_DrvrInstall ; create dce (d0/d0)
tst.l d0 ; test for error
bne.s @releaseDrvr ; ... exit if error
move.l UTableBase,a0 ; point to utable array
move.l (a0,d1),a0 ; get handle to dce in a3
move.l (a0),a0 ; get pointer to dce
move.l a1,dCtlDriver(a0) ; load driver
move.l (a1),a1 ; get pointer to driver
move.w drvrFlags(a1),dCtlFlags(a0) ; copy data to dce
move.w drvrDelay(a1),dCtlDelay(a0)
move.w drvrEMask(a1),dCtlEMask(a0)
move.w drvrMenu(a1),dCtlMenu(a0)
bset.b #dNeedLock,dCtlFlags+1(a0) ; set the handle bit
@openDrvr move.l a2,a1 ; load pointer to driver name
bsr.s OpenDRVR ; open the driver (a1/)
@exit rts
@releaseDrvr move.l a1,a0 ; move handle to a0
_disposHandle ; release the memory
rts
;------------------------------------------------------------------------------------------
;
; FirstEntryFree - Find the first free entry
;
; input
; none
;
; output
; d0.l - driver ref num
; d1.l - offset in table
;
; usage
; a0 - pointer to unit table base
; d0 - table address offset
;
;------------------------------------------------------------------------------------------
StartEntry equ (48-1) ; this avoids appletalk area
FirstEntryFree move.l a0,-(SP) ; save a0
@findEntry move.l UTableBase,a0 ; point to utable array
move.l #(StartEntry*4),d0 ; start at entry (48-1)
@testEntry addq.l #4,d0 ; increment to next entry
tst.l 0(a0,d0) ; test entry
bne.s @testEntry ; if != 0, next entry
@calcRefnum move.l d0,d1
lsr.l #2,d0 ; divide by 4 to get entry number
addq.l #1,d0 ; add 1 (refnum is -(entry number + 1)
neg.l d0 ; negate to get reference number
move.l (SP)+,a0 ; restore a0
rts
;------------------------------------------------------------------------------------------
;
; GetDetachRes - Gets and detaches a resource.
;
; input
; d1 Resource Type
; d2 Resource ID
;
; output
; a1 Handle to resource
;
; usage
; d a1 - Handle to resource
; d d0 - Resource Type
; d1 - Resource Type
; d2 - Resource ID
;
;------------------------------------------------------------------------------------------
GetDetachRes
SUBQ.L #4, SP ; For return address
MOVE.L D1, -(SP) ; Resource type
MOVE.W D2, -(SP) ; Resource ID
_GetResource
MOVE.L (SP), A1 ; Get resource handle to return
_DetachResource
MOVE.L A1,D0 ; Set result code
RTS
;------------------------------------------------------------------------------------------
;
; OpenDRVR - routine used to open a driver
;
; input
; a1 - pointer to driver name
;
; output
; d0.l - refnum/ioResult of open
;
; usage
; a0 - pointer to iopb
; a1 - pointer to driver name
;
;------------------------------------------------------------------------------------------
OpenRegs reg A0-A3/D1-D2
OpenDRVR MOVEM.L OpenRegs,-(SP)
SUB.W #ioQElSize,SP ; Allocate IO stack frame
MOVE.L SP,A0 ; set a0 to point to the pb
MOVE.L A1,ioVNPtr(A0) ; load pointer to name
MOVE.B #fsCurPerm,ioPermssn(A0); set permission (not used)
_Open
MOVE.W ioRefNum(A0),D0 ; return ioRefNum (D0.W:HI)
SWAP D0 ; move ioRefNum HI
MOVE.W ioResult(A0),D0 ; return result (D0.W:LO)
ADD.W #ioQElSize,SP ; Release stack frame
TST.W D0 ; set condition codes based on errors
MOVEM.L (SP)+,OpenRegs
RTS ; Sucess returned in status
EndProc
;------------------------------------------------------------------------------------------
;
; NewBKLTHeader - new header for backlight driver
;
;------------------------------------------------------------------------------------------
BacklightOpen ROMBind (IIci,$e63f2) ; <r8> djw
BacklightPrime ROMBind (IIci,$e63f6) ; <r8> djw
BacklightControl ROMBind (IIci,$e63fa) ; <r8> djw
BacklightStatus ROMBind (IIci,$e63fe) ; <r8> djw
BacklightClose ROMBind (IIci,$e6402) ; <r8> djw
NewBKLTHeader PROC
dc.w $4e00 ; write,ctl,status,needslock
dc.w 0,0,0
dc.w OpenPatch-NewBKLTHeader ; open
dc.w PrimePatch-NewBKLTHeader ; prime
dc.w CtlPatch-NewBKLTHeader ; control
dc.w StatusPatch-NewBKLTHeader ; status
dc.w ClosePatch-NewBKLTHeader ; close
DC.B '.Backlight'
align 2
; Entry points back into rom
OpenPatch jmpROM BacklightOpen ; open the driver
PrimePatch jmpROM BacklightPrime
CtlPatch jmpROM BacklightControl ; continue in rom
StatusPatch jmpROM BacklightStatus
ClosePatch jmpROM BacklightClose
EndProc
End

View File

@ -0,0 +1,234 @@
;
; File: backlight.a
;
; Contains: backlight driver low level glue
;
; Written by: Andy Gong
;
; Copyright: © 1990-1993 by Apple Computer, Inc. All rights reserved.
;
; This file is used in these builds: ROM
;
; Change History (most recent first):
;
; <K3> 9/8/93 ag a new set of values for the backlight table. this should
; increase the range on both the top and bottom ends.
; <K2> 8/13/93 ag changed hardwareequ.a to hardwareprivateequ.a.
; <1> 7/27/93 ag first checked in
; <H12> 3/11/93 RLE another pass at the Escher backlighting table
; <H11> 2/26/93 RLE split a new backlight table off for Escher since the displays
; are just a wee bit different
; <H10> 1/21/93 RLE add support for Escher
; <H9> 7/13/92 SWC Yet another pass at the DBLite table. Deja vu, eh?
; <H8> 6/30/92 ag Added cpu info tables for cpu dependent information.
; <H7> 5/7/92 ag Changed the structure of the backlight tables. Included in the
; tables are a header which indicates the minimun and maximum
; values.
; <H6> 4/10/92 SWC Yet another pass at the DBLite table.
; <H5> 3/4/92 SWC Next pass at the DBLite table.
; <H4> 2/12/92 SWC Changed the DB-Lite table limits to have a narrower range of
; values.
; <H3> 9/10/91 SWC Changed the DB-Lite table to have a span of 0..127 instead of
; 0..255 since the backlight values don't go that high.
; <H2> 8/26/91 SWC Added a PWM lookup table for DB-Lite.
; ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
; Pre-HORROR ROM comments begin here.
; ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
; <5> 7/8/91 ag added lookup table for ashai added name constant for gestalt
; lookup
; <4> 6/24/91 ag added new lookup table for PWM low voltage operation.
; <3> 6/11/91 ag added new table for low power scaling.
; <2> 4/2/91 ag added table lookup for PWM
; <1> 1/23/91 ag first checked in
;_______________________________________________________________________
BLANKS ON
PRINT OFF
INCLUDE 'SysEqu.a'
INCLUDE 'SysErr.a'
INCLUDE 'Traps.a'
INCLUDE 'HardwarePrivateEqu.a'
INCLUDE 'powerprivequ.a'
INCLUDE 'backlightequ.a'
PRINT ON
STRING PASCAL
BacklightPrimitiveTables Proc
with backlightflags
export PrattBkltPrims
DC.L PrimsTypeTable ; flags
DC.L (PrattBkltPrimsEnd-PrattBkltPrims) ; size of table
PrattBkltPrims ; Table of Primitives tables
DC.L PrattBkltProcTable-PrattBkltPrims ; offset to table of backlight routines
DC.L PrattBkltInfo-PrattBkltPrims ; offset to table of backlight information
PrattBkltPrimsEnd
DC.L PrimsTypeInfo ; flags
DC.L (PrattBkltInfoEnd-PrattBkltInfo) ; size of table
PrattBkltInfo ; machine-specific constants:
dc.l (0 << disableHWinput)\ ; operating flag (stops user input)
+(0 << kbdactive)\ ; operating flag (kbd control inprogress)
+(1 << vbl_ok)\ ; operating flag (allow vbl operations)
+(1 << flyByWire)\ ; config flag (hardware input)
+(1 << freeflag)\
+(0 << dualTable)\ ; config flag (use multi tables)
+(0 << lowTable)\ ; operating flag (currently using low table)
+(0 << slewChange) ; operating flag (table transition inprogress)
dc.w 10 ; vbl count SampleRate
dc.w 0 ; (n/a) lowThreshold
dc.w 0 ; (n/a) hiThreshold
PrattBkltInfoEnd
CASE OBJECT
import SetPWM,PotControl,InitPWMControls,PGE_button
import PWMCloseRoutine,PWMControl,BkltGenericStatus
DC.L PrimsTypePtr ; flags
DC.L (PrattBkltProcTableEnd-PrattBkltProcTable) ; size of table
PrattBkltProcTable ; machine specific IdleMind Routines
dc.l SetPWM - PrattBkltProcTable ; set routine
dc.l PotControl - PrattBkltProcTable ; get user input routine
dc.l InitPWMControls - PrattBkltProcTable ; initialize routine
dc.l PWMCloseRoutine - PrattBkltProcTable ; close routine
dc.l PWMControl - PrattBkltProcTable ; control routine
dc.l BkltGenericStatus - PrattBkltProcTable ; status routine
dc.l BkltStandardExit - PrattBkltProcTable ; (n/a) charger state change routine
dc.l PWMMaxTbl - PrattBkltProcTable ; table of maximum value for different power ranges
dc.l dbTbl - PrattBkltProcTable ; low range table
dc.l dbTbl - PrattBkltProcTable ; high range table
dc.l PGE_button - PrattBkltProcTable ; hardware dependent var
PrattBkltProcTableEnd
export PowerBookDuoBkltPrims
DC.L PrimsTypeTable ; flags
DC.L (PowerBookDuoBkltPrimsEnd-PowerBookDuoBkltPrims) ; size of table
PowerBookDuoBkltPrims ; Table of Primitives tables
DC.L PowerBookDuoBkltProcTable-PowerBookDuoBkltPrims ; offset to table of backlight routines
DC.L PowerBookDuoBkltInfo-PowerBookDuoBkltPrims ; offset to table of backlight information
PowerBookDuoBkltPrimsEnd
DC.L PrimsTypeInfo ; flags
DC.L (PowerBookDuoBkltInfoEnd-PowerBookDuoBkltInfo) ; size of table
PowerBookDuoBkltInfo ; machine-specific constants:
dc.l (0 << disableHWinput)\ ; operating flag (stops user input)
+(0 << kbdactive)\ ; operating flag (kbd control inprogress)
+(1 << vbl_ok)\ ; operating flag (allow vbl operations)
+(1 << flyByWire)\ ; config flag (hardware input)
+(1 << freeflag)\
+(0 << dualTable)\ ; config flag (use multi tables)
+(0 << lowTable)\ ; operating flag (currently using low table)
+(0 << slewChange) ; operating flag (table transition inprogress)
dc.w 10 ; vbl count SampleRate
dc.w 0 ; (n/a) lowThreshold
dc.w 0 ; (n/a) hiThreshold
PowerBookDuoBkltInfoEnd
CASE OBJECT
import SetPWM,PotControl,InitPWMControls,PGE_button
import PWMCloseRoutine,PWMControl,BkltGenericStatus
DC.L PrimsTypePtr ; flags
DC.L (PowerBookDuoBkltProcTableEnd-PowerBookDuoBkltProcTable) ; size of table
PowerBookDuoBkltProcTable ; machine specific IdleMind Routines
dc.l SetPWM - PowerBookDuoBkltProcTable ; set routine
dc.l PotControl - PowerBookDuoBkltProcTable ; get user input routine
dc.l InitPWMControls - PowerBookDuoBkltProcTable ; initialize routine
dc.l PWMCloseRoutine - PowerBookDuoBkltProcTable ; close routine
dc.l PWMControl - PowerBookDuoBkltProcTable ; control routine
dc.l BkltGenericStatus - PowerBookDuoBkltProcTable ; status routine
dc.l BkltStandardExit - PowerBookDuoBkltProcTable ; (n/a) charger state change routine
dc.l PWMMaxTbl - PowerBookDuoBkltProcTable ; table of maximum value for different power ranges
dc.l dbTbl - PowerBookDuoBkltProcTable ; low range table
dc.l dbTbl - PowerBookDuoBkltProcTable ; high range table
dc.l PGE_button - PowerBookDuoBkltProcTable ; hardware dependent var
PowerBookDuoBkltProcTableEnd
CASE OFF
;--------------------------------------------------------------------------------------------------------------
;
;
DBLiteinfo
;--------------------------------------------------------------------------------------------------------------
;
dbTbl ; <H2>
dc.w 0 ; minimum value <H7>
dc.w @end - @start ; <H7>
@start DC.B 127 ; 0 <H7>
DC.B 120 ; 1
DC.B 113 ; 2
DC.B 109 ; 3
DC.B 106 ; 4
DC.B 102 ; 5
DC.B 99 ; 6
DC.B 95 ; 7
DC.B 92 ; 8
DC.B 88 ; 9
DC.B 85 ; 10
DC.B 81 ; 11
DC.B 77 ; 12
DC.B 74 ; 13
DC.B 70 ; 14
DC.B 67 ; 15
DC.B 63 ; 16
DC.B 60 ; 17
DC.B 56 ; 18
DC.B 53 ; 19
DC.B 49 ; 20
DC.B 45 ; 21
DC.B 42 ; 22
DC.B 38 ; 23
DC.B 35 ; 24
DC.B 31 ; 25
DC.B 28 ; 26
DC.B 24 ; 27
DC.B 21 ; 28
DC.B 17 ; 29
DC.B 14 ; 30
@end DC.B 10 ; 31 <H7>
;--------------------------------------------------------------------------------------------------------------
;
PWMMaxTbl
dc.w 31 ; 0
dc.w 15 ; 1
dc.w 15 ; 2
dc.w 7 ; 3
dc.w 3 ; 4
;--------------------------------------------------------------------------------------------------------------
;
CASE OBJECT
export PotInputRangeShiftTblPWM
PotInputRangeShiftTblPWM
dc.w 0 ; 0
dc.w 1 ; 1
dc.w 1 ; 2
dc.w 2 ; 3
dc.w 3 ; 4
CASE OFF
case object
BkltStandardExit
rts
case off
END

34
Drivers/Drivers.make Normal file
View File

@ -0,0 +1,34 @@
#
# File: Drivers.make
#
# Contains: makefile for the drivers in ROM
#
# Written by: Kurt Clark
#
# Copyright: © 1992-1993 by Apple Computer, Inc., all rights reserved.
#
# Change History (most recent first):
#
# <SM2> 4/11/93 chp Added SerialDMA.make as a separate entity from Serial.make.
#
SonyDir = {DriverDir}Sony:
SerialDir = {DriverDir}Serial:
NewAgeDir = {DriverDir}NewAge:
IOPDir = {DriverDir}IOP:
SerialDMADir = {DriverDir}SerialDMA:
EDiskDir = {DriverDir}EDisk:
BackLightDir = {DriverDir}BackLight:
#include {SonyDir}Sony.make
#include {SerialDir}Serial.make
#include {SerialDMADir}SerialDMA.make
#include {NewAgeDir}NewAge.make
#include {IOPDir}IOP.make
#include {EDiskDir}EDisk.make
#include {BackLightDir}Backlight.make

24
Drivers/EDisk/EDisk.make Normal file
View File

@ -0,0 +1,24 @@
#
# File: EDisk.make
#
# Contains: Makefile for EDisk.
#
# Written by: Kurt Clark, Chas Spillar, and Tim Nichols
#
# Copyright: © 1992 by Apple Computer, Inc., all rights reserved.
#
# Change History (most recent first):
#
# <SM2> 11/14/92 kc Change link option used to name segment from -sg to -sn.
"{RsrcDir}EDisk.rsrc" Ä "{ObjDir}EDiskDriver.a.o"
Link {StdLOpts} {StdAlign} -o "{Targ}" -sn Main=".EDisk" -rt DRVR=48 "{ObjDir}EDiskDriver.a.o"
"{ObjDir}EDiskDriver.a.o" Ä "{ObjDir}StandardEqu.d" ¶
"{AIncludes}HardwareEqu.a" ¶
"{AIncludes}SonyEqu.a" ¶
"{IntAIncludes}EDiskEqu.a" ¶
"{EDiskDir}EDiskDriver.a"
Asm {StdAOpts} -o "{Targ}" "{EDiskDir}EDiskDriver.a" -d SonyNonPortable=1

1766
Drivers/EDisk/EDiskDriver.a Normal file

File diff suppressed because it is too large Load Diff

1179
Drivers/IOP/ADBDriver.aii Normal file

File diff suppressed because it is too large Load Diff

112
Drivers/IOP/IOP.make Normal file
View File

@ -0,0 +1,112 @@
#
# File: IOP.make
#
# Contains: Makefile for IOP stuff.
#
# Written by: Kurt Clark, Chas Spillar, and Tim Nichols
#
# Copyright: © 1992-1993 by Apple Computer, Inc., all rights reserved.
#
# Change History (most recent first):
#
# <SM2> 11/9/93 KW changed scciop link rules
"{RsrcDir}SWIMIOP.rsrc" Ä "{ObjDir}SWIMIOP.BIN" ¶
"{RsrcDir}MakeIOPCRes"
"{RsrcDir}MakeIOPCRes" -r "{Targ}" -s 16384 -i 1 -o 1 -b "{ObjDir}SWIMIOP.BIN"
"{RsrcDir}SCCIOP.rsrc" Ä "{ObjDir}SCCIOP.BIN" ¶
"{RsrcDir}MakeIOPCRes"
"{RsrcDir}MakeIOPCRes" -r "{Targ}" -s 3072 -i 0 -o 1 -b "{ObjDir}SCCIOP.BIN"
"{ObjDir}SWIMIOP.BIN" Ä "{ObjDir}SWIMIOP.load"
MakeBinIIGS "{ObjDir}SWIMIOP.load" -o "{Targ}"
"{ObjDir}SCCIOP.BIN" Ä "{ObjDir}SCCIOP.load"
MakeBinIIGS "{ObjDir}SCCIOP.load" -o "{Targ}"
"{ObjDir}SWIMIOP.load" Ä "{ObjDir}IOPKernel.aii.obj" ¶
"{ObjDir}SWIMIOP.aii.obj" ¶
"{ObjDir}ADBDriver.aii.obj" ¶
"{ObjDir}SWIMDriver.aii.obj"
LinkIIGS -s -l -w -lseg SWIMIOP -o "{Targ}" -apw > "{ObjDir}SWIMIOP.map" ¶
-org $0001 "{ObjDir}IOPKernel.aii.obj"(@zdata) ¶
"{ObjDir}SWIMIOP.aii.obj"(@zdata) ¶
"{ObjDir}ADBDriver.aii.obj"(@zdata) ¶
"{ObjDir}SWIMDriver.aii.obj"(@zdata) ¶
"{ObjDir}IOPKernel.aii.obj"(@zcode) ¶
"{ObjDir}SWIMIOP.aii.obj"(@zcode) ¶
"{ObjDir}ADBDriver.aii.obj"(@zcode) ¶
"{ObjDir}SWIMDriver.aii.obj"(@zcode) ¶
-org $0400 "{ObjDir}IOPKernel.aii.obj"(@PageData) ¶
"{ObjDir}SWIMIOP.aii.obj"(@PageData) ¶
"{ObjDir}ADBDriver.aii.obj"(@PageData) ¶
"{ObjDir}SWIMDriver.aii.obj"(@PageData) ¶
"{ObjDir}IOPKernel.aii.obj"(@data) ¶
"{ObjDir}SWIMIOP.aii.obj"(@data) ¶
"{ObjDir}ADBDriver.aii.obj"(@data) ¶
"{ObjDir}SWIMDriver.aii.obj"(@data) ¶
-org $5000 "{ObjDir}IOPKernel.aii.obj"(@code) ¶
"{ObjDir}SWIMIOP.aii.obj"(@code) ¶
"{ObjDir}ADBDriver.aii.obj"(@code) ¶
"{ObjDir}SWIMDriver.aii.obj"(@code) ¶
-org $7700 "{ObjDir}IOPKernel.aii.obj"(@PageConsts) ¶
"{ObjDir}SWIMIOP.aii.obj"(@PageConsts) ¶
"{ObjDir}ADBDriver.aii.obj"(@PageConsts) ¶
"{ObjDir}SWIMDriver.aii.obj"(@PageConsts) ¶
"{ObjDir}IOPKernel.aii.obj"(@WordConsts) ¶
"{ObjDir}SWIMIOP.aii.obj"(@WordConsts) ¶
"{ObjDir}ADBDriver.aii.obj"(@WordConsts) ¶
"{ObjDir}SWIMDriver.aii.obj"(@WordConsts) ¶
"{ObjDir}IOPKernel.aii.obj"(@constants) ¶
"{ObjDir}SWIMIOP.aii.obj"(@constants) ¶
"{ObjDir}ADBDriver.aii.obj"(@constants) ¶
"{ObjDir}SWIMDriver.aii.obj"(@constants) ¶
-org $7FE5 "{ObjDir}IOPKernel.aii.obj"(@vectors)
"{ObjDir}SCCIOP.load" Ä "{ObjDir}SCCIOP.aii.obj"
LinkIIGS -s -l -w -lseg SCCIOP -o "{Targ}" -apw > "{ObjDir}SCCIOP.map" ¶
-org $0001 "{ObjDir}SCCIOP.aii.obj"(@IOPOS) ¶
-org $0400 "{ObjDir}SCCIOP.aii.obj"(@Main) ¶
-org $7ffa "{ObjDir}SCCIOP.aii.obj"(@Vectors)
# "{ObjDir}SCCIOP.aii.obj" ¶
#
"{ObjDir}IOPKernel.aii.obj" Ä "{IOPDir}IOPDefs.aii" ¶
"{IOPDir}IOPKernel.aii"
AsmIIGS -o "{Targ}" "{IOPDir}IOPKernel.aii"
"{ObjDir}SWIMIOP.aii.obj" Ä "{IOPDir}IOPDefs.aii" ¶
"{IOPDir}SWIMDefs.aii" ¶
"{IOPDir}SWIMIOP.aii"
AsmIIGS -o "{Targ}" "{IOPDir}SWIMIOP.aii"
"{ObjDir}SWIMDriver.aii.obj" Ä "{IOPDir}IOPDefs.aii" ¶
"{IOPDir}SWIMDefs.aii" ¶
"{IOPDir}SWIMDriver.aii"
AsmIIGS -o "{Targ}" "{IOPDir}SWIMDriver.aii"
"{ObjDir}ADBDriver.aii.obj" Ä "{IOPDir}IOPDefs.aii" ¶
"{IOPDir}SWIMDefs.aii" ¶
"{IOPDir}ADBDriver.aii"
AsmIIGS -o "{Targ}" "{IOPDir}ADBDriver.aii"
"{ObjDir}SCCIOP.aii.obj" Ä "{IOPDir}SCCIOPEqu.aii" ¶
"{IOPDir}SCCIOPSysEqu.aii" ¶
"{IOPDir}SCCIOP.aii"
AsmIIGS -o "{Targ}" "{IOPDir}SCCIOP.aii"

220
Drivers/IOP/IOPDefs.aii Normal file
View File

@ -0,0 +1,220 @@
;EASE$$$ READ ONLY COPY of file ÒIOPDefs.aiiÓ
; 1.2 CCH 07/08/1989 Added EASE comments to file.
;¥1.1 GGD 06/15/1989 Updated to use equates for the latest rev of the IOP chip,
; re-formated tab stops in source.
; 1.0 CCH 11/ 9/1988 Adding to EASE.
; END EASE MODIFICATION HISTORY
macro
assert &boolExpr
if not(&Eval(&boolExpr)) then
aerror &concat('Assertion Failed - ',&boolExpr)
endif
endm
; 65C02 definitions
pswC equ %00000001 ; carry bit
pswZ equ %00000010 ; zero bit
pswI equ %00000100 ; interrupt bit
pswD equ %00001000 ; decimal bit
pswB equ %00010000 ; break bit
psw5 equ %00100000 ; bit 5 unused
pswV equ %01000000 ; overflow bit
pswN equ %10000000 ; negative bit
StackPage equ $0100 ; page 1 is the stack
vNMI equ $FFFA ; non-maskable interrupt
vRESET equ $FFFC ; reset vector
vINT equ $FFFE ; interrupt vector
; IOP Hardware offsets
IOBase equ $F000 ; base of I/O space
; TIMER Hardware Control
TimerCounterL equ IOBase+$10 ; (RW) Timer low counter (latch on write)
TimerCounterH equ IOBase+$11 ; (RW) Timer high counter (load on write)
TimerLatchL equ IOBase+$12 ; (RW) Timer low latch
TimerLatchH equ IOBase+$13 ; (RW) Timer high latch
; DMA Hardware Control
DMA1Control equ IOBase+$20 ; (RW) DMA channel 1 control
DMAEN1 equ %00000001 ; enable DMA channel 1
DREQ1 equ %00000010 ; DMA request 1 active
DMADIR1 equ %00000100 ; transfer I/O to RAM
DEN1ON2 equ %00001000 ; start DMA 1 after DMA 2 complete
IOA1 equ %00010000 ; DMA I/O address
DMA1RAMAddressL equ IOBase+$21 ; (RW) DMA channel 1 RAM address low byte
DMA1RAMAddressH equ IOBase+$22 ; (RW) DMA channel 1 RAM address high byte
DMA1XferCountL equ IOBase+$23 ; (RW) DMA channel 1 transfer count low byte
DMA1XferCountH equ IOBase+$24 ; (RW) DMA channel 1 transfer count high byte
DMA2Control equ IOBase+$28 ; (RW) DMA channel 2 control
DMAEN2 equ %00000001 ; enable DMA channel 2
DREQ2 equ %00000010 ; DMA request 2 active
DMADIR2 equ %00000100 ; transfer I/O to RAM
DEN2ON1 equ %00001000 ; start DMA 2 after DMA 1 complete
IOA2 equ %00010000 ; DMA I/O address
DMA2RAMAddressL equ IOBase+$29 ; (RW) DMA channel 2 RAM address low byte
DMA2RAMAddressH equ IOBase+$2A ; (RW) DMA channel 2 RAM address high byte
DMA2XferCountL equ IOBase+$2B ; (RW) DMA channel 2 transfer count low byte
DMA2XferCountH equ IOBase+$2C ; (RW) DMA channel 2 transfer count high byte
; Miscelaneous Hardware Control
SCCControlReg equ IOBase+$30 ; (RW) SCC control register
BYPASS equ %00000001 ; Host processor controls SCC/ISM
SCCISM equ %00000010 ; ISM port
* equ %00000100 ; unused
RTXCA equ %00001000 ; selects SCC channel A clock source
RTXCB equ %00100000 ; selects SCC channel B clock source
GPOUT1 equ %10000000 ; general purpose output 1
RTXC3MHz equ %00 ; 3.6864MHz
RTXCDPCLK equ %01 ; DPCLK/10
RTXCDPLLOut equ %10 ; Digital phase locked loop output
RTXCGPI equ %11 ; GPIA or GPIB
IOControlReg equ IOBase+$31 ; (RW) I/O Control register
IODurationCount equ %00000001 ; I/O duration count
IODelayCount equ %00010000 ; I/O delay count
TimerDPLLctl equ IOBase+$32 ; (RW) Timer/DPLL control
CONT equ %00000001 ; timer continuous mode
GPOUT0 equ %00000010 ; general purpose output 0
GPIN0 equ %00000100 ; general purpose input 0
GPIN1 equ %00001000 ; general purpose input 1
DPLL1EN equ %00010000 ; DPLL 1 enabled
CRSNS1 equ %00100000 ; carrier present on RXDA
DPLL2EN equ %01000000 ; DPLL 2 enabled
CRSNS2 equ %10000000 ; carrier present on RXDB
InterruptMask equ IOBase+$33 ; (RW) Interrupt Mask Register
DMA1ENI equ %00000010 ; enable DMA channel 1 interrupts
DMA2ENI equ %00000100 ; enable DMA channel 2 interrupts
SCCENI equ %00001000 ; enable SCC interrupts
HSTENI equ %00010000 ; enable interrupts from the host processor
TMRENI equ %00100000 ; enable timer interrupts
InterruptReg equ IOBase+$34 ; (RW) Interrupt Register
DMA1INT equ %00000010 ; DMA channel 1 interrupt
DMA2INT equ %00000100 ; DMA channel 2 interrupt
SCCINT equ %00001000 ; SCC interrupt
HSTINT equ %00010000 ; interrupt from the host processor
TMRINT equ %00100000 ; timer interrupt
HostControl equ IOBase+$35 ; (RW) Host Register
INTHST0 equ %00000100 ; host interrupt 0 active
INTHST1 equ %00001000 ; host interrupt 1 active
MsgCompletedINT equ INTHST0 ; indicates message in MessageCompleted state
NewMsgSentINT equ INTHST1 ; indicates message in NewMessageSent state
; IOP Shared Memory Addresses
RCVMsgBase equ $0200 ; receive message page
RCVMsgMax equ RCVMsgBase+$00 ; Highest receive message number
RCVMsg1State equ RCVMsgBase+$01 ; receive message 1 state
RCVMsg2State equ RCVMsgBase+$02 ; receive message 2 state
RCVMsg3State equ RCVMsgBase+$03 ; receive message 3 state
RCVMsg4State equ RCVMsgBase+$04 ; receive message 4 state
RCVMsg5State equ RCVMsgBase+$05 ; receive message 5 state
RCVMsg6State equ RCVMsgBase+$06 ; receive message 6 state
RCVMsg7State equ RCVMsgBase+$07 ; receive message 7 state
PatchReq equ RCVMsgBase+$1F ; Host wants to patch IOP code
RCVMsg1Data equ RCVMsgBase+$20 ; receive message 1 data
RCVMsg2Data equ RCVMsgBase+$40 ; receive message 2 data
RCVMsg3Data equ RCVMsgBase+$60 ; receive message 3 data
RCVMsg4Data equ RCVMsgBase+$80 ; receive message 4 data
RCVMsg5Data equ RCVMsgBase+$A0 ; receive message 5 data
RCVMsg6Data equ RCVMsgBase+$C0 ; receive message 6 data
RCVMsg7Data equ RCVMsgBase+$E0 ; receive message 7 data
XMTMsgBase equ $0300 ; transmit message page
XMTMsgMax equ XMTMsgBase+$00 ; Highest transmit message number
XMTMsg1State equ XMTMsgBase+$01 ; transmit message 1 state
XMTMsg2State equ XMTMsgBase+$02 ; transmit message 2 state
XMTMsg3State equ XMTMsgBase+$03 ; transmit message 3 state
XMTMsg4State equ XMTMsgBase+$04 ; transmit message 4 state
XMTMsg5State equ XMTMsgBase+$05 ; transmit message 5 state
XMTMsg6State equ XMTMsgBase+$06 ; transmit message 6 state
XMTMsg7State equ XMTMsgBase+$07 ; transmit message 7 state
Alive equ XMTMsgBase+$1F ; IOP is alive flag
XMTMsg1Data equ XMTMsgBase+$20 ; transmit message 1 data
XMTMsg2Data equ XMTMsgBase+$40 ; transmit message 2 data
XMTMsg3Data equ XMTMsgBase+$60 ; transmit message 3 data
XMTMsg4Data equ XMTMsgBase+$80 ; transmit message 4 data
XMTMsg5Data equ XMTMsgBase+$A0 ; transmit message 5 data
XMTMsg6Data equ XMTMsgBase+$C0 ; transmit message 6 data
XMTMsg7Data equ XMTMsgBase+$E0 ; transmit message 7 data
; IOP Message States
Idle equ 0 ; message buffer idle
NewMessageSent equ 1 ; new message arrived
MessageReceived equ 2 ; message being processed
MessageCompleted equ 3 ; request completed
; Block Copy Message Assignments
BCxmtState equ XMTMsg1State
BCxmtData equ XMTMsg1Data
; Block Copy Driver request format
bcIOPtoHOST equ $00
bcHOSTtoIOP equ $01
bcCompare equ $02
bcReqCmd equ BCxmtData+$00 ; (byte) Request Kind
bcReqByteCount equ BCxmtData+$02 ; (word) transfer byte count
bcReqHostAddr equ BCxmtData+$04 ; (long) host RAM address
bcReqIopAddr equ BCxmtData+$08 ; (word) IOP RAM address
bcReqCompRel equ BCxmtData+$0A ; (byte) Compare Relation (output)
; TMPB Time constants (1 tick = 256 clocks @1.9584MHz = 130.71895 uSec)
TMPB1second equ 7650 ; 1 second
TMPB100ms equ TMPB1second/10 ; 100 milliseconds
TMPB10ms equ TMPB1second/100 ; 10 milliseconds
TMPB1ms equ TMPB1second/1000 ; 1 millisecond

1254
Drivers/IOP/IOPKernel.aii Normal file

File diff suppressed because it is too large Load Diff

67
Drivers/IOP/LookupTbl.aii Normal file
View File

@ -0,0 +1,67 @@
;EASE$$$ READ ONLY COPY of file ÒLookupTbl.aiiÓ
; 1.2 CCH 07/08/1989 Added EASE comments to file.
;¥1.1 GGD 06/15/1989 Updated to use equates for the latest rev of the IOP chip,
; re-formated tab stops in source.
; 1.0 CCH 11/ 9/1988 Adding to EASE.
; END EASE MODIFICATION HISTORY
machine m65C02
codechk off
datachk off
longa off
longi off
print nomdir
seg 'PageConsts'
LookupTables proc
export identityPlus
export identityMinus
; Identity Function for performing operations based upon the X / Y registers
;
; eg: a := (x - 5) could be done as LDA identityMinus-5,x
; a := (a .or. x) ORA identityPlus+0,x
; x := y + 5 LDX identityPlus+5,y
; compare a with y CPA identityPlus+0,y
; compare a with (y-10) CPA identityMinus-10,y
identityPlus dc.b $00,$01,$02,$03,$04,$05,$06,$07,$08,$09,$0A,$0B,$0C,$0D,$0E,$0F
dc.b $10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$1A,$1B,$1C,$1D,$1E,$1F
dc.b $20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$2A,$2B,$2C,$2D,$2E,$2F
dc.b $30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$3A,$3B,$3C,$3D,$3E,$3F
dc.b $40,$41,$42,$43,$44,$45,$46,$47,$48,$49,$4A,$4B,$4C,$4D,$4E,$4F
dc.b $50,$51,$52,$53,$54,$55,$56,$57,$58,$59,$5A,$5B,$5C,$5D,$5E,$5F
dc.b $60,$61,$62,$63,$64,$65,$66,$67,$68,$69,$6A,$6B,$6C,$6D,$6E,$6F
dc.b $70,$71,$72,$73,$74,$75,$76,$77,$78,$79,$7A,$7B,$7C,$7D,$7E,$7F
dc.b $80,$81,$82,$83,$84,$85,$86,$87,$88,$89,$8A,$8B,$8C,$8D,$8E,$8F
dc.b $90,$91,$92,$93,$94,$95,$96,$97,$98,$99,$9A,$9B,$9C,$9D,$9E,$9F
dc.b $A0,$A1,$A2,$A3,$A4,$A5,$A6,$A7,$A8,$A9,$AA,$AB,$AC,$AD,$AE,$AF
dc.b $B0,$B1,$B2,$B3,$B4,$B5,$B6,$B7,$B8,$B9,$BA,$BB,$BC,$BD,$BE,$BF
dc.b $C0,$C1,$C2,$C3,$C4,$C5,$C6,$C7,$C8,$C9,$CA,$CB,$CC,$CD,$CE,$CF
dc.b $D0,$D1,$D2,$D3,$D4,$D5,$D6,$D7,$D8,$D9,$DA,$DB,$DC,$DD,$DE,$DF
dc.b $E0,$E1,$E2,$E3,$E4,$E5,$E6,$E7,$E8,$E9,$EA,$EB,$EC,$ED,$EE,$EF
dc.b $F0,$F1,$F2,$F3,$F4,$F5,$F6,$F7,$F8,$F9,$FA,$FB,$FC,$FD,$FE,$FF
identityMinus dc.b $00,$01,$02,$03,$04,$05,$06,$07,$08,$09,$0A,$0B,$0C,$0D,$0E,$0F
dc.b $10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$1A,$1B,$1C,$1D,$1E,$1F
dc.b $20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$2A,$2B,$2C,$2D,$2E,$2F
dc.b $30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$3A,$3B,$3C,$3D,$3E,$3F
dc.b $40,$41,$42,$43,$44,$45,$46,$47,$48,$49,$4A,$4B,$4C,$4D,$4E,$4F
dc.b $50,$51,$52,$53,$54,$55,$56,$57,$58,$59,$5A,$5B,$5C,$5D,$5E,$5F
dc.b $60,$61,$62,$63,$64,$65,$66,$67,$68,$69,$6A,$6B,$6C,$6D,$6E,$6F
dc.b $70,$71,$72,$73,$74,$75,$76,$77,$78,$79,$7A,$7B,$7C,$7D,$7E,$7F
dc.b $80,$81,$82,$83,$84,$85,$86,$87,$88,$89,$8A,$8B,$8C,$8D,$8E,$8F
dc.b $90,$91,$92,$93,$94,$95,$96,$97,$98,$99,$9A,$9B,$9C,$9D,$9E,$9F
dc.b $A0,$A1,$A2,$A3,$A4,$A5,$A6,$A7,$A8,$A9,$AA,$AB,$AC,$AD,$AE,$AF
dc.b $B0,$B1,$B2,$B3,$B4,$B5,$B6,$B7,$B8,$B9,$BA,$BB,$BC,$BD,$BE,$BF
dc.b $C0,$C1,$C2,$C3,$C4,$C5,$C6,$C7,$C8,$C9,$CA,$CB,$CC,$CD,$CE,$CF
dc.b $D0,$D1,$D2,$D3,$D4,$D5,$D6,$D7,$D8,$D9,$DA,$DB,$DC,$DD,$DE,$DF
dc.b $E0,$E1,$E2,$E3,$E4,$E5,$E6,$E7,$E8,$E9,$EA,$EB,$EC,$ED,$EE,$EF
dc.b $F0,$F1,$F2,$F3,$F4,$F5,$F6,$F7,$F8,$F9,$FA,$FB,$FC,$FD,$FE,$FF
endproc
end

15
Drivers/IOP/SCCDefs.aii Normal file
View File

@ -0,0 +1,15 @@
;EASE$$$ READ ONLY COPY of file ÒSCCDefs.aiiÓ
; 1.1 CCH 07/08/1989 Added EASE comments to file.
; 1.0 CCH 11/ 9/1988 Adding to EASE.
; END EASE MODIFICATION HISTORY
SccIOCtlReg equ $4*IODelayCount+$4*IODurationCount
; SCC Addresses
bCtl equ IOBase+$40 ; SCC B command
bData equ IOBase+$41 ; SCC B data
aCtl equ IOBase+$42 ; SCC A command
aData equ IOBase+$43 ; SCC A data

2286
Drivers/IOP/SCCIOP.aii Normal file

File diff suppressed because it is too large Load Diff

69
Drivers/IOP/SCCIOPEqu.aii Normal file
View File

@ -0,0 +1,69 @@
;EASE$$$ READ ONLY COPY of file ÒscciopEqu.aiiÓ
; 1.1 CCH 07/08/1989 Added EASE comments to file.
; 1.0 SGS 02/08/1989 Initial release
; END EASE MODIFICATION HISTORY
*
* File IOPKernEqu.a
*
* Copyright 1988 (c) Apple Computer Inc.
*
* IOP Kernel Equates include file.
*
* Written by Bill O'Connor 3/19/88
*
* Edit History
*
*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
*
* Nil ID pointer
*
Nil Equ $FF
*
* Kernel Messages Constants
*
AllocDvr Equ $01
DeAllocDvr Equ $02
InitDvr Equ $03
ByPass Equ $04
Versn Equ $05
SCCCntl Equ $06
Max_KMsg Equ SCCCntl
*
* Kernel Task Signals
*
RxMsg Equ $01 ; Receive message
*
* Kernel Zero Page locations
*
Dvr_Use Equ Kernel_ZP+$00 ; Base address of Driver use bytes
Dvr_AUse Equ Kernel_ZP+$00 ; Driver A ClientID
Dvr_BUse Equ Dvr_AUse+$01 ; Driver B ClientID
ByPass_Flag Equ Dvr_BUse+$01 ; ByPass mode flag
Close_Vec Equ ByPass_Flag+$01 ; Addresses of close routines for Driver A and B
Init_Vec Equ Close_Vec+$04 ; Addresses of init routines for Driver A and B
Cur_Task Equ Init_Vec+$04 ; Current task that is executing (1 byte)
Dvr_TaskID Equ Cur_Task+$01 ; 2 byte table of DvrA_ID and DvrB_ID
AddressLo Equ Dvr_TaskID+$02 ; ZP memory for indirect parameter passing
AddressHi Equ AddressLo+$01
Ver_Ptr Equ AddressHi+$01 ; Three 2 byte pointers to version info
IOPAlive Equ $031f
*
* TiMer Parameter Block (TMPB) equates
*
MaxTMPBs Equ 4 ; (range 1..15)
TMPBsize Equ 7 ; Bytes per TMPB

View File

@ -0,0 +1,939 @@
;__________________________________________________________________________________________________
;
; File: SCCIOPSysEqu.aii
;
; Contains: IOP System Equates include file
;
; Written by: Bill O'Connor
;
; Copyright: © 1988-1991 by Apple Computer, Inc., all rights reserved.
;
; Change History (most recent first):
;
; <4> 8/26/91 JSM Remove equates of TRUE and FALSE, now done in build script.
; <3> 1/14/90 SWC Fixed a comment in the header that wasn't a comment because the
; semicolon was missing.
; <2> 1/12/90 WTO Change the value of IO_Cntl_Int to improve SCC access times.
; <1.2> 11/2/89 WTO Updated to handle DMA Lap
; <1.1> 7/8/89 CCH Added EASE comments to file.
; <1.0> 2/8/89 SGS Initial release
;__________________________________________________________________________________________________
DriverA Equ 2
DriverB Equ 3
Clock Equ $02 ; 2 MHZ CPU clock
*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
*
* Hardware equates
*
*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
IOBase Equ $f000 ; IOP I/O base address
TmCnt_Lo Equ IOBase+$10 ; Timer low count address
TmCnt_Hi Equ IOBase+$11 ; Timer high count address
TmLatch_Lo Equ IOBase+$12 ; Timer latch low address
TmLatch_Hi Equ IOBase+$13 ; Timer latch high address
DMA1_Cntl Equ IOBase+$20 ; DMA channel 1 control
DMA1_AddrLo Equ IOBase+$21 ; DMA channel 1 low address
DMA1_AddrHi Equ IOBase+$22 ; DMA channel 1 high address
DMA1_CntLo Equ IOBase+$23 ; DMA channel 1 transfer count low
DMA1_CntHi Equ IOBase+$24 ; DMA channel 1 transfer count high
DMA2_Cntl Equ IOBase+$28 ; DMA channel 2 control
DMA2_AddrLo Equ IOBase+$29 ; DMA channel 2 low address
DMA2_AddrHi Equ IOBase+$2a ; DMA channel 2 high address
DMA2_CntLo Equ IOBase+$2b ; DMA channel 2 transfer count low
DMA2_CntHi Equ IOBase+$2c ; DMA channel 2 transfer count high
SCC_Cntl Equ IOBase+$30 ; SCC control register
IO_Cntl Equ IOBase+$31 ; I/O control register
TD_Cntl Equ IOBase+$32 ; Timer/DPLL control register
Int_Mask Equ IOBase+$33 ; Interrupt Mask register
Int_Reg Equ IOBase+$34 ; IOP interrupt register address
Int_Host Equ IOBase+$35 ; Interrupt host register
SCC_BCntl Equ IOBase+$40 ; IOP SCC control register channel B
SCC_BStat Equ IOBase+$40 ; IOP SCC status register channel B
SCC_ACntl Equ IOBase+$41 ; IOP SCC control register channel A
SCC_AStat Equ IOBase+$41 ; IOP SCC status register channel A
SCC_BData Equ IOBase+$42 ; IOP SCC data register channel B
SCC_AData Equ IOBase+$43 ; IOP SCC data register channel A
*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
*
* Software equates
*
*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SCC_Cntl_Init Equ $00 ; Initial value for SCC control register
IO_Cntl_Init Equ $23 ; Initial value for I/O control register
Int0 Equ %00000100 ; Host interrupt 0
Int1 Equ %00001000 ; Host interrupt 1
*
* SCC control register equates
*
ByPass_Bit Equ %00000001 ; ByPass mode bit mask
SCC_Port Equ %00000000 ; Make IOP SCC
ISM_Port Equ %00000010 ; Make IOP ISM
PClk39 Equ %00000000 ; P Clock is 3.9 MHZ
PClk78 Equ %00000100 ; P Clock is 7.8 MHZ
RTXCA_36 Equ %00000000 ; RTXCA source is 3.6864 MHZ
RTXCA_DPClk Equ %00001000 ; RTXCA source is DPCLK/16
RTXCA_DPLL Equ %00010000 ; RTXCA source is DPLL
RTXCA_GPIA Equ %00011000 ; RTXCA source is GPIA
RTXCB_36 Equ %00000000 ; RTXCB source is 3.6864 MHZ
RTXCB_DPClk Equ %00100000 ; RTXCB source is DPCLK/16
RTXCB_DPLL Equ %01000000 ; RTXCB source is DPLL
RTXCB_GPIA Equ %01100000 ; RTXCA source is GPIA
DeBugg Equ %10000000
*
* Interrupt Mask register equates
*
DMA1_Msk Equ %00000010
DMA2_Msk Equ %00000100
SCC_Msk Equ %00001000
Host_Msk Equ %00010000 ;
Timer_Msk Equ %00100000
*
* Timer DPLL control register equates
*
One_Shot Equ %00000001 ;
Continuous Equ %00000001
DPLLA_En Equ %00010000 ; Enable DPLL for channel A
RxCDA_Msk Equ %00100000 ; Receive carrier detected mask
DPLLB_En Equ %01000000 ; Enable DPLL for channel B
RxCDB_Msk Equ %10000000 ; Receive carrier detected mask
StackPage Equ $0100 ; Stack page
pswB Equ %00010000 ; Processor status word decode for BRK
*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
*
* Interrupt priority type equates.
*
*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnKnwn Equ $00
SCC Equ $02 ; SCC interrupt
DMA2 Equ $04 ; DMA2 interrupt
DMA1 Equ $06 ; DMA1 interrupt
TIMER Equ $08 ; Timer interrupt
HOST Equ $0a ; Host interrupt
B_BufEmp Equ $00 ; Channel B transmit buffer empty
B_EXT Equ $02 ; Channel B external status change
B_RX Equ $04 ; Channel B receive character available
B_SpecRx Equ $06 ; Channel B special receive condition
A_BufEmp Equ $08 ; Channle A transmit buffer empty
A_EXT Equ $0a ; Channel A external status change
A_RX Equ $0c ; Channel A receive character available
A_SpecRx Equ $0e ; Channel A special receive condition
*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
*
* SCC register constants
*
*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Wr_reg0 Equ $00
Wr_reg1 Equ $01
Wr_reg2 Equ $02
Wr_reg3 Equ $03
Wr_reg4 Equ $04
Wr_reg5 Equ $05
Wr_reg6 Equ $06
Wr_reg7 Equ $07
Wr_reg8 Equ $08
Wr_reg9 Equ $09
Wr_reg10 Equ $0a
Wr_reg11 Equ $0b
Wr_reg12 Equ $0c
Wr_reg13 Equ $0d
Wr_reg14 Equ $0e
Wr_reg15 Equ $0f
Rd_reg0 Equ $00
Rd_reg1 Equ $01
Rd_reg2 Equ $02
Rd_reg3 Equ $03
Rd_reg8 Equ $08
Rd_reg10 Equ $0a
Rd_reg12 Equ $0c
Rd_reg13 Equ $0d
Rd_reg15 Equ $0f
*
* Software Equates
*
* Register bit masks
*
*
* Write register 0
*
Reset_ExtInt Equ %00010000 ; $10 Reset external status interrupts
RxInt_Enable Equ %00100000 ; $20 Enable interrupt on next recieved char
Reset_TxPend Equ %00101000 ; $28 Reset Tx interrupt pending
Err_Reset Equ %00110000 ; $30 Error reset
Reset_IUS Equ %00111000 ; $38 Reset highest IUS
Reset_TxCRC Equ %10000000 ; $80 Reset Tx CRC latch
Reset_TxUnRun Equ %11000000 ; $C0 Reset Tx underrun/EOM
*
* Write register 1
*
Ext_IntEnable Equ %00000001 ; $01 External interrupt enable
Tx_IntEnable Equ %00000010 ; $02 Tx interrupt enable
Par_SpcCnd Equ %00000100 ; $04 Parity is special condition
Rx_IntDisable Equ %00000000 ; $00 Rx interrupt disable
Int_1RxChar Equ %00001000 ; $08 Interrupt on first received character
Int_RxChar Equ %00010000 ; $10 Interrupt on all received characters
Int_SpcCnd Equ %00011000 ; $18 Interrupt special condition only
DMA_Rx Equ %00100000 ; $20 DMA active for Rx
DMA_Tx Equ %00000000 ; $00 DMA active for Tx
DMA_Req Equ %01000000 ; DMA request funtion = request
DMA_Enable Equ %10000000 ; DMA enable
*
* Write register 3
*
Rx_Enable Equ %00000001 ; $01 Receive enable
Sync_Inhibit Equ %00000010 ; $02 Sync char load inhibit
Addr_Srch Equ %00000100 ; $04 Address search enable
Rx_CRC Equ %00001000 ; $08 Receive CRC enable
Hunt_Enable Equ %00010000 ; $10 Enable Hunt/Sync
Auto_Eanable Equ %00100000 ; $20 Programs func of DCD and CTS pins
Rx_5Bits Equ %00000000 ; $00 Set Rx to 5 bits per char
Rx_7Bits Equ %01000000 ; $40 Set Rx to 7 bits per char
Rx_6Bits Equ %10000000 ; $80 Set Rx to 6 bits per char
Rx_8Bits Equ %11000000 ; $c0 Set Rx to 8 bits per char
*
* Write register 4
*
Par_Enable Equ %00000001 ; $01 Parity Enable
Par_Even Equ %00000010 ; $02 Parity Even
Par_Odd Equ %00000000 ; $00 Parity Odd
Sync_Enable Equ %00000000 ; $00 Sync modes enable
StopBit1 Equ %00000100 ; $04 1 stop bits/char
StopBit15 Equ %00001000 ; $80 1.5 stop bits/char
StopBit2 Equ %00001100 ; $C0 2 stop bits/char
Sync8 Equ %00000000 ; $00 8 bit sync char
Sync16 Equ %00010000 ; $10 16 bit sync char
SDLC_Mode Equ %00100000 ; $20 Set SDLC mode
Ext_Sync Equ %00110000 ; $30 External sync mode
X1Clk Equ %00000000 ; $00 X 1 clock
X16Clk Equ %01000000 ; $40 X 16 clock
X32Clk Equ %10000000 ; $80 X 32 clock
X64Clk Equ %11000000 ; $C0 X 64 clock
*
* Write register 5
*
Tx_CRC Equ %00000001 ; $01 Enable Tx CRCs
Dvr_Enable Equ %00000010 ; $02 Enable output driver
CRC16Poly Equ %00000100 ; $04 CRC 16 polynomial
SDLCPoly Equ %00000000 ; $00 SDLC CRC polynomial
Tx_Enable Equ %00001000 ; $08 Enable Tx
SndBreak Equ %00010000 ; $10 Send break
Tx_5Bits Equ %00000000 ; $00 Set Tx to 5 bits per char
Tx_7Bits Equ %00100000 ; $20 Set Tx to 7 bits per char
Tx_6Bits Equ %01000000 ; $40 Set Tx to 6 bits per char
Tx_8Bits Equ %01100000 ; $60 Set Tx to 8 bits per char
DTRSet Equ %10000000 ; $80 trun DTR on
*
* Write register 7
*
SDLC_Flag Equ $7e ; SDLC flag
*
* Write register 9
*
No_Vec Equ %00000010 ; $02 No vector
MIE Equ %00001000 ; $08 Master Interrupt enable
NoReset Equ %00000000 ; $00 NoReset
ChanB_Reset Equ %01000000 ; $40 Reset channel B
ChanA_Reset Equ %10000000 ; $80 Reset channel A
SCC_Reset Equ %11000000 ; $C0 Force SCC Reset
*
* Write register 10
*
Bit8Sync Equ %00000000 ; $00 8 bit sync
Bit6Sync Equ %00000001 ; $01 6 bit sync
Loop Equ %00000010 ; $02 loop
CRC_UnRun Equ %00000000 ; $00 send CRC on transmit underrun
Abort_UnRun Equ %00000100 ; $04 send Abort on transmit underrun
Flg_Idle Equ %00000000 ; $00 send flag on idle
Mark_Idle Equ %00001000 ; $08 send mark on idle
ActivePoll Equ %00010000 ; $10 go active on poll
NRZ Equ %00000000 ; $00 Set NRZ mode
NRZI Equ %00100000 ; $20 Set NRZI mode
FM1 Equ %01000000 ; $40 Set FM1 mode
FM0 Equ %01100000 ; $60 Set FM0 mode
CRC_Preset Equ %10000000 ; $80 CRC Preset
*
* Write register 11
*
TRxC_XTAL Equ %00000000 ; $00 TRxC = XTAL
TRxC_TxClk Equ %00000001 ; $01 TRxC = Transmit clock
TRxC_BR Equ %00000010 ; $02 TRxC = Baud Rate generator
TRxC_DPLL Equ %00000011 ; $03 TRxC = DPLL
TxClk_RTxC Equ %00000000 ; $00 Transmit clock = ~RTxC pin
TxClk_TRXC Equ %00001000 ; $08 Transmit clock = ~TRxC
TxClk_BR Equ %00010000 ; $10 Transmit clock = Baud rate generator output
TxClk_DPLL Equ %00011000 ; $18 Transmit clock = DPLL
RxClk_RTxC Equ %00000000 ; $00 Receive clock = ~RTxC pin
RxClk_TRxC Equ %00100000 ; $20 Receive clock = ~TRxC pin
RxClk_BR Equ %01000000 ; $40 Receive clock = Br generator
RxClk_DPLL Equ %01100000 ; $60 Receive clock = DPLL output
*
* Write register 12
*
Baud_Lo Equ $06 ; Low value for baud rate generator
*
* Write register 13
*
Baud_Hi Equ $00 ; High value for buad rate generator
*
* Write register 14
*
BR_Enable Equ %00000001 ; $01 Enable baud rate generator
BR_SrcRTxC Equ %00000010 ; $02 BR source is RTxC pin
ReqFunc Equ %00000100 ; $04 Request Function
AutoEcho Equ %00001000 ; $08 Auto enable mode of operation
LoopBck Equ %00010000 ; $10 Local loop back mode
Srch_Mode Equ %00100000 ; $20 Enter search mode
Reset_MCLock Equ %01000000 ; $40 Reset missing clock latch
Disable_DPLL Equ %01100000 ; $60 Disable DPLL
DPLL_BR Equ %10000000 ; $80 DPLL source is Baud Rate generator
DPLL_RTxC Equ %10100000 ; $A0 DPLL source is RTxC pin
DPLL_FM Equ %11000000 ; $C0 Set DPLL to FM mode
DPLL_NRZI Equ %11100000 ; $E0 Set DPLL to NRZI mode
*
* Write register 15
*
ZeroCount_IE Equ %00000010 ; $01 Zero count IE
DCD_IE Equ %00001000 ; $08 DCD IE
SyncHunt_IE Equ %00010000 ; $10 Sync/Hunt IE
CTS_IE Equ %00100000 ; $20 CTS IE
TxUnRun_IE Equ %01000000 ; $40 Tx UnderRun IE
BrkAbort_IE Equ %10000000 ; $80 Break Abort IE
*
* Read register 0
*
Rx_CharAvail Equ %00000001 ; $01 Rx character available
ZeroCount Equ %00000010 ; $02 BR zero count
Tx_BufEmpty Equ %00000100 ; $04 Transmit buffer empty mask
DCD_Msk Equ %00001000 ; $08 DCD
SyncHunt Equ %00010000 ; $10 Sync Hunt
CTS_Msk Equ %00100000 ; $20 CTS
Tx_UnRun Equ %01000000 ; $40 Tx underrun/EOM
BreakAbort Equ %10000000 ; $80 Break abort
*
* Read register 1
*
AllSent Equ %00000001 ; $01 All sent
Par_Err Equ %00010000 ; $10 Parity Error
Rx_OvRun Equ %00100000 ; $20 Receive buffer overrun
CRC_Err Equ %01000000 ; $40 CRC error
End_Frame Equ %10000000 ; $80 End of frame
*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
*
* Diagnostic and Error Equates
*
*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
NonMask Equ $00
*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
*
* Message Passing Equates
*
*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TxMsgCnt Equ $0300 ; Address of Transmit max message count
RxMsgCnt Equ $0200 ; Address of Receive max message count
TxMsgPage Equ $0300 ; Transmit message page
RxMsgPage Equ $0200 ; Receive message page
TxMsgState Equ TxMsgPage ; Beginning address of state variables - 1
RxMsgState Equ RXMsgPage ; Beginning address of state variables -1
MaxTxMsg Equ $07 ; Maximum number of Transmit messages
MaxRxMsg Equ $07 ; Maximum number of receive messages
Idle Equ $00 ; Message Idle
NewMsgSent Equ $01 ; New message sent
MsgRcv Equ $02 ; Message received
MsgCmplt Equ $03 ; Message complete
*
* Kernel Error Messages
*
NoErr Equ 0
Error Equ -1 ; Didn' like sumthin (Unable to write packet etc.)
UnKnwnMsg Equ -2 ; Received an unsupported message
DvrInUse Equ -3 ; Driver is already in use
InByPass Equ -4 ; IOP is in bypass mode
NotAlloc Equ -5 ; Driver has not been allocated
BadID Equ -6 ; The wrong ID was used to turn off ByPass
*
* ALap Error Messages
*
ENQFailed Equ -1 ; ACK was received during ENQ attempt
DvrA Equ $00
DvrB Equ $01
Kern Equ $02
MaxDvr Equ DvrB
*
* Kernel Equates
*
Krn_CmdBase Equ $0000 ; Base address of kernel command table
KCmd_Table_size Equ $28 ; Size of Kernel command table in bytes
InstRxMsg Equ $00 ; Install receive message signaller
RemvRxMsg Equ $00 ; Remove receive message signaller
InstTxCmpl Equ $01 ; Install transmit completion routine
RemvTxCmpl Equ $01 ; Remove transmit completion routine
InstISR Equ $02 ; Install an interrupt service routine handler
RemvISR Equ $02 ; Remove an interrupt service routine
SCCISR Equ $03 ; Install SCC interrupt handler
RemvSCCISR Equ $03 ; Remove an interrupt service routine
InstTask Equ $04 ; Install a task into event loop
KillTask Equ $04 ; Deinstall a task from the loop
RelTask Equ $05 ; Release a task for one cycle
WaitEvent Equ $06 ; Wait for an event
SignalTask Equ $07 ; Signal a task that an event has occurred
ResetEvent Equ $08 ; Reset the event flag after the event is handled
ResetChan Equ $09 ; Reset SCC channel
GetTMPB Equ $0a ; Get a timer parameter block index
InstTmTask Equ $0b ; Install a timer task
RegVer Equ $0c ; Register version info
*
* Kernel Signals
*
InitFin Equ $02 ; Signal to Kernel that driver has initialized
*
* Task ID's
*
TCBSize Equ $05
Kern_ID Equ $00
DvrA_ID Equ TCBSize
DvrB_ID Equ (2*TCBSize)
*
* TMPB Time constants (1 tick = 256 clocks @1.9584MHz = 130.71895 uSec)
*
TMPB1second Equ 7650 ; 1 second
TMPB100ms Equ TMPB1second/10 ; 100 milliseconds
TMPB10ms Equ TMPB1second/100 ; 10 milliseconds
TMPB1ms Equ TMPB1second/1000 ; 1 millisecond
*
* Task Stack Pointers
*
Kern_Sp Equ $1FF
DvrA_Sp Equ $1A9 ; Driver A stack bottom
DvrB_Sp Equ $154 ; Driver B stack bottom
*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
*
* IOP Zero Page Memory Map
*
* The IOP has three things going on:
* i. kernel/operating system/host interface
* ii. driver for channel A
* iii. driver for channel B
*
* The Zero page will be divided equally among the three.
* This gives 85 bytes per process.
*
* ____________________
* | Driver B Zp | $AA-$FF
* ___________________
* | Driver A Zp | $55-$A9
* ___________________
* | Kernel Zp | $00-$54
* ___________________
*
* Zero Page Variables
*
*
* Memory Map
*
* ____________________
* | Driver B | $56AA-$7fef
* ___________________
* | Driver A | $2d55-$56a9
* ___________________
* | Kernel | $400-$2d54
* ___________________
*
*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Kernel_ZP Equ KCmd_Table_size+1
DvrA_Zp Equ $55
DvrB_Zp Equ $aa
Kern_Base Equ $400
DvrA_Base Equ $2d55
DvrB_Base Equ $56aa
DvrA_Top Equ DvrB_Base-1
DvrB_Top Equ $7fef-1
DvrA_Close Equ DvrA_Base+3
DvrB_Close Equ DvrB_Base+3
*
* Kernel Macros
*
* The 65C02 does not has a JSR (Address) instruction.
* To emulate this instruction your code should contain a table
* like this. Each procedure using these macros must then import
* this table address.
*
* Cmd_JmpTable Jmp (Krn_CmdBase+(RemvRxMsg*2))
* Jmp (Krn_CmdBase+(RemvTxCmpl*2))
* Jmp (Krn_CmdBase+(RemvISR*2))
* Jmp (Krn_CmdBase+(RemvSCCISR*2))
* Jmp (Krn_CmdBase+(InstTask*2))
* Jmp (Krn_CmdBase+(RelTask*2))
* Jmp (Krn_CmdBase+(WaitEvent*2))
* Jmp (Krn_CmdBase+(SignalTask*2))
* Jmp (Krn_CmdBase+(ResetEvent*2))
* Jmp (Krn_CmdBase+(ResetChan*2))
* Jmp (Krn_CmdBase+(GetTMPB*2))
* Jmp (Krn_CmdBase+(InstTmTask*2))
* Jmp (Krn_CmdBase+(RegVer*2))
*
*
* Install Receive message signaller macro
*
* Arguments
*
* &MsgNum - number of the message box that uses this handler
* &HndleAddr - the handler address
*
MACRO
_Inst_RxMsgSgn &MsgNum, &SgnAddr
Ldy #>&SgnAddr ; Push the handler address
Lda #<&SgnAddr
Ldx #&MsgNum*2 ; Put the message number in register A
Sec ; Set carry to message install signaller
Jsr Cmd_JmpTable+(InstRxMsg*3)
ENDM
*
* Remove Receive message signaller macro
*
* Arguments
*
* &MsgNum - number of the message box that uses this handler
*
MACRO
_Remv_RxMsgSgn &MsgNum
Ldx #&MsgNum*2 ; Put the message number in register A
Clc ; Clear carry to do remove message signaller
Jsr Cmd_JmpTable+(InstRxMsg*3)
ENDM
*
* Install Transmit completion signaller macro
*
* Arguments
*
* &MsgNum - number of the message box that uses this handler
* &HndleAddr - the handler address
*
MACRO
_Inst_TxCmplSgn &MsgNum, &SgnAddr
Ldy #>&SgnAddr ; Push the handler address
Lda #<&SgnAddr
Ldx #&MsgNum*2 ; Load the msg number in register A
Sec ; Set carry to install message signaller
Jsr Cmd_JmpTable+(InstTxCmpl*3) ; Do the indirect jump
ENDM
*
* Remove Transmit completion signaller macro
*
* Arguments
*
* &MsgNum - number of the message box that uses this handler
*
MACRO
_Remv_TxCmplSgn &MsgNum
Ldx #&MsgNum*2 ; Load the msg number in register A
Clc ; Clear carry to do remove signaller
Jsr Cmd_JmpTable+(InstTxCmpl*3) ; Do the indirect jump
ENDM
*
* Assign an interrupt routine
*
* Arguments
*
* &Type - The type of interrupt
* &HndlAddr - The interrupt handler address
*
MACRO
_Inst_ISR &Type, &HndlAddr
Ldy #>&HndlAddr ; Push the handler address
Lda #<&HndlAddr
Ldx #&Type
Sec ; Set carry for install ISR
Jsr Cmd_JmpTable+(InstISR*3) ; Do the indirect jump
ENDM
*
* Remove an interrupt service routine routine
*
* Arguments
*
* &Type - The type of interrupt
*
MACRO
_Remv_ISR &Type
Ldx #&Type
Clc ; Clear carry for remove ISR
Jsr Cmd_JmpTable+(RemvISR*3) ; Do the indirect jump
ENDM
*
* Assign an SCC interrupt routine
*
* Arguments
*
* &Type - The type of interrupt
* &HndlAddr - The interrupt handler address
*
MACRO
_Inst_SCC_ISR &Type, &HndlAddr
Ldy #>&HndlAddr ; Push the handler address
Lda #<&HndlAddr
Ldx #&Type
Sec ; Set carry for install SCC ISR
Jsr Cmd_JmpTable+(SCCISR*3) ; Do the indirect jump
ENDM
*
* Remove an SCC interrupt routine
*
* Arguments
*
* &Type - The type of interrupt
*
MACRO
_Remv_SCC_ISR &Type
Ldx #&Type
Clc ; Clear carry for remove SCC ISR
Jsr Cmd_JmpTable+(RemvSCCISR*3) ; Do the indirect jump
ENDM
*
* Install a Task
*
* Arguments
*
* &ID - the task ID
* &TaskAddr - the task address
*
MACRO
_Inst_Task &ID, &TaskAddr
Ldy #>&TaskAddr ; Push the handler address
Lda #<&TaskAddr
Ldx #&ID
Sec ; Set the Carry install task
Jsr Cmd_JmpTable+(InstTask*3) ; Do the indirect jump
ENDM
*
* Kill a task
*
* Argument
*
* &ID - the task ID
*
MACRO
_Kill_Task &ID
Ldx #&ID
Clc ; Clear Carry for kill task
Jsr Cmd_JmpTable+(KillTask*3) ; Do the indirect jump
ENDM
*
* Wait for an event to occur
*
* Arguments
*
* &Type - the event type or types we are waiting for
*
MACRO
_Wait_Event &Type
Lda #&Type
Jsr Cmd_JmpTable+(WaitEvent*3) ; Do the indirect jump
ENDM
*
* Signal Task that an event has occurred
*
* Arguments
*
* &ID - ID of task you wish to signal
* &Sgn - mask you wish placed in tasks tEvent
*
MACRO
_Signal_Task &ID, &Sgn
Ldx #&ID
Lda #&Sgn
Jsr Cmd_JmpTable+(SignalTask*3)
ENDM
*
* Reset the event after it has occurred.
*
* Arguments
*
* &Type - the event type or types we are reseting.
* (Actually the complement of the Flags we use for _Wait_Event)
*
MACRO
_Reset_Event &Type
Lda #Å&Type
Jsr Cmd_JmpTable+(ResetEvent*3) ; Do the indirect jump
ENDM
*
* Relase this task for one Tasking cycle
*
* Arguments
*
*
MACRO
_Release_Task
Jsr Cmd_JmpTable+(RelTask*3) ; Do the indirect jump
ENDM
*
* Reset Channel
*
* Arguments
*
* &Chan - channel A or channel B
*
MACRO
_Reset_Chan &Chan
If &Chan='A' then
Sec
ElseIf &Chan='B' then
Clc
Else
AERROR 'Must specify A or B channel
EndIf
Jsr Cmd_JmpTable+(ResetChan*3)
ENDM
*
* _Get_TMPB - get a timer parameter block.
*
* Arguments
*
* none
*
* Returns parameter block index in register Y
*
MACRO
_Get_TMPB
Clc
Jsr Cmd_JmpTable+(GetTMPB*3)
ENDM
*
* _Free_TMPB - free a timer parameter block.
*
* Arguments
*
* If &Param is equal to the null string then it is assumed
* the index is already in register Y. Else register Y is
* loaded with &Param.
*
MACRO
_Free_TMPB &Param
Sec
IF &PARAM='' THEN
Jsr Cmd_JmpTable+(GetTMPB*3)
ELSE
Ldy &Param
Jsr Cmd_JmpTable+(GetTMPB*3)
ENDIF
ENDM
*
* _Inst_TmTask - install a timer task.
*
* Arguments
*
* If &Param is equal to the null string then it is assumed
* the index is already in register Y. Else register Y is
* loaded with &Param.
*
* &Addr - address of the time and completion routine paramaters
*
MACRO
_Inst_TmTask &Addr
Clc
Lda #<&Addr
Ldx #>&Addr
Jsr Cmd_JmpTable+(InstTmTask*3)
ENDM
*
* _Cancel_TmTask - cancel a timer task.
*
* Arguments
*
* If &Param is equal to the null string then it is assumed
* the index is already in register Y. Else register Y is
* loaded with &Param.
*
MACRO
_Cancel_TmTask &Param
Sec
IF &PARAM='' THEN
Jsr Cmd_JmpTable+(InstTmTask*3)
ELSE
Ldy &Param
Jsr Cmd_JmpTable+(InstTmTask*3)
ENDIF
ENDM
*
* Register Version info
*
* Arguments
*
* &ID - the Driver ID
* &InfoAddr - the task address
*
MACRO
_Reg_Ver &ID, &InfoAddr
Ldy #>&InfoAddr ; Push the handler address
Ldx #<&InfoAddr
Lda #&ID
Jsr Cmd_JmpTable+(RegVer*3) ; Do the indirect jump
ENDM

407
Drivers/IOP/SWIMDefs.aii Normal file
View File

@ -0,0 +1,407 @@
;
; File: SWIMDefs.aii
;
; Contains: Equates for the IOP based SWIM driver.
;
; Written by: Gary G. Davidian
;
; Copyright: © 1987-1990 by Apple Computer, Inc., all rights reserved.
;
; Change History (most recent first):
;
; <2> 1/2/90 GGD NEEDED FOR ZONE-5: Changes needed to support the Raw Track I/O
; command.
; <1.4> 12/11/89 GGD NEEDED FOR ZONE-5: Added record formats for new DiskDuplicator
; support requests. Added record formats for new Get RAW Data
; support requests.
; <1.3> 7/8/89 CCH Added EASE comments to file.
; <¥1.2> 6/15/89 GGD Updated to use equates for the latest rev of the IOP chip,
; re-formated tab stops in source.
; <1.1> 2/5/89 GGD Updated for latest version of SWIMDrvr.
; <1.0> 11/9/88 CCH Adding to EASE.
;
; To Do:
;
SwimIOCtlReg equ $3*IODelayCount+$2*IODurationCount
; SWIM Addresses
wData equ IOBase+$40 ; Write a data byte
wMark equ IOBase+$41 ; Write a mark byte
wCRC equ IOBase+$42 ; Write a 2-byte CRC (1 access does both)
wIWMConfig equ wCRC ; Set IWM configuration (when StartAction=0)
wParams equ IOBase+$43 ; Set the 16 parameter registers
wPhase equ IOBase+$44 ; Set phase lines states and directions
wSetup equ IOBase+$45 ; Set the current configuration
wZeroes equ IOBase+$46 ; Mode reg: 1's clr bits, 0's=don't care
wOnes equ IOBase+$47 ; Mode reg: 1's set bits, 0's=don't care
rData equ IOBase+$48 ; Read a data byte
rCorrection equ rData ; Read the correction factor
rMark equ IOBase+$49 ; Read a mark byte
rError equ IOBase+$4A ; Error register
rParams equ IOBase+$4B ; Parameters (16 bytes deep at this addr)
rPhase equ IOBase+$4C ; Phase lines states and directions
rSetup equ IOBase+$4D ; Read the current configuration
rStatus equ IOBase+$4E ; Status (returns current mode reg value)
rHandshake equ IOBase+$4F ; Handshake register
; SWIM register bit masks
; wIWMConfig
IWMtimerOverride equ %10000000 ; Override IWM timer
IWMtimer2X equ %01000000 ; IWM timer takes twice as long to timeout
IWMlatchAsync equ %00100000 ; latch data bit 7 in async mode
; rError
UnderrunFIFO equ %00000001 ; Underrun FIFO
MarkInData equ %00000010 ; Mark In Data
OverrunFIFO equ %00000100 ; Overrun FIFO
CorrectionError equ %00001000 ; Correction Error
TransTooNarrow equ %00010000 ; Transition Too Narrow
TransTooWide equ %00100000 ; Transition Too Wide
TransUnresolved equ %01000000 ; Unresolved Transition
;not used equ %10000000 ; not used
; rPhase / wPhase
ph0 equ %00000001 ; phase line 0 output data
ph1 equ %00000010 ; phase line 1 output data
ph2 equ %00000100 ; phase line 2 output data
ph3 equ %00001000 ; phase line 3 output data
ph0en equ %00010000 ; phase line 0 output enable
ph1en equ %00100000 ; phase line 1 output enable
ph2en equ %01000000 ; phase line 2 output enable
ph3en equ %10000000 ; phase line 3 output enable
ca0 equ ph0
ca1 equ ph1
ca2 equ ph2
lstrb equ ph3
ph0123en equ ph0en+ph1en+ph2en+ph3en
enPh0L equ %00010000
enPh0H equ %00010001
enPh1L equ %00100000
enPh1H equ %00100010
enPh2L equ %01000000
enPh2H equ %01000100
enPh3L equ %10000000
enPh3H equ %10001000
; rSetup / wSetup
HeadSelEnable equ %00000001 ; enable Q3/Head Select to be an output
Select35 equ %00000010 ; 3.5 selected
GCRMode equ %00000100 ; select GCR mode
ClockDiv2 equ %00001000 ; internal clock frequency / 2
EnableECM equ %00010000 ; enables the Error Correction Machine
IBMDrive equ %00100000 ; IBM type drive
TransSpaceDis equ %01000000 ; Trans-Space logic disabled
MotorTimeOut equ %10000000 ; enable 1/2 second motor timeout
; rHandshake
MarkInFIFO equ %00000001 ; next byte read from FIFO is a Mark
CRCNotZero equ %00000010 ; CRC register is not Zero
DriveRdData equ %00000100 ; state of the RdData signal from the drive
DriveSense equ %00001000 ; state of the Sense signal from the drive
DriveEnabled equ %00010000 ; a drive is explicitly enabled, or timing out
rErrorValid equ %00100000 ; error register is non-zero
Dat2Bytes equ %01000000 ; 2 bytes valid / available in the FIFO
Dat1Byte equ %10000000 ; 1 byte valid / available in the FIFO
; wZeros / wOnes / rStatus
ClearFIFO equ %00000001 ; Clear the FIFO
Drive1Enabled equ %00000010 ; select Drive 1
Drive2Enabled equ %00000100 ; select Drive 2
StartAction equ %00001000 ; start Read / Write operation
WriteMode equ %00010000 ; set the chip into Write mode
HeadSelect equ %00100000 ; select head (side) 0 or 1
;reserved equ %01000000 ; reserved, reads back as a one
MotorOn equ %10000000 ; Causes selected drive to be enabled
; disk drive pulse addresses / data
wDirNextAdr equ 0*HeadSelect+0*ca2+0*ca1+0*ca0
wDirPrevAdr equ 0*HeadSelect+1*ca2+0*ca1+0*ca0
wStepOnAdr equ 0*HeadSelect+0*ca2+0*ca1+1*ca0
wStepOffAdr equ 0*HeadSelect+1*ca2+0*ca1+1*ca0
wMotorOnAdr equ 0*HeadSelect+0*ca2+1*ca1+0*ca0
wMotorOffAdr equ 0*HeadSelect+1*ca2+1*ca1+0*ca0
wEjectOffAdr equ 0*HeadSelect+0*ca2+1*ca1+1*ca0
wEjectOnAdr equ 0*HeadSelect+1*ca2+1*ca1+1*ca0
; equ 1*HeadSelect+0*ca2+0*ca1+0*ca0 ; undefined
; equ 1*HeadSelect+1*ca2+0*ca1+0*ca0 ; undefined
wDiskInPlAdr equ 1*HeadSelect+0*ca2+0*ca1+0*ca0 ; don't know for sure if you can
wNoDiskInPlAdr equ 1*HeadSelect+1*ca2+0*ca1+0*ca0 ; really write to these addresses
wMFMModeOnAdr equ 1*HeadSelect+0*ca2+0*ca1+1*ca0
wGCRModeOffAdr equ wMFMModeOnAdr
wMFMModeOffAdr equ 1*HeadSelect+1*ca2+0*ca1+1*ca0
wGCRModeOnAdr equ wMFMModeOffAdr
; equ 1*HeadSelect+0*ca2+1*ca1+0*ca0 ; undefined
; equ 1*HeadSelect+1*ca2+1*ca1+0*ca0 ; undefined
; equ 1*HeadSelect+0*ca2+1*ca1+1*ca0 ; undefined
; equ 1*HeadSelect+1*ca2+1*ca1+1*ca0 ; undefined
; disk drive sense addresses
rDirPrevAdr equ 0*HeadSelect+0*ca2+0*ca1+0*ca0
rStepOffAdr equ 0*HeadSelect+0*ca2+0*ca1+1*ca0
rMotorOffAdr equ 0*HeadSelect+0*ca2+1*ca1+0*ca0
rEjectOnAdr equ 0*HeadSelect+0*ca2+1*ca1+1*ca0
rRdData0Adr equ 0*HeadSelect+1*ca2+0*ca1+0*ca0
rMFMDriveAdr equ 0*HeadSelect+1*ca2+0*ca1+1*ca0
rDoubleSidedAdr equ 0*HeadSelect+1*ca2+1*ca1+0*ca0
rNoDriveAdr equ 0*HeadSelect+1*ca2+1*ca1+1*ca0
rNoDiskInPlAdr equ 1*HeadSelect+0*ca2+0*ca1+0*ca0
rNoWrProtectAdr equ 1*HeadSelect+0*ca2+0*ca1+1*ca0
rNotTrack0Adr equ 1*HeadSelect+0*ca2+1*ca1+0*ca0
rNoTachPulseAdr equ 1*HeadSelect+0*ca2+1*ca1+1*ca0
rIndexPulseAdr equ rNoTachPulseAdr
rRdData1Adr equ 1*HeadSelect+1*ca2+0*ca1+0*ca0
rMFMModeOnAdr equ 1*HeadSelect+1*ca2+0*ca1+1*ca0
rGCRModeOffAdr equ rMFMModeOnAdr
rNotReadyAdr equ 1*HeadSelect+1*ca2+1*ca1+0*ca0
rNotRevisedAdr equ 1*HeadSelect+1*ca2+1*ca1+1*ca0
r1MegMediaAdr equ rNotRevisedAdr
; IWM Addresses
ph0L equ IOBase+$40 ; phase 0 low
ph0H equ IOBase+$41 ; phase 0 high
ph1L equ IOBase+$42 ; phase 1 low
ph1H equ IOBase+$43 ; phase 1 high
ph2L equ IOBase+$44 ; phase 2 low
ph2H equ IOBase+$45 ; phase 2 high
ph3L equ IOBase+$46 ; phase 3 low
ph3H equ IOBase+$47 ; phase 3 high
mtrOff equ IOBase+$48 ; motor off
mtrOn equ IOBase+$49 ; motor on
intDrive equ IOBase+$4A ; enable internal drive
extDrive equ IOBase+$4B ; enable external drive
q6L equ IOBase+$4C ; q 6 low
q6H equ IOBase+$4D ; q 6 high
q7L equ IOBase+$4E ; q 7 low
q7H equ IOBase+$4F ; q 7 high
ca0L equ ph0L
ca0H equ ph0H
ca1L equ ph1L
ca1H equ ph1H
ca2L equ ph2L
ca2H equ ph2H
lstrbL equ ph3L
lstrbH equ ph3H
IWMmode equ $17 ; mode register value
; SWIM IWM Addresses mapping
; wData ph0L
; wMark ph0H
; wCRC ph1L
; wParams ph1H
; wPhase ph2L
; wSetup ph2H
; wZeroes ph3L
; wOnes ph3H
; rData mtrOff
; rCorrection mtrOff
; rMark mtrOn
; rError intDrive
; rParams extDrive
; rPhase q6L
; rSetup q6H
; rStatus q7L
; rHandshake q7H
; Message Assignments
RCVState equ RCVMsg2State
RCVData equ RCVMsg2Data
XMTState equ XMTMsg2State
XMTData equ XMTMsg2Data
; SWIM Driver IOP -> HOST Request encodings
DiskInsertedXmtReq equ $01 ; Disk Inserted event
DiskEjectedXmtReq equ $02 ; Disk Ejected event
DiskStatusChangedXmtReq equ $03 ; Disk Status Changed
XmtKind equ XMTData+$00 ; (byte) Request Kind
XmtDriveNumber equ XMTData+$01 ; (byte) Drive Number
XmtErrorCode equ XMTData+$02 ; (word) Error Code
XmtDriveStatus equ XMTData+$04 ; (?? bytes) Drive Status Information
; SWIM Driver HOST -> IOP Request encodings
InitializeReq equ $01 ; Initialize Driver
ShutDownReq equ $02 ; Shut down driver
StartPollingReq equ $03 ; Start Polling Drives
StopPollingReq equ $04 ; Stop Polling Drives
SetHFSTagAddrReq equ $05 ; Set HFS tag host address
DriveStatusReq equ $06 ; Drive Status
EjectReq equ $07 ; Eject
FormatReq equ $08 ; Format disk
FormatVerifyReq equ $09 ; Verify disk formatting
WriteReq equ $0A ; Write blocks to disk
ReadReq equ $0B ; Read blocks from disk
ReadVerifyReq equ $0C ; Read and compare blocks from disk
CacheControlReq equ $0D ; track cache control
TagBufferControlReq equ $0E ; tag buffer control
GetIconReq equ $0F ; get media or drive Icon
DiskDupInfoReq equ $10 ; get Disk Duplicator information
GetRawDataReq equ $11 ; Read RAW disk data (for copy protection)
ReqKind equ RCVData+$00 ; (byte) Request Kind
ReqDriveNumber equ RCVData+$01 ; (byte) Drive Number
ReqControlKind equ RCVData+$01 ; (byte) DriverControl sub-command
ReqErrorCode equ RCVData+$02 ; (word) Error Code
ReqFormatKind equ RCVData+$04 ; (word) Format Kind
ReqAdditionalParams equ RCVData+$04 ; (long) control / status csParam
ReqDriveStatus equ RCVData+$04 ; (?? bytes) Drive Status Information
ReqDriveKinds equ RCVData+$04 ; (28 bytes) Drive kinds (returned by init)
ReqRAMAddress equ RCVData+$04 ; (long) Main CPU RAM Address
ReqDupVersion equ RCVData+$04 ; (word) Disk Duplicator Version
ReqHdrFmtKind equ RCVData+$06 ; (byte) Format byte from the last sector hdr (0=use default)
ReqFmtInterleave equ RCVData+$07 ; (byte) Format Interleave (0=use default)
ReqBlockNumber equ RCVData+$08 ; (long) Disk Starting Block Number
ReqFmtDataAddress equ RCVData+$08 ; (long) CPU RAM Address of format sector data
ReqBlockCount equ RCVData+$0C ; (long) Transfer Block Count
ReqFmtTagAddress equ RCVData+$0C ; (long) CPU RAM Address of format tag data
ReqMfsTagData equ RCVData+$10 ; (12 bytes) MFS Disk Tag Information
ReqRawClockAddress equ RCVData+$04 ; (long) Buffer for packed MFM clock bits
ReqRawDataAddress equ RCVData+$08 ; (long) Buffer for RAW data bytes
ReqRawByteCount equ RCVData+$0C ; (long) Number of RAW bytes to read
ReqRawSearchMode equ RCVData+$10 ; (word) RAW Read search mode
ReqRawCylinder equ RCVData+$12 ; (word) RAW Read cylinder number
ReqRawHead equ RCVData+$14 ; (byte) RAW Read head number
ReqRawSector equ RCVData+$15 ; (byte) RAW Read sector number
; Search modes for RAW read requests
SearchImmediate equ 0 ; don't search, read immediatly
SearchForAddress equ 1 ; find address field, read raw after address
SearchForData equ 2 ; find data field, read raw after data
SearchForIndex equ 3 ; find index, read raw after index
; Status Message field offsets
StatTrackH equ $04 ; High byte of Current Track Location
StatTrackL equ $05 ; Low byte of Current Track Location
StatWrProtected equ $06 ; bit7=1=write protected
StatDiskInPlace equ $07 ; 0 = no disk place, 1 or 2 = disk in place
StatInstalled equ $08 ; 0 = don't know, 1=installed, $FF=not installed
StatSides equ $09 ; bit7=0=single sided, bit7=1=double sided
; drive queue element is not returned from IOP
StatTwoSidedFmt equ $0A ; $FF=2-sided disk, $00=1-sided disk
StatNewIntface equ $0B ; $00=old drive interface (400K), $FF=new (800K and later)
StatDiskErrorsH equ $0C ; High byte of disk error count
StatDiskErrorsL equ $0D ; Low byte of disk error count
StatDriveInfoB3 equ $0E ; start of data for drive info control call
StatDriveInfoB2 equ $0F ; high 2 bytes unused for now
StatDriveAttr equ $10 ; disk drive attributes
StatDriveType equ $11 ; type of disk drive
; ; start of data for extended drive status control call
StatMfmDrive equ $12 ; $FF=SuperDrive, otherwise zero
StatMfmDisk equ $13 ; $FF=MFM disk in drive, otherwise zero
StatMfmFormat equ $14 ; $FF=1440K, $00=720K
StatDiskCtlr equ $15 ; $FF=SWIM, $00=IWM
StatCurrentFmtH equ $16 ; High byte of bit mask of current format
StatCurrentFmtL equ $17 ; Low byte of bit mask of current format
StatFmtAllowedH equ $18 ; High byte bit mask of allowable formats
StatFmtAllowedL equ $19 ; Low byte bit mask of allowable formats
StatDiskSizeB3 equ $1A ; Byte 3 of size of current drive, if fixed media drive. (HD-20)
StatDiskSizeB2 equ $1B ; Byte 2 of size of current drive, if fixed media drive. (HD-20)
StatDiskSizeB1 equ $1C ; Byte 1 of size of current drive, if fixed media drive. (HD-20)
StatDiskSizeB0 equ $1D ; Byte 0 of size of current drive, if fixed media drive. (HD-20)
StatIconFlags equ $1E ; bit 0 - call for Media Icon, bit 1 - call for Drive Icon
StatSpare equ $1F ; (1 spare byte left)
; Drive number assignments
intDriveNumber equ 1 ; drive number 1 is internal drive
extDriveNumber equ 2 ; drive number 2 is external drive
FirstHD20DriveNumber equ 5 ; first HD20 is drive 5
maxHD20Cnt equ 4 ; 4 HD20's allowed
NumberOfDrives equ FirstHD20DriveNumber+maxHD20Cnt
MaxDriveNumber equ NumberOfDrives-1
; Disk Drive Kinds
noDriveKind equ 0 ; no drive connected
unknownDriveKind equ 1 ; unspecified drive kind
SSGCRDriveKind equ 2 ; single sided 400K GCR disk drive
DSGCRDriveKind equ 3 ; double sided 400K/800K GCR disk drive
DSMFMGCRDriveKind equ 4 ; double sided 400K/800K GCR, 720K, 1440K MFM disk drive
HD20DriveKind equ 7 ; HD20 20MB hard disk
; Disk Media Kinds
NoMediaKind equ 0 ; no disk media in drive
unknownMediaKind equ 1 ; unknown disk media
HD20MediaKind equ 2 ; HD20 20MB hard disk media
LoDenMediaKind equ 3 ; 400K, 800K, 720K Media (Low density)
HiDenMediaKind equ 4 ; 1440K Media (High density)
; Disk Format Kinds
uncheckedFormat equ 0 ; disk format has not been checked
unknownFormat equ 1 ; disk format could not be determined
HD20Format equ 2 ; HD20 20MB hard disk
GCR400Kformat equ 3 ; single sided 400K GCR disk
GCR800Kformat equ 4 ; double sided 800K GCR disk
MFM720Kformat equ 5 ; double sided 720K MFM disk
MFM1440Kformat equ 6 ; double sided 1440K MFM disk HD media
GCRonHDformat equ 7 ; 400K or 800K GCR format on HD media (user error)
; Error codes
noErr equ 0 ; no Error (success)
openErr equ -23 ; Initialize when already initialized
wPrErr equ -44 ; diskette is write protected
paramErr equ -50 ; Error in parameter list
nsDrvErr equ -56 ; no such drive (tried to mount a bad drive num)
noDriveErr equ -64 ; drive not installed
offLinErr equ -65 ; r/w requested for an off-line drive
noNybErr equ -66 ; couldn't find 5 nybbles in 200 tries
noAdrMkErr equ -67 ; couldn't find valid addr mark
dataVerErr equ -68 ; read verify compare failed
badCksmErr equ -69 ; addr mark checksum didn't check
badBtSlpErr equ -70 ; bad addr mark bit slip nibbles
noDtaMkErr equ -71 ; couldn't find a data mark header
badDCksum equ -72 ; bad data mark checksum
badDBtSlp equ -73 ; bad data mark bit slip nibbles
wrUnderrun equ -74 ; write underrun occurred
cantStepErr equ -75 ; step handshake failed
tk0BadErr equ -76 ; track 0 detect doesn't change
initIWMErr equ -77 ; Can't initialize disk controller chip
spdAdjErr equ -79 ; unable to correctly adjust disk speed
seekErr equ -80 ; track number wrong on address mark
sectNFErr equ -81 ; sector number never found on a track
fmt1Err equ -82 ; can't find sector 0 after track format
fmt2Err equ -83 ; can't get enough sync
noIndexErr equ fmt2Err ; index pulse not found during MFM format
verErr equ -84 ; track failed to verify
gcrOnMFMErr equ -400 ; gcr format on high density media error

7718
Drivers/IOP/SWIMDriver.aii Normal file

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More