I ran into an issue with interfacing the HD44780. It turns out that even though the HD44780 is often called a Motorola bus peripheral, it is not actually a Motorola bus peripheral. It is actually designed for the MCS-51 series of microcontrollers. Just because it has E and R/W pins doesn't mean it is a Motorola bus peripheral. So I am going to have to use a MC6821 PIA to control the LCD. This also means I will likely have to add another PIA for the keyboard. The two PIAs are going to cause the size of the PCB to increase considerably.
I have written some code to test the PIA:
STACK = $80100 ; top of stack PORTA = $E0000 ; MC6821 Peripheral Register A CTRLA = $E0001 ; MC6821 Control Register A PORTB = $E0002 ; MC6821 Peripheral Register B CTRLB = $E0003 ; MC6821 Control Register B _start:: jmp piatest ; run the PIA test ; outputs 0 to 255 to PORTA of the PIA piatest:: move.l #STACK,a7 ; initialize stack move.b #$00,CTRLA ; select DDRA move.b #$FF,PORTA ; port A is output move.b #$04,CTRLA ; select PORTA eor.l d0,d0 ; clear d0 .ledcycle: move.b d0,PORTA ; write d0 to PORTA add.b #1,d0 ; d0 = d0 + 1 jmp .ledcycle ; repeat