Subversion Repositories Kolibri OS

Rev

Rev 3908 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
750 victor 1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                              ;;
2465 Serge 3
;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;;
750 victor 4
;; Distributed under terms of the GNU General Public License    ;;
5
;;                                                              ;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
714 Lrz 7
 
750 victor 8
$Revision: 4265 $
9
 
714 Lrz 10
struc VBE_VGAInfo {
11
  .VESASignature          dd ?    ; char
12
  .VESAVersion            dw ?    ; short
13
  .OemStringPtr           dd ?    ; char *
14
  .Capabilities           dd ?    ; ulong
15
  .VideoModePtr           dd ?    ; ulong
16
  .TotalMemory            dw ?    ; short
17
  ; VBE 2.0+
18
  .OemSoftwareRev         db ?    ; short
19
  .OemVendorNamePtr       dw ?    ; char *
20
  .OemProductNamePtr      dw ?    ; char *
21
  .OemProductRevPtr       dw ?    ; char *
22
  .reserved               rb 222  ; char
23
  .OemData                rb 256  ; char
24
}
25
 
26
struc VBE_ModeInfo {
27
  .ModeAttributes         dw ?    ; short
28
  .WinAAttributes         db ?    ; char
29
  .WinBAttributes         db ?    ; char
30
  .WinGranularity         dw ?    ; short
31
  .WinSize                dw ?    ; short
32
  .WinASegment            dw ?    ; ushort
33
  .WinBSegment            dw ?    ; ushort
34
  .WinFuncPtr             dd ?    ; void *
35
  .BytesPerScanLine       dw ?    ; short
36
  .XRes                   dw ?    ; short
37
  .YRes                   dw ?    ; short
38
  .XCharSize              db ?    ; char
39
  .YCharSize              db ?    ; char
40
  .NumberOfPlanes         db ?    ; char
41
  .BitsPerPixel           db ?    ; char
42
  .NumberOfBanks          db ?    ; char
43
  .MemoryModel            db ?    ; char
44
  .BankSize               db ?    ; char
45
  .NumberOfImagePages     db ?    ; char
46
  .res1                   db ?    ; char
47
  .RedMaskSize            db ?    ; char
48
  .RedFieldPosition       db ?    ; char
49
  .GreenMaskSize          db ?    ; char
50
  .GreenFieldPosition     db ?    ; char
51
  .BlueMaskSize           db ?    ; char
52
  .BlueFieldPosition      db ?    ; char
53
  .RsvedMaskSize          db ?    ; char
54
  .RsvedFieldPosition     db ?    ; char
55
  .DirectColorModeInfo    db ?    ; char ; MISSED IN THIS TUTORIAL!! SEE ABOVE
56
  ; VBE 2.0+
57
  .PhysBasePtr            dd ?    ; ulong
58
  .OffScreenMemOffset     dd ?    ; ulong
59
  .OffScreenMemSize       dw ?    ; short
60
  ; VBE 3.0+
61
  .LinbytesPerScanLine    dw ?    ; short
62
  .BankNumberOfImagePages db ?    ; char
63
  .LinNumberOfImagePages  db ?    ; char
64
  .LinRedMaskSize         db ?    ; char
65
  .LinRedFieldPosition    db ?    ; char
66
  .LingreenMaskSize       db ?    ; char
67
  .LinGreenFieldPosition  db ?    ; char
68
  .LinBlueMaskSize        db ?    ; char
69
  .LinBlueFieldPosition   db ?    ; char
70
  .LinRsvdMaskSize        db ?    ; char
71
  .LinRsvdFieldPosition   db ?    ; char
72
  .MaxPixelClock          dd ?    ; ulong
73
  .res2                   rb 190  ; char
74
}
75
 
76
virtual at $A000
77
  vi VBE_VGAInfo
78
  mi VBE_ModeInfo
