Changeset 8818 for trunk/src/ddraw/asmutil.asm
- Timestamp:
- Jul 1, 2002, 9:15:26 PM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/ddraw/asmutil.asm
r5326 r8818 1 ; $Id: asmutil.asm,v 1. 8 2001-03-18 21:44:44 mikeExp $1 ; $Id: asmutil.asm,v 1.9 2002-07-01 19:15:25 sandervl Exp $ 2 2 3 3 ; … … 31 31 CONST32 ENDS 32 32 33 DATA32 SEGMENT 34 35 align 4 36 and1mask dd 0001F001Fh 37 dd 0001F001Fh 38 and2mask dd 0FFC0FFC0h 39 dd 0FFC0FFC0h 40 and2mask565 dd 0FFE07FE0h 41 dd 07FE07FE0h 42 43 DATA32 ENDS 33 44 34 45 CODE32 SEGMENT … … 2097 2108 _MemFlip ENDP 2098 2109 2110 ; void _Optlink DDrawRGB555to565 (WORD *dest, WORD *src, ULONG num); 2111 2112 PUBLIC DDrawRGB555to565 2113 2114 DDrawRGB555to565 PROC NEAR 2115 2116 push esi 2117 push edi 2118 cld 2119 2120 mov edi, eax ; _Optlink arg1 = EAX 2121 mov esi, edx ; _Optlink arg2 = EDX 2122 shr ecx, 1 ; _Optlink arg3 = ECX 2123 pushf 2124 cvt: 2125 mov eax, [esi] 2126 mov edx, eax 2127 2128 add esi, 4 2129 shl eax, 1 2130 2131 and edx, 0001F001Fh 2132 and eax, 0FFC0FFC0h 2133 2134 add edi, 4 2135 or eax, edx 2136 2137 mov [edi-4], eax 2138 loop cvt 2139 2140 popf 2141 jnc SHORT done 2142 2143 mov ax, [esi] 2144 mov dx, ax 2145 and dx, 0001Fh 2146 shl ax, 1 2147 and ax, 0FFC0h 2148 or ax, dx 2149 mov [edi], ax 2150 2151 done: 2152 pop edi 2153 pop esi 2154 ret 2155 2156 DDrawRGB555to565 ENDP 2157 2158 PUBLIC DDrawRGB565to555 2159 2160 DDrawRGB565to555 PROC NEAR 2161 2162 push esi 2163 push edi 2164 cld 2165 2166 cmp ecx, 0 2167 jz done 2168 2169 mov edi, eax ; _Optlink arg1 = EAX 2170 mov esi, edx ; _Optlink arg2 = EDX 2171 shr ecx, 1 ; _Optlink arg3 = ECX 2172 pushf 2173 cvt: 2174 mov eax, [esi] 2175 mov edx, eax 2176 2177 add esi, 4 2178 shr eax, 1 2179 2180 and edx, 0001F001Fh 2181 and eax, 0FFE07FE0h 2182 2183 add edi, 4 2184 or eax, edx 2185 2186 mov [edi-4], eax 2187 loop cvt 2188 2189 popf 2190 jnc SHORT done 2191 2192 mov ax, [esi] 2193 mov dx, ax 2194 and dx, 0001Fh 2195 shr ax, 1 2196 and ax, 0FFE0h 2197 or ax, dx 2198 mov [edi], ax 2199 2200 done: 2201 pop edi 2202 pop esi 2203 ret 2204 2205 DDrawRGB565to555 ENDP 2206 2207 ; void _Optlink DDrawRGB555to565MMX(WORD *dest, WORD *src, ULONG num); 2208 2209 PUBLIC DDrawRGB555to565MMX 2210 2211 DDrawRGB555to565MMX PROC NEAR 2212 push esi 2213 push edi 2214 cld 2215 2216 cmp ecx, 0 2217 jz done 2218 2219 push ecx 2220 2221 mov edi, eax ; _Optlink arg1 = EAX 2222 mov esi, edx ; _Optlink arg2 = EDX 2223 shr ecx, 3 ; _Optlink arg3 = ECX 2224 jz lastpixels 2225 2226 sub esp, 108 2227 fsaved dword ptr [esp] 2228 2229 movq mm2, qword ptr and1mask ; 0001F001F001F001Fh 2230 movq mm3, qword ptr and2mask ; FFC0FFC00FFC0FFC0h 2231 2232 cvt: 2233 movq mm0, qword ptr [esi] 2234 add edi, 16 2235 2236 movq mm4, qword ptr [esi+8] 2237 movq mm1, mm0 2238 2239 movq mm5, mm4 2240 psllq mm0, 1 2241 2242 psllq mm4, 1 2243 pand mm1, mm2 2244 2245 pand mm0, mm3 2246 pand mm5, mm2 2247 2248 pand mm4, mm3 2249 por mm0, mm1 2250 2251 por mm4, mm5 2252 add esi, 16 2253 2254 movq qword ptr [edi-16], mm0 2255 dec ecx 2256 2257 movq qword ptr [edi-8], mm4 2258 jnz cvt 2259 2260 nop 2261 nop 2262 2263 frstord dword ptr [esp] 2264 add esp, 108 2265 2266 lastpixels: 2267 pop ecx 2268 and ecx, 3 2269 jz short done 2270 2271 cvt2loop: 2272 mov ax, [esi] 2273 mov dx, ax 2274 2275 add esi, 2 2276 and dx, 001Fh 2277 2278 shl ax, 1 2279 add edi, 2 2280 2281 and ax, 0FFC0h 2282 or ax, dx 2283 2284 mov [edi-2], ax 2285 loop cvt2loop 2286 2287 done: 2288 pop edi 2289 pop esi 2290 ret 2291 2292 DDrawRGB555to565MMX ENDP 2293 2294 2295 ; void _Optlink DDrawRGB565to555MMX(WORD *dest, WORD *src, ULONG num); 2296 2297 PUBLIC DDrawRGB565to555MMX 2298 2299 DDrawRGB565to555MMX PROC NEAR 2300 push esi 2301 push edi 2302 cld 2303 2304 cmp ecx, 0 2305 jz done 2306 2307 push ecx 2308 2309 mov edi, eax ; _Optlink arg1 = EAX 2310 mov esi, edx ; _Optlink arg2 = EDX 2311 shr ecx, 3 ; _Optlink arg3 = ECX 2312 jz lastpixels 2313 2314 sub esp, 108 2315 fsaved dword ptr [esp] 2316 2317 movq mm2, qword ptr and1mask ; 0001F001F001F001Fh 2318 movq mm3, qword ptr and2mask565 ; FFE07FE007FE07FE0h 2319 2320 cvt: 2321 movq mm0, qword ptr [esi] 2322 add edi, 16 2323 2324 movq mm4, qword ptr [esi+8] 2325 movq mm1, mm0 2326 2327 movq mm5, mm4 2328 psrlq mm0, 1 2329 2330 psrlq mm4, 1 2331 pand mm1, mm2 2332 2333 pand mm0, mm3 2334 pand mm5, mm2 2335 2336 pand mm4, mm3 2337 por mm0, mm1 2338 2339 por mm4, mm5 2340 add esi, 16 2341 2342 movq qword ptr [edi-16], mm0 2343 dec ecx 2344 2345 movq qword ptr [edi-8], mm4 2346 jnz cvt 2347 2348 nop 2349 nop 2350 2351 frstord dword ptr [esp] 2352 add esp, 108 2353 2354 lastpixels: 2355 pop ecx 2356 and ecx, 3 2357 jz short done 2358 2359 cvt2loop: 2360 mov ax, [esi] 2361 mov dx, ax 2362 2363 add esi, 2 2364 and dx, 001Fh 2365 2366 shr ax, 1 2367 add edi, 2 2368 2369 and ax, 0FFE0h 2370 or ax, dx 2371 2372 mov [edi-2], ax 2373 loop cvt2loop 2374 2375 done: 2376 pop edi 2377 pop esi 2378 ret 2379 2380 DDrawRGB565to555MMX ENDP 2381 2099 2382 CODE32 ENDS 2100 2383
Note:
See TracChangeset
for help on using the changeset viewer.