From 83cfce2960ad8a4705c564dffc7a3d884dc58e86 Mon Sep 17 00:00:00 2001 From: Gregor Riepl Date: Fri, 19 Aug 2022 15:03:38 +0200 Subject: [PATCH] Use VIA T2, implment output --- driver.a65 | 118 +++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 93 insertions(+), 25 deletions(-) diff --git a/driver.a65 b/driver.a65 index ea548bf..2e17dd6 100644 --- a/driver.a65 +++ b/driver.a65 @@ -24,6 +24,7 @@ BAUD_RATE = 300 ; we expect to be loaded somewhere in the middle of user ram ; TODO verify if this is safe with the Editor/Basic 2.0 ROM +; or if there is a way to limit memory usage by the ROM .org $7000 ; entry points @@ -67,7 +68,7 @@ BAUD_RATE = 300 initialized: .byte 0 ; saved IRQ vector oldvector: .word 0 - ; current CRA value on CA1 change (bit contains the state of CA1) + ; state of the CA1 input: bit2=0 low level, bit2=1 high level ca1state: .byte 0 ; output buffer ; this is 16bit, because we need to process start and stop bits as well @@ -115,14 +116,19 @@ BAUD_RATE = 300 sta IRQVec lda #period sta VIA_T1CL lda # high byte -> carry + lsr outbuf+1 + ; carry -> low byte + ror outbuf + + ; decrement counter + dec outshift + + @shiftin: + ; TODO process input bit-bang + @storein: + ; TODO process input fifo @irqreturn: ; restore registers