Subversion Repositories Kolibri OS

Rev

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

Rev 983 Rev 1300
Line 15... Line 15...
15
;;                                                              ;;
15
;;                                                              ;;
16
;;  See file COPYING for details                                ;;
16
;;  See file COPYING for details                                ;;
17
;;                                                              ;;
17
;;                                                              ;;
18
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
18
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 19... Line 19...
19
 
19
 
Line 20... Line 20...
20
$Revision: 983 $
20
$Revision: 1300 $
21
 
21
 
Line 22... Line 22...
22
 
22
 
23
; If you're planning to write your own video driver I suggest
23
; If you're planning to write your own video driver I suggest
24
; you replace the VESA12.INC file and see those instructions.
24
; you replace the VESA12.INC file and see those instructions.
25
 
25
 
26
;Screen_Max_X             equ     0xfe00
26
;Screen_Max_X             equ     0xfe00
27
;Screen_Max_Y            equ     0xfe04
-
 
Line 28... Line 27...
28
;BytesPerScanLine        equ     0xfe08
27
;Screen_Max_Y            equ     0xfe04
29
;LFBAddress              equ     0xfe80
28
;BytesPerScanLine        equ     0xfe08
Line 52... Line 51...
52
; eax = x
51
; eax = x
53
; ebx = y
52
; ebx = y
54
     imul    ebx, [BytesPerScanLine]    ; ebx = y * y multiplier
53
     imul    ebx, [BytesPerScanLine]    ; ebx = y * y multiplier
55
     lea     edi, [eax+eax*2] ; edi = x*3
54
     lea     edi, [eax+eax*2] ; edi = x*3
56
     add     edi, ebx         ; edi = x*3+(y*y multiplier)
55
     add     edi, ebx         ; edi = x*3+(y*y multiplier)
57
     add     edi, [LFBAddress]    ; ebx = where pixel is in memory
-
 
58
     mov     ecx, [edi]
56
     mov     ecx, [LFB_BASE+edi]
59
     and     ecx, 0xffffff
57
     and     ecx, 0xffffff
60
     ret
58
     ret
Line 61... Line 59...
61
 
59
 
62
Vesa20_getpixel32:
60
Vesa20_getpixel32:
63
     imul    ebx, [BytesPerScanLine]    ; ebx = y * y multiplier
61
     imul    ebx, [BytesPerScanLine]    ; ebx = y * y multiplier
64
     lea     edi, [ebx+eax*4] ; edi = x*4+(y*y multiplier)
-
 
65
     add     edi, [LFBAddress]    ; ebx = where pixel is in memory
62
     lea     edi, [ebx+eax*4] ; edi = x*4+(y*y multiplier)
66
     mov     ecx, [edi]
63
     mov     ecx, [LFB_BASE+edi]
67
     and     ecx, 0xffffff
64
     and     ecx, 0xffffff
Line 68... Line 65...
68
     ret
65
     ret
Line 104... Line 101...
104
; esi = pointer to 'init' function
101
; esi = pointer to 'init' function
105
; edi = parameter for 'get' function
102
; edi = parameter for 'get' function
Line 106... Line 103...
106
 
103
 
107
vesa20_putimage:
104
vesa20_putimage:
108
     pushad
105
     pushad
109
     call    [disable_mouse]
106
     call    [_display.disable_mouse]
110
     sub     esp, putimg.stack_data
107
     sub     esp, putimg.stack_data
111
; save pointer to image
108
; save pointer to image
112
     mov     [putimg.pti], ebx
109
     mov     [putimg.pti], ebx
113
; unpack the size
110
; unpack the size
Line 192... Line 189...
192
     mov     eax, [putimg.abs_cx]
189
     mov     eax, [putimg.abs_cx]
193
     movzx   ebx, byte [ScreenBPP]
190
     movzx   ebx, byte [ScreenBPP]
194
     shr     ebx, 3
191
     shr     ebx, 3
195
     imul    eax, ebx
192
     imul    eax, ebx
196
     add     edx, eax
193
     add     edx, eax
197
     add     edx, [LFBAddress]
-
 
198
; pointer to pixel map
194
; pointer to pixel map
199
     mov     eax, [putimg.abs_cy]
195
     mov     eax, [putimg.abs_cy]
200
     imul    eax, [Screen_Max_X]
196
     imul    eax, [Screen_Max_X]
201
     add     eax, [putimg.abs_cy]
197
     add     eax, [putimg.abs_cy]
202
     add     eax, [putimg.abs_cx]
198
     add     eax, [putimg.abs_cx]
203
     add     eax, WinMapAddress
