mac-rom/OS/StartMgr/Boot1.a

378 lines
14 KiB
Plaintext
Raw Normal View History

;
; File: Boot1.a (formerly BootBlocks.a)
;
; Contains: Macintosh disk-based boot code
;
; This code goes into the two disk boot blocks and is loaded into RAM
; after ROM initialization is complete and a boot diskette is in place.
;
; In the System file, this code lives in the 'boot' 1 resource.
;
; When this code is entered, the interrupt system, Memory Manager, and
; ROM-based I/O drivers have been initialized. This code finds the
; System file and loads the contents of its data fork, and turns over
; the rest of the booting process to the code that it finds there.
;
; Original written by: Larry Kenyon
; Written by: Darin Adler
;
; Copyright: <09> 1983-1992 by Apple Computer, Inc., all rights reserved.
;
; Change History (most recent first):
;
; <10> 4/20/92 JSM Moved this file from {TidBits}BootBlocks.a to {StartMgr}Boot1.a,
; keeping all revisions.
; <9> 1/15/91 stb & dba; reduce size to fit in one DDP packet
; <8> 12/11/90 dba & bbm; make the check for new ROMs check the whole version word,
; instead of doing a compare on the low byte of the version
; <7> 4/14/90 dba fix bug with register not set to ROMBase
; <6> 4/11/90 dba size the system heap in the old way for Plus and SE ROMs; this
; makes 6.X systems work properly; also unmount volume if
; HGetVInfo or OpenWD fails; respect the maximum size from network
; booting (small)
; <5> 4/10/90 dba boot from a resource instead of the system file data fork; this
; new version will handle systems with or without the new 'boot'
; (2) resources; systems without the resource will be booted in
; the old-fashioned way
; <4> 3/21/90 dba all new boot blocks (the old ones were hardly used); these leave
; most of the booting to code in the system file
; <3> 1/4/90 dba get rid of warnings by deleting extraneous equates
; <2> 12/28/89 dba use MAIN instead of PROC for dead code stripping; redo the
; padding at the end of the boot blocks
; <1.2> 6/1/89 GGD Fixed assembly errors in previous change
; <1.1> 5/31/89 PAT Conditionalized the StartUp ("Hello") program to be
; "Multifinder" for System 7.0 and later, and remain "Finder" for
; all earlier Systems.
; 5/31/89 PAT Conditionalized the StartUp (Hello) program in boot resource
; System 7.0 and later: StartUp application = "Multifinder"
; Earlier than System 7.0: StartUp application = "Finder"
; <1.0> 11/16/88 CCH Added to EASE.
; 5/24/88 EKH Update the boot blocks: bumped the version to 0x17, and set the
; system heap size to 0x2000 (128K).
; 3/9/87 LAK Rebuilt for inclusion in system resource file as resource of
; type 'boot'.
; 5/7/84 LAK reverted to early rev num to placate MacWorks.
; 4/20/84 SC drop the font fix... (f--k I<>m brilliant)
; 4/16/84 SC soften event number and do appl font fix
; 2/23/84 SC Max event and file # maximums
; 2/23/84 AJH fixed system heap size for systems > 512K
; 2/13/84 SC there<72>s a 512 version tacked on end. Copy entire .PROC, chg to
; boot512 and uncomment code @ H512 label
; 1/13/84 AJH don<6F>t SetAppBase until after InitResources
; 1/12/84 AJH load in INIT routines in resID order
; 1/12/84 AJH check to see the file to launch exists
; 1/10/84 AJH/LAK read-only permissions for Macsbug, clear less FS globals
; 1/6/84 AJH set up applZone after file system init, set up version #
; 1/5/84 AJH changed default names, more FCBs for bigger system heaps
; 1/2/84 AJH added system heap CompactMem, increased size in sysHeap, new
; version
; 12/20/83 LAK updated version number to $0081.
; 12/18/83 AJH fixed up mouse scaling cause the ROM uses the wrong bit...
; 12/13/83 AJH got rid of start-up, use "INIT" resources instead
; 12/2/83 AJH final overhaul -- 256K support, startUp file detach, etc
; 11/13/83 AJH get rid of bootBlock deepShit alert; put in Sys.rsrc set up
; screenRow
; 10/13/83 LAK movescreen now uses CopyBits for Lisa compatibility; scrounged
; bytes from various places.
; 9/7/83 LAK added call to _ZeroScrap. optimized IO to make it fit.
; 9/5/83 SC scrap vars point to name
; 9/4/83 LAK added CLR.L ResErrProc for resources,
; 8/28/83 AJH added whichAlerts option for DS alerts
; 8/20/83 LAK Added event queue count in header. Added scrap name in header.
; Changed param. memory for key stuff. Added param. mem. for click
; and caret. Added DoDetach for saving code.
; 8/17/83 LAK added init of EvtBufLen; FinderName var moved in lomem.
; 8/9/83 AJH fixed bug releasing bootAlerts; misc cleanup
; 7/13/83 LAK changed CLR.L Keylast to CLR.W Keylast.
; 6/10/83 AJH added "Hello" fileName for initial launch
; 6/8/83 AJH finderName is 12 long, not 16...
; 6/7/83 AJH set up master block start address, ext file system fields
; 6/5/83 AJH set up key repeat parms from parameter RAM
; 6/4/83 AJH implemented system heap sizing and page 2 reservation
; 6/3/83 AJH KEYM -> KEYC; detached keyProcs and deep shit alerts
; 6/2/83 AJH cleared theScrap, set up vidPage launch param set up sysResName
; and put MacSys there
; 5/31/83 AJH MacSys.Code no longer necessary to boot
; 5/27/83 AJH New Loader!
; 4/7/83 AJH Complete rewrite of mainline; installed deep shit alerts
; 4/1/83 AJH Made it work on 512K system
; 2/8/83 LAK New Today.
;
; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
; equates
load 'StandardEqu.d'
maxBootCodeSize equ 404 ; only this many bytes across the network (net booting)
bootBlocksSize equ 1024 ; two 512-byte disk blocks
macro
str16 &string
string pascal
@label: dc.b &string
org @label+16
endm
; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
BootBlocks main export
; Here is the boot block header.
dc.w ('LK') ; boot code identifier
bra.w Boot ; kick off the boot code
Version
dc.b ('D') ; executable on all machines
dc.b $18 ; version number
Page2Flags dc.w 0
SystemFileName str16 'System'
FinderFileName str16 'Finder'
DebuggerFileName str16 'MacsBug'
DisassemblerFileName str16 'Disassembler'
StartupScreenFileName str16 'StartUpScreen'
HelloFileName str16 'Finder'
ClipboardFileName str16 'Clipboard'
NumFCBs dc.w 10 ; number of FCBs to allocate at boot
NumEvents dc.w 20 ; number of event queue elements
SystemHeapSize128K dc.l $4300 ; size of system heap for 128K system (never used)
SystemHeapSize256K dc.l $8000 ; size of system heap for 256K system (never used)
SystemHeapSize dc.l $20000 ; size of system heap (used for pre-7.0)
; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Boot
; There are three things that can happen here.
; 1) Successful boot; control passed to the code in the 'boot' (2) resource.
; 2) Old system file; no 'boot' (2) resource; continue booting; get patches from System data fork
; 3) Failed boot; call Reboot vector.
;
; The main boot code below will never return in case 1, but in case 2 or 3 it will return with
; a result code in D0. The result code is noErr for an old system file (case 2 above), and some
; other error otherwise (case 3 above).
;
; This section here is used on older ROMs that do not understand the result values. It has hardcoded
; ROM offsets of where to continue booting for cases 2 and 3.
tst.w ROM85 ; check for very old ROMs
bmi.s BadROM
move.l ROMBase,a0 ; get the ROM version number
move.w 8(a0),d1
moveq #-2,d6 ; start before the beginning of the table
NextROM
addq.w #2,d6 ; advance to the next entry in the table
move.w ROMVersionTable(d6.w),d0 ; the end of the table?
bz.s MainBootCode ; yes, this is a new ROM that directly calls MainBootCode
cmp.w d0,d1 ; the right ROM?
bne.s NextROM ; no, go on to the next one
; At this point, D6.W contains an offset into all of the ROM-specific tables.
; Next, set the system heap size for pre-Mac II ROMs where it isn<73>t growable.
cmp.b #$76,d1 ; is this an old ROM that we must help?
bhi.s NoSysZoneResizeNeeded ; no, system heap is already growable
move.l SysZone,a0 ; the one true heap
add.l SystemHeapSize,a0 ; proper size of the heap
_SetAppBase
move.l SysZone,TheZone ; set the zone to system heap
NoSysZoneResizeNeeded
; Call the boot code, and handle errors that might occur.
addq #4,sp ; pop off the return address into the ROM
move.l sp,d7 ; here is the place for PB calls to be used
bsr.s MainBootCode ; do normal boot code
move.w AfterInitResourcesTable(d6.w),d1 ; get ROM offset for continuing 6.0-style boot
tst.w d0 ; check and see if there was an error
bz.s JoinROM ; no error, join the ROM to continue booting
move.w RebootTable(d6.w),d1 ; get ROM offset for failing and rebooting
JoinROM
move.l ROMBase,a0
jmp 0(a0,d1.w) ; jump to the routine
BadROM
moveq #dsNoPatch,d0 ; can<61>t boot on this ROM
_SysError
; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
ROMVersionTable
; ROM version numbers of old ROMs that have old-fashioned boot code
dc.w $0075 ; Plus
dc.w $0276 ; SE
dc.w $0178 ; II
dc.w $037A ; Portable
dc.w $067C ; IIci
dc.w 0 ; end of table
AfterInitResourcesTable
; ROM offsets for continuing booting after InitResources
dc.w $0A44 ; Plus
dc.w $090E ; SE
dc.w $0F1C ; II
dc.w $30E6 ; Portable
dc.w $1D96 ; IIci
RebootTable
; ROM offsets for Reboot routine
dc.w $0B82 ; Plus
dc.w $0A52 ; SE
dc.w $11AE ; II
dc.w $336E ; Portable
dc.w $203E ; IIci
; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
MainBootCode
; This code will either boot the machine, and not return or return with an error in d0.
; If the error returned is noErr (0), then it means that this is an old-style System file,
; and the older ROM booting code should be used.
;
; D7 must contain a pointer to a place for a parameter block on entry to this routine.
; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
GetFileNames
; Put names of system files in low memory.
lea SystemFileName,a0
lea SysResName,a1
moveq #16,d0
_BlockMove
lea FinderFileName,a0
lea FinderName,a1
moveq #16,d0
_BlockMove
lea ClipboardFileName,a0
LEA ScrapTag,A1
MOVE.L A1,ScrapName ; point ScrapName to ScrapTag
moveq #16,d0
_BlockMove
; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
InitializeEventManager
move.w NumEvents,d0
_InitEvents
; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
InitializeFileSystem
move.w NumFCBs,d0
_InitFS ; note to future generations: InitFS trashes A2!
; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
MountStartupDisk
move.l d7,a0 ; point to parameter block
move.w BootDrive,ioDrvNum(a0) ; set up drive number
_MountVol ; mount startup disk
bnz.s Return ; reboot if there<72>s an error
; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
FindBlessedFolder
clr.l ioFileName(a0) ; we don<6F>t want the disk<73>s name
clr.w ioVolIndex(a0) ; use the vRefNum left over from MountVol
_HGetVInfo ; see if there is a system folder
bnz.s UnmountAndReturn ; if we fail, tell our caller
move.l ioVFndrInfo+4(a0),a4 ; save dirID of startup app. in a4 for pre-7.0 systems
move.l ioVFndrInfo(a0),ioWDDirID(a0) ; get the dirID of system folder
bz.s @noFolder ; if it is 0, boot the root
move.l #'ERIK',ioWDProcID(a0) ; magic incantation from hell
_OpenWD ; use the vRefNum left over from MountVol
bnz.s UnmountAndReturn ; can<61>t open, tell our caller
_SetVol ; make blessed folder the default volume
@noFolder
; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
InitializeResourceManager
subq #2,sp ; make room for function result
_InitResources ; open that system file
tst.w (sp)+ ; did we get it?
bmi.s InitResourcesFailed ; yes, we<77>re OK
; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
ContinueBooting
; Check for a secondary boot resource; 'boot' (2).
; If it is there, call it.
;
; Registers passed in:
; A3 = handle to 'boot' (2) resource
; A4 = dirID of the startup application (for pre-7.0 systems)
; A5 = pointer to globals (SP + 400)
; If there is none, do the old style standard boot using the code in ROM.
subq #4,sp ; make room for the handle
move.l #'boot',-(sp)
move.w #2,-(sp) ; 'boot' 2 resource contains secondary boot code
_GetResource
move.l (sp)+,d0 ; is there a 'boot' 2 resource?
bz.s Return ; no, return with 0 in d0 (noErr) to continue booting
addq #4,sp ; get rid of the return address, we are not returning
move.l d0,a3 ; get ready to start the Macintosh
move.l (a3),a0 ; get the address of secondary boot code
jmp (a0) ; call the secondary boot code
; <20><><EFBFBD> THE END <20><><EFBFBD>
; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
InitResourcesFailed
moveq #dsSystemFileErr,d0 ; return just the right error code
UnmountAndReturn
move.w d0,-(sp) ; save the result code
move.l d7,a0 ; point to parameter block
_UnmountVol ; already set up (for HGetVInfo)
move.w (sp)+,d0 ; get error code to return to caller
Return
rts
; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
bootBlocksSoFar: equ *-BootBlocks
if bootBlocksSoFar > maxBootCodeSize then
aerror &concat('boot blocks don<6F>t fit: ', \
&i2s(bootBlocksSoFar),' bytes; ', \
'maximum ',&i2s(maxBootCodeSize),' bytes')
else
dcb.b bootBlocksSize-bootBlocksSoFar,$DA
endif
; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
end