Subversion Repositories Kolibri OS

Rev

Rev 1508 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1508 Rev 1700
Line 3... Line 3...
3
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
4
;; Distributed under terms of the GNU General Public License    ;;
4
;; Distributed under terms of the GNU General Public License    ;;
5
;;                                                              ;;
5
;;                                                              ;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 7... Line 7...
7
 
7
 
Line 8... Line 8...
8
$Revision: 1508 $
8
$Revision: 1700 $
9
 
9
 
10
struc VBE_VGAInfo {
10
struc VBE_VGAInfo {
11
  .VESASignature          dd ?    ; char
11
  .VESASignature          dd ?    ; char
Line 185... Line 185...
185
;        pop     es
185
;        pop     es
Line 186... Line 186...
186
 
186
 
Line 187... Line 187...
187
        lfs     si, [es:vi.VideoModePtr]
187
        lfs     si, [es:vi.VideoModePtr]
188
 
-
 
189
        mov     bx,modes_table
-
 
190
;save no vesa mode of work 320x200, EGA/CGA 256 colors and 640x480, VGA 16 cols
-
 
191
;        mov     word [es:bx],640
-
 
192
;        mov     word [es:bx+2],480
188
 
193
;        mov     word [es:bx+6],0x13
-
 
194
        
-
 
195
;        mov     word [es:bx+10],640
-
 
196
;        mov     word [es:bx+12],480
-
 
197
;        mov     word [es:bx+16],0x12
189
        mov     bx,modes_table
198
;        add     bx,20
190
 
199
  .next_mode:
191
  .next_mode:
200
        mov     cx,word [fs:si] ; mode number
192
        mov     cx,word [fs:si] ; mode number
Line 227... Line 219...
227
        mov     ax,[es:mi.YRes]
219
        mov     ax,[es:mi.YRes]
228
        mov     [es:bx+2],ax               ; +2[2] : resolution Y
220
        mov     [es:bx+2],ax               ; +2[2] : resolution Y
229
        mov     ax,[es:mi.ModeAttributes]
221
        mov     ax,[es:mi.ModeAttributes]
230
        mov     [es:bx+4],ax               ; +4[2] : attributes
222
        mov     [es:bx+4],ax               ; +4[2] : attributes
Line 231... Line 223...
231
 
223
 
232
        cmp     [s_vesa.ver],'2'
224
;<<        cmp     [s_vesa.ver],'2'
Line 233... Line 225...
233
        jb      .lp1
225
;<<        jb      .lp1
234
 
226
 
235
        or      cx,0x4000  ; use LFB
227
        or      cx,0x4000  			; use LFB <<< ?
236
.lp1:	mov     [es:bx+6],cx               ; +6 : mode number
228
.lp1:	mov     [es:bx+6],cx               ; +6 : mode number
237
        movzx   ax,byte [es:mi.BitsPerPixel]
229
        movzx   ax,byte [es:mi.BitsPerPixel]
Line 238... Line 230...
238
        mov     word [es:bx+8],ax               ; +8 : bits per pixel
230
        mov     word [es:bx+8],ax               ; +8 : bits per pixel << ?
239
        add     bx,size_of_step                 ; size of record 
231
        add     bx,size_of_step                 ; size of record 
240
 
232
 
Line 249... Line 241...
249
        popad
241
        popad
250
        ret
242
        ret
Line 251... Line 243...
251
 
243
 
Line 252... Line 244...
252
;-----------------------------------------------------------------------------
244
;-----------------------------------------------------------------------------
253
 
245
 
254
draw_current_vmode:
246
;draw_current_vmode:
Line 255... Line 247...
255
        push    0
247
;        push    0
Line 256... Line 248...
256
        pop     es
248
;        pop     es
257
 
249
 
Line 258... Line 250...
258
        mov     si,word [cursor_pos]
250
;        mov     si,word [cursor_pos]
259
 
251
 
Line 260... Line 252...
260
        cmp     word [es:si+6],0x12
252
;        cmp     word [es:si+6],0x12
261
        je      .no_vesa_0x12
253
;        je      .no_vesa_0x12
262
 
254
 
263
        cmp     word [es:si+6],0x13
255
;        cmp     word [es:si+6],0x13
264
        je      .no_vesa_0x13
256
;        je      .no_vesa_0x13
265
 
257
 
266
        mov     di,loader_block_error
258
;        mov     di,loader_block_error
267
        movzx   eax,word[es:si+0]
259
;        movzx   eax,word[es:si+0]
268
        mov     ecx,10
260
;        mov     ecx,10
269
        call    int2strnz
261
;        call    int2strnz
270
        mov     byte[es:di],'x'
262
;        mov     byte[es:di],'x'
271
        inc     di
263
;        inc     di
272
        movzx   eax,word[es:si+2]
264
;        movzx   eax,word[es:si+2]
273
        call    int2strnz
265
;        call    int2strnz
274
        mov     byte[es:di],'x'
266
;        mov     byte[es:di],'x'
275
        inc     di
267
;        inc     di
276
        movzx   eax,word[es:si+8]
268
;        movzx   eax,word[es:si+8]
277
        call    int2strnz
269
;        call    int2strnz
278
        mov     dword[es:di],0x00000d0a
270
;        mov     dword[es:di],0x00000d0a
279
        mov     si,loader_block_error
271
;        mov     si,loader_block_error
280
        push    ds
272
;        push    ds
281
        push    es
273
;        push    es
282
        pop     ds
274
;        pop     ds
283
        call    printplain
275
;        call    printplain
284
        pop     ds
276
;        pop     ds
285
        ret
277
;        ret
286
.no_vesa_0x13:
278
;.no_vesa_0x13:
287
        mov     si,mode0
279
;        mov     si,mode0
288
        jmp     .print
280
;        jmp     .print
289
.no_vesa_0x12:
281
;.no_vesa_0x12:
290
        mov     si,mode9
282
;        mov     si,mode9
291
.print:
283
;.print:
292
        call    printplain
284
;        call    printplain
Line 307... Line 299...
307
        mov     bx,768
299
        mov     bx,768
308
        mov     si,modes_table
300
        mov     si,modes_table
309
        call    .loops
301
        call    .loops
310
        test    ax,ax
302
        test    ax,ax
311
        jz     .ok_found_mode
303
        jz     .ok_found_mode
312
        mov     ax,800
-
 
313
        mov     bx,600
-
 
314
        mov     si,modes_table
-
 
315
        call    .loops
-
 
316
        test    ax,ax
-
 
317
        jz     .ok_found_mode
-
 
Line 318... Line 304...
318
 
304
 
319
        mov     si,modes_table
305
        mov     si,modes_table
Line 320... Line 306...
320
        jmp     .ok_found_mode
306
        jmp     .ok_found_mode
Line 329... Line 315...
329
        call    .loops
315
        call    .loops
330
        test    ax,ax
316
        test    ax,ax
331
        jz     .ok_found_mode
317
        jz     .ok_found_mode
Line 332... Line 318...
332
 
318
 
333
	mov    si,modes_table
-
 
334
;        cmp     ax,modes_table
-
 
335
;        jb      .zerro           ;check on correct if bellow
-
 
336
;        cmp     ax,word [end_cursor]
-
 
Line 337... Line 319...
337
;        ja      .zerro           ;check on correct if anymore
319
	mov    si,modes_table
338
 
320
 
339
.ok_found_mode:
-
 
340
        mov     word [home_cursor],si
321
.ok_found_mode:
341
;        mov     word [cursor_pos],si
322
        mov     word [home_cursor],si
Line 342... Line 323...
342
        mov     word [preboot_graph],si
323
        mov     word [preboot_graph],si
Line 371... Line 352...
371
.loops:
352
.loops:
372
        cmp     ax,word [es:si]
353
        cmp     ax,word [es:si]
373
        jne     .next
354
        jne     .next
374
        cmp     bx,word [es:si+2]
355
        cmp     bx,word [es:si+2]
375
        jne     .next
356
        jne     .next
376
        cmp     word [es:si+8],32
-
 
377
        je      .ok
-
 
378
        cmp     word [es:si+8],24
-
 
379
        je      .ok
357
        je      .ok
380
.next:  add     si,size_of_step
358
.next:  add     si,size_of_step
381
        cmp     word [es:si],-1
359
        cmp     word [es:si],-1
382
        je      .exit
360
        je      .exit
383
        jmp     .loops
361
        jmp     .loops
Line 391... Line 369...
391
 
369
 
Line 392... Line 370...
392
;default_vmode:
370
;default_vmode:
393
        
371
        
394
;-----------------------------------------------------------------------------
372
;-----------------------------------------------------------------------------
395
draw_vmodes_table:
373
draw_vmodes_table:
396
        _setcursor 9, 2
374
;        _setcursor 9, 2
Line 397... Line 375...
397
        mov     si,gr_mode
375
;        mov     si,gr_mode
398
        call    printplain
376
;        call    printplain
Line 399... Line 377...
399
 
377
 
400
        mov     si,_st
378
;        mov     si,_st
401
        call    printplain
379
;        call    printplain
402
 
380
 
403
        push    word [cursor_pos]
381
;        push    word [cursor_pos]
Line 404... Line 382...
404
        pop     ax
382
;        pop     ax
405
        push    word [home_cursor]
383
;        push    word [home_cursor]
406
        pop     si
384
;        pop     si
Line 407... Line 385...
407
        mov     cx,si
385
;        mov     cx,si
Line 408... Line 386...
408
 
386
 
409
        cmp     ax,si
387
 ;       cmp     ax,si
Line 410... Line 388...
410
        je      .ok
388
;        je      .ok
411
        jb      .low
389
;        jb      .low
412
 
390
 
413
 
391
 
414
        add     cx,size_of_step*long_v_table
392
 ;       add     cx,size_of_step*long_v_table
415
        
393
        
416
        cmp     ax,cx
394
  ;      cmp     ax,cx
417
        jb      .ok
395
;        jb      .ok
Line 418... Line 396...
418
        
396
        
419
        sub     cx,size_of_step*long_v_table
397
;        sub     cx,size_of_step*long_v_table
420
        add     cx,size_of_step
398
;        add     cx,size_of_step
421
        cmp     cx,word[end_cursor]
399
;        cmp     cx,word[end_cursor]
422
        jae     .ok
400
;        jae     .ok
423
        add     si,size_of_step
401
;        add     si,size_of_step
424
        push    si
402
;        push    si
Line 425... Line 403...
425
        pop     word [home_cursor]
403
;        pop     word [home_cursor]
426
        jmp     .ok
404
;        jmp     .ok
427
 
405
 
428
 
406
 
429
.low:   sub     cx,size_of_step
407
;.low:   sub     cx,size_of_step
430
        cmp     cx,modes_table
408
;        cmp     cx,modes_table
431
        jb      .ok
409
;        jb      .ok
432
        push    cx
410
;        push    cx
433
        push    cx
411
;        push    cx
434
        pop     word [home_cursor]
412
;        pop     word [home_cursor]
435
        pop     si
413
;        pop     si
436
 
414
 
437
 
415
 
438
.ok:
416
;.ok:
439
; calculate scroll position
417
; calculate scroll position
440
        push    si
418
;        push    si
441
        mov     ax, [end_cursor]
419
;        mov     ax, [end_cursor]
442
        sub     ax, modes_table
420
;        sub     ax, modes_table
443
        mov     bx, size_of_step
421
;        mov     bx, size_of_step
444
        cwd
422
;        cwd
445
        div     bx
423
;        div     bx
446
        mov     si, ax          ; si = size of list
424
;        mov     si, ax          ; si = size of list
447
        mov     ax, [home_cursor]
425
;        mov     ax, [home_cursor]
448
        sub     ax, modes_table
426
;        sub     ax, modes_table
449
        cwd
427
;        cwd
450
        div     bx
428
;        div     bx
451
        mov     di, ax
429
;        mov     di, ax
452
        mov     ax, scroll_area_size*long_v_table
430
;        mov     ax, scroll_area_size*long_v_table
453
        cwd
431
;        cwd
454
        div     si
432
;        div     si
455
        test    ax, ax
433
;        test    ax, ax
456
        jnz     @f
434
;        jnz     @f
457
        inc     ax
435
;        inc     ax
458
@@:
436
;@@:
459
        cmp     al, scroll_area_size
437
;        cmp     al, scroll_area_size
460
        jb      @f
438
;        jb      @f
461
        mov     al, scroll_area_size
439
;        mov     al, scroll_area_size
462
@@:
440
;@@:
463
        mov     cx, ax
441
;        mov     cx, ax
464
; cx = scroll height
442
; cx = scroll height
465
; calculate scroll pos
443
; calculate scroll pos
466
        xor     bx, bx          ; initialize scroll pos
444
;        xor     bx, bx          ; initialize scroll pos
467
        sub     al, scroll_area_size+1
445
;        sub     al, scroll_area_size+1
468
        neg     al
446
;        neg     al
469
        sub     si, long_v_table-1
447
;        sub     si, long_v_table-1
470
        jbe     @f
448
;        jbe     @f
471
        mul     di
449
;        mul     di
472
        div     si
450
;        div     si
473
        mov     bx, ax
451
;        mov     bx, ax
474
@@:
452
;@@:
475
        inc     bx
453
;        inc     bx
Line 476... Line 454...
476
        imul    ax, bx, size_of_step
454
;        imul    ax, bx, size_of_step
477
        add     ax, [home_cursor]
455
;        add     ax, [home_cursor]
Line 478... Line 456...
478
        mov     [scroll_start], ax
456
;        mov     [scroll_start], ax
479
        imul    cx, size_of_step
457
;        imul    cx, size_of_step
480
        add     ax, cx
458
;        add     ax, cx
481
        mov     [scroll_end], ax
459
;        mov     [scroll_end], ax
482
        pop     si
460
;        pop     si
483
        mov     bp,long_v_table               ;show rows
461
;        mov     bp,long_v_table               ;show rows
484
.@@_next_bit:
462
;.@@_next_bit:
485
;clear cursor
463
;clear cursor
486
	mov	ax,'  '
464
;	mov	ax,'  '
487
        mov     word[ds:_r1+21],ax
465
;        mov     word[ds:_r1+21],ax
488
        mov     word[ds:_r1+50],ax
466
;        mov     word[ds:_r1+50],ax
489
 
467
 
490
        mov     word[ds:_r2+21],ax
468
;        mov     word[ds:_r2+21],ax
491
        mov     word[ds:_r2+45],ax
469
;        mov     word[ds:_r2+45],ax
492
 
470
 
493
        mov     word[ds:_rs+21],ax
471
;        mov     word[ds:_rs+21],ax
494
        mov     word[ds:_rs+46],ax
472
;        mov     word[ds:_rs+46],ax
495
; draw string
473
; draw string
496
        cmp     word [es:si+6],0x12
474
;        cmp     word [es:si+6],0x12
497
        je      .show_0x12
475
;        je      .show_0x12
498
        cmp     word [es:si+6],0x13
476
;        cmp     word [es:si+6],0x13
499
        je      .show_0x13
477
;        je      .show_0x13
500
 
478
 
501
        movzx   eax,word[es:si]
479
;        movzx   eax,word[es:si]
Line 502... Line 480...
502
        cmp     ax,-1
480
;        cmp     ax,-1
503
        je      .@@_end
481
;        je      .@@_end
504
        mov     di,_rs+23          
482
;        mov     di,_rs+23          
505
        mov     ecx,10
483
;        mov     ecx,10
506
        mov     bl,4
484
;        mov     bl,4
Line 507... Line 485...
507
        call    int2str
485
;        call    int2str
508
        movzx   eax,word[es:si+2]
486
;        movzx   eax,word[es:si+2]
509
        inc     di
487
;        inc     di
510
        mov     bl,4
488
;        mov     bl,4
511
        call    int2str
489
;        call    int2str
512
 
490
 
513
        movzx   eax,word[es:si+8]
491
;        movzx   eax,word[es:si+8]
514
        inc     di
492
;        inc     di
515
        mov     bl,2
493
;        mov     bl,2
516
        call    int2str
494
;        call    int2str
517
 
495
 
518
        cmp     si, word [cursor_pos]
496
;        cmp     si, word [cursor_pos]
519
        jne     .next
497
;        jne     .next
520
;draw   cursor
498
;draw   cursor
521
        mov     word[ds:_rs+21],'>>'
499
;        mov     word[ds:_rs+21],'>>'
522
        mov     word[ds:_rs+46],'<<'
500
;        mov     word[ds:_rs+46],'<<'
523
        
501
        
524
 
502
 
525
 
503
 
526
.next:
504
;.next:
527
        push    si
505
;        push    si
528
        mov     si,_rs
506
;        mov     si,_rs
529
.@@_sh:
507
;.@@_sh:
530
; add to the string pseudographics for scrollbar
508
; add to the string pseudographics for scrollbar
531
        pop     bx
509
;        pop     bx
532
        push    bx
510
;        push    bx
533
        mov     byte [si+53], ' '
511
;        mov     byte [si+53], ' '
534
        cmp     bx, [scroll_start]
512
;        cmp     bx, [scroll_start]
535
        jb      @f
513
;        jb      @f
536
        cmp     bx, [scroll_end]
514
;        cmp     bx, [scroll_end]
537
        jae     @f
515
;        jae     @f
538
        mov     byte [si+53], 0xDB ; filled bar
516
;        mov     byte [si+53], 0xDB ; filled bar
539
@@:
517
;@@:
540
        push    bx
518
;        push    bx
541
        add     bx, size_of_step
519
;        add     bx, size_of_step
542
        cmp     bx, [end_cursor]
520
;        cmp     bx, [end_cursor]
543
        jnz     @f
521
;        jnz     @f
544
        mov     byte [si+53], 31 ; 'down arrow' symbol
522
;        mov     byte [si+53], 31 ; 'down arrow' symbol
545
@@:
523
;@@:
546
        sub     bx, [home_cursor]
524
;        sub     bx, [home_cursor]
547
        cmp     bx, size_of_step*long_v_table
525
;        cmp     bx, size_of_step*long_v_table
548
        jnz     @f
526
;        jnz     @f
549
        mov     byte [si+53], 31 ; 'down arrow' symbol
527
;        mov     byte [si+53], 31 ; 'down arrow' symbol
550
@@:
528
;@@:
551
        pop     bx
529
;        pop     bx
552
        cmp     bx, [home_cursor]
530
;        cmp     bx, [home_cursor]
553
        jnz     @f
531
;        jnz     @f
554
        mov     byte [si+53], 30 ; 'up arrow' symbol
532
;        mov     byte [si+53], 30 ; 'up arrow' symbol
555
@@:
533
;@@:
556
        call    printplain
534
;        call    printplain
557
        pop     si
535
;        pop     si
558
        add     si,size_of_step
536
;        add     si,size_of_step
559
 
537
 
560
        dec     bp
538
;        dec     bp
561
        jnz     .@@_next_bit
539
;        jnz     .@@_next_bit
562
 
540
 
563
.@@_end:
541
;.@@_end:
564
        mov     si,_bt
542
;        mov     si,_bt
565
        call    printplain
543
;        call    printplain
566
        ret
544
        ret
567
.show_0x13:
545
;.show_0x13:
Line 568... Line 546...
568
        push    si
546
;        push    si
569
 
547
 
570
        cmp     si, word [cursor_pos]
548
;        cmp     si, word [cursor_pos]
571
        jne     @f
549
;        jne     @f
572
        mov     word[ds:_r1+21],'>>'
550
;        mov     word[ds:_r1+21],'>>'
573
        mov     word[ds:_r1+50],'<<'        
551
;        mov     word[ds:_r1+50],'<<'        
574
@@:
552
;@@:
Line 624... Line 602...
624
 
602
 
625
        mov     word [es:0x900A],ax              ; resolution X
603
        mov     word [es:0x900A],ax              ; resolution X
626
        mov     word [es:0x900C],bx              ; resolution Y
604
        mov     word [es:0x900C],bx              ; resolution Y
Line 627... Line -...
627
        mov     word [es:0x9008],cx              ; number of mode
-
 
628
 
-
 
629
;        cmp     cx,0x12
-
 
630
;        je      .mode0x12_0x13
-
 
Line 631... Line -...
631
;        cmp     cx,0x13
-
 
632
;        je      .mode0x12_0x13
-
 
633
 
-
 
634
 
-
 
635
;        cmp     byte [s_vesa.ver],'2'
605
        mov     word [es:0x9008],cx              ; number of mode
Line 636... Line 606...
636
;        jb      .vesa12
606
 
637
 
607
 
638
;  VESA 2 and Vesa 3
608
;  VESA 2 and Vesa 3 only
639
 
609
 
Line 647... Line 617...
647
        ; ---- vbe voodoo
617
        ; ---- vbe voodoo
648
        BytesPerLine equ 0x10
618
        BytesPerLine equ 0x10
649
        mov     ax, [es:di+BytesPerLine]
619
        mov     ax, [es:di+BytesPerLine]
650
        mov     [es:0x9001], ax
620
        mov     [es:0x9001], ax
651
        ; BPP
621
        ; BPP
652
;        cmp     [es:mi.BitsPerPixel],16
-
 
653
;        jne     .l0
-
 
654
;        cmp     [es:mi.GreenMaskSize],5
-
 
655
;        jne     .l0
-
 
656
;        mov     [es:mi.BitsPerPixel],15
-
 
657
.l0:
622
.l0:
658
        mov     al, byte [es:di+0x19]
623
        mov     al, byte [es:di+0x19]
659
        mov     [es:0x9000], al
624
        mov     [es:0x9000], al
660
        jmp     .exit
625
        jmp     .exit
Line 661... Line -...
661
 
-
 
662
;.mode0x12_0x13:
-
 
663
;        mov     byte [es:0x9000], 32
-
 
664
;        or      dword [es:0x9018], 0xFFFFFFFF; 0x800000
-
 
665
 
-
 
666
 
-
 
667
;  VESA 1.2 PM BANK SWITCH ADDRESS
-
 
668
 
-
 
669
;.vesa12:
-
 
670
 
-
 
671
 
-
 
672
;        mov     ax,0x4f0A
-
 
673
;        xor     bx,bx
-
 
674
;        int     0x10
-
 
675
;        xor     eax,eax
-
 
676
;        xor     ebx,ebx
-
 
677
;        mov     ax,es
-
 
678
;        shl     eax,4
-
 
679
;        mov     bx,di
-
 
680
;        add     eax,ebx
-
 
681
;        movzx   ebx,word[es:di]
-
 
682
;        add     eax,ebx
-
 
683
;        push    0x0000
-
 
684
;        pop     es
-
 
685
;        mov     [es:0x9014],eax
626
 
686
  .exit:
627
  .exit:
Line 687... Line 628...
687
        ret
628
        ret