From 7e9c0431c07ea60c1d4c4f3db6a32c42b09e4cd3 Mon Sep 17 00:00:00 2001 From: "R. Belmont" Date: Sun, 2 Feb 2014 21:51:50 +0000 Subject: [PATCH] mos6551: support Rockwell 6551s, which show different register contents from MOS/CSG parts on reset. [R. Belmont] --- src/emu/machine/mos6551.c | 34 +++++++++++++++++++++++++++++++--- src/emu/machine/mos6551.h | 12 +++++++++++- 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/src/emu/machine/mos6551.c b/src/emu/machine/mos6551.c index 2aa08bab002..5a6b7c7b618 100644 --- a/src/emu/machine/mos6551.c +++ b/src/emu/machine/mos6551.c @@ -67,7 +67,8 @@ mos6551_device::mos6551_device(const machine_config &mconfig, const char *tag, d m_ext_rxc(0), m_cts(1), m_dsr(1), - m_dcd(1) + m_dcd(1), + m_chip_type(MOS6551_TYPE_MOS) { } @@ -103,7 +104,20 @@ void mos6551_device::device_start() void mos6551_device::device_reset() { m_ctrl = 0; - m_cmd = CMD_RIE; + + switch (m_chip_type) + { + case MOS6551_TYPE_MOS: + m_cmd = CMD_RIE; + break; + + case MOS6551_TYPE_ROCKWELL: + m_cmd = 0; + break; + + default: + fatalerror("mos6551: unknown type %d", m_chip_type); + } transmit_register_reset(); receive_register_reset(); @@ -111,6 +125,16 @@ void mos6551_device::device_reset() update_serial(); } +//------------------------------------------------- +// static_set_type - configuration helper to set +// the chip type +//------------------------------------------------- + +void mos6551_device::static_set_type(device_t &device, int type) +{ + mos6551_device &mos = downcast(device); + mos.m_chip_type = type; +} void mos6551_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { @@ -321,7 +345,11 @@ WRITE8_MEMBER( mos6551_device::write ) case 1: // programmed reset - m_cmd = (m_cmd & 0xe0) | CMD_RIE; + m_cmd = (m_cmd & 0xe0); + if (m_chip_type == MOS6551_TYPE_MOS) + { + m_cmd |= CMD_RIE; + } m_st &= ~ST_OR; update_serial(); break; diff --git a/src/emu/machine/mos6551.h b/src/emu/machine/mos6551.h index 975bcaccb66..078669fcbdd 100644 --- a/src/emu/machine/mos6551.h +++ b/src/emu/machine/mos6551.h @@ -33,7 +33,10 @@ #include "emu.h" - +// MOS 6551s reset with the RIE bit set in the command register +#define MOS6551_TYPE_MOS (0) +// Rockwell (and Synertek) reset with all bits clear in the command register +#define MOS6551_TYPE_ROCKWELL (1) //************************************************************************** // INTERFACE CONFIGURATION MACROS @@ -51,6 +54,8 @@ #define MCFG_MOS6551_DTR_HANDLER(_devcb) \ devcb = &mos6551_device::set_dtr_handler(*device, DEVCB2_##_devcb); +#define MCFG_MOS6551_TYPE(_type) \ + mos6551_device::static_set_type(*device, _type); //************************************************************************** @@ -82,6 +87,9 @@ public: void set_rxc(int clock); + // inline configuration helpers + static void static_set_type(device_t &device, int type); + protected: // device-level overrides virtual void device_start(); @@ -181,6 +189,8 @@ protected: int m_dsr; int m_dcd; + int m_chip_type; + static const int brg_divider[16]; };