Add VCS links
[debian-dgen.git] / x86_ctv.asm
blob7c8ce47533d991044a261ae8d7cd90b10ff9e6ec
1 ; CTV!
3 bits 32
4 section .text
5 ;extern "C" int blur_bitmap_16
6 ; (unsigned char *dest,int len);
8 global blur_bitmap_16
9 global test_ctv
10 times ($$-$) & 3 db 0
11 blur_bitmap_16:
12 push edi ; point to screen
13 push edx ; temporary for unwrapping
14 push ecx ; count
15 push ebx ; last pixel
17 ; ax = current pixel
19 xor ebx,ebx ; Last pixel
21 mov edi,[esp+20] ; edi is a pointer to the bitmap
22 mov ecx,[esp+24] ; ecx is the amount of pixels to blur
24 blur16_loop:
25 mov ax,word[edi]
27 mov dx,ax
28 and ax,0x07e0
29 and dx,0xf81f
30 rol eax,16
31 mov ax,dx
32 ; Now we have unwrapped the green middle out of eax
33 mov edx,eax ; ebx=this pixel (unwrapped) before we changed it
34 add eax,ebx ; add last pixel to this one
35 mov ebx,edx ; ebx=this pixel for next time
37 sar eax,1
39 ; wrap up again
40 mov edx,eax
41 ror edx,16
42 and dx,0x07e0
43 and ax,0xf81f
44 or ax,dx
45 ;finished pixel in ax
47 ;mov word[edi],ax
48 ;add edi,2
49 stosw
50 loop blur16_loop
52 pop ebx
53 pop ecx
54 pop edx
55 pop edi
56 xor eax,eax
57 ret
60 ; --------------------------------------
62 bits 32
63 section .text
64 ;extern "C" int blur_bitmap_15
65 ; (unsigned char *dest,int len);
67 global blur_bitmap_15
68 times ($$-$) & 3 db 0
69 blur_bitmap_15:
70 push edi ; point to screen
71 push edx ; temporary for unwrapping
72 push ecx ; count
73 push ebx ; last pixel
75 ; ax = current pixel
77 xor ebx,ebx ; Last pixel
79 mov edi,[esp+20] ; edi is a pointer to the bitmap
80 mov ecx,[esp+24] ; ecx is the amount of pixels to blur
82 blur15_loop:
83 mov ax,word[edi]
85 mov dx,ax
86 and ax,0x03e0
87 and dx,0x7c1f
88 rol eax,16
89 mov ax,dx
90 ; Now we have unwrapped the green middle out of eax
91 mov edx,eax ; ebx=this pixel (unwrapped) before we changed it
92 add eax,ebx ; add last pixel to this one
93 mov ebx,edx ; ebx=this pixel for next time
95 sar eax,1
97 ; wrap up again
98 mov edx,eax
99 ror edx,16
100 and dx,0x03e0
101 and ax,0x7c1f
102 or ax,dx
103 ;finished pixel in ax
105 ;mov word[edi],ax
106 ;add edi,2
107 stosw
108 loop blur15_loop
110 pop ebx
111 pop ecx
112 pop edx
113 pop edi
114 xor eax,eax
117 ; ----------------------------
119 bits 32
120 section .text
121 ;extern "C" int test_ctv
122 ; (unsigned char *dest,int len);
124 global _test_ctv
125 times ($$-$) & 3 db 0
126 test_ctv:
127 push edi ; point to screen
128 push edx ; temporary for unwrapping
129 push ecx ; count
130 push ebx ; last pixel
132 ; ax = current pixel
134 xor ebx,ebx ; Last pixel
136 mov edi,[esp+20] ; edi is a pointer to the bitmap
137 mov ecx,[esp+24] ; ecx is the amount of pixels to blur
139 test_loop:
140 mov ax,word[edi]
142 mov dx,ax
143 rol eax,16
144 mov ax,dx
145 mov edx,eax ; ebx=this pixel (unwrapped) before we changed it
146 mov ebx,edx ; ebx=this pixel for next time
148 sar eax,1
150 mov edx,eax
151 ror edx,16
152 ;finished pixel in ax
154 ;mov word[edi],ax
155 ;add edi,2
156 stosw
157 loop test_loop
159 pop ebx
160 pop ecx
161 pop edx
162 pop edi
163 xor eax,eax
166 %ifdef NASM_STACK_NOEXEC
167 section .note.GNU-stack noalloc noexec nowrite progbits
168 %endif