Subversion Repositories Kolibri OS

Rev

Rev 7136 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2288 clevermous 1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                              ;;
5363 yogev_ezra 3
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
2288 clevermous 4
;; Distributed under terms of the GNU General Public License    ;;
5
;;                                                              ;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7
 
8
$Revision: 8175 $
9
 
10
struc VBE_VGAInfo {
11
  .VESASignature          dd ?    ; char
12
  .VESAVersion            dw ?    ; short
13
  .OemStringPtr           dd ?    ; char *
14
  .Capabilities           dd ?    ; ulong
15
  .VideoModePtr           dd ?    ; ulong
16
  .TotalMemory            dw ?    ; short
17
  ; VBE 2.0+
18
  .OemSoftwareRev         db ?    ; short
19
  .OemVendorNamePtr       dw ?    ; char *
20
  .OemProductNamePtr      dw ?    ; char *
21
  .OemProductRevPtr       dw ?    ; char *
22
  .reserved               rb 222  ; char
23
  .OemData                rb 256  ; char
24
}
25
 
26
struc VBE_ModeInfo {
27
  .ModeAttributes         dw ?    ; short
28
  .WinAAttributes         db ?    ; char
29
  .WinBAttributes         db ?    ; char
30
  .WinGranularity         dw ?    ; short
31
  .WinSize                dw ?    ; short
32
  .WinASegment            dw ?    ; ushort
33
  .WinBSegment            dw ?    ; ushort
34
  .WinFuncPtr             dd ?    ; void *
35
  .BytesPerScanLine       dw ?    ; short
36
  .XRes                   dw ?    ; short
37
  .YRes                   dw ?    ; short
38
  .XCharSize              db ?    ; char
39
  .YCharSize              db ?    ; char
40
  .NumberOfPlanes         db ?    ; char
41
  .BitsPerPixel           db ?    ; char
42
  .NumberOfBanks          db ?    ; char
43
  .MemoryModel            db ?    ; char
44
  .BankSize               db ?    ; char
45
  .NumberOfImagePages     db ?    ; char
46
  .res1                   db ?    ; char
47
  .RedMaskSize            db ?    ; char
48
  .RedFieldPosition       db ?    ; char
49
  .GreenMaskSize          db ?    ; char
50
  .GreenFieldPosition     db ?    ; char
51
  .BlueMaskSize           db ?    ; char
52
  .BlueFieldPosition      db ?    ; char
53
  .RsvedMaskSize          db ?    ; char
54
  .RsvedFieldPosition     db ?    ; char
55
  .DirectColorModeInfo    db ?    ; char ; MISSED IN THIS TUTORIAL!! SEE ABOVE
56
  ; VBE 2.0+
57
  .PhysBasePtr            dd ?    ; ulong
58
  .OffScreenMemOffset     dd ?    ; ulong
59
  .OffScreenMemSize       dw ?    ; short
60
  ; VBE 3.0+
61
  .LinbytesPerScanLine    dw ?    ; short
62
  .BankNumberOfImagePages db ?    ; char
63
  .LinNumberOfImagePages  db ?    ; char
64
  .LinRedMaskSize         db ?    ; char
65
  .LinRedFieldPosition    db ?    ; char
66
  .LingreenMaskSize       db ?    ; char
67
  .LinGreenFieldPosition  db ?    ; char
68
  .LinBlueMaskSize        db ?    ; char
69
  .LinBlueFieldPosition   db ?    ; char
70
  .LinRsvdMaskSize        db ?    ; char
71
  .LinRsvdFieldPosition   db ?    ; char
72
  .MaxPixelClock          dd ?    ; ulong
73
  .res2                   rb 190  ; char
74
}
75
 
76
virtual at $A000
77
  vi VBE_VGAInfo
78
  mi VBE_ModeInfo
