snes_utils 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,344 @@
1
+ module SnesUtils
2
+ module Wdc65816
3
+ class Definitions
4
+ HEX_DIGIT = '[0-9a-f]'
5
+ HEX8 = "\\$?(#{HEX_DIGIT}{1,2})"
6
+ HEX16 = "\\$?(#{HEX_DIGIT}{3,4})"
7
+ HEX24 = "\\$?(#{HEX_DIGIT}{5,6})"
8
+
9
+ SINGLE_OPERAND_INSTRUCTIONS = [:imm, :iml, :imm8, :imm16, :sr, :dp, :dpx, :dpy, :idp, :idx, :idy, :idl, :idly, :isy, :abs, :abx, :aby, :abl, :alx, :ind, :iax, :ial, :rel, :rell]
10
+ DOUBLE_OPERAND_INSTRUCTIONS = [:bm]
11
+ REL_INSTRUCTIONS = [:rel, :rell]
12
+ BIT_INSTRUCTIONS = []
13
+
14
+ MODES_REGEXES = {
15
+ acc: /^$/,
16
+ imp: /^$/,
17
+ imm: /^#{HEX8}$/i,
18
+ iml: /^#{HEX16}$/i,
19
+ imm8: /^##{HEX8}$/i,
20
+ imm16: /^##{HEX16}$/i,
21
+ sr: /^#{HEX8},S$/i,
22
+ dp: /^#{HEX8}$/i,
23
+ dpx: /^#{HEX8},X$/i,
24
+ dpy: /^#{HEX8},Y$/i,
25
+ idp: /^\(#{HEX8}\)$/i,
26
+ idx: /^\(#{HEX8},X\)$/i,
27
+ idy: /^\(#{HEX8}\),Y$/i,
28
+ idl: /^\[#{HEX8}\]$/i,
29
+ idly: /^\[#{HEX8}\],Y$/i,
30
+ isy: /^\(#{HEX8},S\),Y$/i,
31
+ abs: /^#{HEX16}$/i,
32
+ abx: /^#{HEX16},X$/i,
33
+ aby: /^#{HEX16},Y$/i,
34
+ abl: /^#{HEX24}$/i,
35
+ alx: /^#{HEX24},X$/i,
36
+ ind: /^\(#{HEX16}\)$/i,
37
+ iax: /^\(#{HEX16},X\)$/i,
38
+ ial: /^\[#{HEX16}\]$/i,
39
+ rel: /^#{HEX16}$/i,
40
+ rell: /^#{HEX16}$/i,
41
+ bm: /^#{HEX8},#{HEX8}$/i
42
+ }
43
+
44
+ MODES_FORMATS = {
45
+ acc: "%s",
46
+ imp: "%s",
47
+ imm: "%s %02X",
48
+ iml: "%s %02X",
49
+ imm8: "%s #%02X",
50
+ imm16: "%s #%04X",
51
+ sr: "%s %02X,S",
52
+ dp: "%s %02X",
53
+ dpx: "%s %02X,X",
54
+ dpy: "%s %02X,Y",
55
+ idp: "%s (%02X)",
56
+ idx: "%s (%02X,X)",
57
+ idy: "%s (%02X),Y",
58
+ idl: "%s [%02X]",
59
+ idly: "%s [%02X],Y",
60
+ isy: "%s (%02X,S),Y",
61
+ abs: "%s %04X",
62
+ abx: "%s %04X,X",
63
+ aby: "%s %04X,Y",
64
+ abl: "%s %06X",
65
+ alx: "%s %06X,X",
66
+ ind: "%s (%04X)",
67
+ iax: "%s (%04X,X)",
68
+ ial: "%s [%04X]",
69
+ rel: "%s %04X {%s}",
70
+ rell: "%s %04X {%s}",
71
+ bm: "%s %02X,%02X"
72
+ }
73
+
74
+ OPCODES_DATA = [{ opcode: 0x61, mnemonic: 'ADC', mode: :idx, length: 2 },
75
+ { opcode: 0x63, mnemonic: 'ADC', mode: :sr, length: 2 },
76
+ { opcode: 0x65, mnemonic: 'ADC', mode: :dp, length: 2 },
77
+ { opcode: 0x67, mnemonic: 'ADC', mode: :idl, length: 2 },
78
+ { opcode: 0x69, mnemonic: 'ADC', mode: :imm8, length: 2, m: 1 },
79
+ { opcode: 0x69, mnemonic: 'ADC', mode: :imm16, length: 3, m: 0 },
80
+ { opcode: 0x6d, mnemonic: 'ADC', mode: :abs, length: 3 },
81
+ { opcode: 0x6f, mnemonic: 'ADC', mode: :abl, length: 4 },
82
+ { opcode: 0x71, mnemonic: 'ADC', mode: :idy, length: 2 },
83
+ { opcode: 0x72, mnemonic: 'ADC', mode: :idp, length: 2 },
84
+ { opcode: 0x73, mnemonic: 'ADC', mode: :isy, length: 2 },
85
+ { opcode: 0x75, mnemonic: 'ADC', mode: :dpx, length: 2 },
86
+ { opcode: 0x77, mnemonic: 'ADC', mode: :idly, length: 2 },
87
+ { opcode: 0x79, mnemonic: 'ADC', mode: :aby, length: 3 },
88
+ { opcode: 0x7d, mnemonic: 'ADC', mode: :abx, length: 3 },
89
+ { opcode: 0x7f, mnemonic: 'ADC', mode: :alx, length: 4 },
90
+ { opcode: 0xe1, mnemonic: 'SBC', mode: :idx, length: 2 },
91
+ { opcode: 0xe3, mnemonic: 'SBC', mode: :sr, length: 2 },
92
+ { opcode: 0xe5, mnemonic: 'SBC', mode: :dp, length: 2 },
93
+ { opcode: 0xe7, mnemonic: 'SBC', mode: :idl, length: 2 },
94
+ { opcode: 0xe9, mnemonic: 'SBC', mode: :imm8, length: 2, m: 1 },
95
+ { opcode: 0xe9, mnemonic: 'SBC', mode: :imm16, length: 3, m: 0 },
96
+ { opcode: 0xed, mnemonic: 'SBC', mode: :abs, length: 3 },
97
+ { opcode: 0xef, mnemonic: 'SBC', mode: :abl, length: 4 },
98
+ { opcode: 0xf1, mnemonic: 'SBC', mode: :idy, length: 2 },
99
+ { opcode: 0xf2, mnemonic: 'SBC', mode: :idp, length: 2 },
100
+ { opcode: 0xf3, mnemonic: 'SBC', mode: :isy, length: 2 },
101
+ { opcode: 0xf5, mnemonic: 'SBC', mode: :dpx, length: 2 },
102
+ { opcode: 0xf7, mnemonic: 'SBC', mode: :idly, length: 2 },
103
+ { opcode: 0xf9, mnemonic: 'SBC', mode: :aby, length: 3 },
104
+ { opcode: 0xfd, mnemonic: 'SBC', mode: :abx, length: 3 },
105
+ { opcode: 0xff, mnemonic: 'SBC', mode: :alx, length: 4 },
106
+ { opcode: 0xc1, mnemonic: 'CMP', mode: :idx, length: 2 },
107
+ { opcode: 0xc3, mnemonic: 'CMP', mode: :sr, length: 2 },
108
+ { opcode: 0xc5, mnemonic: 'CMP', mode: :dp, length: 2 },
109
+ { opcode: 0xc7, mnemonic: 'CMP', mode: :idl, length: 2 },
110
+ { opcode: 0xc9, mnemonic: 'CMP', mode: :imm8, length: 2, m: 1 },
111
+ { opcode: 0xc9, mnemonic: 'CMP', mode: :imm16, length: 3, m: 0 },
112
+ { opcode: 0xcd, mnemonic: 'CMP', mode: :abs, length: 3 },
113
+ { opcode: 0xcf, mnemonic: 'CMP', mode: :abl, length: 4 },
114
+ { opcode: 0xd1, mnemonic: 'CMP', mode: :idy, length: 2 },
115
+ { opcode: 0xd2, mnemonic: 'CMP', mode: :idp, length: 2 },
116
+ { opcode: 0xd3, mnemonic: 'CMP', mode: :isy, length: 2 },
117
+ { opcode: 0xd5, mnemonic: 'CMP', mode: :dpx, length: 2 },
118
+ { opcode: 0xd7, mnemonic: 'CMP', mode: :idly, length: 2 },
119
+ { opcode: 0xd9, mnemonic: 'CMP', mode: :aby, length: 3 },
120
+ { opcode: 0xdd, mnemonic: 'CMP', mode: :abx, length: 3 },
121
+ { opcode: 0xdf, mnemonic: 'CMP', mode: :alx, length: 4 },
122
+ { opcode: 0xe0, mnemonic: 'CPX', mode: :imm8, length: 2, x: 1 },
123
+ { opcode: 0xe0, mnemonic: 'CPX', mode: :imm16, length: 3, x: 0 },
124
+ { opcode: 0xe4, mnemonic: 'CPX', mode: :dp, length: 2 },
125
+ { opcode: 0xec, mnemonic: 'CPX', mode: :abs, length: 3 },
126
+ { opcode: 0xc0, mnemonic: 'CPY', mode: :imm8, length: 2, x: 1 },
127
+ { opcode: 0xc0, mnemonic: 'CPY', mode: :imm16, length: 3, x: 0 },
128
+ { opcode: 0xc4, mnemonic: 'CPY', mode: :dp, length: 2 },
129
+ { opcode: 0xcc, mnemonic: 'CPY', mode: :abs, length: 3 },
130
+ { opcode: 0x3a, mnemonic: 'DEC', mode: :acc, length: 1 },
131
+ { opcode: 0xc6, mnemonic: 'DEC', mode: :dp, length: 2 },
132
+ { opcode: 0xce, mnemonic: 'DEC', mode: :abs, length: 3 },
133
+ { opcode: 0xd6, mnemonic: 'DEC', mode: :dpx, length: 2 },
134
+ { opcode: 0xde, mnemonic: 'DEC', mode: :abx, length: 3 },
135
+ { opcode: 0xca, mnemonic: 'DEX', mode: :imp, length: 1 },
136
+ { opcode: 0x88, mnemonic: 'DEY', mode: :imp, length: 1 },
137
+ { opcode: 0x1a, mnemonic: 'INC', mode: :acc, length: 1 },
138
+ { opcode: 0xe6, mnemonic: 'INC', mode: :dp, length: 2 },
139
+ { opcode: 0xee, mnemonic: 'INC', mode: :abs, length: 3 },
140
+ { opcode: 0xf6, mnemonic: 'INC', mode: :dpx, length: 2 },
141
+ { opcode: 0xfe, mnemonic: 'INC', mode: :abx, length: 3 },
142
+ { opcode: 0xe8, mnemonic: 'INX', mode: :imp, length: 1 },
143
+ { opcode: 0xc8, mnemonic: 'INY', mode: :imp, length: 1 },
144
+ { opcode: 0x21, mnemonic: 'AND', mode: :idx, length: 2 },
145
+ { opcode: 0x23, mnemonic: 'AND', mode: :sr, length: 2 },
146
+ { opcode: 0x25, mnemonic: 'AND', mode: :dp, length: 2 },
147
+ { opcode: 0x27, mnemonic: 'AND', mode: :idl, length: 2 },
148
+ { opcode: 0x29, mnemonic: 'AND', mode: :imm8, length: 2, m: 1 },
149
+ { opcode: 0x29, mnemonic: 'AND', mode: :imm16, length: 3, m: 0 },
150
+ { opcode: 0x2d, mnemonic: 'AND', mode: :abs, length: 3 },
151
+ { opcode: 0x2f, mnemonic: 'AND', mode: :abl, length: 4 },
152
+ { opcode: 0x31, mnemonic: 'AND', mode: :idy, length: 2 },
153
+ { opcode: 0x32, mnemonic: 'AND', mode: :idp, length: 2 },
154
+ { opcode: 0x33, mnemonic: 'AND', mode: :isy, length: 2 },
155
+ { opcode: 0x35, mnemonic: 'AND', mode: :dpx, length: 2 },
156
+ { opcode: 0x37, mnemonic: 'AND', mode: :idly, length: 2 },
157
+ { opcode: 0x39, mnemonic: 'AND', mode: :aby, length: 3 },
158
+ { opcode: 0x3d, mnemonic: 'AND', mode: :abx, length: 3 },
159
+ { opcode: 0x3f, mnemonic: 'AND', mode: :alx, length: 4 },
160
+ { opcode: 0x41, mnemonic: 'EOR', mode: :idx, length: 2 },
161
+ { opcode: 0x43, mnemonic: 'EOR', mode: :sr, length: 2 },
162
+ { opcode: 0x45, mnemonic: 'EOR', mode: :dp, length: 2 },
163
+ { opcode: 0x47, mnemonic: 'EOR', mode: :idl, length: 2 },
164
+ { opcode: 0x49, mnemonic: 'EOR', mode: :imm8, length: 2, m: 1 },
165
+ { opcode: 0x49, mnemonic: 'EOR', mode: :imm16, length: 3, m: 0 },
166
+ { opcode: 0x4d, mnemonic: 'EOR', mode: :abs, length: 3 },
167
+ { opcode: 0x4f, mnemonic: 'EOR', mode: :abl, length: 4 },
168
+ { opcode: 0x51, mnemonic: 'EOR', mode: :idy, length: 2 },
169
+ { opcode: 0x52, mnemonic: 'EOR', mode: :idp, length: 2 },
170
+ { opcode: 0x53, mnemonic: 'EOR', mode: :isy, length: 2 },
171
+ { opcode: 0x55, mnemonic: 'EOR', mode: :dpx, length: 2 },
172
+ { opcode: 0x57, mnemonic: 'EOR', mode: :idly, length: 2 },
173
+ { opcode: 0x59, mnemonic: 'EOR', mode: :aby, length: 3 },
174
+ { opcode: 0x5d, mnemonic: 'EOR', mode: :abx, length: 3 },
175
+ { opcode: 0x5f, mnemonic: 'EOR', mode: :alx, length: 4 },
176
+ { opcode: 0x01, mnemonic: 'ORA', mode: :idx, length: 2 },
177
+ { opcode: 0x03, mnemonic: 'ORA', mode: :sr, length: 2 },
178
+ { opcode: 0x05, mnemonic: 'ORA', mode: :dp, length: 2 },
179
+ { opcode: 0x07, mnemonic: 'ORA', mode: :idl, length: 2 },
180
+ { opcode: 0x09, mnemonic: 'ORA', mode: :imm8, length: 2, m: 1 },
181
+ { opcode: 0x09, mnemonic: 'ORA', mode: :imm16, length: 3, m: 0 },
182
+ { opcode: 0x0d, mnemonic: 'ORA', mode: :abs, length: 3 },
183
+ { opcode: 0x0f, mnemonic: 'ORA', mode: :abl, length: 4 },
184
+ { opcode: 0x11, mnemonic: 'ORA', mode: :idy, length: 2 },
185
+ { opcode: 0x12, mnemonic: 'ORA', mode: :idp, length: 2 },
186
+ { opcode: 0x13, mnemonic: 'ORA', mode: :isy, length: 2 },
187
+ { opcode: 0x15, mnemonic: 'ORA', mode: :dpx, length: 2 },
188
+ { opcode: 0x17, mnemonic: 'ORA', mode: :idly, length: 2 },
189
+ { opcode: 0x19, mnemonic: 'ORA', mode: :aby, length: 3 },
190
+ { opcode: 0x1d, mnemonic: 'ORA', mode: :abx, length: 3 },
191
+ { opcode: 0x1f, mnemonic: 'ORA', mode: :alx, length: 4 },
192
+ { opcode: 0x24, mnemonic: 'BIT', mode: :dp, length: 2 },
193
+ { opcode: 0x2c, mnemonic: 'BIT', mode: :abs, length: 3 },
194
+ { opcode: 0x34, mnemonic: 'BIT', mode: :dpx, length: 2 },
195
+ { opcode: 0x3c, mnemonic: 'BIT', mode: :abx, length: 3 },
196
+ { opcode: 0x89, mnemonic: 'BIT', mode: :imm8, length: 2, m: 1 },
197
+ { opcode: 0x89, mnemonic: 'BIT', mode: :imm16, length: 3, m: 0 },
198
+ { opcode: 0x14, mnemonic: 'TRB', mode: :dp, length: 2 },
199
+ { opcode: 0x1c, mnemonic: 'TRB', mode: :abs, length: 3 },
200
+ { opcode: 0x04, mnemonic: 'TSB', mode: :dp, length: 2 },
201
+ { opcode: 0x0c, mnemonic: 'TSB', mode: :abs, length: 3 },
202
+ { opcode: 0x06, mnemonic: 'ASL', mode: :dp, length: 2 },
203
+ { opcode: 0x0a, mnemonic: 'ASL', mode: :acc, length: 1 },
204
+ { opcode: 0x0e, mnemonic: 'ASL', mode: :abs, length: 3 },
205
+ { opcode: 0x16, mnemonic: 'ASL', mode: :dpx, length: 2 },
206
+ { opcode: 0x1e, mnemonic: 'ASL', mode: :abx, length: 3 },
207
+ { opcode: 0x46, mnemonic: 'LSR', mode: :dp, length: 2 },
208
+ { opcode: 0x4a, mnemonic: 'LSR', mode: :acc, length: 1 },
209
+ { opcode: 0x4e, mnemonic: 'LSR', mode: :abs, length: 3 },
210
+ { opcode: 0x56, mnemonic: 'LSR', mode: :dpx, length: 2 },
211
+ { opcode: 0x5e, mnemonic: 'LSR', mode: :abx, length: 3 },
212
+ { opcode: 0x26, mnemonic: 'ROL', mode: :dp, length: 2 },
213
+ { opcode: 0x2a, mnemonic: 'ROL', mode: :acc, length: 1 },
214
+ { opcode: 0x2e, mnemonic: 'ROL', mode: :abs, length: 3 },
215
+ { opcode: 0x36, mnemonic: 'ROL', mode: :dpx, length: 2 },
216
+ { opcode: 0x3e, mnemonic: 'ROL', mode: :abx, length: 3 },
217
+ { opcode: 0x66, mnemonic: 'ROR', mode: :dp, length: 2 },
218
+ { opcode: 0x6a, mnemonic: 'ROR', mode: :acc, length: 1 },
219
+ { opcode: 0x6e, mnemonic: 'ROR', mode: :abs, length: 3 },
220
+ { opcode: 0x76, mnemonic: 'ROR', mode: :dpx, length: 2 },
221
+ { opcode: 0x7e, mnemonic: 'ROR', mode: :abx, length: 3 },
222
+ { opcode: 0x90, mnemonic: 'BCC', mode: :rel, length: 2 },
223
+ { opcode: 0xb0, mnemonic: 'BCS', mode: :rel, length: 2 },
224
+ { opcode: 0xf0, mnemonic: 'BEQ', mode: :rel, length: 2 },
225
+ { opcode: 0x30, mnemonic: 'BMI', mode: :rel, length: 2 },
226
+ { opcode: 0xd0, mnemonic: 'BNE', mode: :rel, length: 2 },
227
+ { opcode: 0x10, mnemonic: 'BPL', mode: :rel, length: 2 },
228
+ { opcode: 0x80, mnemonic: 'BRA', mode: :rel, length: 2 },
229
+ { opcode: 0x50, mnemonic: 'BVC', mode: :rel, length: 2 },
230
+ { opcode: 0x70, mnemonic: 'BVS', mode: :rel, length: 2 },
231
+ { opcode: 0x82, mnemonic: 'BRL', mode: :rell, length: 3 },
232
+ { opcode: 0x4c, mnemonic: 'JMP', mode: :abs, length: 3 },
233
+ { opcode: 0x5c, mnemonic: 'JMP', mode: :abl, length: 4 },
234
+ { opcode: 0x6c, mnemonic: 'JMP', mode: :ind, length: 3 },
235
+ { opcode: 0x7c, mnemonic: 'JMP', mode: :iax, length: 3 },
236
+ { opcode: 0xdc, mnemonic: 'JMP', mode: :ial, length: 3 },
237
+ { opcode: 0x22, mnemonic: 'JSL', mode: :abl, length: 4 },
238
+ { opcode: 0x20, mnemonic: 'JSR', mode: :abs, length: 3 },
239
+ { opcode: 0xfc, mnemonic: 'JSR', mode: :iax, length: 3 },
240
+ { opcode: 0x6b, mnemonic: 'RTL', mode: :imp, length: 1 },
241
+ { opcode: 0x60, mnemonic: 'RTS', mode: :imp, length: 1 },
242
+ { opcode: 0x00, mnemonic: 'BRK', mode: :imm, length: 2 },
243
+ { opcode: 0x02, mnemonic: 'COP', mode: :imm, length: 2 },
244
+ { opcode: 0x40, mnemonic: 'RTI', mode: :imp, length: 1 },
245
+ { opcode: 0x18, mnemonic: 'CLC', mode: :imp, length: 1 },
246
+ { opcode: 0xd8, mnemonic: 'CLD', mode: :imp, length: 1 },
247
+ { opcode: 0x58, mnemonic: 'CLI', mode: :imp, length: 1 },
248
+ { opcode: 0xb8, mnemonic: 'CLV', mode: :imp, length: 1 },
249
+ { opcode: 0x38, mnemonic: 'SEC', mode: :imp, length: 1 },
250
+ { opcode: 0xf8, mnemonic: 'SED', mode: :imp, length: 1 },
251
+ { opcode: 0x78, mnemonic: 'SEI', mode: :imp, length: 1 },
252
+ { opcode: 0xc2, mnemonic: 'REP', mode: :imm8, length: 2 },
253
+ { opcode: 0xe2, mnemonic: 'SEP', mode: :imm8, length: 2 },
254
+ { opcode: 0xa1, mnemonic: 'LDA', mode: :idx, length: 2 },
255
+ { opcode: 0xa3, mnemonic: 'LDA', mode: :sr, length: 2 },
256
+ { opcode: 0xa5, mnemonic: 'LDA', mode: :dp, length: 2 },
257
+ { opcode: 0xa7, mnemonic: 'LDA', mode: :idl, length: 2 },
258
+ { opcode: 0xa9, mnemonic: 'LDA', mode: :imm8, length: 2, m: 1 },
259
+ { opcode: 0xa9, mnemonic: 'LDA', mode: :imm16, length: 3, m: 0 },
260
+ { opcode: 0xad, mnemonic: 'LDA', mode: :abs, length: 3 },
261
+ { opcode: 0xaf, mnemonic: 'LDA', mode: :abl, length: 4 },
262
+ { opcode: 0xb1, mnemonic: 'LDA', mode: :idy, length: 2 },
263
+ { opcode: 0xb2, mnemonic: 'LDA', mode: :idp, length: 2 },
264
+ { opcode: 0xb3, mnemonic: 'LDA', mode: :isy, length: 2 },
265
+ { opcode: 0xb5, mnemonic: 'LDA', mode: :dpx, length: 2 },
266
+ { opcode: 0xb7, mnemonic: 'LDA', mode: :idly, length: 2 },
267
+ { opcode: 0xb9, mnemonic: 'LDA', mode: :aby, length: 3 },
268
+ { opcode: 0xbd, mnemonic: 'LDA', mode: :abx, length: 3 },
269
+ { opcode: 0xbf, mnemonic: 'LDA', mode: :alx, length: 4 },
270
+ { opcode: 0xa2, mnemonic: 'LDX', mode: :imm8, length: 2, x: 1 },
271
+ { opcode: 0xa2, mnemonic: 'LDX', mode: :imm16, length: 3, x: 0 },
272
+ { opcode: 0xa6, mnemonic: 'LDX', mode: :dp, length: 2 },
273
+ { opcode: 0xae, mnemonic: 'LDX', mode: :abs, length: 3 },
274
+ { opcode: 0xb6, mnemonic: 'LDX', mode: :dpy, length: 2 },
275
+ { opcode: 0xbe, mnemonic: 'LDX', mode: :aby, length: 3 },
276
+ { opcode: 0xa0, mnemonic: 'LDY', mode: :imm8, length: 2, x: 1 },
277
+ { opcode: 0xa0, mnemonic: 'LDY', mode: :imm16, length: 3, x: 0 },
278
+ { opcode: 0xa4, mnemonic: 'LDY', mode: :dp, length: 2 },
279
+ { opcode: 0xac, mnemonic: 'LDY', mode: :abs, length: 3 },
280
+ { opcode: 0xb4, mnemonic: 'LDY', mode: :dpx, length: 2 },
281
+ { opcode: 0xbc, mnemonic: 'LDY', mode: :abx, length: 3 },
282
+ { opcode: 0x81, mnemonic: 'STA', mode: :idx, length: 2 },
283
+ { opcode: 0x83, mnemonic: 'STA', mode: :sr, length: 2 },
284
+ { opcode: 0x85, mnemonic: 'STA', mode: :dp, length: 2 },
285
+ { opcode: 0x87, mnemonic: 'STA', mode: :idl, length: 2 },
286
+ { opcode: 0x8d, mnemonic: 'STA', mode: :abs, length: 3 },
287
+ { opcode: 0x8f, mnemonic: 'STA', mode: :abl, length: 4 },
288
+ { opcode: 0x91, mnemonic: 'STA', mode: :idy, length: 2 },
289
+ { opcode: 0x92, mnemonic: 'STA', mode: :idp, length: 2 },
290
+ { opcode: 0x93, mnemonic: 'STA', mode: :isy, length: 2 },
291
+ { opcode: 0x95, mnemonic: 'STA', mode: :dpx, length: 2 },
292
+ { opcode: 0x97, mnemonic: 'STA', mode: :idly, length: 2 },
293
+ { opcode: 0x99, mnemonic: 'STA', mode: :aby, length: 3 },
294
+ { opcode: 0x9d, mnemonic: 'STA', mode: :abx, length: 3 },
295
+ { opcode: 0x9f, mnemonic: 'STA', mode: :alx, length: 4 },
296
+ { opcode: 0x86, mnemonic: 'STX', mode: :dp, length: 2 },
297
+ { opcode: 0x8e, mnemonic: 'STX', mode: :abs, length: 3 },
298
+ { opcode: 0x96, mnemonic: 'STX', mode: :dpy, length: 2 },
299
+ { opcode: 0x84, mnemonic: 'STY', mode: :dp, length: 2 },
300
+ { opcode: 0x8c, mnemonic: 'STY', mode: :abs, length: 3 },
301
+ { opcode: 0x94, mnemonic: 'STY', mode: :dpx, length: 2 },
302
+ { opcode: 0x64, mnemonic: 'STZ', mode: :dp, length: 2 },
303
+ { opcode: 0x74, mnemonic: 'STZ', mode: :dpx, length: 2 },
304
+ { opcode: 0x9c, mnemonic: 'STZ', mode: :abs, length: 3 },
305
+ { opcode: 0x9e, mnemonic: 'STZ', mode: :abx, length: 3 },
306
+ { opcode: 0x54, mnemonic: 'MVN', mode: :bm, length: 3 },
307
+ { opcode: 0x44, mnemonic: 'MVP', mode: :bm, length: 3 },
308
+ { opcode: 0xea, mnemonic: 'NOP', mode: :imp, length: 1 },
309
+ { opcode: 0x42, mnemonic: 'WDM', mode: :imm, length: 2 },
310
+ { opcode: 0xf4, mnemonic: 'PEA', mode: :iml, length: 3 },
311
+ { opcode: 0xd4, mnemonic: 'PEI', mode: :dp, length: 2 },
312
+ { opcode: 0x62, mnemonic: 'PER', mode: :rell, length: 3 },
313
+ { opcode: 0x48, mnemonic: 'PHA', mode: :imp, length: 1 },
314
+ { opcode: 0xda, mnemonic: 'PHX', mode: :imp, length: 1 },
315
+ { opcode: 0x5a, mnemonic: 'PHY', mode: :imp, length: 1 },
316
+ { opcode: 0x68, mnemonic: 'PLA', mode: :imp, length: 1 },
317
+ { opcode: 0xfa, mnemonic: 'PLX', mode: :imp, length: 1 },
318
+ { opcode: 0x7a, mnemonic: 'PLY', mode: :imp, length: 1 },
319
+ { opcode: 0x8b, mnemonic: 'PHB', mode: :imp, length: 1 },
320
+ { opcode: 0x0b, mnemonic: 'PHD', mode: :imp, length: 1 },
321
+ { opcode: 0x4b, mnemonic: 'PHK', mode: :imp, length: 1 },
322
+ { opcode: 0x08, mnemonic: 'PHP', mode: :imp, length: 1 },
323
+ { opcode: 0xab, mnemonic: 'PLB', mode: :imp, length: 1 },
324
+ { opcode: 0x2b, mnemonic: 'PLD', mode: :imp, length: 1 },
325
+ { opcode: 0x28, mnemonic: 'PLP', mode: :imp, length: 1 },
326
+ { opcode: 0xdb, mnemonic: 'STP', mode: :imp, length: 1 },
327
+ { opcode: 0xcb, mnemonic: 'WAI', mode: :imp, length: 1 },
328
+ { opcode: 0xaa, mnemonic: 'TAX', mode: :imp, length: 1 },
329
+ { opcode: 0xa8, mnemonic: 'TAY', mode: :imp, length: 1 },
330
+ { opcode: 0xba, mnemonic: 'TSX', mode: :imp, length: 1 },
331
+ { opcode: 0x8a, mnemonic: 'TXA', mode: :imp, length: 1 },
332
+ { opcode: 0x9a, mnemonic: 'TXS', mode: :imp, length: 1 },
333
+ { opcode: 0x9b, mnemonic: 'TXY', mode: :imp, length: 1 },
334
+ { opcode: 0x98, mnemonic: 'TYA', mode: :imp, length: 1 },
335
+ { opcode: 0xbb, mnemonic: 'TYX', mode: :imp, length: 1 },
336
+ { opcode: 0x5b, mnemonic: 'TCD', mode: :imp, length: 1 },
337
+ { opcode: 0x1b, mnemonic: 'TCS', mode: :imp, length: 1 },
338
+ { opcode: 0x7b, mnemonic: 'TDC', mode: :imp, length: 1 },
339
+ { opcode: 0x3b, mnemonic: 'TSC', mode: :imp, length: 1 },
340
+ { opcode: 0xeb, mnemonic: 'XBA', mode: :imp, length: 1 },
341
+ { opcode: 0xfb, mnemonic: 'XCE', mode: :imp, length: 1 }].freeze
342
+ end
343
+ end
344
+ end
data/lib/snes_utils.rb CHANGED
@@ -7,6 +7,8 @@ require 'byebug'
7
7
 
8
8
  require 'mini_assembler/mini_assembler'
9
9
  require 'mini_assembler/definitions'
10
+ require 'mini_assembler/wdc65816/definitions'
11
+ require 'mini_assembler/spc700/definitions'
10
12
  require 'png2snes/png2snes'
11
13
  require 'tmx2snes/tmx2snes'
12
14
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snes_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vivien Bihl
@@ -11,33 +11,33 @@ cert_chain: []
11
11
  date: 2019-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: byebug
14
+ name: rspec
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '11.0'
19
+ version: '3.9'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '11.0'
26
+ version: '3.9'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rspec
28
+ name: byebug
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '3.9'
34
- type: :development
33
+ version: '11.0'
34
+ type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '3.9'
40
+ version: '11.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: chunky_png
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -94,6 +94,8 @@ files:
94
94
  - bin/tmx2snes
95
95
  - lib/mini_assembler/definitions.rb
96
96
  - lib/mini_assembler/mini_assembler.rb
97
+ - lib/mini_assembler/spc700/definitions.rb
98
+ - lib/mini_assembler/wdc65816/definitions.rb
97
99
  - lib/png2snes/png2snes.rb
98
100
  - lib/snes_utils.rb
99
101
  - lib/tmx2snes/tmx2snes.rb