blob: dd03bde3086ddac511be173c4ffb3728fbd45dbc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; name: jaspos_power_connect
;; @param none
;; @return none
;; Connects the APM interface or displays an APM
;; error code on failure
;;
jaspos_power_connect:
push power_msgConnecting ; Display a message saying that we're connecting the interface
call jaspos_monitor_dispstring ;
mov ax, 0x5301 ; ax = 0x5301 - connect interface subfunction
xor bx, bx ; zero-out bx
int 0x15 ; Int 15.5301 - connect APM interface
jc .error ; catch errors from interrupt
.quit:
ret
.error:
push msgFailedWithCode ; Display a message explaining that it failed
call jaspos_monitor_dispstring ;
mov [free_ram+4], byte 0 ; Ensure there'll be a null-terminator
push free_ram + 4 ; arg1 = buffer
push ax ; arg2 = decimal number
call jaspos_strutils_d2str ; Convert decimal to string
push free_ram ; Load address on NumberBuffer for printing
call jaspos_monitor_dispstring ; Print NumberBuffer
jmp .quit ; Jump to .quit for some POPping and then return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; name: jaspos_power_shutdown
;; @param none
;; @return none
;; Powers the computer off using the (already
;; connected) APM interface
;;
jaspos_power_shutdown:
mov ax, 0x5307 ; ax = 5307 - Set power state
mov bx, 0x0001 ; bx = 0001 - Device: BIOS
mov cx, 0x0003 ; cx = 0003 - power state: off
int 0x15 ; Int 15.5307 - set power state using APM interface
jc .error ; Catch errors
ret
.error:
push msgFailedWithCode ; Warn user of error
call jaspos_monitor_dispstring ;
mov [free_ram+5], byte 0
push free_ram + 4
push ax
call jaspos_strutils_d2str ; Convert AH to string in NumberBuffer
push free_ram ; Print NumberBuffer
call jaspos_monitor_dispstring ;
jmp jaspos.panic
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|