mirror of
https://github.com/holub/mame
synced 2025-10-04 16:34:53 +03:00
and of course the missing files (nw)
This commit is contained in:
parent
c7eee90411
commit
fae704cc31
4
.gitattributes
vendored
4
.gitattributes
vendored
@ -1831,6 +1831,8 @@ src/emu/machine/ay31015.c svneol=native#text/plain
|
||||
src/emu/machine/ay31015.h svneol=native#text/plain
|
||||
src/emu/machine/bankdev.c svneol=native#text/plain
|
||||
src/emu/machine/bankdev.h svneol=native#text/plain
|
||||
src/emu/machine/buffer.c svneol=native#text/plain
|
||||
src/emu/machine/buffer.h svneol=native#text/plain
|
||||
src/emu/machine/cdp1852.c svneol=native#text/plain
|
||||
src/emu/machine/cdp1852.h svneol=native#text/plain
|
||||
src/emu/machine/cdp1871.c svneol=native#text/plain
|
||||
@ -1917,6 +1919,8 @@ src/emu/machine/k056230.c svneol=native#text/plain
|
||||
src/emu/machine/k056230.h svneol=native#text/plain
|
||||
src/emu/machine/laserdsc.c svneol=native#text/plain
|
||||
src/emu/machine/laserdsc.h svneol=native#text/plain
|
||||
src/emu/machine/latch.c svneol=native#text/plain
|
||||
src/emu/machine/latch.h svneol=native#text/plain
|
||||
src/emu/machine/latch8.c svneol=native#text/plain
|
||||
src/emu/machine/latch8.h svneol=native#text/plain
|
||||
src/emu/machine/lc89510.c svneol=native#text/plain
|
||||
|
15
src/emu/machine/buffer.c
Normal file
15
src/emu/machine/buffer.c
Normal file
@ -0,0 +1,15 @@
|
||||
#include "emu.h"
|
||||
#include "buffer.h"
|
||||
|
||||
const device_type INPUT_BUFFER = &device_creator<input_buffer_device>;
|
||||
|
||||
input_buffer_device::input_buffer_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
|
||||
: device_t(mconfig, INPUT_BUFFER, "Input Buffer", tag, owner, clock, "input_buffer", __FILE__),
|
||||
m_input_data(0xff)
|
||||
{
|
||||
}
|
||||
|
||||
void input_buffer_device::device_start()
|
||||
{
|
||||
save_item(NAME(m_input_data));
|
||||
}
|
29
src/emu/machine/buffer.h
Normal file
29
src/emu/machine/buffer.h
Normal file
@ -0,0 +1,29 @@
|
||||
#ifndef __BUFFER_H__
|
||||
#define __BUFFER_H__
|
||||
|
||||
class input_buffer_device : public device_t
|
||||
{
|
||||
public:
|
||||
input_buffer_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
|
||||
UINT8 read() { return m_input_data; }
|
||||
DECLARE_READ8_MEMBER(read) { return read(); }
|
||||
|
||||
DECLARE_WRITE_LINE_MEMBER(write_bit0) { if (state) m_input_data |= 0x01; else m_input_data &= ~0x01; }
|
||||
DECLARE_WRITE_LINE_MEMBER(write_bit1) { if (state) m_input_data |= 0x02; else m_input_data &= ~0x02; }
|
||||
DECLARE_WRITE_LINE_MEMBER(write_bit2) { if (state) m_input_data |= 0x04; else m_input_data &= ~0x04; }
|
||||
DECLARE_WRITE_LINE_MEMBER(write_bit3) { if (state) m_input_data |= 0x08; else m_input_data &= ~0x08; }
|
||||
DECLARE_WRITE_LINE_MEMBER(write_bit4) { if (state) m_input_data |= 0x10; else m_input_data &= ~0x10; }
|
||||
DECLARE_WRITE_LINE_MEMBER(write_bit5) { if (state) m_input_data |= 0x20; else m_input_data &= ~0x20; }
|
||||
DECLARE_WRITE_LINE_MEMBER(write_bit6) { if (state) m_input_data |= 0x40; else m_input_data &= ~0x40; }
|
||||
DECLARE_WRITE_LINE_MEMBER(write_bit7) { if (state) m_input_data |= 0x80; else m_input_data &= ~0x80; }
|
||||
|
||||
protected:
|
||||
virtual void device_start();
|
||||
|
||||
UINT8 m_input_data;
|
||||
};
|
||||
|
||||
extern const device_type INPUT_BUFFER;
|
||||
|
||||
#endif
|
120
src/emu/machine/latch.c
Normal file
120
src/emu/machine/latch.c
Normal file
@ -0,0 +1,120 @@
|
||||
#include "emu.h"
|
||||
#include "latch.h"
|
||||
|
||||
const device_type OUTPUT_LATCH = &device_creator<output_latch_device>;
|
||||
|
||||
output_latch_device::output_latch_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
|
||||
: device_t(mconfig, OUTPUT_LATCH, "Output Latch", tag, owner, clock, "output_latch", __FILE__),
|
||||
m_resolved(false),
|
||||
m_bit0(-1),
|
||||
m_bit1(-1),
|
||||
m_bit2(-1),
|
||||
m_bit3(-1),
|
||||
m_bit4(-1),
|
||||
m_bit5(-1),
|
||||
m_bit6(-1),
|
||||
m_bit7(-1),
|
||||
m_bit0_handler(*this),
|
||||
m_bit1_handler(*this),
|
||||
m_bit2_handler(*this),
|
||||
m_bit3_handler(*this),
|
||||
m_bit4_handler(*this),
|
||||
m_bit5_handler(*this),
|
||||
m_bit6_handler(*this),
|
||||
m_bit7_handler(*this)
|
||||
{
|
||||
}
|
||||
|
||||
void output_latch_device::device_start()
|
||||
{
|
||||
save_item(NAME(m_bit0));
|
||||
save_item(NAME(m_bit1));
|
||||
save_item(NAME(m_bit2));
|
||||
save_item(NAME(m_bit3));
|
||||
save_item(NAME(m_bit4));
|
||||
save_item(NAME(m_bit5));
|
||||
save_item(NAME(m_bit6));
|
||||
save_item(NAME(m_bit7));
|
||||
}
|
||||
|
||||
void output_latch_device::write(UINT8 data)
|
||||
{
|
||||
if (!m_resolved)
|
||||
{
|
||||
// HACK: move to device_config_complete() when devcb2 supports that
|
||||
m_bit0_handler.resolve_safe();
|
||||
m_bit1_handler.resolve_safe();
|
||||
m_bit2_handler.resolve_safe();
|
||||
m_bit3_handler.resolve_safe();
|
||||
m_bit4_handler.resolve_safe();
|
||||
m_bit5_handler.resolve_safe();
|
||||
m_bit6_handler.resolve_safe();
|
||||
m_bit7_handler.resolve_safe();
|
||||
|
||||
m_resolved = true;
|
||||
}
|
||||
|
||||
int bit0 = (data >> 0) & 1;
|
||||
if (m_bit0 != bit0)
|
||||
{
|
||||
m_bit0 = bit0;
|
||||
if (!m_bit0_handler.isnull())
|
||||
m_bit0_handler(bit0);
|
||||
}
|
||||
|
||||
int bit1 = (data >> 1) & 1;
|
||||
if (m_bit1 != bit1)
|
||||
{
|
||||
m_bit1 = bit1;
|
||||
if (!m_bit1_handler.isnull())
|
||||
m_bit1_handler(bit1);
|
||||
}
|
||||
|
||||
int bit2 = (data >> 2) & 1;
|
||||
if (m_bit2 != bit2)
|
||||
{
|
||||
m_bit2 = bit2;
|
||||
if (!m_bit2_handler.isnull())
|
||||
m_bit2_handler(bit2);
|
||||
}
|
||||
|
||||
int bit3 = (data >> 3) & 1;
|
||||
if (m_bit3 != bit3)
|
||||
{
|
||||
m_bit3 = bit3;
|
||||
if (!m_bit3_handler.isnull())
|
||||
m_bit3_handler(bit3);
|
||||
}
|
||||
|
||||
int bit4 = (data >> 4) & 1;
|
||||
if (m_bit4 != bit4)
|
||||
{
|
||||
m_bit4 = bit4;
|
||||
if (!m_bit4_handler.isnull())
|
||||
m_bit4_handler(bit4);
|
||||
}
|
||||
|
||||
int bit5 = (data >> 5) & 1;
|
||||
if (m_bit5 != bit5)
|
||||
{
|
||||
m_bit5 = bit5;
|
||||
if (!m_bit5_handler.isnull())
|
||||
m_bit5_handler(bit5);
|
||||
}
|
||||
|
||||
int bit6 = (data >> 6) & 1;
|
||||
if (m_bit6 != bit6)
|
||||
{
|
||||
m_bit6 = bit6;
|
||||
if (!m_bit6_handler.isnull())
|
||||
m_bit6_handler(bit6);
|
||||
}
|
||||
|
||||
int bit7 = (data >> 7) & 1;
|
||||
if (m_bit7 != bit7)
|
||||
{
|
||||
m_bit7 = bit7;
|
||||
if (!m_bit7_handler.isnull())
|
||||
m_bit7_handler(bit7);
|
||||
}
|
||||
}
|
72
src/emu/machine/latch.h
Normal file
72
src/emu/machine/latch.h
Normal file
@ -0,0 +1,72 @@
|
||||
#ifndef __LATCH_H__
|
||||
#define __LATCH_H__
|
||||
|
||||
#define MCFG_OUTPUT_LATCH_BIT0_HANDLER(_devcb) \
|
||||
devcb = &output_latch_device::set_bit0_handler(*device, DEVCB2_##_devcb);
|
||||
|
||||
#define MCFG_OUTPUT_LATCH_BIT1_HANDLER(_devcb) \
|
||||
devcb = &output_latch_device::set_bit1_handler(*device, DEVCB2_##_devcb);
|
||||
|
||||
#define MCFG_OUTPUT_LATCH_BIT2_HANDLER(_devcb) \
|
||||
devcb = &output_latch_device::set_bit2_handler(*device, DEVCB2_##_devcb);
|
||||
|
||||
#define MCFG_OUTPUT_LATCH_BIT3_HANDLER(_devcb) \
|
||||
devcb = &output_latch_device::set_bit3_handler(*device, DEVCB2_##_devcb);
|
||||
|
||||
#define MCFG_OUTPUT_LATCH_BIT4_HANDLER(_devcb) \
|
||||
devcb = &output_latch_device::set_bit4_handler(*device, DEVCB2_##_devcb);
|
||||
|
||||
#define MCFG_OUTPUT_LATCH_BIT5_HANDLER(_devcb) \
|
||||
devcb = &output_latch_device::set_bit5_handler(*device, DEVCB2_##_devcb);
|
||||
|
||||
#define MCFG_OUTPUT_LATCH_BIT6_HANDLER(_devcb) \
|
||||
devcb = &output_latch_device::set_bit6_handler(*device, DEVCB2_##_devcb);
|
||||
|
||||
#define MCFG_OUTPUT_LATCH_BIT7_HANDLER(_devcb) \
|
||||
devcb = &output_latch_device::set_bit7_handler(*device, DEVCB2_##_devcb);
|
||||
|
||||
class output_latch_device : public device_t
|
||||
{
|
||||
public:
|
||||
output_latch_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
|
||||
template<class _Object> static devcb2_base &set_bit0_handler(device_t &device, _Object object) { return downcast<output_latch_device &>(device).m_bit0_handler.set_callback(object); }
|
||||
template<class _Object> static devcb2_base &set_bit1_handler(device_t &device, _Object object) { return downcast<output_latch_device &>(device).m_bit1_handler.set_callback(object); }
|
||||
template<class _Object> static devcb2_base &set_bit2_handler(device_t &device, _Object object) { return downcast<output_latch_device &>(device).m_bit2_handler.set_callback(object); }
|
||||
template<class _Object> static devcb2_base &set_bit3_handler(device_t &device, _Object object) { return downcast<output_latch_device &>(device).m_bit3_handler.set_callback(object); }
|
||||
template<class _Object> static devcb2_base &set_bit4_handler(device_t &device, _Object object) { return downcast<output_latch_device &>(device).m_bit4_handler.set_callback(object); }
|
||||
template<class _Object> static devcb2_base &set_bit5_handler(device_t &device, _Object object) { return downcast<output_latch_device &>(device).m_bit5_handler.set_callback(object); }
|
||||
template<class _Object> static devcb2_base &set_bit6_handler(device_t &device, _Object object) { return downcast<output_latch_device &>(device).m_bit6_handler.set_callback(object); }
|
||||
template<class _Object> static devcb2_base &set_bit7_handler(device_t &device, _Object object) { return downcast<output_latch_device &>(device).m_bit7_handler.set_callback(object); }
|
||||
|
||||
void write(UINT8 data);
|
||||
DECLARE_WRITE8_MEMBER(write) { write(data); }
|
||||
|
||||
protected:
|
||||
virtual void device_start();
|
||||
|
||||
private:
|
||||
bool m_resolved;
|
||||
|
||||
int m_bit0;
|
||||
int m_bit1;
|
||||
int m_bit2;
|
||||
int m_bit3;
|
||||
int m_bit4;
|
||||
int m_bit5;
|
||||
int m_bit6;
|
||||
int m_bit7;
|
||||
|
||||
devcb2_write_line m_bit0_handler;
|
||||
devcb2_write_line m_bit1_handler;
|
||||
devcb2_write_line m_bit2_handler;
|
||||
devcb2_write_line m_bit3_handler;
|
||||
devcb2_write_line m_bit4_handler;
|
||||
devcb2_write_line m_bit5_handler;
|
||||
devcb2_write_line m_bit6_handler;
|
||||
devcb2_write_line m_bit7_handler;
|
||||
};
|
||||
|
||||
extern const device_type OUTPUT_LATCH;
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user