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
108
109
110
111
112
|
// license:BSD-3-Clause
// copyright-holders:Sergey Svishchev
/*********************************************************************
nippelclock.c
Implementation of the Nippel Clock card for Agat.
https://archive.org/details/Nippel_Clock_Agat
*********************************************************************/
#include "emu.h"
#include "nippelclock.h"
/***************************************************************************
PARAMETERS
***************************************************************************/
//**************************************************************************
// GLOBAL VARIABLES
//**************************************************************************
DEFINE_DEVICE_TYPE(A2BUS_NIPPELCLOCK, a2bus_nippelclock_device, "nclock", "Nippel Clock")
/***************************************************************************
FUNCTION PROTOTYPES
***************************************************************************/
//-------------------------------------------------
// device_add_mconfig - add device configuration
//-------------------------------------------------
void a2bus_nippelclock_device::device_add_mconfig(machine_config &config)
{
MC146818(config, m_rtc, 32.768_kHz_XTAL);
m_rtc->irq().set(FUNC(a2bus_nippelclock_device::irq_w));
m_rtc->set_24hrs(true);
m_rtc->set_binary(true);
}
WRITE_LINE_MEMBER(a2bus_nippelclock_device::irq_w)
{
if (state == ASSERT_LINE)
{
raise_slot_irq();
}
else
{
lower_slot_irq();
}
}
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
a2bus_nippelclock_device::a2bus_nippelclock_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, type, tag, owner, clock)
, device_a2bus_card_interface(mconfig, *this)
, m_rtc(*this, "rtc")
{
}
a2bus_nippelclock_device::a2bus_nippelclock_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
a2bus_nippelclock_device(mconfig, A2BUS_NIPPELCLOCK, tag, owner, clock)
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void a2bus_nippelclock_device::device_start()
{
}
void a2bus_nippelclock_device::device_reset()
{
}
/*-------------------------------------------------
read_c0nx - called for reads from this card's c0nx space
-------------------------------------------------*/
uint8_t a2bus_nippelclock_device::read_c0nx(uint8_t offset)
{
switch (offset)
{
case 6: case 7:
return m_rtc->read(offset - 6);
break;
}
return 0;
}
/*-------------------------------------------------
write_c0nx - called for writes to this card's c0nx space
-------------------------------------------------*/
void a2bus_nippelclock_device::write_c0nx(uint8_t offset, uint8_t data)
{
switch (offset)
{
case 6: case 7:
m_rtc->write(offset - 6, data);
break;
}
}
|