Subversion Repositories Kolibri OS

Rev

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

Rev 387 Rev 388
Line 5... Line 5...
5
;;  KolibriOS 16-bit loader,                              ;;
5
;;  KolibriOS 16-bit loader,                              ;;
6
;;                        based on bootcode for MenuetOS  ;;
6
;;                        based on bootcode for MenuetOS  ;;
7
;;                                                        ;;
7
;;                                                        ;;
8
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 9... Line -...
9
 
-
 
10
 
-
 
11
 
9
 
12
;==========================================================================
10
;==========================================================================
13
;
11
;
14
;                           16 BIT FUNCTIONS
12
;                           16 BIT FUNCTIONS
15
;
13
;
Line 16... Line -...
16
;==========================================================================
-
 
17
 
-
 
18
; 16-bit data
-
 
19
		org $+0x10000
-
 
20
 
-
 
21
old_ints_h:
-
 
22
        dw      0x400
-
 
23
        dd      0
-
 
24
        dw      0
-
 
25
 
-
 
26
kernel_restart_bootblock:
-
 
27
    db    1    ; version
-
 
28
    dw    1    ; floppy image is in memory
-
 
29
    dd    0    ; cannot save parameters
-
 
30
 
-
 
31
 
-
 
32
align 32
-
 
33
 
-
 
34
; GDT TABLE
-
 
35
 
-
 
36
gdts:
-
 
37
 
-
 
38
        dw     gdte-$-1
-
 
39
        dd     gdts
-
 
40
        dw     0
-
 
41
 
-
 
42
; Attention! The order first four selectors not to change, is used in Fast System Call
-
 
43
; must be : os_code, os_data, app_code, app_data, ....
-
 
44
 
-
 
45
int_code_l:
-
 
46
os_code_l:
-
 
47
        dw     0xffff
-
 
48
        dw     0x0000
-
 
49
        db     0x00
-
 
50
        dw     11011111b *256 +10011010b
-
 
51
        db     0x00
-
 
52
 
-
 
53
int_data_l:
-
 
54
os_data_l:
-
 
55
        dw     0xffff
-
 
56
        dw     0x0000
-
 
57
        db     0x00
-
 
58
        dw     11011111b *256 +10010010b
-
 
59
        db     0x00
-
 
60
 
-
 
61
app_code_l:
-
 
62
        dw 0xFFFF
-
 
63
        dw 0
-
 
64
        db 0
-
 
65
        db cpl3
-
 
66
        dw G32+D32+0x8000+0x7;
-
 
67
 
-
 
68
app_data_l:
-
 
69
        dw 0xFFFF
-
 
70
        dw 0
-
 
71
        db 0
-
 
72
        db drw3
-
 
73
        dw G32+D32+0x8000+0x7;
-
 
74
 
-
 
75
; --------------- APM ---------------------
-
 
76
apm_code_32:
-
 
77
        dw     0x0f        ; limit 64kb
-
 
78
        db     0, 0, 0
-
 
79
        dw     11010000b *256 +10011010b
-
 
80
        db     0x00
-
 
81
apm_code_16:
-
 
82
        dw     0x0f
-
 
83
        db     0, 0, 0
-
 
84
        dw     10010000b *256 +10011010b
-
 
85
        db     0x00
-
 
86
apm_data_16:
-
 
87
        dw     0x0f
-
 
88
        db     0, 0, 0
-
 
89
        dw     10010000b *256 +10010010b
-
 
90
        db     0x00
-
 
91
; -----------------------------------------
-
 
92
 
-
 
93
graph_data_l:
-
 
94
 
-
 
95
        dw     0x7ff
-
 
96
        dw     0x0000
-
 
97
        db     0x00
-
 
98
        dw     11010000b *256 +11110010b
-
 
99
        db     0x00
-
 
100
 
-
 
101
tss0_l:
-
 
102
;      times (max_processes+10) dd 0,0
-
 
103
gdte = $ + (max_processes+10)*8
-
 
104
 
-
 
105
; videomodes table
-
 
106
gr_table:
-
 
107
    dw      0x112+0100000000000000b ,  640 ,  480        ; 1
-
 
108
    dw      0x115+0100000000000000b ,  800 ,  600        ; 2
-
 
109
    dw      0x118+0100000000000000b , 1024 ,  768        ; 3
-
 
110
    dw      0x11B+0100000000000000b , 1280 , 1024        ; 4
-
 
111
    dw      0x112 ,  640 , 480                ; 5
-
 
112
    dw      0x115 ,  800 , 600                ; 6
-
 
113
    dw      0x118 , 1024 , 768                ; 7
-
 
114
    dw      0x11B , 1280 ,1024                ; 8
-
 
115
    dw    0x13, 640, 480                    ; 9
-
 
116
    dw    0x12, 640, 480                    ; 0
-
 
117
 
-
 
118
; table for move to extended memory (int 15h, ah=87h)
-
 
119
       movedesc:
-
 
120
        db      0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
-
 
121
        db      0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
-
 
122
 
-
 
123
        db      0xff,0xff,0x0,0xa0,0x00,0x93,0x0,0x0
-
 
124
        db      0xff,0xff,0x0,0x00,0x10,0x93,0x0,0x0
-
 
125
 
-
 
126
        db      0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
-
 
127
        db      0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
-
 
128
        db      0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
-
 
Line 129... Line 14...
129
        db      0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
14
;==========================================================================
130
        	org $-0x10000
15
 
131
 
16
 
132
putchar:
17
putchar:
Line 153... Line 38...
153
    cmp    al, 0
38
    cmp    al, 0
154
    jnz    @b
39
    jnz    @b
155
    popa
40
    popa
156
    ret
41
    ret
Line 157... Line -...
157
 
-
 
158
; Now int 16 is used for keyboard support.
-
 
159
; This is shorter, simpler and more reliable.
-
 
160
if 0
-
 
161
getkey:      push  ecx
-
 
162
             push  edx
-
 
163
             add   ebx,0x0101
-
 
164
             xor   eax,eax
-
 
165
 
-
 
166
           gk1:
-
 
167
             in    al,0x60
-
 
168
             mov   cl,al
-
 
169
           gk0:
-
 
170
             in    al,0x60
-
 
171
             cmp   al,cl
-
 
172
             je    gk0
-
 
173
             cmp   ax,11
-
 
174
             jg    gk0
-
 
175
             gk0_1:
-
 
176
             mov   cl,al
-
 
177
 
-
 
178
;             add   al,47
-
 
179
;             mov   [ds:keyinbs-0x10000],al
-
 
180
;             mov   si,keyinbs-0x10000
-
 
181
;             call  printplain
-
 
182
 
-
 
183
           gk12:
-
 
184
             in    al,0x60
-
 
185
             cmp   al,cl
-
 
186
             je    gk12
-
 
187
             cmp   ax,240
-
 
188
             jne   gk13
-
 
189
             mov   al,cl
-
 
190
             jmp   gk14
-
 
191
           gk13:
-
 
192
             add   cl,128
-
 
193
             cmp   al,cl
-
 
194
             jne   gk1
-
 
195
             sub   al,128
-
 
196
           gk14:
-
 
197
 
-
 
198
             movzx edx,bl
-
 
199
             cmp   eax,edx
-
 
200
             jb    gk1
-
 