79
modes_table:
80
end virtual
3539 clevermous 81
cursor_pos  dw 0         ;временное хранение курсора.
3999 mario79 82
cursor_pos_old  dw 0
2288 clevermous 83
home_cursor dw 0    ;current shows rows a table
84
end_cursor  dw 0     ;end of position current shows rows a table
85
scroll_start dw 0    ;start position of scroll bar
86
scroll_end  dw 0     ;end position of scroll bar
7136 dunkaist 87
long_v_table = 9   ;long of visible video table
88
size_of_step = 10
89
scroll_area_size = long_v_table - 2
2288 clevermous 90
int2str:
91
        dec     bl
92
        jz      @f
93
        xor     edx, edx
94
        div     ecx
95
        push    edx
96
        call    int2str
97
        pop     eax
98
    @@:
99
        or      al, 0x30
100
        mov     [ds:di], al
101
        inc     di
102
        ret
103
 
104
int2strnz:
105
        cmp     eax, ecx
106
        jb      @f
107
        xor     edx, edx
108
        div     ecx
109
        push    edx
110
        call    int2strnz
111
        pop     eax
112
    @@:
113
        or      al, 0x30
114
        mov     [es:di], al
115
        inc     di
116
        ret
117
 
118
;-------------------------------------------------------
119
;Write message about incorrect v_mode and write message about jmp on swith v_mode
120
v_mode_error:
121
        _setcursor 19,2
122
        mov     si, fatalsel
123
        call    printplain
124
        _setcursor 20,2
125
        mov     si, pres_key
126
        call    printplain
127
        xor     eax, eax
128
        int     16h
129
        jmp     cfgmanager.d
130
;-------------------------------------------------------
131
;
132
 
133
 
134
 
135
;-------------------------------------------------------
136
print_vesa_info:
137
        _setcursor 5,2
138
 
139
        mov     [es:vi.VESASignature], 'VBE2'
140
        mov     ax, 0x4F00
141
        mov     di, vi     ;0xa000
142
        int     0x10
143
        or      ah, ah
144
        jz      @f
145
        mov     [es:vi.VESASignature], 'VESA'
146
        mov     ax, $4F00
147
        mov     di, vi
148
        int     0x10
149
        or      ah, ah
150
        jnz     .exit
151
  @@:
152
        cmp     [es:vi.VESASignature], 'VESA'
153
        jne     .exit
154
        cmp     [es:vi.VESAVersion], 0x0100
155
        jb      .exit
156
        jmp     .vesaok2
157
 
158
  .exit:
159
        mov     si, novesa
160
        call    printplain
161
        ret
162
 
163
  .vesaok2:
164
        mov     ax, [es:vi.VESAVersion]
165
        add     ax, '00'
166
 
167
        mov     [s_vesa.ver], ah
168
        mov     [s_vesa.ver+2], al
169
        mov     si, s_vesa
170
        call    printplain
171
 
172
        _setcursor 4,2
173
        mov     si, word[es:vi.OemStringPtr]
174
        mov     di, si
175
 
176
        push    ds
177
        mov     ds, word[es:vi.OemStringPtr+2]
178
        call    printplain
179
        pop     ds
180
 
181
        ret
182
;-----------------------------------------------------------------------------
183
 
184
calc_vmodes_table:
185
        pushad
186
 
187
;        push    0
188
;        pop     es
189
 
190
        lfs     si, [es:vi.VideoModePtr]
191
 
192
        mov     bx, modes_table
3539 clevermous 193
;save no vesa mode of work 320x200, EGA/CGA 256 梥⮢ and 640x480, VGA 16 梥⮢
2288 clevermous 194
        mov     word [es:bx], 640
195
        mov     word [es:bx+2], 480
196
        mov     word [es:bx+6], 0x13
197
 
198
        mov     word [es:bx+10], 640
199
        mov     word [es:bx+12], 480
200
        mov     word [es:bx+16], 0x12
201
        add     bx, 20
202
  .next_mode:
203
        mov     cx, word [fs:si]; mode number
204
        cmp     cx, -1
205
        je      .modes_ok.2
206
 
207
        mov     ax, 0x4F01
208
        mov     di, mi
209
        int     0x10
210
 
211
        or      ah, ah
