From 35ec39e13fbb353873f8dfc4ce348531cd2c6e59 Mon Sep 17 00:00:00 2001 From: "Satoshi N. M" Date: Sat, 13 Jan 2018 10:49:44 -0800 Subject: [PATCH] Fix ACIA status/control register, they share the same address (0xa000) --- src/acia6850.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/acia6850.c b/src/acia6850.c index 957ad40..f5b7851 100644 --- a/src/acia6850.c +++ b/src/acia6850.c @@ -13,17 +13,15 @@ extern usbd_device *usbd_dev; // #define ACIAControl 0 -#define ACIAStatus 1 -#define ACIAData 2 +#define ACIAStatus 0 +#define ACIAData 1 // "MC6850 Data Register (R/W) Data can be read when Status.Bit0=1, and written when Status.Bit1=1." -#define RDRF 1 -#define TDRE 2 +#define RDRF (1 << 0) +#define TDRE (1 << 1) uint8_t read6850(uint16_t address) { - switch(address & 3) { - case ACIAControl: - break; + switch(address & 1) { case ACIAStatus: return TDRE; // writable break; @@ -38,13 +36,10 @@ uint8_t read6850(uint16_t address) { } void write6850(uint16_t address, uint8_t value) { - switch(address & 3) { + switch(address & 1) { case ACIAControl: // TODO: decode baudrate, mode, break control, interrupt break; - case ACIAStatus: - (void) value; - break; case ACIAData: { static char buf[1]; buf[0] = value;