From 61e1983def903629f7da0457fecfa05d17b00b35 Mon Sep 17 00:00:00 2001 From: Curt Coder Date: Thu, 27 Sep 2012 16:53:42 +0000 Subject: [PATCH] Implemented DS75160A/DS75161A IEEE-488 GPIB Transceivers. [Curt Coder] (MESS) cbm2: Fixed floppy loading for PAL drivers. (nw) --- .gitattributes | 4 + hash/cbm2_cart.xml | 4 +- src/emu/emu.mak | 2 + src/emu/machine/6526cia.c | 4 - src/emu/machine/6532riot.c | 7 - src/emu/machine/6532riot.h | 2 - src/emu/machine/ds75160a.c | 132 +++++++++++++ src/emu/machine/ds75160a.h | 95 ++++++++++ src/emu/machine/ds75161a.c | 376 +++++++++++++++++++++++++++++++++++++ src/emu/machine/ds75161a.h | 149 +++++++++++++++ src/mess/drivers/cbm2.c | 129 +++++++++---- src/mess/includes/cbm2.h | 14 +- src/mess/machine/cbm2exp.c | 2 +- 13 files changed, 858 insertions(+), 62 deletions(-) create mode 100644 src/emu/machine/ds75160a.c create mode 100644 src/emu/machine/ds75160a.h create mode 100644 src/emu/machine/ds75161a.c create mode 100644 src/emu/machine/ds75161a.h diff --git a/.gitattributes b/.gitattributes index 66b3448aa85..4ac6c40af8f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1047,6 +1047,10 @@ src/emu/machine/ds2401.c svneol=native#text/plain src/emu/machine/ds2401.h svneol=native#text/plain src/emu/machine/ds2404.c svneol=native#text/plain src/emu/machine/ds2404.h svneol=native#text/plain +src/emu/machine/ds75160a.c svneol=native#text/plain +src/emu/machine/ds75160a.h svneol=native#text/plain +src/emu/machine/ds75161a.c svneol=native#text/plain +src/emu/machine/ds75161a.h svneol=native#text/plain src/emu/machine/e0516.c svneol=native#text/plain src/emu/machine/e0516.h svneol=native#text/plain src/emu/machine/eeprom.c svneol=native#text/plain diff --git a/hash/cbm2_cart.xml b/hash/cbm2_cart.xml index 3eafb119823..cf8fa5a66a2 100644 --- a/hash/cbm2_cart.xml +++ b/hash/cbm2_cart.xml @@ -4,11 +4,11 @@ Calc Result - 198? + 1983 Handic Software - + diff --git a/src/emu/emu.mak b/src/emu/emu.mak index 5d27dc96b74..ba7ce6207e4 100644 --- a/src/emu/emu.mak +++ b/src/emu/emu.mak @@ -174,6 +174,8 @@ EMUMACHINEOBJS = \ $(EMUMACHINE)/ds1302.o \ $(EMUMACHINE)/ds2401.o \ $(EMUMACHINE)/ds2404.o \ + $(EMUMACHINE)/ds75160a.o \ + $(EMUMACHINE)/ds75161a.o \ $(EMUMACHINE)/e0516.o \ $(EMUMACHINE)/eeprom.o \ $(EMUMACHINE)/er2055.o \ diff --git a/src/emu/machine/6526cia.c b/src/emu/machine/6526cia.c index e55ebc04847..a57aa52a1b1 100644 --- a/src/emu/machine/6526cia.c +++ b/src/emu/machine/6526cia.c @@ -128,10 +128,6 @@ void mos6526_device::device_reset() m_cnt = 1; m_sp = 0; - /* initialize data direction registers */ - m_port[0].m_ddr = !strcmp(tag(), "cia_0") ? 0x03 : 0xff; - m_port[1].m_ddr = !strcmp(tag(), "cia_0") ? 0x00 : 0xff; - /* TOD running by default */ m_tod_running = TRUE; diff --git a/src/emu/machine/6532riot.c b/src/emu/machine/6532riot.c index 429acba1631..8ea6890aa82 100644 --- a/src/emu/machine/6532riot.c +++ b/src/emu/machine/6532riot.c @@ -475,13 +475,6 @@ void riot6532_device::device_config_complete() void riot6532_device::device_start() { - /* validate arguments */ - assert(this != NULL); - - /* set static values */ - device_type_iterator<&device_creator, riot6532_device> iter(machine().root_device()); - m_index = iter.indexof(*this); - /* configure the ports */ m_port[0].m_in_func.resolve(m_in_a_cb, *this); m_port[0].m_out_func.resolve(m_out_a_cb, *this); diff --git a/src/emu/machine/6532riot.h b/src/emu/machine/6532riot.h index d82e946c4b8..a3d5668c948 100644 --- a/src/emu/machine/6532riot.h +++ b/src/emu/machine/6532riot.h @@ -93,8 +93,6 @@ private: void update_pa7_state(); UINT8 get_timer(); - int m_index; - riot6532_port m_port[2]; devcb_resolved_write_line m_irq_func; diff --git a/src/emu/machine/ds75160a.c b/src/emu/machine/ds75160a.c new file mode 100644 index 00000000000..a936d2e9a32 --- /dev/null +++ b/src/emu/machine/ds75160a.c @@ -0,0 +1,132 @@ +/********************************************************************** + + National Semiconductor DS75160A IEEE-488 GPIB Transceiver emulation + + Copyright MESS Team. + Visit http://mamedev.org for licensing and usage restrictions. + +**********************************************************************/ + +#include "ds75160a.h" + + + +//************************************************************************** +// DEVICE TYPE DEFINITIONS +//************************************************************************** + +const device_type DS75160A = &device_creator; + + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// ds75160a_device - constructor +//------------------------------------------------- + +ds75160a_device::ds75160a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, DS75160A, "DS75160A", tag, owner, clock), + m_data(0xff), + m_te(0), + m_pe(0) +{ +} + + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void ds75160a_device::device_config_complete() +{ + // inherit a copy of the static data + const ds75160a_interface *intf = reinterpret_cast(static_config()); + if (intf != NULL) + *static_cast(this) = *intf; + + // or initialize to defaults if none provided + else + { + memset(&m_in_bus_cb, 0, sizeof(m_in_bus_cb)); + memset(&m_out_bus_cb, 0, sizeof(m_out_bus_cb)); + } +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void ds75160a_device::device_start() +{ + // resolve callbacks + m_in_bus_func.resolve(m_in_bus_cb, *this); + m_out_bus_func.resolve(m_out_bus_cb, *this); + + // register for state saving + save_item(NAME(m_data)); + save_item(NAME(m_te)); + save_item(NAME(m_pe)); +} + + +//------------------------------------------------- +// read - read data bus +//------------------------------------------------- + +READ8_MEMBER( ds75160a_device::read ) +{ + UINT8 data = 0; + + if (!m_te) + { + data = m_in_bus_func(0); + } + + return data; +} + + +//------------------------------------------------- +// write - write data bus +//------------------------------------------------- + +WRITE8_MEMBER( ds75160a_device::write ) +{ + m_data = data; + + if (m_te) + { + m_out_bus_func(0, m_data); + } +} + + +//------------------------------------------------- +// te_w - transmit enable +//------------------------------------------------- + +WRITE_LINE_MEMBER( ds75160a_device::te_w ) +{ + if (m_te != state) + { + m_out_bus_func(0, m_te ? m_data : 0xff); + } + + m_te = state; +} + + +//------------------------------------------------- +// pe_w - parallel enable +//------------------------------------------------- + +WRITE_LINE_MEMBER( ds75160a_device::pe_w ) +{ + m_pe = state; +} diff --git a/src/emu/machine/ds75160a.h b/src/emu/machine/ds75160a.h new file mode 100644 index 00000000000..86ed7502523 --- /dev/null +++ b/src/emu/machine/ds75160a.h @@ -0,0 +1,95 @@ +/********************************************************************** + + National Semiconductor DS75160A IEEE-488 GPIB Transceiver emulation + + Copyright MESS Team. + Visit http://mamedev.org for licensing and usage restrictions. + +********************************************************************** + _____ _____ + TE 1 |* \_/ | 20 Vcc + D1 2 | | 19 D1 + D2 3 | | 18 D2 + D3 4 | | 17 D3 + D4 5 | DS75160A | 16 D4 + D5 6 | | 15 D5 + D6 7 | | 14 D6 + D7 8 | | 13 D7 + D8 8 | | 12 D8 + GND 10 |_____________| 11 PE + +**********************************************************************/ + +#pragma once + +#ifndef __DS75160A__ +#define __DS75160A__ + +#include "emu.h" + + + +///************************************************************************* +// INTERFACE CONFIGURATION MACROS +///************************************************************************* + +#define MCFG_DS75160A_ADD(_tag, _config) \ + MCFG_DEVICE_ADD(_tag, DS75160A, 0) \ + MCFG_DEVICE_CONFIG(_config) + + +#define DS75160A_INTERFACE(name) \ + const ds75160a_interface (name) = + + + +///************************************************************************* +// TYPE DEFINITIONS +///************************************************************************* + +// ======================> ds75160a_interface + +struct ds75160a_interface +{ + devcb_read8 m_in_bus_cb; + devcb_write8 m_out_bus_cb; +}; + + +// ======================> ds75160a_device + +class ds75160a_device : public device_t, + public ds75160a_interface +{ +public: + // construction/destruction + ds75160a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + DECLARE_READ8_MEMBER( read ); + DECLARE_WRITE8_MEMBER( write ); + + DECLARE_WRITE_LINE_MEMBER( te_w ); + DECLARE_WRITE_LINE_MEMBER( pe_w ); + +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + +private: + devcb_resolved_read8 m_in_bus_func; + devcb_resolved_write8 m_out_bus_func; + + UINT8 m_data; + + int m_te; + int m_pe; +}; + + +// device type definition +extern const device_type DS75160A; + + + +#endif diff --git a/src/emu/machine/ds75161a.c b/src/emu/machine/ds75161a.c new file mode 100644 index 00000000000..94580943dd9 --- /dev/null +++ b/src/emu/machine/ds75161a.c @@ -0,0 +1,376 @@ +/********************************************************************** + + National Semiconductor DS75161A IEEE-488 GPIB Transceiver emulation + + Copyright MESS Team. + Visit http://mamedev.org for licensing and usage restrictions. + +**********************************************************************/ + +#include "ds75161a.h" + + + +//************************************************************************** +// DEVICE TYPE DEFINITIONS +//************************************************************************** + +const device_type DS75161A = &device_creator; + + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// ds75161a_device - constructor +//------------------------------------------------- + +ds75161a_device::ds75161a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, DS75161A, "DS75161A", tag, owner, clock), + m_ren(1), + m_ifc(1), + m_ndac(1), + m_nrfd(1), + m_dav(1), + m_eoi(1), + m_atn(1), + m_srq(1), + m_te(0), + m_dc(0) +{ +} + + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void ds75161a_device::device_config_complete() +{ + // inherit a copy of the static data + const ds75161a_interface *intf = reinterpret_cast(static_config()); + if (intf != NULL) + *static_cast(this) = *intf; + + // or initialize to defaults if none provided + else + { + memset(&m_in_ren_cb, 0, sizeof(m_in_ren_cb)); + memset(&m_in_ifc_cb, 0, sizeof(m_in_ifc_cb)); + memset(&m_in_ndac_cb, 0, sizeof(m_in_ndac_cb)); + memset(&m_in_nrfd_cb, 0, sizeof(m_in_nrfd_cb)); + memset(&m_in_dav_cb, 0, sizeof(m_in_dav_cb)); + memset(&m_in_eoi_cb, 0, sizeof(m_in_eoi_cb)); + memset(&m_in_atn_cb, 0, sizeof(m_in_atn_cb)); + memset(&m_in_srq_cb, 0, sizeof(m_in_srq_cb)); + + memset(&m_out_ren_cb, 0, sizeof(m_out_ren_cb)); + memset(&m_out_ifc_cb, 0, sizeof(m_out_ifc_cb)); + memset(&m_out_ndac_cb, 0, sizeof(m_out_ndac_cb)); + memset(&m_out_nrfd_cb, 0, sizeof(m_out_nrfd_cb)); + memset(&m_out_dav_cb, 0, sizeof(m_out_dav_cb)); + memset(&m_out_eoi_cb, 0, sizeof(m_out_eoi_cb)); + memset(&m_out_atn_cb, 0, sizeof(m_out_atn_cb)); + memset(&m_out_srq_cb, 0, sizeof(m_out_srq_cb)); + } +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void ds75161a_device::device_start() +{ + // resolve callbacks + m_in_ren_func.resolve(m_in_ren_cb, *this); + m_in_ifc_func.resolve(m_in_ifc_cb, *this); + m_in_ndac_func.resolve(m_in_ndac_cb, *this); + m_in_nrfd_func.resolve(m_in_nrfd_cb, *this); + m_in_dav_func.resolve(m_in_dav_cb, *this); + m_in_eoi_func.resolve(m_in_eoi_cb, *this); + m_in_atn_func.resolve(m_in_atn_cb, *this); + m_in_srq_func.resolve(m_in_srq_cb, *this); + + m_out_ren_func.resolve(m_out_ren_cb, *this); + m_out_ifc_func.resolve(m_out_ifc_cb, *this); + m_out_ndac_func.resolve(m_out_ndac_cb, *this); + m_out_nrfd_func.resolve(m_out_nrfd_cb, *this); + m_out_dav_func.resolve(m_out_dav_cb, *this); + m_out_eoi_func.resolve(m_out_eoi_cb, *this); + m_out_atn_func.resolve(m_out_atn_cb, *this); + m_out_srq_func.resolve(m_out_srq_cb, *this); + + // register for state saving + save_item(NAME(m_ren)); + save_item(NAME(m_ifc)); + save_item(NAME(m_ndac)); + save_item(NAME(m_nrfd)); + save_item(NAME(m_dav)); + save_item(NAME(m_eoi)); + save_item(NAME(m_atn)); + save_item(NAME(m_srq)); + save_item(NAME(m_te)); + save_item(NAME(m_dc)); +} + + +//------------------------------------------------- +// update_signals - +//------------------------------------------------- + +void ds75161a_device::update_signals() +{ + m_out_ren_func(m_dc ? 1 : m_ren); + m_out_ifc_func(m_dc ? 1 : m_ifc); + m_out_ndac_func(m_te ? 1 : m_ndac); + m_out_nrfd_func(m_te ? 1 : m_nrfd); + m_out_dav_func(m_te ? m_dav : 1); + m_out_atn_func(m_dc ? 1 : m_atn); + m_out_srq_func(m_dc ? m_srq : 1 ); + + int atn = m_in_atn_func(); + + if (m_te && atn) m_out_eoi_func(m_eoi); + else if (!m_dc && !atn) m_out_eoi_func(m_eoi); + else m_out_eoi_func(1); +} + + +//------------------------------------------------- +// te_w - transmit enable +//------------------------------------------------- + +WRITE_LINE_MEMBER( ds75161a_device::te_w ) +{ + if (m_te != state) + { + m_te = state; + + update_signals(); + } +} + + +//------------------------------------------------- +// dc_w - direction control +//------------------------------------------------- + +WRITE_LINE_MEMBER( ds75161a_device::dc_w ) +{ + if (m_dc != state) + { + m_dc = state; + + update_signals(); + } +} + + +//------------------------------------------------- +// ren_r - remote enable read +//------------------------------------------------- + +READ_LINE_MEMBER( ds75161a_device::ren_r ) +{ + return m_dc ? m_in_ren_func() : 0; +} + + +//------------------------------------------------- +// ifc_r - interface clear read +//------------------------------------------------- + +READ_LINE_MEMBER( ds75161a_device::ifc_r ) +{ + return m_dc ? m_in_ifc_func() : 0; +} + + +//------------------------------------------------- +// ndac_r - not data acknowledge read +//------------------------------------------------- + +READ_LINE_MEMBER( ds75161a_device::ndac_r ) +{ + return m_te ? m_in_ndac_func() : 0; +} + + +//------------------------------------------------- +// nrfd_r - not ready for data read +//------------------------------------------------- + +READ_LINE_MEMBER( ds75161a_device::nrfd_r ) +{ + return m_te ? m_in_nrfd_func() : 0; +} + + +//------------------------------------------------- +// dav_r - data valid read +//------------------------------------------------- + +READ_LINE_MEMBER( ds75161a_device::dav_r ) +{ + return m_te ? 0 : m_in_dav_func(); +} + + +//------------------------------------------------- +// eoi_r - end or identify read +//------------------------------------------------- + +READ_LINE_MEMBER( ds75161a_device::eoi_r ) +{ + int atn = m_in_atn_func(); + int eoi = m_in_eoi_func(); + + if (!m_te && atn) return eoi; + else if (m_dc && !atn) return eoi; + else return 0; +} + + +//------------------------------------------------- +// atn_r - attention read +//------------------------------------------------- + +READ_LINE_MEMBER( ds75161a_device::atn_r ) +{ + return m_dc ? m_in_atn_func() : 0; +} + + +//------------------------------------------------- +// srq_r - service request read +//------------------------------------------------- + +READ_LINE_MEMBER( ds75161a_device::srq_r ) +{ + return m_dc ? 0 : m_in_srq_func(); +} + + +//------------------------------------------------- +// ren_w - remote enable write +//------------------------------------------------- + +WRITE_LINE_MEMBER( ds75161a_device::ren_w ) +{ + if (m_ren != state) + { + m_ren = state; + + update_signals(); + } +} + + +//------------------------------------------------- +// ifc_w - interface clear write +//------------------------------------------------- + +WRITE_LINE_MEMBER( ds75161a_device::ifc_w ) +{ + if (m_ifc != state) + { + m_ifc = state; + + update_signals(); + } +} + + +//------------------------------------------------- +// ndac_w - not data acknowledge write +//------------------------------------------------- + +WRITE_LINE_MEMBER( ds75161a_device::ndac_w ) +{ + if (m_ndac != state) + { + m_ndac = state; + + update_signals(); + } +} + + +//------------------------------------------------- +// nrfd_w - not ready for data write +//------------------------------------------------- + +WRITE_LINE_MEMBER( ds75161a_device::nrfd_w ) +{ + if (m_nrfd != state) + { + m_nrfd = state; + + update_signals(); + } +} + + +//------------------------------------------------- +// dav_w - data valid write +//------------------------------------------------- + +WRITE_LINE_MEMBER( ds75161a_device::dav_w ) +{ + if (m_dav != state) + { + m_dav = state; + + update_signals(); + } +} + + +//------------------------------------------------- +// eoi_w - end or identify write +//------------------------------------------------- + +WRITE_LINE_MEMBER( ds75161a_device::eoi_w ) +{ + if (m_eoi != state) + { + m_eoi = state; + + update_signals(); + } +} + + +//------------------------------------------------- +// atn_w - attention write +//------------------------------------------------- + +WRITE_LINE_MEMBER( ds75161a_device::atn_w ) +{ + if (m_atn != state) + { + m_atn = state; + + update_signals(); + } +} + + +//------------------------------------------------- +// srq_w - service request write +//------------------------------------------------- + +WRITE_LINE_MEMBER( ds75161a_device::srq_w ) +{ + if (m_srq != state) + { + m_srq = state; + + update_signals(); + } +} diff --git a/src/emu/machine/ds75161a.h b/src/emu/machine/ds75161a.h new file mode 100644 index 00000000000..dc5a9b8fcdc --- /dev/null +++ b/src/emu/machine/ds75161a.h @@ -0,0 +1,149 @@ +/********************************************************************** + + National Semiconductor DS75161A IEEE-488 GPIB Transceiver emulation + + Copyright MESS Team. + Visit http://mamedev.org for licensing and usage restrictions. + +********************************************************************** + _____ _____ + TE 1 |* \_/ | 20 Vcc + REN 2 | | 19 REN + IFC 3 | | 18 IFC + NDAC 4 | | 17 NDAC + NRFD 5 | DS75161A | 16 NRFD + DAV 6 | | 15 DAV + EOI 7 | | 14 EOI + ATN 8 | | 13 ATN + SRQ 8 | | 12 SRQ + GND 10 |_____________| 11 DC + +**********************************************************************/ + +#pragma once + +#ifndef __DS75161A__ +#define __DS75161A__ + +#include "emu.h" + + + +///************************************************************************* +// INTERFACE CONFIGURATION MACROS +///************************************************************************* + +#define MCFG_DS75161A_ADD(_tag, _config) \ + MCFG_DEVICE_ADD(_tag, DS75161A, 0) \ + MCFG_DEVICE_CONFIG(_config) + + +#define DS75161A_INTERFACE(name) \ + const ds75161a_interface (name) = + + + +///************************************************************************* +// TYPE DEFINITIONS +///************************************************************************* + +// ======================> ds75161a_interface + +struct ds75161a_interface +{ + devcb_read_line m_in_ren_cb; + devcb_read_line m_in_ifc_cb; + devcb_read_line m_in_ndac_cb; + devcb_read_line m_in_nrfd_cb; + devcb_read_line m_in_dav_cb; + devcb_read_line m_in_eoi_cb; + devcb_read_line m_in_atn_cb; + devcb_read_line m_in_srq_cb; + + devcb_write_line m_out_ren_cb; + devcb_write_line m_out_ifc_cb; + devcb_write_line m_out_ndac_cb; + devcb_write_line m_out_nrfd_cb; + devcb_write_line m_out_dav_cb; + devcb_write_line m_out_eoi_cb; + devcb_write_line m_out_atn_cb; + devcb_write_line m_out_srq_cb; +}; + + +// ======================> ds75161a_device + +class ds75161a_device : public device_t, + public ds75161a_interface +{ +public: + // construction/destruction + ds75161a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + DECLARE_WRITE_LINE_MEMBER( te_w ); + DECLARE_WRITE_LINE_MEMBER( dc_w ); + + DECLARE_READ_LINE_MEMBER( ren_r ); + DECLARE_READ_LINE_MEMBER( ifc_r ); + DECLARE_READ_LINE_MEMBER( ndac_r ); + DECLARE_READ_LINE_MEMBER( nrfd_r ); + DECLARE_READ_LINE_MEMBER( dav_r ); + DECLARE_READ_LINE_MEMBER( eoi_r ); + DECLARE_READ_LINE_MEMBER( atn_r ); + DECLARE_READ_LINE_MEMBER( srq_r ); + + DECLARE_WRITE_LINE_MEMBER( ren_w ); + DECLARE_WRITE_LINE_MEMBER( ifc_w ); + DECLARE_WRITE_LINE_MEMBER( ndac_w ); + DECLARE_WRITE_LINE_MEMBER( nrfd_w ); + DECLARE_WRITE_LINE_MEMBER( dav_w ); + DECLARE_WRITE_LINE_MEMBER( eoi_w ); + DECLARE_WRITE_LINE_MEMBER( atn_w ); + DECLARE_WRITE_LINE_MEMBER( srq_w ); + +protected: + // device-level overrides + virtual void device_config_complete(); + virtual void device_start(); + +private: + void update_signals(); + + devcb_resolved_read_line m_in_ren_func; + devcb_resolved_read_line m_in_ifc_func; + devcb_resolved_read_line m_in_ndac_func; + devcb_resolved_read_line m_in_nrfd_func; + devcb_resolved_read_line m_in_dav_func; + devcb_resolved_read_line m_in_eoi_func; + devcb_resolved_read_line m_in_atn_func; + devcb_resolved_read_line m_in_srq_func; + + devcb_resolved_write_line m_out_ren_func; + devcb_resolved_write_line m_out_ifc_func; + devcb_resolved_write_line m_out_ndac_func; + devcb_resolved_write_line m_out_nrfd_func; + devcb_resolved_write_line m_out_dav_func; + devcb_resolved_write_line m_out_eoi_func; + devcb_resolved_write_line m_out_atn_func; + devcb_resolved_write_line m_out_srq_func; + + int m_ren; + int m_ifc; + int m_ndac; + int m_nrfd; + int m_dav; + int m_eoi; + int m_atn; + int m_srq; + + int m_te; + int m_dc; +}; + + +// device type definition +extern const device_type DS75161A; + + + +#endif diff --git a/src/mess/drivers/cbm2.c b/src/mess/drivers/cbm2.c index 958d40896f5..8da05622baf 100644 --- a/src/mess/drivers/cbm2.c +++ b/src/mess/drivers/cbm2.c @@ -2,6 +2,8 @@ TODO: + - CIA timers fail in burn-in test + - NTSC variants unable to load from disk - shift lock - Hungarian keyboard - cbm620hu charom banking? @@ -1004,7 +1006,7 @@ static MC6845_UPDATE_ROW( hp_crtc_update_row ) data <<= 1; } - bitmap.pix32(y, x++) = RGB_MONOCHROME_GREEN[BIT(code, 7)]; + bitmap.pix32(y, x++) = RGB_MONOCHROME_GREEN[BIT(code, 7) ^ BIT(ma, 13)]; } } @@ -1121,13 +1123,12 @@ READ8_MEMBER( cbm2_state::tpi1_pa_r ) UINT8 data = 0; // IEEE-488 - if (m_ieee_dc) data |= m_ieee->ren_r() << 2; - if (m_ieee_dc) data |= m_ieee->atn_r() << 3; - if (!m_ieee_te) data |= m_ieee->dav_r() << 4; - if (m_ieee->atn_r() && !m_ieee_te) data |= m_ieee->eoi_r() << 5; - if (!m_ieee->atn_r() && !m_ieee_dc) data |= m_ieee->eoi_r() << 5; - if (m_ieee_te) data |= m_ieee->ndac_r() << 6; - if (m_ieee_te) data |= m_ieee->nrfd_r() << 7; + data |= m_ieee2->ren_r() << 2; + data |= m_ieee2->atn_r() << 3; + data |= m_ieee2->dav_r() << 4; + data |= m_ieee2->eoi_r() << 5; + data |= m_ieee2->ndac_r() << 6; + data |= m_ieee2->nrfd_r() << 7; return data; } @@ -1150,16 +1151,17 @@ WRITE8_MEMBER( cbm2_state::tpi1_pa_w ) */ // IEEE-488 - m_ieee_dc = BIT(data, 0); - m_ieee_te = BIT(data, 1); + m_ieee2->dc_w(BIT(data, 0)); - if (!m_ieee_dc) m_ieee->ren_w(BIT(data, 2)); - if (!m_ieee_dc) m_ieee->atn_w(BIT(data, 3)); - if (m_ieee_te) m_ieee->dav_w(BIT(data, 4)); - if (m_ieee->atn_r() && m_ieee_te) m_ieee->eoi_w(BIT(data, 5)); - if (!m_ieee->atn_r() && m_ieee_dc) m_ieee->eoi_w(BIT(data, 5)); - if (!m_ieee_te) m_ieee->ndac_w(BIT(data, 6)); - if (!m_ieee_te) m_ieee->nrfd_w(BIT(data, 7)); + m_ieee1->te_w(BIT(data, 1)); + m_ieee2->te_w(BIT(data, 1)); + + m_ieee2->ren_w(BIT(data, 2)); + m_ieee2->atn_w(BIT(data, 3)); + m_ieee2->dav_w(BIT(data, 4)); + m_ieee2->eoi_w(BIT(data, 5)); + m_ieee2->ndac_w(BIT(data, 6)); + m_ieee2->nrfd_w(BIT(data, 7)); } READ8_MEMBER( cbm2_state::tpi1_pb_r ) @@ -1179,18 +1181,18 @@ READ8_MEMBER( cbm2_state::tpi1_pb_r ) */ - UINT8 data = 0xff; + UINT8 data = 0; // IEEE-488 - if (m_ieee_dc) data &= m_ieee->ifc_r(); - if (!m_ieee_dc) data &= m_ieee->srq_r() << 1; + data |= m_ieee2->ifc_r(); + data |= m_ieee2->srq_r() << 1; // user port - //data &= m_user->pb2_r() << 2; - //data &= m_user->pb3_r() << 3; + //data |= m_user->pb2_r() << 2; + //data |= m_user->pb3_r() << 3; // cassette - data &= m_cassette->sense_r() << 7; + data |= m_cassette->sense_r() << 7; return data; } @@ -1213,8 +1215,8 @@ WRITE8_MEMBER( cbm2_state::tpi1_pb_w ) */ // IEEE-488 - if (!m_ieee_dc) m_ieee->ifc_w(BIT(data, 0)); - if (m_ieee_dc) m_ieee->srq_w(BIT(data, 1)); + m_ieee2->ifc_w(BIT(data, 0)); + m_ieee2->srq_w(BIT(data, 1)); // user port //m_user->pb2_w(BIT(data, 2)); @@ -1449,15 +1451,17 @@ READ8_MEMBER( cbm2_state::cia_pa_r ) */ - UINT8 data = 0xff; + UINT8 data = 0; - if (!m_ieee_te) data &= m_ieee->dio_r(); + // IEEE-488 + data |= m_ieee1->read(space, 0); - //data &= m_user->data1_r(); + // user port + //data |= m_user->data1_r(); // joystick - //data &= BIT(m_joy1->joy_r(), 5) << 6; - //data &= BIT(m_joy2->joy_r(), 5) << 7; + //data |= BIT(m_joy1->joy_r(), 5) << 6; + //data |= BIT(m_joy2->joy_r(), 5) << 7; return data; } @@ -1479,10 +1483,13 @@ WRITE8_MEMBER( cbm2_state::cia_pa_w ) */ - if (m_ieee_te) m_ieee->dio_w(data); + // IEEE-488 + m_ieee1->write(space, 0, data); + // user port //m_user->data1_w(data); + // joystick m_cia_pa = data; } @@ -1565,6 +1572,42 @@ static PET_DATASSETTE_PORT_INTERFACE( datassette_intf ) }; +//------------------------------------------------- +// DS75160A_INTERFACE( ds75160a_intf ) +//------------------------------------------------- + +static DS75160A_INTERFACE( ds75160a_intf ) +{ + DEVCB_DEVICE_MEMBER(IEEE488_TAG, ieee488_device, dio_r), + DEVCB_DEVICE_MEMBER(IEEE488_TAG, ieee488_device, dio_w) +}; + + +//------------------------------------------------- +// DS75161A_INTERFACE( ds75161a_intf ) +//------------------------------------------------- + +static DS75161A_INTERFACE( ds75161a_intf ) +{ + DEVCB_DEVICE_LINE_MEMBER(IEEE488_TAG, ieee488_device, ren_r), + DEVCB_DEVICE_LINE_MEMBER(IEEE488_TAG, ieee488_device, ifc_r), + DEVCB_DEVICE_LINE_MEMBER(IEEE488_TAG, ieee488_device, ndac_r), + DEVCB_DEVICE_LINE_MEMBER(IEEE488_TAG, ieee488_device, nrfd_r), + DEVCB_DEVICE_LINE_MEMBER(IEEE488_TAG, ieee488_device, dav_r), + DEVCB_DEVICE_LINE_MEMBER(IEEE488_TAG, ieee488_device, eoi_r), + DEVCB_DEVICE_LINE_MEMBER(IEEE488_TAG, ieee488_device, atn_r), + DEVCB_DEVICE_LINE_MEMBER(IEEE488_TAG, ieee488_device, srq_r), + DEVCB_DEVICE_LINE_MEMBER(IEEE488_TAG, ieee488_device, ren_w), + DEVCB_DEVICE_LINE_MEMBER(IEEE488_TAG, ieee488_device, ifc_w), + DEVCB_DEVICE_LINE_MEMBER(IEEE488_TAG, ieee488_device, ndac_w), + DEVCB_DEVICE_LINE_MEMBER(IEEE488_TAG, ieee488_device, nrfd_w), + DEVCB_DEVICE_LINE_MEMBER(IEEE488_TAG, ieee488_device, dav_w), + DEVCB_DEVICE_LINE_MEMBER(IEEE488_TAG, ieee488_device, eoi_w), + DEVCB_DEVICE_LINE_MEMBER(IEEE488_TAG, ieee488_device, atn_w), + DEVCB_DEVICE_LINE_MEMBER(IEEE488_TAG, ieee488_device, srq_w) +}; + + //------------------------------------------------- // IEEE488_INTERFACE( ieee488_intf ) //------------------------------------------------- @@ -1631,8 +1674,6 @@ MACHINE_START_MEMBER( cbm2_state, cbm2 ) save_item(NAME(m_tpi2_pa)); save_item(NAME(m_tpi2_pb)); save_item(NAME(m_cia_pa)); - save_item(NAME(m_ieee_dc)); - save_item(NAME(m_ieee_te)); } @@ -1797,6 +1838,8 @@ static MACHINE_CONFIG_START( p500_ntsc, p500_state ) MCFG_TPI6525_ADD(MOS6525_2_TAG, p500_tpi2_intf) MCFG_ACIA6551_ADD(MOS6551A_TAG) MCFG_MOS6526R1_ADD(MOS6526_TAG, VIC6567_CLOCK, 60, cia_intf) + MCFG_DS75160A_ADD(DS75160A_TAG, ds75160a_intf) + MCFG_DS75161A_ADD(DS75161A_TAG, ds75161a_intf) MCFG_CBM_IEEE488_ADD(ieee488_intf, "c8050") MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT_TAG, datassette_intf, cbm_datassette_devices, NULL, NULL) MCFG_VCS_CONTROL_PORT_ADD(CONTROL1_TAG, vcs_control_port_devices, NULL, NULL) @@ -1845,6 +1888,8 @@ static MACHINE_CONFIG_START( p500_pal, p500_state ) MCFG_TPI6525_ADD(MOS6525_2_TAG, p500_tpi2_intf) MCFG_ACIA6551_ADD(MOS6551A_TAG) MCFG_MOS6526R1_ADD(MOS6526_TAG, VIC6569_CLOCK, 50, cia_intf) + MCFG_DS75160A_ADD(DS75160A_TAG, ds75160a_intf) + MCFG_DS75161A_ADD(DS75161A_TAG, ds75161a_intf) MCFG_CBM_IEEE488_ADD(ieee488_intf, "c8050") MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT_TAG, datassette_intf, cbm_datassette_devices, NULL, NULL) MCFG_VCS_CONTROL_PORT_ADD(CONTROL1_TAG, vcs_control_port_devices, NULL, NULL) @@ -1871,7 +1916,7 @@ static MACHINE_CONFIG_START( cbm2lp_ntsc, cbm2_state ) MCFG_MACHINE_RESET_OVERRIDE(cbm2_state, cbm2) // basic hardware - MCFG_CPU_ADD(M6509_TAG, M6509, XTAL_18MHz/8) + MCFG_CPU_ADD(M6509_TAG, M6509, XTAL_18MHz/9) MCFG_CPU_PROGRAM_MAP(cbm2_mem) MCFG_QUANTUM_PERFECT_CPU(M6509_TAG) @@ -1884,11 +1929,11 @@ static MACHINE_CONFIG_START( cbm2lp_ntsc, cbm2_state ) MCFG_SCREEN_SIZE(768, 312) MCFG_SCREEN_VISIBLE_AREA(0, 768-1, 0, 312-1) - MCFG_MC6845_ADD(MC68B45_TAG, MC6845, XTAL_18MHz/8, lp_crtc_intf) + MCFG_MC6845_ADD(MC68B45_TAG, MC6845, XTAL_18MHz/9, lp_crtc_intf) // sound hardware MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD(MOS6851_TAG, SID6581, XTAL_18MHz/8) + MCFG_SOUND_ADD(MOS6851_TAG, SID6581, XTAL_18MHz/9) MCFG_SOUND_CONFIG(sid_intf) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) MCFG_SOUND_ADD("dac", DAC, 0) @@ -1899,12 +1944,14 @@ static MACHINE_CONFIG_START( cbm2lp_ntsc, cbm2_state ) MCFG_TPI6525_ADD(MOS6525_1_TAG, tpi1_intf) MCFG_TPI6525_ADD(MOS6525_2_TAG, tpi2_intf) MCFG_ACIA6551_ADD(MOS6551A_TAG) - MCFG_MOS6526R1_ADD(MOS6526_TAG, XTAL_18MHz/8, 60, cia_intf) + MCFG_MOS6526R1_ADD(MOS6526_TAG, XTAL_18MHz/9, 60, cia_intf) + MCFG_DS75160A_ADD(DS75160A_TAG, ds75160a_intf) + MCFG_DS75161A_ADD(DS75161A_TAG, ds75161a_intf) MCFG_CBM_IEEE488_ADD(ieee488_intf, "c8050") MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT_TAG, datassette_intf, cbm_datassette_devices, NULL, NULL) MCFG_VCS_CONTROL_PORT_ADD(CONTROL1_TAG, vcs_control_port_devices, NULL, NULL) MCFG_VCS_CONTROL_PORT_ADD(CONTROL2_TAG, vcs_control_port_devices, NULL, NULL) - MCFG_CBM2_EXPANSION_SLOT_ADD(CBM2_EXPANSION_SLOT_TAG, XTAL_18MHz/8, cbm2_expansion_cards, NULL, NULL) + MCFG_CBM2_EXPANSION_SLOT_ADD(CBM2_EXPANSION_SLOT_TAG, XTAL_18MHz/9, cbm2_expansion_cards, NULL, NULL) //MCFG_CBM2_USER_PORT_ADD(CBM2_USER_PORT_TAG, user_intf, cbm2_user_port_cards, NULL, NULL) //MCFG_CBM2_SYSTEM_PORT_ADD(CBM2_SYSTEM_PORT_TAG, system_intf, cbm2_system_port_cards, NULL, NULL) @@ -1944,7 +1991,7 @@ static MACHINE_CONFIG_START( cbm2lp_pal, cbm2_state ) MCFG_MACHINE_START_OVERRIDE(cbm2_state, cbm2_pal) MCFG_DEVICE_REMOVE(MOS6526_TAG) - MCFG_MOS6526R1_ADD(MOS6526_TAG, XTAL_18MHz/8, 50, cia_intf) + MCFG_MOS6526R1_ADD(MOS6526_TAG, XTAL_18MHz/9, 50, cia_intf) MACHINE_CONFIG_END @@ -1976,7 +2023,7 @@ static MACHINE_CONFIG_START( cbm2hp_ntsc, cbm2hp_state ) MCFG_FRAGMENT_ADD(cbm2lp_ntsc) MCFG_DEVICE_REMOVE(MC68B45_TAG) - MCFG_MC6845_ADD(MC68B45_TAG, MC6845, XTAL_18MHz/8, hp_crtc_intf) + MCFG_MC6845_ADD(MC68B45_TAG, MC6845, XTAL_18MHz/9, hp_crtc_intf) // devices MCFG_DEVICE_REMOVE(MOS6525_2_TAG) @@ -2030,7 +2077,7 @@ static MACHINE_CONFIG_START( cbm2hp_pal, cbm2hp_state ) MCFG_TPI6525_ADD(MOS6525_2_TAG, hp_tpi2_intf) MCFG_DEVICE_REMOVE(MOS6526_TAG) - MCFG_MOS6526R1_ADD(MOS6526_TAG, XTAL_18MHz/8, 50, cia_intf) + MCFG_MOS6526R1_ADD(MOS6526_TAG, XTAL_18MHz/9, 50, cia_intf) MACHINE_CONFIG_END diff --git a/src/mess/includes/cbm2.h b/src/mess/includes/cbm2.h index 72185ca3d42..876c4e49ef2 100644 --- a/src/mess/includes/cbm2.h +++ b/src/mess/includes/cbm2.h @@ -12,6 +12,8 @@ #include "machine/6551acia.h" #include "machine/cbm2exp.h" #include "machine/cbmipt.h" +#include "machine/ds75160a.h" +#include "machine/ds75161a.h" #include "machine/ieee488.h" #include "machine/petcass.h" #include "machine/pla.h" @@ -27,12 +29,14 @@ #define PLA2_TAG "u88" #define MOS6567_TAG "u23" #define MOS6569_TAG "u23" -#define MC68B45_TAG "u7" +#define MC68B45_TAG "u10" #define MOS6851_TAG "u4" #define MOS6525_1_TAG "u20" #define MOS6525_2_TAG "u102" #define MOS6551A_TAG "u19" #define MOS6526_TAG "u2" +#define DS75160A_TAG "u3" +#define DS75161A_TAG "u7" #define SCREEN_TAG "screen" #define CONTROL1_TAG "joy1" #define CONTROL2_TAG "joy2" @@ -50,6 +54,8 @@ public: m_tpi2(*this, MOS6525_2_TAG), m_acia(*this, MOS6551A_TAG), m_cia(*this, MOS6526_TAG), + m_ieee1(*this, DS75160A_TAG), + m_ieee2(*this, DS75161A_TAG), m_joy1(*this, CONTROL1_TAG), m_joy2(*this, CONTROL2_TAG), m_exp(*this, CBM2_EXPANSION_SLOT_TAG), @@ -78,6 +84,8 @@ public: required_device m_tpi2; required_device m_acia; required_device m_cia; + required_device m_ieee1; + required_device m_ieee2; required_device m_joy1; required_device m_joy2; required_device m_exp; @@ -152,10 +160,6 @@ public: UINT8 m_tpi2_pb; UINT8 m_cia_pa; - // IEEE-488 state - int m_ieee_dc; - int m_ieee_te; - // timers emu_timer *m_todclk_timer; }; diff --git a/src/mess/machine/cbm2exp.c b/src/mess/machine/cbm2exp.c index cc9232ca238..55c3e858bfe 100644 --- a/src/mess/machine/cbm2exp.c +++ b/src/mess/machine/cbm2exp.c @@ -108,7 +108,7 @@ UINT8* device_cbm2_expansion_card_interface::cbm2_bank3_pointer(running_machine m_bank3_mask = size - 1; } - return m_bank1; + return m_bank3; }