summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/machine/6526cia.h
blob: f8cea3d34aa77eb530545d5a8f30c0b5d29e9e46 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/**********************************************************************

    MOS 6526/8520 CIA interface and emulation

    This function emulates all the functionality of up to 2 MOS6526 or
    MOS8520 complex interface adapters.

**********************************************************************/

#ifndef __6526CIA_H__
#define __6526CIA_H__

#include "devcb.h"


/***************************************************************************
    MACROS
***************************************************************************/

#define CIA6526R1		DEVICE_GET_INFO_NAME(cia6526r1)
#define CIA6526R2		DEVICE_GET_INFO_NAME(cia6526r1)
#define CIA8520			DEVICE_GET_INFO_NAME(cia8520)

#define MDRV_CIA6526_ADD(_tag, _variant, _clock, _config) \
	MDRV_DEVICE_ADD(_tag, _variant, _clock) \
	MDRV_DEVICE_CONFIG(_config)

#define MDRV_CIA6526_REMOVE(_tag, _variant) \
	MDRV_DEVICE_REMOVE(_tag, _variant)

#define MDRV_CIA8520_ADD(_tag, _clock, _config) \
	MDRV_DEVICE_ADD(_tag, CIA8520, _clock) \
	MDRV_DEVICE_CONFIG(_config)

#define MDRV_CIA8520_REMOVE(_tag) \
	MDRV_DEVICE_REMOVE(_tag, CIA8520)



/***************************************************************************
    TYPE DEFINITIONS
***************************************************************************/

typedef struct _cia6526_interface cia6526_interface;
struct _cia6526_interface
{
	devcb_write_line irq_func;
	devcb_write_line pc_func;

	int tod_clock;

	struct
	{
		devcb_read8 read;
		devcb_write8 write;
	} port[2];
};


/***************************************************************************
    FUNCTION PROTOTYPES
***************************************************************************/

DEVICE_GET_INFO(cia6526r1);
DEVICE_GET_INFO(cia6526r2);
DEVICE_GET_INFO(cia8520);

/* configuration */
void cia_set_port_mask_value(const device_config *device, int port, int data);

/* reading and writing */
READ8_DEVICE_HANDLER( cia_r );
WRITE8_DEVICE_HANDLER( cia_w );
void cia_clock_tod(const device_config *device);
void cia_issue_index(const device_config *device);
void cia_set_input_cnt(const device_config *device, int data);
void cia_set_input_sp(const device_config *device, int data);

/* accessors */
UINT8 cia_get_output_a(const device_config *device);
UINT8 cia_get_output_b(const device_config *device);
int cia_get_irq(const device_config *device);

#endif /* __6526CIA_H__ */