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