Subversion Repositories Kolibri OS

Rev

Rev 730 | Go to most recent revision | Details | 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
 
175
        push    word[es:vi.VideoModePtr+2]
176
        pop     fs
177
178
 
179
;save no vesa mode of work 320x200, EGA/CGA 256 梥⮢ and 640x480, VGA 16 梥⮢
180
        mov     word [es:bx],640
181
        mov     word [es:bx+2],480
182
        mov     word [es:bx+6],0x13
183
184
 
185
        mov     word [es:bx+12],480
186
        mov     word [es:bx+16],0x12
187
        add     bx,20
188
  .next_mode:
189
        mov     cx,word [fs:si] ; mode number
190
        cmp     cx,-1
191
        je      .modes_ok.2
192
193
 
194
        mov     di,mi
195
        int     0x10
196
197
 
198
        jnz     .modes_ok.2;vesa_info.exit
199
200
 
201
        jz      @f
202
        test    [es:mi.ModeAttributes],00010000b   ;picture ?
203
        jz      @f
204
        test    [es:mi.ModeAttributes],10000000b   ;LFB ?
205
        jz      @f
206
207
 
208
        jne     .l0
209
        cmp     [es:mi.GreenMaskSize],5
210
        jne     .l0
211
        mov     [es:mi.BitsPerPixel],15
212
213
 
214
 
215
        cmp     [es:mi.XRes],640
216
        jb      @f
217
        cmp     [es:mi.YRes],480
218
        jb      @f
219
;        cmp     [es:mi.BitsPerPixel],8
220
;        jb      @f
221
222
 
223
        mov     [es:bx+0],ax               ; +0[2] : resolution X
224
        mov     ax,[es:mi.YRes]
225
        mov     [es:bx+2],ax               ; +2[2] : resolution Y
226
        mov     ax,[es:mi.ModeAttributes]
227
        mov     [es:bx+4],ax               ; +4[2] : attributes
228
229
 
230
        jb      .lp1
231
232
 
233
  .lp1: mov     [es:bx+6],cx               ; +6 : mode number
234
        movzx   ax,byte [es:mi.BitsPerPixel]
235
        mov     word [es:bx+8],ax               ; +8 : bits per pixel
236
        add     bx,size_of_step
237
238
 
239
        add     si,2
240
        jmp     .next_mode
241
242
 
243
244
 
245
        mov     word[end_cursor],bx     ;save end cursor position
246
;;;;;;;;;;;;;;;;;;
247
;Sort array
248
;        mov     si,modes_table
249
;.new_mode:
250
;        mov     ax,word [es:si]
251
;        cmp     ax,-1
252
;        je      .exxit
253
;        add     ax,word [es:si+2]
254
;        add     ax,word [es:si+8]
255
;        mov     bp,si
256
;.again:
257
;        add     bp,12
258
;        mov     bx,word [es:bp]
259
;        cmp     bx,-1
260
;        je      .exit
261
;        add     bx,word [es:bp+2]
262
;        add     bx,word [es:bp+8]
263
;
264
;        cmp     ax,bx
265
;        ja      .loops
266
;        jmp     .again
267
;.loops:
268
;        push    dword [es:si]
269
;        push    dword [es:si+4]
270
;        push    dword [es:si+8]
271
;        push    dword [es:bp]
272
;        push    dword [es:bp+4]
273
;        push    dword [es:bp+8]
274
;
275
;        pop     dword [es:si+8]
276
;        pop     dword [es:si+4]
277
;        pop     dword [es:si]
278
;        pop     dword [es:bp+8]
279
;        pop     dword [es:bp+4]
280
;        pop     dword [es:bp]
281
;        jmp     .new_mode
282
;
283
;.exit:  add     si,12
284
;        jmp     .new_mode
285
;.exxit:
286
        popad
287
        ret
288
289
 
290
291
 
292
        push    0
293
        pop     es
294
295
 
296
297
 
298
        je      .no_vesa_0x12
299
300
 
301
        je      .no_vesa_0x13
302
303
 
304
        movzx   eax,word[es:si+0]
305
        mov     ecx,10
306
        call    int2strnz
307
        mov     byte[es:di],'x'
308
        inc     di
309
        movzx   eax,word[es:si+2]
310
        call    int2strnz