79
modes_table:
80
end virtual
3555 Serge 81
cursor_pos  dw 0         ;временное хранение курсора.
4265 Serge 82
cursor_pos_old  dw 0
714 Lrz 83
home_cursor dw 0    ;current shows rows a table
84
end_cursor  dw 0     ;end of position current shows rows a table
834 diamond 85
scroll_start dw 0    ;start position of scroll bar
86
scroll_end  dw 0     ;end position of scroll bar
714 Lrz 87
long_v_table equ 9   ;long of visible video table
731 diamond 88
size_of_step equ 10
89
scroll_area_size equ (long_v_table-2)
714 Lrz 90
int2str:
91
        dec     bl
92
        jz      @f
2434 Serge 93
        xor     edx, edx
714 Lrz 94
        div     ecx
95
        push    edx
96
        call    int2str
97
        pop     eax
2434 Serge 98
    @@:
99
        or      al, 0x30
100
        mov     [ds:di], al
714 Lrz 101
        inc     di
102
        ret
103
 
104
int2strnz:
2434 Serge 105
        cmp     eax, ecx
714 Lrz 106
        jb      @f
2434 Serge 107
        xor     edx, edx
714 Lrz 108
        div     ecx
109
        push    edx
110
        call    int2strnz
111
        pop     eax
2434 Serge 112
    @@:
113
        or      al, 0x30
114
        mov     [es:di], al
714 Lrz 115
        inc     di
116
        ret
946 lrz 117
 
714 Lrz 118
;-------------------------------------------------------
119
;Write message about incorrect v_mode and write message about jmp on swith v_mode
120
v_mode_error:
121
        _setcursor 19,2
122
        mov     si, fatalsel
123
        call    printplain
124
        _setcursor 20,2
2434 Serge 125
        mov     si, pres_key
714 Lrz 126
        call    printplain
2434 Serge 127
        xor     eax, eax
714 Lrz 128
        int     16h
129
        jmp     cfgmanager.d
130
;-------------------------------------------------------
131
;
132
 
133
 
134
 
135
;-------------------------------------------------------
136
print_vesa_info:
137
        _setcursor 5,2
138
 
2434 Serge 139
        mov     [es:vi.VESASignature], 'VBE2'
140
        mov     ax, 0x4F00
141
        mov     di, vi     ;0xa000
714 Lrz 142
        int     0x10
2434 Serge 143
        or      ah, ah
714 Lrz 144
        jz      @f
2434 Serge 145
        mov     [es:vi.VESASignature], 'VESA'
146
        mov     ax, $4F00
147
        mov     di, vi
714 Lrz 148
        int     0x10
2434 Serge 149
        or      ah, ah
714 Lrz 150
        jnz     .exit
151
  @@:
2434 Serge 152
        cmp     [es:vi.VESASignature], 'VESA'
714 Lrz 153
        jne     .exit
2434 Serge 154
        cmp     [es:vi.VESAVersion], 0x0100
714 Lrz 155
        jb      .exit
156
        jmp     .vesaok2
157
 
158
  .exit:
2434 Serge 159
        mov     si, novesa
714 Lrz 160
        call    printplain
161
        ret
162
 
163
  .vesaok2:
2434 Serge 164
        mov     ax, [es:vi.VESAVersion]
165
        add     ax, '00'
714 Lrz 166
 
167
        mov     [s_vesa.ver], ah
168
        mov     [s_vesa.ver+2], al
2434 Serge 169
        mov     si, s_vesa
714 Lrz 170
        call    printplain
171
 
172
        _setcursor 4,2
2434 Serge 173
        mov     si, word[es:vi.OemStringPtr]
174
        mov     di, si
714 Lrz 175
 
176
        push    ds
2434 Serge 177
        mov     ds, word[es:vi.OemStringPtr+2]
714 Lrz 178
        call    printplain
179
        pop     ds
180
 
181
        ret
182
;-----------------------------------------------------------------------------
183
 
184
calc_vmodes_table:
185
        pushad
186
 
187
;        push    0
188
;        pop     es
189
 
730 diamond 190
        lfs     si, [es:vi.VideoModePtr]
714 Lrz 191
 