201
             movzx edx,bh
-
 
202
             cmp   eax,edx
-
 
203
             jg    gk1
-
 
204
             test  ebx,0x010000
-
 
205
             jnz   gk3
-
 
206
             mov   cx,0x1000
-
 
207
             mov   dx,cx
-
 
208
             add   eax,47
-
 
209
             mov   cx,ax
-
 
210
             cmp   cx,58
-
 
211
             jb    gk_nozero
-
 
212
             sub   cx,10
-
 
213
           gk_nozero:
-
 
214
             mov   [ds:keyin-0x10000],cl
-
 
215
             mov   si,keyin-0x10000
-
 
216
             call  printplain
-
 
217
           gk3:
-
 
218
             sub   eax,48
-
 
219
             pop   edx
-
 
220
             pop   ecx
-
 
221
             ret
-
 
222
end if
-
 
223
 
42
 
224
getkey:
43
getkey:
225
; get number in range [bl,bh] (bl,bh in ['0'..'9'])
44
; get number in range [bl,bh] (bl,bh in ['0'..'9'])
226
; in: bx=range
45
; in: bx=range
227
; out: ax=digit (1..9, 10 for 0)
46
; out: ax=digit (1..9, 10 for 0)
Line 251... Line 70...
251
{
70
{
252
    mov    dx, row*256 + column
71
    mov    dx, row*256 + column
253
    call    setcursor
72
    call    setcursor
254
}
73
}
Line 255... Line -...
255
 
-
 
256
;pagetable_set:
-
 
257
;eax - physical address
-
 
258
;es:di - page table
-
 
259
;ecx - number of pages to map
-
 
260
;    or    al, 7
-
 
261
;@@:
-
 
262
;    stosd
-
 
263
;    add    eax, 1000h
-
 
264
;    loop    @b
-
 
265
;    ret
-
 
266
 
74
 
267
boot_read_floppy:
75
boot_read_floppy:
268
        push    si
76
        push    si
269
        xor     si, si
77
        xor     si, si
270
        mov     ah, 2   ; read
78
        mov     ah, 2   ; read
Line 274... Line 82...
274
        pop     ax
82
        pop     ax
275
        jnc     @f
83
        jnc     @f
276
        inc     si
84
        inc     si
277
        cmp     si, 10
85
        cmp     si, 10
278
        jb      @b
86
        jb      @b
279
        mov     si, badsect-0x10000
87
        mov     si, badsect
280
sayerr_plain:
88
sayerr_plain:
281
        call    printplain
89
        call    printplain
282
        jmp     $
90
        jmp     $
283
@@:
91
@@:
284
        pop     si
92
        pop     si
Line 294... Line 102...
294
start_of_code:
102
start_of_code:
295
    cld
103
    cld
296
; \begin{diamond}[02.12.2005]
104
; \begin{diamond}[02.12.2005]
297
    cmp    ax, 'KL'
105
    cmp    ax, 'KL'
298
    jnz    @f
106
    jnz    @f
299
    mov    word [cs:cfgmanager.loader_block-0x10000], si
107
    mov    word [cs:cfgmanager.loader_block], si
300
    mov    word [cs:cfgmanager.loader_block+2-0x10000], ds
108
    mov    word [cs:cfgmanager.loader_block+2], ds
301
@@:
109
@@:
302
; \end{diamond}[02.12.2005]
110
; \end{diamond}[02.12.2005]
Line 303... Line 111...
303
 
111
 
304
; set up stack
112
; set up stack
Line 315... Line 123...
315
    mov    ax, 3
123
    mov    ax, 3
316
        int  0x10
124
        int  0x10
Line 317... Line 125...
317
 
125
 
318
if lang eq ru
126
if lang eq ru
319
 ; Load & set russian VGA font (RU.INC)
127
 ; Load & set russian VGA font (RU.INC)
320
        mov  bp,RU_FNT1-10000h   ; RU_FNT1 - First part
128
        mov  bp, RU_FNT1         ; RU_FNT1 - First part
321
          mov  bx,1000h            ; 768 bytes
129
        mov  bx,1000h            ; 768 bytes
322
          mov  cx,30h              ; 48 symbols
130
        mov  cx,30h              ; 48 symbols
323
          mov  dx,80h              ; 128 - position of first symbol
131
        mov  dx,80h              ; 128 - position of first symbol
324
        mov  ax,1100h
132
        mov  ax,1100h
Line 325... Line 133...
325
          int  10h
133
        int  10h
326
 
134
 
327
        mov  bp,RU_FNT2-10000h   ; RU_FNT2 -Second part
135
        mov  bp,RU_FNT2          ; RU_FNT2 -Second part
328
        mov  bx,1000h            ; 512 bytes
136
        mov  bx,1000h            ; 512 bytes
329
        mov  cx,20h              ; 32 symbols
137
        mov  cx,20h              ; 32 symbols
330
        mov  dx,0E0h             ; 224 - position of first symbol
138
        mov  dx,0E0h             ; 224 - position of first symbol
331
        mov  ax,1100h
139
        mov  ax,1100h
332
          int  10h
140
          int  10h
333
 ; End set VGA russian font
141
 ; End set VGA russian font
334
else if lang eq et
142
else if lang eq et
335
        mov  bp,ET_FNT-10000h   ; ET_FNT1
143
        mov  bp,ET_FNT          ; ET_FNT1
336
        mov  bx,1000h           ;
144
        mov  bx,1000h           ;
337
        mov  cx,255             ; 256 symbols
145
        mov  cx,255             ; 256 symbols
338
        mov  dx,0h              ; 0 - position of first symbol
146
        mov  dx,0h              ; 0 - position of first symbol
Line 342... Line 150...
342
 
150
 
343
; draw frames
151
; draw frames
344
    push    0xb800
152
    push    0xb800
345
    pop    es
153
    pop    es
346
    xor    di, di
-
 
347
;        mov  si,d80x25-0x10000
-
 
348
;        mov  cx,80*25
-
 
349
;        mov  ah,1*16+15
-
 
350
;       dfl1:
-
 
351
;        lodsb
-
 
352
;        stosw
-
 
353
;        loop dfl1
154
    xor    di, di
-
 
155
    mov    ah, 1*16+15
354
    mov    ah, 1*16+15
156
 
355
; draw top
157
; draw top
356
    mov    si, d80x25_top - 0x10000
158
    mov    si, d80x25_top
357
    mov    cx, d80x25_top_num * 80
159
    mov    cx, d80x25_top_num * 80
358
@@:
160
@@:
359
    lodsb
161
    lodsb
360
    stosw
162
    stosw
361
    loop    @b
163
    loop    @b
362
; draw spaces
164
; draw spaces
363
    mov    si, space_msg - 0x10000
165
    mov    si, space_msg
364
    mov    cx, 25 - d80x25_top_num - d80x25_bottom_num
166
    mov    cx, 25 - d80x25_top_num - d80x25_bottom_num
365
dfl1:
167
dfl1:
366
    push    cx
168
    push    cx
367
    push    si
169
    push    si
Line 372... Line 174...
372
    loop    @b
174
    loop    @b
373
    pop    si
175
    pop    si
374
    pop    cx
176
    pop    cx
375
    loop    dfl1
177
    loop    dfl1
