Subversion Repositories Kolibri OS

Rev

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