go6502 icon indicating copy to clipboard operation
go6502 copied to clipboard

cpu: add basic support for some 65C02 opcodes

Open rjw57 opened this issue 10 years ago • 4 comments

This is very much a RFC rather than something which is finished and proposed for merging. I've got my own 6502 homebrew project at https://github.com/rjw57/buri and I make use of the 65C02 instructions such as PHX, PHY, etc.

This commit adds just enough support to boot the 65C02 ROM image I have. This is a work-in-progress change and is not complete 65C02 support by any means.

My question is: is this worth pursuing further? Would you be interested in 65C02 support? If so, would you want some form of configuration allowing 65C02-support to be switched on/off?

rjw57 avatar Apr 15 '15 16:04 rjw57

is this worth pursuing further? Would you be interested in 65C02 support?

Absolutely, thanks for getting it started.

If so, would you want some form of configuration allowing 65C02-support to be switched on/off?

That would be a “nice to have” — I like the idea of a mode to verify code runs on original NMOS hardware, but not worth doing if it's going to add too much complexity.

A tangent of that question would be whether to support commonly used illegal instructions. Aiming for a “pure 6502” mode which doesn't support the original illegal instructions would feel half-done.

The main use-case of this project is software development/debugging for 65C02-based homebrew computers, so it's probably fine to unconditionally support 65C02 instructions.

pda avatar Apr 15 '15 19:04 pda

The main use-case of this project is software development/debugging for 65C02-based homebrew computers, so it's probably fine to unconditionally support 65C02 instructions.

It certainly makes it easier to do in that case. I'll keep the new instructions obvious in the source so if there is some configuration later it should be easy enough to add. As you say, it's mostly useful for us homebrew-ers :).

rjw57 avatar Apr 15 '15 20:04 rjw57

@pda OK, I've added the remaining new instructions and additional addressing modes. This is probably ready to merge.

rjw57 avatar Apr 16 '15 10:04 rjw57

@pda I've been moving forward with my own simulator and found a few bugs/omissions in go6502. I've added them to this PR although they're not strictly speaking 65C02 compatibility. The most serious bug is that PLA did not set the N or Z status flags which breaks Enhanced BASIC.

rjw57 avatar Apr 21 '15 21:04 rjw57