376
; draw bottom
178
; draw bottom
377
    mov    si, d80x25_bottom - 0x10000
179
    mov    si, d80x25_bottom
378
    mov    cx, d80x25_bottom_num * 80
180
    mov    cx, d80x25_bottom_num * 80
379
@@:
181
@@:
380
    lodsb
182
    lodsb
381
    stosw
183
    stosw
382
    loop    @b
184
    loop    @b
Line 383... Line 185...
383
 
185
 
Line 384... Line 186...
384
    mov    byte [space_msg-0x10000+80], 0    ; now space_msg is null terminated
186
    mov    byte [space_msg+80], 0    ; now space_msg is null terminated
Line 385... Line 187...
385
 
187
 
Line 399... Line 201...
399
        pop     ax
201
        pop     ax
400
        and     ax,bx
202
        and     ax,bx
401
        and     dx,bx
203
        and     dx,bx
402
        cmp     ax,dx
204
        cmp     ax,dx
403
        jnz     cpugood
205
        jnz     cpugood
404
        mov     si,not386-0x10000
206
        mov     si,not386
405
sayerr:
207
sayerr:
406
        call    print
208
        call    print
407
        jmp     $
209
        jmp     $
408
     cpugood:
210
     cpugood:
Line -... Line 211...
-
 
211
 
409
 
212
 
410
; set up esp
213
; set up esp
Line 411... Line -...
411
    movzx    esp, sp
-
 
412
 
-
 
413
; FLUSH 8042 KEYBOARD CONTROLLER
-
 
414
 
-
 
415
;// mike.dld [
-
 
416
 ;       mov     al,0xED
-
 
417
 ;       out     0x60,al
-
 
418
 ;       or      cx,-1
-
 
419
 ;     @@:
-
 
420
 ;       in      al,0x64
-
 
421
 ;       test    al,2
-
 
422
 ;       jz      @f
-
 
423
 ;       loop    @b
-
 
424
 ;     @@:
-
 
425
 ;       mov     al,0
-
 
426
 ;       out     0x60,al
-
 
427
 ;       or      cx,-1
-
 
428
 ;     @@:
-
 
429
 ;       in      al,0x64
-
 
430
 ;       test    al,2
-
 
431
 ;       jz      @f
-
 
432
 ;       loop    @b
-
 
433
 ;     @@:
-
 
434
;// mike.dld ]
-
 
435
 
-
 
436
;       mov     ecx,10000
-
 
437
;      fl1:
-
 
438
;       in      al,0x64
-
 
439
;       loop    fl1
-
 
440
;       test    al,1
-
 
441
;       jz      fl2
-
 
442
;       in      al,0x60
-
 
443
;       jmp     fl1
-
 
444
;      fl2:
-
 
445
 
-
 
446
;****************************************************************
-
 
447
; The function is modified Mario79
-
 
448
;*****************************************************************
-
 
449
; wait_kbd:        ; variant 1
-
 
450
;       mov      cx,2500h  ;çàäåðæêà ïîðÿäêà 10 ìñåê
-
 
451
; test_kbd:
-
 
452
;       in       al,64h    ;÷èòàåì ñîñòîÿíèå êëàâèàòóðû
-
 
453
;       test     al,2      ;ïðîâåðêà áèòà ãîòîâíîñòè
-
 
454
;       loopnz   test_kbd
214
    movzx    esp, sp
455
 
215
 
456
        push    0
216
        push    0
457
        pop     es
-
 
458
        and     word [es:0x9031], 0
-
 
459
; \begin{Mario79}
-
 
460
; find HDD IDE DMA PCI device
217
        pop     es
461
; check for PCI BIOS
218
        and     word [es:0x9031], 0
462
        mov     ax, 0xB101
219
        mov     ax, 0xB101
463
        int     0x1A
220
        int     0x1A
464
        jc      .nopci
221
        jc      .nopci
465
        cmp     edx, 'PCI '
-
 
466
        jnz     .nopci
-
 
467
; find PCI class code
-
 
468
; class 1 = mass storage
-
 
469
; subclass 1 = IDE controller
222
        cmp     edx, 'PCI '
470
; a) class 1, subclass 1, programming interface 0x80
223
        jnz     .nopci
471
        mov     ax, 0xB103
224
        mov     ax, 0xB103
472
        mov     ecx, 1*10000h + 1*100h + 0x80
225
        mov     ecx, 1*10000h + 1*100h + 0x80
473
        mov     si, 0   ; device index = 0
226
        mov     si, 0   ; device index = 0
Line 520... Line 273...
520
    mov    [es : 0x9046], cx        ; Save APM flags
273
    mov    [es : 0x9046], cx        ; Save APM flags
Line 521... Line 274...
521
 
274
 
522
    ; Write APM ver ----
275
    ; Write APM ver ----
523
    and    ax, 0xf0f
276
    and    ax, 0xf0f
524
    add    ax, '00'
277
    add    ax, '00'
525
    mov    si, msg_apm - 0x10000
278
    mov    si, msg_apm
526
    mov    [si + 5], ah
279
    mov    [si + 5], ah
527
    mov    [si + 7], al
280
    mov    [si + 7], al
-
 
281
    _setcursor 0, 3
528
    _setcursor 0, 3
282
 
529
    call    printplain
283
    call    printplain
530
    _setcursor d80x25_top_num,0
284
    _setcursor d80x25_top_num,0
Line 531... Line 285...
531
    ; ------------------
285
    ; ------------------
532
 
286
 
533
    mov    ax, 0x5304            ; Disconnect interface
287
    mov    ax, 0x5304            ; Disconnect interface
534
    xor    bx, bx
288
    xor    bx, bx
535
    int    0x15
289
    int    0x15
536
    mov    ax, 0x5303            ; Connect 32 bit mode interface
290
    mov    ax, 0x5303            ; Connect 32 bit mode interface
-
 
291
    xor    bx, bx
-
 
292
    int    0x15
-
 
293
 
-
 
294
    push 0
-
 
295
    pop es
-
 
296
 
-
 
297
    mov [es:0x9050], ax
-
 
298
    mov [es:0x9052], cx
-
 
299
    mov [es:0x9040], dx
537
    xor    bx, bx
300
 
538
    int    0x15
301
 
539
    ; init selectors
302
    ; init selectors
540
    movzx    eax, ax ; real-mode segment base address of protected-mode 32-bit code segment
303
;    movzx    eax, ax ; real-mode segment base address of protected-mode 32-bit code segment
541
    shl    eax, 4
304
;    shl    eax, 4
542
    mov    [apm_code_32 - 0x10000 + 2], ax
305
;    mov    [dword apm_code_32 + 2], ax
543
    shr    eax, 16
306
;    shr    eax, 16
544
    mov    [apm_code_32 - 0x10000 + 4], al
307
;    mov    [dword apm_code_32 + 4], al
545
    movzx    ecx, cx ; real-mode segment base address of protected-mode 16-bit code segment
308
;    movzx    ecx, cx ; real-mode segment base address of protected-mode 16-bit code segment
546
    shl    ecx, 4
309
;    shl    ecx, 4
547
    mov    [apm_code_16 - 0x10000 + 2], cx
310
;    mov    [dword apm_code_16 + 2], cx
548
    shr    ecx, 16
311
;    shr    ecx, 16
549
    mov    [apm_code_16 - 0x10000 + 4], cl
