From a5d7e68af96d9b62821d8fd47f5039c5bae5d421 Mon Sep 17 00:00:00 2001 From: Reiner Herrmann Date: Fri, 10 Feb 2012 14:25:38 +0100 Subject: added original sam_player code --- c64/cia.h | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 c64/cia.h (limited to 'c64/cia.h') 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 -- cgit v1.2.3