2434 Serge 192
        mov     bx, modes_table
3555 Serge 193
;save no vesa mode of work 320x200, EGA/CGA 256 梥⮢ and 640x480, VGA 16 梥⮢
2434 Serge 194
        mov     word [es:bx], 640
195
        mov     word [es:bx+2], 480
196
        mov     word [es:bx+6], 0x13
3908 Serge 197
 
2434 Serge 198
        mov     word [es:bx+10], 640
199
        mov     word [es:bx+12], 480
200
        mov     word [es:bx+16], 0x12
201
        add     bx, 20
714 Lrz 202
  .next_mode:
2434 Serge 203
        mov     cx, word [fs:si]; mode number
204
        cmp     cx, -1
714 Lrz 205
        je      .modes_ok.2
206
 
2434 Serge 207
        mov     ax, 0x4F01
208
        mov     di, mi
714 Lrz 209
        int     0x10
210
 
2434 Serge 211
        or      ah, ah
714 Lrz 212
        jnz     .modes_ok.2;vesa_info.exit
213
 
2434 Serge 214
        test    [es:mi.ModeAttributes], 00000001b  ;videomode support ?
714 Lrz 215
        jz      @f
2434 Serge 216
        test    [es:mi.ModeAttributes], 00010000b  ;picture ?
714 Lrz 217
        jz      @f
2434 Serge 218
        test    [es:mi.ModeAttributes], 10000000b  ;LFB ?
714 Lrz 219
        jz      @f
220
 
3232 Serge 221
        cmp     [es:mi.BitsPerPixel], 32   ;It show only videomodes to have support 24 and 32 bpp
947 lrz 222
        jb      @f
730 diamond 223
 
947 lrz 224
;        cmp     [es:mi.BitsPerPixel],16
225
;        jne     .l0
226
;        cmp     [es:mi.GreenMaskSize],5
227
;        jne     .l0
228
;        mov     [es:mi.BitsPerPixel],15
714 Lrz 229
 
230
 
947 lrz 231
.l0:
2434 Serge 232
        cmp     [es:mi.XRes], 640
714 Lrz 233
        jb      @f
2434 Serge 234
        cmp     [es:mi.YRes], 480
714 Lrz 235
        jb      @f
236
;        cmp     [es:mi.BitsPerPixel],8
237
;        jb      @f
238
 
2434 Serge 239
        mov     ax, [es:mi.XRes]
240
        mov     [es:bx+0], ax              ; +0[2] : resolution X
241
        mov     ax, [es:mi.YRes]
242
        mov     [es:bx+2], ax              ; +2[2] : resolution Y
243
        mov     ax, [es:mi.ModeAttributes]
244
        mov     [es:bx+4], ax              ; +4[2] : attributes
714 Lrz 245
 
2434 Serge 246
        cmp     [s_vesa.ver], '2'
247
;        jb      .lp1
248
        jb      @f    ; We do not use Vesa 1.2 mode is now
714 Lrz 249
 
2434 Serge 250
        or      cx, 0x4000 ; use LFB
251
.lp1:
252
        mov     [es:bx+6], cx              ; +6 : mode number
253
        movzx   ax, byte [es:mi.BitsPerPixel]
254
        mov     word [es:bx+8], ax              ; +8 : bits per pixel
2441 Serge 255
        add     bx, size_of_step                ; size of record
714 Lrz 256
 
257
    @@:
2434 Serge 258
        add     si, 2
714 Lrz 259
        jmp     .next_mode
260
 
261
  .modes_ok.2:
262
 
2434 Serge 263
        mov     word[es:bx], -1 ;end video table
264
        mov     word[end_cursor], bx    ;save end cursor position
