convert line ends
[canaan.git] / prj / tech / libsrc / dev2d / rsdblt.asm
blobe54a0409e015dae8b7966d2d638f09a0f4eb75bc
2 ; $Source: x:/prj/tech/libsrc/dev2d/RCS/rsdblt.asm $
3 ; $Revision: 1.3 $
4 ; $Author: TOML $
5 ; $Date: 1996/10/16 16:06:39 $
7 ; Rsd unpacking into a bitmap where row=width.
10 .386
12 include cseg.inc
13 include dseg.inc
14 include type.inc
15 include rsdblt.inc
16 include msmacros.inc
18 assume ds:_DATA
19 _DATA segment
20 _DATA ends
22 _TEXT segment
24 ;takes eax=rsd_source, edx=dest, ebx=dest_row, ecx=src_width
25 _FUNCDEF gd_rsd8_blit, 4
26 pushad
27 mov edi,edx
28 mov esi,eax
29 xor edx,edx
30 mov edx,ecx
31 xor ecx,ecx
32 sub ebx,edx
33 je flat_loop
35 mov ebp,edx
36 jmp check_loop
38 check_rsd_done:
39 popad
40 ret
42 check_loop:
43 mov cl,[esi] ;2
44 cmp cl,0 ;3
45 jz check_run ;2
46 cmp cl,080h ;3
47 je check_long_op ;6
48 ;aligned here
49 ja check_skip ;6
50 ;dump
51 inc esi ;1
52 sub edx,ecx
53 jle check_wrap_dump
54 check_end_dump:
55 memcpy check_loop
56 jmp check_loop
57 check_wrap_dump:
58 add ecx,edx ;ecx=edx
59 memcpy
60 add edi,ebx
61 mov ecx,edx
62 neg ecx
63 add edx,ebp
64 jle check_wrap_dump
65 jmp check_end_dump
67 align 16
68 check_run:
69 mov cl,[esi+1] ;3
70 mov al,[esi+2] ;3
71 add esi,3 ;3
72 sub edx,ecx
73 jle check_wrap_run
74 check_end_run:
75 memset check_loop
76 jmp check_loop
77 check_wrap_run:
78 add ecx,edx ;ecx=edx
79 memset
80 add edi,ebx
81 mov ecx,edx
82 neg ecx
83 add edx,ebp
84 jle check_wrap_run
85 jmp check_end_run
87 align 16
88 check_skip:
89 and ecx,07fh
90 inc esi
91 add edi,ecx
92 sub edx,ecx
93 ja check_loop
94 check_wrap_skip:
95 add edi,ebx
96 add edx,ebp
97 jle check_wrap_skip
98 xor ecx,ecx
99 jmp check_loop
102 check_long_op:
103 mov cx,[esi+1]
104 cmp ecx,08000h
105 jae check_long_run_or_dump
106 or ecx,ecx
107 jz flat_rsd_done
108 ;long skip
109 add esi,3
110 add edi,ecx
111 sub edx,ecx
112 jle check_wrap_skip
113 xor ecx,ecx
114 jmp check_loop
115 check_long_run_or_dump:
116 cmp ecx,0C000h
117 jae check_long_run
118 ;long dump
119 and ecx,07fffh
120 add esi,3
121 sub edx,ecx
122 jle check_wrap_dump
123 memcpy check_loop
124 jmp check_loop
125 check_long_run:
126 and ecx,03fffh
127 mov al,[esi+3]
128 add esi,4
129 sub edx,ecx
130 jle check_wrap_run
131 memset check_loop
132 jmp check_loop
134 flat_rsd_done:
135 popad
138 align 16
139 flat_loop:
140 mov cl,[esi] ;2
141 cmp cl,0 ;3
142 jz flat_run ;2
143 cmp cl,080h ;3
144 je flat_long_op ;6
145 ja flat_skip ;6
146 ;dump
147 inc esi ;1
148 memcpy flat_loop
149 jmp flat_loop
151 align 16
152 flat_run:
153 mov cl,[esi+1] ;3
154 mov al,[esi+2] ;3
155 add esi,3 ;3
156 memset flat_loop
157 jmp flat_loop
159 align 16
160 flat_skip:
161 and ecx,07fh
162 add edi,ecx
163 inc esi
164 jmp flat_loop
165 flat_long_op:
166 mov cx,[esi+1]
167 cmp ecx,08000h
168 jae flat_long_run_or_dump
169 or ecx,ecx
170 jz flat_rsd_done
171 ;long skip
172 add esi,3
173 add edi,ecx
174 xor ecx,ecx
175 jmp flat_loop
176 flat_long_run_or_dump:
177 cmp ecx,0C000h
178 jae flat_long_run
179 ;long dump
180 and ecx,07fffh
181 add esi,3
182 memcpy flat_loop
183 jmp flat_loop
184 flat_long_run:
185 and ecx,03fffh
186 mov al,[esi+3]
187 add esi,4
188 memset flat_loop
189 jmp flat_loop
190 _TEXT ends