Powering off a computer using ACPI from DOS
By default, DOS does not come with a command to shut down or power off the computer. Back in the days, all you had to do is just to make sure that there was no disk activity going on, and press the hard power button (or in some case, yank the power cord). With SMARTDRV write buffering or Windows 3.11, you would have to make sure to return to the DOS prompt before the computer power supply can be cut off. But still, you do not need to turn off your computer by issuing a command.
On modern computers switching off is done with the OS issuing an ACPI command telling the motherboard to turn off, which will then put the PS-ON wire (green wire) of the ATX PSU to high and allowing power to the computer to be cut off, except for some standby voltages. This is also how I use an ATX power supply as a lab power supply, by grounding the PS-ON wire and allowing the PSU to turn on by itself. This is the pinout of a typical ATX power supply connector:
As DOS does not support ACPI, there is no built-in way to do this if you run DOS on a modern computer. If DOS is run on a modern laptop, this means you will need to press and hold the power button to force turn off, which is not ideal.
After some research I found a way to soft power off the computer by calling BIOS Service 53h, which is implemented by some motherboards, using the following assembly code:
mov ax,5301h xor bx,bx int 15h mov ax,530eh xor bx,bx mov cx,0102h int 15h mov ax,5307h xor bx,bx inc bx mov cx,0003h int 15h ret
The code works well for most of my computers running DOS. It does not work on my HP Compaq NC6120 – nothing will happen once the code is executed. Your mileage may vary, depending on your BIOS ACPI features.
You can download a copy of the above code here. The executable was compiled using the A86 assembler.