Subversion Repositories Kolibri OS

Rev

Rev 738 | Rev 749 | 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
        jmp     .ok_found_mode
746 Lrz 366
714 Lrz 367
 
368
 
746 Lrz 369
 
370
        mov     ax,word [x_save]
371
        mov     bx,word [y_save]
372
        mov     si,modes_table
373
        call    .loops
374
        test    ax,ax
375
        jz     .ok_found_mode
376
377
 
378
;        jb      .zerro           ;check on correct if bellow
379
;        cmp     ax,word [end_cursor]
380
;        ja      .zerro           ;check on correct if anymore
381
382
 
714 Lrz 383
        mov     word [home_cursor],si
384
;        mov     word [cursor_pos],si
385
        mov     word [preboot_graph],si
386
        mov     ax,si
387
388
 
389
390
 
391
        cmp     ax,word [end_cursor]
392
        jae     .next_step
393
        loop    .loop
394
.next_step:
395
        sub     ax,size_of_step*long_v_table
396
        cmp     ax,modes_table
397
        jae     @f
738 diamond 398
        mov     ax,modes_table
399
@@:
400
714 Lrz 401
 
402
        push    word [preboot_graph]
403
        pop     word [cursor_pos]
404
        ret
405
;;;;;;;;;;;;;;;;;;;;;;;;;;;
406
.loops:
407
        cmp     ax,word [es:si]
408
        jne     .next
409
        cmp     bx,word [es:si+2]
410
        jne     .next
411
        cmp     word [es:si+8],32
412
        je      .ok
413
        cmp     word [es:si+8],24
414
        je      .ok
415
.next:  add     si,size_of_step
416
        cmp     word [es:si],-1
417
        je      .exit
418
        jmp     .loops
419
.ok:    xor     ax,ax
420
.exit:  ret
421
422
 
423
 
424
425
 
746 Lrz 426
714 Lrz 427
 
428
draw_vmodes_table:
429
        _setcursor 9, 2
430
        mov     si,gr_mode
431
        call    printplain
432
433
 
434
        call    printplain
435
436
 
437
        pop     ax
438
        push    word [home_cursor]
439
        pop     si
440
        mov     cx,si
441
442
 
443
        je      .ok
444
        jb      .low
445
446
 
447
 
448
449
 
450
        jb      .ok
451
452
 
453
        add     cx,size_of_step
454
        cmp     cx,word[end_cursor]
455
        jae     .ok
456
        add     si,size_of_step
457
        push    si
458
        pop     word [home_cursor]
459
        jmp     .ok
460
461
 
462
 
463
        cmp     cx,modes_table
464
        jb      .ok
465
        push    cx
466
        push    cx
467
        pop     word [home_cursor]
468
        pop     si
469
470
 
471
 
472
        mov     bp,long_v_table               ;show rows
473
.@@_next_bit:
474
        cmp     word [es:si+6],0x12
475
        je      .show_0x12
476
        cmp     word [es:si+6],0x13
477
        je      .show_0x13
478
479
 
480
        cmp     ax,-1
481
        je      .@@_end
482
        mov     di,_rs+23
483
        mov     ecx,10
484
        mov     bl,4
485
        call    int2str
486
        movzx   eax,word[es:si+2]
487
        inc     di
488
        mov     bl,4
489
        call    int2str
490
491
 
492
        inc     di
493
        mov     bl,2
494
        call    int2str
495
;clear cursor
496
        mov     word[ds:_r1+21],'  '
497
        mov     word[ds:_r1+50],'  '
498
499
 
500
        mov     word[ds:_r2+45],'  '
501
502
 
503
        mov     word[ds:_rs+46],'  '
504
505
 
506
        jne     .next
507
;draw   cursor
508
        mov     word[ds:_rs+21],'>>'
509
        mov     word[ds:_rs+46],'<<'
510
511
 
512
 
513
 
514
        push    si
515
        mov     si,_rs
516
.@@_sh:
517
        call    printplain
518
        pop     si
519
        add     si,size_of_step
520
521
 
522
        jnz     .@@_next_bit
523
524
 
525
        mov     si,_bt
526
        call    printplain
527
; show scroll
730 diamond 528
        push    es
529
        push    0xB800
530
        pop     es
531
; arrows
532
        mov     di, (11*80+53)*2
533
        mov     al, 30
534
        stosb
535
        add     di, 80*2-1
536
        mov     al, 32
537
        mov     cx, scroll_area_size
731 diamond 538
@@:
730 diamond 539
        stosb
540
        add     di, 80*2-1
541
        loop    @b
542
        mov     al, 31
543
        stosb
544
; calculate scroll size
545
        mov     ax, [end_cursor]
546
        sub     ax, modes_table
