🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.ibm.pc.programmer
Article #1319

Re: How to do a warm-boot from a C program

#1319
From: James R. Howard
Date: Tue, 20 Feb 1990 21:20
48 lines
1747 bytes
In article <2028@milton.acs.washington.edu>,
pingpong@milton.acs.washington.edu (jimmy) writes:
> Does anyone know how to do a boot from a C program?
> 
> What I really want is whenever something goes wrong in my C program,
(e.g. Null
> pointer reference, etc.) instead of going back to DOS, do a ctrl-alt-del.
> 
> I am using Quick C.
> 
> Thanks in advance.
> 
> -Jimmy.


Well, if it is an AT system (IBM compatible) you can write 0xFE to port
64h on the 
keyboard controller to perform a hard reset.   See the IBM AT Tech Ref,
pg 1-54 
for the details.  The 0xFE is a mask value, leaving everything high
except for bit 0.
Bit 0 of the kbd controller's output is connected to system reset.  

So,  a quickc routine to do that would be:

#include <conio.h>

main()
{
int	port, mask;

port = 0x64;
mask=0xfe;

outp(port,mask)
}


That will do the trick....

--------------------------------------------------------------
James Howard
..cs.utexas.edu!dell!mustang!jrh   or    jrh@mustang.dell.com

"I've got a firm policy on gun control, if there's a gun       
around, I want to be the one controlling it."          
-- Clint Eastwood 
--------------------------------------------------------------
Technical Details
Message-ID: <2236@uudell.dell.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!milano!uudell!mustang!jrh
References: <2028@milton.acs.washington.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!milano!uudell!mustang!jrh
From: jrh@mustang.dell.com (James R. Howard)
Newsgroups: comp.sys.ibm.pc.programmer
Subject: Re: How to do a warm-boot from a C program
Keywords: boot, C
Message-ID: <2236@uudell.dell.com>
Date: 20 Feb 90 21:20:59 GMT
References: <2028@milton.acs.washington.edu>
Sender: news@uudell.dell.com
Reply-To: jrh@mustang.dell.com (James R. Howard)
Distribution: na
Organization: Dell Computer Corp.
Lines: 48