312
;    mov    [dword apm_code_16 + 4], cl
550
    movzx    edx, dx ; real-mode segment base address of protected-mode 16-bit data segment
313
;    movzx    edx, dx ; real-mode segment base address of protected-mode 16-bit data segment
551
    shl    edx, 4
314
;    shl    edx, 4
552
    mov    [apm_data_16 - 0x10000 + 2], dx
315
;    mov    [dword apm_data_16 + 2], dx
553
    shr    edx, 16
316
;    shr    edx, 16
554
    mov    [apm_data_16 - 0x10000 + 4], dl
317
;    mov    [dword apm_data_16 + 4], dl
555
    mov    [es : 0x9040], ebx              ; offset of APM entry point
318
;    mov    [es : 0x9040], ebx              ; offset of APM entry point
Line -... Line 319...
-
 
319
apm_end:
556
apm_end:
320
; -----------------------------------------
Line 557... Line 321...
557
; -----------------------------------------
321
 
558
 
322
 
559
; DISPLAY VESA INFORMATION
323
; DISPLAY VESA INFORMATION
560
 
324
 
561
    push    0
325
    push    0
562
    pop    es
326
    pop    es
563
        mov     ax,0x4f00
327
        mov     ax,0x4f00
564
        mov     di,0xa000
328
        mov     di,0xa000
565
        int     0x10
329
        int     0x10
566
        cmp     ax,0x004f
330
        cmp     ax,0x004f
567
        mov    si, novesa-0x10000
331
        mov    si, novesa
568
        jnz    @f
332
        jnz    @f
569
        mov bx, word [es:di+0x12]
333
        mov bx, word [es:di+0x12]
570
        shl ebx,16
334
        shl ebx,16
571
        mov [es:0x9050], ebx
335
        mov [es:0x9050], ebx
572
        mov     ax,[es:di+4]
336
        mov     ax,[es:di+4]
573
        add     ax,'0'*256+'0'
337
        add     ax,'0'*256+'0'
Line 574... Line 338...
574
        mov    si,vervesa-0x10000
338
        mov    si,vervesa
Line 582... Line 346...
582
; a) preboot_graph = graphical mode
346
; a) preboot_graph = graphical mode
583
;    preboot_gprobe = probe this mode?
347
;    preboot_gprobe = probe this mode?
584
; b) preboot_dma_write  = use DMA write?
348
; b) preboot_dma_write  = use DMA write?
585
; c) preboot_vrrm = use VRR?
349
; c) preboot_vrrm = use VRR?
586
; d) preboot_device = from what boot?
350
; d) preboot_device = from what boot?
587
    mov    di, preboot_graph-0x10000
351
    mov    di, preboot_graph
588
; check bootloader block
352
; check bootloader block
589
    cmp    [.loader_block-0x10000], -1
353
    cmp    [.loader_block], -1
590
    jz    .noloaderblock
354
    jz    .noloaderblock
591
    les    bx, [.loader_block-0x10000]
355
    les    bx, [.loader_block]
592
    cmp    byte [es:bx], 1
356
    cmp    byte [es:bx], 1
593
    mov    si, loader_block_error-0x10000
357
    mov    si, loader_block_error
594
    jnz    sayerr
358
    jnz    sayerr
595
    test    byte [es:bx+1], 1
359
    test    byte [es:bx+1], 1
596
    jz    @f
360
    jz    @f
597
; image in memory present
361
; image in memory present
598
    cmp    [di+preboot_device-preboot_graph], 0
362
    cmp    [di+preboot_device-preboot_graph], 0
599
    jnz    @f
363
    jnz    @f
600
    mov    [di+preboot_device-preboot_graph], 3
364
    mov    [di+preboot_device-preboot_graph], 3
601
@@:
365
@@:
602
.noloaderblock:
366
.noloaderblock:
603
; determine default settings
367
; determine default settings
604
    mov    [.bSettingsChanged-0x10000], 0
368
    mov    [.bSettingsChanged], 0
605
    cmp    byte [di], 0
369
    cmp    byte [di], 0
606
    jnz    .preboot_gr_end
370
    jnz    .preboot_gr_end
607
    mov    [di+preboot_gprobe-preboot_graph], 0
371
    mov    [di+preboot_gprobe-preboot_graph], 0
608
    mov    al, [vervesa+vervesa_off-0x10000]
372
    mov    al, [vervesa+vervesa_off]
609
    cmp    al, 'x'
373
    cmp    al, 'x'
610
    jz    .novesa
374
    jz    .novesa
611
    cmp    al, '1'
375
    cmp    al, '1'
612
    jz    .vesa12
376
    jz    .vesa12
613
    mov    [di+preboot_gprobe-preboot_graph], 2
377
    mov    [di+preboot_gprobe-preboot_graph], 2
Line 626... Line 390...
626
    cmp    [di+preboot_vrrm-preboot_graph], 1
390
    cmp    [di+preboot_vrrm-preboot_graph], 1
627
    adc    [di+preboot_vrrm-preboot_graph], 0
391
    adc    [di+preboot_vrrm-preboot_graph], 0
628
    cmp    [di+preboot_device-preboot_graph], 1
392
    cmp    [di+preboot_device-preboot_graph], 1
629
    adc    [di+preboot_device-preboot_graph], 0
393
    adc    [di+preboot_device-preboot_graph], 0
630
; notify user
394
; notify user
631
    mov    si, linef-0x10000
395
    mov    si, linef
632
    call    print
396
    call    print
633
    mov    si, start_msg-0x10000
397
    mov    si, start_msg
634
    call    print
398
    call    print
635
    mov    si, time_msg-0x10000
399
    mov    si, time_msg
636
    call    print
400
    call    print
637
; get start time
401
; get start time
638
    call    .gettime
402
    call    .gettime
639
    mov    [.starttime-0x10000], eax
403
    mov    [.starttime], eax
640
    mov    word [.timer-0x10000], .newtimer
404
    mov    word [.timer], .newtimer
641
    mov    word [.timer-0x10000+2], cs
405
    mov    word [.timer+2], cs
642
.printcfg:
406
.printcfg:
643
    _setcursor 9,0
407
    _setcursor 9,0
644
    mov    si, current_cfg_msg-0x10000
408
    mov    si, current_cfg_msg
645
    call    print
409
    call    print
646
    mov    si, curvideo_msg-0x10000
410
    mov    si, curvideo_msg
647
    call    print
411
    call    print
648
    mov    al, [preboot_graph-0x10000]
412
    mov    al, [preboot_graph]
649
    cmp    al, 8
413
    cmp    al, 8
650
    ja    .pnovesa
414
    ja    .pnovesa
651
    mov    dl, al
415
    mov    dl, al
652
    and    eax, 3
416
    and    eax, 3
653
    mov    si, [modes_msg-0x10000+eax*2]
417
    mov    si, [modes_msg+eax*2]
654
    call    printplain
418
    call    printplain
655
    mov    si, modevesa20-0x10000
419
    mov    si, modevesa20
656
    cmp    dl, 4
420
    cmp    dl, 4
657
    jbe    @f
421
    jbe    @f
658
    mov    si, modevesa12-0x10000
422
    mov    si, modevesa12
659
@@:
423
@@:
660
    call    printplain