212
        jnz     .modes_ok.2;vesa_info.exit
213
 
214
        test    [es:mi.ModeAttributes], 00000001b  ;videomode support ?
215
        jz      @f
216
        test    [es:mi.ModeAttributes], 00010000b  ;picture ?
217
        jz      @f
218
        test    [es:mi.ModeAttributes], 10000000b  ;LFB ?
219
        jz      @f
220
 
5154 hidnplayr 221
        cmp     [es:mi.BitsPerPixel], 16   ;List only supported videomodes (16, 24 and 32 bpp)
2288 clevermous 222
        jb      @f
223
 
5154 hidnplayr 224
; 16 bpp might actually be 15 bpp
225
        cmp     [es:mi.BitsPerPixel], 16
226
        jne     .l0
227
        cmp     [es:mi.GreenMaskSize], 5
228
        jne     .l0
2288 clevermous 229
;        mov     [es:mi.BitsPerPixel],15
5154 hidnplayr 230
        jmp     @f                         ; 15 bpp isnt supported ATM
2288 clevermous 231
 
232
 
233
.l0:
234
        cmp     [es:mi.XRes], 640
235
        jb      @f
236
        cmp     [es:mi.YRes], 480
237
        jb      @f
238
;        cmp     [es:mi.BitsPerPixel],8
239
;        jb      @f
240
 
241
        mov     ax, [es:mi.XRes]
242
        mov     [es:bx+0], ax              ; +0[2] : resolution X
243
        mov     ax, [es:mi.YRes]
244
        mov     [es:bx+2], ax              ; +2[2] : resolution Y
245
        mov     ax, [es:mi.ModeAttributes]
246
        mov     [es:bx+4], ax              ; +4[2] : attributes
247
 
248
        cmp     [s_vesa.ver], '2'
2407 mario79 249
;        jb      .lp1
250
        jb      @f    ; We do not use Vesa 1.2 mode is now
2288 clevermous 251
 
252
        or      cx, 0x4000 ; use LFB
253
.lp1:
254
        mov     [es:bx+6], cx              ; +6 : mode number
255
        movzx   ax, byte [es:mi.BitsPerPixel]
256
        mov     word [es:bx+8], ax              ; +8 : bits per pixel
3591 Serge 257
        add     bx, size_of_step                ; size of record
2288 clevermous 258
 
259
    @@:
260
        add     si, 2
261
        jmp     .next_mode
262
 
263
  .modes_ok.2:
264
 
265
        mov     word[es:bx], -1 ;end video table
266
        mov     word[end_cursor], bx    ;save end cursor position
267
;;;;;;;;;;;;;;;;;;
268
;Sort array
269
;        mov     si,modes_table
270
;.new_mode:
271
;        mov     ax,word [es:si]
272
;        cmp     ax,-1
273
;        je      .exxit
274
;        add     ax,word [es:si+2]
275
;        add     ax,word [es:si+8]
276
;        mov     bp,si
277
;.again:
278
;        add     bp,12
279
;        mov     bx,word [es:bp]
280
;        cmp     bx,-1
281
;        je      .exit
282
;        add     bx,word [es:bp+2]
283
;        add     bx,word [es:bp+8]
3591 Serge 284
;
2288 clevermous 285
;        cmp     ax,bx
286
;        ja      .loops
287
;        jmp     .again
3591 Serge 288
;.loops:
2288 clevermous 289
;        push    dword [es:si]
290
;        push    dword [es:si+4]
291
;        push    dword [es:si+8]
292
;        push    dword [es:bp]
293
;        push    dword [es:bp+4]
294
;        push    dword [es:bp+8]
295
;
296
;        pop     dword [es:si+8]
297
;        pop     dword [es:si+4]
298
;        pop     dword [es:si]
299
;        pop     dword [es:bp+8]
300
;        pop     dword [es:bp+4]
301
;        pop     dword [es:bp]
302
;        jmp     .new_mode
303
;
304
;.exit:  add     si,12
305
;        jmp     .new_mode
306
;.exxit:
307
        popad
