www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/05/27/15:30:12

From: almeidaj AT mail DOT com (Almeida J.)
Newsgroups: comp.os.msdos.djgpp
Subject: Faq22_26 - The UPDATE
Date: Sun, 27 May 2001 19:15:02 GMT
Message-ID: <3b1150fe.6221792@news.esoterica.pt>
X-Newsreader: Forte Free Agent 1.21/32.243
Organization: VIA NET.WORKS Portugal - Servico de News
Cache-Post-Path: isis.esoterica.pt!unknown AT por207 DOT esoterica DOT pt
X-Cache: nntpcache 2.3.3 (see http://www.nntpcache.org/)
Cache-Post-Path: sirith.esoterica.pt!unknown AT isis DOT esoterica DOT pt
X-Cache: nntpcache 2.3.3 (see http://www.nntpcache.org/)
Lines: 75
NNTP-Posting-Host: 195.22.0.29
X-Trace: 990990977 news.dpn.de 293 195.22.0.29
X-Complaints-To: abuse AT dpn DOT de
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Because, I think Faq22_26 ought to be updated, here's my humble contribution.
This thread tries to resume all mail archives (if someone's idea was left
behind, please include it, by posting a reply), concerning subjects:
	- "How to reboot a PC."
	- "How to make cold / warm reset."
	- "How to close the windows DOS box"
under a windows DOS box (under plain DOS I think the subject has been clearly
covered), and have been tested by me under windows 98 and windows 98SE.

The several ways to accomplish this, were someone else's ideas, not mine (give
them credit for that, not to me).
This is divided in 3 sections:
	1- "Fake solutions."
	2- "Successfully closing the windows Dos box"
	3- "The working solution(s)"

1.1 /*Sending FFh command to the port 60h*/
 	outportb (0x60, 0xFF);

1.2 /*Sending this commands to this ports*/
	outportb(0xCF9, 4);
	outportb(0xCF9, 2);	

2.1 /* INT 19h handler via __dpmi_int instruction*/
	 __dpmi_int(0x19, &regs);

2.2 /*Literal INT 19h
	 __asm__("int $0x19");

2.3 /*Sending FEh command to the port 64h*/
	outportb (0x64, 0xFE);

2.4 /*preceded 2.3 by a test whether the keyboard buffer is full*/
	 __asm__ ("kbdfull:
	inb $0x64, %al
	testb $2, %al
	jnz kbdfull
	movb $0xFE, %al
	outb %al, $0x64
	");

2.4 /*preceding 2.3 by sending 00h to port 64h*/
	outportb(0x3F2,0x00);
	outportb (0x64, 0xFE);

2.5 /*Jumping to F000:FFF0, warm boot=0x1234*/
	_farpokew(_dos_ds, 0x00472, 0x1234);
	regs.x.cs = 0xf000;
	regs.x.ip = 0xfff0;
	regs.x.ss = regs.x.sp = regs.x.flags = 0;
	__dpmi_simulate_real_mode_procedure_retf(&regs);

2.6 /*Jumping to F000:FFF0, cold boot=0x0000*/
	 _farpokew(_dos_ds, 0x00472, 0x0000);
	regs.x.cs = 0xf000;
	regs.x.ip = 0xfff0;
	regs.x.ss = regs.x.sp = regs.x.flags = 0;
	__dpmi_simulate_real_mode_procedure_retf(&regs);

3.1 /*Ugly solution*/
     /*calling a windows DLL function,  ...but you need user help*/
	system("RUNDLL32.EXE User,ExitWindows");

3.2 /*Less ugly solution (not windows DLL dependent)*/
     /*Force the user to make a hardware reset*/
     /*disable all interrupts, loop forever*/
	__asm__("
	cli
	sucks:
	jmp sucks
	");

Thanks to all,
Jorge Almeida

- Raw text -


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