Previous 199869 Revisions Next

r33813 Thursday 11th December, 2014 at 05:07:58 UTC by Jürgen Buchmüller
Add Rockwell 10696 General Purpose Input/Output emulation WIP
[src/emu/machine]machine.mak r10696.c* r10696.h*
[src/mame]mame.mak

trunk/src/emu/machine/machine.mak
r242324r242325
13041304
13051305#-------------------------------------------------
13061306#
1307#@src/emu/machine/r10696.h,MACHINES += R10696
1308#-------------------------------------------------
1309
1310ifneq ($(filter R10696,$(MACHINES)),)
1311MACHINEOBJS+= $(MACHINEOBJ)/r10696.o
1312endif
1313
1314#-------------------------------------------------
1315#
13071316#@src/emu/machine/r10788.h,MACHINES += R10788
13081317#-------------------------------------------------
13091318
trunk/src/emu/machine/r10696.c
r0r242325
1/**********************************************************************
2
3    Rockwell 10696 General Purpose Input/Output (I/O)
4
5    Copyright Nicola Salmoria and the MAME Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8
9    REGISTER DESCRIPTION
10
11    HEX    Address   Select     Names
12    -------------------------------------------------------
13    A      x x x x   1 0 1 0    Read Group A
14    9      x x x x   1 0 0 1    Read Group B
15    3      x x x x   0 0 1 1    Read Group C
16    0      x x x x   0 0 0 0    Read Groups A | B | C
17    1      x x x x   0 0 0 1    Read Groups B | C
18    2      x x x x   0 0 1 0    Read Groups A | C
19    8      x x x x   1 0 0 0    Read Groups A | B
20
21    E      x x x x   1 1 1 0    Set Group A
22    D      x x x x   1 1 0 1    Set Group B
23    7      x x x x   0 1 1 1    Set Group C
24    4      x x x x   0 1 0 0    Set Groups A, B and C
25    5      x x x x   0 1 0 1    Set Groups B and C
26    6      x x x x   0 1 1 0    Set Groups A and C
27    C      x x x x   1 1 0 0    Set Groups A and B
28
29    Notes:
30    Any of the I/O chips may be used to read or set any group
31    (A, B, C) or combination of groups.
32**********************************************************************/
33
34#include "emu.h"
35#include "machine/r10696.h"
36
37#define   VERBOSE   1
38#if VERBOSE
39#define LOG(x) logerror x
40#else
41#define LOG(x)
42#endif
43
44/*************************************
45 *
46 *  Device interface
47 *
48 *************************************/
49
50const device_type R10696 = &device_creator<r10696_device>;
51
52r10696_device::r10696_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
53    : device_t(mconfig, R10696, "Rockwell 10696", tag, owner, clock, "r10696", __FILE__),
54        m_io_a(0), m_io_b(0), m_io_c(0),
55        m_iord(*this), m_iowr(*this)
56{
57}
58
59/**
60 * @brief r10696_device::device_start device-specific startup
61 */
62void r10696_device::device_start()
63{
64    m_iord.resolve();
65    m_iowr.resolve();
66
67    save_item(NAME(m_io_a));
68    save_item(NAME(m_io_b));
69    save_item(NAME(m_io_c));
70}
71
72/**
73 * @brief r10696_device::device_reset device-specific reset
74 */
75void r10696_device::device_reset()
76{
77   m_io_a = 0;
78   m_io_b = 0;
79   m_io_c = 0;
80}
81
82
83/*************************************
84 *
85 *  Constants
86 *
87 *************************************/
88
89/*************************************
90 *
91 *  Command access handlers
92 *
93 *************************************/
94
95WRITE8_MEMBER( r10696_device::io_w )
96{
97    assert(offset < 16);
98    const UINT8 io_a = m_io_a;
99    const UINT8 io_b = m_io_b;
100    const UINT8 io_c = m_io_c;
101    switch (offset)
102    {
103    case 0x0A: // Read Group A
104    case 0x09: // Read Group B
105    case 0x03: // Read Group C
106    case 0x00: // Read Groups A | B | C
107    case 0x01: // Read Groups B | C
108    case 0x02: // Read Groups A | C
109    case 0x08: // Read Groups A | B
110        break;
111
112    case 0x0E: // Set Group A
113        m_io_a = data & 0x0f;
114        break;
115    case 0x0D: // Set Group B
116        m_io_b = data & 0x0f;
117        break;
118    case 0x07: // Set Group C
119        m_io_c = data & 0x0f;
120        break;
121    case 0x04: // Set Groups A, B and C
122        m_io_a = m_io_b = m_io_c = data & 0x0f;
123        break;
124    case 0x05: // Set Groups B and C
125        m_io_b = m_io_c = data & 0x0f;
126        break;
127    case 0x06: // Set Groups A and C
128        m_io_a = m_io_c = data & 0x0f;
129        break;
130    case 0x0C: // Set Groups A and B
131        m_io_a = m_io_b = data & 0x0f;
132        break;
133    }
134    if (io_a != m_io_a)
135        m_iowr(0, m_io_a, 0x0f);
136    if (io_b != m_io_b)
137        m_iowr(1, m_io_b, 0x0f);
138    if (io_c != m_io_c)
139        m_iowr(2, m_io_c, 0x0f);
140}
141
142
143READ8_MEMBER( r10696_device::io_r )
144{
145    assert(offset < 16);
146    UINT8 io_a, io_b, io_c;
147    UINT8 data = 0xf;
148    switch (offset)
149    {
150    case 0x0A: // Read Group A
151        io_a = m_iord(0);
152        data = io_a & 0x0f;
153        break;
154    case 0x09: // Read Group B
155        io_b = m_iord(1);
156        data = io_b & 0x0f;
157        break;
158    case 0x03: // Read Group C
159        io_c = m_iord(2);
160        data = io_c & 0x0f;
161        break;
162    case 0x00: // Read Groups A | B | C
163        io_a = m_iord(0);
164        io_b = m_iord(1);
165        io_c = m_iord(2);
166        data = (io_a | io_b | io_a) & 0x0f;
167        break;
168    case 0x01: // Read Groups B | C
169        io_b = m_iord(1);
170        io_c = m_iord(2);
171        data = (io_b | io_c) & 0x0f;
172        break;
173    case 0x02: // Read Groups A | C
174        io_a = m_iord(0);
175        io_c = m_iord(2);
176        data = (io_a | io_c) & 0x0f;
177        break;
178    case 0x08: // Read Groups A | B
179        io_a = m_iord(0);
180        io_b = m_iord(1);
181        data = (io_a | io_b) & 0x0f;
182        break;
183
184    case 0x0E: // Set Group A
185    case 0x0D: // Set Group B
186    case 0x07: // Set Group C
187    case 0x04: // Set Groups A, B and C
188    case 0x05: // Set Groups B and C
189    case 0x06: // Set Groups A and C
190    case 0x0C: // Set Groups A and B
191        break;
192    }
193    return data;
194}
trunk/src/emu/machine/r10696.h
r0r242325
1/**********************************************************************
2
3    Rockwell 10696 General Purpose Input/Output (I/O)
4
5    Juergen Buchmueller <pullmoll@t-online.de>
6
7    The device decodes reads/write to a 16 byte I/O range defined
8    by four wired inputs SC1, SC2, SC3 and SC4.
9    It provides 12 inputs and 12 outputs in groups of three
10    time 4 bits each.
11
12**********************************************************************/
13
14#ifndef __R10696_H__
15#define __R10696_H__
16
17#include "device.h"
18
19/*************************************
20 *
21 *  Device configuration macros
22 *
23 *************************************/
24
25/* Set the writer used to update a display digit */
26#define MCFG_R10696_IO(_devcb_rd,_devcb_wr) \
27    r10696_device::set_iord(*device, DEVCB_##_devcb_rd); \
28    r10696_device::set_iowr(*device, DEVCB_##_devcb_wr);
29
30class r10696_device : public device_t
31{
32public:
33    r10696_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
34    ~r10696_device() {}
35
36    DECLARE_READ8_MEMBER ( io_r );
37    DECLARE_WRITE8_MEMBER( io_w );
38
39    template<class _Object> static devcb_base &set_iord(device_t &device, _Object object) { return downcast<r10696_device &>(device).m_iord.set_callback(object); }
40    template<class _Object> static devcb_base &set_iowr(device_t &device, _Object object) { return downcast<r10696_device &>(device).m_iowr.set_callback(object); }
41protected:
42    // device-level overrides
43    virtual void device_start();
44    virtual void device_reset();
45
46private:
47    UINT8         m_io_a;   //!< input/output flip-flops group A
48    UINT8         m_io_b;   //!< input/output flip-flops group B
49    UINT8         m_io_c;   //!< input/output flip-flops group C
50    devcb_read8   m_iord;   //!< input line (read, offset = group, data = 4 bits)
51    devcb_write8  m_iowr;   //!< output line (write, offset = group, data = 4 bits)
52};
53
54extern const device_type R10696;
55
56#endif /* __R10696_H__ */
trunk/src/mame/mame.mak
r242324r242325
499499MACHINES += PIC8259
500500MACHINES += PIT8253
501501MACHINES += PLA
502MACHINES += R10696
502503MACHINES += R10788
503504#MACHINES += PROFILE
504505#MACHINES += R64H156


Previous 199869 Revisions Next


© 1997-2024 The MAME Team