714 Lrz 265
;;;;;;;;;;;;;;;;;;
266
;Sort array
267
;        mov     si,modes_table
268
;.new_mode:
269
;        mov     ax,word [es:si]
270
;        cmp     ax,-1
271
;        je      .exxit
272
;        add     ax,word [es:si+2]
273
;        add     ax,word [es:si+8]
274
;        mov     bp,si
275
;.again:
276
;        add     bp,12
277
;        mov     bx,word [es:bp]
278
;        cmp     bx,-1
279
;        je      .exit
280
;        add     bx,word [es:bp+2]
281
;        add     bx,word [es:bp+8]
2441 Serge 282
;
714 Lrz 283
;        cmp     ax,bx
284
;        ja      .loops
285
;        jmp     .again
2441 Serge 286
;.loops:
714 Lrz 287
;        push    dword [es:si]
288
;        push    dword [es:si+4]
289
;        push    dword [es:si+8]
290
;        push    dword [es:bp]
291
;        push    dword [es:bp+4]
292
;        push    dword [es:bp+8]
293
;
294
;        pop     dword [es:si+8]
295
;        pop     dword [es:si+4]
296
;        pop     dword [es:si]
297
;        pop     dword [es:bp+8]
298
;        pop     dword [es:bp+4]
299
;        pop     dword [es:bp]
300
;        jmp     .new_mode
301
;
302
;.exit:  add     si,12
303
;        jmp     .new_mode
304
;.exxit:
305
        popad
306
        ret
307
 
308
;-----------------------------------------------------------------------------
309
 
310
draw_current_vmode:
311
        push    0
312
        pop     es
313
 
2434 Serge 314
        mov     si, word [cursor_pos]
714 Lrz 315
 
2434 Serge 316
        cmp     word [es:si+6], 0x12
714 Lrz 317
        je      .no_vesa_0x12
318
 
2434 Serge 319
        cmp     word [es:si+6], 0x13
714 Lrz 320
        je      .no_vesa_0x13
321
 
2010 serge 322
if defined extended_primary_loader
2434 Serge 323
        mov     di, config_file_variables
2010 serge 324
else
2434 Serge 325
        mov     di, loader_block_error
2010 serge 326
end if
2434 Serge 327
        movzx   eax, word[es:si+0]
328
        mov     ecx, 10
714 Lrz 329
        call    int2strnz
2434 Serge 330
        mov     byte[es:di], 'x'
714 Lrz 331
        inc     di
2434 Serge 332
        movzx   eax, word[es:si+2]
714 Lrz 333
        call    int2strnz
2434 Serge 334
        mov     byte[es:di], 'x'
714 Lrz 335
        inc     di
2434 Serge 336
        movzx   eax, word[es:si+8]
714 Lrz 337
        call    int2strnz
2434 Serge 338
        mov     dword[es:di], 0x00000d0a
2010 serge 339
if defined extended_primary_loader
2434 Serge 340
        mov     si, config_file_variables
2010 serge 341
else
2434 Serge 342
        mov     si, loader_block_error
2010 serge 343
end if
714 Lrz 344
        push    ds
345
        push    es
346
        pop     ds
347
        call    printplain
348
        pop     ds
349
        ret
350
.no_vesa_0x13:
2434 Serge 351
        mov     si, mode0
714 Lrz 352
        jmp     .print
353
.no_vesa_0x12:
2434 Serge 354
        mov     si, mode9
714 Lrz 355
.print:
356
        call    printplain
2441 Serge 357
        ret
714 Lrz 358
;-----------------------------------------------------------------------------
359
check_first_parm:
2010 serge 360
if defined extended_primary_loader
361
        mov     cx, [number_vm]
362
        jcxz    .novbemode
363
        mov     si, modes_table
364
.findvbemode:
365
        cmp     [es:si+6], cx
366
        jnz     @f
2434 Serge 367
        cmp     word [es:si+8], 32
2010 serge 368
        je      .ok_found_mode
2434 Serge 369
        cmp     word [es:si+8], 24
2010 serge 370
        je      .ok_found_mode
2434 Serge 371
@@:
372
        add     si, size_of_step
373
        cmp     word [es:si], -1
2010 serge 374
        jnz     .findvbemode
375
.novbemode:
376
        mov     ax, [x_save]
377
        test    ax, ax
