Subversion Repositories Kolibri OS

Rev

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