308
        ret
309
 
310
;-----------------------------------------------------------------------------
311
 
312
draw_current_vmode:
313
        push    0
314
        pop     es
315
 
316
        mov     si, word [cursor_pos]
317
 
318
        cmp     word [es:si+6], 0x12
319
        je      .no_vesa_0x12
320
 
321
        cmp     word [es:si+6], 0x13
322
        je      .no_vesa_0x13
323
 
324
if defined extended_primary_loader
325
        mov     di, config_file_variables
326
else
327
        mov     di, loader_block_error
328
end if
329
        movzx   eax, word[es:si+0]
330
        mov     ecx, 10
331
        call    int2strnz
332
        mov     byte[es:di], 'x'
333
        inc     di
334
        movzx   eax, word[es:si+2]
335
        call    int2strnz
336
        mov     byte[es:di], 'x'
337
        inc     di
338
        movzx   eax, word[es:si+8]
339
        call    int2strnz
340
        mov     dword[es:di], 0x00000d0a
341
if defined extended_primary_loader
342
        mov     si, config_file_variables
343
else
344
        mov     si, loader_block_error
345
end if
346
        push    ds
347
        push    es
348
        pop     ds
349
        call    printplain
350
        pop     ds
351
        ret
352
.no_vesa_0x13:
353
        mov     si, mode0
354
        jmp     .print
355
.no_vesa_0x12:
356
        mov     si, mode9
357
.print:
358
        call    printplain
359
        ret
360
;-----------------------------------------------------------------------------
361
check_first_parm:
362
if defined extended_primary_loader
363
        mov     cx, [number_vm]
364
        jcxz    .novbemode
365
        mov     si, modes_table
366
.findvbemode:
367
        cmp     [es:si+6], cx
368
        jnz     @f
369
        cmp     word [es:si+8], 32
370
        je      .ok_found_mode
371
        cmp     word [es:si+8], 24
372
        je      .ok_found_mode
5167 hidnplayr 373
        cmp     word [es:si+8], 16
374
        je      .ok_found_mode
2288 clevermous 375
@@:
376
        add     si, size_of_step
377
        cmp     word [es:si], -1
378
        jnz     .findvbemode
379
.novbemode:
380
        mov     ax, [x_save]
381
        test    ax, ax
382
        jz      .zerro
383
        mov     bx, [y_save]
384
        mov     si, modes_table
385
        call    .loops
386
        test    ax, ax
387
        jz      .ok_found_mode
388
else
389
        mov     si, word [preboot_graph]
390
        test    si, si
391
        jnz     .no_zero         ;if no zero
392
end if
393
.zerro:
394
;        mov     ax,modes_table
395
;        mov     word [cursor_pos],ax
396
;        mov     word [home_cursor],ax
397
;        mov     word [preboot_graph],ax
398
;SET default video of mode first probe will fined a move of work 1024x768@32
5169 hidnplayr 399
        mov     cx, 32
400
  .find_mode:
2288 clevermous 401
        mov     ax, 1024
402
        mov     bx, 768
403
        mov     si, modes_table
404
        call    .loops
405
        test    ax, ax
406
        jz      .ok_found_mode
407
        mov     ax, 800
408
        mov     bx, 600
409
        mov     si, modes_table
410
        call    .loops
411
        test    ax, ax
412
        jz      .ok_found_mode
413
        mov     ax, 640
414
        mov     bx, 480
415
        mov     si, modes_table
416
        call    .loops
417
        test    ax, ax
418
        jz      .ok_found_mode
5169 hidnplayr 419
        sub     cx, 8
420
        jnz     .find_mode
2288 clevermous 421
 
422
        mov     si, modes_table
423
if ~ defined extended_primary_loader
424
        jmp     .ok_found_mode
425
 
426
 
427
 
428
.no_zero:
429
        mov     bp, word [number_vm]
430
        cmp     bp, word [es:si+6]
431
        jz      .ok_found_mode
432
        mov     ax, word [x_save]
433
        mov     bx, word [y_save]
434
        mov     si, modes_table
