14 mov ah, 0x0e ; TTY output
16 mov bl, 0x07 ; Color: Light grey on black background
21 ; Call print_al on all characters in si
22 ; si must be null terminated
24 mov cl, 0 ; Start with iteration 0 - equivalent of int i = 0
26 lodsb ; Load next characet of si into al
32 jb print_bytes_si_loop
36 ; APM is not supported
38 mov ch, 9 ; Our string is 9 characters long
46 mov ah, 0x53 ; This is an APM command
47 mov al, 0x00 ; APM: Installation Check
48 mov bx, 0x0000 ; Device ID (0 is APM BIOS)
51 jc apm_error ; Carry flag is set if there was an error
53 cmp ah, 1 ; APM major version must be at least one
56 cmp al, 1 ; APM minor version must be at least one
62 ; Disconnect from any APM interface
64 mov ah, 0x53 ; This is an APM command
65 mov al, 0x04 ; APM: Disconnect
66 mov bx, 0x0000 ; Device ID (0 is APM BIOS)
69 jc .apm_disco_error ; Carry flag is set if there was an error
70 jmp .apm_disco_success
72 ; Disconnecting any APM interface failed
74 cmp ah, 0x03 ; Error code for no interface connected
77 ; No interface are connected now
81 ; Connect to an APM interface
83 mov ah, 0x53 ; This is an APM command
84 mov bx, 0x0000 ; Device ID (0 is APM BIOS)
87 jc apm_error ; Carry flag is set if there was an error
90 ; Set the APM Driver Version to 1.1
92 mov ah, 0x53 ; This is an APM command
93 mov al, 0x0e ; APM: Set Driver Supported Version
94 mov bx, 0x0000 ; Device ID (0 is APM BIOS)
95 mov ch, 1 ; APM Driver Major Version Number
96 mov cl, 1 ; APM Driver Minor Version Number
99 jc apm_error ; Carry flag is set if there was an error
102 ; Enable APM Power Management
104 mov ah, 0x53 ; This is an APM command
105 mov al, 0x08 ; APM: Change power management state
106 mov bx, 0x0001 ; on all devices
107 mov cx, 0x0001 ; to on
110 jc apm_error ; Carry flag is set if there was an error
113 ; Power down the system
115 mov ah, 0x53 ; This is an APM command
116 mov al, 0x07 ; APM: Set power state
117 mov bx, 0x0001 ; on all devices
118 mov cx, 0x0003 ; to off
121 jc apm_error ; Carry flag is set if there was an error
126 call apm_chk ; Is APM supported?
127 call apm_disco ; Disconnect from any APM interface
129 mov al, 0x01 ; Interface to connect to: Real Mode
130 call apm_connect ; Connect to APM interface
132 call apm_drv_init ; Set the APM Driver Version to 1.1
133 call apm_mgmt_on ; Enable Power Management
145 ; Move cursor to 0, 0 on page 0
152 mov ch, 5 ; Our string is 5 characters long
156 mov ch, 29 ; Our string is 29 characters long
157 mov si, paktc ; paktc: Press any key to continue
160 mov ah, 0x00 ; Keyboard: Read key press
164 jmp $ ; Infinite loop
166 hello db 'foo', 13, 10 ; \r\n
167 apm_err db 'APM Error'
168 paktc db 'Press any key to continue... '
170 times (446 - ($ - $$)) db 0x00