Subversion Repositories Kolibri OS

Rev

Rev 110 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 110 Rev 263
Line 1... Line 1...
1
Advanced Power Management
1
Advanced Power Management
Line 2... Line 2...
2
 
2
 
Line 3... Line 3...
3
SYSTEM CALL
3
SYSTEM CALL
4
 
4
 
5
eax = 70
5
eax = 49
6
dx = íîìåð ôóíêöèè APM BIOS (àíàëîãè÷åí ax â ðåàëüíîì ðåæèìå)
6
dx = íîìåð ôóíêöèè APM BIOS (àíàëîãè÷åí ax â ðåàëüíîì ðåæèìå)
Line 16... Line 16...
16
	0x9046 -  word - flags
16
	0x9046 -  word - flags
Line 17... Line 17...
17
 
17
 
Line 18... Line 18...
18
 
18
 
19
ÈÇÌÅÍÅÍÈß
19
ÈÇÌÅÍÅÍÈß
20
 
20
 
21
sys32.inc
21
bootcode.inc
-
 
22
syscall.inc
Line 22... Line 23...
22
syscall.inc
23
kernel.asm
Line 23... Line 24...
23
kernel.asm
24
bootcode.inc
Line 24... Line 25...
24
bootcode.inc
25
shutdown.inc
25
 
26
 
Line 55... Line 56...
55
        db     0x00
56
        db     0x00
56
        dw     11011111b *256 +10010010b
57
        dw     11011111b *256 +10010010b
57
        db     0x00
58
        db     0x00
58
; --------------- APM ---------------------
59
; --------------- APM ---------------------
59
apm_code_32:
60
apm_code_32:
60
        dw     0x10		; limit 64kb
61
        dw     0x0f        ; limit 64kb
61
        db     0, 0, 0
62
        db     0, 0, 0
62
        dw     11011111b *256 +10011010b
63
        dw     11010000b *256 +10011010b
63
        db     0x00
64
        db     0x00
64
apm_code_16:
65
apm_code_16:
65
        dw     0x10
66
        dw     0x0f
66
        db     0, 0, 0
67
        db     0, 0, 0
67
        dw     10011111b *256 +10011010b
68
        dw     10010000b *256 +10011010b
68
        db     0x00
69
        db     0x00
69
apm_data_16:
70
apm_data_16:
70
        dw     0x10
71
        dw     0x0f
71
        db     0, 0, 0
72
        db     0, 0, 0
72
        dw     10011111b *256 +10010010b
73
        dw     10010000b *256 +10010010b
73
        db     0x00
74
        db     0x00
74
; -----------------------------------------
75
; -----------------------------------------
75
app_code_l:
76
app_code_l:
76
      dw ((0x80000000-std_application_base_address) shr 12) and 0xffff
77
      dw ((0x80000000-std_application_base_address) shr 12) and 0xffff
77
      dw 0
78
      dw 0
Line 93... Line 94...
93
        db     0x00
94
        db     0x00
94
        dw     11010000b *256 +11110010b
95
        dw     11010000b *256 +11110010b
95
        db     0x00
96
        db     0x00
Line 96... Line 97...
96
 
97
 
97
tss0_l:
-
 
Line 98... Line 98...
98
      times (max_processes+10) dd 0,0
98
tss0_l:
99
 
99
 
Line 100... Line 100...
100
.............
100
.............
Line 101... Line 101...
101
.............
101
.............
102
 
102
 
Line 103... Line 103...
103
##############[core\syscall.inc]###################
103
##############[core\syscall.inc]###################
104
 
104
 
105
.............
105
.............
106
.............
106
.............
107
 
-
 
108
 
107
 
Line 109... Line 108...
109
      dd undefined_syscall       ; 65-UTF
108
 
110
      dd sys_process_def         ; 66-Process definitions - keyboard
109
      dd display_number          ; 47-WriteNum