199
     add     eax, [_WinMapAddress]
204
     xchg    eax, ebp
200
     xchg    eax, ebp
205
; get process number
201
; get process number
206
     mov     ebx, [CURRENT_TASK]
202
     mov     ebx, [CURRENT_TASK]
207
     cmp     byte [ScreenBPP], 32
203
     cmp     byte [ScreenBPP], 32
208
     je      put_image_end_32
204
     je      put_image_end_32
Line 218... Line 214...
218
     mov     eax, [putimg.ebp+4]
214
     mov     eax, [putimg.ebp+4]
219
     call    eax
215
     call    eax
220
     cmp     [ebp], bl
216
     cmp     [ebp], bl
221
     jne     .skip
217
     jne     .skip
222
;     mov     eax, [esi]        ; eax = RRBBGGRR
218
;     mov     eax, [esi]        ; eax = RRBBGGRR
223
     mov     [edx], ax
219
     mov     [LFB_BASE+edx], ax
224
     shr     eax, 16
220
     shr     eax, 16
225
     mov     [edx+2], al
221
     mov     [LFB_BASE+edx+2], al
226
.skip:
222
.skip:
227
;     add     esi, 3 ;[putimg.source_bpp]
223
;     add     esi, 3 ;[putimg.source_bpp]
228
     add     edx, 3
224
     add     edx, 3
229
     inc     ebp
225
     inc     ebp
230
     dec     ecx
226
     dec     ecx
Line 263... Line 259...
263
     mov     eax, [putimg.ebp+4]
259
     mov     eax, [putimg.ebp+4]
264
     call    eax
260
     call    eax
265
     cmp     [ebp], bl
261
     cmp     [ebp], bl
266
     jne     .skip
262
     jne     .skip
267
;     mov     eax, [esi]        ; ecx = RRBBGGRR
263
;     mov     eax, [esi]        ; ecx = RRBBGGRR
268
     mov     [edx], eax
264
     mov     [LFB_BASE+edx], eax
269
.skip:
265
.skip:
270
;     add     esi, [putimg.source_bpp]
266
;     add     esi, [putimg.source_bpp]
271
     add     edx, 4
267
     add     edx, 4
272
     inc     ebp
268
     inc     ebp
273
     dec     ecx
269
     dec     ecx
Line 306... Line 302...
306
; ecx = ?? RR GG BB    ; 0x01000000 negation
302
; ecx = ?? RR GG BB    ; 0x01000000 negation
307
; edi = 0x00000001 force
303
; edi = 0x00000001 force
Line 308... Line 304...
308
 
304
 
309
;;;        mov  [novesachecksum], dword 0
305
;;;        mov  [novesachecksum], dword 0
310
     pushad
-
 
311
     test  edi,1                 ; force ?
-
 
312
     jnz   .forced
-
 
313
; not forced:
-
 
314
     push  ecx               ; save 24th bit in case negative pixel wanted
-
 
315
     call  checkpixel
-
 
316
     test  ecx,ecx
-
 
317
     pop   ecx
-
 
318
     jnz   .exit
-
 
319
.forced:
306
     pushad
320
     cmp   [Screen_Max_X], eax
307
     cmp   [Screen_Max_X], eax
321
     jb    .exit
308
     jb    .exit
322
     cmp   [Screen_Max_Y], ebx
309
     cmp   [Screen_Max_Y], ebx
-
 
310
     jb    .exit
-
 
311
     test  edi,1                 ; force ?
-
 
312
     jnz   .forced
-
 
313
 
-
 
314
; not forced:
-
 
315
 
-
 
316
     push eax
-
 
317
     mov  edx,[_display.width]     ; screen x size
-
 
318
     imul edx, ebx
-
 
319
     add  eax, [_WinMapAddress]
-
 
320
     movzx  edx, byte [eax+edx]
-
 
321
     cmp edx, [CURRENT_TASK]
-
 
322
     pop eax
-
 
323
     jne .exit
323
     jb    .exit
324
 
324
.ok:
325
.forced:
325
; check if negation
326
; check if negation
326
     test  ecx,0x01000000
327
     test  ecx,0x01000000
327
     jz    .noneg
328
     jz    .noneg
328
     call  getpixel
329
     call  getpixel
Line 340... Line 341...
340
; eax = x
341
; eax = x
341
; ebx = y
342
; ebx = y
342
     imul    ebx, [BytesPerScanLine]     ; ebx = y * y multiplier
343
     imul    ebx, [BytesPerScanLine]     ; ebx = y * y multiplier
343
     lea     edi, [eax+eax*2]  ; edi = x*3
