From 9eb11bdec72bbb9175a4358f46c174a7c832b1ba Mon Sep 17 00:00:00 2001 From: Michael Zapf Date: Wed, 20 Apr 2016 00:23:28 +0200 Subject: Added general read/write methods to 9928a, allowing address lines to select functions --- src/devices/bus/ti99x/datamux.cpp | 24 ++---------------------- src/devices/video/tms9928a.cpp | 19 +++++++++++++++++++ src/devices/video/tms9928a.h | 3 +++ 3 files changed, 24 insertions(+), 22 deletions(-) (limited to 'src/devices') diff --git a/src/devices/bus/ti99x/datamux.cpp b/src/devices/bus/ti99x/datamux.cpp index 6cb44af8f53..996096a1a49 100644 --- a/src/devices/bus/ti99x/datamux.cpp +++ b/src/devices/bus/ti99x/datamux.cpp @@ -125,17 +125,7 @@ void ti99_datamux_device::read_all(address_space& space, UINT16 addr, UINT8 *val if ((addr & 0xf801)==0x8800) { // Forward to VDP unless we have an EVPC - if (m_video != nullptr) - { - if ((addr & 2) != 0) - { // read VDP status - *value = m_video->register_read(space, 0); - } - else - { // read VDP RAM - *value = m_video->vram_read(space, 0); - } - } + if (m_video != nullptr) *value = m_video->read(space, addr>>1); // A14 determines data or register read } } @@ -174,17 +164,7 @@ void ti99_datamux_device::write_all(address_space& space, UINT16 addr, UINT8 val if ((addr & 0xf801)==0x8800) { // Forward to VDP unless we have an EVPC - if (m_video != nullptr) - { - if ((addr & 2) != 0) - { // write VDP address/register - m_video->register_write(space, 0, value); - } - else - { // write VDP data - m_video->vram_write(space, 0, value); - } - } + if (m_video != nullptr) m_video->write(space, addr>>1, value); // A14 determines data or register write } // PEB gets all accesses diff --git a/src/devices/video/tms9928a.cpp b/src/devices/video/tms9928a.cpp index fb8828e2cc1..5f4fcec92ec 100644 --- a/src/devices/video/tms9928a.cpp +++ b/src/devices/video/tms9928a.cpp @@ -112,6 +112,25 @@ tms9929a_device::tms9929a_device(const machine_config &mconfig, const char *tag, : tms9928a_device( mconfig, TMS9929A, "TMS9929A", tag, owner, clock, true, true, true, "tms9929a", __FILE__) { } +READ8_MEMBER( tms9928a_device::read ) +{ + UINT8 value = 0; + + if ((offset & 1) == 0) + value = vram_read(space, 0); + else + value = register_read(space, 0); + + return value; +} + +WRITE8_MEMBER( tms9928a_device::write ) +{ + if ((offset & 1) == 0) + vram_write(space, 0, data); + else + register_write(space, 0, data); +} READ8_MEMBER( tms9928a_device::vram_read ) { diff --git a/src/devices/video/tms9928a.h b/src/devices/video/tms9928a.h index 21e7c9bf606..d05a2d936c4 100644 --- a/src/devices/video/tms9928a.h +++ b/src/devices/video/tms9928a.h @@ -92,6 +92,9 @@ public: template static devcb_base &set_out_int_line_callback(device_t &device, _Object object) { return downcast(device).m_out_int_line_cb.set_callback(object); } template static devcb_base &set_out_gromclk_callback(device_t &device, _Object object) { return downcast(device).m_out_gromclk_cb.set_callback(object); } + DECLARE_READ8_MEMBER( read ); + DECLARE_WRITE8_MEMBER( write ); + DECLARE_READ8_MEMBER( vram_read ); DECLARE_WRITE8_MEMBER( vram_write ); DECLARE_READ8_MEMBER( register_read ); -- cgit v1.2.3-70-g09d2