From b2c40f1f880fb8a8662d69e8cbec4feb361559ba Mon Sep 17 00:00:00 2001 From: Michaƫl Banaan Ananas Date: Sat, 11 Oct 2014 08:07:24 +0000 Subject: (file rename) --- .gitattributes | 4 +- src/mame/drivers/segac2.c | 2 +- src/mame/machine/315-5296.c | 199 -------------------------------------------- src/mame/machine/315-5296.h | 145 -------------------------------- src/mame/machine/315_5296.c | 199 ++++++++++++++++++++++++++++++++++++++++++++ src/mame/machine/315_5296.h | 145 ++++++++++++++++++++++++++++++++ src/mame/mame.mak | 2 +- 7 files changed, 348 insertions(+), 348 deletions(-) delete mode 100644 src/mame/machine/315-5296.c delete mode 100644 src/mame/machine/315-5296.h create mode 100644 src/mame/machine/315_5296.c create mode 100644 src/mame/machine/315_5296.h diff --git a/.gitattributes b/.gitattributes index d619cc3a00c..5c1e0f93315 100644 --- a/.gitattributes +++ b/.gitattributes @@ -6878,8 +6878,8 @@ src/mame/layout/wpc_an.lay svneol=native#text/xml src/mame/layout/zac_1.lay svneol=native#text/xml src/mame/layout/zac_2.lay svneol=native#text/xml src/mame/layout/zac_proto.lay svneol=native#text/xml -src/mame/machine/315-5296.c svneol=native#text/plain -src/mame/machine/315-5296.h svneol=native#text/plain +src/mame/machine/315_5296.c svneol=native#text/plain +src/mame/machine/315_5296.h svneol=native#text/plain src/mame/machine/3do.c svneol=native#text/plain src/mame/machine/acitya.c svneol=native#text/plain src/mame/machine/ajax.c svneol=native#text/plain diff --git a/src/mame/drivers/segac2.c b/src/mame/drivers/segac2.c index a8eaa3834d1..9972b5046d5 100644 --- a/src/mame/drivers/segac2.c +++ b/src/mame/drivers/segac2.c @@ -70,7 +70,7 @@ #include "emu.h" #include "cpu/m68000/m68000.h" #include "machine/nvram.h" -#include "machine/315-5296.h" +#include "machine/315_5296.h" #include "sound/okim6295.h" #include "sound/sn76496.h" #include "sound/2612intf.h" diff --git a/src/mame/machine/315-5296.c b/src/mame/machine/315-5296.c deleted file mode 100644 index 92077b3c891..00000000000 --- a/src/mame/machine/315-5296.c +++ /dev/null @@ -1,199 +0,0 @@ -/********************************************************************** - - Sega 315-5296 I/O chip - - Sega 100-pin QFP, with 8 bidirectional I/O ports, and 3 output pins. - It also has chip select(/FMCS) and clock(CKOT) for a peripheral device. - Commonly used from the late 80s up until Sega Model 2. - - The I/O chip has 64 addresses: - $00-0F : I/O ports, security, configuration registers - $10-1F : Unused (no effect when read or written) - $20-3F : Unused (enables /FMCS output, eg. to YM2151 /CS) - - On System 16 derivatives, the unused locations return the 68000 prefetch - value off the bus when read. - - - TODO: - - complete emulation of CNT register - -**********************************************************************/ - -#include "machine/315-5296.h" - - -const device_type SEGA_315_5296 = &device_creator; - -//------------------------------------------------- -// sega_315_5296_device - constructor -//------------------------------------------------- - -sega_315_5296_device::sega_315_5296_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, SEGA_315_5296, "Sega 315-5296", tag, owner, clock, "315-5296", __FILE__), - m_in_pa_cb(*this), - m_in_pb_cb(*this), - m_in_pc_cb(*this), - m_in_pd_cb(*this), - m_in_pe_cb(*this), - m_in_pf_cb(*this), - m_in_pg_cb(*this), - m_in_ph_cb(*this), - m_out_pa_cb(*this), - m_out_pb_cb(*this), - m_out_pc_cb(*this), - m_out_pd_cb(*this), - m_out_pe_cb(*this), - m_out_pf_cb(*this), - m_out_pg_cb(*this), - m_out_ph_cb(*this), - m_out_cnt0_cb(*this), - m_out_cnt1_cb(*this), - m_out_cnt2_cb(*this) -{ -} - -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void sega_315_5296_device::device_start() -{ - // resolve callbacks - m_in_pa_cb.resolve_safe(0xff); m_in_port_cb[0] = &m_in_pa_cb; - m_in_pb_cb.resolve_safe(0xff); m_in_port_cb[1] = &m_in_pb_cb; - m_in_pc_cb.resolve_safe(0xff); m_in_port_cb[2] = &m_in_pc_cb; - m_in_pd_cb.resolve_safe(0xff); m_in_port_cb[3] = &m_in_pd_cb; - m_in_pe_cb.resolve_safe(0xff); m_in_port_cb[4] = &m_in_pe_cb; - m_in_pf_cb.resolve_safe(0xff); m_in_port_cb[5] = &m_in_pf_cb; - m_in_pg_cb.resolve_safe(0xff); m_in_port_cb[6] = &m_in_pg_cb; - m_in_ph_cb.resolve_safe(0xff); m_in_port_cb[7] = &m_in_ph_cb; - - m_out_pa_cb.resolve_safe(); m_out_port_cb[0] = &m_out_pa_cb; - m_out_pb_cb.resolve_safe(); m_out_port_cb[1] = &m_out_pb_cb; - m_out_pc_cb.resolve_safe(); m_out_port_cb[2] = &m_out_pc_cb; - m_out_pd_cb.resolve_safe(); m_out_port_cb[3] = &m_out_pd_cb; - m_out_pe_cb.resolve_safe(); m_out_port_cb[4] = &m_out_pe_cb; - m_out_pf_cb.resolve_safe(); m_out_port_cb[5] = &m_out_pf_cb; - m_out_pg_cb.resolve_safe(); m_out_port_cb[6] = &m_out_pg_cb; - m_out_ph_cb.resolve_safe(); m_out_port_cb[7] = &m_out_ph_cb; - - m_out_cnt0_cb.resolve_safe(); m_out_cnt_cb[0] = &m_out_cnt0_cb; - m_out_cnt1_cb.resolve_safe(); m_out_cnt_cb[1] = &m_out_cnt1_cb; - m_out_cnt2_cb.resolve_safe(); m_out_cnt_cb[2] = &m_out_cnt2_cb; - - // register for savestates - save_item(NAME(m_output_latch)); - save_item(NAME(m_cnt)); - save_item(NAME(m_dir)); -} - -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void sega_315_5296_device::device_reset() -{ - // all ports are set to input - m_dir = 0; - - // clear output ports - memset(m_output_latch, 0, sizeof(m_output_latch)); - m_cnt = 0; - - for (int i = 0; i < 8; i++) - (*m_out_port_cb[i])((offs_t)i, 0); - for (int i = 0; i < 3; i++) - (*m_out_cnt_cb[i])(0); -} - - -//------------------------------------------------- - -READ8_MEMBER( sega_315_5296_device::read ) -{ - offset &= 0x3f; - - switch (offset) - { - // port A to H - case 0x0: case 0x1: case 0x2: case 0x3: case 0x4: case 0x5: case 0x6: case 0x7: - // if the port is configured as an output, return the last thing written - if (m_dir & 1 << offset) - return m_output_latch[offset]; - - // otherwise, return an input port - return (*m_in_port_cb[offset])(offset); - - // 'SEGA' protection - case 0x8: - return 'S'; - case 0x9: - return 'E'; - case 0xa: - return 'G'; - case 0xb: - return 'A'; - - // CNT register & mirror - case 0xc: case 0xe: - return m_cnt; - - // port direction register & mirror - case 0xd: case 0xf: - return m_dir; - - default: - break; - } - - return 0xff; -} - - -WRITE8_MEMBER( sega_315_5296_device::write ) -{ - offset &= 0x3f; - - switch (offset) - { - // port A to H - case 0x0: case 0x1: case 0x2: case 0x3: case 0x4: case 0x5: case 0x6: case 0x7: - // if the port is configured as an output, write it - if (m_dir & 1 << offset) - (*m_out_port_cb[offset])(offset, data); - - m_output_latch[offset] = data; - break; - - // CNT register - case 0xe: - // d0-2: CNT0-2 output pins - // note: When CNT2 is configured as clock output, bit 2 of this register has - // no effect on the output level of CNT2. - for (int i = 0; i < 3; i++) - (*m_out_cnt_cb[i])(data >> i & 1); - - // d3: CNT2 output mode (1= Clock output, 0= Programmable output) - // d4,5: CNT2 clock divider (0= CLK/4, 1= CLK/8, 2= CLK/16, 3= CLK/2) - // d6,7: CKOT clock divider (0= CLK/4, 1= CLK/8, 2= CLK/16, 3= CLK/2) - // TODO.. - m_cnt = data; - break; - - // port direction register - case 0xf: - // refresh output ports if the direction changed - for (int i = 0; i < 8; i++) - { - if ((m_dir ^ data) & (1 << i)) - (*m_out_port_cb[i])((offs_t)i, (data & 1 << i) ? m_output_latch[i] : 0); - } - - m_dir = data; - break; - - default: - break; - } -} diff --git a/src/mame/machine/315-5296.h b/src/mame/machine/315-5296.h deleted file mode 100644 index a3882475db6..00000000000 --- a/src/mame/machine/315-5296.h +++ /dev/null @@ -1,145 +0,0 @@ -/********************************************************************** - - Sega 315-5296 I/O chip - - Copyright MAME Team. - Visit http://mamedev.org for licensing and usage restrictions. - -**********************************************************************/ - -#pragma once - -#ifndef _SEGA_315_5296_H -#define _SEGA_315_5296_H - -#include "emu.h" - - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -// A to H 8-bit input ports -#define MCFG_315_5296_IN_PORTA_CB(_devcb) \ - devcb = &sega_315_5296_device::set_in_pa_callback(*device, DEVCB_##_devcb); -#define MCFG_315_5296_IN_PORTB_CB(_devcb) \ - devcb = &sega_315_5296_device::set_in_pb_callback(*device, DEVCB_##_devcb); -#define MCFG_315_5296_IN_PORTC_CB(_devcb) \ - devcb = &sega_315_5296_device::set_in_pc_callback(*device, DEVCB_##_devcb); -#define MCFG_315_5296_IN_PORTD_CB(_devcb) \ - devcb = &sega_315_5296_device::set_in_pd_callback(*device, DEVCB_##_devcb); -#define MCFG_315_5296_IN_PORTE_CB(_devcb) \ - devcb = &sega_315_5296_device::set_in_pe_callback(*device, DEVCB_##_devcb); -#define MCFG_315_5296_IN_PORTF_CB(_devcb) \ - devcb = &sega_315_5296_device::set_in_pf_callback(*device, DEVCB_##_devcb); -#define MCFG_315_5296_IN_PORTG_CB(_devcb) \ - devcb = &sega_315_5296_device::set_in_pg_callback(*device, DEVCB_##_devcb); -#define MCFG_315_5296_IN_PORTH_CB(_devcb) \ - devcb = &sega_315_5296_device::set_in_ph_callback(*device, DEVCB_##_devcb); - -// A to H 8-bit output ports -#define MCFG_315_5296_OUT_PORTA_CB(_devcb) \ - devcb = &sega_315_5296_device::set_out_pa_callback(*device, DEVCB_##_devcb); -#define MCFG_315_5296_OUT_PORTB_CB(_devcb) \ - devcb = &sega_315_5296_device::set_out_pb_callback(*device, DEVCB_##_devcb); -#define MCFG_315_5296_OUT_PORTC_CB(_devcb) \ - devcb = &sega_315_5296_device::set_out_pc_callback(*device, DEVCB_##_devcb); -#define MCFG_315_5296_OUT_PORTD_CB(_devcb) \ - devcb = &sega_315_5296_device::set_out_pd_callback(*device, DEVCB_##_devcb); -#define MCFG_315_5296_OUT_PORTE_CB(_devcb) \ - devcb = &sega_315_5296_device::set_out_pe_callback(*device, DEVCB_##_devcb); -#define MCFG_315_5296_OUT_PORTF_CB(_devcb) \ - devcb = &sega_315_5296_device::set_out_pf_callback(*device, DEVCB_##_devcb); -#define MCFG_315_5296_OUT_PORTG_CB(_devcb) \ - devcb = &sega_315_5296_device::set_out_pg_callback(*device, DEVCB_##_devcb); -#define MCFG_315_5296_OUT_PORTH_CB(_devcb) \ - devcb = &sega_315_5296_device::set_out_ph_callback(*device, DEVCB_##_devcb); - -// CNT output pins -#define MCFG_315_5296_OUT_CNT0_CB(_devcb) \ - devcb = &sega_315_5296_device::set_out_cnt0_callback(*device, DEVCB_##_devcb); -#define MCFG_315_5296_OUT_CNT1_CB(_devcb) \ - devcb = &sega_315_5296_device::set_out_cnt1_callback(*device, DEVCB_##_devcb); -#define MCFG_315_5296_OUT_CNT2_CB(_devcb) \ - devcb = &sega_315_5296_device::set_out_cnt2_callback(*device, DEVCB_##_devcb); - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> sega_315_5296_device - -class sega_315_5296_device : public device_t -{ -public: - sega_315_5296_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - // static configuration helpers - template static devcb_base &set_in_pa_callback(device_t &device, _Object object) { return downcast(device).m_in_pa_cb.set_callback(object); } - template static devcb_base &set_in_pb_callback(device_t &device, _Object object) { return downcast(device).m_in_pb_cb.set_callback(object); } - template static devcb_base &set_in_pc_callback(device_t &device, _Object object) { return downcast(device).m_in_pc_cb.set_callback(object); } - template static devcb_base &set_in_pd_callback(device_t &device, _Object object) { return downcast(device).m_in_pd_cb.set_callback(object); } - template static devcb_base &set_in_pe_callback(device_t &device, _Object object) { return downcast(device).m_in_pe_cb.set_callback(object); } - template static devcb_base &set_in_pf_callback(device_t &device, _Object object) { return downcast(device).m_in_pf_cb.set_callback(object); } - template static devcb_base &set_in_pg_callback(device_t &device, _Object object) { return downcast(device).m_in_pg_cb.set_callback(object); } - template static devcb_base &set_in_ph_callback(device_t &device, _Object object) { return downcast(device).m_in_ph_cb.set_callback(object); } - - template static devcb_base &set_out_pa_callback(device_t &device, _Object object) { return downcast(device).m_out_pa_cb.set_callback(object); } - template static devcb_base &set_out_pb_callback(device_t &device, _Object object) { return downcast(device).m_out_pb_cb.set_callback(object); } - template static devcb_base &set_out_pc_callback(device_t &device, _Object object) { return downcast(device).m_out_pc_cb.set_callback(object); } - template static devcb_base &set_out_pd_callback(device_t &device, _Object object) { return downcast(device).m_out_pd_cb.set_callback(object); } - template static devcb_base &set_out_pe_callback(device_t &device, _Object object) { return downcast(device).m_out_pe_cb.set_callback(object); } - template static devcb_base &set_out_pf_callback(device_t &device, _Object object) { return downcast(device).m_out_pf_cb.set_callback(object); } - template static devcb_base &set_out_pg_callback(device_t &device, _Object object) { return downcast(device).m_out_pg_cb.set_callback(object); } - template static devcb_base &set_out_ph_callback(device_t &device, _Object object) { return downcast(device).m_out_ph_cb.set_callback(object); } - - template static devcb_base &set_out_cnt0_callback(device_t &device, _Object object) { return downcast(device).m_out_cnt0_cb.set_callback(object); } - template static devcb_base &set_out_cnt1_callback(device_t &device, _Object object) { return downcast(device).m_out_cnt1_cb.set_callback(object); } - template static devcb_base &set_out_cnt2_callback(device_t &device, _Object object) { return downcast(device).m_out_cnt2_cb.set_callback(object); } - - DECLARE_READ8_MEMBER( read ); - DECLARE_WRITE8_MEMBER( write ); - -protected: - // device-level overrides - virtual void device_start(); - virtual void device_reset(); - -private: - devcb_read8 m_in_pa_cb; - devcb_read8 m_in_pb_cb; - devcb_read8 m_in_pc_cb; - devcb_read8 m_in_pd_cb; - devcb_read8 m_in_pe_cb; - devcb_read8 m_in_pf_cb; - devcb_read8 m_in_pg_cb; - devcb_read8 m_in_ph_cb; - - devcb_write8 m_out_pa_cb; - devcb_write8 m_out_pb_cb; - devcb_write8 m_out_pc_cb; - devcb_write8 m_out_pd_cb; - devcb_write8 m_out_pe_cb; - devcb_write8 m_out_pf_cb; - devcb_write8 m_out_pg_cb; - devcb_write8 m_out_ph_cb; - - devcb_write_line m_out_cnt0_cb; - devcb_write_line m_out_cnt1_cb; - devcb_write_line m_out_cnt2_cb; - - devcb_read8 *m_in_port_cb[8]; - devcb_write8 *m_out_port_cb[8]; - devcb_write_line *m_out_cnt_cb[3]; - - UINT8 m_output_latch[8]; - UINT8 m_cnt; - UINT8 m_dir; -}; - -// device type definition -extern const device_type SEGA_315_5296; - - -#endif /* _SEGA_315_5296_H */ diff --git a/src/mame/machine/315_5296.c b/src/mame/machine/315_5296.c new file mode 100644 index 00000000000..1b02a9c0f2f --- /dev/null +++ b/src/mame/machine/315_5296.c @@ -0,0 +1,199 @@ +/********************************************************************** + + Sega 315-5296 I/O chip + + Sega 100-pin QFP, with 8 bidirectional I/O ports, and 3 output pins. + It also has chip select(/FMCS) and clock(CKOT) for a peripheral device. + Commonly used from the late 80s up until Sega Model 2. + + The I/O chip has 64 addresses: + $00-0F : I/O ports, security, configuration registers + $10-1F : Unused (no effect when read or written) + $20-3F : Unused (enables /FMCS output, eg. to YM2151 /CS) + + On System 16 derivatives, the unused locations return the 68000 prefetch + value off the bus when read. + + + TODO: + - complete emulation of CNT register + +**********************************************************************/ + +#include "machine/315_5296.h" + + +const device_type SEGA_315_5296 = &device_creator; + +//------------------------------------------------- +// sega_315_5296_device - constructor +//------------------------------------------------- + +sega_315_5296_device::sega_315_5296_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, SEGA_315_5296, "Sega 315-5296", tag, owner, clock, "315-5296", __FILE__), + m_in_pa_cb(*this), + m_in_pb_cb(*this), + m_in_pc_cb(*this), + m_in_pd_cb(*this), + m_in_pe_cb(*this), + m_in_pf_cb(*this), + m_in_pg_cb(*this), + m_in_ph_cb(*this), + m_out_pa_cb(*this), + m_out_pb_cb(*this), + m_out_pc_cb(*this), + m_out_pd_cb(*this), + m_out_pe_cb(*this), + m_out_pf_cb(*this), + m_out_pg_cb(*this), + m_out_ph_cb(*this), + m_out_cnt0_cb(*this), + m_out_cnt1_cb(*this), + m_out_cnt2_cb(*this) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void sega_315_5296_device::device_start() +{ + // resolve callbacks + m_in_pa_cb.resolve_safe(0xff); m_in_port_cb[0] = &m_in_pa_cb; + m_in_pb_cb.resolve_safe(0xff); m_in_port_cb[1] = &m_in_pb_cb; + m_in_pc_cb.resolve_safe(0xff); m_in_port_cb[2] = &m_in_pc_cb; + m_in_pd_cb.resolve_safe(0xff); m_in_port_cb[3] = &m_in_pd_cb; + m_in_pe_cb.resolve_safe(0xff); m_in_port_cb[4] = &m_in_pe_cb; + m_in_pf_cb.resolve_safe(0xff); m_in_port_cb[5] = &m_in_pf_cb; + m_in_pg_cb.resolve_safe(0xff); m_in_port_cb[6] = &m_in_pg_cb; + m_in_ph_cb.resolve_safe(0xff); m_in_port_cb[7] = &m_in_ph_cb; + + m_out_pa_cb.resolve_safe(); m_out_port_cb[0] = &m_out_pa_cb; + m_out_pb_cb.resolve_safe(); m_out_port_cb[1] = &m_out_pb_cb; + m_out_pc_cb.resolve_safe(); m_out_port_cb[2] = &m_out_pc_cb; + m_out_pd_cb.resolve_safe(); m_out_port_cb[3] = &m_out_pd_cb; + m_out_pe_cb.resolve_safe(); m_out_port_cb[4] = &m_out_pe_cb; + m_out_pf_cb.resolve_safe(); m_out_port_cb[5] = &m_out_pf_cb; + m_out_pg_cb.resolve_safe(); m_out_port_cb[6] = &m_out_pg_cb; + m_out_ph_cb.resolve_safe(); m_out_port_cb[7] = &m_out_ph_cb; + + m_out_cnt0_cb.resolve_safe(); m_out_cnt_cb[0] = &m_out_cnt0_cb; + m_out_cnt1_cb.resolve_safe(); m_out_cnt_cb[1] = &m_out_cnt1_cb; + m_out_cnt2_cb.resolve_safe(); m_out_cnt_cb[2] = &m_out_cnt2_cb; + + // register for savestates + save_item(NAME(m_output_latch)); + save_item(NAME(m_cnt)); + save_item(NAME(m_dir)); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void sega_315_5296_device::device_reset() +{ + // all ports are set to input + m_dir = 0; + + // clear output ports + memset(m_output_latch, 0, sizeof(m_output_latch)); + m_cnt = 0; + + for (int i = 0; i < 8; i++) + (*m_out_port_cb[i])((offs_t)i, 0); + for (int i = 0; i < 3; i++) + (*m_out_cnt_cb[i])(0); +} + + +//------------------------------------------------- + +READ8_MEMBER( sega_315_5296_device::read ) +{ + offset &= 0x3f; + + switch (offset) + { + // port A to H + case 0x0: case 0x1: case 0x2: case 0x3: case 0x4: case 0x5: case 0x6: case 0x7: + // if the port is configured as an output, return the last thing written + if (m_dir & 1 << offset) + return m_output_latch[offset]; + + // otherwise, return an input port + return (*m_in_port_cb[offset])(offset); + + // 'SEGA' protection + case 0x8: + return 'S'; + case 0x9: + return 'E'; + case 0xa: + return 'G'; + case 0xb: + return 'A'; + + // CNT register & mirror + case 0xc: case 0xe: + return m_cnt; + + // port direction register & mirror + case 0xd: case 0xf: + return m_dir; + + default: + break; + } + + return 0xff; +} + + +WRITE8_MEMBER( sega_315_5296_device::write ) +{ + offset &= 0x3f; + + switch (offset) + { + // port A to H + case 0x0: case 0x1: case 0x2: case 0x3: case 0x4: case 0x5: case 0x6: case 0x7: + // if the port is configured as an output, write it + if (m_dir & 1 << offset) + (*m_out_port_cb[offset])(offset, data); + + m_output_latch[offset] = data; + break; + + // CNT register + case 0xe: + // d0-2: CNT0-2 output pins + // note: When CNT2 is configured as clock output, bit 2 of this register has + // no effect on the output level of CNT2. + for (int i = 0; i < 3; i++) + (*m_out_cnt_cb[i])(data >> i & 1); + + // d3: CNT2 output mode (1= Clock output, 0= Programmable output) + // d4,5: CNT2 clock divider (0= CLK/4, 1= CLK/8, 2= CLK/16, 3= CLK/2) + // d6,7: CKOT clock divider (0= CLK/4, 1= CLK/8, 2= CLK/16, 3= CLK/2) + // TODO.. + m_cnt = data; + break; + + // port direction register + case 0xf: + // refresh output ports if the direction changed + for (int i = 0; i < 8; i++) + { + if ((m_dir ^ data) & (1 << i)) + (*m_out_port_cb[i])((offs_t)i, (data & 1 << i) ? m_output_latch[i] : 0); + } + + m_dir = data; + break; + + default: + break; + } +} diff --git a/src/mame/machine/315_5296.h b/src/mame/machine/315_5296.h new file mode 100644 index 00000000000..a3882475db6 --- /dev/null +++ b/src/mame/machine/315_5296.h @@ -0,0 +1,145 @@ +/********************************************************************** + + Sega 315-5296 I/O chip + + Copyright MAME Team. + Visit http://mamedev.org for licensing and usage restrictions. + +**********************************************************************/ + +#pragma once + +#ifndef _SEGA_315_5296_H +#define _SEGA_315_5296_H + +#include "emu.h" + + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +// A to H 8-bit input ports +#define MCFG_315_5296_IN_PORTA_CB(_devcb) \ + devcb = &sega_315_5296_device::set_in_pa_callback(*device, DEVCB_##_devcb); +#define MCFG_315_5296_IN_PORTB_CB(_devcb) \ + devcb = &sega_315_5296_device::set_in_pb_callback(*device, DEVCB_##_devcb); +#define MCFG_315_5296_IN_PORTC_CB(_devcb) \ + devcb = &sega_315_5296_device::set_in_pc_callback(*device, DEVCB_##_devcb); +#define MCFG_315_5296_IN_PORTD_CB(_devcb) \ + devcb = &sega_315_5296_device::set_in_pd_callback(*device, DEVCB_##_devcb); +#define MCFG_315_5296_IN_PORTE_CB(_devcb) \ + devcb = &sega_315_5296_device::set_in_pe_callback(*device, DEVCB_##_devcb); +#define MCFG_315_5296_IN_PORTF_CB(_devcb) \ + devcb = &sega_315_5296_device::set_in_pf_callback(*device, DEVCB_##_devcb); +#define MCFG_315_5296_IN_PORTG_CB(_devcb) \ + devcb = &sega_315_5296_device::set_in_pg_callback(*device, DEVCB_##_devcb); +#define MCFG_315_5296_IN_PORTH_CB(_devcb) \ + devcb = &sega_315_5296_device::set_in_ph_callback(*device, DEVCB_##_devcb); + +// A to H 8-bit output ports +#define MCFG_315_5296_OUT_PORTA_CB(_devcb) \ + devcb = &sega_315_5296_device::set_out_pa_callback(*device, DEVCB_##_devcb); +#define MCFG_315_5296_OUT_PORTB_CB(_devcb) \ + devcb = &sega_315_5296_device::set_out_pb_callback(*device, DEVCB_##_devcb); +#define MCFG_315_5296_OUT_PORTC_CB(_devcb) \ + devcb = &sega_315_5296_device::set_out_pc_callback(*device, DEVCB_##_devcb); +#define MCFG_315_5296_OUT_PORTD_CB(_devcb) \ + devcb = &sega_315_5296_device::set_out_pd_callback(*device, DEVCB_##_devcb); +#define MCFG_315_5296_OUT_PORTE_CB(_devcb) \ + devcb = &sega_315_5296_device::set_out_pe_callback(*device, DEVCB_##_devcb); +#define MCFG_315_5296_OUT_PORTF_CB(_devcb) \ + devcb = &sega_315_5296_device::set_out_pf_callback(*device, DEVCB_##_devcb); +#define MCFG_315_5296_OUT_PORTG_CB(_devcb) \ + devcb = &sega_315_5296_device::set_out_pg_callback(*device, DEVCB_##_devcb); +#define MCFG_315_5296_OUT_PORTH_CB(_devcb) \ + devcb = &sega_315_5296_device::set_out_ph_callback(*device, DEVCB_##_devcb); + +// CNT output pins +#define MCFG_315_5296_OUT_CNT0_CB(_devcb) \ + devcb = &sega_315_5296_device::set_out_cnt0_callback(*device, DEVCB_##_devcb); +#define MCFG_315_5296_OUT_CNT1_CB(_devcb) \ + devcb = &sega_315_5296_device::set_out_cnt1_callback(*device, DEVCB_##_devcb); +#define MCFG_315_5296_OUT_CNT2_CB(_devcb) \ + devcb = &sega_315_5296_device::set_out_cnt2_callback(*device, DEVCB_##_devcb); + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> sega_315_5296_device + +class sega_315_5296_device : public device_t +{ +public: + sega_315_5296_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // static configuration helpers + template static devcb_base &set_in_pa_callback(device_t &device, _Object object) { return downcast(device).m_in_pa_cb.set_callback(object); } + template static devcb_base &set_in_pb_callback(device_t &device, _Object object) { return downcast(device).m_in_pb_cb.set_callback(object); } + template static devcb_base &set_in_pc_callback(device_t &device, _Object object) { return downcast(device).m_in_pc_cb.set_callback(object); } + template static devcb_base &set_in_pd_callback(device_t &device, _Object object) { return downcast(device).m_in_pd_cb.set_callback(object); } + template static devcb_base &set_in_pe_callback(device_t &device, _Object object) { return downcast(device).m_in_pe_cb.set_callback(object); } + template static devcb_base &set_in_pf_callback(device_t &device, _Object object) { return downcast(device).m_in_pf_cb.set_callback(object); } + template static devcb_base &set_in_pg_callback(device_t &device, _Object object) { return downcast(device).m_in_pg_cb.set_callback(object); } + template static devcb_base &set_in_ph_callback(device_t &device, _Object object) { return downcast(device).m_in_ph_cb.set_callback(object); } + + template static devcb_base &set_out_pa_callback(device_t &device, _Object object) { return downcast(device).m_out_pa_cb.set_callback(object); } + template static devcb_base &set_out_pb_callback(device_t &device, _Object object) { return downcast(device).m_out_pb_cb.set_callback(object); } + template static devcb_base &set_out_pc_callback(device_t &device, _Object object) { return downcast(device).m_out_pc_cb.set_callback(object); } + template static devcb_base &set_out_pd_callback(device_t &device, _Object object) { return downcast(device).m_out_pd_cb.set_callback(object); } + template static devcb_base &set_out_pe_callback(device_t &device, _Object object) { return downcast(device).m_out_pe_cb.set_callback(object); } + template static devcb_base &set_out_pf_callback(device_t &device, _Object object) { return downcast(device).m_out_pf_cb.set_callback(object); } + template static devcb_base &set_out_pg_callback(device_t &device, _Object object) { return downcast(device).m_out_pg_cb.set_callback(object); } + template static devcb_base &set_out_ph_callback(device_t &device, _Object object) { return downcast(device).m_out_ph_cb.set_callback(object); } + + template static devcb_base &set_out_cnt0_callback(device_t &device, _Object object) { return downcast(device).m_out_cnt0_cb.set_callback(object); } + template static devcb_base &set_out_cnt1_callback(device_t &device, _Object object) { return downcast(device).m_out_cnt1_cb.set_callback(object); } + template static devcb_base &set_out_cnt2_callback(device_t &device, _Object object) { return downcast(device).m_out_cnt2_cb.set_callback(object); } + + DECLARE_READ8_MEMBER( read ); + DECLARE_WRITE8_MEMBER( write ); + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + +private: + devcb_read8 m_in_pa_cb; + devcb_read8 m_in_pb_cb; + devcb_read8 m_in_pc_cb; + devcb_read8 m_in_pd_cb; + devcb_read8 m_in_pe_cb; + devcb_read8 m_in_pf_cb; + devcb_read8 m_in_pg_cb; + devcb_read8 m_in_ph_cb; + + devcb_write8 m_out_pa_cb; + devcb_write8 m_out_pb_cb; + devcb_write8 m_out_pc_cb; + devcb_write8 m_out_pd_cb; + devcb_write8 m_out_pe_cb; + devcb_write8 m_out_pf_cb; + devcb_write8 m_out_pg_cb; + devcb_write8 m_out_ph_cb; + + devcb_write_line m_out_cnt0_cb; + devcb_write_line m_out_cnt1_cb; + devcb_write_line m_out_cnt2_cb; + + devcb_read8 *m_in_port_cb[8]; + devcb_write8 *m_out_port_cb[8]; + devcb_write_line *m_out_cnt_cb[3]; + + UINT8 m_output_latch[8]; + UINT8 m_cnt; + UINT8 m_dir; +}; + +// device type definition +extern const device_type SEGA_315_5296; + + +#endif /* _SEGA_315_5296_H */ diff --git a/src/mame/mame.mak b/src/mame/mame.mak index 06c3643e999..a36792813bb 100644 --- a/src/mame/mame.mak +++ b/src/mame/mame.mak @@ -1736,7 +1736,7 @@ $(MAMEOBJ)/sega.a: \ $(DRIVERS)/turbo.o $(AUDIO)/turbo.o $(VIDEO)/turbo.o \ $(DRIVERS)/vicdual.o $(AUDIO)/vicdual.o $(VIDEO)/vicdual.o $(AUDIO)/carnival.o $(AUDIO)/depthch.o $(AUDIO)/invinco.o $(AUDIO)/pulsar.o \ $(DRIVERS)/zaxxon.o $(AUDIO)/zaxxon.o $(VIDEO)/zaxxon.o \ - $(MACHINE)/315-5296.o \ + $(MACHINE)/315_5296.o \ $(MACHINE)/fd1089.o \ $(MACHINE)/fd1094.o \ $(MACHINE)/fddebug.o \ -- cgit v1.2.3-70-g09d2