Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

6502 02 58 f3 case doesn't match Visual 6502 #75

Open
tom-seddon opened this issue Jan 18, 2024 · 3 comments
Open

6502 02 58 f3 case doesn't match Visual 6502 #75

tom-seddon opened this issue Jan 18, 2024 · 3 comments

Comments

@tom-seddon
Copy link

{ "name": "02 35 44", "initial": { "pc": 1837, "s": 197, "a": 33, "x": 239, "y": 61, "p": 108, "ram": [ [1837, 2], [1838, 53], [1839, 68]]}, "final": { "pc": 1837, "s": 197, "a": 33, "x": 239, "y": 61, "p": 108, "ram": [ [1837, 2], [1838, 53], [1839, 68]]}, "cycles": [ [1837, 2, "read"], [1838, 53, "read"], [1838, 53, "read"]] }

It suggests there should be a read from the PC on the 3rd cycle, but the bus activity in Visual 6502 shows a read from $ffff:

cycle	ab	db	rw	Fetch	pc	a	x	y	s	p
0	0000	02	1	unknown	0000	aa	00	00	fd	nv‑BdIZc
0	0000	02	1	unknown	0000	aa	00	00	fd	nv‑BdIZc
1	0001	58	1		0001	aa	00	00	fd	nv‑BdIZc
1	0001	58	1		0001	aa	00	00	fd	nv‑BdIZc
2	ffff	00	1		0002	aa	00	00	fd	nv‑BdIZc
2	ffff	00	1		0002	aa	00	00	fd	nv‑BdIZc

Then 2 reads from fffe, and then endless ffff.

cycle	ab	db	rw	Fetch	pc	a	x	y	s	p
3	fffe	00	1		0002	aa	00	00	fd	nv‑BdIZc
3	fffe	00	1		0002	aa	00	00	fd	nv‑BdIZc
4	fffe	00	1		0002	aa	00	00	fd	nv‑BdIZc
4	fffe	00	1		0002	aa	00	00	fd	nv‑BdIZc
5	ffff	00	1		0002	aa	00	00	fd	nv‑BdIZc
5	ffff	00	1		0002	aa	00	00	fd	nv‑BdIZc
6	ffff	00	1		0002	aa	00	00	fd	nv‑BdIZc
6	ffff	00	1		0002	aa	00	00	fd	nv‑BdIZc
7	ffff	00	1		0002	aa	00	00	fd	nv‑BdIZc
7	ffff	00	1		0002	aa	00	00	fd	nv‑BdIZc
8	ffff	00	1		0002	aa	00	00	fd	nv‑BdIZc
8	ffff	00	1		0002	aa	00	00	fd	nv‑BdIZc
9	ffff	00	1		0002	aa	00	00	fd	nv‑BdIZc
9	ffff	00	1		0002	aa	00	00	fd	nv‑BdIZc
10	ffff	00	1		0002	aa	00	00	fd	nv‑BdIZc
10	ffff	00	1		0002	aa	00	00	fd	nv‑BdIZc
11	ffff	00	1		0002	aa	00	00	fd	nv‑BdIZc
11	ffff	00	1		0002	aa	00	00	fd	nv‑BdIZc
12	ffff	00	1		0002	aa	00	00	fd	nv‑BdIZc
12	ffff	00	1		0002	aa	00	00	fd	nv‑BdIZc
13	ffff	00	1		0002	aa	00	00	fd	nv‑BdIZc
13	ffff	00	1		0002	aa	00	00	fd	nv‑BdIZc
14	ffff	00	1		0002	aa	00	00	fd	nv‑BdIZc
```
@tom-seddon
Copy link
Author

A longer trace with the $02 at $0180 - suggesting the program counter doesn't affect the addresses read.

cycle ab db rw Fetch pc a x y s p
0 0000 a9 1 LDA # 0000 aa 00 00 fd nv‑BdIZc
0 0000 a9 1 LDA # 0000 aa 00 00 fd nv‑BdIZc
1 0001 00 1   0001 aa 00 00 fd nv‑BdIZc
1 0001 00 1   0001 aa 00 00 fd nv‑BdIZc
2 0002 4c 1 JMP Abs 0002 00 00 00 fd nv‑BdIZc
2 0002 4c 1 JMP Abs 0002 00 00 00 fd nv‑BdIZc
3 0003 80 1   0003 00 00 00 fd nv‑BdIZc
3 0003 80 1   0003 00 00 00 fd nv‑BdIZc
4 0004 01 1   0004 00 00 00 fd nv‑BdIZc
4 0004 01 1   0004 00 00 00 fd nv‑BdIZc
5 0180 02 1 unknown 0180 00 00 00 fd nv‑BdIZc
5 0180 02 1 unknown 0180 00 00 00 fd nv‑BdIZc
6 0181 58 1   0181 00 00 00 fd nv‑BdIZc
6 0181 58 1   0181 00 00 00 fd nv‑BdIZc
7 ffff 00 1   0182 00 00 00 fd nv‑BdIZc
7 ffff 00 1   0182 00 00 00 fd nv‑BdIZc
8 fffe 00 1   0182 00 00 00 fd nv‑BdIZc
8 fffe 00 1   0182 00 00 00 fd nv‑BdIZc
9 fffe 00 1   0182 00 00 00 fd nv‑BdIZc
9 fffe 00 1   0182 00 00 00 fd nv‑BdIZc
10 ffff 00 1   0182 00 00 00 fd nv‑BdIZc
10 ffff 00 1   0182 00 00 00 fd nv‑BdIZc
11 ffff 00 1   0182 00 00 00 fd nv‑BdIZc
11 ffff 00 1   0182 00 00 00 fd nv‑BdIZc
12 ffff 00 1   0182 00 00 00 fd nv‑BdIZc
12 ffff 00 1   0182 00 00 00 fd nv‑BdIZc
13 ffff 00 1   0182 00 00 00 fd nv‑BdIZc
13 ffff 00 1   0182 00 00 00 fd nv‑BdIZc
14 ffff 00 1   0182 00 00 00 fd nv‑BdIZc

@fuel-pcbox
Copy link

on an original MOS 6502, the 02 opcode is KIL, which glitches the CPU and forces a hard reset. That's why Visual 6502 is showing a difference.

@tom-seddon
Copy link
Author

My real hardware is packed away but I'm 99% certain there is no reset when executing 02. The CPU appears to get stuck.

I'd expect visual6502 to be accurate, so my assumption is that this is a bug in the test suite?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants