lcd: use GNUC features for memcpy8
[rofl0r-gnuboy.git] / refresh.c
blobef932e77a3364d471dd87ab798c07b28e5aa8634
3 #include "defs.h"
4 #include "lcd.h"
6 #define BUF (scan.buf)
8 #ifdef USE_ASM
9 #include "asm.h"
10 #endif
13 #ifndef ASM_REFRESH_1
14 void refresh_1(byte *dest, byte *src, byte *pal, int cnt)
16 while(cnt--) *(dest++) = pal[*(src++)];
18 #endif
20 #ifndef ASM_REFRESH_2
21 void refresh_2(un16 *dest, byte *src, un16 *pal, int cnt)
23 while (cnt--) *(dest++) = pal[*(src++)];
25 #endif
27 #ifndef ASM_REFRESH_3
28 void refresh_3(byte *dest, byte *src, un32 *pal, int cnt)
30 un32 c;
31 while (cnt--)
33 c = pal[*(src++)];
34 *(dest++) = c;
35 *(dest++) = c>>8;
36 *(dest++) = c>>16;
39 #endif
41 #ifndef ASM_REFRESH_4
42 void refresh_4(un32 *dest, byte *src, un32 *pal, int cnt)
44 while (cnt--) *(dest++) = pal[*(src++)];
46 #endif
51 #ifndef ASM_REFRESH_1_2X
52 void refresh_1_2x(byte *dest, byte *src, byte *pal, int cnt)
54 byte c;
55 while (cnt--)
57 c = pal[*(src++)];
58 *(dest++) = c;
59 *(dest++) = c;
62 #endif
64 #ifndef ASM_REFRESH_2_2X
65 void refresh_2_2x(un16 *dest, byte *src, un16 *pal, int cnt)
67 un16 c;
68 while (cnt--)
70 c = pal[*(src++)];
71 *(dest++) = c;
72 *(dest++) = c;
75 #endif
77 #ifndef ASM_REFRESH_3_2X
78 void refresh_3_2x(byte *dest, byte *src, un32 *pal, int cnt)
80 un32 c;
81 while (cnt--)
83 c = pal[*(src++)];
84 dest[0] = dest[3] = c;
85 dest[1] = dest[4] = c>>8;
86 dest[2] = dest[5] = c>>16;
87 dest += 6;
90 #endif
92 #ifndef ASM_REFRESH_4_2X
93 void refresh_4_2x(un32 *dest, byte *src, un32 *pal, int cnt)
95 un32 c;
96 while (cnt--)
98 c = pal[*(src++)];
99 *(dest++) = c;
100 *(dest++) = c;
103 #endif
105 #ifndef ASM_REFRESH_2_3X
106 void refresh_2_3x(un16 *dest, byte *src, un16 *pal, int cnt)
108 un16 c;
109 while (cnt--)
111 c = pal[*(src++)];
112 *(dest++) = c;
113 *(dest++) = c;
114 *(dest++) = c;
117 #endif
119 #ifndef ASM_REFRESH_3_3X
120 void refresh_3_3x(byte *dest, byte *src, un32 *pal, int cnt)
122 un32 c;
123 while (cnt--)
125 c = pal[*(src++)];
126 dest[0] = dest[3] = dest[6] = c;
127 dest[1] = dest[4] = dest[7] = c>>8;
128 dest[2] = dest[5] = dest[8] = c>>16;
129 dest += 9;
132 #endif
134 #ifndef ASM_REFRESH_4_3X
135 void refresh_4_3x(un32 *dest, byte *src, un32 *pal, int cnt)
137 un32 c;
138 while (cnt--)
140 c = pal[*(src++)];
141 *(dest++) = c;
142 *(dest++) = c;
143 *(dest++) = c;
146 #endif
148 #ifndef ASM_REFRESH_3_4X
149 void refresh_3_4x(byte *dest, byte *src, un32 *pal, int cnt)
151 un32 c;
152 while (cnt--)
154 c = pal[*(src++)];
155 dest[0] = dest[3] = dest[6] = dest[9] = c;
156 dest[1] = dest[4] = dest[7] = dest[10] = c>>8;
157 dest[2] = dest[5] = dest[8] = dest[11] = c>>16;
158 dest += 12;
161 #endif
163 #ifndef ASM_REFRESH_4_4X
164 void refresh_4_4x(un32 *dest, byte *src, un32 *pal, int cnt)
166 un32 c;
167 while (cnt--)
169 c = pal[*(src++)];
170 *(dest++) = c;
171 *(dest++) = c;
172 *(dest++) = c;
173 *(dest++) = c;
176 #endif