summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/machine/upd4701.h
blob: cf3af3357d3383916b1a66bea4b08dc63bfd5f4a (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
/***************************************************************************

    NEC uPD4701

    Incremental Encoder Control

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

#ifndef __UPD4701_H__
#define __UPD4701_H__

#include "devlegcy.h"

/***************************************************************************
    MACROS / CONSTANTS
***************************************************************************/

class upd4701_device : public device_t
{
public:
	upd4701_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);

	void x_add( INT16 data );
	void y_add( INT16 data );
	void switches_set( UINT8 data );

	DECLARE_WRITE_LINE_MEMBER( cs_w );
	DECLARE_WRITE_LINE_MEMBER( xy_w );
	DECLARE_WRITE_LINE_MEMBER( ul_w );
	DECLARE_WRITE_LINE_MEMBER( resetx_w );
	DECLARE_WRITE_LINE_MEMBER( resety_w );

	DECLARE_READ16_MEMBER( d_r );
	DECLARE_READ_LINE_MEMBER( cf_r );
	DECLARE_READ_LINE_MEMBER( sf_r );

protected:
	// device-level overrides
	virtual void device_config_complete();
	virtual void device_start();
	virtual void device_reset();
private:
	// internal state
	int m_cs;
	int m_xy;
	int m_ul;
	int m_resetx;
	int m_resety;
	int m_latchx;
	int m_latchy;
	int m_startx;
	int m_starty;
	int m_x;
	int m_y;
	int m_switches;
	int m_latchswitches;
	int m_cf;
};

extern const device_type UPD4701;


#define MCFG_UPD4701_ADD(_tag) \
	MCFG_DEVICE_ADD(_tag, UPD4701, 0)

#endif  /* __UPD4701_H__ */