424
    call    printplain
661
    cmp    dl, 4
425
    cmp    dl, 4
662
    ja    .x
426
    ja    .x
663
    mov    si, probeno_msg-0x10000
427
    mov    si, probeno_msg
664
    cmp    [preboot_gprobe-0x10000], 2
428
    cmp    [preboot_gprobe], 2
665
    jnz    @f
429
    jnz    @f
666
    mov    si, probeok_msg-0x10000
430
    mov    si, probeok_msg
667
@@:
431
@@:
668
    call    printplain
432
    call    printplain
669
.x:
433
.x:
670
    jmp    .c
434
    jmp    .c
671
.pnovesa:
435
.pnovesa:
672
    cmp    al, 9
436
    cmp    al, 9
673
    mov    si, mode9-0x10000
437
    mov    si, mode9
674
    jz    @b
438
    jz    @b
675
    mov    si, mode10-0x10000
439
    mov    si, mode10
676
    jmp    @b
440
    jmp    @b
677
.c:
441
.c:
678
    mov    si, linef-0x10000
442
    mov    si, linef
679
    call    printplain
443
    call    printplain
680
    mov    si, dma_msg-0x10000
444
    mov    si, dma_msg
681
    cmp    [preboot_dma_write-0x10000], 1
445
    cmp    [preboot_dma_write], 1
682
    call    .say_on_off
446
    call    .say_on_off
683
    mov    si, vrrm_msg-0x10000
447
    mov    si, vrrm_msg
684
    cmp    [preboot_vrrm-0x10000], 1
448
    cmp    [preboot_vrrm], 1
685
    call    .say_on_off
449
    call    .say_on_off
686
    mov    si, preboot_device_msg-0x10000
450
    mov    si, preboot_device_msg
687
    call    print
451
    call    print
688
    mov    al, [preboot_device-0x10000]
452
    mov    al, [preboot_device]
689
    and    eax, 3
453
    and    eax, 3
690
    mov    si, [preboot_device_msgs-0x10000+eax*2]
454
    mov    si, [preboot_device_msgs+eax*2]
691
    call    printplain
455
    call    printplain
692
.wait:
456
.wait:
693
    _setcursor 25,0        ; out of screen
457
    _setcursor 25,0        ; out of screen
694
; set timer interrupt handler
458
; set timer interrupt handler
695
    cli
459
    cli
696
    push    0
460
    push    0
697
    pop    es
461
    pop    es
698
    mov    eax, [es:8*4]
462
    mov    eax, [es:8*4]
699
    mov    [.oldtimer-0x10000], eax
463
    mov    [.oldtimer], eax
700
    mov    eax, [.timer-0x10000]
464
    mov    eax, [.timer]
701
    mov    [es:8*4], eax
465
    mov    [es:8*4], eax
702
    sti
466
    sti
703
; wait for keypressed
467
; wait for keypressed
704
    mov    ah, 0
468
    mov    ah, 0
705
    int    16h
469
    int    16h
706
    push    ax
470
    push    ax
707
; restore timer interrupt
471
; restore timer interrupt
708
    push    0
472
    push    0
709
    pop    es
473
    pop    es
710
    mov    eax, [.oldtimer-0x10000]
474
    mov    eax, [.oldtimer]
711
    mov    [es:8*4], eax
475
    mov    [es:8*4], eax
712
    mov    [.timer-0x10000], eax
476
    mov    [.timer], eax
713
    _setcursor 7,0
477
    _setcursor 7,0
714
    mov    si, space_msg-0x10000
478
    mov    si, space_msg
715
    call    printplain
479
    call    printplain
716
    pop    ax
480
    pop    ax
717
; switch on key
481
; switch on key
718
    cmp    al, 13
482
    cmp    al, 13
719
    jz    .continue
483
    jz    .continue
Line 725... Line 489...
725
    cmp    al, 'c'
489
    cmp    al, 'c'
726
    jz    .change_c
490
    jz    .change_c
727
    cmp    al, 'd'
491
    cmp    al, 'd'
728
    jnz    .wait
492
    jnz    .wait
729
    _setcursor 15,0
493
    _setcursor 15,0
730
    mov     si,bdev-0x10000
494
    mov     si,bdev
731
    call    print
495
    call    print
732
    mov     bx,'13'
496
    mov     bx,'13'
733
    call    getkey
497
    call    getkey
734
    mov    [preboot_device-0x10000], al
498
    mov    [preboot_device], al
735
    _setcursor 13,0
499
    _setcursor 13,0
736
.d:
500
.d:
737
    mov    [.bSettingsChanged-0x10000], 1
501
    mov    [.bSettingsChanged], 1
738
    mov    si, space_msg-0x10000
502
    mov    si, space_msg
739
    call    printplain
503
    call    printplain
740
    _setcursor 15,0
504
    _setcursor 15,0
741
    mov    cx, 6
505
    mov    cx, 6
742
@@:
506
@@:
743
    call    printplain
507
    call    printplain
744
    loop    @b
508
    loop    @b
745
    jmp    .printcfg
509
    jmp    .printcfg
746
.change_a:
510
.change_a:
747
    _setcursor 15,0
511
    _setcursor 15,0
748
    mov    si, gr_mode-0x10000
512
    mov    si, gr_mode
749
    call    printplain
513
    call    printplain
750
    mov     bx, '09'
514
    mov     bx, '09'
751
    call    getkey
515
    call    getkey
752
    mov    [preboot_graph-0x10000], al
516
    mov    [preboot_graph], al
753
    cmp    al, 4
517
    cmp    al, 4
754
    ja    @f
518
    ja    @f
755
    mov    si, probetext-0x10000
519
    mov    si, probetext
756
    call    printplain
520
    call    printplain
757
    mov    bx, '12'
521
    mov    bx, '12'
758
    call    getkey
522
    call    getkey
759
    mov    [preboot_gprobe-0x10000], al
523
    mov    [preboot_gprobe], al
760
@@:
524
@@:
761
    _setcursor 10,0
525
    _setcursor 10,0
762
    jmp    .d
526
    jmp    .d
763
.change_b:
527
.change_b:
764
    _setcursor 15,0
528
    _setcursor 15,0
765
    mov    si, ask_dma-0x10000
529
    mov    si, ask_dma
766
    call    print
530
    call    print
767
    mov    bx, '12'
531
    mov    bx, '12'
768
    call    getkey
532
    call    getkey
769
    mov    [preboot_dma_write-0x10000], al
533
    mov    [preboot_dma_write], al
770
    _setcursor 11,0
534
    _setcursor 11,0
771
    jmp    .d
535
    jmp    .d
772
.change_c:
536
.change_c:
773
    _setcursor 15,0
537
    _setcursor 15,0
774
    mov    si, vrrmprint-0x10000
538
    mov    si, vrrmprint
775
    call    print
539
    call    print
776
    mov    bx, '12'
540
    mov    bx, '12'
777
    call    getkey
541
    call    getkey
778
    mov    [preboot_vrrm-0x10000], al
542
    mov    [preboot_vrrm], al
779
    _setcursor 12,0
543
    _setcursor 12,0
780
    jmp    .d
544
    jmp    .d
781
.say_on_off:
545
.say_on_off:
782
    pushf
546
    pushf
783
    call    print
547
    call    print
