mirror of
https://github.com/holub/mame
synced 2025-04-23 08:49:55 +03:00
apple2: fix missing floating bus reads and improved joystick/paddle calibration [Golden Child]
This commit is contained in:
parent
cd704879b2
commit
4210ce2de0
@ -313,8 +313,8 @@ void apple2_state::machine_start()
|
||||
m_inh_bank = 0;
|
||||
|
||||
// precalculate joystick time constants
|
||||
m_x_calibration = attotime::from_usec(12).as_double();
|
||||
m_y_calibration = attotime::from_usec(13).as_double();
|
||||
m_x_calibration = attotime::from_nsec(10800).as_double();
|
||||
m_y_calibration = attotime::from_nsec(10800).as_double();
|
||||
|
||||
// cache slot devices
|
||||
for (int i = 0; i <= 7; i++)
|
||||
@ -630,33 +630,33 @@ READ8_MEMBER(apple2_state::flags_r)
|
||||
switch (offset)
|
||||
{
|
||||
case 0: // cassette in
|
||||
return m_cassette->input() > 0.0 ? 0x80 : 0;
|
||||
return (m_cassette->input() > 0.0 ? 0x80 : 0) | (read_floatingbus() & 0x7f);
|
||||
|
||||
case 1: // button 0
|
||||
return (m_joybuttons->read() & 0x10) ? 0x80 : 0;
|
||||
return ((m_joybuttons->read() & 0x10) ? 0x80 : 0) | (read_floatingbus() & 0x7f);
|
||||
|
||||
case 2: // button 1
|
||||
return (m_joybuttons->read() & 0x20) ? 0x80 : 0;
|
||||
return ((m_joybuttons->read() & 0x20) ? 0x80 : 0) | (read_floatingbus() & 0x7f);
|
||||
|
||||
case 3: // button 2
|
||||
// check if SHIFT key mod configured
|
||||
if (m_sysconfig->read() & 0x04)
|
||||
{
|
||||
return ((m_joybuttons->read() & 0x40) || (m_kbspecial->read() & 0x06)) ? 0x80 : 0;
|
||||
return (((m_joybuttons->read() & 0x40) || (m_kbspecial->read() & 0x06)) ? 0x80 : 0) | (read_floatingbus() & 0x3f);
|
||||
}
|
||||
return (m_joybuttons->read() & 0x40) ? 0x80 : 0;
|
||||
return ((m_joybuttons->read() & 0x40) ? 0x80 : 0) | (read_floatingbus() & 0x7f);
|
||||
|
||||
case 4: // joy 1 X axis
|
||||
return (machine().time().as_double() < m_joystick_x1_time) ? 0x80 : 0;
|
||||
return ((machine().time().as_double() < m_joystick_x1_time) ? 0x80 : 0) | (read_floatingbus() & 0x7f);
|
||||
|
||||
case 5: // joy 1 Y axis
|
||||
return (machine().time().as_double() < m_joystick_y1_time) ? 0x80 : 0;
|
||||
return ((machine().time().as_double() < m_joystick_y1_time) ? 0x80 : 0) | (read_floatingbus() & 0x7f);
|
||||
|
||||
case 6: // joy 2 X axis
|
||||
return (machine().time().as_double() < m_joystick_x2_time) ? 0x80 : 0;
|
||||
return ((machine().time().as_double() < m_joystick_x2_time) ? 0x80 : 0) | (read_floatingbus() & 0x7f);
|
||||
|
||||
case 7: // joy 2 Y axis
|
||||
return (machine().time().as_double() < m_joystick_y2_time) ? 0x80 : 0;
|
||||
return ((machine().time().as_double() < m_joystick_y2_time) ? 0x80 : 0) | (read_floatingbus() & 0x7f);
|
||||
}
|
||||
|
||||
// this is never reached
|
||||
|
@ -780,8 +780,8 @@ void apple2e_state::machine_start()
|
||||
}
|
||||
|
||||
// precalculate joystick time constants
|
||||
m_x_calibration = attotime::from_usec(12).as_double();
|
||||
m_y_calibration = attotime::from_usec(13).as_double();
|
||||
m_x_calibration = attotime::from_nsec(10800).as_double();
|
||||
m_y_calibration = attotime::from_nsec(10800).as_double();
|
||||
|
||||
// cache slot devices
|
||||
for (int i = 0; i <= 7; i++)
|
||||
@ -1592,6 +1592,7 @@ void apple2e_state::do_io(address_space &space, int offset, bool is_iic)
|
||||
READ8_MEMBER(apple2e_state::c000_r)
|
||||
{
|
||||
if(machine().side_effects_disabled()) return read_floatingbus();
|
||||
u8 uFloatingBus7 = read_floatingbus() & 0x7f;
|
||||
|
||||
if ((offset & 0xf0) == 0x00) // keyboard latch, $C000 is really 00-0F
|
||||
{
|
||||
@ -1656,43 +1657,43 @@ READ8_MEMBER(apple2e_state::c000_r)
|
||||
case 0x68:
|
||||
if (m_cassette)
|
||||
{
|
||||
return m_cassette->input() > 0.0 ? 0x80 : 0;
|
||||
return (m_cassette->input() > 0.0 ? 0x80 : 0) | uFloatingBus7;
|
||||
}
|
||||
return 0;
|
||||
return uFloatingBus7;
|
||||
|
||||
case 0x61: // button 0 or Open Apple
|
||||
case 0x69:
|
||||
return ((m_joybuttons->read() & 0x10) || (m_kbspecial->read() & 0x10)) ? 0x80 : 0;
|
||||
return (((m_joybuttons->read() & 0x10) || (m_kbspecial->read() & 0x10)) ? 0x80 : 0) | uFloatingBus7;
|
||||
|
||||
case 0x62: // button 1 or Solid Apple
|
||||
case 0x6a:
|
||||
return ((m_joybuttons->read() & 0x20) || (m_kbspecial->read() & 0x20)) ? 0x80 : 0;
|
||||
return (((m_joybuttons->read() & 0x20) || (m_kbspecial->read() & 0x20)) ? 0x80 : 0) | uFloatingBus7;
|
||||
|
||||
case 0x63: // button 2 or SHIFT key
|
||||
case 0x6b:
|
||||
return ((m_joybuttons->read() & 0x40) || (m_kbspecial->read() & 0x06)) ? 0x80 : 0;
|
||||
return (((m_joybuttons->read() & 0x40) || (m_kbspecial->read() & 0x06)) ? 0x80 : 0) | uFloatingBus7;
|
||||
|
||||
case 0x64: // joy 1 X axis
|
||||
case 0x6c:
|
||||
return (machine().time().as_double() < m_joystick_x1_time) ? 0x80 : 0;
|
||||
return ((machine().time().as_double() < m_joystick_x1_time) ? 0x80 : 0) | uFloatingBus7;
|
||||
|
||||
case 0x65: // joy 1 Y axis
|
||||
case 0x6d:
|
||||
return (machine().time().as_double() < m_joystick_y1_time) ? 0x80 : 0;
|
||||
return ((machine().time().as_double() < m_joystick_y1_time) ? 0x80 : 0) | uFloatingBus7;
|
||||
|
||||
case 0x66: // joy 2 X axis
|
||||
case 0x6e:
|
||||
return (machine().time().as_double() < m_joystick_x2_time) ? 0x80 : 0;
|
||||
return ((machine().time().as_double() < m_joystick_x2_time) ? 0x80 : 0) | uFloatingBus7;
|
||||
|
||||
case 0x67: // joy 2 Y axis
|
||||
case 0x6f:
|
||||
return (machine().time().as_double() < m_joystick_y2_time) ? 0x80 : 0;
|
||||
return ((machine().time().as_double() < m_joystick_y2_time) ? 0x80 : 0) | uFloatingBus7;
|
||||
|
||||
case 0x7e: // read IOUDIS
|
||||
return m_ioudis ? 0x80 : 0x00;
|
||||
return (m_ioudis ? 0x80 : 0x00) | uFloatingBus7;
|
||||
|
||||
case 0x7f: // read DHIRES
|
||||
return m_video->m_dhires ? 0x00 : 0x80;
|
||||
return (m_video->m_dhires ? 0x00 : 0x80) | uFloatingBus7;
|
||||
|
||||
default:
|
||||
do_io(space, offset, false);
|
||||
@ -1833,6 +1834,7 @@ WRITE8_MEMBER(apple2e_state::c000_w)
|
||||
READ8_MEMBER(apple2e_state::c000_iic_r)
|
||||
{
|
||||
if(machine().side_effects_disabled()) return read_floatingbus();
|
||||
u8 uFloatingBus7 = read_floatingbus() & 0x7f;
|
||||
|
||||
if ((offset & 0xf0) == 0x00) // keyboard latch, $C000 is really 00-0F
|
||||
{
|
||||
@ -1908,43 +1910,43 @@ READ8_MEMBER(apple2e_state::c000_iic_r)
|
||||
return m_y0edge ? 0x80 : 0x00;
|
||||
|
||||
case 0x60: // 40/80 column switch (IIc only)
|
||||
return (m_sysconfig->read() & 0x04) ? 0x80 : 0;
|
||||
return ((m_sysconfig->read() & 0x04) ? 0x80 : 0) | uFloatingBus7;
|
||||
|
||||
case 0x61: // button 0 or Open Apple or mouse button 1
|
||||
case 0x69:
|
||||
return ((m_joybuttons->read() & 0x10) || (m_kbspecial->read() & 0x10)) ? 0x80 : 0;
|
||||
return (((m_joybuttons->read() & 0x10) || (m_kbspecial->read() & 0x10)) ? 0x80 : 0) | uFloatingBus7;
|
||||
|
||||
case 0x62: // button 1 or Solid Apple
|
||||
case 0x6a:
|
||||
return ((m_joybuttons->read() & 0x20) || (m_kbspecial->read() & 0x20)) ? 0x80 : 0;
|
||||
return (((m_joybuttons->read() & 0x20) || (m_kbspecial->read() & 0x20)) ? 0x80 : 0) | uFloatingBus7;
|
||||
|
||||
case 0x63: // mouse button 2 (no other function on IIc)
|
||||
case 0x6b:
|
||||
return m_mouseb->read() ? 0 : 0x80;
|
||||
return (m_mouseb->read() ? 0 : 0x80) | uFloatingBus7;
|
||||
|
||||
case 0x64: // joy 1 X axis
|
||||
case 0x6c:
|
||||
return (machine().time().as_double() < m_joystick_x1_time) ? 0x80 : 0;
|
||||
return ((machine().time().as_double() < m_joystick_x1_time) ? 0x80 : 0) | uFloatingBus7;
|
||||
|
||||
case 0x65: // joy 1 Y axis
|
||||
case 0x6d:
|
||||
return (machine().time().as_double() < m_joystick_y1_time) ? 0x80 : 0;
|
||||
return ((machine().time().as_double() < m_joystick_y1_time) ? 0x80 : 0) | uFloatingBus7;
|
||||
|
||||
case 0x66: // mouse X1 (IIc only)
|
||||
case 0x6e:
|
||||
return m_x1 ? 0x80 : 0;
|
||||
return (m_x1 ? 0x80 : 0) | uFloatingBus7;
|
||||
|
||||
case 0x67: // mouse Y1 (IIc only)
|
||||
case 0x6f:
|
||||
return m_y1 ? 0x80 : 0;
|
||||
return (m_y1 ? 0x80 : 0) | uFloatingBus7;
|
||||
|
||||
case 0x7e: // read IOUDIS
|
||||
m_vbl = false;
|
||||
lower_irq(IRQ_VBL);
|
||||
return m_ioudis ? 0x80 : 0x00;
|
||||
return (m_ioudis ? 0x80 : 0x00) | uFloatingBus7;
|
||||
|
||||
case 0x7f: // read DHIRES
|
||||
return m_video->m_dhires ? 0x00 : 0x80;
|
||||
return (m_video->m_dhires ? 0x00 : 0x80) | uFloatingBus7;
|
||||
|
||||
default:
|
||||
do_io(space, offset, true);
|
||||
|
@ -1212,8 +1212,8 @@ void apple2gs_state::machine_start()
|
||||
m_speaker->set_levels(16, lvlTable);
|
||||
|
||||
// precalculate joystick time constants
|
||||
m_x_calibration = attotime::from_usec(12).as_double();
|
||||
m_y_calibration = attotime::from_usec(13).as_double();
|
||||
m_x_calibration = attotime::from_nsec(10800).as_double();
|
||||
m_y_calibration = attotime::from_nsec(10800).as_double();
|
||||
|
||||
// cache slot devices
|
||||
for (int i = 0; i <= 7; i++)
|
||||
@ -2029,6 +2029,7 @@ READ8_MEMBER(apple2gs_state::c000_r)
|
||||
}
|
||||
|
||||
slow_cycle();
|
||||
u8 uFloatingBus7 = read_floatingbus();
|
||||
|
||||
switch (offset)
|
||||
{
|
||||
@ -2272,28 +2273,28 @@ READ8_MEMBER(apple2gs_state::c000_r)
|
||||
return (m_an3 ? INTFLAG_AN3 : 0x00) | m_intflag;
|
||||
|
||||
case 0x60: // button 3 on IIgs
|
||||
return (m_joybuttons->read() & 0x80);
|
||||
return (m_joybuttons->read() & 0x80) | uFloatingBus7;
|
||||
|
||||
case 0x61: // button 0 or Open Apple
|
||||
return ((m_joybuttons->read() & 0x10) || (m_kbspecial->read() & 0x10)) ? 0x80 : 0;
|
||||
return (((m_joybuttons->read() & 0x10) || (m_kbspecial->read() & 0x10)) ? 0x80 : 0) | uFloatingBus7;
|
||||
|
||||
case 0x62: // button 1 or Solid Apple
|
||||
return ((m_joybuttons->read() & 0x20) || (m_kbspecial->read() & 0x20)) ? 0x80 : 0;
|
||||
return (((m_joybuttons->read() & 0x20) || (m_kbspecial->read() & 0x20)) ? 0x80 : 0) | uFloatingBus7;
|
||||
|
||||
case 0x63: // button 2 or SHIFT key
|
||||
return ((m_joybuttons->read() & 0x40) || (m_kbspecial->read() & 0x06)) ? 0x80 : 0;
|
||||
return (((m_joybuttons->read() & 0x40) || (m_kbspecial->read() & 0x06)) ? 0x80 : 0) | uFloatingBus7;
|
||||
|
||||
case 0x64: // joy 1 X axis
|
||||
return (machine().time().as_double() < m_joystick_x1_time) ? 0x80 : 0;
|
||||
return ((machine().time().as_double() < m_joystick_x1_time) ? 0x80 : 0) | uFloatingBus7;
|
||||
|
||||
case 0x65: // joy 1 Y axis
|
||||
return (machine().time().as_double() < m_joystick_y1_time) ? 0x80 : 0;
|
||||
return ((machine().time().as_double() < m_joystick_y1_time) ? 0x80 : 0) | uFloatingBus7;
|
||||
|
||||
case 0x66: // joy 2 X axis
|
||||
return (machine().time().as_double() < m_joystick_x2_time) ? 0x80 : 0;
|
||||
return ((machine().time().as_double() < m_joystick_x2_time) ? 0x80 : 0) | uFloatingBus7;
|
||||
|
||||
case 0x67: // joy 2 Y axis
|
||||
return (machine().time().as_double() < m_joystick_y2_time) ? 0x80 : 0;
|
||||
return ((machine().time().as_double() < m_joystick_y2_time) ? 0x80 : 0) | uFloatingBus7;
|
||||
|
||||
case 0x68: // STATEREG, synthesizes all the IIe state regs
|
||||
return (m_altzp ? 0x80 : 0x00) |
|
||||
|
Loading…
Reference in New Issue
Block a user