Razorback
NewsProjectsGuidesResourcesContact

Resource Index

Quick Links
APMTOGL

APMTOGL is a tiny COM program for Windows 9x that modifies WIN.COM to enable or disable APM poweroff when shutting down Windows. This program and its source code are released to the public domain.

Floppy disk Download APMTOGL 1.1 (or COM executable only)

It's now safe to turn off your computer.

How does it work?

When you shut down Windows 9x, it tries to call the APM BIOS in real mode to power off all devices, effectively turning off your computer. (If you're using ACPI, it calls an alternate poweroff routine, so APMTOGL will have no effect.) The relevant disassembled code amounts to a couple documented standard BIOS calls:

mov	ax, 5301h	; AH = APM handle, AL = connect real
			; mode interface
			
xor	bx, bx		; Device ID always 0
			; (XORing a register onto itself
			; is common practice to zero it)
			
int	15h		; call BIOS with parameters
			; so APM interface is connected

mov ax, 530Eh	; AL = set APM BIOS version
xor bx, bx		; always 0
mov cx, 0102h	; CH = major version, CL = minor version
int 15h

mov	ax, 5307h	; AL = set power state
mov	bx, 0001h	; BX = device ID (all devices)
mov	cx, 0003h	; CX = power state (off)
int	15h		; call BIOS again to power off

APMTOGL searches for the bytes representing the above code and modifies two of them to make the code look more like this:

mov	ax, 5307h	; AL = set power state
mov	bx, 0001h	; BX = device ID (all devices)
mov	cx, 0003h	; CX = power state (off)
nop			; do absolutely nothing
nop

This effectively emulates what would happen if you were to shut down Windows 9x on an AT system, should you be running it on an ATX system, some laptop, or a virtual machine. Attempting to power off all devices on an AT system fails even if it has an implementation of APM. Some later dual AT/ATX systems may come closer to accomplishing the task with an AT power supply, but hang on a blank screen.

If APMTOGL finds that it has already previously modified WIN.COM to disable APM poweroff, it will restore the function when it is run again.

Command Line Switches

You can get this output by typing APMTOGL /? at the command line for a reference on what switches you can use. Note that /C, /D, or /E must come before the filename if one is to be specified.

APMTOGL v1.1 -- public domain
Enable or disable APM poweroff in Windows 9x.

Usage: APMTOGL [ /C | /D | /E ] [filename]

  /C            Check status.
  /D            Force disable APM poweroff.
  /E            Force enable APM poweroff.
  [filename]    Modify a specific WIN.COM file.

APMTOGL has no effect if ACPI is used.
Drop by at razorback95.com