378
        jz      .zerro
379
        mov     bx, [y_save]
380
        mov     si, modes_table
381
        call    .loops
382
        test    ax, ax
383
        jz      .ok_found_mode
384
else
2434 Serge 385
        mov     si, word [preboot_graph]
386
        test    si, si
3908 Serge 387
        jnz     .no_zero         ;if no zero
2010 serge 388
end if
714 Lrz 389
.zerro:
390
;        mov     ax,modes_table
391
;        mov     word [cursor_pos],ax
392
;        mov     word [home_cursor],ax
393
;        mov     word [preboot_graph],ax
394
;SET default video of mode first probe will fined a move of work 1024x768@32
395
 
2434 Serge 396
        mov     ax, 1024
397
        mov     bx, 768
398
        mov     si, modes_table
714 Lrz 399
        call    .loops
2434 Serge 400
        test    ax, ax
3908 Serge 401
        jz      .ok_found_mode
2434 Serge 402
        mov     ax, 800
403
        mov     bx, 600
404
        mov     si, modes_table
714 Lrz 405
        call    .loops
2434 Serge 406
        test    ax, ax
3908 Serge 407
        jz      .ok_found_mode
2434 Serge 408
        mov     ax, 640
409
        mov     bx, 480
410
        mov     si, modes_table
714 Lrz 411
        call    .loops
2434 Serge 412
        test    ax, ax
3908 Serge 413
        jz      .ok_found_mode
714 Lrz 414
 
2434 Serge 415
        mov     si, modes_table
2010 serge 416
if ~ defined extended_primary_loader
746 Lrz 417
        jmp     .ok_found_mode
714 Lrz 418
 
419
 
746 Lrz 420
 
421
.no_zero:
2434 Serge 422
        mov     bp, word [number_vm]
423
        cmp     bp, word [es:si+6]
749 Lrz 424
        jz      .ok_found_mode
2434 Serge 425
        mov     ax, word [x_save]
426
        mov     bx, word [y_save]
427
        mov     si, modes_table
746 Lrz 428
        call    .loops
2434 Serge 429
        test    ax, ax
3908 Serge 430
        jz      .ok_found_mode
746 Lrz 431
 
2434 Serge 432
        mov     si, modes_table
746 Lrz 433
;        cmp     ax,modes_table
434
;        jb      .zerro           ;check on correct if bellow
435
;        cmp     ax,word [end_cursor]
436
;        ja      .zerro           ;check on correct if anymore
2010 serge 437
end if
746 Lrz 438
 
714 Lrz 439
.ok_found_mode:
2434 Serge 440
        mov     word [home_cursor], si
714 Lrz 441
;        mov     word [cursor_pos],si
2434 Serge 442
        mov     word [preboot_graph], si
443
        mov     ax, si
714 Lrz 444
 
2434 Serge 445
        mov     ecx, long_v_table
714 Lrz 446
 
2434 Serge 447
.loop:
448
        add     ax, size_of_step
449
        cmp     ax, word [end_cursor]
714 Lrz 450
        jae     .next_step
451
        loop    .loop
452
.next_step:
2434 Serge 453
        sub     ax, size_of_step*long_v_table
454
        cmp     ax, modes_table
738 diamond 455
        jae     @f
2434 Serge 456
        mov     ax, modes_table
738 diamond 457
@@:
714 Lrz 458
 
2434 Serge 459
        mov     word [home_cursor], ax
460
        mov     si, [preboot_graph]
461
        mov     word [cursor_pos], si
946 lrz 462
 
463
        push    word [es:si]
464
        pop     word [x_save]
465
        push    word [es:si+2]
466
        pop     word [y_save]
467
        push    word [es:si+6]
468
        pop     word [number_vm]
469
 
714 Lrz 470
        ret
471
;;;;;;;;;;;;;;;;;;;;;;;;;;;
472
.loops:
2434 Serge 473
        cmp     ax, word [es:si]
714 Lrz 474
        jne     .next