344
     lea     edi, [eax+eax*2]  ; edi = x*3
344
     mov     eax, [esp+32-8+4]
345
     mov     eax, [esp+32-8+4]
345
     add     edi, [LFBAddress]
-
 
346
     add     edi, ebx          ; ebx = where to put pixel in memory
-
 
347
     mov     [edi], ax
346
     mov     [LFB_BASE+ebx+edi], ax
348
     shr     eax, 16
347
     shr     eax, 16
349
     mov     [edi+2], al
348
     mov     [LFB_BASE+ebx+edi+2], al
350
     ret
349
     ret
Line 351... Line 350...
351
 
350
 
352
 
351
 
353
align 4
352
align 4
354
Vesa20_putpixel32:
353
Vesa20_putpixel32:
355
; eax = x
354
; eax = x
356
; ebx = y
355
; ebx = y
357
     imul    ebx, [BytesPerScanLine]     ; ebx = y * y multiplier
356
     imul    ebx, [BytesPerScanLine]     ; ebx = y * y multiplier
358
     lea     edi, [ebx+eax*4]  ; edi = x*4+(y*y multiplier)
-
 
359
     mov     eax, [esp+32-8+4] ; eax = color
357
     lea     edi, [ebx+eax*4]  ; edi = x*4+(y*y multiplier)
360
     add     edi, [LFBAddress]     ; ebx = where to put pixel in memory
358
     mov     eax, [esp+32-8+4] ; eax = color
Line 361... Line 359...
361
     mov     [edi], eax
359
     mov     [LFB_BASE+edi], eax
Line 362... Line 360...
362
     ret
360
     ret
Line 376... Line 374...
376
; DRAWLINE
374
; DRAWLINE
Line 377... Line 375...
377
 
375
 
378
align 4
376
align 4
379
__sys_draw_line:
377
__sys_draw_line:
380
;     inc   [mouse_pause]
378
;     inc   [mouse_pause]
Line 381... Line 379...
381
     call    [disable_mouse]
379
     call    [_display.disable_mouse]
382
 
380
 
383
; draw a line
381
; draw a line
384
; eax = HIWORD = x1
382
; eax = HIWORD = x1
Line 566... Line 564...
566
; ecx   xe
564
; ecx   xe
567
; edx   ye
565
; edx   ye
568
; edi   color
566
; edi   color
569
vesa20_drawbar:
567
vesa20_drawbar:
570
     pushad
568
     pushad
571
     call    [disable_mouse]
569
     call    [_display.disable_mouse]
572
     sub     esp, drbar.stack_data
570
     sub     esp, drbar.stack_data
573
     mov     [drbar.color], edi
571
     mov     [drbar.color], edi
574
     sub     edx, ebx
572
     sub     edx, ebx
575
     jle     .exit          ;// mike.dld, 2005-01-29
573
     jle     .exit          ;// mike.dld, 2005-01-29
576
     sub     ecx, eax
574
     sub     ecx, eax
Line 641... Line 639...
641
     mov     eax, [drbar.abs_cx]
639
     mov     eax, [drbar.abs_cx]
642
;     movzx   ebx, byte [ScreenBPP]
640
;     movzx   ebx, byte [ScreenBPP]
643
;     shr     ebx, 3
641
;     shr     ebx, 3
644
     imul    eax, ebx
642
     imul    eax, ebx
645
     add     edx, eax
643
     add     edx, eax
646
     add     edx, [LFBAddress]
-
 
647
; pointer to pixel map
644
; pointer to pixel map
648
     mov     eax, [drbar.abs_cy]
645
     mov     eax, [drbar.abs_cy]
649
     imul    eax, [Screen_Max_X]
646
     imul    eax, [Screen_Max_X]
650
     add     eax, [drbar.abs_cy]
647
     add     eax, [drbar.abs_cy]
651
     add     eax, [drbar.abs_cx]
648
     add     eax, [drbar.abs_cx]
652
     add     eax, WinMapAddress
649
     add     eax, [_WinMapAddress]
653
     xchg    eax, ebp
650
     xchg    eax, ebp
654
; get process number
651
; get process number
655
     mov     ebx, [CURRENT_TASK]
652
     mov     ebx, [CURRENT_TASK]
656
     cmp     byte [ScreenBPP], 24
653
     cmp     byte [ScreenBPP], 24
657
     jne     draw_bar_end_32
654
     jne     draw_bar_end_32
Line 672... Line 669...
672
     mov     edi, [drbar.real_sx]
669
     mov     edi, [drbar.real_sx]
