Hi!
CaptainCulry wrote:
Just to be clear, the 6502 is not going to be reading anything from the UART. This is just going to be outputting the train animation with no user interaction. Later if this computer generates any excitement, and I come up with another idea for this, I may remap the memory, rebuild the machine a bit different, and do something else.
Then, you don't need an UART, you can simply shift the bits via software.
In fact, being a little clever, you don't even need RAM, and can use the R/W line to simply latch a data bit as the serial output. Without RAM you can't do subroutines, but you can use X and Y registers as counters and do a simple loop like:
Code:
; Output data from D0, clocked via (R/W NOR Phi2) signal:
start_loop:
ldy #0 ; Only need to initialize Y once
; This loop outputs the bytes from $E000 to $E0FF serially:
loop1:
ldx #9
stx $00 ; Output start bit == 1
lda $e000, y ; 4 cycles
stx $00 ; burns 3 more cycles
; 10 cycles per bit, so a 1.152MHz clock would
; output at exactly 115200 baud:
bit1:
sta $00 ; Output bit #N
asl ; shift bits
dex
bne bit1
iny
bne loop1 ; Transmit next byte
; Now, the same for bytes from $E100 to $E1FF:
loop2:
ldx #9
stx $00
lda $e100, y
stx $00
bit2:
sta $00
asl
dex
bne bit2
iny
bne loop2
; And so on for the rest of the bytes!
; ........
;
; At the end, simply go to the start again
jmp start_loop
Note that for decoding the output bytes, you only need a D flip-flop clocked by ( RW NOR Phi2 ), then you have 8 output lines that change on any write.