2434 Serge 475
        cmp     bx, word [es:si+2]
714 Lrz 476
        jne     .next
2434 Serge 477
        cmp     word [es:si+8], 32
714 Lrz 478
        je      .ok
2434 Serge 479
        cmp     word [es:si+8], 24
714 Lrz 480
        je      .ok
2434 Serge 481
.next:
482
        add     si, size_of_step
483
        cmp     word [es:si], -1
714 Lrz 484
        je      .exit
485
        jmp     .loops
2434 Serge 486
.ok:
487
        xor     ax, ax
3908 Serge 488
        ret
2434 Serge 489
.exit:
490
        or      ax, -1
3908 Serge 491
        ret
714 Lrz 492
 
493
 
494
;-----------------------------------------------------------------------------
495
 
746 Lrz 496
;default_vmode:
2441 Serge 497
 
714 Lrz 498
;-----------------------------------------------------------------------------
499
draw_vmodes_table:
500
        _setcursor 9, 2
2434 Serge 501
        mov     si, gr_mode
714 Lrz 502
        call    printplain
503
 
2434 Serge 504
        mov     si, _st
714 Lrz 505
        call    printplain
506
 
507
        push    word [cursor_pos]
508
        pop     ax
509
        push    word [home_cursor]
510
        pop     si
2434 Serge 511
        mov     cx, si
714 Lrz 512
 
2434 Serge 513
        cmp     ax, si
714 Lrz 514
        je      .ok
515
        jb      .low
516
 
517
 
2434 Serge 518
        add     cx, size_of_step*long_v_table
2441 Serge 519
 
2434 Serge 520
        cmp     ax, cx
714 Lrz 521
        jb      .ok
2441 Serge 522
 
2434 Serge 523
        sub     cx, size_of_step*long_v_table
524
        add     cx, size_of_step
525
        cmp     cx, word[end_cursor]
714 Lrz 526
        jae     .ok
2434 Serge 527
        add     si, size_of_step
714 Lrz 528
        push    si
529
        pop     word [home_cursor]
530
        jmp     .ok
531
 
532
 
2434 Serge 533
.low:
534
        sub     cx, size_of_step
535
        cmp     cx, modes_table
714 Lrz 536
        jb      .ok
537
        push    cx
538
        push    cx
539
        pop     word [home_cursor]
540
        pop     si
541
 
542
 
543
.ok:
834 diamond 544
; calculate scroll position
545
        push    si
546
        mov     ax, [end_cursor]
547
        sub     ax, modes_table
548
        mov     bx, size_of_step
549
        cwd
550
        div     bx
551
        mov     si, ax          ; si = size of list
552
        mov     ax, [home_cursor]
553
        sub     ax, modes_table
554
        cwd
555
        div     bx
556
        mov     di, ax
557
        mov     ax, scroll_area_size*long_v_table
558
        cwd
559
        div     si
560
        test    ax, ax
561
        jnz     @f
562
        inc     ax
563
@@:
564
        cmp     al, scroll_area_size
565
        jb      @f
566
        mov     al, scroll_area_size
567
@@:
568
        mov     cx, ax
569
; cx = scroll height
570
; calculate scroll pos
571
        xor     bx, bx          ; initialize scroll pos
572
        sub     al, scroll_area_size+1
573
        neg     al
574
        sub     si, long_v_table-1
575
        jbe     @f
576
        mul     di
577
        div     si
578
        mov     bx, ax
579
@@:
580
        inc     bx
581
        imul    ax, bx, size_of_step
582
        add     ax, [home_cursor]
583
        mov     [scroll_start], ax
584
        imul    cx, size_of_step
585
        add     ax, cx
586
        mov     [scroll_end], ax
587
        pop     si
2434 Serge 588
        mov     bp, long_v_table              ;show rows
714 Lrz 589
.@@_next_bit:
834 diamond 590
;clear cursor
2434 Serge 591
        mov     ax, '  '
592
        mov     word[ds:_r1+21], ax
593
        mov     word[ds:_r1+50], ax
