Rev 431 | Rev 593 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 431 | Rev 465 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | $Revision: 431 $ |
1 | $Revision: 465 $ |
2 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
3 | ;; ;; |
3 | ;; ;; |
4 | ;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; |
4 | ;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; |
5 | ;; Distributed under terms of the GNU General Public License ;; |
5 | ;; Distributed under terms of the GNU General Public License ;; |
6 | ;; ;; |
6 | ;; ;; |
Line 10... | Line 10... | ||
10 | ;; See file COPYING for details. ;; |
10 | ;; See file COPYING for details. ;; |
11 | ;; Copyright 2003 Ville Turjanmaa ;; |
11 | ;; Copyright 2003 Ville Turjanmaa ;; |
12 | ;; ;; |
12 | ;; ;; |
13 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
13 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
Line 14... | Line -... | ||
14 | - | ||
15 | - | ||
16 | system_shutdown: ; shut down the system |
- | |
17 | call stop_all_services |
- | |
18 | - | ||
19 | push 3 ; stop playing cd |
- | |
20 | pop eax |
- | |
21 | call sys_cd_audio |
- | |
22 | cld |
- | |
23 | - | ||
24 | mov al,[0x2f0000+0x9030] |
- | |
25 | cmp al,1 |
- | |
26 | jl no_shutdown_parameter |
- | |
27 | cmp al,4 |
- | |
28 | jle yes_shutdown_param |
- | |
29 | no_shutdown_parameter: |
- | |
30 | - | ||
31 | ; movzx ecx,word [0x2f0000+0x900A] |
- | |
32 | ; movzx esi,word [0x2f0000+0x900C] |
- | |
33 | ; imul ecx,esi ;[0xfe04] |
- | |
34 | ;; mov ecx,0x500000/4 ;3fff00/4 ; darken screen |
- | |
35 | ; push ecx |
- | |
36 | ; mov esi,[0xfe80] |
- | |
37 | ; cmp esi,32*0x100000 |
- | |
38 | ; jbe no_darken_screen |
- | |
39 | ; mov edi,16*0x100000 |
- | |
40 | ; push esi edi |
- | |
41 | ; sdnewpix: |
- | |
42 | ; lodsd |
- | |
43 | ; shr eax,1 |
- | |
44 | ; and eax,0x7f7f7f7f |
- | |
45 | ; stosd |
- | |
46 | ; loop sdnewpix |
- | |
47 | ; pop ecx |
- | |
48 | ; pop esi edi |
- | |
49 | ; rep movsd |
- | |
50 | ; no_darken_screen: |
- | |
51 | - | ||
52 | ; read shutdown code: |
- | |
53 | ; 1) display shutdown "window" |
- | |
54 | - | ||
55 | mov eax,[0xfe00] |
- | |
56 | shr eax,1 |
- | |
57 | lea esi,[eax+220] ; x end |
- | |
58 | sub eax,220 ; x start |
- | |
59 | - | ||
60 | mov ebx,[ScreenHeight] |
- | |
61 | shr ebx,1 |
- | |
62 | mov [shutdownpos],ebx |
- | |
63 | lea ebp,[ebx+105] ; y end |
- | |
64 | sub ebx,120 ; y start |
- | |
65 | - | ||
66 | xor edi,edi |
- | |
67 | inc edi ; force putpixel & dtext |
- | |
68 | mov ecx,0x0000ff |
- | |
69 | - | ||
70 | ; vertical loop begin |
- | |
71 | sdnewpix1: |
- | |
72 | push eax ; save x start |
- | |
73 | - | ||
74 | ; horizontal loop begin |
- | |
75 | sdnewpix2: |
- | |
76 | - | ||
77 | call [putpixel] |
- | |
78 | - | ||
79 | inc eax |
- | |
80 | cmp eax,esi |
- | |
81 | jnz sdnewpix2 |
- | |
82 | ; horizontal loop end |
- | |
83 | - | ||
84 | dec ecx ; color |
- | |
85 | pop eax ; restore x start |
- | |
86 | - | ||
87 | inc ebx ; advance y pos |
- | |
88 | cmp ebx,ebp |
- | |
89 | jnz sdnewpix1 |
- | |
90 | ; vertical loop end |
- | |
91 | - | ||
92 | ; 2) display text strings |
- | |
93 | ; a) version |
- | |
94 | mov eax,[0xfe00] |
- | |
95 | shr eax,1 |
- | |
96 | shl eax,16 |
- | |
97 | mov ax,word [shutdownpos] |
- | |
98 | push eax |
- | |
99 | sub eax,(220-27)*10000h + 105 |
- | |
100 | mov ebx,0xffff00 |
- | |
101 | mov ecx,version |
- | |
102 | push 34 |
- | |
103 | pop edx |
- | |
104 | call dtext |
- | |
105 | - | ||
106 | ; b) variants |
- | |
107 | add eax,105+33 |
- | |
108 | push 6 |
- | |
109 | pop esi |
- | |
110 | ; mov ebx,0xffffff |
- | |
111 | mov bl,0xFF |
- | |
112 | mov ecx,shutdowntext |
- | |
113 | mov dl,40 |
- | |
114 | newsdt: |
- | |
115 | call dtext |
- | |
116 | add eax,10 |
- | |
117 | add ecx,edx |
- | |
118 | dec esi |
- | |
119 | jnz newsdt |
- | |
120 | - | ||
121 | ; 3) load & display rose.txt |
- | |
122 | mov eax,rosef-std_application_base_address ; load rose.txt |
- | |
123 | xor ebx,ebx |
- | |
124 | push 2 |
- | |
125 | pop ecx |
- | |
126 | mov edx,0x90000 |
- | |
127 | push edx |
- | |
128 | push 12 |
- | |
129 | pop esi |
- | |
130 | push edi ; may be destroyed |
- | |
131 | - | ||
132 | pushad |
- | |
133 | push eax |
- | |
134 | call file_system_lfn ; by SPraid fileread |
- | |
135 | pop eax |
- | |
136 | popad |
- | |
137 | pop edi |
- | |
138 | - | ||
139 | pop ecx |
- | |
140 | inc ecx ; do not display stars from rose.txt |
- | |
141 | pop eax |
- | |
142 | add eax,20*10000h - 110 |
- | |
143 | - | ||
144 | mov ebx,0x00ff00 |
- | |
145 | push 27 |
- | |
146 | pop edx |
- | |
147 | - | ||
148 | nrl: |
- | |
149 | call dtext |
- | |
150 | ; sub ebx,0x050000 |
- | |
151 | ror ebx, 16 |
- | |
152 | sub bl, 0x05 |
- | |
153 | ror ebx, 16 |
- | |
154 | add eax,8 |
- | |
155 | add ecx,31 |
- | |
156 | cmp cx,word 0x0001+25*31 |
- | |
157 | jnz nrl |
- | |
158 | - | ||
159 | call checkVga_N13 |
- | |
160 | - | ||
161 | yes_shutdown_param: |
14 | |
162 | cli |
- | |
163 | - | ||
164 | mov eax,kernel ; load kernel.mnt to 0x8000:0 |
- | |
165 | push 12 |
- | |
166 | pop esi |
- | |
167 | xor ebx,ebx |
- | |
168 | or ecx,-1 |
- | |
169 | mov edx,0x80000 |
- | |
170 | call fileread |
- | |
171 | - | ||
172 | mov esi,restart_kernel_4000+0x10000 ; move kernel re-starter to 0x4000:0 |
- | |
173 | mov edi,0x40000 |
- | |
174 | mov ecx,1000 |
- | |
175 | rep movsb |
- | |
176 | - | ||
177 | mov eax,0x2F0000 ; restore 0x0 - 0xffff |
- | |
178 | xor ebx,ebx |
- | |
179 | mov ecx,0x10000 |
- | |
180 | call memmove |
- | |
181 | - | ||
182 | call restorefatchain |
- | |
183 | - | ||
184 | mov al, 0xFF |
- | |
185 | out 0x21, al |
- | |
186 | out 0xA1, al |
- | |
187 | - | ||
188 | mov word [0x467+0],pr_mode_exit-0x10000 |
- | |
189 | mov word [0x467+2],0x1000 |
- | |
190 | - | ||
191 | mov al,0x0F |
- | |
192 | out 0x70,al |
- | |
193 | mov al,0x05 |
- | |
194 | out 0x71,al |
- | |
195 | - | ||
196 | mov al,0xFE |
- | |
197 | out 0x64,al |
- | |
198 | hlt |
- | |
199 | - | ||
200 | use16 |
- | |
201 | 15 | align 4 |
|
202 | pr_mode_exit: |
- | |
Line 203... | Line 16... | ||
203 | org $-0x10000 |
16 | pr_mode_exit: |
204 | 17 | ||
205 | ; setup stack |
18 | ; setup stack |
206 | mov ax, 3000h |
19 | mov ax, 0x3000 |
207 | mov ss, ax |
20 | mov ss, ax |
208 | mov esp, 0EC00h |
21 | mov esp, 0x0EC00 |
209 | ; setup ds |
22 | ; setup ds |
Line 210... | Line 23... | ||
210 | push cs |
23 | push cs |
211 | pop ds |
24 | pop ds |
212 | 25 | ||
213 | lidt [old_ints_h-0x10000] |
26 | lidt [old_ints_h] |
214 | ;remap IRQs |
27 | ;remap IRQs |
215 | mov al,0x11 |
28 | mov al,0x11 |
216 | out 0x20,al |
29 | out 0x20,al |
217 | call rdelay |
30 | call rdelay |
218 | out 0xA0,al |
31 | out 0xA0,al |
219 | call rdelay |
32 | call rdelay |
220 | 33 | ||
221 | mov al,0x08 |
34 | mov al,0x08 |
222 | out 0x21,al |
35 | out 0x21,al |
223 | call rdelay |
36 | call rdelay |
224 | mov al,0x70 |
37 | mov al,0x70 |
225 | out 0xA1,al |
38 | out 0xA1,al |
226 | call rdelay |
39 | call rdelay |
227 | 40 | ||
228 | mov al,0x04 |
41 | mov al,0x04 |
229 | out 0x21,al |
42 | out 0x21,al |
230 | call rdelay |
43 | call rdelay |
231 | mov al,0x02 |
44 | mov al,0x02 |
232 | out 0xA1,al |
45 | out 0xA1,al |
233 | call rdelay |
46 | call rdelay |
234 | 47 | ||
235 | mov al,0x01 |
48 | mov al,0x01 |
236 | out 0x21,al |
49 | out 0x21,al |
237 | call rdelay |
50 | call rdelay |
238 | out 0xA1,al |
51 | out 0xA1,al |
239 | call rdelay |
52 | call rdelay |
240 | 53 | ||
241 | mov al,0xB8 |
54 | mov al,0xB8 |
242 | out 0x21,al |
55 | out 0x21,al |
243 | call rdelay |
- | |
244 | mov al,0xBD |
- | |
245 | out 0xA1,al |
- | |
246 | sti |
- | |
247 | - | ||
248 | temp_3456: |
- | |
249 | xor ax,ax |
- | |
250 | mov es,ax |
- | |
251 | mov al,byte [es:0x9030] |
- | |
252 | cmp al,1 |
- | |
253 | jl nbw |
- | |
254 | cmp al,4 |
- | |
255 | jle nbw32 |
- | |
256 | - | ||
257 | nbw: |
- | |
258 | in al,0x60 |
- | |
259 | call pause_key |
- | |
260 | cmp al,6 |
- | |
261 | jae nbw |
- | |
262 | mov bl,al |
- | |
263 | nbw2: |
- | |
264 | in al,0x60 |
- | |
265 | call pause_key |
- | |
266 | cmp al,bl |
- | |
267 | je nbw2 |
- | |
268 | cmp al,240 ;ax,240 |
- | |
269 | jne nbw31 |
- | |
270 | mov al,bl |
- | |
271 | dec ax |
- | |
272 | jmp nbw32 |
- | |
273 | nbw31: |
- | |
274 | add bl,128 |
- | |
275 | cmp al,bl |
- | |
276 | jne nbw |
- | |
277 | sub al,129 |
- | |
278 | - | ||
279 | nbw32: |
- | |
280 | - | ||
281 | dec ax ; 1 = write floppy |
- | |
282 | js nbw |
- | |
283 | jnz no_floppy_write |
- | |
284 | call floppy_write |
- | |
285 | jmp temp_3456 ;nbw |
- | |
286 | no_floppy_write: |
- | |
287 | - | ||
288 | dec ax ; 2 = power off |
- | |
289 | jnz no_apm_off |
- | |
290 | call APM_PowerOff |
- | |
291 | jmp $ |
- | |
292 | no_apm_off: |
- | |
293 | - | ||
294 | dec ax ; 3 = reboot |
- | |
295 | jnz restart_kernel ; 4 = restart kernel |
- | |
296 | push 0x40 |
- | |
297 | pop ds |
- | |
298 | mov word[0x0072],0x1234 |
- | |
299 | jmp 0xF000:0xFFF0 |
- | |
300 | - | ||
301 | pause_key: |
- | |
302 | mov cx,100 |
- | |
303 | pause_key_1: |
- | |
304 | loop pause_key_1 |
- | |
305 | ret |
- | |
306 | - | ||
307 | rdelay: |
- | |
308 | ret |
- | |
309 | - | ||
310 | iglobal |
- | |
311 | kernel db 'KERNEL MNT' |
- | |
312 | ; shutdown_parameter db 0 |
- | |
313 | endg |
- | |
314 | - | ||
315 | restart_kernel: |
- | |
316 | - | ||
317 | mov ax,0x0003 ; set text mode for screen |
- | |
318 | int 0x10 |
- | |
319 | - | ||
320 | jmp 0x4000:0000 |
- | |
321 | - | ||
322 | - | ||
323 | restart_kernel_4000: |
- | |
324 | cli |
- | |
325 | - | ||
326 | ; mov di,0x1000 ; load kernel image from 0x8000:0 -> 0x1000:0 |
- | |
327 | ; |
- | |
328 | ; new_kernel_block_move: |
- | |
329 | ; |
- | |
330 | ; mov ebx,0 |
- | |
331 | ; |
- | |
332 | ; new_kernel_byte_move: |
- | |
333 | ; |
- | |
334 | ; mov ax,di |
- | |
335 | ; add ax,0x7000 |
- | |
336 | ; mov es,ax |
- | |
337 | ; mov dl,[es:bx] |
- | |
338 | ; mov es,di |
- | |
339 | ; mov [es:bx],dl |
- | |
340 | ; |
- | |
341 | ; inc ebx |
- | |
342 | ; cmp ebx,65536 |
- | |
343 | ; jbe new_kernel_byte_move |
- | |
344 | ; |
- | |
345 | ; add di,0x1000 |
- | |
346 | ; cmp di,0x2000 |
- | |
347 | ; jbe new_kernel_block_move |
- | |
348 | push ds |
- | |
349 | pop es |
- | |
350 | mov cx, 0x8000 |
- | |
351 | push cx |
- | |
352 | mov ds, cx |
- | |
353 | xor si, si |
- | |
354 | xor di, di |
- | |
355 | rep movsw |
- | |
356 | push 0x9000 |
- | |
357 | pop ds |
- | |
358 | push 0x2000 |
- | |
359 | pop es |
- | |
360 | pop cx |
- | |
361 | rep movsw |
- | |
362 | - | ||
363 | wbinvd ; write and invalidate cache |
- | |
364 | - | ||
365 | ; mov ax,0x1000 |
- | |
366 | ; mov es,ax |
- | |
367 | ; mov ax,0x3000 |
- | |
368 | ; mov ss,ax |
- | |
369 | ; mov sp,0xec00 |
- | |
370 | ; restore timer |
- | |
371 | mov al, 00110100b |
- | |
372 | out 43h, al |
- | |
373 | jcxz $+2 |
- | |
374 | mov al, 0xFF |
- | |
375 | out 40h, al |
- | |
376 | jcxz $+2 |
56 | call rdelay |
Line -... | Line 57... | ||
- | 57 | mov al,0xBD |
|
- | 58 | out 0xA1,al |
|
- | 59 | sti |
|
- | 60 | ||
- | 61 | temp_3456: |
|
- | 62 | xor ax,ax |
|
- | 63 | mov es,ax |
|
- | 64 | mov al,byte [es:0x9030] |
|
- | 65 | cmp al,1 |
|
- | 66 | jl nbw |
|
- | 67 | cmp al,4 |
|
- | 68 | jle nbw32 |
|
- | 69 | ||
- | 70 | nbw: |
|
- | 71 | in al,0x60 |
|
- | 72 | call pause_key |
|
377 | out 40h, al |
73 | cmp al,6 |
- | 74 | jae nbw |
|
- | 75 | mov bl,al |
|
- | 76 | nbw2: |
|
378 | jcxz $+2 |
77 | in al,0x60 |
- | 78 | call pause_key |
|
- | 79 | cmp al,bl |
|
- | 80 | je nbw2 |
|
- | 81 | cmp al,240 ;ax,240 |
|
- | 82 | jne nbw31 |
|
- | 83 | mov al,bl |
|
- | 84 | dec ax |
|
- | 85 | jmp nbw32 |
|
- | 86 | nbw31: |
|
- | 87 | add bl,128 |
|
- | 88 | cmp al,bl |
|
- | 89 | jne nbw |
|
379 | sti |
90 | sub al,129 |
- | 91 | ||
380 | 92 | nbw32: |
|
- | 93 | ||
- | 94 | dec ax ; 1 = write floppy |
|
- | 95 | js nbw |
|
- | 96 | jnz no_floppy_write |
|
381 | ; (hint by Black_mirror) |
97 | call floppy_write |
382 | ; We must read data from keyboard port, |
98 | jmp temp_3456 ;nbw |
- | 99 | no_floppy_write: |
|
- | 100 | ||
- | 101 | dec ax ; 2 = power off |
|
383 | ; because there may be situation when previous keyboard interrupt is lost |
102 | jnz no_apm_off |
384 | ; (due to return to real mode and IRQ reprogramming) |
103 | call APM_PowerOff |
- | 104 | jmp $ |
|
385 | ; and next interrupt will not be generated (as keyboard waits for handling) |
105 | no_apm_off: |
386 | in al, 0x60 |
106 | |
387 | 107 | dec ax ; 3 = reboot |
|
- | 108 | jnz restart_kernel ; 4 = restart kernel |
|
- | 109 | push 0x40 |
|
- | 110 | pop ds |
|
388 | ; bootloader interface |
111 | mov word[0x0072],0x1234 |
- | 112 | jmp 0xF000:0xFFF0 |
|
389 | push 0x1000 |
113 | |
- | 114 | pause_key: |
|
Line 390... | Line -... | ||
390 | pop ds |
- | |
391 | mov si, kernel_restart_bootblock-0x10000 |
- | |
392 | mov ax, 'KL' |
- | |
393 | jmp 0x1000:0000 |
- | |
394 | - | ||
395 | APM_PowerOff: |
- | |
396 | mov ax, 5304h |
- | |
397 | xor bx, bx |
- | |
398 | int 15h |
115 | mov cx,100 |
399 | ;!!!!!!!!!!!!!!!!!!!!!!!! |
- | |
400 | mov ax,0x5300 |
- | |
401 | xor bx,bx |
- | |
402 | int 0x15 |
- | |
403 | push ax |
- | |
404 | - | ||
405 | mov ax,0x5301 |
- | |
406 | xor bx,bx |
- | |
407 | int 0x15 |
- | |
408 | - | ||
409 | mov ax,0x5308 |
- | |
410 | mov bx,1 |
- | |
411 | mov cx,bx |
- | |
412 | int 0x15 |
- | |
413 | - | ||
414 | mov ax,0x530E |
- | |
415 | xor bx,bx |
- | |
416 | pop cx |
- | |
417 | int 0x15 |
- | |
418 | - | ||
419 | mov ax,0x530D |
- | |
420 | mov bx,1 |
- | |
421 | mov cx,bx |
- | |
422 | int 0x15 |
- | |
423 | - | ||
424 | mov ax,0x530F |
- | |
425 | mov bx,1 |
- | |
426 | mov cx,bx |
- | |
427 | int 0x15 |
- | |
428 | - | ||
429 | mov ax,0x5307 |
- | |
430 | mov bx,1 |
116 | pause_key_1: |
431 | mov cx,3 |
- | |
432 | int 0x15 |
- | |
433 | ;!!!!!!!!!!!!!!!!!!!!!!!! |
- | |
Line 434... | Line 117... | ||
434 | fwwritedone: |
117 | loop pause_key_1 |
Line 435... | Line 118... | ||
435 | ret |
118 | ret |
436 | org $+0x10000 |
119 | |
437 | flm db 0 |
120 | rdelay: |
Line 438... | Line 121... | ||
438 | org $-0x10000 |
121 | ret |
439 | 122 | ||
440 | floppy_write: ; write diskette image to physical floppy |
123 | floppy_write: ; write diskette image to physical floppy |
Line 441... | Line 124... | ||
441 | 124 | ||
442 | cmp [flm-0x10000],byte 1 |
125 | cmp [flm],byte 1 |
443 | je fwwritedone |
- | |
444 | mov [flm-0x10000],byte 1 |
126 | je fwwritedone |
Line 445... | Line 127... | ||
445 | 127 | mov [flm],byte 1 |
|
446 | xor ax, ax ; reset drive |
128 | |
Line 447... | Line 129... | ||
447 | xor dx, dx |
129 | xor ax, ax ; reset drive |
Line 448... | Line 130... | ||
448 | int 0x13 |
130 | xor dx, dx |
449 | 131 | int 0x13 |
|
450 | mov cx,0x0001 ; startcyl,startsector |
132 | |
451 | ; mov dx,0x0000 ; starthead,drive |
133 | mov cx,0x0001 ; startcyl,startsector |
452 | xor dx, dx |
134 | xor dx, dx ; starthead,drive |
453 | mov ax, 80*2 ; read no of sect |
135 | mov ax, 80*2 ; read no of sect |
454 | 136 | ||
455 | fwwrites: |
137 | fwwrites: |
456 | push ax |
138 | push ax |
Line 457... | Line 139... | ||
457 | 139 | ||
458 | ; move 1mb+ -> 0:a000 |
140 | ; move 1mb+ -> 0:a000 |
459 | 141 | ||
460 | pusha |
142 | pusha |
461 | mov si,fwmovedesc -0x10000 |
143 | mov si, fwmovedesc |
462 | mov cx,256*18 |
144 | mov cx,256*18 |
Line 463... | Line 145... | ||
463 | mov ah,0x87 |
145 | mov ah,0x87 |
464 | push ds |
146 | push ds |
Line 465... | Line 147... | ||
465 | pop es |
147 | pop es |
466 | int 0x15 |
148 | int 0x15 |
467 | add dword [fwmovedesc-0x10000+0x12], 512*18 |
149 | add dword [fwmovedesc+0x12], 512*18 |
Line 468... | Line 150... | ||
468 | popa |
150 | popa |
469 | 151 | ||
470 | xor si,si |
152 | xor si,si |
Line 471... | Line 153... | ||
471 | mov es,si |
153 | mov es,si |
472 | fwnewwrite: |
154 | fwnewwrite: |
473 | mov bx,0xa000 ; es:bx -> data area |
155 | mov bx,0xa000 ; es:bx -> data area |
474 | mov ax,0x0300+18 ; read, no of sectors to read |
156 | mov ax,0x0300+18 ; read, no of sectors to read |
475 | int 0x13 |
157 | int 0x13 |
476 | 158 | ||
477 | test ah, ah |
159 | test ah, ah |
478 | jz fwgoodwrite |
160 | jz fwgoodwrite |
479 | 161 | ||
480 | inc si |
162 | inc si |
481 | cmp si,10 |
163 | cmp si,10 |
- | 164 | jnz fwnewwrite |
|
482 | jnz fwnewwrite |
165 | |
483 | 166 | ; can't access diskette - return |
|
484 | ; can't access diskette - return |
167 | pop ax |
485 | pop ax |
168 | ret |
- | 169 | ||
486 | ret |
170 | fwgoodwrite: |
- | 171 | inc dh |
|
- | 172 | cmp dh,2 |
|
- | 173 | jnz fwbb2 |
|
- | 174 | mov dh,0 |
|
487 | 175 | inc ch |
|
- | 176 | fwbb2: |
|
- | 177 | pop ax |
|
- | 178 | dec ax |
|
488 | fwgoodwrite: |
179 | jnz fwwrites |
- | 180 | ret |
|
489 | inc dh |
181 | |
- | 182 | APM_PowerOff: |
|
- | 183 | mov ax, 5304h |
|
490 | cmp dh,2 |
184 | xor bx, bx |
491 | jnz fwbb2 |
185 | int 15h |
492 | mov dh,0 |
186 | ;!!!!!!!!!!!!!!!!!!!!!!!! |
- | 187 | mov ax,0x5300 |
|
493 | inc ch |
188 | xor bx,bx |
494 | fwbb2: |
189 | int 0x15 |
495 | pop ax |
190 | push ax |
496 | dec ax |
191 | |
- | 192 | mov ax,0x5301 |
|
497 | jnz fwwrites |
193 | xor bx,bx |
- | 194 | int 0x15 |
|
- | 195 | ||
- | 196 | mov ax,0x5308 |
|
- | 197 | mov bx,1 |
|
498 | ret |
198 | mov cx,bx |
- | 199 | int 0x15 |
|
- | 200 | ||
- | 201 | mov ax,0x530E |
|
- | 202 | xor bx,bx |
|
- | 203 | pop cx |
|
499 | org $+0x10000 |
204 | int 0x15 |
500 | fwmovedesc: |
205 | |
- | 206 | mov ax,0x530D |
|
501 | db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0 |
207 | mov bx,1 |
- | 208 | mov cx,bx |
|
502 | db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0 |
209 | int 0x15 |
503 | db 0xff,0xff,0x0,0x00,0x10,0x93,0x0,0x0 |
210 | |
504 | db 0xff,0xff,0x0,0xa0,0x00,0x93,0x0,0x0 |
211 | mov ax,0x530F |
- | 212 | mov bx,1 |
|
- | 213 | mov cx,bx |
|
- | 214 | int 0x15 |
|
- | 215 | ||
505 | db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0 |
216 | mov ax,0x5307 |
506 | db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0 |
217 | mov bx,1 |
507 | db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0 |
218 | mov cx,3 |
508 | db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0 |
219 | int 0x15 |
509 | org $-0x10000 |
220 | ;!!!!!!!!!!!!!!!!!!!!!!!! |
510 | use32 |
221 | fwwritedone: |
511 | org $+0x10000 |
222 | ret |
512 | uglobal |
223 | |
513 | shutdownpos dd 0x0 |
224 | restart_kernel: |
- | 225 | ||
514 | endg |
226 | mov ax,0x0003 ; set text mode for screen |
- | 227 | int 0x10 |
|
- | 228 | jmp 0x4000:0000 |
|
- | 229 | ||
- | 230 | restart_kernel_4000: |
|
515 | 231 | cli |
|
516 | iglobal |
232 | |
- | 233 | push ds |
|
- | 234 | pop es |
|
517 | if lang eq en |
235 | mov cx, 0x8000 |
518 | shutdowntext: |
236 | push cx |
519 | db "IT'S SAFE TO POWER OFF COMPUTER OR " |
237 | mov ds, cx |
- | 238 | xor si, si |
|
520 | db ' ' |
239 | xor di, di |
- | 240 | rep movsw |
|
- | 241 | push 0x9000 |
|
- | 242 | pop ds |
|
- | 243 | push 0x2000 |
|
521 | db '1) SAVE RAMDISK TO FLOPPY ' |
244 | pop es |
- | 245 | pop cx |
|
522 | db '2) APM - POWEROFF ' |
246 | rep movsw |
- | 247 | ||
523 | db '3) REBOOT ' |
248 | wbinvd ; write and invalidate cache |
- | 249 | ||
524 | db '4) RESTART KERNEL ' |
250 | mov al, 00110100b |
- | 251 | out 43h, al |
|
525 | else if lang eq ru |
252 | jcxz $+2 |
526 | shutdowntext: |
253 | mov al, 0xFF |
527 | db "¥§®¯ ᮥ ¢ëª«î票¥ ª®¬¯ìîâ¥à ¨«¨ " |
254 | out 40h, al |
- | 255 | jcxz $+2 |
|
- | 256 | out 40h, al |
|
528 | db ' ' |
257 | jcxz $+2 |