summaryrefslogtreecommitdiff
path: root/emu/6522.h
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2020-12-30 16:55:06 +0100
committerAndreas Baumann <mail@andreasbaumann.cc>2020-12-30 16:55:06 +0100
commitaff63a211e9b1e397adb9dce726d8153beb96dcd (patch)
tree28f5b85fde65cff328fad0ea1d24fe93e5678b2e /emu/6522.h
parent53569267c59204f56e4c0fddb669536d28706e5c (diff)
download6502-aff63a211e9b1e397adb9dce726d8153beb96dcd.tar.gz
6502-aff63a211e9b1e397adb9dce726d8153beb96dcd.tar.bz2
- 7seg is a subdevice of the VIA 6522 now, registering to
a small sub-bus
Diffstat (limited to 'emu/6522.h')
-rw-r--r--emu/6522.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/emu/6522.h b/emu/6522.h
new file mode 100644
index 0000000..853bd3e
--- /dev/null
+++ b/emu/6522.h
@@ -0,0 +1,46 @@
+#ifndef VIA_6522_H
+#define VIA_6522_H
+
+#include "device.h"
+#include "bus.h"
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#ifdef WITH_GUI
+#include <SDL.h>
+#endif
+
+// the VIA connects to sub-devices itself via the bus. It also
+// has things like timers and internal registers
+// the VIA is initialized with a base address, the addresses for
+// the registers are relative to this base.
+enum {
+ PORTA = 0x01,
+ DDRA = 0x03
+};
+
+typedef struct via_6522_t
+{
+ device_t base;
+
+ uint16_t addr;
+
+ uint8_t ddra;
+
+ bool debug;
+
+ bus_t bus;
+} via_6522_t;
+
+void via_6522_init( via_6522_t *via, uint16_t addr, bool initialize );
+void via_6522_register( via_6522_t *via, device_t *device );
+
+uint8_t via_6522_read( void *obj, uint16_t addr );
+void via_6522_write( void *obj, uint16_t addr, uint8_t data );
+#ifdef WITH_GUI
+void via_6522_draw( void *obj, SDL_Renderer *renderer );
+#endif
+void via_6522_deinit( void *obj );
+
+#endif