aboutsummaryrefslogtreecommitdiff
path: root/c64/cia.h
diff options
context:
space:
mode:
authorReiner Herrmann <reiner@reiner-h.de>2012-02-10 14:25:38 +0100
committerReiner Herrmann <reiner@reiner-h.de>2012-02-10 14:25:38 +0100
commita5d7e68af96d9b62821d8fd47f5039c5bae5d421 (patch)
treeab7d1a70312afb74dc7184d8b269b08f332f4b74 /c64/cia.h
added original sam_player code
Diffstat (limited to 'c64/cia.h')
-rw-r--r--c64/cia.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/c64/cia.h b/c64/cia.h
new file mode 100644
index 0000000..8272c25
--- /dev/null
+++ b/c64/cia.h
@@ -0,0 +1,55 @@
+// cia.h
+//
+// 20060803 Markku Alén
+
+#ifndef __CIA_H__
+#define __CIA_H__ 1
+
+typedef struct __cia_interrupt
+{
+ int mask;
+ int request;
+}cia_interrupt_t;
+
+typedef struct __cia_port
+{
+ int pins;
+ int input;
+ int output;
+ int direction;
+}cia_port_t;
+
+#define UPDATE_CIA_PORT_PINS(CIA_PORT) ((CIA_PORT)->pins = ((CIA_PORT)->output & (CIA_PORT)->direction) | ((CIA_PORT)->input & ~((CIA_PORT)->direction)))
+
+typedef struct __cia_timer
+{
+ int latch;
+ int counter;
+ int running;
+ int toggle_mode;
+ int one_shot;
+ cia_interrupt_t interrupt;
+}cia_timer_t;
+
+typedef struct __cia
+{
+ cia_port_t port_a, port_b;
+ cia_timer_t timer_a, timer_b;
+ int inmode_a, inmode_b;
+ int irq_pin;
+}cia_t;
+
+void cia_init(cia_t *cia);
+
+int cia_read(cia_t *cia, int address);
+void cia_write(cia_t *cia, int address, int data);
+
+int cia_a_port_output(cia_t *cia);
+int cia_b_port_output(cia_t *cia);
+
+void cia_port_a_input(cia_t *cia, int data);
+void cia_port_b_input(cia_t *cia, int data);
+
+void cia_exec(cia_t *cia, unsigned int cycles);
+
+#endif