summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/tms9900
diff options
context:
space:
mode:
author Olivier Galibert <galibert@pobox.com>2018-06-29 10:58:19 +0200
committer Olivier Galibert <galibert@pobox.com>2018-06-29 20:04:28 +0200
commita704ed7b1b121c3bcff52d49bff8372360fe907c (patch)
tree53dd19f2dbe2bd0bf0f747dcccd989beabfafbf7 /src/devices/cpu/tms9900
parentf16d1298a44e71c18c337fc321faebe4fe691e06 (diff)
emumem: Backend modernization [O. Galibert]
Diffstat (limited to 'src/devices/cpu/tms9900')
-rw-r--r--src/devices/cpu/tms9900/tms9900.cpp25
-rw-r--r--src/devices/cpu/tms9900/tms9900.h4
-rw-r--r--src/devices/cpu/tms9900/tms9980a.cpp12
-rw-r--r--src/devices/cpu/tms9900/tms9995.cpp34
-rw-r--r--src/devices/cpu/tms9900/tms9995.h4
5 files changed, 60 insertions, 19 deletions
diff --git a/src/devices/cpu/tms9900/tms9900.cpp b/src/devices/cpu/tms9900/tms9900.cpp
index 21760205aff..61ee5644d7f 100644
--- a/src/devices/cpu/tms9900/tms9900.cpp
+++ b/src/devices/cpu/tms9900/tms9900.cpp
@@ -114,6 +114,8 @@
#define NOPRG -1
+constexpr int tms99xx_device::AS_SETOFFSET;
+
/* tms9900 ST register bits. */
enum
{
@@ -179,6 +181,7 @@ enum
tms99xx_device::tms99xx_device(const machine_config &mconfig, device_type type, const char *tag, int data_width, int prg_addr_bits, int cru_addr_bits, device_t *owner, uint32_t clock)
: cpu_device(mconfig, type, tag, owner, clock),
m_program_config("program", ENDIANNESS_BIG, data_width, prg_addr_bits),
+ m_setoffset_config("setoffset", ENDIANNESS_BIG, data_width, prg_addr_bits),
m_io_config("cru", ENDIANNESS_BIG, 8, cru_addr_bits),
m_prgspace(nullptr),
m_cru(nullptr),
@@ -223,6 +226,7 @@ void tms99xx_device::device_start()
// TODO: Restore state save feature
resolve_lines();
m_prgspace = &space(AS_PROGRAM);
+ m_sospace = has_space(AS_SETOFFSET) ? &space(AS_SETOFFSET) : nullptr;
m_cru = &space(AS_IO);
// set our instruction counter
@@ -437,10 +441,17 @@ void tms99xx_device::write_workspace_register_debug(int reg, uint16_t data)
device_memory_interface::space_config_vector tms99xx_device::memory_space_config() const
{
- return space_config_vector {
- std::make_pair(AS_PROGRAM, &m_program_config),
- std::make_pair(AS_IO, &m_io_config)
- };
+ if (has_configured_map(AS_SETOFFSET))
+ return space_config_vector {
+ std::make_pair(AS_PROGRAM, &m_program_config),
+ std::make_pair(AS_SETOFFSET, &m_setoffset_config),
+ std::make_pair(AS_IO, &m_io_config)
+ };
+ else
+ return space_config_vector {
+ std::make_pair(AS_PROGRAM, &m_program_config),
+ std::make_pair(AS_IO, &m_io_config)
+ };
}
/**************************************************************************
@@ -1523,7 +1534,8 @@ void tms99xx_device::mem_read()
if (m_mem_phase==1)
{
if (!m_dbin_line.isnull()) m_dbin_line(ASSERT_LINE);
- m_prgspace->set_address(m_address & m_prgaddr_mask & 0xfffe);
+ if (m_sospace)
+ m_sospace->read_byte(m_address & m_prgaddr_mask & 0xfffe);
m_check_ready = true;
m_mem_phase = 2;
m_pass = 2;
@@ -1550,7 +1562,8 @@ void tms99xx_device::mem_write()
if (!m_dbin_line.isnull()) m_dbin_line(CLEAR_LINE);
// When writing, the data bus is asserted immediately after the address bus
if (TRACE_ADDRESSBUS) logerror("set address (w) %04x\n", m_address);
- m_prgspace->set_address(m_address & m_prgaddr_mask & 0xfffe);
+ if (m_sospace)
+ m_sospace->read_byte(m_address & m_prgaddr_mask & 0xfffe);
if (TRACE_MEM) logerror("mem w %04x <- %04x\n", m_address, m_current_value);
m_prgspace->write_word(m_address & m_prgaddr_mask & 0xfffe, m_current_value);
m_check_ready = true;
diff --git a/src/devices/cpu/tms9900/tms9900.h b/src/devices/cpu/tms9900/tms9900.h
index 5af536fb54d..c084c190623 100644
--- a/src/devices/cpu/tms9900/tms9900.h
+++ b/src/devices/cpu/tms9900/tms9900.h
@@ -43,6 +43,8 @@ static const char opname[][5] =
class tms99xx_device : public cpu_device
{
public:
+ static constexpr int AS_SETOFFSET = 4;
+
~tms99xx_device();
// READY input line. When asserted (high), the memory is ready for data exchange.
@@ -93,8 +95,10 @@ protected:
void decode(uint16_t inst);
const address_space_config m_program_config;
+ const address_space_config m_setoffset_config;
const address_space_config m_io_config;
address_space* m_prgspace;
+ address_space* m_sospace;
address_space* m_cru;
virtual uint16_t read_workspace_register_debug(int reg);
diff --git a/src/devices/cpu/tms9900/tms9980a.cpp b/src/devices/cpu/tms9900/tms9980a.cpp
index e63b1b76d5b..aebe26f9575 100644
--- a/src/devices/cpu/tms9900/tms9980a.cpp
+++ b/src/devices/cpu/tms9900/tms9980a.cpp
@@ -183,7 +183,8 @@ void tms9980a_device::mem_read()
case 1:
m_pass = 4; // make the CPU visit this method more than once
if (!m_dbin_line.isnull()) m_dbin_line(ASSERT_LINE);
- m_prgspace->set_address(m_address & m_prgaddr_mask & ~1);
+ if (m_sospace)
+ m_sospace->read_byte(m_address & m_prgaddr_mask & ~1);
if (TRACE_ADDRESSBUS) logerror("tms9980a: set address bus %04x\n", m_address & m_prgaddr_mask & ~1);
m_check_ready = true;
break;
@@ -194,7 +195,8 @@ void tms9980a_device::mem_read()
m_current_value = (value << 8) & 0xff00;
break;
case 3:
- m_prgspace->set_address((m_address & m_prgaddr_mask) | 1);
+ if (m_sospace)
+ m_sospace->read_byte((m_address & m_prgaddr_mask) | 1);
if (TRACE_ADDRESSBUS) logerror("tms9980a: set address bus %04x\n", (m_address & m_prgaddr_mask) | 1);
break;
case 4:
@@ -216,7 +218,8 @@ void tms9980a_device::mem_write()
case 1:
m_pass = 4; // make the CPU visit this method once more
if (!m_dbin_line.isnull()) m_dbin_line(CLEAR_LINE);
- m_prgspace->set_address(m_address & m_prgaddr_mask & ~1);
+ if (m_sospace)
+ m_sospace->read_byte(m_address & m_prgaddr_mask & ~1);
if (TRACE_ADDRESSBUS) logerror("tms9980a: set address bus %04x\n", m_address & m_prgaddr_mask & ~1);
m_prgspace->write_byte(m_address & 0x3ffe & ~1, (m_current_value >> 8)&0xff);
if (TRACE_MEM) logerror("tms9980a: memory write high byte %04x <- %02x\n", m_address & m_prgaddr_mask & ~1, (m_current_value >> 8)&0xff);
@@ -226,7 +229,8 @@ void tms9980a_device::mem_write()
// no action here, just wait for READY
break;
case 3:
- m_prgspace->set_address((m_address & m_prgaddr_mask) | 1);
+ if (m_sospace)
+ m_sospace->read_byte((m_address & m_prgaddr_mask) | 1);
if (TRACE_ADDRESSBUS) logerror("tms9980a: set address bus %04x\n", (m_address & m_prgaddr_mask) | 1);
m_prgspace->write_byte((m_address & m_prgaddr_mask) | 1, m_current_value & 0xff);
if (TRACE_MEM) logerror("tms9980a: memory write low byte %04x <- %02x\n", (m_address & m_prgaddr_mask) | 1, m_current_value & 0xff);
diff --git a/src/devices/cpu/tms9900/tms9995.cpp b/src/devices/cpu/tms9900/tms9995.cpp
index ddc80522f68..26d357a8e61 100644
--- a/src/devices/cpu/tms9900/tms9995.cpp
+++ b/src/devices/cpu/tms9900/tms9995.cpp
@@ -151,6 +151,8 @@ enum
#include "logmacro.h"
+constexpr int tms9995_device::AS_SETOFFSET;
+
/****************************************************************************
Constructor
****************************************************************************/
@@ -167,8 +169,10 @@ tms9995_device::tms9995_device(const machine_config &mconfig, device_type type,
PC(0),
PC_debug(0),
m_program_config("program", ENDIANNESS_BIG, 8, 16),
+ m_setoffset_config("setoffset", ENDIANNESS_BIG, 8, 16),
m_io_config("cru", ENDIANNESS_BIG, 8, 16),
m_prgspace(nullptr),
+ m_sospace(nullptr),
m_cru(nullptr),
m_external_operation(*this),
m_iaq_line(*this),
@@ -193,7 +197,8 @@ void tms9995_device::device_start()
{
// TODO: Restore save state suport
- m_prgspace = &space(AS_PROGRAM); // dimemory.h
+ m_prgspace = &space(AS_PROGRAM);
+ m_sospace = has_space(AS_SETOFFSET) ? &space(AS_SETOFFSET) : nullptr;
m_cru = &space(AS_IO);
// Resolve our external connections
@@ -440,10 +445,17 @@ void tms9995_device::write_workspace_register_debug(int reg, uint16_t data)
device_memory_interface::space_config_vector tms9995_device::memory_space_config() const
{
- return space_config_vector {
- std::make_pair(AS_PROGRAM, &m_program_config),
- std::make_pair(AS_IO, &m_io_config)
- };
+ if (has_configured_map(AS_SETOFFSET))
+ return space_config_vector {
+ std::make_pair(AS_PROGRAM, &m_program_config),
+ std::make_pair(AS_SETOFFSET, &m_setoffset_config),
+ std::make_pair(AS_IO, &m_io_config)
+ };
+ else
+ return space_config_vector {
+ std::make_pair(AS_PROGRAM, &m_program_config),
+ std::make_pair(AS_IO, &m_io_config)
+ };
}
/**************************************************************************
@@ -1838,7 +1850,8 @@ void tms9995_device::mem_read()
m_check_hold = false;
LOGMASKED(LOG_ADDRESSBUS, "set address bus %04x\n", m_address & ~1);
- m_prgspace->set_address(address);
+ if (m_sospace)
+ m_sospace->read_byte(address);
m_request_auto_wait_state = m_auto_wait;
pulse_clock(1);
break;
@@ -1852,7 +1865,8 @@ void tms9995_device::mem_read()
case 3:
// Set address + 1 (unless byte command)
LOGMASKED(LOG_ADDRESSBUS, "set address bus %04x\n", m_address | 1);
- m_prgspace->set_address(m_address | 1);
+ if (m_sospace)
+ m_sospace->read_byte(m_address | 1);
m_request_auto_wait_state = m_auto_wait;
pulse_clock(1);
break;
@@ -1970,7 +1984,8 @@ void tms9995_device::mem_write()
m_check_hold = false;
LOGMASKED(LOG_ADDRESSBUS, "set address bus %04x\n", address);
- m_prgspace->set_address(address);
+ if (m_sospace)
+ m_sospace->read_byte(address);
LOGMASKED(LOG_MEM, "memory write byte %04x <- %02x\n", address, (m_current_value >> 8)&0xff);
m_prgspace->write_byte(address, (m_current_value >> 8)&0xff);
m_request_auto_wait_state = m_auto_wait;
@@ -1983,7 +1998,8 @@ void tms9995_device::mem_write()
case 3:
// Set address + 1 (unless byte command)
LOGMASKED(LOG_ADDRESSBUS, "set address bus %04x\n", m_address | 1);
- m_prgspace->set_address(m_address | 1);
+ if (m_sospace)
+ m_sospace->read_byte(m_address | 1);
LOGMASKED(LOG_MEM, "memory write byte %04x <- %02x\n", m_address | 1, m_current_value & 0xff);
m_prgspace->write_byte(m_address | 1, m_current_value & 0xff);
m_request_auto_wait_state = m_auto_wait;
diff --git a/src/devices/cpu/tms9900/tms9995.h b/src/devices/cpu/tms9900/tms9995.h
index 1dcc4667176..940ec0f43ee 100644
--- a/src/devices/cpu/tms9900/tms9995.h
+++ b/src/devices/cpu/tms9900/tms9995.h
@@ -49,6 +49,8 @@ enum
class tms9995_device : public cpu_device
{
public:
+ static constexpr int AS_SETOFFSET = 4;
+
tms9995_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// READY input line. When asserted (high), the memory is ready for data exchange.
@@ -125,8 +127,10 @@ private:
uint8_t m_onchip_memory[256];
const address_space_config m_program_config;
+ const address_space_config m_setoffset_config;
const address_space_config m_io_config;
address_space* m_prgspace;
+ address_space* m_sospace;
address_space* m_cru;
// Processor states