[ Usenet FAQs | Web FAQs | Documents | RFC Index ]
    Search the FAQ Archives

Part1 - Part2 - Part3 - Single Page

Top Document: x86 Assembly Language FAQ - General Part 3/3
Previous Document: 29. .obj File Format
Next Document: 31. Other FAQs


30. Rebooting from Software


30.1  WARM AND COLD REBOOT

Within DOS, there are two types of rebooting.  There is the warm reboot
that is evoked by pressing the "Ctrl-Alt-Del" key combination.  During
this reboot, all Power On System Tests, POSTs, are performed with the
exception of the memory tests.  In addition to the POSTs, interrupt
vectors are reinitialized and system timers reinitialized.  In other
words, the BIOS code initializes the computer system to such a state
that the computer system is ready for loading the operating system.
Issuing an interrupt 19h does the loading of the operating system.

The second type of rebooting is a cold reboot that occurs when the
system is turned on.  The only difference between a cold reboot and a
warm reboot is the performing of the memory tests.

30.2  PERFORMING A REBOOT FROM SOFTWARE

Whether a cold or warm reboot is performed depends upon the value if the
reset flag in the ROM BIOS data area.  If this flag is set to 1234h, a
warm reset is performed.  Any other value results in a cold reboot.
Usually a zero is loaded for the cold reboot.  Code snippets to do this
are:

ROMBIOS_DATA    segment at 0400h
    org 72h
ResetFlag   dw  ?
ROMBIOS_DATA    ends

ROMBIOS     segment at 0f000h
    org 0fff0h
Reset   label   far
ROMBIOS ends

In your code:

    mov ax, seg ROMBIOS_DATA
    mov ds, ax
ASSUME ds:ROMBIOS_DATA
    mov ResetFlag, 1234h        ; or 0 if cold reset is desired
    jmp Reset

30.3  WARNINGS!

Neither the warm nor the cold boot flushes buffers, system, smartdrv,
and EMM386, or notifies TSRs.  This can lead to lost of data.  The best
source code that considers most of this is:

    ftp://ftp.simtel.net/pub/simtelnet/msdos/bootutil/reboot33.zip

Full source code is available.

30.4  JUST USING INT 19H

Using this interrupt alone will only reload the operating system onto a
computer system that may not be initialized properly for it.  The
interrupt vectors are not reset but the TSRs that have hooks into the
interrupt table may be overwritten.  Obviously, this can lead to the
system hanging if one of these hooked and overwritten interrupts is
called.  Other problems can be timers not reset or add-on cards not
reinitialized properly.  So, do NOT use Int 19h to reboot the computer.

30.5  USING F000:E05B INSTEAD OF F000:FFF0 AS THE JUMP ADDRESS

In the original IBM ROM BIOS, the instruction at f000:fff0 was a long
jump to f000:e05b.  Some programs skipped the jump at f000:fff0 and went
directly to the second address which is the start of the reset procedure
in ROM BIOS.  I checked my 386 with non-IBM BIOS, and the start of the
reset procedure is at the same address.  I believe that using the second
address is dangerous because there is not any guarantee that it will
stay the same.  In addition, if you are rebooting the computer what is
the reason in saving a few cycles!  Stay with the address f000:fff0 as
the jump there always will take the execution path to the correct code.

Contributor:  Raymond Moon, raymoon@moonware.dgsys.com
Last changed: 20 Dec 96



Top Document: x86 Assembly Language FAQ - General Part 3/3
Previous Document: 29. .obj File Format
Next Document: 31. Other FAQs

Part1 - Part2 - Part3 - Single Page


[ Usenet FAQs | Web FAQs | Documents | RFC Index ]

Send corrections/additions to the FAQ Maintainer:
raymoon@moonware.dgsys.com

Last Update October 22 2009 @ 05:22 AM

Some parts © 2009 Advameg, Inc.