source: trunk/src/ddraw/asmutil.asm@ 46

Last change on this file since 46 was 46, checked in by sandervl, 26 years ago

* empty log message *

File size: 2.1 KB
Line 
1; asmutil.asm Color key bit blitting for DirectDraw
2;
3; Copyright 1998 Sander van Leeuwen (sandervl@xs4all.nl)
4; *
5; * Project Odin Software License can be found in LICENSE.TXT
6; *
7;
8
9.386p
10 NAME asmutil
11
12CODE32 SEGMENT DWORD PUBLIC USE32 'CODE'
13 ASSUME CS:FLAT ,DS:FLAT,SS:FLAT
14
15 PUBLIC _BlitColorKey8
16
17; endpos = destbuf + blitlinesize;
18; while(destbuf < endpos) {
19; if(*srcbuf == colorkey) {
20; destbuf++;
21; }
22; else *destbuf++ = *srcbuf;
23; srcbuf++;
24; }
25; destbuf += (destscanlinesize-blitlinesize);
26; srcbuf += (srcscanlinesize-blitlinesize);
27;void BlitColorKey8(char *dest, char *src, ULONG key, ULONG linesize)
28_BlitColorKey8 PROC NEAR
29 push ebp
30 mov ebp, esp
31 push edi
32 push esi
33 push eax
34 push ebx
35 push ecx
36 push edx
37
38 mov edi, dword ptr [ebp+8] ;dest
39 mov esi, dword ptr [ebp+12] ;src
40 mov ecx, dword ptr [ebp+20] ;linesize
41 mov edx, dword ptr [ebp+16] ;colorkey
42
43 and ecx, 3
44 push ecx ;do the remaining bytes afterwards
45 mov ecx, dword ptr [ebp+20] ;linesize
46 shr ecx, 2 ;linesize in dwords
47
48 ALIGN 16
49
50blitloop:
51 mov ebx, dword ptr [esi]
52 mov eax, dword ptr [edi]
53 cmp bl, dl
54 je skipbyte1
55 mov al, bl
56
57skipbyte1:
58 cmp bh, dl
59 je skipbyte2
60 mov ah, bh
61skipbyte2:
62 ror eax, 16
63 ror ebx, 16
64 cmp bl, dl
65 je skipbyte3
66 mov al, bl
67skipbyte3:
68 cmp bh, dl
69 je skipbyte4
70 mov ah, bh
71skipbyte4:
72 ror eax, 16
73 dec ecx
74 mov dword ptr [edi], eax
75 add esi, 4
76 add edi, 4
77
78 cmp ecx, 0
79 jne blitloop
80
81 pop ecx
82 cmp ecx, 0
83 je endofblit
84
85blitperbyte:
86 mov al, byte ptr [esi]
87 dec ecx
88 cmp al, dl
89 je skipsinglebyte
90 mov byte ptr [edi], al
91skipsinglebyte:
92 inc esi
93 inc edi
94 cmp ecx, 0
95 jne blitperbyte
96
97endofblit:
98 pop edx
99 pop ecx
100 pop ebx
101 pop eax
102 pop esi
103 pop edi
104 pop ebp
105 ret
106_BlitColorKey8 ENDP
107
108CODE32 ENDS
109
110 END
Note: See TracBrowser for help on using the repository browser.