www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/07/05/11:08:08

Date: Sat, 5 Jul 1997 08:06:21 -0700 (PDT)
Message-Id: <199707051506.IAA24406@adit.ap.net>
Mime-Version: 1.0
To: James MacDonald <trill AT xnetbook DOT demon DOT co DOT uk>
From: Nate Eldredge <eldredge AT ap DOT net>
Subject: Re: CWSDPMI halting interrupt 19 (reboot)
Cc: djgpp AT delorie DOT com

At 07:28  7/4/1997 +0100, you wrote:
>In message <199707041814 DOT LAA22009 AT adit DOT ap DOT net>, Nate Eldredge
><eldredge AT ap DOT net> wrote :
>>So perhaps INT 19 is not the best way to reboot. Other solutions:
>>The standard way to reboot has always been a real-mode jump to F000h:FFF0h.
>>For a warm boot, store 1234h at 0040h:0072h first; for a cold boot, store
0000h.

>Well, how do you do that from C?
>I don't want to use TASM.

How about this (untested)?
#include <dpmi.h>
void reboot(void)
{
   __dpmi_regs registers;
#ifdef WARMBOOT
   _farpokew(_dos_ds,0x00472,0x1234); /* tell it to warm boot
#else
   _farpokew(_dos_ds,0x00472,0x0000); /* tell it to cold boot
#endif
   registers.x.ss = 0;
   registers.x.sp = 0; /* have it make its own stack */
   registers.x.flags = 0; /* it can figure out those too */
   registers.x.cs = 0xF000;
   registers.x.ip = 0xFFF0; /* go to 0xF000:0xFFF0 */
   __dpmi_simulate_real_mode_procedure_retf(&registers);
   /* Note that we actually did a far call, but it makes no difference
      since it should never return anyway */
   /* If we get here, something went wrong */
   fprintf(stderr,"Panic! Attempt to reboot didn't work!\n");
}

HTH

Nate Eldredge
eldredge AT ap DOT net



- Raw text -


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