2004-02-15 20:46:45 +00:00
|
|
|
/*
|
|
|
|
*
|
2006-09-15 14:55:39 +00:00
|
|
|
* (c) 2004,2005 Laurent Vivier <Laurent@lvivier.info>
|
2004-02-15 20:46:45 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2005-05-19 09:02:45 +00:00
|
|
|
.chip 68000
|
|
|
|
|
2004-12-07 00:35:33 +00:00
|
|
|
.equ sector_size, 512
|
|
|
|
.equ first_level_size, 2 * sector_size
|
|
|
|
|
2005-11-21 21:17:58 +00:00
|
|
|
.include "macos.i"
|
2005-11-25 19:53:47 +00:00
|
|
|
.include "32bitmode.i"
|
2004-02-15 20:46:45 +00:00
|
|
|
|
2004-05-21 10:18:49 +00:00
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* Structure: "Inside Macintosh: Files", p. 2-57
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
2004-02-15 20:46:45 +00:00
|
|
|
|
|
|
|
begin:
|
2004-07-10 01:29:17 +00:00
|
|
|
ID: .short 0x4C4B /* boot blocks signature */
|
|
|
|
Entry: bra start /* entry point to bootcode */
|
|
|
|
Version: .short 0x4418 /* boot blocks version number */
|
|
|
|
PageFlags: .short 0x00 /* used internally */
|
|
|
|
SysName: pString "Mac Bootloader" /* System filename */
|
|
|
|
ShellName: pstring "Copyright 2004" /* Finder filename */
|
|
|
|
Dbg1Name: pString "Laurent Vivier" /* debugger filename */
|
|
|
|
Dbg2Name: pString "Distributed " /* debugger filename */
|
|
|
|
ScreenName: pString "under GNU GPL " /* name of startup screen */
|
|
|
|
HelloName: pString "first level " /* name of startup program */
|
2004-12-07 00:35:33 +00:00
|
|
|
ScrapName: pString "version 1.2 " /* name of system scrap file */
|
2004-07-10 01:29:17 +00:00
|
|
|
CntFCBs: .short 10 /* number of FCBs to allocate */
|
|
|
|
CntEvts: .short 20 /* number of event queue elements */
|
|
|
|
Heap128K: .long 0x00004300 /* system heap size on 128K Mac */
|
|
|
|
Heap256K: .long 0x00008000 /* used internally */
|
|
|
|
SysHeapSize: .long 0x00020000 /* system heap size on all machines */
|
2004-02-15 20:46:45 +00:00
|
|
|
|
2004-12-07 00:35:33 +00:00
|
|
|
.ifdef SCSI_SUPPORT
|
|
|
|
|
2005-11-21 21:17:58 +00:00
|
|
|
.include "scsi.i"
|
2004-12-07 00:35:33 +00:00
|
|
|
|
2005-11-21 21:17:58 +00:00
|
|
|
.else
|
2004-12-07 00:35:33 +00:00
|
|
|
|
2005-11-21 21:17:58 +00:00
|
|
|
.include "floppy.i"
|
2004-02-15 20:46:45 +00:00
|
|
|
|
2005-11-21 21:17:58 +00:00
|
|
|
.endif
|
2004-02-15 20:46:45 +00:00
|
|
|
|
2004-05-21 10:18:49 +00:00
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* start : load the second stage
|
|
|
|
*
|
|
|
|
* start is called from the boot block header
|
|
|
|
*
|
|
|
|
* call PBReadSync() to read blocks from floppy
|
|
|
|
* as described in param_block
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
|
|
|
|
2004-12-07 00:35:33 +00:00
|
|
|
.align 4
|
2004-05-21 10:18:49 +00:00
|
|
|
start:
|
2005-05-20 00:24:13 +00:00
|
|
|
moveal SysZone,%a0
|
|
|
|
addal %pc@(SysHeapSize),%a0
|
|
|
|
SetApplBase
|
|
|
|
movel SysZone,TheZone
|
|
|
|
|
2005-11-25 19:53:47 +00:00
|
|
|
/* test if we are in 32bit mode, otherwise reboot in 32bit mode */
|
2005-05-20 00:24:13 +00:00
|
|
|
|
2005-11-25 19:53:47 +00:00
|
|
|
switch32bitmode
|
2004-08-18 22:31:40 +00:00
|
|
|
|
2005-11-21 21:17:58 +00:00
|
|
|
/* buffer size to store second stage booter */
|
2004-05-25 20:34:08 +00:00
|
|
|
|
2005-11-21 21:17:58 +00:00
|
|
|
get_second_size %d0
|
2004-12-07 00:35:33 +00:00
|
|
|
|
2005-11-21 21:17:58 +00:00
|
|
|
/* Allocate Memory for second stage loader */
|
2005-05-20 00:24:13 +00:00
|
|
|
|
2004-05-25 22:39:51 +00:00
|
|
|
add.l #4, %d0
|
2004-05-25 20:34:08 +00:00
|
|
|
NewPtr
|
|
|
|
move.l %a0, %d0
|
2004-08-18 22:31:40 +00:00
|
|
|
bne malloc_ok
|
|
|
|
move.l #1, %d0
|
|
|
|
SysError
|
|
|
|
malloc_ok:
|
2004-05-26 18:34:04 +00:00
|
|
|
add.l #3, %d0
|
|
|
|
and.l #0xFFFFFFFC.l, %d0
|
2004-05-21 10:18:49 +00:00
|
|
|
|
2005-11-21 21:17:58 +00:00
|
|
|
/* load second stage */
|
2004-12-07 00:35:33 +00:00
|
|
|
|
2005-11-21 21:17:58 +00:00
|
|
|
load_second
|
2004-12-07 00:35:33 +00:00
|
|
|
|
2004-05-21 10:18:49 +00:00
|
|
|
/* call second stage bootloader */
|
|
|
|
|
|
|
|
jmp (%a0)
|
|
|
|
|
2004-08-18 22:31:40 +00:00
|
|
|
PRAM_buffer:
|
|
|
|
.long 0
|
2004-02-15 20:46:45 +00:00
|
|
|
end:
|
2004-05-21 10:18:49 +00:00
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* Filler: the boot block is 2 floppy blocks
|
|
|
|
* as seen on the disk of utilities of MacOS 7.6, we fill with 0xda
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
|
|
|
|
2004-12-07 00:35:33 +00:00
|
|
|
.ifdef SCSI_SUPPORT
|
|
|
|
.fill first_level_size - (end - begin) - 10, 1, 0xda
|
|
|
|
container_end:
|
|
|
|
block_size: .short 0
|
|
|
|
unit_id: .short 0
|
|
|
|
second_size: .long 0
|
|
|
|
max_blocks: .short container_end - end
|
|
|
|
.else
|
2004-05-21 10:18:49 +00:00
|
|
|
.fill first_level_size - (end - begin), 1, 0xda
|
2004-12-07 00:35:33 +00:00
|
|
|
.endif
|