Previous Book Contents Book Index Next

Inside Macintosh: Files /
Chapter 2 - File Manager / Data Organization on Volumes

Boot Blocks

The first two logical blocks on every Macintosh volume are boot blocks. These blocks contain system startup information: instructions and information necessary to start up (or "boot") a Macintosh computer. This information consists of certain configurable system parameters (such as the capacity of the event queue, the number of open files allowed, and so forth) and is contained in a boot block header. The system startup information also includes actual machine-language instructions that could be used to load and execute the System file. Usually these instructions follow immediately after the boot block header. Generally, however, the boot code stored on disk is ignored in favor of boot code stored in a resource in the System file.

The structure of the boot block header can be described by the Pascal BootBlkHdr
data type.

The format of the boot block header is subject to change. If your application relies on the information presented here, it should check the boot block header version number and react gracefully if that number is greater than that documented here.
Note that there are two boot block header formats. The current format includes two fields at the end that are not contained in the older format. These fields allow the Operating System to size the System heap relative to the amount of available physical RAM. A boot block header that conforms to the older format sets the size of the System heap absolutely, using values specified in the header itself. You can determine whether a boot block header uses the current or the older format by inspecting a bit in the high-order byte of the bbVersion field, as explained in its field description.

TYPE BootBlkHdr   =           {boot block header}
   bbID:             Integer; {boot blocks signature}
   bbEntry:          LongInt; {entry point to boot code}
   bbVersion:        Integer; {boot blocks version number}
   bbPageFlags:      Integer; {used internally}
   bbSysName:        Str15;   {System filename}
   bbShellName:      Str15;   {Finder filename}
   bbDbg1Name:       Str15;   {debugger filename}
   bbDbg2Name:       Str15;   {debugger filename}
   bbScreenName:     Str15;   {name of startup screen}
   bbHelloName:      Str15;   {name of startup program}
   bbScrapName:      Str15;   {name of system scrap file}
   bbCntFCBs:        Integer; {number of FCBs to allocate}
   bbCntEvts:        Integer; {number of event queue elements}
   bb128KSHeap:      LongInt; {system heap size on 128K Mac}
   bb256KSHeap:      LongInt; {used internally}
   bbSysHeapSize:    LongInt; {system heap size on all machines}
   filler:           Integer; {reserved}
   bbSysHeapExtra:   LongInt; {additional system heap space}
   bbSysHeapFract:   LongInt; {fraction of RAM for system heap}
Field Description
A signature word. For HFS volumes, this field always contains the value $4C4B.
The entry point to the boot code stored in the boot blocks. This
field contains machine-language instructions that translate to BRA.S *+$90 (or BRA.S *+$88, if the older block header format is used), which jumps to the main boot code following the boot block header. This field is ignored, however, if bit 6 is clear in the high-order byte of the bbVersion field or if the low-order byte in that field contains $D.
A flag byte and boot block version number. The high-order byte of this field is a flag byte whose bits have the following meanings:
 0-4Reserved; must be 0
 5Set if relative system heap sizing is to be used
 6Set if the boot code in boot blocks is to be executed
 7Set if new boot block header format is used
If bit 7 is clear, then bits 5 and 6 are ignored and the version number is found in the low-order byte of this field. If that byte contains a value that is less than $15, the Operating System ignores any values in the bb128KSHeap and bb256KSHeap fields and configures the System heap to the default value contained in the bbSysHeapSize field. If that byte contains a value that is greater than or equal to $15, the Operating System sets the System heap to the value in bbSysHeapSize. In addition, the Operating System executes
the boot code in the bbEntry field only if the low-order byte contains $D.
If bit 7 is set, the Operating System inspects bit 6 to determine whether to execute the boot code contained in the bbEntry field and bit 5 to determine whether to use relative System heap sizing. If bit 5 is clear, the Operating System sets the System heap to the value

in bbSysHeapSize. If bit 5 is set, the System heap is extended by the value in bbSysHeapExtra plus the fraction of available RAM specified in bbSysHeapFract.
Used internally.
The name of the System file.
The name of the shell file. Usually, the system shell is the Finder.
The name of the first debugger installed during the boot process. Typically this is Macsbug.
The name of the second debugger installed during the boot process. Typically this is Disassembler.
The name of the file containing the startup screen. Usually this is StartUpScreen.
The name of the startup program. Usually this is Finder.
The name of the system scrap file. Usually this is Clipboard.
The number of file control blocks (FCBs) to put in the FCB buffer. In system software version 7.0 and later, this field specifies only the initial number of FCBs in the FCB buffer, because the Operating System can usually resize the FCB buffer if necessary. See "File Control Blocks" on page 2-81 for details on the FCB buffer.
The number of event queue elements to allocate. This number determines the maximum number of events that the Event Manager can store at any one time. Usually this field contains the value 20.
The size of the System heap on a Macintosh computer having
128 KB of RAM.
The size of the System heap on a Macintosh computer having
512 KB or more of RAM. This field might be ignored, as explained in the description of the bbVersion field.
The minimum amount of additional System heap space required. If bit 5 of the high-order word of the bbVersion field is set, this value is added to bbSysHeapSize.
The fraction of RAM available to be used for the System heap. If
bit 5 of the high-order word of the bbVersion field is set, this fraction of available RAM is added to bbSysHeapSize.

Previous Book Contents Book Index Next

© Apple Computer, Inc.
2 JUL 1996