BITS 16 ; THIS LIBARY IS IN REALLY BAD SHAPE ; Power_off is okay to use power_check: ;perform an installation check mov ah,53h ;this is an APM command mov al,00h ;installation check command xor bx,bx ;device id (0 = APM BIOS) int 15h ;call the BIOS function through interrupt 15h call printCRLF call dumpax ;jc APM_error ;if the carry flag is set there was an error ;the function was successful ;AX = APM version number ;AH = Major revision number (in BCD format) ;AL = Minor revision number (also BCD format) ;BX = ASCII characters "P" (in BH) and "M" (in BL) ;CX = APM flags (see the official documentation for more details) ret power_enable: ;Enable power management for all devices mov ah,53h ;this is an APM command mov al,08h ;Change the state of power management... mov bx,0001h ;...on all devices to... mov cx,0001h ;...power management on. int 15h ;call the BIOS function through interrupt 15h ;jc APM_error ;if the carry flag is set there was an error ret power_off: ;actual shutdown command mov ah, 0x53 mov al, 0x07 mov bx, 0x1 mov cx, 0x3 int 0x15 ret