How can I shutdown the computer using only assembly code?
This is the 29 byte program that I have been using to turn the computer off in DOS mode for years.
;Connect to APM API
MOV AX,5301
XOR BX,BX
INT 15
;Try to set APM version (to 1.2)
MOV AX,530E
XOR BX,BX
MOV CX,0102
INT 15
;Turn off the system
MOV AX,5307
MOV BX,0001
MOV CX,0003
INT 15
;Exit (for good measure and in case of failure)
RET
You can lookup more functions with Ralf Brown’s Interrupt List at DJGPP.