summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2019-04-27 21:24:06 -0400
committer AJR <ajrhacker@users.noreply.github.com>2019-04-27 21:24:41 -0400
commit8293d4d68544a6af3988ea9abcd94aa74c26fff3 (patch)
treea512db1694bc00dcb6ccc0a0d2ec0914775f3950
parenta2460f12d3f03dee3754c2ed49807cc04f1dcbef (diff)
ti89, etc.: Better way to force the reset vector (nw)
-rw-r--r--src/mame/drivers/ti89.cpp39
-rw-r--r--src/mame/includes/ti89.h5
2 files changed, 32 insertions, 12 deletions
diff --git a/src/mame/drivers/ti89.cpp b/src/mame/drivers/ti89.cpp
index aa2ba7f3afa..61594868fd5 100644
--- a/src/mame/drivers/ti89.cpp
+++ b/src/mame/drivers/ti89.cpp
@@ -149,6 +149,24 @@ READ16_MEMBER ( ti68k_state::rom_r )
}
+uint16_t ti68k_state::reset_overlay_r(offs_t offset)
+{
+ if (m_ram_enabled)
+ return m_ram_base[offset];
+ else
+ {
+ // FIXME: probably triggered by something else
+ if (offset == 3 && !machine().side_effects_disabled())
+ m_ram_enabled = true;
+
+ if (m_flash.found())
+ return m_flash->read(offset + 0x12088/2); // why this offset?
+ else
+ return m_rom_base[offset];
+ }
+}
+
+
TIMER_DEVICE_CALLBACK_MEMBER(ti68k_state::ti68k_timer_callback)
{
m_timer++;
@@ -185,6 +203,7 @@ void ti68k_state::ti92_mem(address_map &map)
{
map.unmap_value_high();
map(0x000000, 0x0fffff).ram().share("nvram");
+ map(0x000000, 0x000007).r(FUNC(ti68k_state::reset_overlay_r));
map(0x200000, 0x5fffff).unmaprw(); // ROM
map(0x600000, 0x6fffff).rw(FUNC(ti68k_state::ti68k_io_r), FUNC(ti68k_state::ti68k_io_w));
}
@@ -194,6 +213,7 @@ void ti68k_state::ti89_mem(address_map &map)
{
map.unmap_value_high();
map(0x000000, 0x0fffff).ram().share("nvram");
+ map(0x000000, 0x000007).r(FUNC(ti68k_state::reset_overlay_r));
map(0x200000, 0x3fffff).rw(m_flash, FUNC(intelfsh16_device::read), FUNC(intelfsh16_device::write));
map(0x400000, 0x5fffff).noprw();
map(0x600000, 0x6fffff).rw(FUNC(ti68k_state::ti68k_io_r), FUNC(ti68k_state::ti68k_io_w));
@@ -205,6 +225,7 @@ void ti68k_state::ti92p_mem(address_map &map)
{
map.unmap_value_high();
map(0x000000, 0x0fffff).ram().share("nvram");
+ map(0x000000, 0x000007).r(FUNC(ti68k_state::reset_overlay_r));
map(0x200000, 0x3fffff).noprw();
map(0x400000, 0x5fffff).rw(m_flash, FUNC(intelfsh16_device::read), FUNC(intelfsh16_device::write));
map(0x600000, 0x6fffff).rw(FUNC(ti68k_state::ti68k_io_r), FUNC(ti68k_state::ti68k_io_w));
@@ -216,6 +237,7 @@ void ti68k_state::v200_mem(address_map &map)
{
map.unmap_value_high();
map(0x000000, 0x0fffff).ram().share("nvram");
+ map(0x000000, 0x000007).r(FUNC(ti68k_state::reset_overlay_r));
map(0x200000, 0x5fffff).rw(m_flash, FUNC(intelfsh16_device::read), FUNC(intelfsh16_device::write));
map(0x600000, 0x6fffff).rw(FUNC(ti68k_state::ti68k_io_r), FUNC(ti68k_state::ti68k_io_w));
map(0x700000, 0x70ffff).rw(FUNC(ti68k_state::ti68k_io2_r), FUNC(ti68k_state::ti68k_io2_w));
@@ -226,6 +248,7 @@ void ti68k_state::ti89t_mem(address_map &map)
{
map.unmap_value_high();
map(0x000000, 0x0fffff).ram().mirror(0x200000).share("nvram");
+ map(0x000000, 0x000007).r(FUNC(ti68k_state::reset_overlay_r));
map(0x600000, 0x6fffff).rw(FUNC(ti68k_state::ti68k_io_r), FUNC(ti68k_state::ti68k_io_w));
map(0x700000, 0x70ffff).rw(FUNC(ti68k_state::ti68k_io2_r), FUNC(ti68k_state::ti68k_io2_w));
map(0x800000, 0xbfffff).rw(m_flash, FUNC(intelfsh16_device::read), FUNC(intelfsh16_device::write));
@@ -421,28 +444,21 @@ void ti68k_state::machine_start()
if (m_flash.found())
{
uint32_t base = ((((m_rom_base[0x82]) << 16) | m_rom_base[0x83]) & 0xffff)>>1;
- int i;
if (m_rom_base[base] >= 8)
m_hw_version = ((m_rom_base[base + 0x0b]) << 16) | m_rom_base[base + 0x0c];
if (!m_hw_version)
m_hw_version = HW1;
-
- for (i = 0x9000; i < 0x100000; i++)
- if (m_rom_base[i] == 0xcccc && m_rom_base[i + 1] == 0xcccc)
- break;
-
- m_initial_pc = ((m_rom_base[i + 4]) << 16) | m_rom_base[i + 5];
}
else
{
m_hw_version = HW1;
- m_initial_pc = ((m_rom_base[2]) << 16) | m_rom_base[3];
+ uint32_t initial_pc = ((m_rom_base[2]) << 16) | m_rom_base[3];
m_maincpu->space(AS_PROGRAM).unmap_read(0x200000, 0x5fffff);
- if (m_initial_pc > 0x400000)
+ if (initial_pc > 0x400000)
{
m_maincpu->space(AS_PROGRAM).install_read_handler(0x400000, 0x5fffff, read16_delegate(FUNC(ti68k_state::rom_r), this));
}
@@ -452,13 +468,14 @@ void ti68k_state::machine_start()
}
}
- logerror("HW=v%x, PC=%06x, Type=%s\n", m_hw_version, m_initial_pc, m_flash.found() ? "Flash" : "ROM");
+ logerror("HW=v%x, Type=%s\n", m_hw_version, m_flash.found() ? "Flash" : "ROM");
}
void ti68k_state::machine_reset()
{
- m_maincpu->set_state_int(M68K_PC, m_initial_pc);
+ m_ram_enabled = false;
+ m_maincpu->reset();
m_kb_mask = 0xff;
m_on_key = 0;
diff --git a/src/mame/includes/ti89.h b/src/mame/includes/ti89.h
index 3f9e35b2762..67bb638fbf2 100644
--- a/src/mame/includes/ti89.h
+++ b/src/mame/includes/ti89.h
@@ -22,6 +22,7 @@ public:
, m_maincpu(*this, "maincpu")
, m_flash(*this, "flash")
, m_rom_base(*this, "flash")
+ , m_ram_base(*this, "nvram")
, m_io_bit0(*this, "BIT0")
, m_io_bit1(*this, "BIT1")
, m_io_bit2(*this, "BIT2")
@@ -51,6 +52,7 @@ private:
required_device<cpu_device> m_maincpu;
optional_device<intelfsh16_device> m_flash;
required_region_ptr<uint16_t> m_rom_base;
+ required_shared_ptr<uint16_t> m_ram_base;
required_ioport m_io_bit0;
required_ioport m_io_bit1;
required_ioport m_io_bit2;
@@ -62,7 +64,7 @@ private:
// HW specifications
uint8_t m_hw_version;
- uint32_t m_initial_pc;
+ bool m_ram_enabled;
// keyboard
uint16_t m_kb_mask;
@@ -93,6 +95,7 @@ private:
DECLARE_WRITE16_MEMBER( ti68k_io2_w );
DECLARE_READ16_MEMBER( ti68k_io2_r );
DECLARE_READ16_MEMBER( rom_r );
+ uint16_t reset_overlay_r(offs_t offset);
void ti68k_palette(palette_device &palette) const;
TIMER_DEVICE_CALLBACK_MEMBER(ti68k_timer_callback);