diff options
author | Michael Zapf <michael.zapf@mizapf.de> | 2013-06-09 13:22:00 +0000 |
---|---|---|
committer | Michael Zapf <michael.zapf@mizapf.de> | 2013-06-09 13:22:00 +0000 |
commit | 3e5766d0ffe07551d46ae6ee576fdf8c7a592520 (patch) | |
tree | 3626e60fe81a162a04b07cf1c6bae2279a081f52 | |
parent | 220da4e3d76cb3ab099980e900138a38ddeaacca (diff) |
(MESS) ti99: Make debugger happier. Also, removed some unneeded
variables. (nw)
-rw-r--r-- | src/mess/machine/ti99/datamux.c | 121 | ||||
-rw-r--r-- | src/mess/machine/ti99/datamux.h | 9 | ||||
-rw-r--r-- | src/mess/machine/ti99/grom.c | 6 | ||||
-rw-r--r-- | src/mess/machine/ti99/videowrp.c | 8 | ||||
-rw-r--r-- | src/mess/machine/ti99/videowrp.h | 1 |
5 files changed, 71 insertions, 74 deletions
diff --git a/src/mess/machine/ti99/datamux.c b/src/mess/machine/ti99/datamux.c index 8b2c9d8d63a..38e7dc2e9fb 100644 --- a/src/mess/machine/ti99/datamux.c +++ b/src/mess/machine/ti99/datamux.c @@ -84,6 +84,42 @@ ti99_datamux_device::ti99_datamux_device(const machine_config &mconfig, const ch DEVICE ACCESSOR FUNCTIONS ***************************************************************************/ +void ti99_datamux_device::read_all(address_space& space, UINT16 addr, UINT8 *target) +{ + attached_device *dev = m_devices.first(); + + // Reading the odd address first (addr+1) + while (dev != NULL) + { + if (dev->m_config->write_select != 0xffff) // write-only + { + if ((addr & dev->m_config->address_mask)==dev->m_config->select) + { + // Cast to the bus8z_device (see ti99defs.h) + bus8z_device *devz = static_cast<bus8z_device *>(dev->m_device); + devz->readz(space, addr, target); + } + // hope we don't have two devices answering... + // consider something like a logical OR and maybe some artificial smoke + } + dev = dev->m_next; + } +} + +void ti99_datamux_device::write_all(address_space& space, UINT16 addr, UINT8 value) +{ + attached_device *dev = m_devices.first(); + while (dev != NULL) + { + if ((addr & dev->m_config->address_mask)==(dev->m_config->select | dev->m_config->write_select)) + { + bus8z_device *devz = static_cast<bus8z_device *>(dev->m_device); + devz->write(space, addr, value); + } + dev = dev->m_next; + } +} + /* Read access. We are using two loops because the delay between both accesses must not occur within the loop. So we have one access on the bus, @@ -97,8 +133,6 @@ READ16_MEMBER( ti99_datamux_device::read ) UINT8 hbyte = 0; UINT16 addr = (offset << 1); - assert (mem_mask == 0xffff); - // Looks ugly, but this is close to the real thing. If the 16bit // memory expansion is installed in the console, and the access hits its // space, just respond to the memory access and don't bother the @@ -113,50 +147,27 @@ READ16_MEMBER( ti99_datamux_device::read ) if (base != 0) { UINT16 reply = m_ram16b[offset-base]; - return reply; - } - } - - attached_device *dev = m_devices.first(); - - // Reading the odd address first (addr+1) - while (dev != NULL) - { - if (((addr+1) & dev->m_config->address_mask)==dev->m_config->select) - { - // Cast to the bus8z_device (see ti99defs.h) - bus8z_device *devz = static_cast<bus8z_device *>(dev->m_device); - devz->readz(*m_space, addr+1, &m_latch); + return reply & mem_mask; } - // hope we don't have two devices answering... - // consider something like a logical OR and maybe some artificial smoke - dev = dev->m_next; } - dev = m_devices.first(); + // Read the odd address into the latch + read_all(space, addr+1, &m_latch); // Reading the even address now (addr) - while (dev != NULL) - { - if (dev->m_config->write_select != 0xffff) // write-only - { - if ((addr & dev->m_config->address_mask)==dev->m_config->select) - { - bus8z_device *devz = static_cast<bus8z_device *>(dev->m_device); - devz->readz(*m_space, addr, &hbyte); - } - } - dev = dev->m_next; - } + read_all(space, addr, &hbyte); // Insert four wait states and let CPU enter wait state // The counter in the real console is implemented by a shift register // that is triggered on a memory access + + // We cannot split the wait states between the read accesses before we + // have a split-phase read access in the core m_waitcount = 6; m_ready(CLEAR_LINE); // use the latch and the currently read byte and put it on the 16bit bus - return (hbyte<<8) | m_latch; + return ((hbyte<<8) | m_latch) & mem_mask; } /* @@ -173,46 +184,24 @@ WRITE16_MEMBER( ti99_datamux_device::write ) // printf("write addr=%04x, value=%04x\n", addr, data); - assert (mem_mask == 0xffff); - // Handle the internal 32K expansion if (m_use32k) { - if (addr>=0x2000 && addr<0x4000) - { - m_ram16b[offset-0x1000] = data; // index 0000 - 0fff - return; - } - if (addr>=0xa000) - { - m_ram16b[offset-0x4000] = data; // index 1000 - 4fff - return; - } - } + UINT16 base = 0; + if ((addr & 0xe000)==0x2000) base = 0x1000; + if (((addr & 0xe000)==0xa000) || ((addr & 0xc000)==0xc000)) base = 0x4000; - attached_device *dev = m_devices.first(); - while (dev != NULL) - { - if (((addr+1) & dev->m_config->address_mask)==(dev->m_config->select | dev->m_config->write_select)) + if (base != 0) { - bus8z_device *devz = static_cast<bus8z_device *>(dev->m_device); - devz->write(*m_space, addr+1, data & 0xff); + m_ram16b[offset-base] = data; + return; } - dev = dev->m_next; } - dev = m_devices.first(); - - while (dev != NULL) - { - if ((addr & dev->m_config->address_mask)==(dev->m_config->select | dev->m_config->write_select)) - { - // write the byte from the upper 8 lines - bus8z_device *devz = static_cast<bus8z_device *>(dev->m_device); - devz->write(*m_space, addr, (data>>8) & 0xff); - } - dev = dev->m_next; - } + // write odd byte + write_all(space, addr+1, data & 0xff); + // write even byte + write_all(space, addr, (data>>8) & 0xff); // Insert four wait states and let CPU enter wait state m_waitcount = 6; @@ -254,7 +243,7 @@ void ti99_datamux_device::device_reset(void) m_ready.resolve(conf->ready, *this); m_cpu = machine().device("maincpu"); - m_space = &m_cpu->memory().space(AS_PROGRAM); + // m_space = &m_cpu->memory().space(AS_PROGRAM); m_devices.reset(); // clear the list m_use32k = (ioport("RAM")->read()==1); diff --git a/src/mess/machine/ti99/datamux.h b/src/mess/machine/ti99/datamux.h index ec8fac3250d..79f4f7c817f 100644 --- a/src/mess/machine/ti99/datamux.h +++ b/src/mess/machine/ti99/datamux.h @@ -81,6 +81,12 @@ protected: virtual ioport_constructor device_input_ports() const; private: + // Common read routine + void read_all(address_space& space, UINT16 addr, UINT8 *target); + + // Common write routine + void write_all(address_space& space, UINT16 addr, UINT8 value); + // Ready line to the CPU devcb_resolved_write_line m_ready; @@ -101,9 +107,6 @@ private: /* Reference to the CPU; avoid lookups. */ device_t *m_cpu; - - /* Reference to the address space, maybe unnecessary. */ - address_space *m_space; }; /******************************************************************************/ diff --git a/src/mess/machine/ti99/grom.c b/src/mess/machine/ti99/grom.c index ec55dcd131c..c663f802184 100644 --- a/src/mess/machine/ti99/grom.c +++ b/src/mess/machine/ti99/grom.c @@ -103,6 +103,9 @@ ti99_grom_device::ti99_grom_device(const machine_config &mconfig, const char *ta */ READ8Z_MEMBER( ti99_grom_device::readz ) { + // Prevent debugger access + if (space.debugger_access()) return; + if (offset & 2) { // GROMs generally answer the address read request @@ -163,6 +166,9 @@ READ8Z_MEMBER( ti99_grom_device::readz ) */ WRITE8_MEMBER( ti99_grom_device::write ) { + // Prevent debugger access + if (space.debugger_access()) return; + if (offset & 2) { /* write GROM address */ diff --git a/src/mess/machine/ti99/videowrp.c b/src/mess/machine/ti99/videowrp.c index 7094daa9677..792264f057a 100644 --- a/src/mess/machine/ti99/videowrp.c +++ b/src/mess/machine/ti99/videowrp.c @@ -48,11 +48,11 @@ READ8Z_MEMBER( ti_std_video_device::readz ) { if (offset & 2) { /* read VDP status */ - *value = m_tms9928a->register_read(*(this->m_space), 0); + *value = m_tms9928a->register_read(space, 0); } else { /* read VDP RAM */ - *value = m_tms9928a->vram_read(*(this->m_space), 0); + *value = m_tms9928a->vram_read(space, 0); } } @@ -60,11 +60,11 @@ WRITE8_MEMBER( ti_std_video_device::write ) { if (offset & 2) { /* write VDP address */ - m_tms9928a->register_write(*(this->m_space), 0, data); + m_tms9928a->register_write(space, 0, data); } else { /* write VDP data */ - m_tms9928a->vram_write(*(this->m_space), 0, data); + m_tms9928a->vram_write(space, 0, data); } } diff --git a/src/mess/machine/ti99/videowrp.h b/src/mess/machine/ti99/videowrp.h index f1e278d2818..68ac730d1ed 100644 --- a/src/mess/machine/ti99/videowrp.h +++ b/src/mess/machine/ti99/videowrp.h @@ -23,7 +23,6 @@ public: virtual void reset_vdp(int state) =0; protected: - address_space *m_space; tms9928a_device *m_tms9928a; /* Constructor */ |