From ec0b8732aeec6598870bf1647dc313d24a487e35 Mon Sep 17 00:00:00 2001 From: Michael Zapf Date: Sat, 7 Dec 2019 23:54:08 +0100 Subject: tms9995: Make address visible on address bus during on-chip operations. --- src/devices/cpu/tms9900/tms9995.cpp | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/src/devices/cpu/tms9900/tms9995.cpp b/src/devices/cpu/tms9900/tms9995.cpp index c192f2a1b53..7bc077d1dd4 100644 --- a/src/devices/cpu/tms9900/tms9995.cpp +++ b/src/devices/cpu/tms9900/tms9995.cpp @@ -1228,7 +1228,7 @@ void tms9995_device::execute_run() if (m_check_ready && m_ready == false) { // We are in a wait state - LOGMASKED(LOG_WAIT, "wait state\n"); + LOGMASKED(LOG_WAIT, "wait\n"); // The clock output should be used to change the state of an outer // device which operates the READY line pulse_clock(1); @@ -1632,11 +1632,13 @@ void tms9995_device::command_completed() // Pseudo state at the end of the current instruction cycle sequence if (LOG_CYCLES & VERBOSE) { - logerror("+++++ Instruction %04x (%s) completed", IR, opname[m_command]); + // logerror("+++++ Instruction %04x (%s) completed", IR, opname[m_command]); int cycles = m_first_cycle - m_icount; // Avoid nonsense values due to expired and resumed main loop - if (cycles > 0 && cycles < 10000) logerror(", consumed %d cycles", cycles); - logerror(" +++++\n"); + // if (cycles > 0 && cycles < 10000) logerror(", consumed %d cycles", cycles); + // logerror(" +++++\n"); + if (cycles > 0 && cycles < 10000) logerror("%04x %s [%02d]\n", PC_debug, opname[m_command], cycles); + else logerror("%04x %s [ ?]\n", PC_debug, opname[m_command]); } if (m_int_pending != 0) @@ -1827,12 +1829,22 @@ void tms9995_device::mem_read() // Ignore the READY state m_check_ready = false; + // We put fffc-ffff back into the f000-f0ff area - m_current_value = m_onchip_memory[m_address & 0x00ff]<<8; - if (m_word_access || !m_byteop) + offs_t intaddr = m_address & 0x00fe; + + // An on-chip memory access is also visible to the outside world ([1], 2.3.1.2) + // but only on word boundary, as only full words are read. + if (m_setaddr) + m_setaddr->write_byte(m_address & 0xfffe, (TMS99xx_BUS_DBIN | (m_iaq? TMS99xx_BUS_IAQ : 0))); + + // Always read a word from internal memory + m_current_value = (m_onchip_memory[intaddr] << 8) | m_onchip_memory[intaddr + 1]; + + if (!m_word_access && m_byteop) { - // We have a word operation; add the low byte right here (just 1 cycle) - m_current_value |= (m_onchip_memory[(m_address & 0x00ff)+1] & 0xff); + if ((m_address & 1)==1) m_current_value = m_current_value << 8; + m_current_value &= 0xff00; } pulse_clock(1); } @@ -1963,6 +1975,12 @@ void tms9995_device::mem_write() if (m_word_access || !m_byteop) m_address &= 0xfffe; LOGMASKED(LOG_MEM, "write to onchip memory (single pass, address %04x, value=%04x)\n", m_address, m_current_value); + + // An on-chip memory access is also visible to the outside world ([1], 2.3.1.2) + // but only on word boundary + if (m_setaddr) + m_setaddr->write_byte(m_address & 0xfffe, TMS99xx_BUS_WRITE); + m_check_ready = false; m_onchip_memory[m_address & 0x00ff] = (m_current_value >> 8) & 0xff; if (m_word_access || !m_byteop) -- cgit v1.2.3