mirror of
https://github.com/elliotnunn/supermario.git
synced 2024-11-22 04:31:30 +00:00
417 lines
18 KiB
Plaintext
417 lines
18 KiB
Plaintext
;
|
||
; File: GestaltExtensions.a
|
||
;
|
||
; Contains: Linked patches for Gestalt
|
||
;
|
||
; Written by: Jeff Miller
|
||
;
|
||
; Copyright: © 1990-1993 by Apple Computer, Inc., all rights reserved.
|
||
;
|
||
; Change History (most recent first):
|
||
;
|
||
; <SM10> 6/7/93 wc (Really BT)Fix a stupid bug of mine.
|
||
; <SM9> 6/6/93 BT Add gestaltRISCV0ResMgrPatches to 'bugy' bits if rom is built
|
||
; with this option.
|
||
; <SM8> 6/3/93 SAM Updating the list of machine icons from the Gibbly project.
|
||
; <SM7> 5/10/93 CSS For 'bugy' return that the gestaltmtCheckFix has been fixed in
|
||
; SuperMario. Also, update the support of bugy to include bits
|
||
; from Indigo. Turned on gestaltGetIndResourceFix as the resource
|
||
; manager has been rewritten/reworked -- so we don't want this
|
||
; patch.
|
||
; <SM6> 3/31/93 CSS Support 'bugy' to add the fix gestaltMoveHHiExtraStackSpace.
|
||
; <SM5> 3/18/93 SAM Updated the list of machine icons
|
||
; <SM4> 11/11/92 RB Added a machine icon for the LC II, updated the machine icon
|
||
; table but left many as undefined. Also left the description of
|
||
; the machine on the side since I don't know what those machines
|
||
; look like. Changed the code to get the machine icon since we now
|
||
; have tons of them and it was out of bounds.
|
||
; <SM3> 9/25/92 RB Added a machine icon for the Quadra 950. Updated the machine
|
||
; names for some the icons.
|
||
; <SM2> 9/10/92 AEK Set FixedMicroseconds bit since QuickTime fixes rolled in (keeps
|
||
; QuickTime from patching PrimeTime and Microseconds)
|
||
; <1> 4/22/92 PN first checked in
|
||
; <2> 3/24/92 PN Move the HasSoftPowerOff and CQDFeatures GetOSTable GetToolboxTable
|
||
; GetExtToolboxTable GetFSAttr into GestaltFunction.a
|
||
; Remove BWQDFeatures
|
||
; <26> 1/19/92 DTY Turn on gestaltDietPatches in 'bugz'.
|
||
; <25> 1/10/92 DTY Add gestaltTrueTypeFix to 'bugz'.
|
||
; <24> 1/10/92 DTY Add 'bugz' gestalt selector with bits for 7 Up bugs that have
|
||
; been rolled into CubeE. (The ones with 0’s aren’t in CubeE
|
||
; yet.)
|
||
; <23> 12/17/91 DTY Add gestaltResourceOverrides to the 'rsrc' attributes.
|
||
; <22> 12/2/91 SAM Using official boxflag equates now.
|
||
; <21> 10/28/91 SAM/KSM Rolled in Regatta file:
|
||
; Added Apollo to the list of machines that do have the PowerOff
|
||
; trap but do not have soft power off (in the
|
||
; GestaltHardwardAttributes patch)
|
||
; Changed the MachineIcon table to jibe with the new boxFlags.
|
||
; Removed the old <12> (put it back into GestaltFunction). (HJR)
|
||
; Added Eclipse, Spike, Tim, DBLite, and Asahi to the machine icon
|
||
; table.
|
||
; <20> 10/4/91 gbm Add the infamous 'rsrc' selector, and change unnecessary
|
||
; leaResident to lea
|
||
; <19> 9/26/91 gbm #89608: Make the assembler stop optimizing a move.l into a
|
||
; moveq. This screwed up the 'qdrw' selector.
|
||
; <18> 9/10/91 JSM Kill all codenames!
|
||
; <17> 7/3/91 JSM Remove obsolete SysVers conditional, remove 'lram' fix
|
||
; completely.
|
||
; <16> 3/17/91 DTY gbm, #SAM-005: Setting 'lram' to ROMBase is the Wrong Thing.
|
||
; Since 'ptch' 5 is installed on all machines now anyway, and
|
||
; there’s a wrapper in the patch files which fill in the right
|
||
; values for 'lram' and 'ram ', the lramFix routine isn’t needed
|
||
; anymore, and is IF 0’d out.
|
||
; <15> 3/12/91 SAM #SAM-005: Made the “lram” selector universal and not assume 8mb
|
||
; limit on 24 bit machines (or 32 bit machines running in 24 bit
|
||
; mode).
|
||
; <14> 3/6/91 gbm dba,csd,dty,#gbm0008: add Quickdraw features selector, fix
|
||
; gestaltFSAttr to override the existing one...
|
||
; <13> 1/15/91 gbm (bbm) Add new hardware attribute, gestaltHasSoftPowerOff
|
||
; <12> 12/14/90 SAM Patched New/Replace Gestalt check for a nil proc ptr and updated
|
||
; the “lram” selector patch code to work on all machines.
|
||
; <11> 12/5/90 gbm <dba> Add two file system selectors: one for FSSpec calls
|
||
; existing, and another for file system manager existing
|
||
; <10> 11/29/90 SAM Fixed a typo.
|
||
; <9> 11/29/90 SAM Added an LPatch install time patch that reduces Gestalt's "lram"
|
||
; value to < 8 meg on IIci ROM systems in 24-bit mode with > 8 meg
|
||
; of RAM.
|
||
; <8> 9/22/90 KSM Add a semicolon before <7> on line 197 -- you're welcome dave.
|
||
; <8> 9/22/90 KSM Add a semicolon before <7> on line 197 -- you're welcome dave.
|
||
; <7> 9/22/90 dnf Turn on #gestaltFullExtFSDispatching
|
||
; <6> 9/10/90 gbm add file system attributes selector, gestaltFSAttr.
|
||
; <5> 8/17/90 JSM Fix machine icon function to work on machines with Gestalt in
|
||
; ROM, add Classic, IIsi, and LC icons, change some unnecessary
|
||
; leaResidents to leas.
|
||
; <4> 8/13/90 gbm add selectors for trap table bases
|
||
; <3> 7/18/90 EMT Changed EXPORT to ENTRY to avoid conflicts.
|
||
; <2> 7/18/90 CCH Moved machine icon selector in here from GestaltFunction.a,
|
||
; since it is added on all machines currently.
|
||
; <1> 7/13/90 JSM First checked in.
|
||
;
|
||
|
||
LOAD 'StandardEqu.d'
|
||
INCLUDE 'HardwarePrivateEqu.a'
|
||
INCLUDE 'GestaltEqu.a'
|
||
INCLUDE 'GestaltPrivateEqu.a'
|
||
INCLUDE 'SysPrivateEqu.a'
|
||
INCLUDE 'InternalOnlyEqu.a'
|
||
|
||
;————————————————————————————————————————————————————————————————————————————————————————————————————
|
||
; Record that describes stack frame for Gestalt functions
|
||
;
|
||
GestaltProcParms RECORD 0,INCREMENT
|
||
returnAddr DS.L 1
|
||
resultPtr DS.L 1
|
||
selector DS.L 1
|
||
error DS.W 1
|
||
ENDR
|
||
|
||
;————————————————————————————————————————————————————————————————————————————————————————————————————
|
||
; Installs new selectors that are not in ROM on any machine (yet).
|
||
;————————————————————————————————————————————————————————————————————————————————————————————————————
|
||
|
||
|
||
NewGestaltSelectors Proc Export
|
||
WITH ExpandMemRec, GestaltGlobals
|
||
UnimplementedTrapNumber EQU $A89F
|
||
PowerOffTrapNumber EQU $A05B
|
||
|
||
IMPORT getBugFixes ; <24>
|
||
lea getBugFixes,a0 ; <24>
|
||
move.l #gestaltBugFixAttrs,d0 ; <24>
|
||
_NewGestalt
|
||
|
||
IMPORT getBugFixesTwo ; <SM6> CSS
|
||
lea getBugFixesTwo,a0 ; <SM6> CSS
|
||
move.l #gestaltBugFixAttrsTwo,d0 ; <SM6> CSS
|
||
_NewGestalt
|
||
|
||
IMPORT getMachineIcon
|
||
lea getMachineIcon,A0 ; address of gestaltMachineIcon patch
|
||
MOVE.L #gestaltMachineIcon,D0 ; selector to add
|
||
_NewGestalt
|
||
|
||
IMPORT getResourceAttrs ; <20>
|
||
lea getResourceAttrs, a0 ; <20>
|
||
move.l #gestaltResourceMgrAttr, d0 ; resource manager attributes <20>
|
||
_NewGestalt ; <20>
|
||
|
||
RTS
|
||
|
||
ENDWITH
|
||
ENDPROC
|
||
|
||
;This get rolled into GestaltFunction.a
|
||
;CQDFeatures InstallProc (II,IIci)
|
||
|
||
; these will get stripped out if nobody refers to them, so they are not conditionalized
|
||
|
||
************************************************************************
|
||
* <24> Bug fixes
|
||
************************************************************************
|
||
|
||
getBugFixes Proc Entry
|
||
moveq #0, d0
|
||
move.l # \
|
||
(1<<gestaltFixPrinting) | \
|
||
(1<<gestaltResponderCrashFix) | \
|
||
(1<<gestaltResponderVersionFix) | \
|
||
(1<<gestaltPurgeFonts) | \
|
||
(1<<gestaltAliasMgrFix) | \
|
||
(1<<gestaltSCSIFix) | \
|
||
(1<<gestaltKeyboardFix) | \
|
||
(1<<gestaltTrueTypeFix) | \ <25>
|
||
(1<<gestaltFixedMicroseconds) | \ <SM2>
|
||
(1<<gestaltSaveLastSPExtra) | \
|
||
(1<<gestaltDietPatches) | \ <26>
|
||
(0<<gestaltBackgroundPrintingPatch) | \
|
||
(0<<gestaltNoPreferredAlertPatch) | \
|
||
(1<<gestaltAllocPtrPatches) | \
|
||
(1<<gestaltEPPCConnectionTableFix) | \
|
||
(1<<gestaltDAHandlerPatch) | \
|
||
(1<<gestaltLaunchFix) | \
|
||
(1<<gestaltDeathNoticePatches) | \
|
||
(1<<gestaltBacklightFix) | \
|
||
(1<<gestaltPrintDriverFix) | \
|
||
(1<<gestaltPMSegmentTweaks) | \
|
||
(1<<gestaltWDEFZeroFix) | \
|
||
(1<<gestaltPACKSixFix) | \
|
||
(1<<gestaltMtCheckFix) \ <SM7> CSS
|
||
, d0
|
||
|
||
import stdResult
|
||
lea stdResult,a0
|
||
jmp (a0)
|
||
EndProc
|
||
|
||
************************************************************************
|
||
* <SM6> More Bug fixes
|
||
************************************************************************
|
||
|
||
getBugFixesTwo Proc Entry
|
||
IF hasRISCV0ResMgrPatches THEN
|
||
move.l # \
|
||
(1<<gestaltEgretSCCFix) | \
|
||
(1<<gestaltEgretRdTimeFix) | \
|
||
(1<<gestaltEgretIRQPatch) | \
|
||
(1<<gestaltEgretTickHandlerFix) | \
|
||
(1<<gestaltSCSIFastAckFix) | \
|
||
(1<<gestaltPowerOffDelayFix) | \
|
||
(1<<gestaltGetIndResourceSysMapHandleFix) | \
|
||
(1<<gestaltMoveHHiExtraStackSpace) | \
|
||
(1<<gestaltRISCV0ResMgrPatches) \ <SM9> BT
|
||
, d0
|
||
ELSE
|
||
move.l # \
|
||
(1<<gestaltEgretSCCFix) | \
|
||
(1<<gestaltEgretRdTimeFix) | \
|
||
(1<<gestaltEgretIRQPatch) | \
|
||
(1<<gestaltEgretTickHandlerFix) | \
|
||
(1<<gestaltSCSIFastAckFix) | \
|
||
(1<<gestaltPowerOffDelayFix) | \
|
||
(1<<gestaltGetIndResourceSysMapHandleFix) | \
|
||
(1<<gestaltMoveHHiExtraStackSpace) | \
|
||
(0<<gestaltRISCV0ResMgrPatches) \ <SM9> BT
|
||
, d0
|
||
ENDIF
|
||
|
||
import stdResult
|
||
lea stdResult,a0
|
||
jmp (a0)
|
||
EndProc
|
||
|
||
************************************************************************
|
||
* Machine Icon
|
||
************************************************************************
|
||
|
||
machineIcon proc entry
|
||
entry getMachineIcon
|
||
with ExpandMemRec, GestaltGlobals
|
||
|
||
; Icon ID ; (boxflag) machine name (icon name) <revision>
|
||
MachineIconTable
|
||
dc.w 3 ; unknown
|
||
dc.w -16482 ; 128, 512
|
||
dc.w 3 ; XL = unknown
|
||
dc.w -16482 ; 512Ke
|
||
dc.w -16482 ; Plus
|
||
dc.w -16483 ; SE
|
||
dc.w -16486 ; II
|
||
dc.w -16486 ; IIx
|
||
dc.w -16485 ; IIcx
|
||
dc.w -16483 ; SE/30
|
||
dc.w -16484 ; Portable
|
||
dc.w -16485 ; IIci
|
||
dc.w 3 ; unknown
|
||
dc.w -16486 ; IIfx
|
||
dc.w 3 ; unknown <5>
|
||
dc.w 3 ; unknown <5>
|
||
dc.w 3 ; unknown <5>
|
||
dc.w -16482 ; XO (same as Plus) <5>
|
||
dc.w -16502 ; Erickson <5>
|
||
dc.w -16503 ; Elsie <5>
|
||
dc.w -16504 ; (14) Eclipse <2>
|
||
dc.w -16505 ; (15) Tim <2>
|
||
dc.w -16507 ; (16) Spike <2>
|
||
dc.w -16482 ; (17) Apollo (same as plus/XO) <2>
|
||
dc.w -16508 ; (18) Asahi <2>
|
||
dc.w -16505 ; (19) Tim LC
|
||
dc.w -16504 ; (20) Eclipse33/Zydeco <2>
|
||
dc.w -16503 ; (21) Vail25 <7>
|
||
dc.w -16482 ; (22) Carnation33 <1>
|
||
dc.w -16508 ; (23) DBLight25 <1>
|
||
dc.w -16454 ; (24) Wombat 25/Lego <14>
|
||
dc.w -16482 ; (25) Columbia <3>
|
||
dc.w -16508 ; (26) DBLite33 <3>
|
||
dc.w -16505 ; (27) Dartanian <3>
|
||
dc.w -16505 ; (28) DartanianLC <3>
|
||
dc.w -16456 ; (29) Wombat 33Mhz/fridge <3><14>
|
||
dc.w -16454 ; (30) Wombat 33/Lego <3><14>
|
||
dc.w -16503 ; (31) FosterFarms <3>
|
||
dc.w -16508 ; (32) Ansel (DBLite TFT) <23>
|
||
dc.w 3 ; (33) db20 <3><11>
|
||
dc.w 3 ; (34) Vail 16 <9><11>
|
||
dc.w 3 ; (35) Carnation 25 <9><11>
|
||
dc.w 3 ; (36) Carnation 16 <9><11>
|
||
dc.w -16610 ; (37) Cyclone33 (Fridge) <24>
|
||
dc.w -16454 ; (38) Brazil16 in Lego <10><14>
|
||
dc.w -16454 ; (39) Brazil32 in Lego <10><14>
|
||
dc.w 3 ; (40) Brazil16 in Fridgidaire (Killed) <10><14>
|
||
dc.w 3 ; (41) Brazil32 in Fridgidaire (Killed) <10><14>
|
||
dc.w -16454 ; (42) Brazil32c in Lego <10><14>
|
||
dc.w -16568 ; (43) BoxSlice <9><11>
|
||
dc.w -16505 ; (44) Monet <21>
|
||
dc.w -16454 ; (45) Wombat 40/Lego <9><11><14><18>
|
||
dc.w -16455 ; (46) WLCD 20Mhz/QFC <9><11>
|
||
dc.w -16455 ; (47) WLCD 25 Mhz/QFC <9><11>
|
||
dc.w -16505 ; (48) PowerBook 145 (same as 140/170) <9>
|
||
dc.w 3 ; (49) Brazil 32c in Fridgidaire <10><14>
|
||
dc.w -16749 ; (50) Hook <11>
|
||
dc.w -16455 ; (51) WLCD Consumer #1/QFC <11>
|
||
dc.w -16454 ; (52) Wombat 20 Mhz/Lego <11><14>
|
||
dc.w -16456 ; (53) Wombat 40 Mhz/Fridge <11><14>
|
||
dc.w -16455 ; (54) Tempest25 (QFC) <24>
|
||
dc.w -17000 ; (55) Box PDm/RiscQuadra <11><16>
|
||
dc.w -16503 ; (56) Vail33 <35>
|
||
dc.w -16455 ; (57) WLCD33 <35>
|
||
dc.w -17000 ; (58) PDM66F <19>
|
||
dc.w -17000 ; (59) PDM80F <19>
|
||
dc.w -17000 ; (60) PDM100F <19>
|
||
dc.w -16504 ; (61) TesseractL <19>
|
||
dc.w -16504 ; (62) TesseractF <19>
|
||
dc.w -16504 ; (63) TesseractC <19>
|
||
dc.w -16503 ; (64) 930 <19>
|
||
dc.w -16505 ; (65) Hokusai <21>
|
||
dc.w -16505 ; (66) BlackBird <24>
|
||
dc.w -16505 ; (67) BlackBirdLC <24>
|
||
dc.w -17000 ; (68) PDM evt1 WLCD <24>
|
||
dc.w -17000 ; (69) PDM50 WLCD <24>
|
||
dc.w -16508 ; (70) Escher25 <25>
|
||
dc.w -16508 ; (71) Escher33 <25>
|
||
dc.w -16610 ; (72) Cyclone40 (cyclone) <24>
|
||
dc.w -16455 ; (73) Tempest33 (QFC) <24>
|
||
dc.w -16749 ; (74) Hook33 (Hook) <25>
|
||
dc.w -16568 ; (75) Slice25 (Slice) <25>
|
||
dc.w -17000 ; (76) RISCWombat <25>
|
||
dc.w -16568 ; (77) Slice33 <25>
|
||
dc.w -16505 ; (78) Norad <28>
|
||
dc.w -16508 ; (79) BudMan <28>
|
||
dc.w -16503 ; (80) primus20 <28>
|
||
dc.w -16749 ; (81) optimus20 <28>
|
||
dc.w -16749 ; (82) PeterPan <28>
|
||
dc.w -16503 ; (83) Primus25 <28>
|
||
dc.w -16503 ; (84) primus33 <28>
|
||
dc.w -16749 ; (85) optimus25 <28>
|
||
dc.w -16749 ; (86) optimus33 <28>
|
||
dc.w -16503 ; (87) aladdin20 <28>
|
||
dc.w -16503 ; (88) aladdin25 <28>
|
||
dc.w -16503 ; (89) aladdin33 <28>
|
||
dc.w -16455 ; (90) Malcolm25 (QFC) <35>
|
||
dc.w -16455 ; (91) Malcolm33 (QFC) <35>
|
||
dc.w -16568 ; (92) Slimus25 (sliceBox) <35>
|
||
dc.w -16568 ; (93) Slice33 (sliceBox) <35>
|
||
dc.w -17000 ; (94) PDM 66 evt2-> (WLCD) <36>
|
||
dc.w -17000 ; (95) PDM 80 evt2-> (WLCD) <36>
|
||
MachineIconTableEnd
|
||
|
||
numMachineIcons equ (MachineIconTableEnd-MachineIconTable)/2
|
||
|
||
getMachineIcon
|
||
;
|
||
; We can't read the machine type directly from the globals, since the globals <5>
|
||
; structure used in certain ROM versions (like the Portable) is different from <5>
|
||
; the current structure. Otherwise, we could just do: <5>
|
||
; <5>
|
||
; Move.l ExpandMem,a1 ; find out where expandMem is <5>
|
||
; Move.l emGestalt(a1),a1 ; get global ptr <5>
|
||
; clr.l d0 ; clear result register <5>
|
||
; Move.w machType(a1),d0 ; put machineType in lsw of result <5>
|
||
; <5>
|
||
; but instead we have to call the gestaltMachineType function. <5>
|
||
; <5>
|
||
move.l #gestaltMachineType,d0 ; pass machine type selector in d0 <5>
|
||
_Gestalt ; <5>
|
||
move.l a0,d0 ; put machineType in d0 (only lsw is used) <5>
|
||
|
||
andi.w #$FFFF,d0 ; make sure only a word is valid <SM4> rb
|
||
cmp.w #numMachineIcons,d0 ; do we have a table entry?
|
||
blo.s @gotTableEntry
|
||
clr.w d0 ; no entry, use the first one in the table
|
||
@gotTableEntry
|
||
add.w d0,d0 ; advance to offset in table
|
||
lea MachineIconTable,a0 ; get table in a0 <SM4> rb
|
||
adda.l d0,a0 ; add offset to tyable entry <SM4> rb
|
||
move.w (a0),d0 ; get icon resource id <SM4> rb
|
||
|
||
import stdResult ; <5>
|
||
lea stdResult,a0 ; get address of result routine <5>
|
||
jmp (a0) ; save result and exit
|
||
|
||
endproc
|
||
|
||
|
||
************************************************************************
|
||
* Resource manager flags
|
||
************************************************************************
|
||
|
||
getResourceAttrs proc entry ;<20>
|
||
|
||
moveq #0, d0 ;<20>
|
||
move.w # \ ;<20>
|
||
(1<<gestaltPartialRsrcs) | \ ;<20>
|
||
(1<<gestaltResourceOverrides) \ ;<23>
|
||
, d0 ;<20>
|
||
|
||
import stdResult
|
||
lea stdResult,a0
|
||
jmp (a0)
|
||
endproc
|
||
|
||
|
||
|
||
************************************************************************
|
||
* Common Gestalt Function Return Code
|
||
************************************************************************
|
||
CommonCode PROC entry
|
||
ENTRY stdUnknown, stdResult, noError, stdExit
|
||
with GestaltProcParms
|
||
|
||
stdUnknown move.w #gestaltUnknownErr,error(sp) ; return gestaltUnknownErr
|
||
bra.s stdExit
|
||
|
||
stdResult move.l resultPtr(sp),a0 ; get ptr to place result
|
||
move.l d0,(a0) ; return value in d0
|
||
|
||
noError move.w #noErr,error(sp) ; return noErr
|
||
|
||
stdExit move.l (sp)+,a0 ; get return address off stack
|
||
addq.l #8,sp ; clean up stack
|
||
jmp (a0) ; return
|
||
|
||
|
||
ENDWITH
|
||
|
||
ENDPROC
|
||
|
||
|
||
END
|