The idea for this design was born at the end of januari (2023).
While many homebuilt CPU's have their own, unique instruction set, I decided that for this project the CPU would use an existing instruction set. Also, I wanted to build the computer from parts of the TTL family. That are integrated circuits, that can perform elementary logic functions. They were first used in the 60's of the previous age. I use a modern version of these circuits, that use less power.
So which instruction set to use ? The CPU inside your laptop or cellphone is much, much too complex to build. But it is possible to use an older CPU from the time when microprocessors just became available. There were two processors that can be regarded as the Beetle and the Deux Cheveaux of the beginning of the homecomputer age.
The 6502 is famous because it was the heart of the Apple 1, the Apple ] [, the Commodore 64, the Nintendo NES and many others. The Z80 is well known because it was used in the TRS-80 and the ZX Spectrum.
So now, I had to decide whether to use the instruction set of the 6502 or that of the Z80. But then I thought... why not build a CPU that can do both ?
I did spend a few months searching for a good design that would give good performance while not using too many parts. I think the basic design is stable now (end of march). I can now start with the details of the design.
Here comes the system diagram of the CPU. All arrows and buses represent 8 wires, that means that the information flows through the processor in units of 8 bits (a Byte).
I might as well start with explaining some of the parts.
- PCH/PCL (program counter high byte and low byte)
- A (Accumulator)
- T (Temporary register)
- DPH/DPL (Data pointer high byte and low byte)
- IR (Instruction register)
- CGH Constant generator, generates only 0 (mainly for zpage addressing)
- CGL Constant generator for small integer values
- MBANK Bank selection system
You will miss the 6502 registers S (stack pointer) and the index registers X and Y. And you will miss the long list of registers that are inside a Z80 CPU. Those registers are in memory. A special memory section (outside the normal 64K range) is used for the registers.
The control section will use microcode to run the whole show. The microcode has 8 pages, 1 page is needed for the 6502 and probably 4 will be needed for the Z80, and the software can switch between 6502 and Z80.
I hope to reach 6.25 MHz as clock frequency. This is actually a must, because this is 1/4 of the VGA video clock frequency.
For the 6502, the cpu will run many instructions in about the same number of clock cycles as a real 6502, but some instructions will take significantly more cycles. But since the clock frequency is higher, it will run programs faster than the original 2 MHz 6502.
For the Z80, most instructions will use less cycles, and a few will use more. Programs will run faster than on an original 4 MHz Z80.
The video output is directly generated by the CPU, so this will use a lot of CPU power. (As an option, a stand-alone video system could be used).
There will be some restrictions, decimal mode might not be implemented.
11. Video system