435
        call    .loops
436
        test    ax, ax
437
        jz      .ok_found_mode
438
 
439
        mov     si, modes_table
440
;        cmp     ax,modes_table
441
;        jb      .zerro           ;check on correct if bellow
442
;        cmp     ax,word [end_cursor]
443
;        ja      .zerro           ;check on correct if anymore
444
end if
445
 
446
.ok_found_mode:
447
        mov     word [home_cursor], si
448
;        mov     word [cursor_pos],si
449
        mov     word [preboot_graph], si
450
        mov     ax, si
451
 
452
        mov     ecx, long_v_table
453
 
454
.loop:
455
        add     ax, size_of_step
456
        cmp     ax, word [end_cursor]
457
        jae     .next_step
458
        loop    .loop
459
.next_step:
460
        sub     ax, size_of_step*long_v_table
461
        cmp     ax, modes_table
462
        jae     @f
463
        mov     ax, modes_table
464
@@:
465
 
466
        mov     word [home_cursor], ax
467
        mov     si, [preboot_graph]
468
        mov     word [cursor_pos], si
469
 
470
        push    word [es:si]
471
        pop     word [x_save]
472
        push    word [es:si+2]
473
        pop     word [y_save]
474
        push    word [es:si+6]
475
        pop     word [number_vm]
476
 
477
        ret
478
;;;;;;;;;;;;;;;;;;;;;;;;;;;
479
.loops:
480
        cmp     ax, word [es:si]
481
        jne     .next
482
        cmp     bx, word [es:si+2]
483
        jne     .next
8175 dunkaist 484
        jcxz    @f
5169 hidnplayr 485
        cmp     cx, word [es:si+8]
486
        jne     .next
8175 dunkaist 487
@@:
5169 hidnplayr 488
        xor     ax, ax
489
        ret
2288 clevermous 490
.next:
491
        add     si, size_of_step
492
        cmp     word [es:si], -1
493
        je      .exit
494
        jmp     .loops
495
.exit:
496
        or      ax, -1
497
        ret
498
 
499
 
500
;-----------------------------------------------------------------------------
501
 
502
;default_vmode:
3591 Serge 503
 
2288 clevermous 504
;-----------------------------------------------------------------------------
505
draw_vmodes_table:
506
        _setcursor 9, 2
507
        mov     si, gr_mode
508
        call    printplain
509
 
510
        mov     si, _st
511
        call    printplain
512
 
513
        push    word [cursor_pos]
514
        pop     ax
515
        push    word [home_cursor]
516
        pop     si
517
        mov     cx, si
518
 
519
        cmp     ax, si
520
        je      .ok
521
        jb      .low
522
 
523
 
524
        add     cx, size_of_step*long_v_table
3591 Serge 525
 
2288 clevermous 526
        cmp     ax, cx
527
        jb      .ok
3591 Serge 528
 
2288 clevermous 529
        sub     cx, size_of_step*long_v_table
530
        add     cx, size_of_step
531
        cmp     cx, word[end_cursor]
532
        jae     .ok
533
        add     si, size_of_step
534
        push    si
535
        pop     word [home_cursor]
536
        jmp     .ok
537
 
538
 
539
.low:
540
        sub     cx, size_of_step
541
        cmp     cx, modes_table
542
        jb      .ok
543
        push    cx
544
        push    cx
545
        pop     word [home_cursor]
546
        pop     si
547
 
548
 
549
.ok:
550
; calculate scroll position
551
        push    si
552
        mov     ax, [end_cursor]
553
        sub     ax, modes_table
554
        mov     bx, size_of_step
555
        cwd
556
        div     bx
557
        mov     si, ax          ; si = size of list
558
        mov     ax, [home_cursor]
559
        sub     ax, modes_table
560
        cwd
561
        div     bx
562
        mov     di, ax
563
        mov     ax, scroll_area_size*long_v_table
564
        cwd
565
        div     si
566
        test    ax, ax
567
        jnz     @f
568
        inc     ax
569
@@:
570
        cmp     al, scroll_area_size
