Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Assembly (http://www.programmingforums.org/forum20.html)
-   -   Power Off Question (http://www.programmingforums.org/showthread.php?t=11684)

grimpirate Oct 24th, 2006 9:46 PM

Power Off Question
 
I'm curious if anyone can refer me to a URL or explain how exactly it is that I can achieve a soft power down in assembly code. Like is there a certain interrupt I should call? Some special value I need to place into memory? A particular opcode? Any help is appreciated.

mrynit Oct 25th, 2006 5:21 AM

i just did a google search "assembly reboot code"

http://www.faqs.org/faqs/assembly-la...section-5.html

hope that helps

DaWei Oct 25th, 2006 6:06 AM

I'm thinking that's not at all what he wants. I would suggest beginning with something like ACPI. Note that not all machines are equipped with this ability. If you're dealing with some relatively common machine, a peep at the BIOS should tell you if APM is available. For something like a desktop PC, you're getting into the driver area, which suggests that you can't just pop some inline assembly into your app.

grimpirate Oct 25th, 2006 11:06 PM

Ya you're on the money DaWei, but thanks for the help mrynit I actually found those tutorials myself and wrote a brief reboot program. I'm not trying to pop some inline assembly into my prog. I was actually hoping to write a small boot loader like the Hello World! example I posted here in the assembly forum, but that once it's done, rather than keeping the computer in a non-terminating loop it waits for a keyboard input and then powers down. Figuring out how to do it within Windows would likely be more complicated then I could understand. Thanks for that link though DaWei someone on the IRC chat had said something referring to ACPI in MenuetOS but I had no clue what they meant.

grimpirate Oct 26th, 2006 1:46 AM

Found what I needed, it was the interrupt 0x15. Of course, proper coding as you pointed out DaWei would require that I perform a check that this interrupt is actually existent and functional. Anyhow, here's the FASM code for a power down.
:

mov    ax,    0x5307
mov    bx,    0x0001
mov    cx,    0x0003
int    0x15



All times are GMT -5. The time now is 12:52 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC