x86 Assembly

Moderators: None (Apply to moderate this forum)
Number of threads: 4563
Number of posts: 16029

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
reboot pc under DOS Posted by edridil on 6 Sept 2004 at 10:13 AM
What I have to do is reboot the pc working under DOS (not with CTRL-ALT-DEL!!) and using MASM (I have to use MASM..)

How can I do?
I found int 19h, is this all?
Report
Re: reboot pc under DOS Posted by ASHLEY4 on 6 Sept 2004 at 12:41 PM
Here's some info:
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



\\\\||////
(@@)
ASHLEY4.
Report
Re: reboot pc under DOS Posted by CPU Master on 6 Sept 2004 at 8:08 PM
: What I have to do is reboot the pc working under DOS (not with CTRL-ALT-DEL!!) and using MASM (I have to use MASM..)
:
: How can I do?
: I found int 19h, is this all?
:
Why do you have to use MA$M? Just wondering...
Report
Re: reboot pc under DOS Posted by edridil on 7 Sept 2004 at 12:25 AM
:
: Why do you have to use MA$M? Just wondering...
:

It's for an exam, and this is what the prof. wants, that's all
Report
Re: reboot pc under DOS Posted by Juli on 7 Sept 2004 at 5:33 AM
: What I have to do is reboot the pc working under DOS (not with CTRL-ALT-DEL!!) and using MASM (I have to use MASM..)
:
: How can I do?
: I found int 19h, is this all?
:

Are you aware that the code won't work in a DOS box.
Report
Re: reboot pc under DOS Posted by edridil on 7 Sept 2004 at 12:21 PM
: : What I have to do is reboot the pc working under DOS (not with CTRL-ALT-DEL!!) and using MASM (I have to use MASM..)
: :
: : How can I do?
: : I found int 19h, is this all?
: :
:
: Are you aware that the code won't work in a DOS box.
:

I know, thanks ;)
Report
Re: reboot pc under DOS Posted by theresajayne on 4 Sept 2012 at 9:47 AM
I have not done it for a while but int 19 would sometimes crash the machine so we moved to the following code which programatically performs a reboot

MOV AL,0Fh
OUT 64H,AL

4 bytes to rule them all and in the darkness Reboot them....

We saved this as reboot.com :)

Theresa
Report
Re: reboot pc under DOS Posted by theresajayne on 4 Sept 2012 at 9:49 AM
I have not done it for a while but int 19 would sometimes crash the machine so we moved to the following code which programatically performs a reboot

MOV AL,0Fh
OUT 64H,AL

4 bytes to rule them all and in the darkness Reboot them....

We saved this as reboot.com :)

Theresa
Report
Re: reboot pc under DOS Posted by theresajayne on 4 Sept 2012 at 9:53 AM
I have not done it for a while but int 19 would sometimes crash the machine so we moved to the following code which programatically performs a reboot

MOV AL,0Fh
OUT 64H,AL

4 bytes to rule them all and in the darkness Reboot them....

We saved this as reboot.com :)

Theresa



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.