784
    mov    si, on_msg-0x10000
548
    mov    si, on_msg
785
    popf
549
    popf
786
    jz    @f
550
    jz    @f
787
    mov    si, off_msg-0x10000
551
    mov    si, off_msg
788
@@:    call    printplain
552
@@:    call    printplain
789
    ret
553
    ret
790
; novesa and vervesa strings are not used at the moment of executing this code
554
; novesa and vervesa strings are not used at the moment of executing this code
791
virtual at novesa
555
virtual at novesa
792
.oldtimer dd ?
556
.oldtimer dd ?
793
.starttime dd ?
557
.starttime dd ?
794
.bSettingsChanged db ?
558
.bSettingsChanged db ?
795
.timer dd ?
559
.timer dd ?
796
end virtual
560
end virtual
797
	org $+0x10000
-
 
798
.loader_block dd -1
561
.loader_block dd -1
799
	org $-0x10000
-
 
800
.gettime:
562
.gettime:
-
 
563
 
801
    mov    ah, 0
564
    mov    ah, 0
802
    int    1Ah
565
    int    1Ah
803
    xchg    ax, cx
566
    xchg    ax, cx
804
    shl    eax, 10h
567
    shl    eax, 10h
805
    xchg    ax, dx
568
    xchg    ax, dx
Line 807... Line 570...
807
.newtimer:
570
.newtimer:
808
    push    ds
571
    push    ds
809
    push    cs
572
    push    cs
810
    pop    ds
573
    pop    ds
811
    pushf
574
    pushf
812
    call    [.oldtimer-0x10000]
575
    call    [.oldtimer]
813
    pushad
576
    pushad
814
    call    .gettime
577
    call    .gettime
815
    sub    eax, [.starttime-0x10000]
578
    sub    eax, [.starttime]
816
    sub    ax, 18*5
579
    sub    ax, 18*5
817
    jae    .timergo
580
    jae    .timergo
818
    neg    ax
581
    neg    ax
819
    add    ax, 18-1
582
    add    ax, 18-1
820
    mov    bx, 18
583
    mov    bx, 18
Line 827... Line 590...
827
    jae    @f
590
    jae    @f
828
    cmp    al, 1
591
    cmp    al, 1
829
    mov    cl, 'ã'
592
    mov    cl, 'ã'
830
    jz    @f
593
    jz    @f
831
    mov    cl, 'ë'
594
    mov    cl, 'ë'
832
@@:    mov    [time_str+9-0x10000], cl
595
@@:    mov    [time_str+9], cl
833
else if lang eq et
596
else if lang eq et
834
    cmp    al, 1
597
    cmp    al, 1
835
    ja     @f
598
    ja     @f
836
    mov    [time_str+9-0x10000], ' '
599
    mov    [time_str+9], ' '
837
    mov    [time_str+10-0x10000],' '
600
    mov    [time_str+10],' '
838
@@:
601
@@:
839
else
602
else
840
; wait 5/4/3/2 seconds, 1 second
603
; wait 5/4/3/2 seconds, 1 second
841
    cmp    al, 1
604
    cmp    al, 1
842
    mov    cl, 's'
605
    mov    cl, 's'
843
    ja    @f
606
    ja    @f
844
    mov    cl, ' '
607
    mov    cl, ' '
845
@@:    mov    [time_str+9-0x10000], cl
608
@@:    mov    [time_str+9], cl
846
end if
609
end if
847
    add    al, '0'
610
    add    al, '0'
848
    mov    [time_str+1-0x10000], al
611
    mov    [time_str+1], al
849
    mov    si, time_msg-0x10000
612
    mov    si, time_msg
850
    _setcursor 7,0
613
    _setcursor 7,0
851
    call    print
614
    call    print
852
    _setcursor 25,0
615
    _setcursor 25,0
853
    popad
616
    popad
854
    pop    ds
617
    pop    ds
855
    iret
618
    iret
856
.timergo:
619
.timergo:
857
    push    0
620
    push    0
858
    pop    es
621
    pop    es
859
    mov    eax, [.oldtimer-0x10000]
622
    mov    eax, [.oldtimer]
860
    mov    [es:8*4], eax
623
    mov    [es:8*4], eax
861
    mov    sp, 0EC00h
624
    mov    sp, 0EC00h
862
.continue:
625
.continue:
863
    sti
626
    sti
864
    _setcursor 6,0
627
    _setcursor 6,0
865
    mov    si, space_msg-0x10000
628
    mov    si, space_msg
866
    call    printplain
629
    call    printplain
867
    call    printplain
630
    call    printplain
868
    _setcursor 6,0
631
    _setcursor 6,0
869
    mov    si, loading_msg-0x10000
632
    mov    si, loading_msg
870
    call    print
633
    call    print
871
    _setcursor 15,0
634
    _setcursor 15,0
872
    cmp    [.bSettingsChanged-0x10000], 0
635
    cmp    [.bSettingsChanged], 0
873
    jz    .load
636
    jz    .load
874
    cmp    [.loader_block-0x10000], -1
637
    cmp    [.loader_block], -1
875
    jz    .load
638
    jz    .load
876
    les    bx, [.loader_block-0x10000]
639
    les    bx, [.loader_block]
877
    mov    eax, [es:bx+3]
640
    mov    eax, [es:bx+3]
878
    push    ds
641
    push    ds
879
    pop    es
642
    pop    es
880
    test    eax, eax
643
    test    eax, eax
881
    jz    .load
644
    jz    .load
882
    push    eax
645
    push    eax
883
    mov    si, save_quest-0x10000
646
    mov    si, save_quest
884
    call    print
647
    call    print
885
.waityn:
648
.waityn:
886
    mov    ah, 0
649
    mov    ah, 0
887
    int    16h
650
    int    16h
888
    or    al, 20h
651
    or    al, 20h
889
    cmp    al, 'n'
652
    cmp    al, 'n'
890
    jz    .loadc
653
    jz    .loadc
891
    cmp    al, 'y'
654
    cmp    al, 'y'
892
    jnz    .waityn
655
    jnz    .waityn
893
    call    putchar
656
    call    putchar
894
    mov    byte [space_msg-0x10000+80], 186
657
    mov    byte [space_msg+80], 186
895
    pop    eax
658
    pop    eax
896
    push    cs
659
    push    cs
897
    push    .cont
660
    push    .cont
898
    push    eax
661
    push    eax
899
    retf
662
    retf
900
.loadc:
663
.loadc:
901
    pop    eax
664
    pop    eax
902
.cont:
665
.cont:
903
    push    cs
666
    push    cs
904
    pop    ds
667
    pop    ds
905
    mov    si, space_msg-0x10000
668
    mov    si, space_msg
906
    mov    byte [si+80], 0
669
    mov    byte [si+80], 0
907
    _setcursor 15,0
670
    _setcursor 15,0
908
    call    printplain
671
    call    printplain
909
    _setcursor 15,0
672
    _setcursor 15,0
910
.load:
673
.load:
911
; \end{diamond}[02.12.2005]
674
; \end{diamond}[02.12.2005]
Line 912... Line 675...
912
 
675
 
Line 913... Line 676...
913
; ASK GRAPHICS MODE
676
; ASK GRAPHICS MODE
914
 
677
 
915
    movzx    ax, [preboot_graph-0x10000]
