Up until now the computer was run either by a fairly slow 555 timer or even slower single stepping. This was possible because the WDC-65C02, unlike the R-65C02, can be run by any clock from 0 … 14MHz. It's time to speed things up. Not to the full 14MHz — that might cause problems on a breadboard. Because of this only a 1 MHz oscillator is used.
Unlike Ben Eater I permanently attached the clock module to the system so it's always ready if some debugging is needed. I also added a helpful jumper cable to quickly change between the crystal oscillator and the clock module:
I have ordered a switch to be places where the jumper cable is currently for even more convenient switching. Next an update of the software is needed as the computer is now a lot faster than the display clear operation. And for all other operations it's right at the border. Best to add a busy check to all display operations:
;;
; Wait for instruction to finish
;
.proc Wait
PHA
VIA_Set_B #%00000000 ; Set Port B to all input
Busy: VIA_Out_A #LCD::RW ; Start LCD read operation.
VIA_Out_A #(LCD::RW | LCD::E) ; Enable Output if LCD status
BIT VIA::IRB
BMI Busy
VIA_Out_A #LCD::RW ; End LCD read operation
VIA_Set_B #%11111111 ; Set Port B to all output
PLA
RTS
.endproc
Using .proc and .endproc makes the Busy label local so it won't conflict with any future subroutine. Ben Eater also uses LDA and AND to check the busy flag. But that's not needed.
You find the source code for the LCD macro on GitLab: 6502Tutorial — Kit/Library.