Subversion Repositories Kolibri OS

Rev

Rev 731 | Rev 746 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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