678
    movzx    ax, [preboot_graph]
916
    push    0
679
    push    0
917
    pop    es
680
    pop    es
918
; address is gr_table+6*(ax-1)-0x10000
681
; address is gr_table+6*(ax-1)
919
        add    ax, ax
682
        add    ax, ax
920
        lea    si, [gr_table-0x10000 + eax + eax*2 - 6]
683
        lea    si, [gr_table + eax + eax*2 - 6]
921
        mov     bx,[si+0]
684
        mov     bx,[si+0]
922
        mov     cx,[si+2]
685
        mov     cx,[si+2]
923
        mov     dx,[si+4]
686
        mov     dx,[si+4]
Line 934... Line 697...
934
        jz    nov
697
        jz    nov
Line 935... Line 698...
935
 
698
 
Line 936... Line 699...
936
; USE DEFAULTS OR PROBE
699
; USE DEFAULTS OR PROBE
937
 
700
 
938
; bx - mode : cx - x size : dx - y size
701
; bx - mode : cx - x size : dx - y size
Line 939... Line 702...
939
    cmp    [preboot_gprobe-0x10000], 1
702
    cmp    [preboot_gprobe], 1
940
    jz    noprobe
703
    jz    noprobe
941
 
704
 
942
        mov     bx,0x100
705
        mov     bx,0x100
943
     newprobe:
706
     newprobe:
944
        inc     bx
707
        inc     bx
Line 945... Line 708...
945
        cmp     bx,0x17f
708
        cmp     bx,0x17f
946
        mov    si,prnotfnd-0x10000
709
        mov    si,prnotfnd
947
        jz    sayerr
710
        jz    sayerr
Line 988... Line 751...
988
        ; BPP
751
        ; BPP
989
        mov     al,byte [es:di+0x19]
752
        mov     al,byte [es:di+0x19]
990
        mov     [es:0x9000],al
753
        mov     [es:0x9000],al
991
       nov:
754
       nov:
992
        cmp     al,24
755
        cmp     al,24
993
        mov    si,bt24-0x10000
756
        mov    si,bt24
994
        jz    bppl
757
        jz    bppl
995
        cmp     al,32
758
        cmp     al,32
996
        mov     si,bt32-0x10000
759
        mov     si,bt32
997
        jz     bppl
760
        jz     bppl
998
        mov     si,btns-0x10000
761
        mov     si,btns
999
        jmp    sayerr
762
        jmp    sayerr
1000
       bppl:
763
       bppl:
1001
        call    print
764
        call    print
Line 1022... Line 785...
1022
; force yes
785
; force yes
1023
        mov     [es:0x901C], byte 1
786
        mov     [es:0x901C], byte 1
Line 1024... Line 787...
1024
 
787
 
Line 1025... Line 788...
1025
; DMA WRITE
788
; DMA WRITE
1026
 
789
 
Line 1027... Line 790...
1027
        mov     al, [preboot_dma_write-0x10000]
790
        mov     al, [preboot_dma_write]
Line 1028... Line 791...
1028
        mov     [es:0x901F],al
791
        mov     [es:0x901F],al
1029
 
792
 
1030
; VRR_M USE
-
 
1031
 
-
 
1032
        mov     al,[preboot_vrrm-0x10000]
-
 
1033
        mov     [es:0x9030],al
-
 
1034
 
-
 
1035
 
-
 
1036
; MEMORY MODEL
-
 
1037
 
-
 
1038
;        movzx   eax,byte [es:preboot_memory-0x10000]
-
 
1039
;        cmp     eax,0
-
 
1040
;        jne     pre_mem
-
 
1041
;;;;;;;;;;;;;;;;;;;;;;;;;
-
 
1042
; mario79 - memory size ;
-
 
1043
;;;;;;;;;;;;;;;;;;;;;;;;;
-
 
1044
;           mov ax,0E801h
-
 
1045
;;;           xor bx,bx    ; thanks to Alexei for bugfix [18.07.2004]
-
 
1046
;           xor cx, cx
-
 
1047
;           xor dx, dx
-
 
1048
;           int 0x15
-
 
1049
;           movzx ebx, dx ;bx
-
 
1050
;           movzx eax, cx ;ax
-
 
1051
;           shl   ebx,6   ; ïåðåâîä â êèëîáàéòû (x64)
-
 
1052
;           add   eax,ebx
-
 
1053
;           add eax, 1000h ;440h
-
 
1054
;           cmp eax,40000h ; 256?
-
 
1055
;           jge mem_256_z
-
 
1056
;           cmp eax,20000h ; 128?
-
 
1057
;           jge mem_128_z
-
 
1058
;           cmp eax,10000h ; 64?
-
 
1059
;           jge mem_64_z
-
 
1060
;           cmp eax,8000h ; 32?
-
 
1061
;           jge mem_32_z
-
 
1062
;           jmp mem_16_z
-
 
1063
;
-
 
1064
;mem_256_z: mov     si,memokz256-0x10000
-
 
1065
;           call    printplain
-
 
1066
;           mov eax,5
-
 
1067
;           jmp pre_mem
-
 
1068
;mem_128_z: mov     si,memokz128-0x10000
-
 
1069
;           call    printplain
-
 
1070
;           mov eax,4
-
 
1071
;           jmp pre_mem
-
 
1072
;mem_64_z:  mov     si,memokz64-0x10000
-
 
1073
;           call    printplain
-
 
1074
;           mov eax,3
-
 
1075
;           jmp pre_mem
-
 
1076
;mem_32_z:  mov     si,memokz32-0x10000
-
 
1077
;           call    printplain
-
 
1078
;           mov eax,2
-
 
1079
;           jmp pre_mem
-
 
1080
;mem_16_z:  mov     si,memokz16-0x10000
-
 
1081
;           call    printplain
-
 
1082
;           mov eax,1
-
 
1083
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
 
1084
;      pre_mem:
-
 
1085
;        push    word 0x0000
-
 
1086
;        pop     es
-
 
1087
;        mov     [es:0x9030],al
-
 
1088
;        push    word 0x1000
-
 
1089
;        pop     es
-
 
1090
;        mov     si,linef-0x10000
-
 
1091
;        call    printplain
-
 
1092
 
-
 
1093
 
-
 
1094
 
-
 
1095
 
-
 
1096
; DIRECT WRITE TO LFB, PAGING DISABLED
-
 
1097
 
-
 
1098
;        movzx   eax,byte [es:preboot_lfb-0x10000]
-
 
1099
;        mov     eax,1                             ; paging disabled
-
 
1100
;        cmp     eax,0
-
 
1101
;        jne     pre_lfb
-
 
1102
;        mov     si,gr_direct-0x10000
-
 
1103
;        call    printplain
-
 
1104
;        mov     ebx,'12'
-
 
1105
;        call    getkey
-
 
1106
;      pre_lfb:
-
 
1107
;        push    word 0x0000
-
 
1108
;        pop     es
-
 
1109
;        mov     [es:0x901E],al
-
 
1110
;        mov     ax,0x1000
793
; VRR_M USE
Line 1111... Line -...
1111
;        mov     es,ax
-
 
1112
;        mov     si,linef-0x10000
-
 
1113
;        call    printplain
794
 
Line 1114... Line 795...
1114
        mov     [es:0x901E],byte 1