571
        jb      @f
572
        mov     al, scroll_area_size
573
@@:
574
        mov     cx, ax
575
; cx = scroll height
576
; calculate scroll pos
577
        xor     bx, bx          ; initialize scroll pos
578
        sub     al, scroll_area_size+1
579
        neg     al
580
        sub     si, long_v_table-1
581
        jbe     @f
582
        mul     di
583
        div     si
584
        mov     bx, ax
585
@@:
586
        inc     bx
587
        imul    ax, bx, size_of_step
588
        add     ax, [home_cursor]
589
        mov     [scroll_start], ax
590
        imul    cx, size_of_step
591
        add     ax, cx
592
        mov     [scroll_end], ax
593
        pop     si
594
        mov     bp, long_v_table              ;show rows
595
.@@_next_bit:
596
;clear cursor
597
        mov     ax, '  '
598
        mov     word[ds:_r1+21], ax
599
        mov     word[ds:_r1+50], ax
600
 
601
        mov     word[ds:_r2+21], ax
602
        mov     word[ds:_r2+45], ax
603
 
604
        mov     word[ds:_rs+21], ax
605
        mov     word[ds:_rs+46], ax
606
; draw string
607
        cmp     word [es:si+6], 0x12
608
        je      .show_0x12
609
        cmp     word [es:si+6], 0x13
610
        je      .show_0x13
611
 
612
        movzx   eax, word[es:si]
613
        cmp     ax, -1
614
        je      .@@_end
615
        mov     di, _rs+23
616
        mov     ecx, 10
617
        mov     bl, 4
618
        call    int2str
619
        movzx   eax, word[es:si+2]
620
        inc     di
621
        mov     bl, 4
622
        call    int2str
623
 
624
        movzx   eax, word[es:si+8]
625
        inc     di
626
        mov     bl, 2
627
        call    int2str
628
 
629
        cmp     si, word [cursor_pos]
630
        jne     .next
631
;draw   cursor
632
        mov     word[ds:_rs+21], '>>'
633
        mov     word[ds:_rs+46], '<<'
634
 
635
 
3591 Serge 636
 
2288 clevermous 637
.next:
638
        push    si
639
        mov     si, _rs
640
.@@_sh:
641
; add to the string pseudographics for scrollbar
642
        pop     bx
643
        push    bx
644
        mov     byte [si+53], ' '
645
        cmp     bx, [scroll_start]
646
        jb      @f
647
        cmp     bx, [scroll_end]
648
        jae     @f
649
        mov     byte [si+53], 0xDB ; filled bar
650
@@:
651
        push    bx
652
        add     bx, size_of_step
653
        cmp     bx, [end_cursor]
654
        jnz     @f
655
        mov     byte [si+53], 31 ; 'down arrow' symbol
656
@@:
657
        sub     bx, [home_cursor]
658
        cmp     bx, size_of_step*long_v_table
659
        jnz     @f
660
        mov     byte [si+53], 31 ; 'down arrow' symbol
661
@@:
662
        pop     bx
663
        cmp     bx, [home_cursor]
664
        jnz     @f
665
        mov     byte [si+53], 30 ; 'up arrow' symbol
666
@@:
667
        call    printplain
668
        pop     si
669
        add     si, size_of_step
670
 
671
        dec     bp
672
        jnz     .@@_next_bit
673
 
674
.@@_end:
675
        mov     si, _bt
676
        call    printplain
677
        ret
678
.show_0x13:
679
        push    si
680
 
681
        cmp     si, word [cursor_pos]
682
        jne     @f
683
        mov     word[ds:_r1+21], '>>'
684
        mov     word[ds:_r1+50], '<<'
685
@@:
686
        mov     si, _r1
687
        jmp     .@@_sh
688
.show_0x12:
689
        push    si
690
        cmp     si, word [cursor_pos]
691
        jne     @f
692
 
693
        mov     word[ds:_r2+21], '>>'
694
        mov     word[ds:_r2+45], '<<'
695
@@:
696
        mov     si, _r2
