A replacement master boot record
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Contents
~~~~~~~~
1. Copyright
2. Introduction
3. Basic Installation
4. The boot process
5. Configuration

1. Copyright
~~~~~~~~~~~~

Copyright (C) 1995 Neil Turton

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

See file COPYING for details

2. Introduction
~~~~~~~~~~~~~~~

When a PC is reset, it goes through a series of self tests, and then
attempts to load an operating system. The loading process requires a
number of steps. When booting from a hard disk, these are to read and
execute the first sector of the first hard disk, called the master
boot record, which in turn, reads and executes the first sector of one
of the partitions on that disk, called a boot sector. The program code
on this sector then loads the operating system. The standard MBR
(master boot record) which comes with MSDOS is fairly simple, and
limited in a number of ways. This MBR is more complicated, and
overcomes some of the limitations.

3. Basic Installation
~~~~~~~~~~~~~~~~~~~~~

It is recomended that you test the master boot record with your system
before you install it on the first sector of your hard disk. To do this,
all you need to do is put a blank floppy disk in your first disk drive,
and type "make floppy".

Installing this master boot record is quite easy. Just type
  make install
which will build the boot record and install it on your
hard disk. (/dev/hda)

4. The boot process
~~~~~~~~~~~~~~~~~~~

When the MBR is first loaded it waits for a configurable length of
time, monitoring the keyboard, for key presses. If the MBR detects a
key press, it will interrupt the boot process, and display it's
prompt. Otherwise, it will load the first sector of the default
partition, and execute it. If a disk error occours, the MBR will
display it's prompt.

4.1 The boot prompt
~~~~~~~~~~~~~~~~~~~

The boot prompt looks something like this:

14FA:

This is the list of valid keys which may be pressed. This means that
partitions 1, and 4 can be booted, also the first floppy drive
(F). The A means that 'advanced' mode may be entered, in which any
partition may be booted. The prompt for this mode looks like this:

1234F:

The only other valid key which may be pressed is RETURN, which
continues booting with the default partition.

5. Configuration
~~~~~~~~~~~~~~~~

This master boot record is written to be configurable, and I hope to
write a configuration program to make the configuration process
easier. The configuration is defined by a number of parameters. At
present, these must be changed in the source code for the MBR. There
are two built-in configurations, one of which closely mimics the
DOS MBR, and the other which has a 1 second delay, and allows a
floppy boot, or advanced mode.

5.1 flags
~~~~~~~~~

There is space for 8 flags, of which 6 are used. These mark which
letters appear in the boot prompt. The bits are assigned as follows

bit	7 6 5 4 3 2 1 0
key	A     F 4 3 2 1

(Advanced,Floppy,Partitions 4,3,2,1)

5.2 Default and interrupt keys (def)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The def parameter stores the default partition, and the keys that
may be pressed to interrupt the boot process. They are assigned
as follows

bit	7   6   5   4   3   2   1   0
Use	K  S/C              |default|

The default partition is a number in the range 0-7, and is defined
according to the key needed to activate that choice at the boot
prompt.

default	7 6 5 4 3 2 1 0
key	      F 4 3 2 1

Also, the value 7 means boot the first partition which has the
bootable flag set in the partition table. The values 5 and 6 are
undefined.

If bit 7 is set in the def parameter, any character key may be pressed
to interrupt the boot process. If bit 6 is set, any shift/control key
may be held down to interrupt the boot process.

5.3 delay
~~~~~~~~~

The delay parameter is simply the number of timer ticks (18.2 times a
second) which the MBR will wait to be interrupted by a keystroke. The
exception to this is that the value 255 means always use the boot
prompt.

5.4 drive
~~~~~~~~~

This parameter determines which drive the partitions are on. For most
situations, this will be 0x80, meaning the first hard drive.
