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
27 jb print_bytes_si_loop
31 ; APM is not supported
33 mov ch, 9 ; Our string is 9 characters long
41 mov ah, 0x53 ; This is an APM command
42 mov al, 0x00 ; APM: Installation Check
43 mov bx, 0x0000 ; Device ID (0 is APM BIOS)
46 jc apm_error ; Carry flag is set if there was an error
48 cmp ah, 1 ; APM major version must be at least one
51 cmp al, 1 ; APM minor version must be at least one
57 ; Disconnect from any APM interface
59 mov ah, 0x53 ; This is an APM command
60 mov al, 0x04 ; APM: Disconnect
61 mov bx, 0x0000 ; Device ID (0 is APM BIOS)
64 jc .apm_disco_error ; Carry flag is set if there was an error
65 jmp .apm_disco_success
67 ; Disconnecting any APM interface failed
69 cmp ah, 0x03 ; Error code for no interface connected
72 ; No interface are connected now
76 ; Connect to an APM interface
78 mov ah, 0x53 ; This is an APM command
79 mov bx, 0x0000 ; Device ID (0 is APM BIOS)
82 jc apm_error ; Carry flag is set if there was an error
85 ; Set the APM Driver Version to 1.1
87 mov ah, 0x53 ; This is an APM command
88 mov al, 0x0E ; APM: Set Driver Supported Version
89 mov bx, 0x0000 ; Device ID (0 is APM BIOS)
90 mov ch, 1 ; APM Driver Major Version Number
91 mov cl, 1 ; APM Driver Minor Version Number
94 jc apm_error ; Carry flag is set if there was an error
97 ; Enable APM Power Management
99 mov ah, 0x53 ; This is an APM command
100 mov al, 0x08 ; APM: Change power management state
101 mov bx, 0x0001 ; on all devices
102 mov cx, 0x0001 ; to on
105 jc apm_error ; Carry flag is set if there was an error
108 ; Power down the system
110 mov ah, 0x53 ; This is an APM command
111 mov al, 0x07 ; APM: Set power state
112 mov bx, 0x0001 ; on all devices
113 mov cx, 0x0003 ; to off
116 jc apm_error ; Carry flag is set if there was an error
121 call apm_chk ; Is APM supported?
122 call apm_disco ; Disconnect from any APM interface
124 mov al, 0x01 ; Interface to connect to: Real Mode
125 call apm_connect ; Connect to APM interface
127 call apm_drv_init ; Set the APM Driver Version to 1.1
128 call apm_mgmt_on ; Enable Power Management
140 ; Move cursor to 0, 0 on page 0
147 mov ch, 5 ; Our string is 5 characters long
151 mov ch, 29 ; Our string is 29 characters long
152 mov si, paktc ; paktc: Press any key to continue
155 mov ah, 0x00 ; Keyboard: Read key press
159 jmp $ ; Infinite loop
161 hello db 'foo', 13, 10 ; \r\n
162 apm_err db 'APM Error'
163 paktc db 'Press any key to continue... '