summaryrefslogtreecommitdiff
path: root/emu/7seg.h
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2020-11-26 19:55:02 +0100
committerAndreas Baumann <mail@andreasbaumann.cc>2020-11-26 19:55:02 +0100
commit3d77f3f5ad41e931117425f58c74f49c9503bf7b (patch)
tree8165c8f10a1b3b3cec27cfb283ee218e7af3a519 /emu/7seg.h
parent394c9fbb6cc243e46b32aa9e7221b0e6cadd4c13 (diff)
download6502-3d77f3f5ad41e931117425f58c74f49c9503bf7b.tar.gz
6502-3d77f3f5ad41e931117425f58c74f49c9503bf7b.tar.bz2
more work on emulator, mainly debug and 7seg stuff
Diffstat (limited to 'emu/7seg.h')
-rw-r--r--emu/7seg.h38
1 files changed, 34 insertions, 4 deletions
diff --git a/emu/7seg.h b/emu/7seg.h
index c49a8a1..0cd585f 100644
--- a/emu/7seg.h
+++ b/emu/7seg.h
@@ -1,12 +1,42 @@
-#ifndef 7_SEG_H
-#define 7_SEG_H
+#ifndef SEG7_H
+#define SEG7_H
#ifdef WITH_GUI
#include <SDL.h>
#endif
-typedef struct 7seg_t
+#include <stdint.h>
+#include <stdbool.h>
+
+// VIA connected on PORTA to 3 wires leading to the 3 coupled 74HC595
+// shift register which enable the ROM address lines to read the LED
+// segment data (cells 0-15 contain the encoded 7 segments of 16 hexdigits)
+//
+// PORTA connected as follows:
+// xxxxx111
+// +--- SER
+// +---- RCLK
+// +----- SRCLK
+enum {
+ PORTA = 0x6001,
+ DDRA = 0x6003,
+
+ SER = 0x01,
+ RCLK = 0x02,
+ SRCLK = 0x04
+};
+
+typedef struct seg7_t
{
-} 7seg_t;
+ uint8_t ddr;
+ uint16_t shift;
+ uint16_t latch;
+
+ bool debug;
+} seg7_t;
+
+void seg7_init( seg7_t *seg );
+uint8_t seg7_read( seg7_t *seg, uint16_t addr );
+void seg7_write( seg7_t *seg, uint16_t addr, uint8_t data );
#endif