Rather often we see mentions here of three main flavours of 6502 micro: The original NMOS 6502, the 65C02, and WDC's 65816.
Summary: with minimal effort, you can design with a 65816 and use it as a 6502. You get some benefits, which for simplicity you can choose to ignore, and you get the possibility of later using it to its full potential. This is a separate topic from making a native mode '816 system!
Longer (but not exhaustive!):
Rather too often we see confusion and misunderstanding about the similarities and differences, with the possible undesired result that the '816 is not being considered as a perfectly useful and acceptable choice, even - especially - in a 6502-like system running 6502 software.
I'd like to make it clear that the '816 is indeed a perfectly useful and acceptable choice - all points made to the opposite effect focus on differences which need not be material, or even visible.
At the electrical level, the pinout is slightly different, so you need an adapter or to adjust your SBC design a little. See
http://jefftranter.blogspot.co.uk/2012/ ... 6-cpu.html for pointers to a couple of adapter designs. See also
this topic.
Also at the electrical level, the databus is driven during phi1 to provide the upper 8 address bits - you can ignore these extra address bits if your design only needs 16, but there's the possibility of momentary contention if you have slow peripherals directly on the bus which are slow to stop driving. That could cause harmful noise on the supply, so use a '245 transceiver - unless you're prepared to investigate. [*]
At the software level, at reset the '816 is in "emulation mode" which behaves very much like a 65C02. The differences:
- you have some extra instructions available, which you can use or ignore
- columns 7 and F do not offer the additional bit setting, clearing, and testing instructions
In emulation mode you can run old or new software written for the 6502, so long as it doesn't make use of any undocumented (illegal) opcodes or the bitwise instructions SMB, RMB, BBS and BBR. Useful though these instructions are, they are not indispensable: workarounds will take a few more bytes and a few more cycles which only matters in extreme situations.
I hope the above establishes that the '816 is a valid near-substitute workalike for the 6502. See also
Brett Tabke's doc, section 4.
So, why would you choose an '816?
- perhaps you already have one.
- you might want to access up to 16Mbyte[*] memory using those 24-bit addressing modes available in 6502 mode.
- you like the B register and the XAB instruction.
- you like JSR (addr,X).
- you like TXY and TYX.
- you like having zero-page (Direct Page) relocatable (and you're OK with the lack of wraparound in this case.) [*]
- you like the stack-pointer-relative addressing modes [*]
- one day you might venture into the "native" mode with 16-bit modes for A, X, and Y, more convenient ways to access the 24-bit memory space, relocatable direct page and stack, block move instructions, and those odd PER, PEI, PEA instructions.
- you don't want to be put off by naysayers.
[*] More advanced points:
- the '816 has no SYNC pin, so either do without it or connect up VDA and VPA instead.
- you will not normally need to use VDA or VPA otherwise - most designs don't have any problem with the extra reads performed by RMW instructions.
- you can even run code in a high bank in emulation mode, if you have no interrupts or take special care to record the bank address and return to where you came from.
- you can switch to native mode temporarily, for example to do some 16-bit work or perform block moves, so long as you can disable interrupts or write native-mode handlers.
- just possibly you could use BE to help avoid bus contention without using a bus transceiver - see
here.
- the
65C265 SoC might be of interest to the adventurous - it's in a PLCC, has an '816 core, several I/O devices, and a non-multiplex databus.
Cheers
Ed
[*] Updated at various times in response to valued feedback. This head post may continue to change!