Advanced 6502
(C) - André Fachat
Table of content
Quickfinder
- The 65k project - In the 65k project I defined an extended set of opcodes and features for a 6502 that uses up to 64 bit registers, while still being - at least software-wise - upward-compatible with the original 6502. I plan to put it into VHDL and really use it, but that has not started (yet).
- PET816 - The PET816 board replaces the 6502 in a normal 6502 computer with a 65816 board. The 65816 can be clocked up to 10 MHz, using the additional RAM that is on the board - making for a really fast PET. With different memory selection logic in the used CPLD it could be used for other 6502 systems like the VIC20, or maybe even a 6502-based Apple or Atari computer.
- CS/A65 - The CS/A65 computer in various ways go "beyond" the original 6502 concept. That this is possible is actually a sign for how flexible the simple 6502 basic design is. The CS/A65 CPU board in itself can be seen as an extended 6502. It extends the core with an MMU to get more address lines, but also with write-protected memory, no-execute bits, or page faults for non-mapped memory blocks. The Auxiliary CPU then provides a CPU that can actually correct the memory faults while the main CPU is halted - coming from the fact that the original 6502 lacks an ABORT signal that the 65816 has. The coprocessor board then is the first step into non-uniform-memory-access (NUMA) multiprocessing. Finally the CPU emulator board allows to replace the 6502 in a normal system with a connection to the CS/A computer - where the 64k of the emulated system just becomes a 64k windows in the CS/A65 1 MByte address space.
This section contains links to various projects of other people that extended the 6502
65GZ032
With the 65GZ032 Gideo Zweijtzer has built a VHDL core that is 6502 compatible, but extends the 8 bit core with a 32 bit design. From the programmers reference manual:
- Full 32 bit design
- Pipelined RISC architecture, with instruction and data caches
- Eight 32 bit registers (five are all-purpose) and one 16 bit register
- Several new opcodes
- New addressing modes
- Highly orthogonal architecture (very few fixed function registers)
- Can access 4GB of linear memory (no segments, bank switching, etc)
- Built-in paged memory management unit
- Much higher clock speeds (33 MHz)
The processor is able to operate on 8, 16, and 32 bit wide operands, address and data busses are 32 bit each. The 65GZ032 opcodes are interleaved with the 6502 opcodes in that the first byte has to lowest two bits set - which are all illegal opcodes in the 6502 - and a second opcode bytes then gives an opcode space of 14 bit, i.e. 16384 possible native instructions. 6502 opcodes are translated into one or two of the CPU's 32 bit native opcodes when the instruction is fetched.
The CPU has been used in the C=1 system, but it is difficult to find further references anymore. According to the commodorefree interview with Gideo it may have been abandoned.
- 65GZ032 programmers reference (PDF)
- Hardware development (of the 65GZ032)
- Commodorefree interview with Gideon
KimKlone
The KimKlone is a very intersting 6502 extension. The system catches 65C02 undefined opcodes, and executes them aside the original processor. This way also the address space is extended to 24 bit.
MyCPU
The MyCPU is a computer completely built from logic ICs - no highly integrated parts used! I.e. the processor consists of basically 74-series logic ICs plus a number of ROMs. The internals are 8 bit, as using wider busses and registers would have used many more parts.
The MyCPU computer is only barely fitting into this 6502 page - it is not binary compatible.
The processor has only 5 universal and 1 special purpose register: A, X, Y, P and SP are universal 8-bit registers, whereas the Program Counter (PC) is a special purpose 16-bit register whose contents can be incremented by one through a dedicated signal. The P-register is only an internal register used by the microcode to store temporary data and is not visible to assembly programs. In my implementation the microcode covers many commands and addressing modes of the good old 6502 processor, but MyCPU is not binary compatible to it.
As you can see from that description, the processor has nevertheless been inspired by the 6502.
In the meantime the author, Dennis Kuschel, has built a VHDL version of the MyCPU, built into a Xilinx Spartan3 FPGA, called "MyCPU Compact". The development is still ongoing!
M02
Dieter MÜ ller has built a 6502-compatible CPU from logic parts as well
65CE02
The 65CE02 was a modernization of the 6502, developed by Commodore itself back in the days
Ruud's Build your own 6502
Ruud Baltissen started work on a TTL6502
AppleCrate
The AppleCrate I and II are multi-processing machines built from Apple II boards.
- AppleCrate I with 8 processors
- AppleCrate II with 17 processors
- Micheal J. Mahon's further projects for example NadaNet
65el02
Eloraam has implemented a 6502 emulation in minecraft!
This 65el02 implements 6502 and 65C02 opcodes, part of the 65816 and own instructions. It adds a "D" registers that allows using multiply and divide opcodes
This section gives links and information about hardware- and software-based 6502 emulation projects. Most of these (so far) concern original 6502 compatible cores
AVR-based emulation
It has been shown that the 6502 can actually be emulated within an AVR microcontroller. 1MHz emulated speed has been achieved with 16MHz AVRs (in a simple emulated hardware setup).
- Mikrocontroller.net on 6502 emulation in AVRs (German)
- Thread on Mikrocontroller.net (in German) last post seems to contain code
- NES 6502 emulation in an ATMega
- 6502 emulation on AVR (on forum.6502.org)
- AVR-based Apple II emulator (on forum.6502.org)
NMOS-based emulation
Andrew Holme has managed to create a Verilog-based core using the actual NMOS transistor netlist from visual6502.org!
Here are some links to general 6502 and beyond information
- Digging into Technology's Past - History of the 6502
- The 6502/65C02/65C816 instruction set decoded
- Programming the 65816 (PDF)
- How the illegal instructions really work
- A reengineered and visually simulated original 6502!
- 27C3 presentation on the visual6502 reverse engineering process
- Reverse Engineering the 6502 A presentation of visual6502 from the 27C3 conference in december 2010
- The ROR bug in early 6502 revisions!
- 6502.org forum: A taken branch delays interrupt handling by one instruction...
- 6502.org forum: Improving the 6502, some ideas...
- 6502.org forum: Prefix bytes: an idea for 65Org816...
- Admired designs...
- The 6502 decimal flag
- Experience from writing a 6502 core
- The Steckschwein - a 6502 in a plugboard (in German)
- The L-Star - a software-defined 6502 computer
Some links about other, non-6502 compatible (homebrew) CPUs
Disclaimer
Last modified: 2020-10-29