Subversion Repositories Kolibri OS

Rev

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