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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
// license:BSD-3-Clause
// copyright-holders:AJR
/**********************************************************************
RST interrupt vector buffer
**********************************************************************/
#pragma once
#ifndef MAME_DEVICES_MACHINE_RSTBUF_H
#define MAME_DEVICES_MACHINE_RSTBUF_H
//**************************************************************************
// CONFIGURATION MACROS
//**************************************************************************
#define MCFG_RST_BUFFER_INT_CALLBACK(_devcb) \
devcb = &downcast<rst_buffer_device &>(*device).set_int_callback(DEVCB_##_devcb);
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
// ======================> rst_buffer_device
class rst_buffer_device : public device_t
{
public:
// configuration
template<class Object> devcb_base &set_int_callback(Object &&object) { return m_int_cb.set_callback(std::forward<Object>(object)); }
// getter (required override)
virtual u8 get_vector() const = 0;
// INTA handler
IRQ_CALLBACK_MEMBER(inta_cb);
protected:
// device base class constructor
rst_buffer_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock);
// device-level overrides
virtual void device_resolve_objects() override;
virtual void device_start() override;
// synchronization helpers
void sync_input(bool state, u8 mask);
TIMER_CALLBACK_MEMBER(sync_set_input);
TIMER_CALLBACK_MEMBER(sync_clear_input);
// interrupt output callback
devcb_write_line m_int_cb;
// input state (D3-D5 of interrupt vector)
u8 m_input_buffer;
};
// ======================> rst_pos_buffer_device
class rst_pos_buffer_device : public rst_buffer_device
{
public:
// device constructor
rst_pos_buffer_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
// set RST 1/RST 08H request line (modifies bit 3 of vector)
DECLARE_WRITE_LINE_MEMBER(rst1_w) { sync_input(state, 0x08); }
// set RST 2/RST 10H request line (modifies bit 4 of vector)
DECLARE_WRITE_LINE_MEMBER(rst2_w) { sync_input(state, 0x10); }
// set RST 3/RST 20H request line (modifies bit 5 of vector)
DECLARE_WRITE_LINE_MEMBER(rst4_w) { sync_input(state, 0x20); }
protected:
// getter (required override)
virtual u8 get_vector() const override { return 0xc7 | m_input_buffer; }
};
// ======================> rst_neg_buffer_device
class rst_neg_buffer_device : public rst_buffer_device
{
public:
// device constructor
rst_neg_buffer_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
// set RST 30H request line (modifies bit 3 of vector)
DECLARE_WRITE_LINE_MEMBER(rst30_w) { sync_input(state, 0x08); }
// set RST 28H request line (modifies bit 4 of vector)
DECLARE_WRITE_LINE_MEMBER(rst28_w) { sync_input(state, 0x10); }
// set RST 18H request line (modifies bit 5 of vector)
DECLARE_WRITE_LINE_MEMBER(rst18_w) { sync_input(state, 0x20); }
protected:
// getter (required override)
virtual u8 get_vector() const override { return 0xff ^ m_input_buffer; }
};
// device type definitions
DECLARE_DEVICE_TYPE(RST_POS_BUFFER, rst_pos_buffer_device)
DECLARE_DEVICE_TYPE(RST_NEG_BUFFER, rst_neg_buffer_device)
#endif // MAME_DEVICES_MACHINE_RSTBUF_H
|