v25: Add address translation for IDB window

This commit is contained in:
AJR 2023-07-18 10:55:38 -04:00
parent 0f68436c09
commit ba3fb1648f
3 changed files with 21 additions and 8 deletions

View File

@ -630,7 +630,7 @@ void v25_common_device::device_start()
m_program->cache(m_cache16);
m_dr8 = [this](offs_t address) -> u8 { return m_cache16.read_byte(address); };
}
m_data = &space(AS_DATA);
space(AS_DATA).specific(m_data);
m_io = &space(AS_IO);
state_add( V25_PC, "PC", m_ip).formatstr("%04X");

View File

@ -63,6 +63,7 @@ protected:
// device_memory_interface overrides
virtual space_config_vector memory_space_config() const override;
virtual bool memory_translate(int spacenum, int intention, offs_t &address, address_space *&target_space) override;
// device_state_interface overrides
virtual void state_string_export(const device_state_entry &entry, std::string &str) const override;
@ -126,7 +127,7 @@ private:
address_space *m_program;
std::function<u8 (offs_t address)> m_dr8;
address_space *m_data;
memory_access<9, 1, 0, ENDIANNESS_LITTLE>::specific m_data;
address_space *m_io;
int m_icount;

View File

@ -605,7 +605,7 @@ void v25_common_device::idb_w(uint8_t d)
uint8_t v25_common_device::v25_read_byte(unsigned a)
{
if (((a & 0xffe00) == m_IDB && (m_RAMEN || BIT(a, 8))) || a == 0xfffff)
return m_data->read_byte(a & 0x1ff);
return m_data.read_byte(a & 0x1ff);
else
return m_program->read_byte(a);
}
@ -617,9 +617,9 @@ uint16_t v25_common_device::v25_read_word(unsigned a)
// not sure about this - manual says FFFFC-FFFFE are "reserved"
if (a == 0xffffe)
return (m_program->read_byte(a) | (m_data->read_byte(0x1ff) << 8));
return (m_program->read_byte(a) | (m_data.read_byte(0x1ff) << 8));
else if ((a & 0xffe00) == m_IDB && (m_RAMEN || BIT(a, 8)))
return m_data->read_word(a & 0x1ff);
return m_data.read_word(a & 0x1ff);
else
return m_program->read_word(a);
}
@ -627,7 +627,7 @@ uint16_t v25_common_device::v25_read_word(unsigned a)
void v25_common_device::v25_write_byte(unsigned a, uint8_t d)
{
if (((a & 0xffe00) == m_IDB && (m_RAMEN || BIT(a, 8))) || a == 0xfffff)
m_data->write_byte(a & 0x1ff, d);
m_data.write_byte(a & 0x1ff, d);
else
m_program->write_byte(a, d);
}
@ -645,10 +645,22 @@ void v25_common_device::v25_write_word(unsigned a, uint16_t d)
if (a == 0xffffe)
{
m_program->write_byte(a, d);
m_data->write_byte(0x1ff, d >> 8);
m_data.write_byte(0x1ff, d >> 8);
}
else if ((a & 0xffe00) == m_IDB && (m_RAMEN || BIT(a, 8)))
m_data->write_word(a & 0x1ff, d);
m_data.write_word(a & 0x1ff, d);
else
m_program->write_word(a, d);
}
bool v25_common_device::memory_translate(int spacenum, int intention, offs_t &address, address_space *&target_space)
{
if (spacenum == AS_PROGRAM && intention != TR_FETCH && (((address & 0xffe00) == m_IDB && (m_RAMEN || BIT(address, 8))) || address == 0xfffff))
{
address &= 0x1ff;
target_space = &m_data.space();
}
else
target_space = &space(spacenum);
return true;
}