aboutsummaryrefslogtreecommitdiff
path: root/src/test/6502.1
blob: f94bcc8a8ae6fed00c71aa2c04a3c81f0b476856 (plain)
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
259
260
261
262
263
264
265
266
267
268
269
270
271
272
	;option	list-file,list.txt
	option	+list
	option	+list-hex
	option	+list-pc
	option	list-labels,all
	option	list-macros,all

	;
	; Test basically created by pasting in opcodes from 6502.org
	;
	cpu	6502

	org	$8000

zero:	equ	0

	option	zero-page,off

adc_test
	ADC #$44
	option	+zero-page
	ADC $44
	adc $44,x
	option	-zero-page
	adc $4400
	adc $4400,x
	adc $4400,y
	ADC ($44,X)
	ADC ($44),Y

zp_test
	option	zero-page,auto
	adc	$80	; Always ZP
	adc	$8080	; Always !ZP
	adc	fwd_80	; Always ZP - sure after 2nd pass onwards
	adc	fwd_101	; Initially ZP - sure !ZP after 2nd pass onwards
	option	-zero-page


addr_mode_tests:	; Uncomment to test
	option	+zero-page
	; adc	$4400	; Outside of ZP
	option	-zero-page
	; adc	$4400,z	; Unknown index reg
	; adc	($44,y) ; Wrong indirect reg
	; adc	($44),x ; Wrong indirect reg

and_test
	and #$44
	and $44
	and $44,x
	and $4400
	and $4400,x
	and $4400,y
	and ($44,x)
	and ($44),y

asl_test
	ASL A
	ASL $44
	ASL $44,X
	ASL $4400
	ASL $4400,X

bit_test
	BIT $44
	BIT $4400

branch_test
	BPL branch_test
	BMI branch_test
	BVC branch_test
	BVS branch_test
	BCC branch_test
	BCS branch_test
	BNE branch_test
	BEQ branch_test

	BPL brk_test
	BMI brk_test
	BVC brk_test
	BVS brk_test
	BCC brk_test
	BCS brk_test
	BNE brk_test
	BEQ brk_test

	; BEQ zero		; Would generate an error/warning
	; BEQ $f000		; Would generate an error/warning

brk_test
    	BRK

cmp_test
.acc
	CMP #$44
	CMP $44
	CMP $44,X
	CMP $4400
	CMP $4400,X
	CMP $4400,Y
	CMP ($44,X)
	CMP ($44),Y

.xreg
	CPX #$44
	CPX $44
	CPX $4400

 
.yreg
	CPY #$44
	CPY $44
	CPY $4400

dec_test
	DEC $44
	DEC $44,X
	DEC $4400
	DEC $4400,X

 

eor_test
	EOR #$44
	EOR $44
	EOR $44,X
	EOR $4400
	EOR $4400,X
	EOR $4400,Y
	EOR ($44,X)
	EOR ($44),Y

flag_test
	CLC
	SEC
	CLI
	SEI
	CLV
	CLD
	SED

inc_test
	INC $44
	INC $44,X
	INC $4400
	INC $4400,X
 

jmp_test
	JMP $5597
	JMP ($5597)

jsr_test
	JSR $5597

ld_test
.acc
	LDA #$44
	LDA $44
	LDA $44,X
	LDA $4400
	LDA $4400,X
	LDA $4400,Y
	LDA ($44,X)
	LDA ($44),Y

.xreg
	LDX #$44
	LDX $44
	LDX $44,Y
	LDX $4400
	LDX $4400,Y

.yreg
	LDY #$44
	LDY $44
	LDY $44,X
	LDY $4400
	LDY $4400,X

lst_test

	LSR A
	LSR $44
	LSR $44,X
	LSR $4400
	LSR $4400,X

nop_test

	NOP

ora_test
	ORA #$44
	ORA $44
	ORA $44,X
	ORA $4400
	ORA $4400,X
	ORA $4400,Y
	ORA ($44,X)
	ORA ($44),Y

xfer_test
	TAX
	TXA
	DEX
	INX
	TAY
	TYA
	DEY
	INY
 

rol_test
	ROL A
	ROL $44
	ROL $44,X
	ROL $4400
	ROL $4400,X

rot_test
	ROR A
	ROR $44
	ROR $44,X
	ROR $4400
	ROR $4400,X

ret_test
	RTI
	rts

sbc_test
	SBC #$44
	SBC $44
	SBC $44,X
	SBC $4400
	SBC $4400,X
	SBC $4400,Y
	SBC ($44,X)
	SBC ($44),Y

store_test
.acc
	STA $44
	STA $44,X
	STA $4400
	STA $4400,X
	STA $4400,Y
	STA ($44,X)
	STA ($44),Y

.xreg
	STX $44
	STX $44,Y
	STX $4400
 
.yreg
	STY $44
	STY $44,X
	STY $4400

stack_test
	TXS
	TSX
	PHA
	PLA
	PHP
	PLP

fwd_80:	equ	$80
fwd_101	equ	$101