-
Notifications
You must be signed in to change notification settings - Fork 0
/
refresh.c
executable file
·176 lines (156 loc) · 2.65 KB
/
refresh.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
#include "gnuboy.h"
#include "defs.h"
#include "lcd.h"
#define BUF (scan.buf)
#ifdef USE_ASM
#include "asm.h"
#endif
#ifndef ASM_REFRESH_1
void refresh_1(byte *dest, byte *src, byte *pal, int cnt)
{
while(cnt--) *(dest++) = pal[*(src++)];
}
#endif
#ifndef ASM_REFRESH_2
void refresh_2(un16 *dest, byte *src, un16 *pal, int cnt)
{
while (cnt--) *(dest++) = pal[*(src++)];
}
#endif
#ifndef ASM_REFRESH_3
void refresh_3(byte *dest, byte *src, un32 *pal, int cnt)
{
un32 c;
while (cnt--)
{
c = pal[*(src++)];
*(dest++) = c;
*(dest++) = c>>8;
*(dest++) = c>>16;
}
}
#endif
#ifndef ASM_REFRESH_4
void refresh_4(un32 *dest, byte *src, un32 *pal, int cnt)
{
while (cnt--) *(dest++) = pal[*(src++)];
}
#endif
#ifndef ASM_REFRESH_1_2X
void refresh_1_2x(byte *dest, byte *src, byte *pal, int cnt)
{
byte c;
while (cnt--)
{
c = pal[*(src++)];
*(dest++) = c;
*(dest++) = c;
}
}
#endif
#ifndef ASM_REFRESH_2_2X
void refresh_2_2x(un16 *dest, byte *src, un16 *pal, int cnt)
{
un16 c;
while (cnt--)
{
c = pal[*(src++)];
*(dest++) = c;
*(dest++) = c;
}
}
#endif
#ifndef ASM_REFRESH_3_2X
void refresh_3_2x(byte *dest, byte *src, un32 *pal, int cnt)
{
un32 c;
while (cnt--)
{
c = pal[*(src++)];
dest[0] = dest[3] = c;
dest[1] = dest[4] = c>>8;
dest[2] = dest[5] = c>>16;
dest += 6;
}
}
#endif
#ifndef ASM_REFRESH_4_2X
void refresh_4_2x(un32 *dest, byte *src, un32 *pal, int cnt)
{
un32 c;
while (cnt--)
{
c = pal[*(src++)];
*(dest++) = c;
*(dest++) = c;
}
}
#endif
#ifndef ASM_REFRESH_2_3X
void refresh_2_3x(un16 *dest, byte *src, un16 *pal, int cnt)
{
un16 c;
while (cnt--)
{
c = pal[*(src++)];
*(dest++) = c;
*(dest++) = c;
*(dest++) = c;
}
}
#endif
#ifndef ASM_REFRESH_3_3X
void refresh_3_3x(byte *dest, byte *src, un32 *pal, int cnt)
{
un32 c;
while (cnt--)
{
c = pal[*(src++)];
dest[0] = dest[3] = dest[6] = c;
dest[1] = dest[4] = dest[7] = c>>8;
dest[2] = dest[5] = dest[8] = c>>16;
dest += 9;
}
}
#endif
#ifndef ASM_REFRESH_4_3X
void refresh_4_3x(un32 *dest, byte *src, un32 *pal, int cnt)
{
un32 c;
while (cnt--)
{
c = pal[*(src++)];
*(dest++) = c;
*(dest++) = c;
*(dest++) = c;
}
}
#endif
#ifndef ASM_REFRESH_3_4X
void refresh_3_4x(byte *dest, byte *src, un32 *pal, int cnt)
{
un32 c;
while (cnt--)
{
c = pal[*(src++)];
dest[0] = dest[3] = dest[6] = dest[9] = c;
dest[1] = dest[4] = dest[7] = dest[10] = c>>8;
dest[2] = dest[5] = dest[8] = dest[11] = c>>16;
dest += 12;
}
}
#endif
#ifndef ASM_REFRESH_4_4X
void refresh_4_4x(un32 *dest, byte *src, un32 *pal, int cnt)
{
un32 c;
while (cnt--)
{
c = pal[*(src++)];
*(dest++) = c;
*(dest++) = c;
*(dest++) = c;
*(dest++) = c;
}
}
#endif