311
        mov     byte[es:di],'x'
312
        inc     di
313
        movzx   eax,word[es:si+8]
314
        call    int2strnz
315
        mov     dword[es:di],0x00000d0a
316
        mov     si,loader_block_error
317
        push    ds
318
        push    es
319
        pop     ds
320
        call    printplain
321
        pop     ds
322
        ret
323
.no_vesa_0x13:
324
        mov     si,mode0
325
        jmp     .print
326
.no_vesa_0x12:
327
        mov     si,mode9
328
.print:
329
        call    printplain
330
        ret
331
;-----------------------------------------------------------------------------
332
check_first_parm:
333
        mov     ax,word [preboot_graph]
334
        test    ax,ax
335
        jnz      .no_zero        ;if no zero
336
.zerro:
337
;        mov     ax,modes_table
338
;        mov     word [cursor_pos],ax
339
;        mov     word [home_cursor],ax
340
;        mov     word [preboot_graph],ax
341
;SET default video of mode first probe will fined a move of work 1024x768@32
342
343
 
344
        mov     bx,768
345
        mov     si,modes_table
346
        call    .loops
347
        test    ax,ax
348
        jz     .ok_found_mode
349
        mov     ax,800
350
        mov     bx,600
351
        mov     si,modes_table
352
        call    .loops
353
        test    ax,ax
354
        jz     .ok_found_mode
355
        mov     ax,640
356
        mov     bx,480
357
        mov     si,modes_table
358
        call    .loops
359
        test    ax,ax
360
        jz     .ok_found_mode
361
362
 
363
364
 
365
 
366
        mov     word [home_cursor],si
367
;        mov     word [cursor_pos],si
368
        mov     word [preboot_graph],si
369
        mov     ax,si
370
371
 
372
        cmp     ax,modes_table
373
        jb      .zerro           ;check on correct if bellow
374
        cmp     ax,word [end_cursor]
375
        ja      .zerro           ;check on correct if anymore
376
377
 
378
379
 
380
        cmp     ax,word [end_cursor]
381
        jae     .next_step
382
        loop    .loop
383
.next_step:
384
        sub     ax,size_of_step*long_v_table
385
        cmp     ax,modes_table
386
        jb      .zerro
387
388
 
389
        push    word [preboot_graph]
390
        pop     word [cursor_pos]
391
        ret
392
;;;;;;;;;;;;;;;;;;;;;;;;;;;
393
.loops:
394
        cmp     ax,word [es:si]
395
        jne     .next
396
        cmp     bx,word [es:si+2]
397
        jne     .next
398
        cmp     word [es:si+8],32
399
        je      .ok
400
        cmp     word [es:si+8],24
401
        je      .ok
402
.next:  add     si,size_of_step
403
        cmp     word [es:si],-1
404
        je      .exit
405
        jmp     .loops
406
.ok:    xor     ax,ax
407
.exit:  ret
408
409
 
410
 
411
412
 
413
414
 
415
draw_vmodes_table:
416
        _setcursor 9, 2
417
        mov     si,gr_mode
418
        call    printplain
419
420
 
421
        call    printplain
422
423
 
424
        pop     ax
425
        push    word [home_cursor]
426
        pop     si
427
        mov     cx,si
428
429
 
430
        je      .ok
431
        jb      .low
432
433
 
434
 
435
436
 
437
        jb      .ok
438
439
 
440
        add     cx,size_of_step
441
        cmp     cx,word[end_cursor]
442
        jae     .ok
443
        add     si,size_of_step
444
        push    si
445
        pop     word [home_cursor]
446
        jmp     .ok
447
448
 
449
 
450
        cmp     cx,modes_table
451
        jb      .ok
452
        push    cx
453
        push    cx
454
        pop     word [home_cursor]
455
        pop     si
456
457
 
458
 
459
        mov     bp,long_v_table               ;show rows
460
.@@_next_bit:
461
        cmp     word [es:si+6],0x12
462
        je      .show_0x12
463
        cmp     word [es:si+6],0x13
464
        je      .show_0x13
465
466
 
467
        cmp     ax,-1
468
        je      .@@_end
469
        mov     di,_rs+23
470
        mov     ecx,10
471
        mov     bl,4
472
        call    int2str
473
        movzx   eax,word[es:si+2]
