[comp.sys.ibm.pc] Ass. Lang location of drive A:

bill@hpcvlx.HP.COM (Bill Frolik) (08/22/88)

The simplest way to do a programmatic reboot is to write a 1234h to
address 40h:72h (40:72=34, 40:73=12), and then perform a far jump
to address FFFF:0000.  This has the same effect as [ctrl][alt][del].
the 1234h is a special flag that tells the bios to perform a warm boot
rather than a cold one; FFFF:0000 is the power-on reset address.

Once the bios has gone through POST (power-on self-test: determines how
much memory you've got, initializes any adaptors that have their own
on-board bios roms, resets the keyboard and display hardware, etc), 
it issues an Int 19h, which attempts to read drive 0 (80h if hard disk),
cylinder 0, head 0, sector 1 (sector numbers start at 1, not 0) into
location 0000:7C00, and, if successful, jump to that address.  The boot
code read from the disk then takes over -- if you're booting DOS, it will
read in the first of the two hidden system files (generally IBMBIO.COM or
something similar), which performs various initializations and subsequently
loads the second system file (IBMDOS.COM or similar).  You can try issuing
an Int 19h yourself, but if you're already running DOS, and trying to boot
a new DOS over itself don't expect it to work -- the already-running DOS
changes a lot of interrupt vectors which are normally assumed to be pristine
at boot time.

There's another word at 40:13 that says how much memory is in the system
(number of 1K blocks).  DOS looks at this when it boots to figure out how
much RAM it's got available.  If you do the 1234h warm-boot, I don't think
this word gets reset -- if you want to keep something in memory across a 
reboot, you might look at 40:13 to figure out where the end of RAM is
located, stuff your "resident" code up there, then reduce the word at 
40:13 by the number of 1K blocks your "resident" code consumed.  This is
a sometimes-used practice among hardware adaptors that have their own
bios expansion ROMs and require some additional RAM, but in their case
is done during the POST.

Bill Frolik / hp-pcd!bill
Hewlett-Packard / 1010 NE Circle Blvd / Corvallis, Oregon 97330