/
extendedopcodes.h
258 lines (257 loc) · 11.7 KB
/
extendedopcodes.h
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
#include "gb.h"
EXT_INST(0x0, "RLC B", { rlc8(gb.b); })
EXT_INST(0x1, "RLC C", { rlc8(gb.c); })
EXT_INST(0x2, "RLC D", { rlc8(gb.d); })
EXT_INST(0x3, "RLC E", { rlc8(gb.e); })
EXT_INST(0x4, "RLC H", { rlc8(gb.h); })
EXT_INST(0x5, "RLC L", { rlc8(gb.l); })
EXT_INST(0x6, "RLC (HL)", { u8 val = readMemory(gb.hl); rlc8(val); writeMemory(gb.hl, val); })
EXT_INST(0x7, "RLC A", { rlc8(gb.a); })
EXT_INST(0x8, "RRC B", { rrc8(gb.b); })
EXT_INST(0x9, "RRC C", { rrc8(gb.c); })
EXT_INST(0xA, "RRC D", { rrc8(gb.d); })
EXT_INST(0xB, "RRC E", { rrc8(gb.e); })
EXT_INST(0xC, "RRC H", { rrc8(gb.h); })
EXT_INST(0xD, "RRC L", { rrc8(gb.l); })
EXT_INST(0xE, "RRC (HL)", { u8 val = readMemory(gb.hl); rrc8(val); writeMemory(gb.hl, val); })
EXT_INST(0xF, "RRC A", { rrc8(gb.a); })
EXT_INST(0x10, "RL B", { rl8(gb.b); })
EXT_INST(0x11, "RL C", { rl8(gb.c); })
EXT_INST(0x12, "RL D", { rl8(gb.d); })
EXT_INST(0x13, "RL E", { rl8(gb.e); })
EXT_INST(0x14, "RL H", { rl8(gb.h); })
EXT_INST(0x15, "RL L", { rl8(gb.l); })
EXT_INST(0x16, "RL (HL)", { u8 val = readMemory(gb.hl); rl8(val); writeMemory(gb.hl, val); })
EXT_INST(0x17, "RL A", { rl8(gb.a); })
EXT_INST(0x18, "RR B", { rr8(gb.b); })
EXT_INST(0x19, "RR C", { rr8(gb.c); })
EXT_INST(0x1A, "RR D", { rr8(gb.d); })
EXT_INST(0x1B, "RR E", { rr8(gb.e); })
EXT_INST(0x1C, "RR H", { rr8(gb.h); })
EXT_INST(0x1D, "RR L", { rr8(gb.l); })
EXT_INST(0x1E, "RR (HL)", { u8 val = readMemory(gb.hl); rr8(val); writeMemory(gb.hl, val); })
EXT_INST(0x1F, "RR A", { rr8(gb.a); })
EXT_INST(0x20, "SLA B", { sla8(gb.b); })
EXT_INST(0x21, "SLA C", { sla8(gb.c); })
EXT_INST(0x22, "SLA D", { sla8(gb.d); })
EXT_INST(0x23, "SLA E", { sla8(gb.e); })
EXT_INST(0x24, "SLA H", { sla8(gb.h); })
EXT_INST(0x25, "SLA L", { sla8(gb.l); })
EXT_INST(0x26, "SLA (HL)", { u8 val = readMemory(gb.hl); sla8(val); writeMemory(gb.hl, val); })
EXT_INST(0x27, "SLA A", { sla8(gb.a); })
EXT_INST(0x28, "SRA B", { sra8(gb.b); })
EXT_INST(0x29, "SRA C", { sra8(gb.c); })
EXT_INST(0x2A, "SRA D", { sra8(gb.d); })
EXT_INST(0x2B, "SRA E", { sra8(gb.e); })
EXT_INST(0x2C, "SRA H", { sra8(gb.h); })
EXT_INST(0x2D, "SRA L", { sra8(gb.l); })
EXT_INST(0x2E, "SRA (HL)", { u8 val = readMemory(gb.hl); sra8(val); writeMemory(gb.hl, val); })
EXT_INST(0x2F, "SRA A", { sra8(gb.a); })
EXT_INST(0x30, "SWAP B", { swap8(gb.b); })
EXT_INST(0x31, "SWAP C", { swap8(gb.c); })
EXT_INST(0x32, "SWAP D", { swap8(gb.d); })
EXT_INST(0x33, "SWAP E", { swap8(gb.e); })
EXT_INST(0x34, "SWAP H", { swap8(gb.h); })
EXT_INST(0x35, "SWAP L", { swap8(gb.l); })
EXT_INST(0x36, "SWAP (HL)", { u8 val = readMemory(gb.hl); swap8(val); writeMemory(gb.hl, val); })
EXT_INST(0x37, "SWAP A", { swap8(gb.a); })
EXT_INST(0x38, "SRL B", { srl8(gb.b); })
EXT_INST(0x39, "SRL C", { srl8(gb.c); })
EXT_INST(0x3A, "SRL D", { srl8(gb.d); })
EXT_INST(0x3B, "SRL E", { srl8(gb.e); })
EXT_INST(0x3C, "SRL H", { srl8(gb.h); })
EXT_INST(0x3D, "SRL L", { srl8(gb.l); })
EXT_INST(0x3E, "SRL (HL)", { u8 val = readMemory(gb.hl); srl8(val); writeMemory(gb.hl, val); })
EXT_INST(0x3F, "SRL A", { srl8(gb.a); })
EXT_INST(0x40, "BIT 0,B", { bit8(0, gb.b); })
EXT_INST(0x41, "BIT 0,C", { bit8(0, gb.c); })
EXT_INST(0x42, "BIT 0,D", { bit8(0, gb.d); })
EXT_INST(0x43, "BIT 0,E", { bit8(0, gb.e); })
EXT_INST(0x44, "BIT 0,H", { bit8(0, gb.h); })
EXT_INST(0x45, "BIT 0,L", { bit8(0, gb.l); })
EXT_INST(0x46, "BIT 0,(HL)", { bit8(0, readMemory(gb.hl)); })
EXT_INST(0x47, "BIT 0,A", { bit8(0, gb.a); })
EXT_INST(0x48, "BIT 1,B", { bit8(1, gb.b); })
EXT_INST(0x49, "BIT 1,C", { bit8(1, gb.c); })
EXT_INST(0x4A, "BIT 1,D", { bit8(1, gb.d); })
EXT_INST(0x4B, "BIT 1,E", { bit8(1, gb.e); })
EXT_INST(0x4C, "BIT 1,H", { bit8(1, gb.h); })
EXT_INST(0x4D, "BIT 1,L", { bit8(1, gb.l); })
EXT_INST(0x4E, "BIT 1,(HL)", { bit8(1, readMemory(gb.hl)); })
EXT_INST(0x4F, "BIT 1,A", { bit8(1, gb.a); })
EXT_INST(0x50, "BIT 2,B", { bit8(2, gb.b); })
EXT_INST(0x51, "BIT 2,C", { bit8(2, gb.c); })
EXT_INST(0x52, "BIT 2,D", { bit8(2, gb.d); })
EXT_INST(0x53, "BIT 2,E", { bit8(2, gb.e); })
EXT_INST(0x54, "BIT 2,H", { bit8(2, gb.h); })
EXT_INST(0x55, "BIT 2,L", { bit8(2, gb.l); })
EXT_INST(0x56, "BIT 2,(HL)", { bit8(2, readMemory(gb.hl)); })
EXT_INST(0x57, "BIT 2,A", { bit8(2, gb.a); })
EXT_INST(0x58, "BIT 3,B", { bit8(3, gb.b); })
EXT_INST(0x59, "BIT 3,C", { bit8(3, gb.c); })
EXT_INST(0x5A, "BIT 3,D", { bit8(3, gb.d); })
EXT_INST(0x5B, "BIT 3,E", { bit8(3, gb.e); })
EXT_INST(0x5C, "BIT 3,H", { bit8(3, gb.h); })
EXT_INST(0x5D, "BIT 3,L", { bit8(3, gb.l); })
EXT_INST(0x5E, "BIT 3,(HL)", { bit8(3, readMemory(gb.hl)); })
EXT_INST(0x5F, "BIT 3,A", { bit8(3, gb.a); })
EXT_INST(0x60, "BIT 4,B", { bit8(4, gb.b); })
EXT_INST(0x61, "BIT 4,C", { bit8(4, gb.c); })
EXT_INST(0x62, "BIT 4,D", { bit8(4, gb.d); })
EXT_INST(0x63, "BIT 4,E", { bit8(4, gb.e); })
EXT_INST(0x64, "BIT 4,H", { bit8(4, gb.h); })
EXT_INST(0x65, "BIT 4,L", { bit8(4, gb.l); })
EXT_INST(0x66, "BIT 4,(HL)", { bit8(4, readMemory(gb.hl)); })
EXT_INST(0x67, "BIT 4,A", { bit8(4, gb.a); })
EXT_INST(0x68, "BIT 5,B", { bit8(5, gb.b); })
EXT_INST(0x69, "BIT 5,C", { bit8(5, gb.c); })
EXT_INST(0x6A, "BIT 5,D", { bit8(5, gb.d); })
EXT_INST(0x6B, "BIT 5,E", { bit8(5, gb.e); })
EXT_INST(0x6C, "BIT 5,H", { bit8(5, gb.h); })
EXT_INST(0x6D, "BIT 5,L", { bit8(5, gb.l); })
EXT_INST(0x6E, "BIT 5,(HL)", { bit8(5, readMemory(gb.hl)); })
EXT_INST(0x6F, "BIT 5,A", { bit8(5, gb.a); })
EXT_INST(0x70, "BIT 6,B", { bit8(6, gb.b); })
EXT_INST(0x71, "BIT 6,C", { bit8(6, gb.c); })
EXT_INST(0x72, "BIT 6,D", { bit8(6, gb.d); })
EXT_INST(0x73, "BIT 6,E", { bit8(6, gb.e); })
EXT_INST(0x74, "BIT 6,H", { bit8(6, gb.h); })
EXT_INST(0x75, "BIT 6,L", { bit8(6, gb.l); })
EXT_INST(0x76, "BIT 6,(HL)", { bit8(6, readMemory(gb.hl)); })
EXT_INST(0x77, "BIT 6,A", { bit8(6, gb.a); })
EXT_INST(0x78, "BIT 7,B", { bit8(7, gb.b); })
EXT_INST(0x79, "BIT 7,C", { bit8(7, gb.c); })
EXT_INST(0x7A, "BIT 7,D", { bit8(7, gb.d); })
EXT_INST(0x7B, "BIT 7,E", { bit8(7, gb.e); })
EXT_INST(0x7C, "BIT 7,H", { bit8(7, gb.h); })
EXT_INST(0x7D, "BIT 7,L", { bit8(7, gb.l); })
EXT_INST(0x7E, "BIT 7,(HL)", { bit8(7, readMemory(gb.hl)); })
EXT_INST(0x7F, "BIT 7,A", { bit8(7, gb.a); })
EXT_INST(0x80, "RES 0,B", { res8(0, gb.b); })
EXT_INST(0x81, "RES 0,C", { res8(0, gb.c); })
EXT_INST(0x82, "RES 0,D", { res8(0, gb.d); })
EXT_INST(0x83, "RES 0,E", { res8(0, gb.e); })
EXT_INST(0x84, "RES 0,H", { res8(0, gb.h); })
EXT_INST(0x85, "RES 0,L", { res8(0, gb.l); })
EXT_INST(0x86, "RES 0,(HL)", { res8hl(0); })
EXT_INST(0x87, "RES 0,A", { res8(0, gb.a); })
EXT_INST(0x88, "RES 1,B", { res8(1, gb.b); })
EXT_INST(0x89, "RES 1,C", { res8(1, gb.c); })
EXT_INST(0x8A, "RES 1,D", { res8(1, gb.d); })
EXT_INST(0x8B, "RES 1,E", { res8(1, gb.e); })
EXT_INST(0x8C, "RES 1,H", { res8(1, gb.h); })
EXT_INST(0x8D, "RES 1,L", { res8(1, gb.l); })
EXT_INST(0x8E, "RES 1,(HL)", { res8hl(1); })
EXT_INST(0x8F, "RES 1,A", { res8(1, gb.a); })
EXT_INST(0x90, "RES 2,B", { res8(2, gb.b); })
EXT_INST(0x91, "RES 2,C", { res8(2, gb.c); })
EXT_INST(0x92, "RES 2,D", { res8(2, gb.d); })
EXT_INST(0x93, "RES 2,E", { res8(2, gb.e); })
EXT_INST(0x94, "RES 2,H", { res8(2, gb.h); })
EXT_INST(0x95, "RES 2,L", { res8(2, gb.l); })
EXT_INST(0x96, "RES 2,(HL)", { res8hl(2); })
EXT_INST(0x97, "RES 2,A", { res8(2, gb.a); })
EXT_INST(0x98, "RES 3,B", { res8(3, gb.b); })
EXT_INST(0x99, "RES 3,C", { res8(3, gb.c); })
EXT_INST(0x9A, "RES 3,D", { res8(3, gb.d); })
EXT_INST(0x9B, "RES 3,E", { res8(3, gb.e); })
EXT_INST(0x9C, "RES 3,H", { res8(3, gb.h); })
EXT_INST(0x9D, "RES 3,L", { res8(3, gb.l); })
EXT_INST(0x9E, "RES 3,(HL)", { res8hl(3); })
EXT_INST(0x9F, "RES 3,A", { res8(3, gb.a); })
EXT_INST(0xA0, "RES 4,B", { res8(4, gb.b); })
EXT_INST(0xA1, "RES 4,C", { res8(4, gb.c); })
EXT_INST(0xA2, "RES 4,D", { res8(4, gb.d); })
EXT_INST(0xA3, "RES 4,E", { res8(4, gb.e); })
EXT_INST(0xA4, "RES 4,H", { res8(4, gb.h); })
EXT_INST(0xA5, "RES 4,L", { res8(4, gb.l); })
EXT_INST(0xA6, "RES 4,(HL)", { res8hl(4); })
EXT_INST(0xA7, "RES 4,A", { res8(4, gb.a); })
EXT_INST(0xA8, "RES 5,B", { res8(5, gb.b); })
EXT_INST(0xA9, "RES 5,C", { res8(5, gb.c); })
EXT_INST(0xAA, "RES 5,D", { res8(5, gb.d); })
EXT_INST(0xAB, "RES 5,E", { res8(5, gb.e); })
EXT_INST(0xAC, "RES 5,H", { res8(5, gb.h); })
EXT_INST(0xAD, "RES 5,L", { res8(5, gb.l); })
EXT_INST(0xAE, "RES 5,(HL)", { res8hl(5); })
EXT_INST(0xAF, "RES 5,A", { res8(5, gb.a); })
EXT_INST(0xB0, "RES 6,B", { res8(6, gb.b); })
EXT_INST(0xB1, "RES 6,C", { res8(6, gb.c); })
EXT_INST(0xB2, "RES 6,D", { res8(6, gb.d); })
EXT_INST(0xB3, "RES 6,E", { res8(6, gb.e); })
EXT_INST(0xB4, "RES 6,H", { res8(6, gb.h); })
EXT_INST(0xB5, "RES 6,L", { res8(6, gb.l); })
EXT_INST(0xB6, "RES 6,(HL)", { res8hl(6); })
EXT_INST(0xB7, "RES 6,A", { res8(6, gb.a); })
EXT_INST(0xB8, "RES 7,B", { res8(7, gb.b); })
EXT_INST(0xB9, "RES 7,C", { res8(7, gb.c); })
EXT_INST(0xBA, "RES 7,D", { res8(7, gb.d); })
EXT_INST(0xBB, "RES 7,E", { res8(7, gb.e); })
EXT_INST(0xBC, "RES 7,H", { res8(7, gb.h); })
EXT_INST(0xBD, "RES 7,L", { res8(7, gb.l); })
EXT_INST(0xBE, "RES 7,(HL)", { res8hl(7); })
EXT_INST(0xBF, "RES 7,A", { res8(7, gb.a); })
EXT_INST(0xC0, "SET 0,B", { set8(0, gb.b); })
EXT_INST(0xC1, "SET 0,C", { set8(0, gb.c); })
EXT_INST(0xC2, "SET 0,D", { set8(0, gb.d); })
EXT_INST(0xC3, "SET 0,E", { set8(0, gb.e); })
EXT_INST(0xC4, "SET 0,H", { set8(0, gb.h); })
EXT_INST(0xC5, "SET 0,L", { set8(0, gb.l); })
EXT_INST(0xC6, "SET 0,(HL)", { set8hl(0); })
EXT_INST(0xC7, "SET 0,A", { set8(0, gb.a); })
EXT_INST(0xC8, "SET 1,B", { set8(1, gb.b); })
EXT_INST(0xC9, "SET 1,C", { set8(1, gb.c); })
EXT_INST(0xCA, "SET 1,D", { set8(1, gb.d); })
EXT_INST(0xCB, "SET 1,E", { set8(1, gb.e); })
EXT_INST(0xCC, "SET 1,H", { set8(1, gb.h); })
EXT_INST(0xCD, "SET 1,L", { set8(1, gb.l); })
EXT_INST(0xCE, "SET 1,(HL)", { set8hl(1); })
EXT_INST(0xCF, "SET 1,A", { set8(1, gb.a); })
EXT_INST(0xD0, "SET 2,B", { set8(2, gb.b); })
EXT_INST(0xD1, "SET 2,C", { set8(2, gb.c); })
EXT_INST(0xD2, "SET 2,D", { set8(2, gb.d); })
EXT_INST(0xD3, "SET 2,E", { set8(2, gb.e); })
EXT_INST(0xD4, "SET 2,H", { set8(2, gb.h); })
EXT_INST(0xD5, "SET 2,L", { set8(2, gb.l); })
EXT_INST(0xD6, "SET 2,(HL)", { set8hl(2); })
EXT_INST(0xD7, "SET 2,A", { set8(2, gb.a); })
EXT_INST(0xD8, "SET 3,B", { set8(3, gb.b); })
EXT_INST(0xD9, "SET 3,C", { set8(3, gb.c); })
EXT_INST(0xDA, "SET 3,D", { set8(3, gb.d); })
EXT_INST(0xDB, "SET 3,E", { set8(3, gb.e); })
EXT_INST(0xDC, "SET 3,H", { set8(3, gb.h); })
EXT_INST(0xDD, "SET 3,L", { set8(3, gb.l); })
EXT_INST(0xDE, "SET 3,(HL)", { set8hl(3); })
EXT_INST(0xDF, "SET 3,A", { set8(3, gb.a); })
EXT_INST(0xE0, "SET 4,B", { set8(4, gb.b); })
EXT_INST(0xE1, "SET 4,C", { set8(4, gb.c); })
EXT_INST(0xE2, "SET 4,D", { set8(4, gb.d); })
EXT_INST(0xE3, "SET 4,E", { set8(4, gb.e); })
EXT_INST(0xE4, "SET 4,H", { set8(4, gb.h); })
EXT_INST(0xE5, "SET 4,L", { set8(4, gb.l); })
EXT_INST(0xE6, "SET 4,(HL)", { set8hl(4); })
EXT_INST(0xE7, "SET 4,A", { set8(4, gb.a); })
EXT_INST(0xE8, "SET 5,B", { set8(5, gb.b); })
EXT_INST(0xE9, "SET 5,C", { set8(5, gb.c); })
EXT_INST(0xEA, "SET 5,D", { set8(5, gb.d); })
EXT_INST(0xEB, "SET 5,E", { set8(5, gb.e); })
EXT_INST(0xEC, "SET 5,H", { set8(5, gb.h); })
EXT_INST(0xED, "SET 5,L", { set8(5, gb.l); })
EXT_INST(0xEE, "SET 5,(HL)", { set8hl(5); })
EXT_INST(0xEF, "SET 5,A", { set8(5, gb.a); })
EXT_INST(0xF0, "SET 6,B", { set8(6, gb.b); })
EXT_INST(0xF1, "SET 6,C", { set8(6, gb.c); })
EXT_INST(0xF2, "SET 6,D", { set8(6, gb.d); })
EXT_INST(0xF3, "SET 6,E", { set8(6, gb.e); })
EXT_INST(0xF4, "SET 6,H", { set8(6, gb.h); })
EXT_INST(0xF5, "SET 6,L", { set8(6, gb.l); })
EXT_INST(0xF6, "SET 6,(HL)", { set8hl(6); })
EXT_INST(0xF7, "SET 6,A", { set8(6, gb.a); })
EXT_INST(0xF8, "SET 7,B", { set8(7, gb.b); })
EXT_INST(0xF9, "SET 7,C", { set8(7, gb.c); })
EXT_INST(0xFA, "SET 7,D", { set8(7, gb.d); })
EXT_INST(0xFB, "SET 7,E", { set8(7, gb.e); })
EXT_INST(0xFC, "SET 7,H", { set8(7, gb.h); })
EXT_INST(0xFD, "SET 7,L", { set8(7, gb.l); })
EXT_INST(0xFE, "SET 7,(HL)", { set8hl(7); })
EXT_INST(0xFF, "SET 7,A", { set8(7, gb.a); })