blob: 2da8ca41cfb8df40090fcd4e091d50d374c8296c (
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
85
86
|
// license:BSD-3-Clause
// copyright-holders:Miodrag Milanovic
/***************************************************************************
Generic 8bit and 16 bit latch devices
***************************************************************************/
#pragma once
#ifndef __GEN_LATCH_H__
#define __GEN_LATCH_H__
//**************************************************************************
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
#define MCFG_GENERIC_LATCH_8_ADD(_tag) \
MCFG_DEVICE_ADD(_tag, GENERIC_LATCH_8, 0)
#define MCFG_GENERIC_LATCH_16_ADD(_tag) \
MCFG_DEVICE_ADD(_tag, GENERIC_LATCH_16, 0)
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
// ======================> generic_latch_8_device
class generic_latch_8_device : public device_t
{
public:
// construction/destruction
generic_latch_8_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
DECLARE_READ8_MEMBER( read );
DECLARE_WRITE8_MEMBER( write );
DECLARE_WRITE8_MEMBER( preset_w );
DECLARE_WRITE8_MEMBER( clear_w );
DECLARE_WRITE_LINE_MEMBER( preset_w );
DECLARE_WRITE_LINE_MEMBER( clear_w );
protected:
virtual void device_start() override;
void sync_callback(void *ptr, INT32 param);
private:
UINT16 m_latched_value;
UINT8 m_latch_read;
};
// device type definition
extern const device_type GENERIC_LATCH_8;
// ======================> generic_latch_16_device
class generic_latch_16_device : public device_t
{
public:
// construction/destruction
generic_latch_16_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
DECLARE_READ16_MEMBER( read );
DECLARE_WRITE16_MEMBER( write );
DECLARE_WRITE16_MEMBER( preset_w );
DECLARE_WRITE16_MEMBER( clear_w );
DECLARE_WRITE_LINE_MEMBER( preset_w );
DECLARE_WRITE_LINE_MEMBER( clear_w );
protected:
virtual void device_start() override;
void sync_callback(void *ptr, INT32 param);
private:
UINT16 m_latched_value;
UINT8 m_latch_read;
};
// device type definition
extern const device_type GENERIC_LATCH_16;
#endif /* __GEN_LATCH_H__ */
|