Subversion Repositories Kolibri OS

Rev

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

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