(MESS) mac: Use pre-cached tagmaps for keyboard/mouse (nw)

(No speed difference, sorry folks).
This commit is contained in:
R. Belmont 2013-01-26 20:42:33 +00:00
parent 391aec2e5c
commit 52a1fa0005
4 changed files with 49 additions and 12 deletions

View File

@ -39,7 +39,7 @@
'g 6802c73c' to get to the interesting part (wait past the boot chime). PPC register r24 is the 68000 PC. 'g 6802c73c' to get to the interesting part (wait past the boot chime). PPC register r24 is the 68000 PC.
when the PC hits GetCPUID, the move.l (a2), d0 at PC = 0x10000 will cause an MMU fault (jump to 0xFFF00300). why? 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. a2 = 0x5ffffffc (the CPU ID register). MMU is unable to resolve this; defect in the MMU emulation probable.
****************************************************************************/ ****************************************************************************/
@ -127,7 +127,7 @@ WRITE32_MEMBER( mac_state::rbv_ramdac_w )
if (m_model != MODEL_MAC_CLASSIC_II) if (m_model != MODEL_MAC_CLASSIC_II)
{ {
// Color Classic has no MONTYPE so the safe read gets us 512x384, which is right // Color Classic has no MONTYPE so the safe read gets us 512x384, which is right
if (space.machine().root_device().ioport("MONTYPE")->read_safe(2) == 1) if (m_montype->read_safe(2) == 1)
{ {
palette_set_color(space.machine(), m_rbv_clutoffs, MAKE_RGB(m_rbv_colors[2], m_rbv_colors[2], m_rbv_colors[2])); palette_set_color(space.machine(), m_rbv_clutoffs, MAKE_RGB(m_rbv_colors[2], m_rbv_colors[2], m_rbv_colors[2]));
m_rbv_palette[m_rbv_clutoffs] = MAKE_RGB(m_rbv_colors[2], m_rbv_colors[2], m_rbv_colors[2]); m_rbv_palette[m_rbv_clutoffs] = MAKE_RGB(m_rbv_colors[2], m_rbv_colors[2], m_rbv_colors[2]);
@ -163,7 +163,7 @@ WRITE32_MEMBER( mac_state::ariel_ramdac_w ) // this is for the "Ariel" style RAM
if (m_model != MODEL_MAC_CLASSIC_II) if (m_model != MODEL_MAC_CLASSIC_II)
{ {
// Color Classic has no MONTYPE so the safe read gets us 512x384, which is right // Color Classic has no MONTYPE so the safe read gets us 512x384, which is right
if (space.machine().root_device().ioport("MONTYPE")->read_safe(2) == 1) if (m_montype->read_safe(2) == 1)
{ {
palette_set_color(space.machine(), m_rbv_clutoffs, MAKE_RGB(m_rbv_colors[2], m_rbv_colors[2], m_rbv_colors[2])); palette_set_color(space.machine(), m_rbv_clutoffs, MAKE_RGB(m_rbv_colors[2], m_rbv_colors[2], m_rbv_colors[2]));
m_rbv_palette[m_rbv_clutoffs] = MAKE_RGB(m_rbv_colors[2], m_rbv_colors[2], m_rbv_colors[2]); m_rbv_palette[m_rbv_clutoffs] = MAKE_RGB(m_rbv_colors[2], m_rbv_colors[2], m_rbv_colors[2]);
@ -195,7 +195,7 @@ READ8_MEMBER( mac_state::mac_sonora_vctl_r )
if (offset == 2) if (offset == 2)
{ {
// printf("Sonora: read monitor ID at PC=%x\n", m_maincpu->pc()); // printf("Sonora: read monitor ID at PC=%x\n", m_maincpu->pc());
return (space.machine().root_device().ioport("MONTYPE")->read_safe(6)<<4); return (m_montype->read_safe(6)<<4);
} }
return m_sonora_vctl[offset]; return m_sonora_vctl[offset];
@ -251,7 +251,7 @@ READ8_MEMBER ( mac_state::mac_rbv_r )
if (offset == 0x10) if (offset == 0x10)
{ {
data &= ~0x38; data &= ~0x38;
data |= (space.machine().root_device().ioport("MONTYPE")->read_safe(2)<<3); data |= (m_montype->read_safe(2)<<3);
// printf("rbv_r montype: %02x (PC %x)\n", data, space.cpu->safe_pc()); // printf("rbv_r montype: %02x (PC %x)\n", data, space.cpu->safe_pc());
} }

View File

@ -198,6 +198,17 @@ public:
m_ncr5380(*this, "scsi:ncr5380"), m_ncr5380(*this, "scsi:ncr5380"),
m_mackbd(*this, MACKBD_TAG), m_mackbd(*this, MACKBD_TAG),
m_rtc(*this,"rtc"), m_rtc(*this,"rtc"),
m_mouse0(*this, "MOUSE0"),
m_mouse1(*this, "MOUSE1"),
m_mouse2(*this, "MOUSE2"),
m_key0(*this, "KEY0"),
m_key1(*this, "KEY1"),
m_key2(*this, "KEY2"),
m_key3(*this, "KEY3"),
m_key4(*this, "KEY4"),
m_key5(*this, "KEY5"),
m_key6(*this, "KEY6"),
m_montype(*this, "MONTYPE"),
m_vram(*this,"vram"), m_vram(*this,"vram"),
m_vram16(*this,"vram16") m_vram16(*this,"vram16")
{ } { }
@ -217,6 +228,10 @@ public:
optional_device<mackbd_device> m_mackbd; optional_device<mackbd_device> m_mackbd;
optional_device<rtc3430042_device> m_rtc; optional_device<rtc3430042_device> m_rtc;
required_ioport m_mouse0, m_mouse1, m_mouse2;
required_ioport m_key0, m_key1, m_key2, m_key3, m_key4, m_key5;
optional_ioport m_key6, m_montype;
virtual void machine_start(); virtual void machine_start();
virtual void machine_reset(); virtual void machine_reset();

View File

@ -561,7 +561,6 @@ static int scan_keyboard(running_machine &machine)
int i, j; int i, j;
int keybuf; int keybuf;
int keycode; int keycode;
static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4", "KEY5", "KEY6" };
mac_state *mac = machine.driver_data<mac_state>(); mac_state *mac = machine.driver_data<mac_state>();
if (mac->m_keycode_buf_index) if (mac->m_keycode_buf_index)
@ -571,7 +570,30 @@ static int scan_keyboard(running_machine &machine)
for (i=0; i<7; i++) for (i=0; i<7; i++)
{ {
keybuf = machine.root_device().ioport(keynames[i])->read(); switch (i)
{
case 0:
keybuf = mac->m_key0->read();
break;
case 1:
keybuf = mac->m_key1->read();
break;
case 2:
keybuf = mac->m_key2->read();
break;
case 3:
keybuf = mac->m_key3->read();
break;
case 4:
keybuf = mac->m_key4->read();
break;
case 5:
keybuf = mac->m_key5->read();
break;
case 6:
keybuf = mac->m_key6->read();
break;
}
if (keybuf != mac->m_key_matrix[i]) if (keybuf != mac->m_key_matrix[i])
{ {
@ -839,8 +861,8 @@ void mac_state::mouse_callback()
int x_needs_update = 0, y_needs_update = 0; int x_needs_update = 0, y_needs_update = 0;
mac_state *mac = machine().driver_data<mac_state>(); mac_state *mac = machine().driver_data<mac_state>();
new_mx = ioport("MOUSE1")->read(); new_mx = m_mouse1->read();
new_my = ioport("MOUSE2")->read(); new_my = m_mouse2->read();
/* see if it moved in the x coord */ /* see if it moved in the x coord */
if (new_mx != last_mx) if (new_mx != last_mx)
@ -1353,7 +1375,7 @@ READ8_MEMBER(mac_state::mac_via_in_b)
val |= 0x20; val |= 0x20;
if (m_mouse_bit_x) /* Mouse X2 */ if (m_mouse_bit_x) /* Mouse X2 */
val |= 0x10; val |= 0x10;
if ((machine().root_device().ioport("MOUSE0")->read() & 0x01) == 0) if ((m_mouse0->read() & 0x01) == 0)
val |= 0x08; val |= 0x08;
if (!ADB_IS_PM_CLASS) if (!ADB_IS_PM_CLASS)

View File

@ -242,7 +242,7 @@ VIDEO_RESET_MEMBER(mac_state,macrbv)
visarea.min_x = 0; visarea.min_x = 0;
visarea.min_y = 0; visarea.min_y = 0;
view = 0; view = 0;
m_rbv_montype = machine().root_device().ioport("MONTYPE")->read_safe(2); m_rbv_montype = m_montype->read_safe(2);
switch (m_rbv_montype) switch (m_rbv_montype)
{ {
case 1: // 15" portrait display case 1: // 15" portrait display
@ -299,7 +299,7 @@ VIDEO_RESET_MEMBER(mac_state,macsonora)
visarea.min_x = 0; visarea.min_x = 0;
visarea.min_y = 0; visarea.min_y = 0;
m_rbv_montype = machine().root_device().ioport("MONTYPE")->read_safe(2); m_rbv_montype = m_montype->read_safe(2);
switch (m_rbv_montype) switch (m_rbv_montype)
{ {
case 1: // 15" portrait display case 1: // 15" portrait display