]> icculus.org git repositories - btb/d2x.git/blob - unused/win95/winckpit.asm
use the orientation parameter of g3_draw_bitmap
[btb/d2x.git] / unused / win95 / winckpit.asm
1 ; THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
2 ; SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
3 ; END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
4 ; ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
5 ; IN USING, DISPLAYING,  AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
6 ; SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
7 ; FREE PURPOSES.  IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
8 ; CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES.  THE END-USER UNDERSTANDS
9 ; AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.  
10 ; COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
11
12
13 .386
14         option  oldstructs
15
16         .nolist
17         include pstypes.inc
18         include psmacros.inc
19         .list
20
21         assume  cs:_TEXT, ds:_DATA
22
23 _DATA   segment dword public USE32 'DATA'
24
25 _DATA   ends
26
27
28
29 _TEXT   segment dword public USE32 'CODE'
30
31 ; gr_winckpit_blt_span
32 ;       blts a span region from source to dest buffer given a span
33 ;       list
34 ;
35 ;       EBX = xmin
36 ;       ECX = xmax
37 ;       ESI = bm_data source at start of y
38 ;       EDI = bm_data dest
39
40 PUBLIC gr_winckpit_blt_span
41 gr_winckpit_blt_span:
42
43         push    ebp
44
45         inc     ecx                     ; Better for counting and testing
46
47 NewSpanBlt:     
48         mov     al, [esi+ebx]           ; else blt odd pixel then check right
49         mov     [edi+ebx], al            
50         inc     ebx
51         cmp     ebx, ecx
52         jl      NewSpanBlt
53
54         pop     ebp
55         ret
56
57
58
59 ; gr_winckpit_blt_span_long
60 ;       blts a span region from source to dest buffer given a span
61 ;       list
62 ;       This uses word optimization, and should be used for spans longer
63 ;       than 10 pixels, and can't be used for spans of 3 pixels or less.
64 ;
65 ;       EBX = xmin
66 ;       ECX = xmax
67 ;       ESI = bm_data source at start of y
68 ;       EDI = bm_data dest
69
70 PUBLIC gr_winckpit_blt_span_long
71 gr_winckpit_blt_span_long:
72
73 ;       EDX = right word boundary
74
75         push    ebp
76
77         inc     ecx                     ; Better for counting and testing
78         mov     edx, ecx                ; Current right word boundary
79
80         test    ebx, 1                  ; is left boundary odd?
81         jz      TestRightBound          ; if even check right boundary.
82
83         mov     al, [esi+ebx]           ; else blt odd pixel then check right
84         mov     [edi+ebx], al            
85         inc     ebx
86                                 
87 ;       Assured even left boundary and find right word boundary.
88
89 TestRightBound:
90         test    ecx, 1                  ; if even, then we have an even bound
91         jz      NewSpanBlt2_0
92         dec     edx                     ; if odd, force even boundary           
93         jmp     NewSpanBlt2_1           
94
95
96 ;       This is a word only blt.  No odd pixels.
97
98 NewSpanBlt2_0:                  
99         mov     ax, [esi+ebx]
100         mov     [edi+ebx], ax           ; straight out blt.
101         add     ebx, 2
102         cmp     ebx, edx                ; do up to right word boundary
103         jl      NewSpanBlt2_0
104         jmp     EndProc
105
106
107 ;       Blts word span and odd right byte is needed.
108
109 NewSpanBlt2_1:
110         mov     ax, [esi+ebx]
111         mov     [edi+ebx], ax           ; straight out blt.
112         add     ebx, 2
113         cmp     ebx, edx                ; do up to right word boundary
114         jl      NewSpanBlt2_1
115         mov     al, [esi+ebx]           ; blt right odd pixel.
116         mov     [edi+ebx], al            
117
118 EndProc:
119         pop     ebp
120         ret
121
122 _TEXT   ends
123
124         end
125