547
        mov     bx, size_of_step
548
        cwd
549
        div     bx
550
        mov     si, ax          ; si = size of list
551
        mov     ax, [home_cursor]
552
        sub     ax, modes_table
553
        cwd
554
        div     bx
555
        mov     di, ax
556
        mov     ax, scroll_area_size*long_v_table
731 diamond 557
        cwd
730 diamond 558
        div     si
559
        test    ax, ax
560
        jnz     @f
561
        inc     ax
562
@@:
563
        cmp     al, scroll_area_size
731 diamond 564
        jb      @f
730 diamond 565
        mov     al, scroll_area_size
731 diamond 566
@@:
730 diamond 567
        mov     cx, ax
568
; cx = scroll height
569
; calculate scroll pos
570
        xor     bx, bx          ; initialize scroll pos
571
        sub     al, scroll_area_size+1
731 diamond 572
        neg     al
730 diamond 573
        sub     si, long_v_table-1
731 diamond 574
        jbe     .draw_scroll
730 diamond 575
        mul     di
576
        div     si
577
        mov     bx, ax
578
.draw_scroll:
579
        mov     al, 0xDB
580
        imul    di, bx, 80*2
581
        add     di, (12*80+53)*2
582
@@:
583
        stosb
584
        add     di, 80*2-1
585
        loop    @b
586
        pop     es
587
        ret
714 Lrz 588
.show_0x13:
589
        push    si
590
591
 
592
        jne     @f
593
        mov     word[ds:_r1+21],'>>'
594
        mov     word[ds:_r1+50],'<<'
595
@@:
596
        mov     si,_r1
597
        jmp     .@@_sh
598
.show_0x12:
599
        push    si
600
        cmp     si, word [cursor_pos]
601
        jne     @f
602
603
 
604
        mov     word[ds:_r2+45],'<<'
605
@@:
606
        mov     si,_r2
607
        jmp     .@@_sh
608
609
 
610
;Clear arrea of current video page (0xb800)
611
clear_vmodes_table:
612
        pusha
613
       ; draw frames
614
        push    es
615
        push    0xb800
616
        pop     es
617
        mov     di,1444
618
        xor     ax,ax
619
        mov     ah, 1*16+15
620
        mov     cx,70
621
        mov     bp,12
622
.loop_start:
623
        rep     stosw
624
        mov     cx,70
625
        add     di,20
626
        dec     bp               ; 㬥­ìè¨âì DX,
627
        jns        .loop_start
628
        pop     es
629
        popa
630
        ret
631
632
 
633
634
 
635
        push    0 ;0;x1000
636
        pop     es
637
638
 
639
        mov     cx,word [es:si+6]            ; number of mode
640
641
 
642
 
643
        mov     bx,word [es:si+2]            ; resolution Y
644
645
 
646
 
647
        mov     word [es:0x900C],bx              ; resolution Y
648
        mov     word [es:0x9008],cx              ; number of mode
649
650
 
651
        je      .mode0x12_0x13
652
        cmp     cx,0x13
653
        je      .mode0x12_0x13
654
655
 
656
 
657
        jb      .vesa12
658
659
 
660
661
 
662
        and     cx,0xfff
663
        mov     di,mi;0xa000
664
        int     0x10
665
        ; LFB
666
        mov     eax,[es:mi.PhysBasePtr];di+0x28]
667
        mov     [es:0x9018],eax
668
        ; ---- vbe voodoo
669
        BytesPerLine equ 0x10
670
        mov     ax, [es:di+BytesPerLine]
671
        mov     [es:0x9001], ax
672
        ; BPP
673
        cmp     [es:mi.BitsPerPixel],16
674
        jne     .l0
675
        cmp     [es:mi.GreenMaskSize],5
676
        jne     .l0
677
        mov     [es:mi.BitsPerPixel],15
678
.l0:
679
        mov     al, byte [es:di+0x19]
680
        mov     [es:0x9000], al
681
        jmp     .exit
682
683
 
684
        mov     byte [es:0x9000], 32
685
        or      dword [es:0x9018], 0xFFFFFFFF; 0x800000
686
687
 
688
 
689
690
 
691
692
 
693
 
694
        xor     bx,bx
695
        int     0x10
696
        xor     eax,eax
697
        xor     ebx,ebx
698
        mov     ax,es
699
        shl     eax,4
700
        mov     bx,di
701
        add     eax,ebx
702
        movzx   ebx,word[es:di]
703
        add     eax,ebx
704
        push    0x0000
705
        pop     es
706
        mov     [es:0x9014],eax
707
  .exit:
708
        ret
709
710
 
711
 
712
;        ret
713
714
 
715
;=============================================================================
716
;=============================================================================
717
@@:
718