697
        jmp     .@@_sh
698
 
699
;-----------------------------------------------------------------------------
700
;Clear arrea of current video page (0xb800)
701
clear_vmodes_table:
702
        pusha
703
       ; draw frames
704
        push    es
705
        push    0xb800
706
        pop     es
707
        mov     di, 1444
708
        xor     ax, ax
709
        mov     ah, 1*16+15
3795 mario79 710
        mov     cx, 77
2288 clevermous 711
        mov     bp, 12
712
.loop_start:
713
        rep stosw
3795 mario79 714
        mov     cx, 77
715
        add     di, 6
2288 clevermous 716
        dec     bp
717
        jns     .loop_start
718
        pop     es
719
        popa
720
        ret
721
 
722
;-----------------------------------------------------------------------------
723
 
724
set_vmode:
725
        push    0 ;0;x1000
726
        pop     es
727
 
728
        mov     si, word [preboot_graph]           ;[preboot_graph]
729
        mov     cx, word [es:si+6]           ; number of mode
730
 
731
 
732
        mov     ax, word [es:si+0]           ; resolution X
733
        mov     bx, word [es:si+2]           ; resolution Y
734
 
735
 
7132 dunkaist 736
        mov     word [es:BOOT_LO.x_res], ax             ; resolution X
737
        mov     word [es:BOOT_LO.y_res], bx             ; resolution Y
738
        mov     word [es:BOOT_LO.vesa_mode], cx         ; number of mode
2288 clevermous 739
 
740
        cmp     cx, 0x12
741
        je      .mode0x12_0x13
742
        cmp     cx, 0x13
743
        je      .mode0x12_0x13
744
 
745
 
2407 mario79 746
;        cmp     byte [s_vesa.ver], '2'
747
;        jb      .vesa12
2288 clevermous 748
 
749
;  VESA 2 and Vesa 3
750
 
751
        mov     ax, 0x4f01
752
        and     cx, 0xfff
753
        mov     di, mi;0xa000
754
        int     0x10
755
        ; LFB
756
        mov     eax, [es:mi.PhysBasePtr];di+0x28]
7132 dunkaist 757
        mov     [es:BOOT_LO.lfb], eax
2288 clevermous 758
        ; ---- vbe voodoo
7136 dunkaist 759
        BytesPerLine = 0x10
2288 clevermous 760
        mov     ax, [es:di+BytesPerLine]
7132 dunkaist 761
        mov     [es:BOOT_LO.pitch], ax
2288 clevermous 762
        ; BPP
763
        cmp     [es:mi.BitsPerPixel], 16
764
        jne     .l0
765
        cmp     [es:mi.GreenMaskSize], 5
766
        jne     .l0
767
        mov     [es:mi.BitsPerPixel], 15
768
.l0:
769
        mov     al, byte [es:di+0x19]
7132 dunkaist 770
        mov     [es:BOOT_LO.bpp], al
2288 clevermous 771
        jmp     .exit
772
 
773
.mode0x12_0x13:
7132 dunkaist 774
        mov     byte [es:BOOT_LO.bpp], 32
775
        or      dword [es:BOOT_LO.lfb], 0xFFFFFFFF; 0x800000
2288 clevermous 776
 
777
 
778
;  VESA 1.2 PM BANK SWITCH ADDRESS
779
 
2407 mario79 780
;.vesa12:
781
;        mov     ax, 0x4f0A
782
;        xor     bx, bx
783
;        int     0x10
784
;        xor     eax, eax
785
;        xor     ebx, ebx
786
;        mov     ax, es
787
;        shl     eax, 4
788
;        mov     bx, di
789
;        add     eax, ebx
790
;        movzx   ebx, word[es:di]
791
;        add     eax, ebx
792
;        push    0x0000
793
;        pop     es
7132 dunkaist 794
;        mov     [es:BOOT_LO.bank_sw], eax
2288 clevermous 795
  .exit:
796
        ret
797
 
798
;=============================================================================
799
;=============================================================================
800
;=============================================================================
801