]> icculus.org git repositories - btb/d2x.git/blob - unused/win95/winckpit.asm
configuration fixes
[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 rcsid   db      "$Id: winckpit.asm,v 1.1.1.2 2001-01-19 03:33:51 bradleyb Exp $"
26         align   4
27
28 _DATA   ends
29
30
31
32 _TEXT   segment dword public USE32 'CODE'
33
34 ; gr_winckpit_blt_span
35 ;       blts a span region from source to dest buffer given a span
36 ;       list
37 ;
38 ;       EBX = xmin
39 ;       ECX = xmax
40 ;       ESI = bm_data source at start of y
41 ;       EDI = bm_data dest
42
43 PUBLIC gr_winckpit_blt_span
44 gr_winckpit_blt_span:
45
46         push    ebp
47
48         inc     ecx                     ; Better for counting and testing
49
50 NewSpanBlt:     
51         mov     al, [esi+ebx]           ; else blt odd pixel then check right
52         mov     [edi+ebx], al            
53         inc     ebx
54         cmp     ebx, ecx
55         jl      NewSpanBlt
56
57         pop     ebp
58         ret
59
60
61
62 ; gr_winckpit_blt_span_long
63 ;       blts a span region from source to dest buffer given a span
64 ;       list
65 ;       This uses word optimization, and should be used for spans longer
66 ;       than 10 pixels, and can't be used for spans of 3 pixels or less.
67 ;
68 ;       EBX = xmin
69 ;       ECX = xmax
70 ;       ESI = bm_data source at start of y
71 ;       EDI = bm_data dest
72
73 PUBLIC gr_winckpit_blt_span_long
74 gr_winckpit_blt_span_long:
75
76 ;       EDX = right word boundary
77
78         push    ebp
79
80         inc     ecx                     ; Better for counting and testing
81         mov     edx, ecx                ; Current right word boundary
82
83         test    ebx, 1                  ; is left boundary odd?
84         jz      TestRightBound          ; if even check right boundary.
85
86         mov     al, [esi+ebx]           ; else blt odd pixel then check right
87         mov     [edi+ebx], al            
88         inc     ebx
89                                 
90 ;       Assured even left boundary and find right word boundary.
91
92 TestRightBound:
93         test    ecx, 1                  ; if even, then we have an even bound
94         jz      NewSpanBlt2_0
95         dec     edx                     ; if odd, force even boundary           
96         jmp     NewSpanBlt2_1           
97
98
99 ;       This is a word only blt.  No odd pixels.
100
101 NewSpanBlt2_0:                  
102         mov     ax, [esi+ebx]
103         mov     [edi+ebx], ax           ; straight out blt.
104         add     ebx, 2
105         cmp     ebx, edx                ; do up to right word boundary
106         jl      NewSpanBlt2_0
107         jmp     EndProc
108
109
110 ;       Blts word span and odd right byte is needed.
111
112 NewSpanBlt2_1:
113         mov     ax, [esi+ebx]
114         mov     [edi+ebx], ax           ; straight out blt.
115         add     ebx, 2
116         cmp     ebx, edx                ; do up to right word boundary
117         jl      NewSpanBlt2_1
118         mov     al, [esi+ebx]           ; blt right odd pixel.
119         mov     [edi+ebx], al            
120
121 EndProc:
122         pop     ebp
123         ret
124
125 _TEXT   ends
126
127         end
128