474
        inc     di
475
        mov     bl,4
476
        call    int2str
477
478
 
479
        inc     di
480
        mov     bl,2
481
        call    int2str
482
;clear cursor
483
        mov     word[ds:_r1+21],'  '
484
        mov     word[ds:_r1+50],'  '
485
486
 
487
        mov     word[ds:_r2+45],'  '
488
489
 
490
        mov     word[ds:_rs+46],'  '
491
492
 
493
        jne     .next
494
;draw   cursor
495
        mov     word[ds:_rs+21],'>>'
496
        mov     word[ds:_rs+46],'<<'
497
498
 
499
 
500
 
501
        push    si
502
        mov     si,_rs
503
.@@_sh:
504
        call    printplain
505
        pop     si
506
        add     si,size_of_step
507
508
 
509
        jnz     .@@_next_bit
510
511
 
512
        mov     si,_bt
513
        call    printplain
514
        ret
515
.show_0x13:
516
        push    si
517
518
 
519
        jne     @f
520
        mov     word[ds:_r1+21],'>>'
521
        mov     word[ds:_r1+50],'<<'
522
@@:
523
        mov     si,_r1
524
        jmp     .@@_sh
525
.show_0x12:
526
        push    si
527
        cmp     si, word [cursor_pos]
528
        jne     @f
529
530
 
531
        mov     word[ds:_r2+45],'<<'
532
@@:
533
        mov     si,_r2
534
        jmp     .@@_sh
535
536
 
537
;Clear arrea of current video page (0xb800)
538
clear_vmodes_table:
539
        pusha
540
       ; draw frames
541
        push    es
542
        push    0xb800
543
        pop     es
544
        mov     di,1444
545
        xor     ax,ax
546
        mov     ah, 1*16+15
547
        mov     cx,70
548
        mov     bp,12
549
.loop_start:
550
        rep     stosw
551
        mov     cx,70
552
        add     di,20
553
        dec     bp               ; 㬥­ìè¨âì DX,
554
        jns        .loop_start
555
        pop     es
556
        popa
557
        ret
558
559
 
560
561
 
562
        push    0 ;0;x1000
563
        pop     es
564
565
 
566
        mov     cx,word [es:si+6]            ; number of mode
567
568
 
569
 
570
        mov     bx,word [es:si+2]            ; resolution Y
571
572
 
573
 
574
        mov     word [es:0x900C],bx              ; resolution Y
575
        mov     word [es:0x9008],cx              ; number of mode
576
577
 
578
        je      .mode0x12_0x13
579
        cmp     cx,0x13
580
        je      .mode0x12_0x13
581
582
 
583
 
584
        jb      .vesa12
585
586
 
587
588
 
589
        and     cx,0xfff
590
        mov     di,mi;0xa000
591
        int     0x10
592
        ; LFB
593
        mov     eax,[es:mi.PhysBasePtr];di+0x28]
594
        mov     [es:0x9018],eax
595
        ; ---- vbe voodoo
596
        BytesPerLine equ 0x10
597
        mov     ax, [es:di+BytesPerLine]
598
        mov     [es:0x9001], ax
599
        ; BPP
600
        cmp     [es:mi.BitsPerPixel],16
601
        jne     .l0
602
        cmp     [es:mi.GreenMaskSize],5
603
        jne     .l0
604
        mov     [es:mi.BitsPerPixel],15
605
.l0:
606
        mov     al, byte [es:di+0x19]
607
        mov     [es:0x9000], al
608
        jmp     .exit
609
610
 
611
        mov     byte [es:0x9000], 32
612
        or      dword [es:0x9018], 0xFFFFFFFF; 0x800000
613
614
 
615
 
616
617
 
618
619
 
620
 
621
        xor     bx,bx
622
        int     0x10
623
        xor     eax,eax
624
        xor     ebx,ebx
625
        mov     ax,es
626
        shl     eax,4
627
        mov     bx,di
628
        add     eax,ebx
629
        movzx   ebx,word[es:di]
630
        add     eax,ebx
631
        push    0x0000
632
        pop     es
633
        mov     [es:0x9014],eax
634
  .exit:
635
        ret
636
637
 
638
 
639
;        ret
640
641
 
642
;=============================================================================
643
;=============================================================================
644
@@:
645