Mail Archives: djgpp/2001/07/05/16:00:14
| Message-ID: | <3B44C546.1020507@nic.fi>
|
| From: | Antti =?ISO-8859-1?Q?Koskip=E4=E4?= <antti DOT koskipaa AT nic DOT fi>
|
| User-Agent: | Mozilla/5.0 (Windows; U; Win95; en-US; rv:0.9.1) Gecko/20010607
|
| X-Accept-Language: | en-us
|
| MIME-Version: | 1.0
|
| Newsgroups: | comp.os.msdos.djgpp
|
| Subject: | Re: Reseting / turning off computer ?
|
| References: | <9hq2q6$cqe$1 AT info DOT cyf-kr DOT edu DOT pl>
|
| Lines: | 41
|
| Date: | Thu, 05 Jul 2001 22:51:34 +0300
|
| NNTP-Posting-Host: | 212.38.225.123
|
| X-Trace: | uutiset.nic.fi 994362707 212.38.225.123 (Thu, 05 Jul 2001 22:51:47 EET DST)
|
| NNTP-Posting-Date: | Thu, 05 Jul 2001 22:51:47 EET DST
|
| Organization: | NIC Tietoverkot Oy - NIC Data Networks Ltd.
|
| To: | djgpp AT delorie DOT com
|
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
| Reply-To: | djgpp AT delorie DOT com
|
Rafal Maj wrote:
> Hi,
> how to reset / turn-off computer ? I remember that this was discussing here,
> but with solution is best ?
> Maybe small example of program that will work both under Lose98 & plain-DOS
> ?
> Thanx,
Reset: outportb(0x64, 0xFE); // works under windows 9x
If you want a "soft" reset (ie ctrl-alt-del type),
do a _farpokeb(_dos_ds, 0x472, 0x1234); before the
outportb. Of course, won't work under windows as
your program runs in V86 mode and the real low memory isn't
mapped blah blah blah...
ATX shutdown: (works under windows too)
#include <dpmi.h>
...
__dpmi_regs r;
r.x.ax = 0x5301;
r.x.bx = 0;
__dpmi_int(0x15, &r);
r.x.ax = 0x5307;
r.x.bx = 1;
r.x.cx = 3;
__dpmi_int(0x15, &r);
r.x.ax = 0x5304;
r.x.bx = 0;
__dpmi_int(0x15, &r);
asm("cli\n\t");
for(;;);
This code is a quick hack and does not check the presence of
APM 1.0. for more info, see Ralf Brown's interrupt list.
--
- Antti
- Raw text -