673
align   4
670
align   4
674
.new_x:
671
.new_x:
675
     cmp     byte [ebp], bl
672
     cmp     byte [ebp], bl
676
     jne     .skip
673
     jne     .skip
-
 
674
 
677
     mov     [edx], bh
675
     mov     [LFB_BASE+edx], bh
678
     mov     [edx + 1], ax
676
     mov     [LFB_BASE+edx + 1], ax
679
.skip:
677
.skip:
680
; add pixel
678
; add pixel
681
     add     edx, 3
679
     add     edx, 3
682
     inc     ebp
680
     inc     ebp
683
     dec     edi
681
     dec     edi
Line 708... Line 706...
708
     mov     edi, [drbar.real_sx]
706
     mov     edi, [drbar.real_sx]
709
align   4
707
align   4
710
.new_x:
708
.new_x:
711
     cmp     byte [ebp], bl
709
     cmp     byte [ebp], bl
712
     jne     .skip
710
     jne     .skip
-
 
711
 
713
     mov     [edx], eax
712
     mov     [LFB_BASE+edx], eax
714
.skip:
713
.skip:
715
; add pixel
714
; add pixel
716
     add     edx, 4
715
     add     edx, 4
717
     inc     ebp
716
     inc     ebp
718
     dec     edi
717
     dec     edi
Line 735... Line 734...
735
     call    VGA_draw_bar
734
     call    VGA_draw_bar
736
     xor     eax, eax
735
     xor     eax, eax
737
     mov     [EGA_counter],1
736
     mov     [EGA_counter],1
738
     ret
737
     ret
Line 739... Line -...
739
 
-
 
740
;voodoodbcplimit:
-
 
741
 
-
 
742
; ebp:=(y+Ywin)*(ScreenXSize+1)+(x+Xwin)+AddrBuffer
-
 
743
 
-
 
744
 
-
 
745
;     pusha
-
 
746
 
-
 
747
;     xor edx,edx
-
 
748
;     mov eax,ebp
-
 
749
;     mov ebx,[Screen_Max_X] ; Screen_X_size
-
 
750
;     inc ebx   ; +1
-
 
751
;     sub eax,WinMapAddress ; -AddrBuffer
-
 
752
;     div ebx ;
-
 
753
;     mov ebx,eax ; ebx:=Y
-
 
754
;     mov eax,edx ; eax:=X
-
 
755
;     call cplimit
-
 
756
 
-
 
757
;     test ecx,ecx
-
 
758
;     jne  dbcpl12
-
 
759
;     popa
-
 
760
;     clc
-
 
761
;     ret
-
 
762
;   dbcpl12:
-
 
763
;     popa
738
 
764
;     stc
-
 
765
;     ret
-
 
766
 
-
 
767
 
-
 
768
 
-
 
769
 
-
 
770
;dbcplimit:
-
 
771
 
-
 
772
;        pusha
-
 
773
 
-
 
774
;        xor  edx,edx
-
 
775
;        mov  ebx,[Screen_Max_X]
-
 
776
;        inc  ebx
-
 
777
;        sub  eax,WinMapAddress
-
 
778
;        div  ebx
-
 
779
;        mov  ebx,eax
-
 
780
;        mov  eax,edx
-
 
781
;        call cplimit
-
 
782
 
-
 
783
;        test ecx,ecx
-
 
784
;        jne  dbcpl1
-
 
785
;        popa
-
 
786
;        clc
-
 
787
;        ret
-
 
788
;     dbcpl1:
-
 
789
;        popa
-
 
790
;        stc
-
 
791
;        ret
-
 
792
 
-
 
793
 
739
align 4
794
vesa20_drawbackground_tiled:
740
vesa20_drawbackground_tiled:
795
        call    [disable_mouse]
741
        call    [_display.disable_mouse]
796
        pushad
742
        pushad
797
; External loop for all y from start to end
743
; External loop for all y from start to end
798
        mov     ebx, [draw_data+32+RECT.top]    ; y start
744
        mov     ebx, [draw_data+32+RECT.top]    ; y start
799
dp2:
745
dp2:
Line 808... Line 754...
808
        add     ebp, eax
754
        add     ebp, eax
809
        cmp     [ScreenBPP], byte 24    ; 24 or 32 bpp ? - x size
755
        cmp     [ScreenBPP], byte 24    ; 24 or 32 bpp ? - x size
810
        jz      @f
756
        jz      @f
811
        add     ebp, eax
757
        add     ebp, eax
812
@@:
758
@@:
813
        add     ebp, [LFBAddress]
759
        add     ebp, LFB_BASE
