libsidplayfp  2.0.2
opcodes.h
1 /*
2  * This file is part of libsidplayfp, a SID player engine.
3  *
4  * Copyright 2011-2013 Leandro Nini <drfiemost@users.sourceforge.net>
5  * Copyright 2007-2010 Antti Lankila
6  * Copyright 2000 Simon White
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21  */
22 
23 #ifndef OPCODES_H
24 #define OPCODES_H
25 
26 #define OPCODE_MAX 0x100
27 
28 /* HLT
29  case 0x02: case 0x12: case 0x22: case 0x32: case 0x42: case 0x52:
30  case 0x62: case 0x72: case 0x92: case 0xb2: case 0xd2: case 0xf2:
31 */
32 
33 #define BRKn 0x00
34 #define JSRw 0x20
35 #define RTIn 0x40
36 #define RTSn 0x60
37 #define NOPb 0x80
38 #define NOPb_ NOPb: case 0x82: case 0xC2: case 0xE2: case 0x89
39 #define LDYb 0xA0
40 #define CPYb 0xC0
41 #define CPXb 0xE0
42 
43 #define ORAix 0x01
44 #define ANDix 0x21
45 #define EORix 0x41
46 #define ADCix 0x61
47 #define STAix 0x81
48 #define LDAix 0xA1
49 #define CMPix 0xC1
50 #define SBCix 0xE1
51 
52 #define LDXb 0xA2
53 
54 #define SLOix 0x03
55 #define RLAix 0x23
56 #define SREix 0x43
57 #define RRAix 0x63
58 #define SAXix 0x83
59 #define LAXix 0xA3
60 #define DCPix 0xC3
61 #define ISBix 0xE3
62 
63 #define NOPz 0x04
64 #define NOPz_ NOPz: case 0x44: case 0x64
65 #define BITz 0x24
66 #define STYz 0x84
67 #define LDYz 0xA4
68 #define CPYz 0xC4
69 #define CPXz 0xE4
70 
71 #define ORAz 0x05
72 #define ANDz 0x25
73 #define EORz 0x45
74 #define ADCz 0x65
75 #define STAz 0x85
76 #define LDAz 0xA5
77 #define CMPz 0xC5
78 #define SBCz 0xE5
79 
80 #define ASLz 0x06
81 #define ROLz 0x26
82 #define LSRz 0x46
83 #define RORz 0x66
84 #define STXz 0x86
85 #define LDXz 0xA6
86 #define DECz 0xC6
87 #define INCz 0xE6
88 
89 #define SLOz 0x07
90 #define RLAz 0x27
91 #define SREz 0x47
92 #define RRAz 0x67
93 #define SAXz 0x87
94 #define LAXz 0xA7
95 #define DCPz 0xC7
96 #define ISBz 0xE7
97 
98 #define PHPn 0x08
99 #define PLPn 0x28
100 #define PHAn 0x48
101 #define PLAn 0x68
102 #define DEYn 0x88
103 #define TAYn 0xA8
104 #define INYn 0xC8
105 #define INXn 0xE8
106 
107 #define ORAb 0x09
108 #define ANDb 0x29
109 #define EORb 0x49
110 #define ADCb 0x69
111 #define LDAb 0xA9
112 #define CMPb 0xC9
113 #define SBCb 0xE9
114 #define SBCb_ SBCb: case 0xEB
115 
116 #define ASLn 0x0A
117 #define ROLn 0x2A
118 #define LSRn 0x4A
119 #define RORn 0x6A
120 #define TXAn 0x8A
121 #define TAXn 0xAA
122 #define DEXn 0xCA
123 #define NOPn 0xEA
124 #define NOPn_ NOPn: case 0x1A: case 0x3A: case 0x5A: case 0x7A: case 0xDA: case 0xFA
125 
126 #define ANCb 0x0B
127 #define ANCb_ ANCb: case 0x2B
128 #define ASRb 0x4B
129 #define ARRb 0x6B
130 #define ANEb 0x8B
131 #define XAAb 0x8B
132 #define LXAb 0xAB
133 #define SBXb 0xCB
134 
135 #define NOPa 0x0C
136 #define BITa 0x2C
137 #define JMPw 0x4C
138 #define JMPi 0x6C
139 #define STYa 0x8C
140 #define LDYa 0xAC
141 #define CPYa 0xCC
142 #define CPXa 0xEC
143 
144 #define ORAa 0x0D
145 #define ANDa 0x2D
146 #define EORa 0x4D
147 #define ADCa 0x6D
148 #define STAa 0x8D
149 #define LDAa 0xAD
150 #define CMPa 0xCD
151 #define SBCa 0xED
152 
153 #define ASLa 0x0E
154 #define ROLa 0x2E
155 #define LSRa 0x4E
156 #define RORa 0x6E
157 #define STXa 0x8E
158 #define LDXa 0xAE
159 #define DECa 0xCE
160 #define INCa 0xEE
161 
162 #define SLOa 0x0F
163 #define RLAa 0x2F
164 #define SREa 0x4F
165 #define RRAa 0x6F
166 #define SAXa 0x8F
167 #define LAXa 0xAF
168 #define DCPa 0xCF
169 #define ISBa 0xEF
170 
171 #define BPLr 0x10
172 #define BMIr 0x30
173 #define BVCr 0x50
174 #define BVSr 0x70
175 #define BCCr 0x90
176 #define BCSr 0xB0
177 #define BNEr 0xD0
178 #define BEQr 0xF0
179 
180 #define ORAiy 0x11
181 #define ANDiy 0x31
182 #define EORiy 0x51
183 #define ADCiy 0x71
184 #define STAiy 0x91
185 #define LDAiy 0xB1
186 #define CMPiy 0xD1
187 #define SBCiy 0xF1
188 
189 #define SLOiy 0x13
190 #define RLAiy 0x33
191 #define SREiy 0x53
192 #define RRAiy 0x73
193 #define SHAiy 0x93
194 #define LAXiy 0xB3
195 #define DCPiy 0xD3
196 #define ISBiy 0xF3
197 
198 #define NOPzx 0x14
199 #define NOPzx_ NOPzx: case 0x34: case 0x54: case 0x74: case 0xD4: case 0xF4
200 #define STYzx 0x94
201 #define LDYzx 0xB4
202 
203 #define ORAzx 0x15
204 #define ANDzx 0x35
205 #define EORzx 0x55
206 #define ADCzx 0x75
207 #define STAzx 0x95
208 #define LDAzx 0xB5
209 #define CMPzx 0xD5
210 #define SBCzx 0xF5
211 
212 #define ASLzx 0x16
213 #define ROLzx 0x36
214 #define LSRzx 0x56
215 #define RORzx 0x76
216 #define STXzy 0x96
217 #define LDXzy 0xB6
218 #define DECzx 0xD6
219 #define INCzx 0xF6
220 
221 #define SLOzx 0x17
222 #define RLAzx 0x37
223 #define SREzx 0x57
224 #define RRAzx 0x77
225 #define SAXzy 0x97
226 #define LAXzy 0xB7
227 #define DCPzx 0xD7
228 #define ISBzx 0xF7
229 
230 #define CLCn 0x18
231 #define SECn 0x38
232 #define CLIn 0x58
233 #define SEIn 0x78
234 #define TYAn 0x98
235 #define CLVn 0xB8
236 #define CLDn 0xD8
237 #define SEDn 0xF8
238 
239 #define ORAay 0x19
240 #define ANDay 0x39
241 #define EORay 0x59
242 #define ADCay 0x79
243 #define STAay 0x99
244 #define LDAay 0xB9
245 #define CMPay 0xD9
246 #define SBCay 0xF9
247 
248 #define TXSn 0x9A
249 #define TSXn 0xBA
250 
251 #define SLOay 0x1B
252 #define RLAay 0x3B
253 #define SREay 0x5B
254 #define RRAay 0x7B
255 #define SHSay 0x9B
256 #define TASay 0x9B
257 #define LASay 0xBB
258 #define DCPay 0xDB
259 #define ISBay 0xFB
260 
261 #define NOPax 0x1C
262 #define NOPax_ NOPax: case 0x3C: case 0x5C: case 0x7C: case 0xDC: case 0xFC
263 #define SHYax 0x9C
264 #define LDYax 0xBC
265 
266 #define ORAax 0x1D
267 #define ANDax 0x3D
268 #define EORax 0x5D
269 #define ADCax 0x7D
270 #define STAax 0x9D
271 #define LDAax 0xBD
272 #define CMPax 0xDD
273 #define SBCax 0xFD
274 
275 #define ASLax 0x1E
276 #define ROLax 0x3E
277 #define LSRax 0x5E
278 #define RORax 0x7E
279 #define SHXay 0x9E
280 #define LDXay 0xBE
281 #define DECax 0xDE
282 #define INCax 0xFE
283 
284 #define SLOax 0x1F
285 #define RLAax 0x3F
286 #define SREax 0x5F
287 #define RRAax 0x7F
288 #define SHAay 0x9F
289 #define LAXay 0xBF
290 #define DCPax 0xDF
291 #define ISBax 0xFF
292 
293 // Instruction Aliases
294 #define ASOix SLOix
295 #define LSEix SREix
296 #define AXSix SAXix
297 #define DCMix DCPix
298 #define INSix ISBix
299 #define ASOz SLOz
300 #define LSEz SREz
301 #define AXSz SAXz
302 #define DCMz DCPz
303 #define INSz ISBz
304 #define ALRb ASRb
305 #define OALb LXAb
306 #define ASOa SLOa
307 #define LSEa SREa
308 #define AXSa SAXa
309 #define DCMa DCPa
310 #define INSa ISBa
311 #define ASOiy SLOiy
312 #define LSEiy SREiy
313 #define AXAiy SHAiy
314 #define DCMiy DCPiy
315 #define INSiy ISBiy
316 #define ASOzx SLOzx
317 #define LSEzx SREzx
318 #define AXSzy SAXzy
319 #define DCMzx DCPzx
320 #define INSzx ISBzx
321 #define ASOay SLOay
322 #define LSEay SREay
323 #define DCMay DCPay
324 #define INSay ISBay
325 #define SAYax SHYax
326 #define XASay SHXay
327 #define ASOax SLOax
328 #define LSEax SREax
329 #define AXAay SHAay
330 #define DCMax DCPax
331 #define INSax ISBax
332 #define SKBn NOPb
333 #define SKWn NOPa
334 
335 #endif // OPCODES_H