834 diamond 594
 
2434 Serge 595
        mov     word[ds:_r2+21], ax
596
        mov     word[ds:_r2+45], ax
834 diamond 597
 
2434 Serge 598
        mov     word[ds:_rs+21], ax
599
        mov     word[ds:_rs+46], ax
834 diamond 600
; draw string
2434 Serge 601
        cmp     word [es:si+6], 0x12
714 Lrz 602
        je      .show_0x12
2434 Serge 603
        cmp     word [es:si+6], 0x13
714 Lrz 604
        je      .show_0x13
605
 
2434 Serge 606
        movzx   eax, word[es:si]
607
        cmp     ax, -1
714 Lrz 608
        je      .@@_end
2434 Serge 609
        mov     di, _rs+23
610
        mov     ecx, 10
611
        mov     bl, 4
714 Lrz 612
        call    int2str
2434 Serge 613
        movzx   eax, word[es:si+2]
714 Lrz 614
        inc     di
2434 Serge 615
        mov     bl, 4
714 Lrz 616
        call    int2str
617
 
2434 Serge 618
        movzx   eax, word[es:si+8]
714 Lrz 619
        inc     di
2434 Serge 620
        mov     bl, 2
714 Lrz 621
        call    int2str
622
 
623
        cmp     si, word [cursor_pos]
624
        jne     .next
625
;draw   cursor
2434 Serge 626
        mov     word[ds:_rs+21], '>>'
627
        mov     word[ds:_rs+46], '<<'
714 Lrz 628
 
629
 
2441 Serge 630
 
714 Lrz 631
.next:
632
        push    si
2434 Serge 633
        mov     si, _rs
714 Lrz 634
.@@_sh:
834 diamond 635
; add to the string pseudographics for scrollbar
636
        pop     bx
637
        push    bx
638
        mov     byte [si+53], ' '
639
        cmp     bx, [scroll_start]
640
        jb      @f
641
        cmp     bx, [scroll_end]
642
        jae     @f
643
        mov     byte [si+53], 0xDB ; filled bar
644
@@:
645
        push    bx
646
        add     bx, size_of_step
647
        cmp     bx, [end_cursor]
648
        jnz     @f
649
        mov     byte [si+53], 31 ; 'down arrow' symbol
650
@@:
651
        sub     bx, [home_cursor]
652
        cmp     bx, size_of_step*long_v_table
653
        jnz     @f
654
        mov     byte [si+53], 31 ; 'down arrow' symbol
655
@@:
656
        pop     bx
657
        cmp     bx, [home_cursor]
658
        jnz     @f
659
        mov     byte [si+53], 30 ; 'up arrow' symbol
660
@@:
714 Lrz 661
        call    printplain
662
        pop     si
2434 Serge 663
        add     si, size_of_step
714 Lrz 664
 
665
        dec     bp
666
        jnz     .@@_next_bit
667
 
668
.@@_end:
2434 Serge 669
        mov     si, _bt
714 Lrz 670
        call    printplain
671
        ret
672
.show_0x13:
673
        push    si
674
 
675
        cmp     si, word [cursor_pos]
676
        jne     @f
2434 Serge 677
        mov     word[ds:_r1+21], '>>'
678
        mov     word[ds:_r1+50], '<<'
714 Lrz 679
@@:
2434 Serge 680
        mov     si, _r1
714 Lrz 681
        jmp     .@@_sh
682
.show_0x12:
683
        push    si
684
        cmp     si, word [cursor_pos]
685
        jne     @f
686
 
2434 Serge 687
        mov     word[ds:_r2+21], '>>'
688
        mov     word[ds:_r2+45], '<<'
714 Lrz 689
@@:
2434 Serge 690
        mov     si, _r2
714 Lrz 691
        jmp     .@@_sh
692
 
693
;-----------------------------------------------------------------------------
694
;Clear arrea of current video page (0xb800)
695
clear_vmodes_table:
696
        pusha
697
       ; draw frames
698
        push    es
