I decided to take a pause from routing and look at 65C02 compatibility. Realistically, this is the last opportunity to add any significant changes to the hardware before working on the ALU&CU card, so it's a good time to make final decisions. My primary target is the Commodore 64, which of course uses the NMOS chip. Nevertheless, it would be nice to have this CPU be able to live alongside newer designs which use the 65C02.
It turns out that the majority of 65C02 instructions can be implemented with only microcode changes on the existing hardware (BRA INC/DEC A, zp addressing mode, etc). Similarly, I already have hardware in place to correctly add an extra cycle in decimal mode to produce valid flags. TRB and TSB can also be managed largely in microcode, but do require the ability to set only the Z flag after an ALU operation. Currently Z is always set alongside N so this needs to change. I'm out of room on the SF.MX decoder that controls the flags so some re-working will be necessary. But this seems fairly manageable. (For example, SEI and CLD can be combined and we can then use the "65C02 mode" jumper to control whether a CLD is performed during interrupt service routines. Other optimizations are possible as well).
RMB and SMB require the addition of a decoder (74138) to map bits 4, 5 and 6 of the Opcode to the correct bit in an 8 bit mask. We can then use the ALU to invert the mask as necessary to set or reset bits (with OR and AND operations respectively). BBR and BBS require a 74151 controlled by bits 4, 5 and 6 of the opcode to select the right bit in the operand for the branch test. Once again, the ALU can be used to invert the operand as necessary for Set vs Reset. The output of the 74151 can then be combined with the existing branch test logic for the other flags and fed directly into the sequencer at that point.
And I think that's it for hardware mods. All in all, it seems well worth the effort. Of course, I was hoping any changes could be done on the as-yet-to-be routed ALU & CU card alone but a few (small) changes to the Registers card are required (mainly the 74138 bit mask generator needs to go there). Once again, I'm faced with some re-routing on that board.
but I will just have to grin and bear it.
One question is whether to implement STP, WAI or the VPB and MLB pins. I have also left the SO pin un-implemented for that matter. My assumption is that these functions are seldom used and can therefore be safely left out. I may be way off base on that though, so I would appreciate any feedback on that score.
Thanks in advance for any thoughts or comments.
Regards,
Drass.