Subversion Repositories Kolibri OS

Rev

Rev 425 | Rev 465 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

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