795
        mov     al,[preboot_vrrm]
1115
 
796
        mov     [es:0x9030],al
1116
 
797
        mov     [es:0x901E],byte 1
Line 1117... Line 798...
1117
 
798
 
Line 1118... Line 799...
1118
; BOOT DEVICE
799
; BOOT DEVICE
1119
 
800
 
1120
    mov    al, [preboot_device-0x10000]
801
    mov    al, [preboot_device]
1121
        dec     al
802
        dec     al
1122
        mov     [boot_dev-0x10000],al
803
        mov     [boot_dev],al
1123
 
804
 
1124
; READ DISKETTE TO MEMORY
805
; READ DISKETTE TO MEMORY
1125
 
806
 
Line 1136... Line 817...
1136
        xor     dx, dx          ; starthead,drive
817
        xor     dx, dx          ; starthead,drive
1137
        mov     al, 1+9         ; no of sectors to read
818
        mov     al, 1+9         ; no of sectors to read
1138
        mov     bx, 0xB000      ; es:bx -> data area
819
        mov     bx, 0xB000      ; es:bx -> data area
1139
        call    boot_read_floppy
820
        call    boot_read_floppy
1140
; and copy them to extended memory
821
; and copy them to extended memory
1141
        mov     si, movedesc-0x10000
822
        mov     si, movedesc
1142
        mov     [si+8*2+3], bh
823
        mov     [si+8*2+3], bh
1143
        push    es
824
        push    es
1144
        push    ds
825
        push    ds
1145
        pop     es
826
        pop     es
1146
        mov     cx, 256*10
827
        mov     cx, 256*10
Line 1150... Line 831...
1150
        jz      @f
831
        jz      @f
1151
sayerr_floppy:
832
sayerr_floppy:
1152
        mov     dx, 0x3f2
833
        mov     dx, 0x3f2
1153
        mov     al, 0
834
        mov     al, 0
1154
        out     dx, al
835
        out     dx, al
1155
        mov     si, memmovefailed-0x10000
836
        mov     si, memmovefailed
1156
        jmp     sayerr_plain
837
        jmp     sayerr_plain
1157
@@:
838
@@:
1158
        add     dword [si+8*3+2], 512*10
839
        add     dword [si+8*3+2], 512*10
1159
; copy FAT to second copy
840
; copy FAT to second copy
1160
        mov     byte [si+8*2+3], 0xB2
841
        mov     byte [si+8*2+3], 0xB2
Line 1239... Line 920...
1239
        mul     cx
920
        mul     cx
1240
        div     bp
921
        div     bp
1241
        aam
922
        aam
1242
        xchg    al, ah
923
        xchg    al, ah
1243
        add     ax, '00'
924
        add     ax, '00'
1244
        mov     si, pros-0x10000
925
        mov     si, pros
1245
        cmp     [si], ax
926
        cmp     [si], ax
1246
        jz      @f
927
        jz      @f
1247
        mov     [si], ax
928
        mov     [si], ax
1248
        call    printplain
929
        call    printplain
1249
@@:
930
@@:
Line 1317... Line 998...
1317
;        dec     ax
998
;        dec     ax
1318
;        push    ax
999
;        push    ax
1319
;        jnz     reads
1000
;        jnz     reads
1320
;       readdone:
1001
;       readdone:
1321
;        pop     ax
1002
;        pop     ax
-
 
1003
 
1322
        mov     si,backspace2-0x10000
1004
        mov     si,backspace2
1323
        call    printplain
1005
        call    printplain
1324
        mov     si,okt-0x10000
1006
        mov     si,okt
1325
        call    printplain
1007
        call    printplain
-
 
1008
 
1326
       no_sys_on_floppy:
1009
no_sys_on_floppy:
1327
        xor    ax, ax        ; reset drive
1010
        xor    ax, ax        ; reset drive
1328
        xor    dx, dx
1011
        xor    dx, dx
1329
        int     0x13
1012
        int     0x13
1330
       mov dx,0x3f2 ; floppy motor off
1013
        mov dx,0x3f2 ; floppy motor off
1331
       mov al,0
1014
        mov al,0
1332
       out dx,al
1015
        out dx,al
Line 1333... Line -...
1333
 
-
 
1334
    push    es
-
 
1335
; PAGE TABLE
-
 
1336
 
-
 
1337
    push    dword [es:0x9018]
-
 
1338
;
-
 
1339
;        mmap_mem equ 64                ; amount of memory to map
-
 
1340
;
-
 
1341
        push    0x6000
-
 
1342
        pop    es                    ; es:di = 6000:0
-
 
1343
;        xor     di,di
-
 
1344
;        mov     cx,256*mmap_mem         ; Map (mapmem) M
-
 
1345
;; initialize as identity mapping
-
 
1346
;        xor    eax, eax
-
 
1347
;        call    pagetable_set
-
 
1348
;
-
 
1349
;
-
 
1350
; 4 KB PAGE DIRECTORY
-
 
1351
;
-
 
1352
       push    0x7F00
-
 
1353
       pop    es                ; es:di = 7F00:0
-
 
1354
;        xor     di, di
-
 
1355
;        mov     cx, 64 / 4
-
 
1356
;        mov     eax, 0x60007            ; for 0 M
-
 
1357
;        call    pagetable_set
-
 
1358
;        xor     si,si
-
 
1359
;        mov     di,second_base_address shr 20
-
 
1360
;        mov     cx,64/2
-
 
1361
;        rep     movs word [es:di], [es:si]
-
 
1362
 
-
 
1363
;        mov     eax, 0x7F000 +8+16      ; Page directory and enable caches
-
 
Line 1364... Line 1016...
1364
;        mov     cr3, eax
1016
 
Line 1365... Line -...
1365
 
-
 
1366
; SET GRAPHICS
-
 
1367
 
1017
 
1368
    pop    es
1018
; SET GRAPHICS
Line 1369... Line 1019...
1369
 
1019
 
1370
        xor ax, ax
1020
        xor ax, ax
Line 1378... Line 1028...
1378
        je      setgr
1028
        je      setgr
1379
        mov     ax,0x4f02            ; Vesa
1029
        mov     ax,0x4f02            ; Vesa
1380
       setgr:
1030
setgr:
1381
        int     0x10
1031
        int     0x10
1382
        test    ah,ah
1032
        test    ah,ah
1383
        mov    si, fatalsel-0x10000
1033
        mov    si, fatalsel
1384
        jnz    sayerr
1034
        jnz    sayerr
-
 
1035
 
1385
; set mode 0x12 graphics registers:
1036
; set mode 0x12 graphics registers:
1386
        cmp     bx,0x12
1037
        cmp     bx,0x12
1387
        jne     gmok2
1038
        jne     gmok2
Line 1388... Line 1039...
1388
 
1039
 
Line 1403... Line 1054...
1403
 
1054
 
1404
        mov     al,0x08
1055
        mov     al,0x08
1405
        pop    dx
1056
        pop    dx
1406
        out     dx,al      ; select GDC bit mask register
1057
        out     dx,al      ; select GDC bit mask register
1407
                           ; for writes to 0x03cf
-
 
1408
 
1058
                           ; for writes to 0x03cf
1409
       gmok2:
1059
gmok2:
1410
        push    ds
1060
        push    ds