EXECUTABLE BOOTSECTORS by Guus Surtel
There are some utilities people always prefer to run before doing
anything else with their Atari ST. For example a utility that
sets the date or sets the sync to 60hz. Because they always want
to run it before anything else they put those utilities into an
auto folder. The advantage of an auto folder is that you don't
have to click on the programs in order to start them, the system
automatically starts them while bootting. A disadvantage of this
system is that it costs diskspace and you always have to copy the
auto folder and its contents to a new disk.
When I read about executable bootsectors, I thought it would be
nice to put some standard routines into the bootsector, so that
each time the system restarts it will execute those utilities.
First I will tell you what is in the bootsector.
Bytes Meaning
===== =======
0 - 1 Machinecode branch instruction to the beginning of the
executable machinecode in this sector.
2 - 7 Reserved (at the moment equal to the virgin data 4E).
8 - A Serial number of this disk. The only way that the
operating system knows that you have change the disk is
by means of the serial number. The serial number is
also used in a number of copy protection schemes.
B - C Bytes/Sector. Low byte first for MS-DOS compatibility.
D Number of sectors/clusters (normally 2)
E - F The number of reserved sector.
10 The number of FAT's (File Allocation Tables).
11-12 The number of directory entries. Low byte first
13-14 The number of sectors on the disk.
15 Media descriptor (Not used by the Atari ST).
16-17 The number of sectors in each FAT.
18-19 The number of sectors per track (normally 9).
1A-1B The number of sides on the disk (normally 1 or 2).
1C-1D The number of hidden sectors (Not used by the Atari).
1E-1FD Boot code (if any)
1FE-1FF Checksum of bootsector. If this checksum=$1234 then
this is an executable bootsector.
In order to create a executable bootsector we read the existing
bootsector, modify it and write the bootsector back. We can read
and write the bootsector with the relevant XBIOS routines (FLOPRD
and FLOPWR).
In order to make the bootsector executable we put the machinecode
into the area from 1E till 1FF in the bootsector and put a branch
instruction to the beginning of the machinecode (BRA $1C) at
position 0. Then the prototype routine is called to generate the
required checksum for a bootsector.
The assembly source code (for the Metacomco Assembler) supplied
contains a routine called EXECUTE. This routine is copied into
the bootsector. You can easily extend or replace this routine
with some new, useful routines.
The EXECUTE routine now contains a routine to set the printer
parameters (so I can get good hardcopies of the screen), a
routine to copy the date and time of the keyboard processor to
GEM (you now only have to set the date and time once, when you
power up your computer) and a routine to change the screen
synchronisation (to 60hz in my case).
The program is very simple to use. Just start it and insert the
disk you want to modify. All information (except a possible
machinecode routine in the bootsector) is left untouched.
Disclaimer
The text of the articles is identical to the originals like they appeared
in old ST NEWS issues. Please take into consideration that the author(s)
was (were) a lot younger and less responsible back then. So bad jokes,
bad English, youthful arrogance, insults, bravura, over-crediting and
tastelessness should be taken with at least a grain of salt. Any contact
and/or payment information, as well as deadlines/release dates of any
kind should be regarded as outdated. Due to the fact that these pages are
not actually contained in an Atari executable here, references to scroll
texts, featured demo screens and hidden articles may also be irrelevant.