snes_utils 0.1.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,136 @@
1
+ require 'spec_helper'
2
+ require 'snes_utils'
3
+
4
+ describe SnesUtils::MiniAssembler do
5
+ let(:mini_asm) { SnesUtils::MiniAssembler.new }
6
+
7
+ describe '#parse_address' do
8
+ subject { mini_asm.parse_address(line) }
9
+
10
+ context 'when address is given' do
11
+ let(:line) { '300: lda #$12' }
12
+
13
+ it 'returns the address given' do
14
+ expect(subject).to eq(0x300)
15
+ end
16
+ end
17
+
18
+ context 'when address is implied' do
19
+ let(:line) { 'lda #$12' }
20
+
21
+ it 'returns the current address' do
22
+ expect(subject).to eq(0)
23
+ end
24
+ end
25
+ end
26
+
27
+ describe '#parse_instruction' do
28
+ subject { mini_asm.parse_instruction(line) }
29
+ context 'imm8' do
30
+ let(:line) { 'ora #17' }
31
+
32
+ it do
33
+ expect(subject).to eq [['09', '17'], 2, 0]
34
+ end
35
+ end
36
+
37
+ context 'abs' do
38
+ let(:line) { 'lda $1234' }
39
+
40
+ it do
41
+ expect(subject).to eq [['AD','34','12'], 3, 0]
42
+ end
43
+ end
44
+
45
+ context 'imp' do
46
+ let(:line) { '300:xce' }
47
+
48
+ it do
49
+ expect(subject).to eq [['FB'], 1, 0x300]
50
+ end
51
+ end
52
+
53
+ context 'idly' do
54
+ let(:line) { 'ADC [$12],Y' }
55
+
56
+ it do
57
+ expect(subject).to eq [['77', '12'], 2, 0]
58
+ end
59
+ end
60
+
61
+ context 'bm' do
62
+ let(:line) { 'MVN $12,$34' }
63
+
64
+ it do
65
+ expect(subject).to eq [['54', '34', '12'], 3, 0]
66
+ end
67
+ end
68
+
69
+ describe 'relative addressing' do
70
+ context '8 bit rel postivie' do
71
+ let(:line) { '300:BMI 305' }
72
+
73
+ it { expect(subject).to eq [['30', '03'], 2, 0x300] }
74
+ end
75
+
76
+ context '8 bit rel negative' do
77
+ let(:line) { '30a:bcc 300' }
78
+
79
+ it { expect(subject).to eq [['90', 'F4'], 2, 0x30a] }
80
+ end
81
+
82
+ context '16 bit rel postivie' do
83
+ let(:line) { '304:BRL $03A0' }
84
+
85
+ it { expect(subject).to eq [['82', '99', '00'], 3, 0x304] }
86
+ end
87
+
88
+ context '16 bit rel negative' do
89
+ let(:line) { '3bf:per 37a' }
90
+
91
+ it { expect(subject).to eq [['62', 'B8', 'FF'], 3, 0x3bf] }
92
+ end
93
+ end
94
+ end
95
+
96
+ describe '#disassemble_range' do
97
+ subject { mini_asm.disassemble_range(0, count) }
98
+
99
+ let(:count) { 1 }
100
+
101
+ before { mini_asm.instance_variable_set(:@memory, memory) }
102
+
103
+ context 'when cpu is 65816' do
104
+ let(:memory) { ['82', '99', '00'] }
105
+
106
+ it { expect(subject).to eq ['00/0000: 82 99 00 BRL 009C {+0099}'] }
107
+ end
108
+
109
+ context 'when cpu is spc700' do
110
+ let(:memory) { ['00'] }
111
+
112
+ before { mini_asm.instance_variable_set(:@cpu, :spc700) }
113
+
114
+ it { expect(subject).to eq ['00/0000: 00 NOP'] }
115
+ end
116
+ end
117
+
118
+ describe '#read' do
119
+ let(:file) { 'spec/fixtures/test.asm' }
120
+ before { mini_asm.read(file) }
121
+ let(:memory) do
122
+ ["A9", "12", "78", "18", "C9", "14", "3A", "D0",
123
+ "FD", "00", "00", "80", "02", "42", "12", "AD",
124
+ "34", "12", "80", "F2", nil, nil, nil, nil,
125
+ nil, nil, nil, nil, nil, nil, nil, nil,
126
+ "E4", "12", "4F", "12", "50", "FC", "53", "12",
127
+ "F9", "FA", "22", "11", nil, nil, nil, nil,
128
+ "11", "22", "33", "44", "55", "66", "77", "88",
129
+ "DE", "AF", "FA", "CE", "DE", "CA", "FE", "12"]
130
+ end
131
+
132
+ it 'sets memory correctly' do
133
+ expect(mini_asm.instance_variable_get(:@memory)).to eq memory
134
+ end
135
+ end
136
+ end
@@ -0,0 +1,322 @@
1
+ require 'spec_helper'
2
+ require 'snes_utils'
3
+
4
+ describe SnesUtils::MiniAssembler do
5
+ RSpec::Support::ObjectFormatter.default_instance.max_formatted_output_length = 10000000000000000
6
+
7
+ let(:mini_asm) { SnesUtils::MiniAssembler.new }
8
+ let(:memory) do
9
+ ["00", "01", "02", "12", "03", "12", "34", "04", "12", "05", "34", "12", "06", "07", "12", "08",
10
+ "12", "09", "34", "12", "0A", "A5", "91", "0B", "12", "0C", "34", "12", "0D", "0E", "34", "12",
11
+ "0F", "10", "12", "11", "12", "12", "13", "12", "34", "14", "12", "15", "34", "12", "16", "34",
12
+ "12", "17", "12", "18", "34", "12", "19", "1A", "12", "1B", "12", "1C", "1D", "1E", "34", "12",
13
+ "1F", "34", "12", "20", "21", "22", "12", "23", "12", "34", "24", "12", "25", "34", "12", "26",
14
+ "27", "12", "28", "12", "29", "34", "12", "2A", "A5", "91", "2B", "12", "2C", "34", "12", "2D",
15
+ "2E", "12", "34", "2F", "12", "30", "12", "31", "32", "12", "33", "12", "34", "34", "12", "35",
16
+ "34", "12", "36", "34", "12", "37", "12", "38", "34", "12", "39", "3A", "12", "3B", "12", "3C",
17
+ "3D", "3E", "12", "3F", "34", "12", "40", "41", "42", "12", "43", "12", "34", "44", "12", "45",
18
+ "34", "12", "46", "47", "12", "48", "12", "49", "34", "12", "4A", "A5", "91", "4B", "12", "4C",
19
+ "34", "12", "4D", "4E", "34", "12", "4F", "12", "50", "12", "51", "52", "12", "53", "12", "34",
20
+ "54", "12", "55", "34", "12", "56", "34", "12", "57", "12", "58", "34", "12", "59", "5A", "12",
21
+ "5B", "12", "5C", "5D", "5E", "34", "12", "5F", "34", "12", "60", "61", "62", "12", "63", "12",
22
+ "34", "64", "12", "65", "34", "12", "66", "67", "12", "68", "12", "69", "34", "12", "6A", "A5",
23
+ "91", "6B", "12", "6C", "34", "12", "6D", "6E", "12", "34", "6F", "70", "12", "71", "72", "12",
24
+ "73", "12", "34", "74", "12", "75", "34", "12", "76", "34", "12", "77", "12", "78", "34", "12",
25
+ "79", "7A", "12", "7B", "12", "7C", "7D", "7E", "12", "7F", "80", "81", "82", "12", "83", "12",
26
+ "34", "84", "12", "85", "34", "12", "86", "87", "12", "88", "12", "89", "34", "12", "8A", "A5",
27
+ "91", "8B", "12", "8C", "34", "12", "8D", "12", "8E", "8F", "34", "12", "90", "12", "91", "92",
28
+ "12", "93", "12", "34", "94", "12", "95", "34", "12", "96", "34", "12", "97", "12", "98", "34",
29
+ "12", "99", "9A", "12", "9B", "12", "9C", "9D", "9E", "9F", "A0", "A1", "A2", "12", "A3", "12",
30
+ "34", "A4", "12", "A5", "34", "12", "A6", "A7", "12", "A8", "12", "A9", "34", "12", "AA", "A5",
31
+ "91", "AB", "12", "AC", "34", "12", "AD", "12", "AE", "AF", "B0", "12", "B1", "B2", "12", "B3",
32
+ "12", "34", "B4", "12", "B5", "34", "12", "B6", "34", "12", "B7", "12", "B8", "34", "12", "B9",
33
+ "BA", "12", "BB", "12", "BC", "BD", "BE", "BF", "C0", "C1", "C2", "12", "C3", "12", "34", "C4",
34
+ "12", "C5", "34", "12", "C6", "C7", "12", "C8", "12", "C9", "34", "12", "CA", "A5", "91", "CB",
35
+ "12", "CC", "34", "12", "CD", "12", "CE", "CF", "D0", "12", "D1", "D2", "12", "D3", "12", "34",
36
+ "D4", "12", "D5", "34", "12", "D6", "34", "12", "D7", "12", "D8", "12", "D9", "12", "DA", "12",
37
+ "DB", "12", "DC", "DD", "DE", "12", "34", "DF", "E0", "E1", "E2", "12", "E3", "12", "34", "E4",
38
+ "12", "E5", "34", "12", "E6", "E7", "12", "E8", "12", "E9", "34", "12", "EA", "A5", "91", "EB",
39
+ "12", "EC", "34", "12", "ED", "EE", "EF", "F0", "12", "F1", "F2", "12", "F3", "12", "34", "F4",
40
+ "12", "F5", "34", "12", "F6", "34", "12", "F7", "12", "F8", "12", "F9", "12", "FA", "34", "12",
41
+ "FB", "12", "FC", "FD", "FE", "12", "FF"]
42
+ end
43
+
44
+ describe 'when assembling' do
45
+ let(:file) { 'spec/fixtures/spc700.asm' }
46
+ before { mini_asm.read(file) }
47
+
48
+ it 'sets memory correctly' do
49
+ expect(mini_asm.instance_variable_get(:@memory)).to eq memory
50
+ end
51
+ end
52
+
53
+ describe 'when disassembling' do
54
+ subject { mini_asm.disassemble_range(0, 256) }
55
+
56
+ before do
57
+ mini_asm.instance_variable_set(:@memory, memory)
58
+ mini_asm.instance_variable_set(:@cpu, :spc700)
59
+ end
60
+
61
+ it 'disassembles correctly' do
62
+ expect(subject).to eq [
63
+ "00/0000: 00 NOP",
64
+ "00/0001: 01 TCALL 0",
65
+ "00/0002: 02 12 SET1 12.0",
66
+ "00/0004: 03 12 34 BBS 12.0,003B {+34}",
67
+ "00/0007: 04 12 OR A,12",
68
+ "00/0009: 05 34 12 OR A,!1234",
69
+ "00/000C: 06 OR A,(X)",
70
+ "00/000D: 07 12 OR A,[12+X]",
71
+ "00/000F: 08 12 OR A,#12",
72
+ "00/0011: 09 34 12 OR 12<d>,34<s>",
73
+ "00/0014: 0A A5 91 OR1 C,1234.5",
74
+ "00/0017: 0B 12 ASL 12",
75
+ "00/0019: 0C 34 12 ASL !1234",
76
+ "00/001C: 0D PUSH PSW",
77
+ "00/001D: 0E 34 12 TSET1 !1234",
78
+ "00/0020: 0F BRK",
79
+ "00/0021: 10 12 BPL 0035 {+12}",
80
+ "00/0023: 11 TCALL 1",
81
+ "00/0024: 12 12 CLR1 12.0",
82
+ "00/0026: 13 12 34 BBC 12.0,005D {+34}",
83
+ "00/0029: 14 12 OR A,12+X",
84
+ "00/002B: 15 34 12 OR A,!1234+X",
85
+ "00/002E: 16 34 12 OR A,!1234+Y",
86
+ "00/0031: 17 12 OR A,[12]+Y",
87
+ "00/0033: 18 34 12 OR 12,#34",
88
+ "00/0036: 19 OR (X),(Y)",
89
+ "00/0037: 1A 12 DECW 12",
90
+ "00/0039: 1B 12 ASL 12+X",
91
+ "00/003B: 1C ASL A",
92
+ "00/003C: 1D DEC X",
93
+ "00/003D: 1E 34 12 CMP X,!1234",
94
+ "00/0040: 1F 34 12 JMP [!1234+X]",
95
+ "00/0043: 20 CLRP",
96
+ "00/0044: 21 TCALL 2",
97
+ "00/0045: 22 12 SET1 12.1",
98
+ "00/0047: 23 12 34 BBS 12.1,007E {+34}",
99
+ "00/004A: 24 12 AND A,12",
100
+ "00/004C: 25 34 12 AND A,!1234",
101
+ "00/004F: 26 AND A,(X)",
102
+ "00/0050: 27 12 AND A,[12+X]",
103
+ "00/0052: 28 12 AND A,#12",
104
+ "00/0054: 29 34 12 AND 12<d>,34<s>",
105
+ "00/0057: 2A A5 91 OR1 C,/1234.5",
106
+ "00/005A: 2B 12 ROL 12",
107
+ "00/005C: 2C 34 12 ROL !1234",
108
+ "00/005F: 2D PUSH A",
109
+ "00/0060: 2E 12 34 CBNE 12,0097 {+34}",
110
+ "00/0063: 2F 12 BRA 0077 {+12}",
111
+ "00/0065: 30 12 BMI 0079 {+12}",
112
+ "00/0067: 31 TCALL 3",
113
+ "00/0068: 32 12 CLR1 12.1",
114
+ "00/006A: 33 12 34 BBC 12.1,00A1 {+34}",
115
+ "00/006D: 34 12 AND A,12+X",
116
+ "00/006F: 35 34 12 AND A,!1234+X",
117
+ "00/0072: 36 34 12 AND A,!1234+Y",
118
+ "00/0075: 37 12 AND A,[12]+Y",
119
+ "00/0077: 38 34 12 AND 12,#34",
120
+ "00/007A: 39 AND (X),(Y)",
121
+ "00/007B: 3A 12 INCW 12",
122
+ "00/007D: 3B 12 ROL 12+X",
123
+ "00/007F: 3C ROL A",
124
+ "00/0080: 3D INC X",
125
+ "00/0081: 3E 12 CMP X,12",
126
+ "00/0083: 3F 34 12 CALL !1234",
127
+ "00/0086: 40 SETP",
128
+ "00/0087: 41 TCALL 4",
129
+ "00/0088: 42 12 SET1 12.2",
130
+ "00/008A: 43 12 34 BBS 12.2,00C1 {+34}",
131
+ "00/008D: 44 12 EOR A,12",
132
+ "00/008F: 45 34 12 EOR A,!1234",
133
+ "00/0092: 46 EOR A,(X)",
134
+ "00/0093: 47 12 EOR A,[12+X]",
135
+ "00/0095: 48 12 EOR A,#12",
136
+ "00/0097: 49 34 12 EOR 12<d>,34<s>",
137
+ "00/009A: 4A A5 91 AND1 C,1234.5",
138
+ "00/009D: 4B 12 LSR 12",
139
+ "00/009F: 4C 34 12 LSR !1234",
140
+ "00/00A2: 4D PUSH X",
141
+ "00/00A3: 4E 34 12 TCLR1 !1234",
142
+ "00/00A6: 4F 12 PCALL 12",
143
+ "00/00A8: 50 12 BVC 00BC {+12}",
144
+ "00/00AA: 51 TCALL 5",
145
+ "00/00AB: 52 12 CLR1 12.2",
146
+ "00/00AD: 53 12 34 BBC 12.2,00E4 {+34}",
147
+ "00/00B0: 54 12 EOR A,12+X",
148
+ "00/00B2: 55 34 12 EOR A,!1234+X",
149
+ "00/00B5: 56 34 12 EOR A,!1234+Y",
150
+ "00/00B8: 57 12 EOR A,[12]+Y",
151
+ "00/00BA: 58 34 12 EOR 12,#34",
152
+ "00/00BD: 59 EOR (X),(Y)",
153
+ "00/00BE: 5A 12 CMPW YA,12",
154
+ "00/00C0: 5B 12 LSR 12+X",
155
+ "00/00C2: 5C LSR A",
156
+ "00/00C3: 5D MOV X,A",
157
+ "00/00C4: 5E 34 12 CMP Y,!1234",
158
+ "00/00C7: 5F 34 12 JMP !1234",
159
+ "00/00CA: 60 CLRC",
160
+ "00/00CB: 61 TCALL 6",
161
+ "00/00CC: 62 12 SET1 12.3",
162
+ "00/00CE: 63 12 34 BBS 12.3,0105 {+34}",
163
+ "00/00D1: 64 12 CMP A,12",
164
+ "00/00D3: 65 34 12 CMP A,!1234",
165
+ "00/00D6: 66 CMP A,(X)",
166
+ "00/00D7: 67 12 CMP A,[12+X]",
167
+ "00/00D9: 68 12 CMP A,#12",
168
+ "00/00DB: 69 34 12 CMP 12<d>,34<s>",
169
+ "00/00DE: 6A A5 91 AND1 C,/1234.5",
170
+ "00/00E1: 6B 12 ROR 12",
171
+ "00/00E3: 6C 34 12 ROR !1234",
172
+ "00/00E6: 6D PUSH Y",
173
+ "00/00E7: 6E 12 34 DBNZ 12,011E {+34}",
174
+ "00/00EA: 6F RET",
175
+ "00/00EB: 70 12 BVS 00FF {+12}",
176
+ "00/00ED: 71 TCALL 7",
177
+ "00/00EE: 72 12 CLR1 12.3",
178
+ "00/00F0: 73 12 34 BBC 12.3,0127 {+34}",
179
+ "00/00F3: 74 12 CMP A,12+X",
180
+ "00/00F5: 75 34 12 CMP A,!1234+X",
181
+ "00/00F8: 76 34 12 CMP A,!1234+Y",
182
+ "00/00FB: 77 12 CMP A,[12]+Y",
183
+ "00/00FD: 78 34 12 CMP 12,#34",
184
+ "00/0100: 79 CMP (X),(Y)",
185
+ "00/0101: 7A 12 ADDW YA,12",
186
+ "00/0103: 7B 12 ROR 12+X",
187
+ "00/0105: 7C ROR A",
188
+ "00/0106: 7D MOV A,X",
189
+ "00/0107: 7E 12 CMP Y,12",
190
+ "00/0109: 7F RETI",
191
+ "00/010A: 80 SETC",
192
+ "00/010B: 81 TCALL 8",
193
+ "00/010C: 82 12 SET1 12.4",
194
+ "00/010E: 83 12 34 BBS 12.4,0145 {+34}",
195
+ "00/0111: 84 12 ADC A,12",
196
+ "00/0113: 85 34 12 ADC A,!1234",
197
+ "00/0116: 86 ADC A,(X)",
198
+ "00/0117: 87 12 ADC A,[12+X]",
199
+ "00/0119: 88 12 ADC A,#12",
200
+ "00/011B: 89 34 12 ADC 12<d>,34<s>",
201
+ "00/011E: 8A A5 91 EOR1 C,1234.5",
202
+ "00/0121: 8B 12 DEC 12",
203
+ "00/0123: 8C 34 12 DEC !1234",
204
+ "00/0126: 8D 12 MOV Y,#12",
205
+ "00/0128: 8E POP PSW",
206
+ "00/0129: 8F 34 12 MOV 12,#34",
207
+ "00/012C: 90 12 BCC 0140 {+12}",
208
+ "00/012E: 91 TCALL 9",
209
+ "00/012F: 92 12 CLR1 12.4",
210
+ "00/0131: 93 12 34 BBC 12.4,0168 {+34}",
211
+ "00/0134: 94 12 ADC A,12+X",
212
+ "00/0136: 95 34 12 ADC A,!1234+X",
213
+ "00/0139: 96 34 12 ADC A,!1234+Y",
214
+ "00/013C: 97 12 ADC A,[12]+Y",
215
+ "00/013E: 98 34 12 ADC 12,#34",
216
+ "00/0141: 99 ADC (X),(Y)",
217
+ "00/0142: 9A 12 SUBW YA,12",
218
+ "00/0144: 9B 12 DEC 12+X",
219
+ "00/0146: 9C DEC A",
220
+ "00/0147: 9D MOV X,SP",
221
+ "00/0148: 9E DIV YA,X",
222
+ "00/0149: 9F XCN A",
223
+ "00/014A: A0 EI",
224
+ "00/014B: A1 TCALL 10",
225
+ "00/014C: A2 12 SET1 12.5",
226
+ "00/014E: A3 12 34 BBS 12.5,0185 {+34}",
227
+ "00/0151: A4 12 SBC A,12",
228
+ "00/0153: A5 34 12 SBC A,!1234",
229
+ "00/0156: A6 SBC A,(X)",
230
+ "00/0157: A7 12 SBC A,[12+X]",
231
+ "00/0159: A8 12 SBC A,#12",
232
+ "00/015B: A9 34 12 SBC 12<d>,34<s>",
233
+ "00/015E: AA A5 91 MOV1 C,1234.5",
234
+ "00/0161: AB 12 INC 12",
235
+ "00/0163: AC 34 12 INC !1234",
236
+ "00/0166: AD 12 CMP Y,#12",
237
+ "00/0168: AE POP A",
238
+ "00/0169: AF MOV (X)+,A",
239
+ "00/016A: B0 12 BCS 017E {+12}",
240
+ "00/016C: B1 TCALL 11",
241
+ "00/016D: B2 12 CLR1 12.5",
242
+ "00/016F: B3 12 34 BBC 12.5,01A6 {+34}",
243
+ "00/0172: B4 12 SBC A,12+X",
244
+ "00/0174: B5 34 12 SBC A,!1234+X",
245
+ "00/0177: B6 34 12 SBC A,!1234+Y",
246
+ "00/017A: B7 12 SBC A,[12]+Y",
247
+ "00/017C: B8 34 12 SBC 12,#34",
248
+ "00/017F: B9 SBC (X),(Y)",
249
+ "00/0180: BA 12 MOVW YA,12",
250
+ "00/0182: BB 12 INC 12+X",
251
+ "00/0184: BC INC A",
252
+ "00/0185: BD MOV SP,X",
253
+ "00/0186: BE DAS A",
254
+ "00/0187: BF MOV A,(X)+",
255
+ "00/0188: C0 DI",
256
+ "00/0189: C1 TCALL 12",
257
+ "00/018A: C2 12 SET1 12.6",
258
+ "00/018C: C3 12 34 BBS 12.6,01C3 {+34}",
259
+ "00/018F: C4 12 MOV 12,A",
260
+ "00/0191: C5 34 12 MOV !1234,A",
261
+ "00/0194: C6 MOV (X),A",
262
+ "00/0195: C7 12 MOV [12+X],A",
263
+ "00/0197: C8 12 CMP X,#12",
264
+ "00/0199: C9 34 12 MOV !1234,X",
265
+ "00/019C: CA A5 91 MOV1 1234.5,C",
266
+ "00/019F: CB 12 MOV 12,Y",
267
+ "00/01A1: CC 34 12 MOV !1234,Y",
268
+ "00/01A4: CD 12 MOV X,#12",
269
+ "00/01A6: CE POP X",
270
+ "00/01A7: CF MUL YA",
271
+ "00/01A8: D0 12 BNE 01BC {+12}",
272
+ "00/01AA: D1 TCALL 13",
273
+ "00/01AB: D2 12 CLR1 12.6",
274
+ "00/01AD: D3 12 34 BBC 12.6,01E4 {+34}",
275
+ "00/01B0: D4 12 MOV 12+X,A",
276
+ "00/01B2: D5 34 12 MOV !1234+X,A",
277
+ "00/01B5: D6 34 12 MOV !1234+Y,A",
278
+ "00/01B8: D7 12 MOV [12]+Y,A",
279
+ "00/01BA: D8 12 MOV 12,X",
280
+ "00/01BC: D9 12 MOV 12+Y,X",
281
+ "00/01BE: DA 12 MOVW 12,YA",
282
+ "00/01C0: DB 12 MOV 12+X,Y",
283
+ "00/01C2: DC DEC Y",
284
+ "00/01C3: DD MOV A,Y",
285
+ "00/01C4: DE 12 34 CBNE 12+X,01FB {+34}",
286
+ "00/01C7: DF DAA A",
287
+ "00/01C8: E0 CLRV",
288
+ "00/01C9: E1 TCALL 14",
289
+ "00/01CA: E2 12 SET1 12.7",
290
+ "00/01CC: E3 12 34 BBS 12.7,0203 {+34}",
291
+ "00/01CF: E4 12 MOV A,12",
292
+ "00/01D1: E5 34 12 MOV A,!1234",
293
+ "00/01D4: E6 MOV A,(X)",
294
+ "00/01D5: E7 12 MOV A,[12+X]",
295
+ "00/01D7: E8 12 MOV A,#12",
296
+ "00/01D9: E9 34 12 MOV X,!1234",
297
+ "00/01DC: EA A5 91 NOT1 1234.5",
298
+ "00/01DF: EB 12 MOV Y,12",
299
+ "00/01E1: EC 34 12 MOV Y,!1234",
300
+ "00/01E4: ED NOTC",
301
+ "00/01E5: EE POP Y",
302
+ "00/01E6: EF SLEEP",
303
+ "00/01E7: F0 12 BEQ 01FB {+12}",
304
+ "00/01E9: F1 TCALL 15",
305
+ "00/01EA: F2 12 CLR1 12.7",
306
+ "00/01EC: F3 12 34 BBC 12.7,0223 {+34}",
307
+ "00/01EF: F4 12 MOV A,12+X",
308
+ "00/01F1: F5 34 12 MOV A,!1234+X",
309
+ "00/01F4: F6 34 12 MOV A,!1234+Y",
310
+ "00/01F7: F7 12 MOV A,[12]+Y",
311
+ "00/01F9: F8 12 MOV X,12",
312
+ "00/01FB: F9 12 MOV X,12+Y",
313
+ "00/01FD: FA 34 12 MOV 12<d>,34<s>",
314
+ "00/0200: FB 12 MOV Y,12+X",
315
+ "00/0202: FC INC Y",
316
+ "00/0203: FD MOV Y,A",
317
+ "00/0204: FE 12 DBNZ Y,0218 {+12}",
318
+ "00/0206: FF STOP"
319
+ ]
320
+ end
321
+ end
322
+ end
@@ -0,0 +1,100 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
4
+ # this file to always be loaded, without a need to explicitly require it in any
5
+ # files.
6
+ #
7
+ # Given that it is always loaded, you are encouraged to keep this file as
8
+ # light-weight as possible. Requiring heavyweight dependencies from this file
9
+ # will add to the boot time of your test suite on EVERY test run, even for an
10
+ # individual file that may not need all of that loaded. Instead, consider making
11
+ # a separate helper file that requires the additional dependencies and performs
12
+ # the additional setup, and require it from the spec files that actually need
13
+ # it.
14
+ #
15
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
16
+ RSpec.configure do |config|
17
+ # rspec-expectations config goes here. You can use an alternate
18
+ # assertion/expectation library such as wrong or the stdlib/minitest
19
+ # assertions if you prefer.
20
+ config.expect_with :rspec do |expectations|
21
+ # This option will default to `true` in RSpec 4. It makes the `description`
22
+ # and `failure_message` of custom matchers include text for helper methods
23
+ # defined using `chain`, e.g.:
24
+ # be_bigger_than(2).and_smaller_than(4).description
25
+ # # => "be bigger than 2 and smaller than 4"
26
+ # ...rather than:
27
+ # # => "be bigger than 2"
28
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
29
+ end
30
+
31
+ # rspec-mocks config goes here. You can use an alternate test double
32
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
33
+ config.mock_with :rspec do |mocks|
34
+ # Prevents you from mocking or stubbing a method that does not exist on
35
+ # a real object. This is generally recommended, and will default to
36
+ # `true` in RSpec 4.
37
+ mocks.verify_partial_doubles = true
38
+ end
39
+
40
+ # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
41
+ # have no way to turn it off -- the option exists only for backwards
42
+ # compatibility in RSpec 3). It causes shared context metadata to be
43
+ # inherited by the metadata hash of host groups and examples, rather than
44
+ # triggering implicit auto-inclusion in groups with matching metadata.
45
+ config.shared_context_metadata_behavior = :apply_to_host_groups
46
+
47
+ # The settings below are suggested to provide a good initial experience
48
+ # with RSpec, but feel free to customize to your heart's content.
49
+ =begin
50
+ # This allows you to limit a spec run to individual examples or groups
51
+ # you care about by tagging them with `:focus` metadata. When nothing
52
+ # is tagged with `:focus`, all examples get run. RSpec also provides
53
+ # aliases for `it`, `describe`, and `context` that include `:focus`
54
+ # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
55
+ config.filter_run_when_matching :focus
56
+
57
+ # Allows RSpec to persist some state between runs in order to support
58
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
59
+ # you configure your source control system to ignore this file.
60
+ config.example_status_persistence_file_path = "spec/examples.txt"
61
+
62
+ # Limits the available syntax to the non-monkey patched syntax that is
63
+ # recommended. For more details, see:
64
+ # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
65
+ # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
66
+ # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
67
+ config.disable_monkey_patching!
68
+
69
+ # This setting enables warnings. It's recommended, but in some cases may
70
+ # be too noisy due to issues in dependencies.
71
+ config.warnings = true
72
+
73
+ # Many RSpec users commonly either run the entire suite or an individual
74
+ # file, and it's useful to allow more verbose output when running an
75
+ # individual spec file.
76
+ if config.files_to_run.one?
77
+ # Use the documentation formatter for detailed output,
78
+ # unless a formatter has already been configured
79
+ # (e.g. via a command-line flag).
80
+ config.default_formatter = "doc"
81
+ end
82
+
83
+ # Print the 10 slowest examples and example groups at the
84
+ # end of the spec run, to help surface which specs are running
85
+ # particularly slow.
86
+ config.profile_examples = 10
87
+
88
+ # Run specs in random order to surface order dependencies. If you find an
89
+ # order dependency and want to debug it, you can fix the order by providing
90
+ # the seed, which is printed after each run.
91
+ # --seed 1234
92
+ config.order = :random
93
+
94
+ # Seed global randomization in this process using the `--seed` CLI option.
95
+ # Setting this allows you to use `--seed` to deterministically reproduce
96
+ # test failures related to randomization by passing the same `--seed` value
97
+ # as the one that triggered the failure.
98
+ Kernel.srand config.seed
99
+ =end
100
+ end
data/spec/vas_spec.rb ADDED
@@ -0,0 +1,5 @@
1
+ require 'spec_helper'
2
+ require 'snes_utils'
3
+
4
+ describe SnesUtils::Vas do
5
+ end