Line 150... Line 149...
150
apm_vf		dd	0
149
apm_vf		dd	0
151
align 4
150
align 4
152
sys_apm:
151
sys_apm:
153
	cmp	word [apm_vf], 0	; Check APM BIOS enable
152
	cmp	word [apm_vf], 0	; Check APM BIOS enable
154
	jne	@f
153
	jne	@f
155
	or	[esp + 40], byte 1	; error
154
	or	[esp + 56], byte 1	; error
156
	mov	[esp + 36], dword 8	; 32-bit protected-mode interface not supported
155
	mov	[esp + 36], dword 8	; 32-bit protected-mode interface not supported
157
	ret
156
	ret
Line 158... Line 157...
158
	
157
	
159
@@:	xchg	eax, ecx
158
@@:	xchg	eax, ecx
Line 160... Line 159...
160
	xchg	ebx, ecx
159
	xchg	ebx, ecx
161
	
160
	
162
	cmp	al, 3
161
	cmp	al, 3
163
	ja	@f
162
	ja	@f
164
	and	[esp + 40], byte 0xfe	; emulate func 0..3 as func 0
163
	and	[esp + 56], byte 0xfe	; emulate func 0..3 as func 0
165
	mov	eax, [apm_vf]
164
	mov	eax, [apm_vf]
166
	mov	[esp + 36], eax
165
	mov	[esp + 36], eax
167
	shr	eax, 16
166
	shr	eax, 16
Line 174... Line 173...
174
	mov	[esp + 24], ebx
173
	mov	[esp + 24], ebx
175
	mov	[esp + 28], edx
174
	mov	[esp + 28], edx
176
	mov	[esp + 32], ecx
175
	mov	[esp + 32], ecx
177
	mov	[esp + 36], eax
176
	mov	[esp + 36], eax
178
	setc	al
177
	setc	al
179
	and	[esp + 40], byte 0xfe
178
	and	[esp + 56], byte 0xfe
180
	or	[esp + 40], al
179
	or	[esp + 56], al
181
	ret
180
	ret
182
; -----------------------------------------
181
; -----------------------------------------
Line 183... Line 182...
183
 
182
 
Line 211... Line 210...
211
	; Write APM ver ----
210
	; Write APM ver ----
212
	jmp	@f
211
	jmp	@f
213
msg_apm:db	' APM x.x ', 0
212
msg_apm:db	' APM x.x ', 0
214
@@:	and	ax, 0xf0f
213
@@:	and	ax, 0xf0f
215
	add	ax, '00'
214
	add	ax, '00'
216
	mov	[msg_apm - 0x10000 + 5], ah
-
 
217
	mov	[msg_apm - 0x10000 + 7], al
-
 
218
	_setcursor 0, 3
-
 
219
	mov	si, msg_apm - 0x10000
215
	mov	si, msg_apm - 0x10000
-
 
216
	mov	[si + 5], ah
-
 
217
	mov	[si + 7], al
-
 
218
	_setcursor 0, 3
220
	call	printplain
219
	call	printplain
221
	_setcursor d80x25_top_num,0
220
	_setcursor d80x25_top_num,0
222
	; ------------------
221
	; ------------------
Line 223... Line 222...
223
	
222
	
Line 251... Line 250...
251
; DISPLAY VESA INFORMATION
250
; DISPLAY VESA INFORMATION
Line 252... Line 251...
252
 
251
 
253
.............
252
.............
Line -... Line 253...
-
 
253
.............
-
 
254
 
-
 
255
##############[boot\shutdown.inc]##################
-
 
256
 
-
 
257
Ðåøåíèå ïðîáëåìû APM poweroff
-
 
258
 
-
 
259
.............
-
 
260
.............
-
 
261
 
-
 
262
APM_PowerOff:
-
 
263
        mov     ax, 5304h
-
 
264
        xor     bx, bx
-
 
265
        int     15h
-
 
266
;!!!!!!!!!!!!!!!!!!!!!!!!
-
 
267
mov ax,0x5300
-
 
268
xor bx,bx
-
 
269
int 0x15
-
 
270
push ax
-
 
271