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