bus/electron/cart: Added the Pace RS423 Communications cartridge.

This commit is contained in:
Nigel Barnes 2020-09-07 16:58:02 +01:00
parent 49074fa828
commit e5b039078f
4 changed files with 148 additions and 2 deletions

View File

@ -1078,6 +1078,8 @@ if (BUSES["ELECTRON_CART"]~=null) then
MAME_DIR .. "src/devices/bus/electron/cart/peg400.h",
MAME_DIR .. "src/devices/bus/electron/cart/romp144.cpp",
MAME_DIR .. "src/devices/bus/electron/cart/romp144.h",
MAME_DIR .. "src/devices/bus/electron/cart/rs423.cpp",
MAME_DIR .. "src/devices/bus/electron/cart/rs423.h",
MAME_DIR .. "src/devices/bus/electron/cart/sndexp.cpp",
MAME_DIR .. "src/devices/bus/electron/cart/sndexp.h",
MAME_DIR .. "src/devices/bus/electron/cart/sndexp3.cpp",

View File

@ -0,0 +1,97 @@
// license:BSD-3-Clause
// copyright-holders:Nigel Barnes
/**********************************************************************
Electron RS423 Communications cartridge (Pace Micro Technology)
**********************************************************************/
#include "emu.h"
#include "rs423.h"
#include "bus/rs232/rs232.h"
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
DEFINE_DEVICE_TYPE(ELECTRON_RS423, electron_rs423_device, "electron_rs423", "Pace RS423 Communications cartridge")
//-------------------------------------------------
// device_add_mconfig - add device configuration
//-------------------------------------------------
void electron_rs423_device::device_add_mconfig(machine_config &config)
{
SCN2681(config, m_duart, 3.6864_MHz_XTAL);
m_duart->irq_cb().set(DEVICE_SELF_OWNER, FUNC(electron_cartslot_device::irq_w));
m_duart->a_tx_cb().set("rs423", FUNC(rs232_port_device::write_txd));
m_duart->outport_cb().set("rs423", FUNC(rs232_port_device::write_rts)).bit(0);
rs232_port_device &rs232(RS232_PORT(config, "rs423", default_rs232_devices, "null_modem"));
rs232.rxd_handler().set(m_duart, FUNC(scn2681_device::rx_a_w));
rs232.cts_handler().set(m_duart, FUNC(scn2681_device::ip2_w));
}
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// electron_rs423_device - constructor
//-------------------------------------------------
electron_rs423_device::electron_rs423_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, ELECTRON_RS423, tag, owner, clock)
, device_electron_cart_interface(mconfig, *this)
, m_duart(*this, "duart")
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void electron_rs423_device::device_start()
{
}
//-------------------------------------------------
// read - cartridge data read
//-------------------------------------------------
uint8_t electron_rs423_device::read(offs_t offset, int infc, int infd, int romqa, int oe, int oe2)
{
uint8_t data = 0xff;
if (infc)
{
if (offset >= 0x60 && offset < 0x70)
{
data = m_duart->read(offset & 0x0f);
}
}
else if (oe)
{
data = m_rom[offset & 0x3fff];
}
return data;
}
//-------------------------------------------------
// write - cartridge data write
//-------------------------------------------------
void electron_rs423_device::write(offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2)
{
if (infc)
{
if (offset >= 0x60 && offset < 0x70)
{
m_duart->write(offset & 0x0f, data);
}
}
}

View File

@ -0,0 +1,47 @@
// license:BSD-3-Clause
// copyright-holders:Nigel Barnes
/**********************************************************************
Electron RS423 Communications cartridge (Pace Micro Technology)
**********************************************************************/
#ifndef MAME_BUS_ELECTRON_CART_RS423_H
#define MAME_BUS_ELECTRON_CART_RS423_H
#include "slot.h"
#include "machine/mc68681.h"
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
class electron_rs423_device :
public device_t,
public device_electron_cart_interface
{
public:
// construction/destruction
electron_rs423_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
protected:
// device-level overrides
virtual void device_start() override;
// optional information overrides
virtual void device_add_mconfig(machine_config &config) override;
// electron_cart_interface overrides
virtual uint8_t read(offs_t offset, int infc, int infd, int romqa, int oe, int oe2) override;
virtual void write(offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2) override;
private:
required_device<scn2681_device> m_duart;
};
// device type definition
DECLARE_DEVICE_TYPE(ELECTRON_RS423, electron_rs423_device)
#endif // MAME_BUS_ELECTRON_CART_RS423_H

View File

@ -265,7 +265,7 @@ void electron_cartslot_device::write(offs_t offset, uint8_t data, int infc, int
#include "peg400.h"
//#include "pmse2p.h"
#include "romp144.h"
//#include "rs423.h"
#include "rs423.h"
#include "sndexp.h"
#include "sndexp3.h"
#include "sp64.h"
@ -287,7 +287,7 @@ void electron_cart(device_slot_interface &device)
device.option_add_internal("peg400", ELECTRON_PEG400);
//device.option_add_internal("pmse2p", ELECTRON_PMSE2P);
device.option_add_internal("romp144", ELECTRON_ROMP144);
//device.option_add_internal("rs423", ELECTRON_RS423);
device.option_add_internal("rs423", ELECTRON_RS423);
device.option_add_internal("sndexp", ELECTRON_SNDEXP);
device.option_add_internal("sndexp3", ELECTRON_SNDEXP3);
device.option_add_internal("sp64", ELECTRON_SP64);