814
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
760
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
815
        call    calculate_edi
761
        call    calculate_edi
816
        xchg    edi, ebp
762
        xchg    edi, ebp
-
 
763
        add ebp, [_WinMapAddress]
817
; Now eax=x, ebx=y, edi->output, ebp=offset in WinMapAddress
764
; Now eax=x, ebx=y, edi->output, ebp=offset in WinMapAddress
818
; 2) Calculate offset in background memory block
765
; 2) Calculate offset in background memory block
819
        push    eax
766
        push    eax
820
        xor     edx, edx
767
        xor     edx, edx
821
        mov     eax, ebx
768
        mov     eax, ebx
Line 840... Line 787...
840
; ecx = deltax - number of pixels left in current tile block
787
; ecx = deltax - number of pixels left in current tile block
841
; edx = 1
788
; edx = 1
842
; esi -> bgr memory, edi -> output
789
; esi -> bgr memory, edi -> output
843
; ebp = offset in WinMapAddress
790
; ebp = offset in WinMapAddress
844
dp3:
791
dp3:
845
        cmp     [ebp+WinMapAddress], dl
792
        cmp     [ebp], dl
846
        jnz     nbgp
793
        jnz     nbgp
847
        movsb
794
        movsb
848
        movsb
795
        movsb
849
        movsb
796
        movsb
850
        jmp     @f
797
        jmp     @f
Line 879... Line 826...
879
 
826
 
Line 880... Line 827...
880
; ----------
827
; ----------
881
 
828
 
882
 
829
 
883
vesa20_drawbackground_stretch:
830
vesa20_drawbackground_stretch:
884
        call    [disable_mouse]
831
        call    [_display.disable_mouse]
885
        pushad
832
        pushad
886
; Helper variables
833
; Helper variables
Line 915... Line 862...
915
        add     ebp, eax
862
        add     ebp, eax
916
        cmp     [ScreenBPP], byte 24    ; 24 or 32 bpp ? - x size
863
        cmp     [ScreenBPP], byte 24    ; 24 or 32 bpp ? - x size
917
        jz      @f
864
        jz      @f
918
        add     ebp, eax
865
        add     ebp, eax
919
@@:
866
@@:
920
        add     ebp, [LFBAddress]
-
 
921
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
867
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
922
        call    calculate_edi
868
        call    calculate_edi
923
        xchg    edi, ebp
869
        xchg    edi, ebp
924
; Now eax=x, ebx=y, edi->output, ebp=offset in WinMapAddress
870
; Now eax=x, ebx=y, edi->output, ebp=offset in WinMapAddress
925
        push    ebx
871
        push    ebx
Line 983... Line 929...
983
; dword [esp+24] = y
929
; dword [esp+24] = y
984
; precalculated constants:
930
; precalculated constants:
985
; qword [esp+28] = 2^32*(BgrDataHeight-1)/(ScreenHeight-1)
931
; qword [esp+28] = 2^32*(BgrDataHeight-1)/(ScreenHeight-1)
986
; qword [esp+36] = 2^32*(BgrDataWidth-1)/(ScreenWidth-1)
932
; qword [esp+36] = 2^32*(BgrDataWidth-1)/(ScreenWidth-1)
987
sdp3a:
933
sdp3a:
-
 
934
        mov eax, [_WinMapAddress]
988
        cmp     [ebp+WinMapAddress], byte 1
935
        cmp     [ebp+eax], byte 1
989
        jnz     snbgp
936
        jnz     snbgp
990
        mov     eax, [bgr_cur_line+esi]
937
        mov     eax, [bgr_cur_line+esi]
991
        test    ecx, ecx
938
        test    ecx, ecx
992
        jz      .novert
939
        jz      .novert
993
        mov     ebx, [bgr_next_line+esi]
940
        mov     ebx, [bgr_next_line+esi]
994
        call    [overlapping_of_points_ptr]
941
        call    [overlapping_of_points_ptr]
995
.novert:
942
.novert:
-
 
943
 
996
        mov     [edi], ax
944
        mov     [LFB_BASE+edi], ax
997
        shr     eax, 16
945
        shr     eax, 16
-
 
946
 
998
        mov     [edi+2], al
947
        mov     [LFB_BASE+edi+2], al
999
snbgp:
948
snbgp:
1000
        cmp     [ScreenBPP], byte 25
949
        cmp     [ScreenBPP], byte 25
1001
        sbb     edi, -4
950
        sbb     edi, -4
1002
        add     ebp, 1
951
        add     ebp, 1
1003
        mov     eax, [esp+20]
952
        mov     eax, [esp+20]