summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author arbee <rb6502@users.noreply.github.com>2020-08-25 22:07:37 -0400
committer arbee <rb6502@users.noreply.github.com>2020-08-25 22:07:37 -0400
commit7b62eab1a92a48bfa9206635e6729dabc91b7849 (patch)
treea00ee357d66e42f8f733fb8ee92d460e940fa58d
parent42613dc74e12753b0fb213c1218d8f0068bee59f (diff)
mac: eliminated runtime region lookups and fixed several non-booting models. [R. Belmont]
-rw-r--r--src/mame/drivers/mac.cpp19
-rw-r--r--src/mame/includes/mac.h17
-rw-r--r--src/mame/machine/mac.cpp36
-rw-r--r--src/mame/machine/macadb.cpp1
4 files changed, 40 insertions, 33 deletions
diff --git a/src/mame/drivers/mac.cpp b/src/mame/drivers/mac.cpp
index 9834144250c..f97b71647d0 100644
--- a/src/mame/drivers/mac.cpp
+++ b/src/mame/drivers/mac.cpp
@@ -18,7 +18,6 @@
0xf00000 - 0xffffef ??? (the ROM appears to be accessing here)
0xfffff0 - 0xffffff Auto Vector
-
Interrupts:
M68K:
Level 1 from VIA
@@ -42,6 +41,14 @@
when the PC hits GetCPUID, the move.l (a2), d0 at PC = 0x10000 will cause an MMU fault (jump to 0xFFF00300). why?
a2 = 0x5ffffffc (the CPU ID register). MMU is unable to resolve this; defect in the MMU emulation probable.
+ TODO:
+ - SE and Classic to own driver
+ - Portable and PowerBook 100 to own driver
+ - Remaining PowerBooks to own driver
+ - Quadra 700 to own driver
+ - V8 and friends to own driver
+ - LC3 / LC520 / IIvx / IIvi to own driver
+
****************************************************************************/
@@ -728,7 +735,7 @@ void mac_state::maciifx_map(address_map &map)
// ROM detects the "Jaws" ASIC by checking for I/O space mirrored at 0x01000000 boundries
void mac_state::macpb140_map(address_map &map)
{
- map(0x40000000, 0x400fffff).rom().region("bootrom", 0).mirror(0x0ff00000);
+ map(0x40000000, 0x400fffff).r(FUNC(mac_state::rom_switch_r)).mirror(0x0ff00000);
map(0x50000000, 0x50001fff).rw(FUNC(mac_state::mac_via_r), FUNC(mac_state::mac_via_w)).mirror(0x01f00000);
map(0x50002000, 0x50003fff).rw(FUNC(mac_state::mac_via2_r), FUNC(mac_state::mac_via2_w)).mirror(0x01f00000);
@@ -745,7 +752,7 @@ void mac_state::macpb140_map(address_map &map)
void mac_state::macpb160_map(address_map &map)
{
- map(0x40000000, 0x400fffff).rom().region("bootrom", 0).mirror(0x0ff00000);
+ map(0x40000000, 0x400fffff).r(FUNC(mac_state::rom_switch_r)).mirror(0x0ff00000);
map(0x50f00000, 0x50f01fff).rw(FUNC(mac_state::mac_via_r), FUNC(mac_state::mac_via_w));
map(0x50f02000, 0x50f03fff).rw(FUNC(mac_state::mac_via2_r), FUNC(mac_state::mac_via2_w));
@@ -763,7 +770,7 @@ void mac_state::macpb160_map(address_map &map)
void mac_state::macpb165c_map(address_map &map)
{
- map(0x40000000, 0x400fffff).rom().region("bootrom", 0).mirror(0x0ff00000);
+ map(0x40000000, 0x400fffff).r(FUNC(mac_state::rom_switch_r)).mirror(0x0ff00000);
map(0x50f00000, 0x50f01fff).rw(FUNC(mac_state::mac_via_r), FUNC(mac_state::mac_via_w));
map(0x50f02000, 0x50f03fff).rw(FUNC(mac_state::mac_via2_r), FUNC(mac_state::mac_via2_w));
@@ -786,7 +793,7 @@ void mac_state::macpb165c_map(address_map &map)
void mac_state::macpd210_map(address_map &map)
{
- map(0x40000000, 0x400fffff).rom().region("bootrom", 0).mirror(0x0ff00000);
+ map(0x40000000, 0x400fffff).r(FUNC(mac_state::rom_switch_r)).mirror(0x0ff00000);
map(0x50f00000, 0x50f01fff).rw(FUNC(mac_state::mac_via_r), FUNC(mac_state::mac_via_w));
map(0x50f02000, 0x50f03fff).rw(FUNC(mac_state::mac_via2_r), FUNC(mac_state::mac_via2_w));
@@ -806,7 +813,7 @@ void mac_state::macpd210_map(address_map &map)
void mac_state::quadra700_map(address_map &map)
{
- map(0x40000000, 0x400fffff).rom().region("bootrom", 0).mirror(0x0ff00000);
+ map(0x40000000, 0x400fffff).r(FUNC(mac_state::rom_switch_r)).mirror(0x0ff00000);
map(0x50000000, 0x50001fff).rw(FUNC(mac_state::mac_via_r), FUNC(mac_state::mac_via_w)).mirror(0x00fc0000);
map(0x50002000, 0x50003fff).rw(FUNC(mac_state::mac_via2_r), FUNC(mac_state::mac_via2_w)).mirror(0x00fc0000);
diff --git a/src/mame/includes/mac.h b/src/mame/includes/mac.h
index e159a178a28..bbca13d3c52 100644
--- a/src/mame/includes/mac.h
+++ b/src/mame/includes/mac.h
@@ -92,6 +92,8 @@ public:
m_palette(*this, "palette"),
m_dac(*this, "dac")
{
+ m_rom_size = 0;
+ m_rom_ptr = nullptr;
}
void add_scsi(machine_config &config, bool cdrom = false);
@@ -267,16 +269,6 @@ private:
virtual void machine_start() override;
virtual void machine_reset() override;
- /* for Egret and CUDA streaming MCU commands, command types */
- enum mac_streaming_t
- {
- MCU_STREAMING_NONE = 0,
- MCU_STREAMING_PRAMRD,
- MCU_STREAMING_PRAMWR,
- MCU_STREAMING_WRAMRD,
- MCU_STREAMING_WRAMWR
- };
-
enum
{
RBV_TYPE_RBV = 0,
@@ -317,7 +309,7 @@ private:
int32_t m_adb_irq_pending, m_adb_waiting_cmd, m_adb_datasize, m_adb_buffer[257];
int32_t m_adb_state, m_adb_command, m_adb_send, m_adb_timer_ticks, m_adb_extclock, m_adb_direction;
int32_t m_adb_listenreg, m_adb_listenaddr, m_adb_last_talk, m_adb_srq_switch;
- int32_t m_adb_streaming, m_adb_stream_ptr;
+ int32_t m_adb_stream_ptr;
int32_t m_adb_linestate;
bool m_adb_srqflag;
#define kADBKeyBufSize 32
@@ -502,6 +494,9 @@ private:
optional_device<palette_device> m_palette;
optional_device<dac_8bit_pwm_device> m_dac;
+ uint32_t m_rom_size;
+ uint32_t *m_rom_ptr;
+
emu_timer *m_scanline_timer;
emu_timer *m_adb_timer;
diff --git a/src/mame/machine/mac.cpp b/src/mame/machine/mac.cpp
index 6129cbae4d0..b6810f12e8f 100644
--- a/src/mame/machine/mac.cpp
+++ b/src/mame/machine/mac.cpp
@@ -325,8 +325,8 @@ void mac_state::v8_resize()
if (is_rom)
{
/* ROM mirror */
- memory_size = memregion("bootrom")->bytes();
- memory_data = memregion("bootrom")->base();
+ memory_size = m_rom_size;
+ memory_data = reinterpret_cast<uint8_t *>(m_rom_ptr);
is_rom = true;
}
else
@@ -353,9 +353,9 @@ void mac_state::v8_resize()
static const uint32_t simm_sizes[4] = { 0, 2*1024*1024, 4*1024*1024, 8*1024*1024 };
// re-install ROM in its normal place
- size_t rom_mirror = 0xfffff ^ (memregion("bootrom")->bytes() - 1);
+ size_t rom_mirror = 0xfffff ^ (m_rom_size - 1);
m_maincpu->space(AS_PROGRAM).install_read_bank(0xa00000, 0xafffff, rom_mirror, "bankR");
- membank("bankR")->set_base((void *)memregion("bootrom")->base());
+ membank("bankR")->set_base((void *)m_rom_ptr);
// force unmap of entire RAM region
space.unmap_write(0, 0x9fffff);
@@ -412,8 +412,8 @@ void mac_state::set_memory_overlay(int overlay)
if (overlay)
{
/* ROM mirror */
- memory_size = memregion("bootrom")->bytes();
- memory_data = memregion("bootrom")->base();
+ memory_size = m_rom_size;
+ memory_data = reinterpret_cast<uint8_t *>(m_rom_ptr);
is_rom = true;
}
else
@@ -440,6 +440,8 @@ void mac_state::set_memory_overlay(int overlay)
else // RAM: be careful not to populate ram B with a mirror or the ROM will get confused
{
mac_install_memory(0x00000000, memory_size-1, memory_size, memory_data, is_rom, "bank1");
+ // switch ROM region to direct access instead of through rom_switch_r
+ mac_install_memory(0x40000000, 0x4007ffff, memory_size, memory_data, is_rom, "bank2");
}
}
else if ((m_model == MODEL_MAC_PORTABLE) || (m_model == MODEL_MAC_PB100) || (m_model == MODEL_MAC_IIFX))
@@ -468,13 +470,17 @@ void mac_state::set_memory_overlay(int overlay)
}
else
{
- size_t rom_mirror = 0xfffffff ^ (memregion("bootrom")->bytes() - 1);
+ size_t rom_mirror = 0xfffffff ^ (m_rom_size - 1);
m_maincpu->space(AS_PROGRAM).install_read_bank(0x40000000, 0x4fffffff & ~rom_mirror, rom_mirror, "bankR");
- membank("bankR")->set_base((void *)memregion("bootrom")->base());
+ membank("bankR")->set_base((void *)m_rom_ptr);
}
}
else if (m_model == MODEL_MAC_QUADRA_700)
{
+ if (!is_rom)
+ {
+ mac_install_memory(0x40000000, 0x400fffff, m_rom_size, m_rom_ptr, true, "bank2");
+ }
mac_install_memory(0x00000000, memory_size-1, memory_size, memory_data, is_rom, "bank1");
}
else
@@ -491,18 +497,15 @@ void mac_state::set_memory_overlay(int overlay)
uint32_t mac_state::rom_switch_r(offs_t offset)
{
- offs_t ROM_size = memregion("bootrom")->bytes();
- uint32_t *ROM_data = (uint32_t *)memregion("bootrom")->base();
-
// disable the overlay
if (m_overlay)
{
set_memory_overlay(0);
}
- //printf("rom_switch_r: offset %08x ROM_size -1 = %08x, masked = %08x\n", offset, ROM_size-1, offset & ((ROM_size - 1)>>2));
+ //printf("rom_switch_r: offset %08x ROM_size -1 = %08x, masked = %08x\n", offset, m_rom_size-1, offset & ((m_rom_size - 1)>>2));
- return ROM_data[offset & ((ROM_size - 1)>>2)];
+ return m_rom_ptr[offset & ((m_rom_size - 1)>>2)];
}
@@ -1843,6 +1846,9 @@ void mac_state::mac_driver_init(model_t model)
m_scsi_interrupt = 0;
m_model = model;
+ m_rom_size = memregion("bootrom")->bytes();
+ m_rom_ptr = reinterpret_cast<uint32_t *>(memregion("bootrom")->base());
+
if (model < MODEL_MAC_PORTABLE)
{
/* set up RAM mirror at 0x600000-0x6fffff (0x7fffff ???) */
@@ -1850,7 +1856,7 @@ void mac_state::mac_driver_init(model_t model)
/* set up ROM at 0x400000-0x4fffff (-0x5fffff for mac 128k/512k/512ke) */
mac_install_memory(0x400000, (model >= MODEL_MAC_PLUS) ? 0x4fffff : 0x5fffff,
- memregion("bootrom")->bytes(), memregion("bootrom")->base(), true, "bank3");
+ m_rom_size, m_rom_ptr, true, "bank3");
}
m_overlay = -1;
@@ -1863,7 +1869,7 @@ void mac_state::mac_driver_init(model_t model)
if ((model == MODEL_MAC_SE) || (model == MODEL_MAC_CLASSIC) || (model == MODEL_MAC_CLASSIC_II) || (model == MODEL_MAC_LC) || (model == MODEL_MAC_COLOR_CLASSIC) || (model >= MODEL_MAC_LC_475 && model <= MODEL_MAC_LC_580) ||
(model == MODEL_MAC_LC_II) || (model == MODEL_MAC_LC_III) || (model == MODEL_MAC_LC_III_PLUS) || ((m_model >= MODEL_MAC_II) && (m_model <= MODEL_MAC_SE30)) ||
- (model == MODEL_MAC_PORTABLE) || (model == MODEL_MAC_PB100) || (model == MODEL_MAC_PB140) || (model == MODEL_MAC_PB160) || (model == MODEL_MAC_PBDUO_210) || (model >= MODEL_MAC_QUADRA_700 && model <= MODEL_MAC_QUADRA_800))
+ (model == MODEL_MAC_PORTABLE) || (model == MODEL_MAC_PB100))
{
m_overlay_timeout = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mac_state::overlay_timeout_func),this));
}
diff --git a/src/mame/machine/macadb.cpp b/src/mame/machine/macadb.cpp
index 76be06dcc12..c77be4a2889 100644
--- a/src/mame/machine/macadb.cpp
+++ b/src/mame/machine/macadb.cpp
@@ -1210,7 +1210,6 @@ void mac_state::adb_reset()
m_adb_extclock = 0;
m_adb_send = 0;
m_adb_waiting_cmd = 0;
- m_adb_streaming = MCU_STREAMING_NONE;
m_adb_state = 0;
m_adb_srqflag = false;
m_pmu_poll = 0;