Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

how to shutdown computer..

nec2152nec2152 Member Posts: 18
I am looking for how to shutdown computer directly, like windows 98/xp does on new ATX systems, without displaying 'You may safely turn off the computer'.
can anybody help...

Comments

  • jeffleydajeffleyda Member Posts: 390
    : I am looking for how to shutdown computer directly, like windows 98/xp does on new ATX systems, without displaying 'You may safely turn off the computer'.
    : can anybody help...
    :

    http://www.delorie.com/djgpp/doc/rbinter/ix/15/53.html

    INT 15, function 53xx has some function to do such cpu state handling.

    You can also do it directly by accessing the ACPI controller in the southbridge.

    Through ACPI, you can send simple I/O writes to the ACPI block to put the machine into any state you want, including power off.

    If you want to go the ACPI way, there's dos and windows source code available here:

    http://www.oldskool.org/pc/throttle

    -jeff!
  • tsagldtsagld Member Posts: 621
    : : I am looking for how to shutdown computer directly, like windows 98/xp does on new ATX systems, without displaying 'You may safely turn off the computer'.
    : : can anybody help...
    : :
    :
    : http://www.delorie.com/djgpp/doc/rbinter/ix/15/53.html
    :
    : INT 15, function 53xx has some function to do such cpu state handling.
    :
    : You can also do it directly by accessing the ACPI controller in the southbridge.
    :
    : Through ACPI, you can send simple I/O writes to the ACPI block to put the machine into any state you want, including power off.
    :
    : If you want to go the ACPI way, there's dos and windows source code available here:
    :
    : http://www.oldskool.org/pc/throttle
    :
    : -jeff!
    :
    From Windows, you can call
    [code]
    ExitWindowsEx(EWX_POWEROFF, 0);
    [/code]

    Greets,
    Eric Goldstein
    www.gvh-maatwerk.nl

  • Luke7Luke7 Member Posts: 156
    : I am looking for how to shutdown computer directly, like windows 98/xp does on new ATX systems, without displaying 'You may safely turn off the computer'.
    : can anybody help...
    :

    I have the code and executable to do just what you want.

    It'll shutdown XP and Win 2K with just one double click.

    Give me your email and I can send it to you.


  • Chainsaw666Chainsaw666 Member Posts: 198
    Just push the power button!

  • Luke7Luke7 Member Posts: 156
    : Just push the power button!
    :
    :

    You're so funny. Don't quit your day job. :-)

  • holusholus Member Posts: 2
    Did you get some useful information with this old post.
    I
  • BretBret Member Posts: 114
    If the computer is fairly old and only has an APM-compatible BIOS, it's relatively simple to shut down using INT 15h. If the computer is only somewhat old, it may have both APM and ACPI, in which case INT 15h should also work. If the computer is new enough, though, it may only have ACPI. ACPI is nasty.

    The source code for FDAPM (a FreeDOS utility) has what you're looking for.
  • mercury0x000dmercury0x000d Member Posts: 2
    I faced this same problem in making my own OS. Using information I found on Toshihiro Horie's website, I made these routines to do the job:

    DEFINT A-Z
    SUB APMGetVer(vMajor, vMinor, APMState)
    'returns Advanced Power Management BIOS version
    rAX = 0
    rCX = 0
    !mov ax, &h5300
    !mov bx, &h0
    !int &h15
    !mov rAX, ax
    !mov rCX, cx
    vMajor = rAX 256
    vMinor = rAX AND 255
    IF rCX AND 8 THEN
    APMState = 0
    ELSE
    APMState = 1
    END IF
    END SUB

    DEFINT A-Z
    SUB APMActivate (activateFlag)
    'enables APM for everything controlled by the APM BIOS
    'to enable APM, activateFlag = 1
    'to disable APM, activateFlag = 0
    af = 0
    rAX = 0
    !mov ax, &h530D
    !mov bx, &h01
    !mov cx, af
    !int &h15
    !mov rAX, ax
    errorFlag = rAX 256
    select case errorFlag
    CASE 1:sysErr = &h21C:error 1
    CASE 3:sysErr = &h21E:error 1
    CASE 9:sysErr = &h221:error 1
    CASE &h0A:sysErr = &h222:error 1
    end select
    END SUB

    DEFINT A-Z
    SUB APMShutdown
    rAX = 0
    !mov ax, &h5301
    !mov bx, &h0
    !int &h15
    !mov rAX, ax
    SELECT CASE rAX 256
    CASE 2:sysErr = &h21D:error 1
    CASE 5:sysErr = &h21F:error 1
    CASE 7:sysErr = &h220:error 1
    CASE 9:sysErr = &h221:error 1
    CASE &h86:sysErr = &h223:error 1
    END SELECT
    !mov ax, &h530E
    !mov bx, &h00
    !mov cx, &h102
    !int &h15
    'SET POWER STATE OF ALL DEVICES TO OFF...
    !mov ax, &h5307
    !mov bx, &h01
    !mov cx, &h03
    !int &h15
    END SUB

    You would need to execute these routines in the order they're listed. First, determine if the APM BIOS is available, then activate it, then shut everything down. This has worked on every machine I've tried it on so far. In case you're wondering about the lines beginning with "!", this code is in a language called PowerBASIC, which allows the mixing of assembly and traditional BASIC code in one file. Also keep in mind, there's no way to do this under Windows XP and later since Windows traps and stops all direct runs at the hardware. Instead, it just terminates your program.

    Hope this helps :)
    Mercury0x000D
Sign In or Register to comment.