From a455d0031a2862b969d13767e1bfb81ef8f1d7b4 Mon Sep 17 00:00:00 2001 From: AJR Date: Mon, 9 Oct 2023 19:56:50 -0400 Subject: mc146818: Split non-direct read and write handlers into more hardware-accurate handlers for address writes and data reads/writes Note that address_r is not provided since the original IC makes no provision for reading data strobed with AS back. However, a getter has been provided for some situations where this may be dubiously possible. --- src/devices/bus/a2bus/nippelclock.cpp | 11 ++++--- src/devices/bus/bbc/internal/cumana68k.cpp | 6 ++-- src/devices/bus/bbc/internal/integrab.cpp | 9 ++---- src/devices/bus/bbc/rom/rtc.cpp | 8 ++--- src/devices/bus/cpc/symbfac2.cpp | 12 ++------ src/devices/bus/cpc/symbfac2.h | 2 -- src/devices/bus/econet/e01.cpp | 44 ++------------------------- src/devices/bus/econet/e01.h | 4 --- src/devices/bus/electron/cart/click.cpp | 7 +++-- src/devices/bus/electron/cart/cumana.cpp | 8 +++-- src/devices/bus/lpci/southbridge.cpp | 18 +++++------ src/devices/bus/lpci/southbridge.h | 2 +- src/devices/bus/samcoupe/expansion/dallas.cpp | 11 +++++-- src/devices/bus/spectrum/smuc.cpp | 6 ++-- src/devices/bus/tanbus/radisc.cpp | 11 ++++--- src/devices/machine/at.cpp | 18 +++++------ src/devices/machine/at.h | 2 +- src/devices/machine/cs4031.cpp | 18 +++++------ src/devices/machine/cs4031.h | 16 +--------- src/devices/machine/ds128x.cpp | 15 +++++---- src/devices/machine/fdc37c93x.cpp | 3 +- src/devices/machine/i82357.cpp | 4 +-- src/devices/machine/i82357.h | 4 +-- src/devices/machine/mc146818.cpp | 36 ++++++++-------------- src/devices/machine/mc146818.h | 8 +++-- src/devices/machine/pc87306.cpp | 18 ++++++++++- src/devices/machine/pc87306.h | 2 ++ src/devices/machine/sis85c496.cpp | 16 ++++------ src/devices/machine/sis85c496.h | 2 +- src/devices/machine/w83977tf.cpp | 18 ++++++++++- src/devices/machine/w83977tf.h | 3 ++ src/devices/machine/wd7600.cpp | 17 +++++------ src/devices/machine/wd7600.h | 2 +- src/mame/acorn/bbc_m.cpp | 6 ++-- src/mame/amstrad/amstr_pc.cpp | 3 +- src/mame/amstrad/amstrad_m.cpp | 6 ++-- src/mame/amstrad/nc.cpp | 3 +- src/mame/amstrad/pc1512.cpp | 8 +++-- src/mame/aristocrat/aristmk4.cpp | 6 ++-- src/mame/ausnz/mbee.cpp | 18 +++++------ src/mame/ausnz/mbee.h | 3 -- src/mame/ausnz/mbee_m.cpp | 15 --------- src/mame/be/bebox.cpp | 3 +- src/mame/bfm/rastersp.cpp | 3 +- src/mame/elektor/ec65.cpp | 5 ++- src/mame/epson/qx10.cpp | 15 ++------- src/mame/intergraph/interpro.cpp | 6 ++-- src/mame/lsi/octopus.cpp | 10 +++--- src/mame/merit/mtouchxl.cpp | 3 +- src/mame/microsoft/jazz.cpp | 6 ++-- src/mame/misc/hotstuff.cpp | 17 +++++------ src/mame/misc/xtom3d.cpp | 14 ++++++--- src/mame/omron/luna_88k.cpp | 3 +- src/mame/sgi/iris3130.cpp | 8 ++--- src/mame/shared/pcshare.cpp | 3 +- src/mame/sinclair/sprinter.cpp | 6 ++-- src/mame/skeleton/micronic.cpp | 23 ++------------ src/mame/skeleton/micronic.h | 3 -- src/mame/taito/taitowlf.cpp | 14 ++++++--- src/mame/ussr/orion_m.cpp | 9 ++++-- 60 files changed, 254 insertions(+), 326 deletions(-) diff --git a/src/devices/bus/a2bus/nippelclock.cpp b/src/devices/bus/a2bus/nippelclock.cpp index 97dbec1bf3e..cca2af8b29c 100644 --- a/src/devices/bus/a2bus/nippelclock.cpp +++ b/src/devices/bus/a2bus/nippelclock.cpp @@ -88,8 +88,8 @@ uint8_t a2bus_nippelclock_device::read_c0nx(uint8_t offset) { switch (offset) { - case 6: case 7: - return m_rtc->read(offset - 6); + case 7: + return m_rtc->data_r(); break; } @@ -105,8 +105,11 @@ void a2bus_nippelclock_device::write_c0nx(uint8_t offset, uint8_t data) { switch (offset) { - case 6: case 7: - m_rtc->write(offset - 6, data); + case 6: + m_rtc->address_w(data); + break; + case 7: + m_rtc->data_w(data); break; } } diff --git a/src/devices/bus/bbc/internal/cumana68k.cpp b/src/devices/bus/bbc/internal/cumana68k.cpp index 4699b9f4877..0523622115c 100644 --- a/src/devices/bus/bbc/internal/cumana68k.cpp +++ b/src/devices/bus/bbc/internal/cumana68k.cpp @@ -268,7 +268,7 @@ void bbc_cumana68k_device::mc146818_set(int as, int ds, int rw) /* if address select is set then set the address in the 146818 */ if (m_mc146818_as & !as) { - m_rtc->write(0, m_mc146818_data); + m_rtc->address_w(m_mc146818_data); //logerror("addr_w: %02x\n", m_mc146818_data); } @@ -277,12 +277,12 @@ void bbc_cumana68k_device::mc146818_set(int as, int ds, int rw) { if (m_mc146818_rw) { - m_mc146818_data = m_rtc->read(1); + m_mc146818_data = m_rtc->data_r(); //logerror("data_r: %02x\n", m_mc146818_data); } else { - m_rtc->write(1, m_mc146818_data); + m_rtc->data_w(m_mc146818_data); //logerror("data_w: %02x\n", m_mc146818_data); } } diff --git a/src/devices/bus/bbc/internal/integrab.cpp b/src/devices/bus/bbc/internal/integrab.cpp index 6d69b9c34c0..1cb750b7022 100644 --- a/src/devices/bus/bbc/internal/integrab.cpp +++ b/src/devices/bus/bbc/internal/integrab.cpp @@ -157,11 +157,8 @@ uint8_t bbc_integrab_device::romsel_r(offs_t offset) switch (offset & 0x0c) { - case 0x08: - data = m_rtc->read(0); - break; case 0x0c: - data = m_rtc->read(1); + data = m_rtc->data_r(); break; } @@ -194,10 +191,10 @@ void bbc_integrab_device::romsel_w(offs_t offset, uint8_t data) m_ramsel = data; break; case 0x08: - m_rtc->write(0, data); + m_rtc->address_w(data); break; case 0x0c: - m_rtc->write(1, data); + m_rtc->data_w(data); break; } diff --git a/src/devices/bus/bbc/rom/rtc.cpp b/src/devices/bus/bbc/rom/rtc.cpp index 7d73c24b53e..436783f3641 100644 --- a/src/devices/bus/bbc/rom/rtc.cpp +++ b/src/devices/bus/bbc/rom/rtc.cpp @@ -82,22 +82,22 @@ uint8_t bbc_stlrtc_device::read(offs_t offset) switch (offset & 0x3fc0) { case 0x3e00: - data = m_rtc->read(1); + data = m_rtc->data_r(); break; case 0x3e40: if (!machine().side_effects_disabled()) - m_rtc->write(0, data); + m_rtc->address_w(data); break; case 0x3e80: case 0x3ec0: - data = m_rtc->read(0); + data = m_rtc->get_address(); // FIXME: really? break; case 0x3f00: case 0x3f40: case 0x3f80: case 0x3fc0: if (!machine().side_effects_disabled()) - m_rtc->write(1, data); + m_rtc->data_w(data); break; } return data; diff --git a/src/devices/bus/cpc/symbfac2.cpp b/src/devices/bus/cpc/symbfac2.cpp index bffadf99f2a..8b18c94aab3 100644 --- a/src/devices/bus/cpc/symbfac2.cpp +++ b/src/devices/bus/cpc/symbfac2.cpp @@ -93,7 +93,8 @@ void cpc_symbiface2_device::device_start() space.install_readwrite_handler(0xfd00,0xfd07, read8sm_delegate(*this, FUNC(cpc_symbiface2_device::ide_cs1_r)), write8sm_delegate(*this, FUNC(cpc_symbiface2_device::ide_cs1_w))); space.install_readwrite_handler(0xfd08,0xfd0f, read8sm_delegate(*this, FUNC(cpc_symbiface2_device::ide_cs0_r)), write8sm_delegate(*this, FUNC(cpc_symbiface2_device::ide_cs0_w))); space.install_read_handler(0xfd10,0xfd10, read8smo_delegate(*this, FUNC(cpc_symbiface2_device::mouse_r))); - space.install_readwrite_handler(0xfd14,0xfd15, read8sm_delegate(*this, FUNC(cpc_symbiface2_device::rtc_r)), write8sm_delegate(*this, FUNC(cpc_symbiface2_device::rtc_w))); + space.install_readwrite_handler(0xfd14,0xfd14, read8smo_delegate(m_rtc, FUNC(mc146818_device::data_r)), write8smo_delegate(m_rtc, FUNC(mc146818_device::data_w))); + space.install_write_handler(0xfd15,0xfd15, write8smo_delegate(m_rtc, FUNC(mc146818_device::address_w))); space.install_readwrite_handler(0xfd17,0xfd17, read8smo_delegate(*this, FUNC(cpc_symbiface2_device::rom_rewrite_r)), write8smo_delegate(*this, FUNC(cpc_symbiface2_device::rom_rewrite_w))); // set up ROM space (these can be writable, when mapped to &4000, or completely disabled, allowing the built-in ROMs to be visible) @@ -159,15 +160,6 @@ void cpc_symbiface2_device::ide_cs1_w(offs_t offset, uint8_t data) // RTC (Dallas DS1287A) // #FD15 (write only) register select // #FD14 (read/write) read from or write into selected register -uint8_t cpc_symbiface2_device::rtc_r(offs_t offset) -{ - return m_rtc->read(~offset & 0x01); -} - -void cpc_symbiface2_device::rtc_w(offs_t offset, uint8_t data) -{ - m_rtc->write(~offset & 0x01, data); -} // PS/2 Mouse connector // #FD10 (read only) read mouse status diff --git a/src/devices/bus/cpc/symbfac2.h b/src/devices/bus/cpc/symbfac2.h index 4bc59e8a5e6..5b5bb2e7e43 100644 --- a/src/devices/bus/cpc/symbfac2.h +++ b/src/devices/bus/cpc/symbfac2.h @@ -27,8 +27,6 @@ public: void ide_cs0_w(offs_t offset, uint8_t data); uint8_t ide_cs1_r(offs_t offset); void ide_cs1_w(offs_t offset, uint8_t data); - uint8_t rtc_r(offs_t offset); - void rtc_w(offs_t offset, uint8_t data); uint8_t mouse_r(); uint8_t rom_rewrite_r(); void rom_rewrite_w(uint8_t data); diff --git a/src/devices/bus/econet/e01.cpp b/src/devices/bus/econet/e01.cpp index fb542805048..b056783242d 100644 --- a/src/devices/bus/econet/e01.cpp +++ b/src/devices/bus/econet/e01.cpp @@ -219,8 +219,8 @@ void econet_e01_device::scsi_req_w(int state) void econet_e01_device::e01_mem(address_map &map) { map(0x0000, 0xffff).rw(FUNC(econet_e01_device::read), FUNC(econet_e01_device::write)); - map(0xfc00, 0xfc00).mirror(0x00c3).rw(FUNC(econet_e01_device::rtc_address_r), FUNC(econet_e01_device::rtc_address_w)); - map(0xfc04, 0xfc04).mirror(0x00c3).rw(FUNC(econet_e01_device::rtc_data_r), FUNC(econet_e01_device::rtc_data_w)); + map(0xfc00, 0xfc00).mirror(0x00c3).w(m_rtc, FUNC(mc146818_device::address_w)); + map(0xfc04, 0xfc04).mirror(0x00c3).rw(m_rtc, FUNC(mc146818_device::data_r), FUNC(mc146818_device::data_w)); map(0xfc08, 0xfc08).mirror(0x00c0).r(FUNC(econet_e01_device::ram_select_r)).w(FUNC(econet_e01_device::floppy_w)); map(0xfc0c, 0xfc0f).mirror(0x00c0).rw(WD2793_TAG, FUNC(wd2793_device::read), FUNC(wd2793_device::write)); map(0xfc10, 0xfc1f).mirror(0x00c0).m(R6522_TAG, FUNC(via6522_device::map)); @@ -649,46 +649,6 @@ void econet_e01_device::hdc_irq_enable_w(uint8_t data) } -//------------------------------------------------- -// rtc_address_r - -//------------------------------------------------- - -uint8_t econet_e01_device::rtc_address_r() -{ - return m_rtc->read(0); -} - - -//------------------------------------------------- -// rtc_address_w - -//------------------------------------------------- - -void econet_e01_device::rtc_address_w(uint8_t data) -{ - m_rtc->write(0, data); -} - - -//------------------------------------------------- -// rtc_data_r - -//------------------------------------------------- - -uint8_t econet_e01_device::rtc_data_r() -{ - return m_rtc->read(1); -} - - -//------------------------------------------------- -// rtc_data_w - -//------------------------------------------------- - -void econet_e01_device::rtc_data_w(uint8_t data) -{ - m_rtc->write(1, data); -} - - //------------------------------------------------- // econet_clk_w - //------------------------------------------------- diff --git a/src/devices/bus/econet/e01.h b/src/devices/bus/econet/e01.h index 8e3d6777565..07b39908155 100644 --- a/src/devices/bus/econet/e01.h +++ b/src/devices/bus/econet/e01.h @@ -79,10 +79,6 @@ private: void hdc_data_w(uint8_t data); void hdc_select_w(uint8_t data); void hdc_irq_enable_w(uint8_t data); - uint8_t rtc_address_r(); - void rtc_address_w(uint8_t data); - uint8_t rtc_data_r(); - void rtc_data_w(uint8_t data); static void floppy_formats_afs(format_registration &fr); diff --git a/src/devices/bus/electron/cart/click.cpp b/src/devices/bus/electron/cart/click.cpp index 46bb123c9e4..31537949a4f 100644 --- a/src/devices/bus/electron/cart/click.cpp +++ b/src/devices/bus/electron/cart/click.cpp @@ -96,9 +96,8 @@ uint8_t electron_click_device::read(offs_t offset, int infc, int infd, int romqa { switch (offset & 0xff) { - case 0xf8: case 0xf9: - data = m_rtc->read(offset & 0x01); + data = m_rtc->data_r(); break; case 0xfc: data = m_page_register; @@ -134,8 +133,10 @@ void electron_click_device::write(offs_t offset, uint8_t data, int infc, int inf switch (offset & 0xff) { case 0xf8: + m_rtc->address_w(data); + break; case 0xf9: - m_rtc->write(offset & 0x01, data); + m_rtc->data_w(data); break; case 0xfc: m_page_register = data; diff --git a/src/devices/bus/electron/cart/cumana.cpp b/src/devices/bus/electron/cart/cumana.cpp index d53ace1d4a3..9a81383697d 100644 --- a/src/devices/bus/electron/cart/cumana.cpp +++ b/src/devices/bus/electron/cart/cumana.cpp @@ -99,10 +99,10 @@ uint8_t electron_cumana_device::read(offs_t offset, int infc, int infd, int romq data = m_fdc->read(offset & 0x03); break; case 0x94: - break; case 0x98: + break; case 0x9c: - data = m_rtc->read(BIT(offset, 2)); + data = m_rtc->data_r(); break; } } @@ -146,8 +146,10 @@ void electron_cumana_device::write(offs_t offset, uint8_t data, int infc, int in control_w(data); break; case 0x98: + m_rtc->address_w(data); + break; case 0x9c: - m_rtc->write(BIT(offset, 2), data); + m_rtc->data_w(data); break; } } diff --git a/src/devices/bus/lpci/southbridge.cpp b/src/devices/bus/lpci/southbridge.cpp index ebbb0c47ce4..4a9b8641857 100644 --- a/src/devices/bus/lpci/southbridge.cpp +++ b/src/devices/bus/lpci/southbridge.cpp @@ -561,7 +561,8 @@ void southbridge_extended_device::device_start() spaceio.install_readwrite_handler(0x0060, 0x0063, read8smo_delegate(*m_keybc, FUNC(at_keyboard_controller_device::data_r)), write8smo_delegate(*m_keybc, FUNC(at_keyboard_controller_device::data_w)), 0x000000ff); spaceio.install_readwrite_handler(0x0064, 0x0067, read8smo_delegate(*m_keybc, FUNC(at_keyboard_controller_device::status_r)), write8smo_delegate(*m_keybc, FUNC(at_keyboard_controller_device::command_w)), 0xffffffff); - spaceio.install_readwrite_handler(0x0070, 0x007f, read8sm_delegate(*m_ds12885, FUNC(ds12885_device::read)), write8sm_delegate(*m_ds12885, FUNC(ds12885_device::write)), 0xffffffff); + spaceio.install_write_handler(0x0070, 0x007f, write8smo_delegate(*this, FUNC(southbridge_extended_device::rtc_nmi_w)), 0x00ff00ff); + spaceio.install_readwrite_handler(0x0070, 0x007f, read8smo_delegate(*m_ds12885, FUNC(ds12885_device::data_r)), write8smo_delegate(*m_ds12885, FUNC(ds12885_device::data_w)), 0xff00ff00); } //------------------------------------------------- @@ -573,15 +574,10 @@ void southbridge_extended_device::device_reset() southbridge_device::device_reset(); } -void southbridge_extended_device::write_rtc(offs_t offset, uint8_t data) +void southbridge_extended_device::rtc_nmi_w(uint8_t data) { - if (offset==0) { - m_nmi_enabled = BIT(data,7); - if (!m_nmi_enabled) - m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); - m_ds12885->write(0,data); - } - else { - m_ds12885->write(offset,data); - } + m_nmi_enabled = BIT(data,7); + if (!m_nmi_enabled) + m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); + m_ds12885->address_w(data); } diff --git a/src/devices/bus/lpci/southbridge.h b/src/devices/bus/lpci/southbridge.h index b6f70dc590d..2ea3a60a2ba 100644 --- a/src/devices/bus/lpci/southbridge.h +++ b/src/devices/bus/lpci/southbridge.h @@ -159,7 +159,7 @@ protected: required_device m_pc_kbdc; private: - void write_rtc(offs_t offset, uint8_t data); + void rtc_nmi_w(uint8_t data); }; #endif // MAME_BUS_LPCI_SOUTHBRIDGE_H diff --git a/src/devices/bus/samcoupe/expansion/dallas.cpp b/src/devices/bus/samcoupe/expansion/dallas.cpp index 30e7a1d0005..d877b94e6e1 100644 --- a/src/devices/bus/samcoupe/expansion/dallas.cpp +++ b/src/devices/bus/samcoupe/expansion/dallas.cpp @@ -67,8 +67,8 @@ uint8_t sam_dallas_clock_device::iorq_r(offs_t offset) { uint8_t data = 0xff; - if (m_print && (offset & 0xfe07) == 0xfe07) - data &= m_rtc->read((offset >> 8) & 0x01); + if (m_print && (offset & 0xff07) == 0xff07) + data &= m_rtc->data_r(); return data; } @@ -76,5 +76,10 @@ uint8_t sam_dallas_clock_device::iorq_r(offs_t offset) void sam_dallas_clock_device::iorq_w(offs_t offset, uint8_t data) { if (m_print && (offset & 0xfe07) == 0xfe07) - m_rtc->write((offset >> 8) & 0x01, data); + { + if (BIT(offset, 8)) + m_rtc->data_w(data); + else + m_rtc->address_w(data); + } } diff --git a/src/devices/bus/spectrum/smuc.cpp b/src/devices/bus/spectrum/smuc.cpp index 8851573947d..ba2aba269f4 100644 --- a/src/devices/bus/spectrum/smuc.cpp +++ b/src/devices/bus/spectrum/smuc.cpp @@ -90,12 +90,12 @@ void smuc_device::map_io(address_map &map) .lr8(NAME([]() { return 0x28; })); map(0x138a2, 0x138a2).mirror(0x4718) // 7fba | 0x111xxx101xx010 | VirtualFDD .lrw8(NAME([this]() { return m_port_7fba_data | 0x37; }) - , NAME([this](offs_t offset, u8 data) { m_port_7fba_data = data; })); + , NAME([this](u8 data) { m_port_7fba_data = data; })); map(0x138a6, 0x138a6).mirror(0x4718) // 7[ef]be | 0x111xxN101xx110 | i8259 - absent in 2.0 .lr8(NAME([]() { return 0x57; })).nopw(); map(0x198a2, 0x198a2).mirror(0x4718) // dfba | 1x011xxx101xx010 | DS1685RTC - .lrw8(NAME([this]() { return m_rtc->read(1); }) - , NAME([this](offs_t offset, u8 data) { m_rtc->write(BIT(m_port_ffba_data, 7), data); })); + .lrw8(NAME([this]() { return m_rtc->data_r(); }) + , NAME([this](u8 data) { if (BIT(m_port_ffba_data, 7)) m_rtc->data_w(data); else m_rtc->address_w(data); })); map(0x198a6, 0x198a6).mirror(0x4718) // d8be | 1x011xxx101xx110 | IDE-Hi .lrw8(NAME([this]() { return m_ide_hi; }), NAME([this](u8 data) { m_ide_hi = data; })); map(0x1b8a2, 0x1b8a2).mirror(0x4718) // ffba | 1x111xxx101xx010 | SYS diff --git a/src/devices/bus/tanbus/radisc.cpp b/src/devices/bus/tanbus/radisc.cpp index 4b0d14fb4f9..add9a7e3945 100644 --- a/src/devices/bus/tanbus/radisc.cpp +++ b/src/devices/bus/tanbus/radisc.cpp @@ -121,8 +121,8 @@ uint8_t tanbus_radisc_device::read(offs_t offset, int inhrom, int inhram, int be case 0xbf94: data = status_r(); break; - case 0xbf98: case 0xbf99: - data = m_rtc->read(offset & 0x01); + case 0xbf99: + data = m_rtc->data_r(); break; } @@ -150,8 +150,11 @@ void tanbus_radisc_device::write(offs_t offset, uint8_t data, int inhrom, int in m_beeper_state ^= 1; m_beeper->set_state(m_beeper_state); break; - case 0xbf98: case 0xbf99: - m_rtc->write(offset & 0x01, data); + case 0xbf98: + m_rtc->address_w(data); + break; + case 0xbf99: + m_rtc->data_w(data); break; } } diff --git a/src/devices/machine/at.cpp b/src/devices/machine/at.cpp index f88a65688d0..22aab4ee090 100644 --- a/src/devices/machine/at.cpp +++ b/src/devices/machine/at.cpp @@ -156,7 +156,8 @@ void at_mb_device::map(address_map &map) map(0x0061, 0x0061).rw(FUNC(at_mb_device::portb_r), FUNC(at_mb_device::portb_w)); map(0x0060, 0x0060).rw("keybc", FUNC(at_keyboard_controller_device::data_r), FUNC(at_keyboard_controller_device::data_w)); map(0x0064, 0x0064).rw("keybc", FUNC(at_keyboard_controller_device::status_r), FUNC(at_keyboard_controller_device::command_w)); - map(0x0070, 0x007f).r("rtc", FUNC(mc146818_device::read)).umask16(0xffff).w(FUNC(at_mb_device::write_rtc)).umask16(0xffff); + map(0x0070, 0x007f).w(m_mc146818, FUNC(at_mb_device::rtcas_nmi_w)).umask16(0x00ff); + map(0x0070, 0x007f).rw(m_mc146818, FUNC(mc146818_device::data_r), FUNC(mc146818_device::data_w)).umask16(0xff00); map(0x0080, 0x009f).rw(FUNC(at_mb_device::page8_r), FUNC(at_mb_device::page8_w)).umask16(0xffff); map(0x00a0, 0x00bf).rw("pic8259_slave", FUNC(pic8259_device::read), FUNC(pic8259_device::write)).umask16(0xffff); map(0x00c0, 0x00df).rw("dma8237_2", FUNC(am9517a_device::read), FUNC(am9517a_device::write)).umask16(0x00ff); @@ -360,17 +361,12 @@ void at_mb_device::set_dma_channel(int channel, int state) } } -void at_mb_device::write_rtc(offs_t offset, uint8_t data) +void at_mb_device::rtcas_nmi_w(uint8_t data) { - if (offset==0) { - m_nmi_enabled = BIT(data,7); - if (!m_nmi_enabled) - m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); - m_mc146818->write(0,data); - } - else { - m_mc146818->write(offset,data); - } + m_nmi_enabled = BIT(data,7); + if (!m_nmi_enabled) + m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); + m_mc146818->address_w(data); } uint32_t at_mb_device::a20_286(bool state) diff --git a/src/devices/machine/at.h b/src/devices/machine/at.h index d41e9448401..b6f98a06b45 100644 --- a/src/devices/machine/at.h +++ b/src/devices/machine/at.h @@ -28,7 +28,7 @@ public: void kbd_data_w(int state); uint8_t portb_r(); void portb_w(uint8_t data); - void write_rtc(offs_t offset, uint8_t data); + void rtcas_nmi_w(uint8_t data); void iochck_w(int state); void shutdown(int state); diff --git a/src/devices/machine/cs4031.cpp b/src/devices/machine/cs4031.cpp index 36d8b51e322..c885c30b056 100644 --- a/src/devices/machine/cs4031.cpp +++ b/src/devices/machine/cs4031.cpp @@ -16,7 +16,7 @@ - 2x 8257 DMA controller - 2x 8259 interrupt controller - 8254 timer - - MC14818 RTC + - MC146818 RTC TODO: - No emulation of memory parity checks @@ -256,7 +256,8 @@ void cs4031_device::device_start() m_space_io->install_readwrite_handler(0x0060, 0x0063, read8smo_delegate(*this, FUNC(cs4031_device::keyb_data_r)), write8smo_delegate(*this, FUNC(cs4031_device::keyb_data_w)), 0x000000ff); m_space_io->install_readwrite_handler(0x0060, 0x0063, read8smo_delegate(*this, FUNC(cs4031_device::portb_r)), write8smo_delegate(*this, FUNC(cs4031_device::portb_w)), 0x0000ff00); m_space_io->install_readwrite_handler(0x0064, 0x0067, read8smo_delegate(*this, FUNC(cs4031_device::keyb_status_r)), write8smo_delegate(*this, FUNC(cs4031_device::keyb_command_w)), 0x000000ff); - m_space_io->install_readwrite_handler(0x0070, 0x0073, read8sm_delegate(*m_rtc, FUNC(mc146818_device::read)), write8sm_delegate(*this, FUNC(cs4031_device::rtc_w)), 0x0000ffff); + m_space_io->install_write_handler(0x0070, 0x0073, write8smo_delegate(*this, FUNC(cs4031_device::rtc_nmi_w)), 0x000000ff); // RTC address (84035) and NMI mask (84031) are both write-only + m_space_io->install_readwrite_handler(0x0070, 0x0073, read8smo_delegate(*m_rtc, FUNC(mc146818_device::data_r)), write8smo_delegate(*m_rtc, FUNC(mc146818_device::data_w)), 0x0000ff00); m_space_io->install_readwrite_handler(0x0080, 0x008f, read8sm_delegate(*this, FUNC(cs4031_device::dma_page_r)), write8sm_delegate(*this, FUNC(cs4031_device::dma_page_w)), 0xffffffff); m_space_io->install_readwrite_handler(0x0090, 0x0093, read8smo_delegate(*this, FUNC(cs4031_device::sysctrl_r)), write8smo_delegate(*this, FUNC(cs4031_device::sysctrl_w)), 0x00ff0000); m_space_io->install_readwrite_handler(0x00a0, 0x00a3, read8sm_delegate(*m_intc2, FUNC(pic8259_device::read)), write8sm_delegate(*m_intc2, FUNC(pic8259_device::write)), 0x0000ffff); @@ -898,16 +899,13 @@ void cs4031_device::portb_w(uint8_t data) 7 - NMI mask 6:0 - RTC address */ -void cs4031_device::rtc_w(offs_t offset, uint8_t data) +void cs4031_device::rtc_nmi_w(uint8_t data) { if (0) - logerror("cs4031_device::rtc_w: %02x\n", data); + logerror("cs4031_device::rtc_nmi_w: %02x\n", data); - if (offset == 0) - { - m_nmi_mask = !BIT(data, 7); - data &= 0x7f; - } + m_nmi_mask = !BIT(data, 7); + data &= 0x7f; - m_rtc->write(offset, data); + m_rtc->address_w(data); } diff --git a/src/devices/machine/cs4031.h b/src/devices/machine/cs4031.h index 09c7f97fc82..4a98721861b 100644 --- a/src/devices/machine/cs4031.h +++ b/src/devices/machine/cs4031.h @@ -4,20 +4,6 @@ Chips & Technologies CS4031 chipset - Chipset for 486 based PC/AT compatible systems. Consists of two - individual chips: - - * F84031 - - DRAM controller - - ISA-bus controller - - VESA VL-BUS controller - - * F84035 (82C206 IPC core) - - 2x 8257 DMA controller - - 2x 8259 interrupt controller - - 8254 timer - - MC14818 RTC - ***************************************************************************/ #ifndef MAME_MACHINE_CS4031_H @@ -66,7 +52,7 @@ public: void config_data_w(uint8_t data); uint8_t portb_r(); void portb_w(uint8_t data); - void rtc_w(offs_t offset, uint8_t data); + void rtc_nmi_w(uint8_t data); void sysctrl_w(uint8_t data); uint8_t sysctrl_r(); uint8_t dma_page_r(offs_t offset) { return m_dma_page[offset]; } diff --git a/src/devices/machine/ds128x.cpp b/src/devices/machine/ds128x.cpp index 8292e5237f2..a4ff2c19228 100644 --- a/src/devices/machine/ds128x.cpp +++ b/src/devices/machine/ds128x.cpp @@ -49,12 +49,11 @@ uint8_t ds12885ext_device::read_extended(offs_t offset) switch (offset) { case 0: - case 1: - return read(offset); - break; case 2: + return get_address(); + case 1: case 3: - return read(offset - 2); + return data_r(); break; default: return 0xff; @@ -66,16 +65,16 @@ void ds12885ext_device::write_extended(offs_t offset, uint8_t data) switch (offset) { case 0: - write(offset, data & 127); + address_w(data & 127); break; case 1: - write(offset, data); + data_w(data); break; case 2: - write(offset - 2, data); + address_w(data); break; case 3: - write(offset - 2, data); + data_w(data); break; } } diff --git a/src/devices/machine/fdc37c93x.cpp b/src/devices/machine/fdc37c93x.cpp index 81118b696d9..e154e50693a 100644 --- a/src/devices/machine/fdc37c93x.cpp +++ b/src/devices/machine/fdc37c93x.cpp @@ -609,7 +609,8 @@ void fdc37c93x_device::unmap_serial2_addresses() void fdc37c93x_device::map_rtc(address_map &map) { - map(0x0, 0xf).rw(ds12885_rtcdev, FUNC(ds12885_device::read), FUNC(ds12885_device::write)); + map(0x0, 0xf).lr8(NAME([this]() { return ds12885_rtcdev->get_address(); })).w(ds12885_rtcdev, FUNC(ds12885_device::address_w)).umask32(0x00ff00ff); // datasheet implies address might be a R/W register + map(0x0, 0xf).rw(ds12885_rtcdev, FUNC(ds12885_device::data_r), FUNC(ds12885_device::data_w)).umask32(0xff00ff00); } void fdc37c93x_device::map_rtc_addresses() diff --git a/src/devices/machine/i82357.cpp b/src/devices/machine/i82357.cpp index 0a044348036..0d8c14c4bbe 100644 --- a/src/devices/machine/i82357.cpp +++ b/src/devices/machine/i82357.cpp @@ -33,7 +33,7 @@ i82357_device::i82357_device(const machine_config &mconfig, const char *tag, dev , m_pic(*this, "pic%u", 0) , m_pit(*this, "pit%u", 0) , m_dma(*this, "dma%u", 0) - , m_out_rtc(*this) + , m_out_rtc_address(*this) , m_out_nmi(*this) , m_out_spkr(*this) { @@ -128,7 +128,7 @@ void i82357_device::map(address_map &map) { m_nmi_enabled = !BIT(data, 7); - m_out_rtc(0, data & 0x7f); + m_out_rtc_address(data & 0x7f); m_nmi_check->adjust(attotime::zero); }, "nmi_rtc").umask64(0xff); diff --git a/src/devices/machine/i82357.h b/src/devices/machine/i82357.h index 9f8a31cdfc3..7b15cb5c6bb 100644 --- a/src/devices/machine/i82357.h +++ b/src/devices/machine/i82357.h @@ -15,7 +15,7 @@ class i82357_device : public device_t public: i82357_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); - auto out_rtc_cb() { return m_out_rtc.bind(); } + auto out_rtc_address_cb() { return m_out_rtc_address.bind(); } auto out_int_cb() { return m_pic[0].lookup()->out_int_callback(); } auto out_nmi_cb() { return m_out_nmi.bind(); } auto out_spkr_cb() { return m_out_spkr.bind(); } @@ -45,7 +45,7 @@ private: required_device_array m_pit; required_device_array m_dma; - devcb_write8 m_out_rtc; + devcb_write8 m_out_rtc_address; devcb_write_line m_out_nmi; devcb_write_line m_out_spkr; diff --git a/src/devices/machine/mc146818.cpp b/src/devices/machine/mc146818.cpp index a01e5d08427..dd956657526 100644 --- a/src/devices/machine/mc146818.cpp +++ b/src/devices/machine/mc146818.cpp @@ -585,20 +585,12 @@ void mc146818_device::update_irq() // read - I/O handler for reading //------------------------------------------------- -uint8_t mc146818_device::read(offs_t offset) +uint8_t mc146818_device::data_r() { - uint8_t data = 0; - switch (offset) - { - case 0: - data = m_index; - break; + uint8_t data = internal_read(m_index); - case 1: - data = internal_read(m_index); + if (!machine().side_effects_disabled()) LOG("mc146818_port_r(): offset=0x%02x data=0x%02x\n", m_index, data); - break; - } return data; } @@ -611,7 +603,8 @@ uint8_t mc146818_device::read_direct(offs_t offset) uint8_t data = internal_read(offset); - LOG("mc146818_port_r(): offset=0x%02x data=0x%02x\n", offset, data); + if (!machine().side_effects_disabled()) + LOG("mc146818_port_r(): offset=0x%02x data=0x%02x\n", offset, data); return data; } @@ -620,19 +613,16 @@ uint8_t mc146818_device::read_direct(offs_t offset) // write - I/O handler for writing //------------------------------------------------- -void mc146818_device::write(offs_t offset, uint8_t data) +void mc146818_device::address_w(uint8_t data) { - switch (offset) - { - case 0: - internal_set_address(data % data_logical_size()); - break; + internal_set_address(data % data_logical_size()); +} - case 1: - LOG("mc146818_port_w(): offset=0x%02x data=0x%02x\n", m_index, data); - internal_write(m_index, data); - break; - } +void mc146818_device::data_w(uint8_t data) +{ + LOG("mc146818_port_w(): offset=0x%02x data=0x%02x\n", m_index, data); + + internal_write(m_index, data); } void mc146818_device::write_direct(offs_t offset, uint8_t data) diff --git a/src/devices/machine/mc146818.h b/src/devices/machine/mc146818.h index 6e3fff11fd7..1bee70ec6c9 100644 --- a/src/devices/machine/mc146818.h +++ b/src/devices/machine/mc146818.h @@ -39,13 +39,17 @@ public: void set_epoch(int epoch) { m_epoch = epoch; } // read/write access - uint8_t read(offs_t offset); - void write(offs_t offset, uint8_t data); + void address_w(uint8_t data); + uint8_t data_r(); + void data_w(uint8_t data); // direct-mapped read/write access uint8_t read_direct(offs_t offset); void write_direct(offs_t offset, uint8_t data); + // FIXME: Addresses are read-only on a standard MC146818. Do some chipsets permit readback? + uint8_t get_address() const { return m_index; } + protected: mc146818_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); diff --git a/src/devices/machine/pc87306.cpp b/src/devices/machine/pc87306.cpp index f8f4a515f0c..c06a4751967 100644 --- a/src/devices/machine/pc87306.cpp +++ b/src/devices/machine/pc87306.cpp @@ -101,7 +101,7 @@ void pc87306_device::remap(int space_id, offs_t start, offs_t end) } if (BIT(m_krr, 3)) - m_isa->install_device(0x70, 0x71, read8sm_delegate(*m_rtc, FUNC(ds12885_device::read)), write8sm_delegate(*m_rtc, FUNC(ds12885_device::write))); + m_isa->install_device(0x70, 0x71, read8sm_delegate(*this, FUNC(pc87306_device::rtc_r)), write8sm_delegate(*this, FUNC(pc87306_device::rtc_w))); } } @@ -200,6 +200,22 @@ void pc87306_device::keybc_command_w(offs_t offset, u8 data) m_kbdc->data_w(4, data); } +u8 pc87306_device::rtc_r(offs_t offset) +{ + if (BIT(offset, 0)) + return m_rtc->data_r(); // TODO: SCF0 bit 0 locks addresses 38 to 3F (FF is returned) + else + return m_rtc->get_address(); // datasheet doesn't clarify whether or not this is actually readable +} + +void pc87306_device::rtc_w(offs_t offset, u8 data) +{ + if (BIT(offset, 0)) + m_rtc->data_w(data); // TODO: SCF0 bit 0 locks addresses 38 to 3F + else + m_rtc->address_w(data); +} + /* * KBC lines */ diff --git a/src/devices/machine/pc87306.h b/src/devices/machine/pc87306.h index f6aea07cd37..1ab9c582627 100644 --- a/src/devices/machine/pc87306.h +++ b/src/devices/machine/pc87306.h @@ -67,6 +67,8 @@ private: u8 keybc_status_r(offs_t offset); void keybc_command_w(offs_t offset, u8 data); + u8 rtc_r(offs_t offset); + void rtc_w(offs_t offset, u8 data); void kbdp21_gp25_gatea20_w(int state); void kbdp20_gp20_reset_w(int state); diff --git a/src/devices/machine/sis85c496.cpp b/src/devices/machine/sis85c496.cpp index 877217d6f33..f74a1d818c7 100644 --- a/src/devices/machine/sis85c496.cpp +++ b/src/devices/machine/sis85c496.cpp @@ -47,7 +47,8 @@ void sis85c496_host_device::internal_io_map(address_map &map) map(0x0040, 0x005f).rw("pit8254", FUNC(pit8254_device::read), FUNC(pit8254_device::write)); map(0x0060, 0x0063).rw(FUNC(sis85c496_host_device::at_keybc_r), FUNC(sis85c496_host_device::at_keybc_w)); map(0x0064, 0x0067).rw("keybc", FUNC(at_keyboard_controller_device::status_r), FUNC(at_keyboard_controller_device::command_w)); - map(0x0070, 0x007f).rw("rtc", FUNC(ds12885_device::read), FUNC(ds12885_device::write)); + map(0x0070, 0x007f).w(FUNC(sis85c496_host_device::rtc_nmi_w)).umask32(0x00ff00ff); + map(0x0070, 0x007f).rw("rtc", FUNC(ds12885_device::data_r), FUNC(ds12885_device::data_w)).umask32(0xff00ff00); map(0x0080, 0x009f).rw(FUNC(sis85c496_host_device::at_page8_r), FUNC(sis85c496_host_device::at_page8_w)); map(0x00a0, 0x00bf).rw("pic8259_slave", FUNC(pic8259_device::read), FUNC(pic8259_device::write)); map(0x00c0, 0x00df).rw(FUNC(sis85c496_host_device::at_dma8237_2_r), FUNC(sis85c496_host_device::at_dma8237_2_w)); @@ -618,16 +619,11 @@ void sis85c496_host_device::at_keybc_w(offs_t offset, uint8_t data) } -void sis85c496_host_device::write_rtc(offs_t offset, uint8_t data) +void sis85c496_host_device::rtc_nmi_w(uint8_t data) { - if (offset==0) { - m_nmi_enabled = BIT(data,7); - //m_isabus->set_nmi_state((m_nmi_enabled==0) && (m_channel_check==0)); - m_ds12885->write(0,data); - } - else { - m_ds12885->write(offset,data); - } + m_nmi_enabled = BIT(data,7); + //m_isabus->set_nmi_state((m_nmi_enabled==0) && (m_channel_check==0)); + m_ds12885->address_w(data); } void sis85c496_host_device::cpu_a20_w(int state) diff --git a/src/devices/machine/sis85c496.h b/src/devices/machine/sis85c496.h index ab63f044c9a..1636b2177e0 100644 --- a/src/devices/machine/sis85c496.h +++ b/src/devices/machine/sis85c496.h @@ -152,7 +152,7 @@ private: void at_dma8237_2_w(offs_t offset, uint8_t data); uint8_t at_keybc_r(offs_t offset); void at_keybc_w(offs_t offset, uint8_t data); - void write_rtc(offs_t offset, uint8_t data); + void rtc_nmi_w(uint8_t data); uint8_t pc_dma_read_byte(offs_t offset); void pc_dma_write_byte(offs_t offset, uint8_t data); uint8_t pc_dma_read_word(offs_t offset); diff --git a/src/devices/machine/w83977tf.cpp b/src/devices/machine/w83977tf.cpp index 0449d0363a0..a2d5cbe0254 100644 --- a/src/devices/machine/w83977tf.cpp +++ b/src/devices/machine/w83977tf.cpp @@ -103,7 +103,7 @@ void w83977tf_device::remap(int space_id, offs_t start, offs_t end) if (m_activate[8] & 1) { // TODO: from port - m_isa->install_device(0x70, 0x7f, read8sm_delegate(*m_rtc, FUNC(ds12885_device::read)), write8sm_delegate(*m_rtc, FUNC(ds12885_device::write))); + m_isa->install_device(0x70, 0x7f, read8sm_delegate(*this, FUNC(w83977tf_device::rtc_r)), write8sm_delegate(*this, FUNC(w83977tf_device::rtc_w))); } } } @@ -386,6 +386,22 @@ void w83977tf_device::keyb_io_address_w(offs_t offset, u8 data) * Device #8 (RTC) */ +u8 w83977tf_device::rtc_r(offs_t offset) +{ + if (BIT(offset, 0)) + return m_rtc->data_r(); + else + return m_rtc->get_address(); +} + +void w83977tf_device::rtc_w(offs_t offset, u8 data) +{ + if (BIT(offset, 0)) + m_rtc->data_w(data); + else + m_rtc->address_w(data); +} + void w83977tf_device::irq_rtc_w(int state) { if (m_activate[8] == false) diff --git a/src/devices/machine/w83977tf.h b/src/devices/machine/w83977tf.h index 9eceda2bd7b..2fe165f3135 100644 --- a/src/devices/machine/w83977tf.h +++ b/src/devices/machine/w83977tf.h @@ -87,6 +87,9 @@ private: void kbdp21_gp25_gatea20_w(int state); void kbdp20_gp20_reset_w(int state); + u8 rtc_r(offs_t offset); + void rtc_w(offs_t offset, u8 data); + u8 rtc_irq_r(offs_t offset); void rtc_irq_w(offs_t offset, u8 data); diff --git a/src/devices/machine/wd7600.cpp b/src/devices/machine/wd7600.cpp index 3f984614ce4..e75fc067552 100644 --- a/src/devices/machine/wd7600.cpp +++ b/src/devices/machine/wd7600.cpp @@ -154,7 +154,8 @@ void wd7600_device::device_start() m_space_io->install_readwrite_handler(0x0060, 0x0061, read8smo_delegate(*this, FUNC(wd7600_device::keyb_data_r)), write8smo_delegate(*this, FUNC(wd7600_device::keyb_data_w)), 0x00ff); m_space_io->install_readwrite_handler(0x0060, 0x0061, read8smo_delegate(*this, FUNC(wd7600_device::portb_r)), write8smo_delegate(*this, FUNC(wd7600_device::portb_w)), 0xff00); m_space_io->install_readwrite_handler(0x0064, 0x0065, read8smo_delegate(*this, FUNC(wd7600_device::keyb_status_r)), write8smo_delegate(*this, FUNC(wd7600_device::keyb_cmd_w)), 0x00ff); - m_space_io->install_readwrite_handler(0x0070, 0x007f, read8sm_delegate(*m_rtc, FUNC(mc146818_device::read)), write8sm_delegate(*this, FUNC(wd7600_device::rtc_w)), 0xffff); + m_space_io->install_write_handler(0x0070, 0x007f, write8smo_delegate(*this, FUNC(wd7600_device::rtc_nmi_w)), 0x00ff); + m_space_io->install_readwrite_handler(0x0070, 0x007f, read8smo_delegate(*m_rtc, FUNC(mc146818_device::data_r)), write8smo_delegate(*m_rtc, FUNC(mc146818_device::data_w)), 0xff00); m_space_io->install_readwrite_handler(0x0080, 0x008f, read8sm_delegate(*this, FUNC(wd7600_device::dma_page_r)), write8sm_delegate(*this, FUNC(wd7600_device::dma_page_w)), 0xffff); m_space_io->install_readwrite_handler(0x0092, 0x0093, read8smo_delegate(*this, FUNC(wd7600_device::a20_reset_r)), write8smo_delegate(*this, FUNC(wd7600_device::a20_reset_w)), 0x00ff); m_space_io->install_readwrite_handler(0x00a0, 0x00a3, read8sm_delegate(*m_pic2, FUNC(pic8259_device::read)), write8sm_delegate(*m_pic2, FUNC(pic8259_device::write)), 0xffff); @@ -176,7 +177,8 @@ void wd7600_device::device_start() m_space_io->install_readwrite_handler(0x0060, 0x0063, read8smo_delegate(*this, FUNC(wd7600_device::keyb_data_r)), write8smo_delegate(*this, FUNC(wd7600_device::keyb_data_w)), 0x000000ff); m_space_io->install_readwrite_handler(0x0060, 0x0063, read8smo_delegate(*this, FUNC(wd7600_device::portb_r)), write8smo_delegate(*this, FUNC(wd7600_device::portb_w)), 0x0000ff00); m_space_io->install_readwrite_handler(0x0064, 0x0067, read8smo_delegate(*this, FUNC(wd7600_device::keyb_status_r)), write8smo_delegate(*this, FUNC(wd7600_device::keyb_cmd_w)), 0x000000ff); - m_space_io->install_readwrite_handler(0x0070, 0x007f, read8sm_delegate(*m_rtc, FUNC(mc146818_device::read)), write8sm_delegate(*this, FUNC(wd7600_device::rtc_w)), 0x0000ffff); + m_space_io->install_write_handler(0x0070, 0x007f, write8smo_delegate(*this, FUNC(wd7600_device::rtc_nmi_w)), 0x000000ff); + m_space_io->install_readwrite_handler(0x0070, 0x007f, read8smo_delegate(*m_rtc, FUNC(mc146818_device::data_r)), write8smo_delegate(*m_rtc, FUNC(mc146818_device::data_w)), 0x0000ff00); m_space_io->install_readwrite_handler(0x0080, 0x008f, read8sm_delegate(*this, FUNC(wd7600_device::dma_page_r)), write8sm_delegate(*this, FUNC(wd7600_device::dma_page_w)), 0xffffffff); m_space_io->install_readwrite_handler(0x0090, 0x0093, read8smo_delegate(*this, FUNC(wd7600_device::a20_reset_r)), write8smo_delegate(*this, FUNC(wd7600_device::a20_reset_w)), 0x00ff0000); m_space_io->install_readwrite_handler(0x00a0, 0x00a3, read8sm_delegate(*m_pic2, FUNC(pic8259_device::read)), write8sm_delegate(*m_pic2, FUNC(pic8259_device::write)), 0x0000ffff); @@ -244,15 +246,12 @@ void wd7600_device::keyboard_gatea20(int state) a20m(); } -void wd7600_device::rtc_w(offs_t offset, uint8_t data) +void wd7600_device::rtc_nmi_w(uint8_t data) { - if (offset == 0) - { - m_nmi_mask = !BIT(data, 7); - data &= 0x7f; - } + m_nmi_mask = !BIT(data, 7); + data &= 0x7f; - m_rtc->write(offset, data); + m_rtc->address_w(data); } uint8_t wd7600_device::pic1_slave_ack_r(offs_t offset) diff --git a/src/devices/machine/wd7600.h b/src/devices/machine/wd7600.h index 2db1718bb41..6e81862ed48 100644 --- a/src/devices/machine/wd7600.h +++ b/src/devices/machine/wd7600.h @@ -104,7 +104,7 @@ private: uint8_t pic1_slave_ack_r(offs_t offset); void ctc_out1_w(int state); void ctc_out2_w(int state); - void rtc_w(offs_t offset, uint8_t data); + void rtc_nmi_w(uint8_t data); void keyb_cmd_w(uint8_t data); void keyb_data_w(uint8_t data); uint8_t keyb_data_r(); diff --git a/src/mame/acorn/bbc_m.cpp b/src/mame/acorn/bbc_m.cpp index 8661cb34d89..bc84655b628 100644 --- a/src/mame/acorn/bbc_m.cpp +++ b/src/mame/acorn/bbc_m.cpp @@ -857,18 +857,18 @@ void bbc_state::mc146818_set() { if (m_latch->q1_r()) // WR { - m_via_system_porta = m_rtc->read(1); + m_via_system_porta = m_rtc->data_r(); } else { - m_rtc->write(1, m_via_system_porta); + m_rtc->data_w(m_via_system_porta); } } /* if address select is set then set the address in the 146818 */ if (m_mc146818_as) { - m_rtc->write(0, m_via_system_porta); + m_rtc->address_w(m_via_system_porta); } } } diff --git a/src/mame/amstrad/amstr_pc.cpp b/src/mame/amstrad/amstr_pc.cpp index d872082db4c..61f50493a44 100644 --- a/src/mame/amstrad/amstr_pc.cpp +++ b/src/mame/amstrad/amstr_pc.cpp @@ -299,7 +299,8 @@ void amstrad_pc_state::pc200_io(address_map &map) void amstrad_pc_state::ppc512_io(address_map &map) { pc200_io(map); - map(0x0070, 0x0071).rw("rtc", FUNC(mc146818_device::read), FUNC(mc146818_device::write)); + map(0x0070, 0x0070).w("rtc", FUNC(mc146818_device::address_w)); + map(0x0071, 0x0071).rw("rtc", FUNC(mc146818_device::data_r), FUNC(mc146818_device::data_w)); } void amstrad_pc_state::machine_start() diff --git a/src/mame/amstrad/amstrad_m.cpp b/src/mame/amstrad/amstrad_m.cpp index c3f420815ec..ef47ce3a193 100644 --- a/src/mame/amstrad/amstrad_m.cpp +++ b/src/mame/amstrad/amstrad_m.cpp @@ -2487,13 +2487,13 @@ void amstrad_state::update_psg() switch(m_aleste_rtc_function) { case 0x02: // AS - m_rtc->write(0, m_ppi_port_outputs[amstrad_ppi_PortA]); + m_rtc->address_w(m_ppi_port_outputs[amstrad_ppi_PortA]); break; case 0x04: // DS write - m_rtc->write(1, m_ppi_port_outputs[amstrad_ppi_PortA]); + m_rtc->data_w(m_ppi_port_outputs[amstrad_ppi_PortA]); break; case 0x05: // DS read - m_ppi_port_inputs[amstrad_ppi_PortA] = m_rtc->read(1); + m_ppi_port_inputs[amstrad_ppi_PortA] = m_rtc->data_r(); break; } return; diff --git a/src/mame/amstrad/nc.cpp b/src/mame/amstrad/nc.cpp index 953d45af03d..63e333e2870 100644 --- a/src/mame/amstrad/nc.cpp +++ b/src/mame/amstrad/nc.cpp @@ -326,7 +326,8 @@ void nc200_state::io_map(address_map &map) map(0xa0, 0xa0).portr("battery"); map(0xb0, 0xb9).r(FUNC(nc200_state::keyboard_r)); map(0xc0, 0xc1).rw(m_uart, FUNC(i8251_device::read), FUNC(i8251_device::write)); - map(0xd0, 0xd1).rw(m_rtc, FUNC(mc146818_device::read), FUNC(mc146818_device::write)); + map(0xd0, 0xd0).w(m_rtc, FUNC(mc146818_device::address_w)); + map(0xd1, 0xd1).rw(m_rtc, FUNC(mc146818_device::data_r), FUNC(mc146818_device::data_w)); map(0xe0, 0xe1).m(m_fdc, FUNC(upd765a_device::map)); } diff --git a/src/mame/amstrad/pc1512.cpp b/src/mame/amstrad/pc1512.cpp index aa34b699f7e..f0778468379 100644 --- a/src/mame/amstrad/pc1512.cpp +++ b/src/mame/amstrad/pc1512.cpp @@ -563,7 +563,7 @@ uint8_t pc1640_state::io_r(offs_t offset) else if (addr >= 0x020 && addr <= 0x021) { data = m_pic->read(offset & 0x01); decoded = true; } else if (addr >= 0x040 && addr <= 0x043) { data = m_pit->read(offset & 0x03); decoded = true; } else if (addr >= 0x060 && addr <= 0x06f) { data = system_r(offset & 0x0f); decoded = true; } - else if (addr >= 0x070 && addr <= 0x073) { data = m_rtc->read(offset & 0x01); decoded = true; } + else if (addr == 0x071 || addr == 0x073) { data = m_rtc->data_r(); decoded = true; } else if (addr >= 0x078 && addr <= 0x07f) { data = mouse_r(offset & 0x07); decoded = true; } else if (addr >= 0x378 && addr <= 0x37b) { data = printer_r(offset & 0x03); decoded = true; } else if (addr >= 0x3b0 && addr <= 0x3df) { decoded = true; } @@ -631,7 +631,8 @@ void pc1512_state::pc1512_io(address_map &map) map(0x020, 0x021).rw(m_pic, FUNC(pic8259_device::read), FUNC(pic8259_device::write)); map(0x040, 0x043).rw(m_pit, FUNC(pit8253_device::read), FUNC(pit8253_device::write)); map(0x060, 0x06f).rw(FUNC(pc1512_state::system_r), FUNC(pc1512_state::system_w)); - map(0x070, 0x071).mirror(0x02).rw(m_rtc, FUNC(mc146818_device::read), FUNC(mc146818_device::write)); + map(0x070, 0x070).mirror(0x02).w(m_rtc, FUNC(mc146818_device::address_w)); + map(0x071, 0x071).mirror(0x02).rw(m_rtc, FUNC(mc146818_device::data_r), FUNC(mc146818_device::data_w)); map(0x078, 0x07f).rw(FUNC(pc1512_state::mouse_r), FUNC(pc1512_state::mouse_w)); map(0x080, 0x083).w(FUNC(pc1512_state::dma_page_w)); map(0x0a1, 0x0a1).w(FUNC(pc1512_state::nmi_mask_w)); @@ -666,7 +667,8 @@ void pc1640_state::pc1640_io(address_map &map) map(0x020, 0x021).w(m_pic, FUNC(pic8259_device::write)); map(0x040, 0x043).w(m_pit, FUNC(pit8253_device::write)); map(0x060, 0x06f).w(FUNC(pc1640_state::system_w)); - map(0x070, 0x071).mirror(0x02).w(m_rtc, FUNC(mc146818_device::write)); + map(0x070, 0x070).mirror(0x02).w(m_rtc, FUNC(mc146818_device::address_w)); + map(0x071, 0x071).mirror(0x02).w(m_rtc, FUNC(mc146818_device::data_w)); map(0x078, 0x07f).w(FUNC(pc1640_state::mouse_w)); map(0x080, 0x083).w(FUNC(pc1640_state::dma_page_w)); map(0x0a1, 0x0a1).w(FUNC(pc1640_state::nmi_mask_w)); diff --git a/src/mame/aristocrat/aristmk4.cpp b/src/mame/aristocrat/aristmk4.cpp index 32c09429d8f..3419e12a638 100644 --- a/src/mame/aristocrat/aristmk4.cpp +++ b/src/mame/aristocrat/aristmk4.cpp @@ -676,7 +676,7 @@ uint8_t aristmk4_state::mkiv_pia_ina() { /* uncomment this code once RTC is fixed */ - //return m_rtc->read(1); + //return m_rtc->data_r(); return 0; // OK for now, the aussie version has no RTC on the MB so this is valid. } @@ -685,12 +685,12 @@ void aristmk4_state::mkiv_pia_outa(uint8_t data) { if(m_rtc_data_strobe) { - m_rtc->write(1,data); + m_rtc->data_w(data); //logerror("rtc protocol write data: %02X\n",data); } else { - m_rtc->write(0,data); + m_rtc->address_w(data); //logerror("rtc protocol write address: %02X\n",data); } } diff --git a/src/mame/ausnz/mbee.cpp b/src/mame/ausnz/mbee.cpp index 7c864a175fd..14ea2e2be1f 100644 --- a/src/mame/ausnz/mbee.cpp +++ b/src/mame/ausnz/mbee.cpp @@ -242,9 +242,9 @@ void mbee_state::mbeett_io(address_map &map) { map.unmap_value_high(); map(0x0000, 0x0003).mirror(0xff00).rw(m_pio, FUNC(z80pio_device::read_alt), FUNC(z80pio_device::write_alt)); - map(0x0004, 0x0004).mirror(0xff00).w(FUNC(mbee_state::port04_w)); - map(0x0006, 0x0006).mirror(0xff00).w(FUNC(mbee_state::port06_w)); - map(0x0007, 0x0007).mirror(0xff00).r(FUNC(mbee_state::port07_r)); + map(0x0004, 0x0004).mirror(0xff00).w(m_rtc, FUNC(mc146818_device::address_w)); + map(0x0006, 0x0006).mirror(0xff00).w(m_rtc, FUNC(mc146818_device::data_w)); + map(0x0007, 0x0007).mirror(0xff00).r(m_rtc, FUNC(mc146818_device::data_r)); map(0x0008, 0x0008).mirror(0xff00).rw(FUNC(mbee_state::port08_r), FUNC(mbee_state::port08_w)); map(0x000a, 0x000a).select(0xff10).rw(FUNC(mbee_state::telcom_r), FUNC(mbee_state::port0a_w)); map(0x000b, 0x000b).mirror(0xff00).w(FUNC(mbee_state::port0b_w)); @@ -275,9 +275,9 @@ void mbee_state::mbee128_io(address_map &map) map.global_mask(0xff); map.unmap_value_high(); map(0x00, 0x03).rw(m_pio, FUNC(z80pio_device::read_alt), FUNC(z80pio_device::write_alt)); - map(0x04, 0x04).w(FUNC(mbee_state::port04_w)); - map(0x06, 0x06).w(FUNC(mbee_state::port06_w)); - map(0x07, 0x07).r(FUNC(mbee_state::port07_r)); + map(0x04, 0x04).w(m_rtc, FUNC(mc146818_device::address_w)); + map(0x06, 0x06).w(m_rtc, FUNC(mc146818_device::data_w)); + map(0x07, 0x07).r(m_rtc, FUNC(mc146818_device::data_r)); map(0x08, 0x08).rw(FUNC(mbee_state::port08_r), FUNC(mbee_state::port08_w)); map(0x09, 0x09).nopw(); map(0x0b, 0x0b).w(FUNC(mbee_state::port0b_w)); @@ -301,9 +301,9 @@ void mbee_state::mbee256_io(address_map &map) { map.unmap_value_high(); map(0x0000, 0x0003).mirror(0xff00).rw(m_pio, FUNC(z80pio_device::read_alt), FUNC(z80pio_device::write_alt)); - map(0x0004, 0x0004).mirror(0xff00).w(FUNC(mbee_state::port04_w)); - map(0x0006, 0x0006).mirror(0xff00).w(FUNC(mbee_state::port06_w)); - map(0x0007, 0x0007).mirror(0xff00).r(FUNC(mbee_state::port07_r)); + map(0x0004, 0x0004).mirror(0xff00).w(m_rtc, FUNC(mc146818_device::address_w)); + map(0x0006, 0x0006).mirror(0xff00).w(m_rtc, FUNC(mc146818_device::data_w)); + map(0x0007, 0x0007).mirror(0xff00).r(m_rtc, FUNC(mc146818_device::data_r)); map(0x0008, 0x0008).mirror(0xff00).rw(FUNC(mbee_state::port08_r), FUNC(mbee_state::port08_w)); map(0x0009, 0x0009).select(0xff00).r(FUNC(mbee_state::speed_r)); map(0x0009, 0x0009).mirror(0xff00).nopw(); diff --git a/src/mame/ausnz/mbee.h b/src/mame/ausnz/mbee.h index 33b6a523798..7d13ec1836f 100644 --- a/src/mame/ausnz/mbee.h +++ b/src/mame/ausnz/mbee.h @@ -94,9 +94,6 @@ public: void init_mbee256() { m_features = 0x2d; } private: - void port04_w(u8 data); - void port06_w(u8 data); - u8 port07_r(); u8 port08_r(); void port08_w(u8 data); void port0a_w(u8 data); diff --git a/src/mame/ausnz/mbee_m.cpp b/src/mame/ausnz/mbee_m.cpp index 8155f8f4991..682a24648c5 100644 --- a/src/mame/ausnz/mbee_m.cpp +++ b/src/mame/ausnz/mbee_m.cpp @@ -214,21 +214,6 @@ u8 mbee_state::speed_r(offs_t offset) ************************************************************/ -void mbee_state::port04_w(u8 data) // address -{ - m_rtc->write(0, data); -} - -void mbee_state::port06_w(u8 data) // write -{ - m_rtc->write(1, data); -} - -u8 mbee_state::port07_r() // read -{ - return m_rtc->read(1); -} - // See it work: Run mbeett, choose RTC in the config switches, run the F3 test, press Esc. void mbee_state::rtc_irq_w(int state) { diff --git a/src/mame/be/bebox.cpp b/src/mame/be/bebox.cpp index d20c38b6965..2f22f3b0f7d 100644 --- a/src/mame/be/bebox.cpp +++ b/src/mame/be/bebox.cpp @@ -43,7 +43,8 @@ void bebox_state::main_mem(address_map &map) map(0x80000020, 0x8000003F).rw(m_pic8259[0], FUNC(pic8259_device::read), FUNC(pic8259_device::write)); map(0x80000040, 0x8000005f).rw(m_pit8254, FUNC(pit8254_device::read), FUNC(pit8254_device::write)); map(0x80000060, 0x8000006F).rw("kbdc", FUNC(kbdc8042_device::data_r), FUNC(kbdc8042_device::data_w)); - map(0x80000070, 0x8000007F).rw("rtc", FUNC(mc146818_device::read), FUNC(mc146818_device::write)); + map(0x80000070, 0x8000007F).w("rtc", FUNC(mc146818_device::address_w)).umask64(0x00ff00ff00ff00ff); + map(0x80000070, 0x8000007F).rw("rtc", FUNC(mc146818_device::data_r), FUNC(mc146818_device::data_w)).umask64(0xff00ff00ff00ff00); map(0x80000080, 0x8000009F).rw(FUNC(bebox_state::bebox_page_r), FUNC(bebox_state::bebox_page_w)); map(0x800000A0, 0x800000BF).rw(m_pic8259[1], FUNC(pic8259_device::read), FUNC(pic8259_device::write)); map(0x800000C0, 0x800000DF).rw(FUNC(bebox_state::at_dma8237_1_r), FUNC(bebox_state::at_dma8237_1_w)); diff --git a/src/mame/bfm/rastersp.cpp b/src/mame/bfm/rastersp.cpp index 5b3e946cac2..76be73ba3ff 100644 --- a/src/mame/bfm/rastersp.cpp +++ b/src/mame/bfm/rastersp.cpp @@ -1136,7 +1136,8 @@ void rastersp_state::io_map(address_map &map) map(0x100c, 0x100f).portr("DSW2"); map(0x1010, 0x1013).portr("DSW1"); map(0x1014, 0x1017).portr("EXTRA"); - map(0x4000, 0x4007).rw("rtc", FUNC(mc146818_device::read), FUNC(mc146818_device::write)).umask32(0x000000ff); + map(0x4000, 0x4000).w("rtc", FUNC(mc146818_device::address_w)); + map(0x4004, 0x4004).rw("rtc", FUNC(mc146818_device::data_r), FUNC(mc146818_device::data_w)); map(0x6000, 0x6000).rw( m_duart, FUNC(z80scc_device::cb_r), FUNC(z80scc_device::cb_w)); map(0x6004, 0x6004).rw( m_duart, FUNC(z80scc_device::db_r), FUNC(z80scc_device::db_w)); map(0x6008, 0x6008).rw( m_duart, FUNC(z80scc_device::ca_r), FUNC(z80scc_device::ca_w)); diff --git a/src/mame/elektor/ec65.cpp b/src/mame/elektor/ec65.cpp index f0bef1730df..f0633d9d500 100644 --- a/src/mame/elektor/ec65.cpp +++ b/src/mame/elektor/ec65.cpp @@ -125,9 +125,8 @@ void ec65k_state::ec65k_mem(address_map &map) map(0x00e400, 0x00e403).rw(m_pia0, FUNC(pia6821_device::read), FUNC(pia6821_device::write)); // PIA0 porta=keyboard; portb=parallel port map(0x00e410, 0x00e413).rw("uart", FUNC(mos6551_device::read), FUNC(mos6551_device::write)); map(0x00e420, 0x00e423).rw(m_pia1, FUNC(pia6821_device::read), FUNC(pia6821_device::write)); // PIA1 porta=centronics control; portb=centronics data - map(0x00e430, 0x00e430).lw8(NAME([this] (u8 data) { m_rtc->write(0, data); })); // RTC 146818 - has battery backup - map(0x00e431, 0x00e431).lr8(NAME([this] () { return m_rtc->read(1); })); - map(0x00e431, 0x00e431).lw8(NAME([this] (u8 data) { m_rtc->write(1, data); })); + map(0x00e430, 0x00e430).w(m_rtc, FUNC(mc146818_device::address_w)); // RTC 146818 - has battery backup + map(0x00e431, 0x00e431).rw(m_rtc, FUNC(mc146818_device::data_r), FUNC(mc146818_device::data_w)); //map(0x00e500, 0x00e5ff) universal disk controller (no info) map(0x00e800, 0x00efff).ram().share("videoram"); map(0x00f000, 0x00ffff).rom().region("maincpu",0); diff --git a/src/mame/epson/qx10.cpp b/src/mame/epson/qx10.cpp index 50aef384636..6255eddb248 100644 --- a/src/mame/epson/qx10.cpp +++ b/src/mame/epson/qx10.cpp @@ -124,8 +124,6 @@ private: void zoom_w(uint8_t data); void tc_w(int state); void sqw_out(uint8_t state); - uint8_t mc146818_r(offs_t offset); - void mc146818_w(offs_t offset, uint8_t data); IRQ_CALLBACK_MEMBER( inta_call ); uint8_t get_slave_ack(offs_t offset); uint8_t vram_bank_r(); @@ -623,16 +621,6 @@ void qx10_state::sqw_out(uint8_t state) m_counter = cnt; } -void qx10_state::mc146818_w(offs_t offset, uint8_t data) -{ - m_rtc->write(!offset, data); -} - -uint8_t qx10_state::mc146818_r(offs_t offset) -{ - return m_rtc->read(!offset); -} - void qx10_state::keyboard_irq(int state) { m_scc->m1_r(); // always set @@ -745,7 +733,8 @@ void qx10_state::qx10_io(address_map &map) map(0x38, 0x39).rw(m_hgdc, FUNC(upd7220_device::read), FUNC(upd7220_device::write)); map(0x3a, 0x3a).w(FUNC(qx10_state::zoom_w)); // map(0x3b, 0x3b) GDC light pen req - map(0x3c, 0x3d).rw(FUNC(qx10_state::mc146818_r), FUNC(qx10_state::mc146818_w)); + map(0x3c, 0x3c).rw(m_rtc, FUNC(mc146818_device::data_r), FUNC(mc146818_device::data_w)); + map(0x3d, 0x3d).w(m_rtc, FUNC(mc146818_device::address_w)); map(0x40, 0x4f).rw(m_dma_1, FUNC(am9517a_device::read), FUNC(am9517a_device::write)); map(0x50, 0x5f).rw(m_dma_2, FUNC(am9517a_device::read), FUNC(am9517a_device::write)); } diff --git a/src/mame/intergraph/interpro.cpp b/src/mame/intergraph/interpro.cpp index 34df79c0f6d..0d2223fe937 100644 --- a/src/mame/intergraph/interpro.cpp +++ b/src/mame/intergraph/interpro.cpp @@ -903,10 +903,8 @@ void interpro_state::interpro_common_map(address_map &map) map(0x7f000400, 0x7f00040f).rw(m_scc1, FUNC(z80scc_device::ab_dc_r), FUNC(z80scc_device::ab_dc_w)).umask32(0x000000ff); map(0x7f000410, 0x7f00041f).rw(m_scc2, FUNC(z80scc_device::ab_dc_r), FUNC(z80scc_device::ab_dc_w)).umask32(0x000000ff); - map(0x7f000500, 0x7f000503).lrw8( - NAME([this] (offs_t offset) { return m_rtc->read(offset^1); }), - NAME([this] (offs_t offset, u8 data) { m_rtc->write(offset^1, data); })).umask32(0x000000ff); - map(0x7f000600, 0x7f000600).w(m_rtc, FUNC(mc146818_device::write)); + map(0x7f000500, 0x7f000500).rw(m_rtc, FUNC(mc146818_device::data_r), FUNC(mc146818_device::data_w)); + map(0x7f000600, 0x7f000600).w(m_rtc, FUNC(mc146818_device::address_w)); // the system board id prom map(0x7f000700, 0x7f00077f).rom().region("idprom", 0); diff --git a/src/mame/lsi/octopus.cpp b/src/mame/lsi/octopus.cpp index 673dd3eb41b..e732281de15 100644 --- a/src/mame/lsi/octopus.cpp +++ b/src/mame/lsi/octopus.cpp @@ -514,9 +514,7 @@ uint8_t octopus_state::rtc_r() uint8_t ret = 0xff; if(m_rtc_data) - ret = m_rtc->read(1); - else if(m_rtc_address) - ret = m_rtc->read(0); + ret = m_rtc->data_r(); return ret; } @@ -524,9 +522,9 @@ uint8_t octopus_state::rtc_r() void octopus_state::rtc_w(uint8_t data) { if(m_rtc_data) - m_rtc->write(1,data); + m_rtc->data_w(data); else if(m_rtc_address) - m_rtc->write(0,data); + m_rtc->address_w(data); } // RTC/FDC control - PPI port B @@ -939,7 +937,7 @@ void octopus_state::octopus(machine_config &config) m_pic2->in_sp_callback().set_constant(0); // RTC (MC146818 via i8255 PPI) - I8255(config, m_ppi, 0); + I8255(config, m_ppi); m_ppi->in_pa_callback().set(FUNC(octopus_state::rtc_r)); m_ppi->in_pb_callback().set(FUNC(octopus_state::cntl_r)); m_ppi->in_pc_callback().set(FUNC(octopus_state::gpo_r)); diff --git a/src/mame/merit/mtouchxl.cpp b/src/mame/merit/mtouchxl.cpp index d82c9b17ed5..143f537332e 100644 --- a/src/mame/merit/mtouchxl.cpp +++ b/src/mame/merit/mtouchxl.cpp @@ -134,7 +134,8 @@ void mtxl_state::at32_io(address_map &map) map(0x0040, 0x005f).rw("mb:pit8254", FUNC(pit8254_device::read), FUNC(pit8254_device::write)); map(0x0060, 0x0067).rw("kbdc", FUNC(kbdc8042_device::data_r), FUNC(kbdc8042_device::data_w)); map(0x0061, 0x0061).rw("mb", FUNC(at_mb_device::portb_r), FUNC(at_mb_device::portb_w)); - map(0x0070, 0x007f).rw("mb:rtc", FUNC(mc146818_device::read), FUNC(mc146818_device::write)); + map(0x0070, 0x007f).w("mb:rtc", FUNC(mc146818_device::address_w)).umask32(0x00ff00ff); + map(0x0070, 0x007f).rw("mb:rtc", FUNC(mc146818_device::data_r), FUNC(mc146818_device::data_w)).umask32(0xff00ff00); map(0x0080, 0x009f).rw("mb", FUNC(at_mb_device::page8_r), FUNC(at_mb_device::page8_w)); map(0x00a0, 0x00bf).rw("mb:pic8259_slave", FUNC(pic8259_device::read), FUNC(pic8259_device::write)); map(0x00c0, 0x00df).rw("mb:dma8237_2", FUNC(am9517a_device::read), FUNC(am9517a_device::write)).umask32(0x00ff00ff); diff --git a/src/mame/microsoft/jazz.cpp b/src/mame/microsoft/jazz.cpp index d86a1019f1c..49bec973410 100644 --- a/src/mame/microsoft/jazz.cpp +++ b/src/mame/microsoft/jazz.cpp @@ -226,8 +226,8 @@ void jazz_state::mct_map(address_map &map) // LE: only reads 4000 // BE: read 400d, write 400d, write 400c map(0x80004000, 0x8000400f).lrw8( - NAME([this] (offs_t offset) { return m_rtc->read(1); }), - NAME([this] (offs_t offset, u8 data) { m_rtc->write(1, data); })); + NAME([this] (offs_t offset) { return m_rtc->data_r(); }), + NAME([this] (offs_t offset, u8 data) { m_rtc->data_w(data); })); map(0x80005000, 0x80005000).rw(m_kbdc, FUNC(ps2_keyboard_controller_device::data_r), FUNC(ps2_keyboard_controller_device::data_w)); map(0x80005001, 0x80005001).rw(m_kbdc, FUNC(ps2_keyboard_controller_device::status_r), FUNC(ps2_keyboard_controller_device::command_w)); map(0x80006000, 0x80006007).rw(m_ace[0], FUNC(ns16550_device::ins8250_r), FUNC(ns16550_device::ins8250_w)); @@ -412,7 +412,7 @@ void jazz_state::jazz(machine_config &config) m_net->set_bus(m_mct_adr, 1); I82357(config, m_isp, 14.318181_MHz_XTAL); - m_isp->out_rtc_cb().set(m_rtc, FUNC(mc146818_device::write)); + m_isp->out_rtc_address_cb().set(m_rtc, FUNC(mc146818_device::address_w)); m_isp->out_int_cb().set_inputline(m_cpu, INPUT_LINE_IRQ2); m_isp->out_nmi_cb().set_inputline(m_cpu, INPUT_LINE_IRQ3); m_isp->out_spkr_cb().set(m_buzzer, FUNC(speaker_sound_device::level_w)); diff --git a/src/mame/misc/hotstuff.cpp b/src/mame/misc/hotstuff.cpp index 06206665d48..0c2caab438d 100644 --- a/src/mame/misc/hotstuff.cpp +++ b/src/mame/misc/hotstuff.cpp @@ -18,8 +18,7 @@ public: hotstuff_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_bitmapram(*this, "bitmapram"), - m_maincpu(*this, "maincpu"), - m_rtc(*this, "rtc") + m_maincpu(*this, "maincpu") { } void hotstuff(machine_config &config); @@ -29,7 +28,6 @@ private: virtual void video_start() override; uint32_t screen_update_hotstuff(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); required_device m_maincpu; - required_device m_rtc; void hotstuff_map(address_map &map); }; @@ -87,9 +85,8 @@ void hotstuff_state::hotstuff_map(address_map &map) map(0x600000, 0x600003).rw("scc1", FUNC(z80scc_device::ab_dc_r), FUNC(z80scc_device::ab_dc_w)); map(0x620000, 0x620003).rw("scc2", FUNC(z80scc_device::ab_dc_r), FUNC(z80scc_device::ab_dc_w)); - map(0x680000, 0x680001).lrw8( - NAME([this] (offs_t offset) { return m_rtc->read(offset^1); }), - NAME([this] (offs_t offset, u8 data) { m_rtc->write(offset^1, data); })); + map(0x680000, 0x680000).rw("rtc", FUNC(mc146818_device::data_r), FUNC(mc146818_device::data_w)); + map(0x680001, 0x680001).w("rtc", FUNC(mc146818_device::address_w)); map(0x980000, 0x9bffff).ram().share("bitmapram"); } @@ -111,14 +108,14 @@ void hotstuff_state::hotstuff(machine_config &config) PALETTE(config, "palette").set_entries(0x200); - scc8530_device& scc1(SCC8530N(config, "scc1", 4915200)); + scc8530_device &scc1(SCC8530N(config, "scc1", 4915200)); scc1.out_int_callback().set_inputline(m_maincpu, M68K_IRQ_4); - scc8530_device& scc2(SCC8530N(config, "scc2", 4915200)); + scc8530_device &scc2(SCC8530N(config, "scc2", 4915200)); scc2.out_int_callback().set_inputline(m_maincpu, M68K_IRQ_5); - MC146818(config, m_rtc, XTAL(32'768)); - m_rtc->irq().set_inputline("maincpu", M68K_IRQ_1); + mc146818_device &rtc(MC146818(config, "rtc", XTAL(32'768))); + rtc.irq().set_inputline("maincpu", M68K_IRQ_1); } diff --git a/src/mame/misc/xtom3d.cpp b/src/mame/misc/xtom3d.cpp index c439b5cd40b..0214c780916 100644 --- a/src/mame/misc/xtom3d.cpp +++ b/src/mame/misc/xtom3d.cpp @@ -243,6 +243,8 @@ protected: private: void remap(int space_id, offs_t start, offs_t end) override; + + void device_map(address_map &map); }; DEFINE_DEVICE_TYPE(ISA16_OKSAN_LPC, isa16_oksan_lpc, "isa16_oksan_lpc", "ISA16 Oksan Virtual LPC") @@ -282,10 +284,14 @@ void isa16_oksan_lpc::device_reset() void isa16_oksan_lpc::remap(int space_id, offs_t start, offs_t end) { if (space_id == AS_IO) - { - m_isa->install_device(0x60, 0x6f, read8sm_delegate(m_kbdc, FUNC(kbdc8042_device::data_r)), write8sm_delegate(m_kbdc, FUNC(kbdc8042_device::data_w))); - m_isa->install_device(0x70, 0x7f, read8sm_delegate(m_rtc, FUNC(mc146818_device::read)), write8sm_delegate(m_rtc, FUNC(mc146818_device::write))); - } + m_isa->install_device(0x60, 0x7f, *this, &isa16_oksan_lpc::device_map); +} + +void isa16_oksan_lpc::device_map(address_map &map) +{ + map(0x00, 0x0f).rw(m_kbdc, FUNC(kbdc8042_device::data_r), FUNC(kbdc8042_device::data_w)); + map(0x10, 0x1f).w(m_rtc, FUNC(mc146818_device::address_w)).umask32(0x00ff00ff); + map(0x10, 0x1f).rw(m_rtc, FUNC(mc146818_device::data_r), FUNC(mc146818_device::data_w)).umask32(0xff00ff00); } diff --git a/src/mame/omron/luna_88k.cpp b/src/mame/omron/luna_88k.cpp index 017d09086f0..26742b92c87 100644 --- a/src/mame/omron/luna_88k.cpp +++ b/src/mame/omron/luna_88k.cpp @@ -338,7 +338,8 @@ void luna88k2_state::cpu_map(address_map &map) { luna_88k_state_base::cpu_map(map); - map(0x4500'0000, 0x4500'0001).rw(m_rtc, FUNC(ds1397_device::read), FUNC(ds1397_device::write)); + map(0x4500'0000, 0x4500'0000).w(m_rtc, FUNC(ds1397_device::address_w)); + map(0x4500'0001, 0x4500'0001).rw(m_rtc, FUNC(ds1397_device::data_r), FUNC(ds1397_device::data_w)); map(0x4700'0000, 0x4700'003f).rw(m_rtc, FUNC(ds1397_device::xram_r), FUNC(ds1397_device::xram_w)); // 0x8100'0000 ext board A diff --git a/src/mame/sgi/iris3130.cpp b/src/mame/sgi/iris3130.cpp index ca1e7156578..64895829086 100644 --- a/src/mame/sgi/iris3130.cpp +++ b/src/mame/sgi/iris3130.cpp @@ -351,7 +351,7 @@ uint16_t iris3000_state::dips_r(offs_t offset, uint16_t mem_mask) uint8_t iris3000_state::clock_ctrl_r() { - const uint8_t data = m_rtc->read(1); + const uint8_t data = m_rtc->data_r(); // FIXME: really? LOGMASKED(LOG_RTC, "%s: clock_ctrl_r: %02x\n", machine().describe_context(), data); return data; } @@ -359,12 +359,12 @@ uint8_t iris3000_state::clock_ctrl_r() void iris3000_state::clock_ctrl_w(uint8_t data) { LOGMASKED(LOG_RTC, "%s: clock_ctrl_w: %02x\n", machine().describe_context(), data); - m_rtc->write(1, data); + m_rtc->data_w(data); // FIXME: really? } uint8_t iris3000_state::clock_data_r() { - uint8_t data = m_rtc->read(0); + uint8_t data = m_rtc->get_address(); // FIXME: really? LOGMASKED(LOG_RTC, "%s: clock_data_r: %02x\n", machine().describe_context(), data); return data; } @@ -372,7 +372,7 @@ uint8_t iris3000_state::clock_data_r() void iris3000_state::clock_data_w(uint8_t data) { LOGMASKED(LOG_RTC, "%s: clock_data_w: %02x\n", machine().describe_context(), data); - m_rtc->write(0, data); + m_rtc->address_w(data); // FIXME: really? } uint8_t iris3000_state::kernel_base_r(offs_t offset) diff --git a/src/mame/shared/pcshare.cpp b/src/mame/shared/pcshare.cpp index 290f1185689..82cb02b3531 100644 --- a/src/mame/shared/pcshare.cpp +++ b/src/mame/shared/pcshare.cpp @@ -131,7 +131,8 @@ void pcat_base_state::pcat32_io_common(address_map &map) map(0x0020, 0x003f).rw(m_pic8259_1, FUNC(pic8259_device::read), FUNC(pic8259_device::write)); map(0x0040, 0x005f).rw(m_pit8254, FUNC(pit8254_device::read), FUNC(pit8254_device::write)); map(0x0060, 0x006f).rw(m_kbdc, FUNC(kbdc8042_device::data_r), FUNC(kbdc8042_device::data_w)); - map(0x0070, 0x007f).rw(m_mc146818, FUNC(mc146818_device::read), FUNC(mc146818_device::write)); + map(0x0070, 0x007f).w(m_mc146818, FUNC(mc146818_device::address_w)).umask32(0x00ff00ff); + map(0x0070, 0x007f).rw(m_mc146818, FUNC(mc146818_device::data_r), FUNC(mc146818_device::data_w)).umask32(0xff00ff00); map(0x0080, 0x009f).rw(FUNC(pcat_base_state::dma_page_select_r), FUNC(pcat_base_state::dma_page_select_w));//TODO map(0x00a0, 0x00bf).rw(m_pic8259_2, FUNC(pic8259_device::read), FUNC(pic8259_device::write)); map(0x00c0, 0x00df).rw(m_dma8237_2, FUNC(am9517a_device::read), FUNC(am9517a_device::write)).umask32(0x00ff00ff); diff --git a/src/mame/sinclair/sprinter.cpp b/src/mame/sinclair/sprinter.cpp index ab2d97b1268..3e220712aac 100644 --- a/src/mame/sinclair/sprinter.cpp +++ b/src/mame/sinclair/sprinter.cpp @@ -565,7 +565,7 @@ u8 sprinter_state::dcp_r(offs_t offset) break; case 0x1c: - data = m_rtc->read(1); + data = m_rtc->data_r(); break; case 0x20: @@ -699,8 +699,10 @@ void sprinter_state::dcp_w(offs_t offset, u8 data) break; case 0x1d: + m_rtc->address_w(data); + break; case 0x1e: - m_rtc->write(~dcpp & 1, data); + m_rtc->data_w(data); break; case 0x20: diff --git a/src/mame/skeleton/micronic.cpp b/src/mame/skeleton/micronic.cpp index 57140fb96ab..5eab8d32847 100644 --- a/src/mame/skeleton/micronic.cpp +++ b/src/mame/skeleton/micronic.cpp @@ -199,25 +199,6 @@ void micronic_state::port_2c_w(uint8_t data) } -/*************************************************************************** - RTC-146818 -***************************************************************************/ - -void micronic_state::rtc_address_w(uint8_t data) -{ - m_rtc->write(0, data); -} - -uint8_t micronic_state::rtc_data_r() -{ - return m_rtc->read(1); -} - -void micronic_state::rtc_data_w(uint8_t data) -{ - m_rtc->write(1, data); -} - /*************************************************************************** Machine ***************************************************************************/ @@ -241,8 +222,8 @@ void micronic_state::micronic_io(address_map &map) map(0x23, 0x23).rw(m_lcdc, FUNC(hd61830_device::status_r), FUNC(hd61830_device::control_w)); /* rtc-146818 */ - map(0x08, 0x08).w(FUNC(micronic_state::rtc_address_w)); - map(0x28, 0x28).rw(FUNC(micronic_state::rtc_data_r), FUNC(micronic_state::rtc_data_w)); + map(0x08, 0x08).w(m_rtc, FUNC(mc146818_device::address_w)); + map(0x28, 0x28).rw(m_rtc, FUNC(mc146818_device::data_r), FUNC(mc146818_device::data_w)); /* sound */ map(0x2b, 0x2b).w(FUNC(micronic_state::beep_w)); diff --git a/src/mame/skeleton/micronic.h b/src/mame/skeleton/micronic.h index 9114b5726ba..ecf227def28 100644 --- a/src/mame/skeleton/micronic.h +++ b/src/mame/skeleton/micronic.h @@ -68,9 +68,6 @@ private: void port_2c_w(uint8_t data); void bank_select_w(uint8_t data); void lcd_contrast_w(uint8_t data); - void rtc_address_w(uint8_t data); - uint8_t rtc_data_r(); - void rtc_data_w(uint8_t data); void mc146818_irq(int state); void micronic_palette(palette_device &palette) const; diff --git a/src/mame/taito/taitowlf.cpp b/src/mame/taito/taitowlf.cpp index ed8fced131b..39a43ecbba3 100644 --- a/src/mame/taito/taitowlf.cpp +++ b/src/mame/taito/taitowlf.cpp @@ -392,6 +392,8 @@ protected: private: void remap(int space_id, offs_t start, offs_t end) override; + + void device_map(address_map &map); }; DEFINE_DEVICE_TYPE(ISA16_P5TXLA_MB, isa16_p5txla_mb, "isa16_p5txla_mb", "ISA16 P5TX-LA Virtual MB resources") @@ -433,10 +435,14 @@ void isa16_p5txla_mb::device_reset() void isa16_p5txla_mb::remap(int space_id, offs_t start, offs_t end) { if (space_id == AS_IO) - { - m_isa->install_device(0x60, 0x6f, read8sm_delegate(m_kbdc, FUNC(kbdc8042_device::data_r)), write8sm_delegate(m_kbdc, FUNC(kbdc8042_device::data_w))); - m_isa->install_device(0x70, 0x7f, read8sm_delegate(m_rtc, FUNC(mc146818_device::read)), write8sm_delegate(m_rtc, FUNC(mc146818_device::write))); - } + m_isa->install_device(0x60, 0x7f, *this, &isa16_p5txla_mb::device_map); +} + +void isa16_p5txla_mb::device_map(address_map &map) +{ + map(0x00, 0x0f).rw(m_kbdc, FUNC(kbdc8042_device::data_r), FUNC(kbdc8042_device::data_w)); + map(0x10, 0x1f).w(m_rtc, FUNC(mc146818_device::address_w)).umask32(0x00ff00ff); + map(0x10, 0x1f).rw(m_rtc, FUNC(mc146818_device::data_r), FUNC(mc146818_device::data_w)).umask32(0xff00ff00); } namespace { diff --git a/src/mame/ussr/orion_m.cpp b/src/mame/ussr/orion_m.cpp index 08026de137d..d1a5562c32a 100644 --- a/src/mame/ussr/orion_m.cpp +++ b/src/mame/ussr/orion_m.cpp @@ -215,7 +215,7 @@ void orion_state::orion128_floppy_w(offs_t offset, uint8_t data) uint8_t orion_state::orionz80_floppy_rtc_r(offs_t offset) { if ((offset >= 0x60) && (offset <= 0x6f)) - return m_rtc->read(offset-0x60); + return m_rtc->data_r(); else return orion128_floppy_r(offset); } @@ -223,7 +223,12 @@ uint8_t orion_state::orionz80_floppy_rtc_r(offs_t offset) void orion_state::orionz80_floppy_rtc_w(offs_t offset, uint8_t data) { if ((offset >= 0x60) && (offset <= 0x6f)) - m_rtc->write(offset-0x60,data); + { + if (BIT(offset, 0)) + m_rtc->data_w(data); + else + m_rtc->address_w(data); + } else orion128_floppy_w(offset,data); } -- cgit v1.2.3