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