ret
-; APM is not supported
-apm_error:
- mov ch, 9 ; Our string is 9 characters long
- mov si, apm_err
- call print_bytes_si
-
- jmp $ ; Infinite loop
-
-; Check APM support
-apm_chk:
- mov ah, 0x53 ; This is an APM command
- mov al, 0x00 ; APM: Installation Check
- mov bx, 0x0000 ; Device ID (0 is APM BIOS)
- int 0x15 ; Call
-
- jc apm_error ; Carry flag is set if there was an error
-
- cmp ah, 1 ; APM major version must be at least one
- jb apm_error
-
- cmp al, 1 ; APM minor version must be at least one
- jb apm_error
-
- ret
-
-
-; Disconnect from any APM interface
-apm_disco:
- mov ah, 0x53 ; This is an APM command
- mov al, 0x04 ; APM: Disconnect
- mov bx, 0x0000 ; Device ID (0 is APM BIOS)
- int 0x15 ; Call
-
- jc .apm_disco_error ; Carry flag is set if there was an error
- jmp .apm_disco_success
-
-; Disconnecting any APM interface failed
-.apm_disco_error:
- cmp ah, 0x03 ; Error code for no interface connected
- jne apm_error
-
-; No interface are connected now
-.apm_disco_success:
- ret
-
-; Connect to an APM interface
-apm_connect:
- mov ah, 0x53 ; This is an APM command
- mov bx, 0x0000 ; Device ID (0 is APM BIOS)
- int 0x15 ; Call
-
- jc apm_error ; Carry flag is set if there was an error
- ret
-
-; Set the APM Driver Version to 1.1
-apm_drv_init:
- mov ah, 0x53 ; This is an APM command
- mov al, 0x0e ; APM: Set Driver Supported Version
- mov bx, 0x0000 ; Device ID (0 is APM BIOS)
- mov ch, 1 ; APM Driver Major Version Number
- mov cl, 1 ; APM Driver Minor Version Number
- int 0x15 ; Call
-
- jc apm_error ; Carry flag is set if there was an error
- ret
-
-; Enable APM Power Management
-apm_mgmt_on:
- mov ah, 0x53 ; This is an APM command
- mov al, 0x08 ; APM: Change power management state
- mov bx, 0x0001 ; on all devices
- mov cx, 0x0001 ; to on
- int 0x15 ; Call
-
- jc apm_error ; Carry flag is set if there was an error
- ret
-
-; Power down the system
-apm_power_off:
- mov ah, 0x53 ; This is an APM command
- mov al, 0x07 ; APM: Set power state
- mov bx, 0x0001 ; on all devices
- mov cx, 0x0003 ; to off
- int 0x15 ; Call
-
- jc apm_error ; Carry flag is set if there was an error
- ret
-
; Main
boot:
- call apm_chk ; Is APM supported?
- call apm_disco ; Disconnect from any APM interface
-
- mov al, 0x01 ; Interface to connect to: Real Mode
- call apm_connect ; Connect to APM interface
-
- call apm_drv_init ; Set the APM Driver Version to 1.1
- call apm_mgmt_on ; Enable Power Management
-
; Clear the screen
mov ah, 0x06
mov al, 0x00
mov dl, 0 ; Column
int 0x10
- mov ch, 5 ; Our string is 5 characters long
+ mov ch, 33 ; Our string is 33 characters long
mov si, hello
call print_bytes_si
- mov ch, 29 ; Our string is 29 characters long
- mov si, paktc ; paktc: Press any key to continue
- call print_bytes_si
-
- mov ah, 0x00 ; Keyboard: Read key press
- int 0x16 ; Call
-
- call apm_power_off
jmp $ ; Infinite loop
-hello db 'foo', 13, 10 ; \r\n
-apm_err db 'APM Error'
-paktc db 'Press any key to continue... '
+hello db 'Welcome to loadnothing stage 1!', 13, 10 ; \r\n
times (446 - ($ - $$)) db 0x00