flat assembler
Message board for the users of flat assembler.

Index > OS Construction > how to turn off a PC?

Author
Thread Post new topic Reply to topic
zhak



Joined: 12 Apr 2005
Posts: 501
Location: Belarus
zhak 11 Aug 2005, 21:13
There are many different ways to reboot a PC, but how to turn off the power?
Post 11 Aug 2005, 21:13
View user's profile Send private message Reply with quote
gunblade



Joined: 19 Feb 2004
Posts: 209
gunblade 11 Aug 2005, 23:45
If your bios has APM support, the following should do it.

Code:
mov ax, 0x5307
mov bx, 1
mov cx, 3
int 0x15    


taken from the linux kernel apm.c, although the apm docs says that action 3 (off) cant be used with device 1 (ALL). might as well try and see Wink

Edit: And if that doesnt work, try it out with
Code:
mov bx, 0    

rather than
Code:
mov bx, 1    


if that still doesnt work, its likely your bios doesnt have APM support
Post 11 Aug 2005, 23:45
View user's profile Send private message Reply with quote
Night Rider



Joined: 28 Jul 2005
Posts: 72
Night Rider 11 Aug 2005, 23:56
Post 11 Aug 2005, 23:56
View user's profile Send private message ICQ Number Reply with quote
Night Rider



Joined: 28 Jul 2005
Posts: 72
Night Rider 11 Aug 2005, 23:58
This is method using BIOS, but there are ways of direct hardware ACPI uni-unterface.
Post 11 Aug 2005, 23:58
View user's profile Send private message ICQ Number Reply with quote
Night Rider



Joined: 28 Jul 2005
Posts: 72
Night Rider 12 Aug 2005, 00:01
Ways of using
Post 12 Aug 2005, 00:01
View user's profile Send private message ICQ Number Reply with quote
THEWizardGenius



Joined: 14 Jan 2005
Posts: 382
Location: California, USA
THEWizardGenius 12 Aug 2005, 01:38
How do you program ACPI? The APM examples can be derived from the APM spec documentation (which describes all the BIOS calls) but ACPI specs do not describe BIOS calls, hardware support, or anything. Does anyone know how to "tell" ACPI to shutdown? No websites or documents that I've seen do.

Note: I wouldn't use the APM code if I were you. On my computer, for example, the BIOS merely prints gibberish on the screen and crashes. Not all systems support it, or support it properly/well, so it's unsafe to use it. There's a BIOS call for detecting APM, but even that crashes my PC. On older laptops, however, it works virtually every time (including my 486 Wink )

If I remember right, MenuetOS used to have APM code but they removed it due to compatibility issues.

It's kinder to print a "It is now safe to turn your computer off" message and halt, ala Windows 95, rather than expect the user to put up with nonsense all over the screen and no more response from the OS!
Post 12 Aug 2005, 01:38
View user's profile Send private message AIM Address Reply with quote
smiddy



Joined: 31 Oct 2004
Posts: 557
smiddy 12 Aug 2005, 04:48
zhak wrote:
There are many different ways to reboot a PC, but how to turn off the power?


Sorry, but I have to:

The On/Off button on the front of the computer, push it! Razz Razz

Seriously, there are many ways of turning of the computer, but usually they are not the same for all computers. ACPI is one ay, another are the BIOS calls. Try looking at MenuetOS to see that code. There is a snippet at the end of a routine (the name escapes me now) with several BIOS calls that need to be done in order for it to work; but it doesn' t work on all machines.
Post 12 Aug 2005, 04:48
View user's profile Send private message Reply with quote
Chewy509



Joined: 19 Jun 2003
Posts: 297
Location: Bris-vegas, Australia
Chewy509 12 Aug 2005, 06:11
THEWizardGenius wrote:
How do you program ACPI?

ACPI is accessed via an entry listed in the ACPI Tables (see int 15h, e820h). You normally read the ACPI Config table, find the system information table, and from there modify the system state table. To power off the system just set the system power state (S0) to D3 (power-off).

see: www.acpi.info -> ACPI v3.0, Section 5.
Post 12 Aug 2005, 06:11
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.