diff --git a/src/devices/bus/apricot/keyboard/hle.cpp b/src/devices/bus/apricot/keyboard/hle.cpp index 08ba47cc4f0..d0f4eaa41a4 100644 --- a/src/devices/bus/apricot/keyboard/hle.cpp +++ b/src/devices/bus/apricot/keyboard/hle.cpp @@ -267,6 +267,8 @@ void apricot_keyboard_hle_device::received_byte(uint8_t byte) { m_rtc->address_w(m_rtc_index--); m_rtc->data_w(machine().dummy_space(), 0, byte); + m_rtc->write_w(1); + m_rtc->write_w(0); } } else @@ -303,7 +305,6 @@ void apricot_keyboard_hle_device::received_byte(uint8_t byte) // make rtc chip ready m_rtc->cs_w(1); - m_rtc->write_w(1); break; diff --git a/src/devices/machine/msm5832.cpp b/src/devices/machine/msm5832.cpp index 51b98621f69..079418409b3 100644 --- a/src/devices/machine/msm5832.cpp +++ b/src/devices/machine/msm5832.cpp @@ -92,6 +92,7 @@ msm5832_device::msm5832_device(const machine_config &mconfig, const char *tag, d device_rtc_interface(mconfig, *this), m_hold(0), m_address(0), + m_data(0), m_read(0), m_write(0), m_cs(0) @@ -115,6 +116,7 @@ void msm5832_device::device_start() save_item(NAME(m_reg)); save_item(NAME(m_hold)); save_item(NAME(m_address)); + save_item(NAME(m_data)); save_item(NAME(m_read)); save_item(NAME(m_write)); save_item(NAME(m_cs)); @@ -163,28 +165,9 @@ void msm5832_device::rtc_clock_updated(int year, int month, int day, int day_of_ READ8_MEMBER( msm5832_device::data_r ) { - uint8_t data = 0; + if (LOG) logerror("MSM5832 Register Read %01x: %01x\n", m_address, m_data & 0x0f); - if (m_cs && m_read) - { - if (m_address == REGISTER_REF) - { - // TODO reference output - } - else if (m_address <= REGISTER_Y10) - { - data = m_reg[m_address]; - } - else - { - // Otrona Attache CP/M BIOS checks unused registers to detect it - data = 0x0f; - } - } - - if (LOG) logerror("MSM5832 Register Read %01x: %01x\n", m_address, data & 0x0f); - - return data & 0x0f; + return m_data & 0x0f; } @@ -196,20 +179,7 @@ WRITE8_MEMBER( msm5832_device::data_w ) { if (LOG) logerror("MSM5832 Register Write %01x: %01x\n", m_address, data & 0x0f); - if (m_cs && m_write) - { - if (m_address == REGISTER_REF) - { - // TODO reference output - } - else if (m_address <= REGISTER_Y10) - { - m_reg[m_address] = data & 0x0f; - - set_time(false, read_counter(REGISTER_Y1), read_counter(REGISTER_MO1), read_counter(REGISTER_D1), m_reg[REGISTER_W], - read_counter(REGISTER_H1), read_counter(REGISTER_MI1), read_counter(REGISTER_S1)); - } - } + m_data = data & 0x0f; } @@ -222,6 +192,23 @@ void msm5832_device::address_w(uint8_t data) if (LOG) logerror("MSM5832 Address: %01x\n", data & 0x0f); m_address = data & 0x0f; + + if (m_cs && m_read) + { + if (m_address == REGISTER_REF) + { + // TODO reference output + } + else if (m_address <= REGISTER_Y10) + { + m_data = m_reg[m_address]; + } + else + { + // Otrona Attache CP/M BIOS checks unused registers to detect it + m_data = 0x0f; + } + } } @@ -280,8 +267,26 @@ WRITE_LINE_MEMBER( msm5832_device::read_w ) WRITE_LINE_MEMBER( msm5832_device::write_w ) { + if (m_write == state) + return; + if (LOG) logerror("MSM5832 WR: %u\n", state); + if (m_cs && state) + { + if (m_address == REGISTER_REF) + { + // TODO reference output + } + else if (m_address <= REGISTER_Y10) + { + m_reg[m_address] = m_data & 0x0f; + + set_time(false, read_counter(REGISTER_Y1), read_counter(REGISTER_MO1), read_counter(REGISTER_D1), m_reg[REGISTER_W], + read_counter(REGISTER_H1), read_counter(REGISTER_MI1), read_counter(REGISTER_S1)); + } + } + m_write = state; } diff --git a/src/devices/machine/msm5832.h b/src/devices/machine/msm5832.h index 9e7b32f5a83..cadfa19053a 100644 --- a/src/devices/machine/msm5832.h +++ b/src/devices/machine/msm5832.h @@ -80,7 +80,9 @@ private: uint8_t m_reg[13]; // registers int m_hold; // counter hold - int m_address; // address + + uint8_t m_address; // address + uint8_t m_data; // latched data int m_read; int m_write; diff --git a/src/devices/machine/msm58321.h b/src/devices/machine/msm58321.h index ef6bf799bdd..ee337955184 100644 --- a/src/devices/machine/msm58321.h +++ b/src/devices/machine/msm58321.h @@ -15,6 +15,20 @@ D3 7 | | 10 _BUSY GND 8 |_____________| 9 ADDRESS WRITE + _____ _____ + NC 1 |* \_/ | 24 Vdd + NC 2 | | 23 Vdd + NC 3 | | 22 Vdd + NC 4 | | 21 Vdd + CS2 5 | | 20 Vdd + WRITE 6 | | 19 Vdd + READ 7 | RTC58323 | 18 Vdd + D0 8 | | 17 CS1 + D1 9 | | 16 TEST + D2 10 | | 15 STOP + D3 11 | | 14 _BUSY + GND 12 |_____________| 13 ADDRESS WRITE + **********************************************************************/ #pragma once diff --git a/src/devices/machine/msm6242.h b/src/devices/machine/msm6242.h index 30ce46c7a01..c686e3b1a7e 100644 --- a/src/devices/machine/msm6242.h +++ b/src/devices/machine/msm6242.h @@ -2,7 +2,33 @@ // copyright-holders:Nathan Woods /*************************************************************************** - MSM6242 Real Time Clock + MSM6242 / RTC-6242x / RTC-7242x Real Time Clock + +**************************************************************************** + _____ _____ + STD.P 1 |* \_/ | 18 Vdd + /CS0 2 | | 17 /XT (MSM6242 only) + ALE 3 | | 16 XT (MSM6242 only) + A0 4 | MSM6242RS | 15 CS1 + A1 5 | RTC62421 | 14 D0 + A2 6 | RTC72421 | 13 D1 + A3 7 | | 12 D2 + /RD 8 | | 11 D3 + GND 9 |_____________| 10 /WR + + _____ _____ + STD.P 1 |* \_/ | 24 Vdd + /CS0 2 | | 23 /XT (MSM6242 only) + NC 3 | | 22 XT (MSM6242 only) + ALE 4 | | 21 NC + A0 5 | | 20 CS1 + NC 6 | MSM6242GS | 19 D0 + A1 7 | RTC62423 | 18 NC + NC 8 | RTC72423 | 17 NC + A2 9 | | 16 D1 + A3 10 | | 15 D2 + /RD 11 | | 14 D3 + GND 12 |_____________| 13 /WR ***************************************************************************/ diff --git a/src/mame/drivers/amusco.cpp b/src/mame/drivers/amusco.cpp index 1093de611d1..a0f93e2d54a 100644 --- a/src/mame/drivers/amusco.cpp +++ b/src/mame/drivers/amusco.cpp @@ -122,7 +122,6 @@ public: DECLARE_READ8_MEMBER(lpt_status_r); DECLARE_WRITE8_MEMBER(lpt_data_w); DECLARE_WRITE8_MEMBER(rtc_control_w); - DECLARE_WRITE8_MEMBER(rtc_data_w); MC6845_ON_UPDATE_ADDR_CHANGED(crtc_addr); MC6845_UPDATE_ROW(update_row); @@ -134,7 +133,6 @@ public: required_device m_screen; uint8_t m_mc6845_address; uint16_t m_video_update_address; - uint8_t m_rtc_data; }; @@ -172,7 +170,6 @@ void amusco_state::video_start() void amusco_state::machine_start() { - m_rtc_data = 0; } @@ -305,16 +302,6 @@ WRITE8_MEMBER(amusco_state::rtc_control_w) m_rtc->hold_w(BIT(data, 6)); m_rtc->write_w(BIT(data, 5)); m_rtc->read_w(BIT(data, 4)); - - // TO DO: MSM5832 WR emulation is inaccurate - if (BIT(data, 5)) - m_rtc->data_w(space, 0, m_rtc_data); -} - -WRITE8_MEMBER(amusco_state::rtc_data_w) -{ - // TO DO: MSM5832 should be able to latch this value itself - m_rtc_data = data; } static ADDRESS_MAP_START( amusco_io_map, AS_IO, 8, amusco_state ) @@ -454,7 +441,7 @@ static MACHINE_CONFIG_START( amusco, amusco_state ) MCFG_DEVICE_ADD("rtc_interface", I8155, 0) MCFG_I8155_OUT_PORTA_CB(WRITE8(amusco_state, rtc_control_w)) MCFG_I8155_IN_PORTC_CB(DEVREAD8("rtc", msm5832_device, data_r)) - MCFG_I8155_OUT_PORTC_CB(WRITE8(amusco_state, rtc_data_w)) + MCFG_I8155_OUT_PORTC_CB(DEVWRITE8("rtc", msm5832_device, data_w)) /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) diff --git a/src/mame/drivers/attache.cpp b/src/mame/drivers/attache.cpp index b1958f25904..deb7495b6af 100644 --- a/src/mame/drivers/attache.cpp +++ b/src/mame/drivers/attache.cpp @@ -491,10 +491,10 @@ void attache_state::operation_strobe(address_space& space, uint8_t data) break; case PIO_SEL_5832_WRITE: m_rtc->cs_w(1); - m_rtc->write_w(1); m_rtc->read_w(0); m_rtc->address_w((data & 0xf0) >> 4); m_rtc->data_w(space,0,data & 0x0f); + m_rtc->write_w(1); logerror("RTC: write %01x to %01x\n",data & 0x0f,(data & 0xf0) >> 4); break; case PIO_SEL_5832_READ: diff --git a/src/mame/drivers/cmi.cpp b/src/mame/drivers/cmi.cpp index 5493f059aa5..b9456f79688 100644 --- a/src/mame/drivers/cmi.cpp +++ b/src/mame/drivers/cmi.cpp @@ -2419,7 +2419,6 @@ WRITE8_MEMBER( cmi_state::q133_1_portb_w ) m_msm5832->hold_w(BIT(data, 0)); m_msm5832->read_w(BIT(data, 1)); m_msm5832->write_w(BIT(data, 2)); - m_msm5832->cs_w(1); } /* @@ -2720,6 +2719,8 @@ void cmi_state::machine_start() /* Allocate 256B scratch RAM per CPU */ m_scratch_ram[0] = std::make_unique(0x100); m_scratch_ram[1] = std::make_unique(0x100); + + m_msm5832->cs_w(1); } INTERRUPT_GEN_MEMBER( cmi_state::cmi_iix_vblank )