delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/05/02/01:16:07

Mime-Version: 1.0
To: gregorio AT jet DOT es (Grzegorz Adam Hankiewicz), djgpp AT delorie DOT com
From: Nate Eldredge <nate AT cartsys DOT com>
Subject: Re: What's the code to reboot the computer?
Date: Fri, 1 May 1998 22:10:36 -0700
Message-ID: <19980502051013.AAI531@ppp122.cartsys.com>

At 12:32  5/1/1998 GMT, Grzegorz Adam Hankiewicz wrote:
>Hello.
>
>I've heard there's some asm code which can reboot the computer.
>Does someone have this code? Is ot possible to choose between a warm
>boot and a cold boot?

Under DOS, you can jump to real-mode address F000h:FFF0h. If you want a warm
boot, store 1234h in the word at address 0040h:0072h; otherwise store 0000h.
Or with DJGPP:

void reboot(int warm_boot)
{
  __dpmi_regs r;
  if (warm_boot)
     _farpokew(_dos_ds, 0x00472, 0x1234);
  else
     _farpokew(_dos_ds, 0x00472, 0x0000);
  r.x.cs = 0xf000;
  r.x.ip = 0xfff0;
  r.x.ss = r.x.sp = r.x.flags = 0;
  __dpmi_simulate_real_mode_procedure_retf(&r);
}

I don't know whether this will work from a DOS box; I would suspect not, but
there's only one way to find out...

You can also do some low-level poking of the keyboard controller, which does
a cold reboot. But I don't know how offhand, though the ports.lst of the
Ralf Brown Interrupt List has the necessary data. Note that this is very
severe, could be dangerous, and also may not work under Windows 95.

Nate Eldredge
nate AT cartsys DOT com



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019