supermario/base/SuperMarioProj.1994-02-09/Tidbits/BootAlerts.a
2019-06-29 23:17:50 +08:00

449 lines
15 KiB
Plaintext

;
; File: BootAlerts.a
;
; Contains: deep shit alerts for booting
;
; Copyright: © 1986-1991 by Apple Computer, Inc., all rights reserved.
;
; This file is used in these builds: BigBang
;
; Change History (most recent first):
;
; <17> 6/12/91 LN removed #include 'HardwareEqu.a'
; <16> 6/11/91 gbm Take out conditional for Regatta
; <15> 4/2/91 SAM Changed the Boot strings for the Regatta build.
; <14> 3/4/91 dba dty: get rid of SysVers conditionals
; <13> 1/14/91 stb & JDR; reword MacsBug installed and Extensions off.
; <12> 12/11/90 stb tweak message extensions disabled
; <11> 8/6/90 stb add message for “System x.x needs more memory to start up.” for
; 7.0 and later
; <10> 8/1/90 SAM Reverted MissingPatchMessage to the way it was in rev 7 of this
; file. See brain-fade.
; <9> 7/30/90 SAM Reworded MissingPatchMessage (again).
; <8> 7/30/90 SAM Reworded MissingPatchMessage.
; <7> 7/10/90 BA Fixed length of dssSwitch button string. This fixes some bugs
; related to the 24/32 bit mode alert.
; <6> 5/30/90 dba capitalize the D in “Extensions Disabled.”; change RAM parity
; message to match the messages in UserAlerts
; <5> 4/10/90 dba added message for “Extensions disabled.”; added alert for “need
; to write boot blocks, but the disk is write-protected”; got rid
; of a few alerts for 7.0 that are only used from UserAlerts.a
; since the boot code cleanup makes the loading time consistent
; between different ROMs
; <4> 1/30/90 dba get rid of warnings when assembling; put in fancier messages;
; conditionalize out stuff needed only on systems that do not
; support 32-bit addressing
; <3> 1/12/90 CCH added include of “HardwarePrivateEqu.a”
; <2> 12/28/89 dba changed from PROC to MAIN so we get dead code stripping
; <1.4> 10/11/89 dba changed IDs to conform with UserAlerts; improved icons
; <1.3> 8/15/89 dba NEEDED FOR 6.0.4: expunged references to “32-Bit Mode” for the
; greater good of humanity
; <1.2> 8/11/89 dba NEEDED FOR 6.0.4: changed text for alerts; improved ShutDown
; code used when ShutDown Manager is not present; added duplicate
; button lists to handle case where ResumeProc is not NIL; added
; system version to text of some alerts
; <1.1> 5/15/89 CCH Added alert for memory parity error. (#101)
; <1.0> 11/16/88 CCH Added to EASE.
; 3/20/88 EKH Added SysErr #98 (dsNoPatch) for RomNoPatch, so it has it's very
; own SysErr number. Also, I changed the proc ID from 90 to 91 to
; match UserAlerts.a <EKH 20Mar88 S429> Also, modified proc ID 80
; to seperate the eject code so I use it. This is paralleled in
; the UserAlerts.a code.
; 1/17/88 EKH Added Alert for "needed resource can't be loaded" error at boot
; time (SysErr #99). This error is generated by PTCH id -1, and
; anyone else who can not load a "do or die" resource from the
; system file. <EKH 14Jan88 S359> ALSO, I documented the file so
; it is MUCH easier to add SysErrs!
; 3/30/87 jdt Removed the HD20 Startup alert. It now resides in the user alert
; table.
; 7/23/86 DLD Converted source to MPW.
;
string asis
load 'StandardEqu.d'
include 'ShutDownEqu.a'
include 'HardwarePrivateEqu.a'
ShutDownTrapNumber equ $95 ; _ShutDown
UnimplementedTrapNumber equ $9F ; _Unimplemented
macro
dcSystemVersion
gblc &SysVersion
dc.b '&SysVersion'
endm
; ——————————————————————————————————————————————————————————————————————————————————————————————————
BootAlerts main
; ——————————————————————————————————————————————————————————————————————————————————————————————————
;
; Icon numbering:
;
; The internal icon numbers are also used as resource IDs for color icons,
; so they must be assigned like all other reserved resource IDs.
; Also, like all the other numbers below, they must steer clear of system errors.
; For this reason we use negative numbers lower than -10000.
dsiBomb equ -16397
dsiStop equ -16400
dsiPicasso equ -16396
; ——————————————————————————————————————————————————————————————————————————————————————————————————
;
; Numbering scheme:
;
; These IDs must not conflict with actual system errors.
; For this reason, we use negative numbers lower than -10000 (we start at -20000).
; for text
dstMissingPatch equ -20000
dstParityError equ -20001
dstSystemDamaged equ -20002
dst32BitMode equ -20100
dstGreeting equ -20101
dstMacsBugInstalled equ -20102
dstOldSystem equ -20103
dstNeedToWriteBootBlocks equ -20104
dstExtensionsDisabled equ -20105
dstNotEnoughRAMToBoot equ -20106
; for procedures
dspRestart equ -21000
dspSwitch equ -21100
; for button lists
dsbRestart equ -22001 ; also uses -22000
dsb32BitMode equ -22101 ; also uses -22100
; for button strings
dssRestart equ -23000
dssSwitch equ -23100
; ——————————————————————————————————————————————————————————————————————————————————————————————————
;
; Entry count: bump 1 for each new item.
NumEntries: set 21 ; 8 alerts, 2 icons, 7 texts, 1 proc, 2 button lists, 1 button string
dc.w NumEntries
; ——————————————————————————————————————————————————————————————————————————————————————————————————
;
; Alert definitions.
;
; (word) error ID
; (word) 10 (length of remaining items)
; (word) primary text definition ID
; (word) secondary text definition ID
; (word) icon definition ID
; (word) procedure definition ID
; (word) button definition ID
; greetings
dc.w dsGreeting,10,dstGreeting,0,dsiPicasso,0,0
dc.w dsMacsBugInstalled,10,dstMacsBugInstalled,0,0,0,0
dc.w dsDisassemblerInstalled,10,0,0,0,0,0
dc.w dsExtensionsDisabled,10,dstExtensionsDisabled,0,0,0,0
; errors
dc.w dsOldSystem,10,dstOldSystem,0,dsiStop,0,dsbRestart
dc.w dsNeedToWriteBootBlocks,10,dstNeedToWriteBootBlocks,0,dsiStop,0,dsbRestart
; errors in both BootAlerts and UserAlerts
; (boot 2 resource fixes it so that only BadPatch is needed before UserAlerts take over)
dc.w dsBadPatch,10,dstSystemDamaged,0,dsiStop,0,dsbRestart
dc.w dsNotEnoughRAMToBoot,10,dstNotEnoughRAMToBoot,0,dsiStop,0,dsbRestart
; ——————————————————————————————————————————————————————————————————————————————————————————————————
;
; Text definitions.
;
; (word) text definition ID
; (word) length of rest of definition
; (long) location (point) - global coordinates
; (??) ASCII text
; (byte) null character
GreetingMessage
dc.w dstGreeting,@end-@rest
@rest
dc.w 108,192
DC.B 'Welcome to Macintosh.'
DC.B 0
align
@end
MacsBugInstalledMessage
dc.w dstMacsBugInstalled,@end-@rest
@rest
dc.w 126,192
DC.B 'Debugger installed.'
DC.B 0
align
@end
ExtensionsDisabledMessage
dc.w dstExtensionsDisabled,@end-@rest
@rest
dc.w 126,192
DC.B 'Extensions off.'
DC.B 0
align
@end
OldSystemMessageMessage
dc.w dstOldSystem,@end-@rest
@rest
dc.w 94,114
dc.b 'This startup disk will not work on this Macintosh/'
dc.b 'model. Use the latest Installer to update this disk/'
dc.b 'for this model. (System '
dcSystemVersion
dc.b ' does not work on/'
dc.b 'this model; you need a newer version that does.)'
dc.b 0
align
@end
NeedToWriteBootBlocksMessage
dc.w dstNeedToWriteBootBlocks,@end-@rest
@rest
dc.w 94,114
dc.b 'This disk must be unlocked in order to perform/'
dc.b 'one-time housekeeping. If you wish to use this/'
dc.b 'disk to start your Macintosh, unlock it.'
dc.b 0
align
@end
SystemDamagedMessage
dc.w dstSystemDamaged,@end-@rest
@rest
dc.w 94,114
DC.B 'The “System” file on this startup disk may be/'
dc.b 'damaged. The Installer can be used to repair this/'
dc.b 'disk.'
DC.B 0
align
@end
NotEnoughRAMToBootMessage
dc.w dstNotEnoughRAMToBoot,@end-@rest
@rest
dc.w 94,114
dc.b 'System '
dcSystemVersion
dc.b ' needs more memory to start up.'
dc.b 0
align
@end
; ——————————————————————————————————————————————————————————————————————————————————————————————————
;
; icon definitions
;
; (word) icon definition ID (used as resource ID for cicn)
; (word) length of rest of definition
; (8 bytes) location (rectangle) - global coordinates
; (128 bytes) icon data
; Picasso Macintosh icon
PicassoIcon
dc.w dsiPicasso,@end-@rest
@rest
dc.w 89,56,121,88
dc.l $0007FF80, $00080000, $00087E20, $00080120
dc.l $00080120, $04080120, $0C080120, $08080120
dc.l $66080120, $99080120, $8108FE20, $80080020
dc.l $80080020, $4A001F20, $34000020, $00FC0020
dc.l $03000000, $0401FFF0, $04000008, $03E01FE4
dc.l $00100552, $001000A9, $00200001, $002001FE
dc.l $00180000, $00040000, $0000C000, $00012000
dc.l $00025000, $00008800, $00000800, $00001000
@end
; stop icon
DSStopIcon
dc.w dsiStop,@end-@rest
@rest
dc.w 81,60,113,92
dc.l $00FFFF00, $01FFFF80, $03FFFFC0, $07FEFFE0
dc.l $0FFC7FF0, $1FEC67F8, $3FC447FC, $7FC447FE
dc.l $FF4447FF, $FE4447FF, $FE4447FF, $FE4447FF
dc.l $FE4447FF, $FE4447FF, $FE40071F, $FE00061F
dc.l $FE00061F, $FE00043F, $FE00003F, $FE00007F
dc.l $FE00007F, $FE0000FF, $FE0000FF, $FE0001FF
dc.l $FE0001FF, $7E0403FE, $3F0207FC, $1FFFFFF8
dc.l $0FFFFFF0, $07FFFFE0, $03FFFFC0, $01FFFF80
@end
; ——————————————————————————————————————————————————————————————————————————————————————————————————
;
; button lists
;
; (word) button definition ID
; (word) length of rest of definition
; (word) number of buttons
; (word) string ID
; (4 words) button location (rectangle)
; (word) procedure definition ID
; Restart button list
; this is the copy used if there is no ResumeProc
; note that these two are identical
RestartButtons1
dc.w dsbRestart,@end-@rest
@rest
dc.w 1
dc.w dssRestart,154,404,174,463,dspRestart
@end
; Restart button list
; this is the copy used if there is a ResumeProc
; note that these two are identical
RestartButtons2
dc.w dsbRestart+1,@end-@rest
@rest
dc.w 1
dc.w dssRestart,154,404,174,463,dspRestart
@end
; ——————————————————————————————————————————————————————————————————————————————————————————————————
;
; button strings
;
; (word) string ID
; (word) length of string (rounded to next word)
; (??) ASCII characters
;
dc.w dssRestart,8
DC.B 'Restart '
; ——————————————————————————————————————————————————————————————————————————————————————————————————
;
; Procedures.
;
; (word) procedure definition ID
; (word) length of rest of definition
; (??) procedure code
; —————————————————————————————————————————————————
;
; DoRestart is used to restart.
dc.w dspRestart,EndDoRestart-DoRestart
DoRestart
; restart the machine, first try to use the shutdown manager, then do our own restart
bsr.s ShutDownManagerInstalled ; is there a ShutDown Manager?
bz.s @noShutDownManager
_SDRestart ; use the ShutDown Manager
; This code is executed on machines without ShutDown Managers in ROM.
@noShutDownManager
bsr.s DoUnmount ; unmount all of the volumes
Move.L ROMBase,a0 ; point to the ROM
Lea ROMHeader.ReStart(a0),a0 ; point to the restart routine
btst #6,ROM85 ; old machines only need reset
bz.s @tooNewForReset
reset
@tooNewForReset
Jmp (a0) ; exit thru the restart routine
; ShutDownManagerInstalled
;
; This determines if the ShutDown Manager is installed.
; It returns NZ if there is a ShutDown Manager and Z if there is not.
ShutDownManagerInstalled
Move.W #UnimplementedTrapNumber, D0
_GetTrapAddress ; get Unimplemented
Move.L A0, A1 ; save result
Move.W #ShutDownTrapNumber, D0
_GetTrapAddress ; get ShutDown
Cmp.L A0, A1 ; compare the two
rts
; The following routines (DoUnmount and ZapVCBQueue) are copied from the ShutDown Manager:
;
; DoUnmount - Unmount all of the Volumes on line, so the disks will be
; updated before our power off.
;
; Entry: No parameters.
DoUnmount
Sub #ioQElSize,SP ; allocate pBlock
; Go through the VCB Queue to Flush and eject all volumes.
Move.L SP,A0 ; point to the parameter block.
Clr.L ioVNPtr(A0)
Clr.W ioRefNum(A0)
Move.L VCBQHdr+QHead,A1 ; get the queue header
Move.L VCBQHdr+QTail,D2 ; get the tail too.
Beq.S @AllFlushed
Bsr.S ZapVCBQueue ; wipe out the whole Queue
@AllFlushed
Add #ioQElSize,SP ; deallocate pBlock
Rts
; ZapVCBQueue - This ReEntrant routine goes through the VCB Queue, and calls
; UnmountVol for each entry.
; Entry: A0 - IOParam Block
; A1 - Pointer to current Entry
; D2 - Tail entry Pointer.
; Exit: A1 - Pointer to next Entry.
; D1 - Preserved.
ZapVCBQueue
Move.W D1,-(SP) ; save for re-entrancy.
Move.W vcbVRefNum(A1),D1 ; get a VRefNum
Move.L QLink(A1),-(SP) ; go on to the next VCB
Cmp.L D2,A1
Move.L (SP)+,A1
Beq.S @FlushTime ; have we reached the end?
Bsr.S ZapVCBQueue ; not yet, save the VRefNum, call self.
@FlushTime
Move.W D1,ioVRefNum(A0) ; set up the refNum in the PBlock.
_Eject
_HUnmountVol ; shut the volume down.
Move.W (SP)+,D1 ; restore crucial VRefNum
Rts ; for reentrancy.
EndDoRestart
; ——————————————————————————————————————————————————————————————————————————————————————————————————
end