699
        push    0xb800
700
        pop     es
2434 Serge 701
        mov     di, 1444
702
        xor     ax, ax
714 Lrz 703
        mov     ah, 1*16+15
3908 Serge 704
        mov     cx, 77
2434 Serge 705
        mov     bp, 12
714 Lrz 706
.loop_start:
3908 Serge 707
        rep stosw
708
        mov     cx, 77
709
        add     di, 6
946 lrz 710
        dec     bp
3908 Serge 711
        jns     .loop_start
714 Lrz 712
        pop     es
713
        popa
714
        ret
715
 
716
;-----------------------------------------------------------------------------
717
 
718
set_vmode:
719
        push    0 ;0;x1000
720
        pop     es
721
 
2434 Serge 722
        mov     si, word [preboot_graph]           ;[preboot_graph]
723
        mov     cx, word [es:si+6]           ; number of mode
3908 Serge 724
 
714 Lrz 725
 
2434 Serge 726
        mov     ax, word [es:si+0]           ; resolution X
727
        mov     bx, word [es:si+2]           ; resolution Y
714 Lrz 728
 
729
 
2441 Serge 730
        mov     word [es:BOOT_X_RES], ax             ; resolution X
731
        mov     word [es:BOOT_Y_RES], bx             ; resolution Y
732
        mov     word [es:BOOT_VESA_MODE], cx             ; number of mode
714 Lrz 733
 
2434 Serge 734
        cmp     cx, 0x12
714 Lrz 735
        je      .mode0x12_0x13
2434 Serge 736
        cmp     cx, 0x13
714 Lrz 737
        je      .mode0x12_0x13
738
 
739
 
2434 Serge 740
;        cmp     byte [s_vesa.ver], '2'
741
;        jb      .vesa12
714 Lrz 742
 
743
;  VESA 2 and Vesa 3
744
 
2434 Serge 745
        mov     ax, 0x4f01
746
        and     cx, 0xfff
747
        mov     di, mi;0xa000
714 Lrz 748
        int     0x10
749
        ; LFB
2434 Serge 750
        mov     eax, [es:mi.PhysBasePtr];di+0x28]
2441 Serge 751
        mov     [es:BOOT_LFB], eax
714 Lrz 752
        ; ---- vbe voodoo
753
        BytesPerLine equ 0x10
754
        mov     ax, [es:di+BytesPerLine]
2441 Serge 755
        mov     [es:BOOT_PITCH], ax
714 Lrz 756
        ; BPP
2434 Serge 757
        cmp     [es:mi.BitsPerPixel], 16
714 Lrz 758
        jne     .l0
2434 Serge 759
        cmp     [es:mi.GreenMaskSize], 5
714 Lrz 760
        jne     .l0
2434 Serge 761
        mov     [es:mi.BitsPerPixel], 15
714 Lrz 762
.l0:
763
        mov     al, byte [es:di+0x19]
2441 Serge 764
        mov     [es:BOOT_BPP], al
714 Lrz 765
        jmp     .exit
766
 
767
.mode0x12_0x13:
2441 Serge 768
        mov     byte [es:BOOT_BPP], 32
769
        or      dword [es:BOOT_LFB], 0xFFFFFFFF; 0x800000
714 Lrz 770
 
771
 
772
;  VESA 1.2 PM BANK SWITCH ADDRESS
773
 
2434 Serge 774
;.vesa12:
775
;        mov     ax, 0x4f0A
776
;        xor     bx, bx
777
;        int     0x10
778
;        xor     eax, eax
779
;        xor     ebx, ebx
780
;        mov     ax, es
781
;        shl     eax, 4
782
;        mov     bx, di
783
;        add     eax, ebx
784
;        movzx   ebx, word[es:di]
785
;        add     eax, ebx
786
;        push    0x0000
787
;        pop     es
788
;        mov     [es:0x9014], eax
714 Lrz 789
  .exit:
790
        ret
791
 
792
;=============================================================================
793
;=============================================================================
794
;=============================================================================
795