15 ; Call print_al on all characters in si
16 ; si must be null terminated
18 mov cl, 0 ; Start with iteration 0 - equivalent of int i = 0
20 lodsb ; Load next characet of si into al
26 jb print_bytes_si_loop
30 ; APM is not supported
32 mov ch, 9 ; Our string is 9 characters long
40 mov ah, 0x53 ; This is an APM command
41 mov al, 0x00 ; APM: Installation Check
42 mov bx, 0x0000 ; Device ID (0 is APM BIOS)
45 jc apm_error ; Carry flag is set if there was an error
47 cmp ah, 1 ; APM major version must be at least one
50 cmp al, 1 ; APM minor version must be at least one
56 ; Disconnect from any APM interface
58 mov ah, 0x53 ; This is an APM command
59 mov al, 0x04 ; APM: Disconnect
60 mov bx, 0x0000 ; Device ID (0 is APM BIOS)
63 jc .apm_disco_error ; Carry flag is set if there was an error
64 jmp .apm_disco_success
66 ; Disconnecting any APM interface failed
68 cmp ah, 0x03 ; Error code for no interface connected
71 ; No interface are connected now
75 ; Connect to an APM interface
77 mov ah, 0x53 ; This is an APM command
78 mov bx, 0x0000 ; Device ID (0 is APM BIOS)
81 jc apm_error ; Carry flag is set if there was an error
84 ; Set the APM Driver Version to 1.1
86 mov ah, 0x53 ; This is an APM command
87 mov al, 0x0e ; APM: Set Driver Supported Version
88 mov bx, 0x0000 ; Device ID (0 is APM BIOS)
89 mov ch, 1 ; APM Driver Major Version Number
90 mov cl, 1 ; APM Driver Minor Version Number
93 jc apm_error ; Carry flag is set if there was an error
96 ; Enable APM Power Management
98 mov ah, 0x53 ; This is an APM command
99 mov al, 0x08 ; APM: Change power management state
100 mov bx, 0x0001 ; on all devices
101 mov cx, 0x0001 ; to on
104 jc apm_error ; Carry flag is set if there was an error
107 ; Power down the system
109 mov ah, 0x53 ; This is an APM command
110 mov al, 0x07 ; APM: Set power state
111 mov bx, 0x0001 ; on all devices
112 mov cx, 0x0003 ; to off
115 jc apm_error ; Carry flag is set if there was an error
120 call apm_chk ; Is APM supported?
121 call apm_disco ; Disconnect from any APM interface
123 mov al, 0x01 ; Interface to connect to: Real Mode
124 call apm_connect ; Connect to APM interface
126 call apm_drv_init ; Set the APM Driver Version to 1.1
127 call apm_mgmt_on ; Enable Power Management
139 ; Move cursor to 0, 0 on page 0
146 mov ch, 5 ; Our string is 5 characters long
150 mov ch, 29 ; Our string is 29 characters long
151 mov si, paktc ; paktc: Press any key to continue
154 mov ah, 0x00 ; Keyboard: Read key press
158 jmp $ ; Infinite loop
160 hello db 'foo', 13, 10 ; \r\n
161 apm_err db 'APM Error'
162 paktc db 'Press any key to continue... '