fixed one-shot paddle timers in Apple II and clones (#8504)

This commit is contained in:
xotmatrix 2021-08-30 08:11:34 -04:00 committed by GitHub
parent 3e54ade4bc
commit cd17ea8829
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 88 additions and 20 deletions

View File

@ -584,13 +584,27 @@ uint8_t agat_base_state::controller_strobe_r()
} }
void agat_base_state::controller_strobe_w(uint8_t data) void agat_base_state::controller_strobe_w(uint8_t data)
{
// 555 monostable one-shot timers; a running timer cannot be restarted
if (machine().time().as_double() >= m_joystick_x1_time)
{ {
m_joystick_x1_time = machine().time().as_double() + m_x_calibration * m_joy1x->read(); m_joystick_x1_time = machine().time().as_double() + m_x_calibration * m_joy1x->read();
}
if (machine().time().as_double() >= m_joystick_y1_time)
{
m_joystick_y1_time = machine().time().as_double() + m_y_calibration * m_joy1y->read(); m_joystick_y1_time = machine().time().as_double() + m_y_calibration * m_joy1y->read();
}
if (machine().time().as_double() >= m_joystick_x2_time)
{
m_joystick_x2_time = machine().time().as_double() + m_x_calibration * m_joy2x->read(); m_joystick_x2_time = machine().time().as_double() + m_x_calibration * m_joy2x->read();
}
if (machine().time().as_double() >= m_joystick_y2_time)
{
m_joystick_y2_time = machine().time().as_double() + m_y_calibration * m_joy2y->read(); m_joystick_y2_time = machine().time().as_double() + m_y_calibration * m_joy2y->read();
} }
}
uint8_t agat_base_state::c080_r(offs_t offset) uint8_t agat_base_state::c080_r(offs_t offset)
{ {
if (!machine().side_effects_disabled()) if (!machine().side_effects_disabled())

View File

@ -676,13 +676,27 @@ u8 apple2_state::controller_strobe_r()
} }
void apple2_state::controller_strobe_w(u8 data) void apple2_state::controller_strobe_w(u8 data)
{
// 558 monostable one-shot timers; a running timer cannot be restarted
if (machine().time().as_double() >= m_joystick_x1_time)
{ {
m_joystick_x1_time = machine().time().as_double() + m_x_calibration * m_gameio->pdl0_r(); m_joystick_x1_time = machine().time().as_double() + m_x_calibration * m_gameio->pdl0_r();
}
if (machine().time().as_double() >= m_joystick_y1_time)
{
m_joystick_y1_time = machine().time().as_double() + m_y_calibration * m_gameio->pdl1_r(); m_joystick_y1_time = machine().time().as_double() + m_y_calibration * m_gameio->pdl1_r();
}
if (machine().time().as_double() >= m_joystick_x2_time)
{
m_joystick_x2_time = machine().time().as_double() + m_x_calibration * m_gameio->pdl2_r(); m_joystick_x2_time = machine().time().as_double() + m_x_calibration * m_gameio->pdl2_r();
}
if (machine().time().as_double() >= m_joystick_y2_time)
{
m_joystick_y2_time = machine().time().as_double() + m_y_calibration * m_gameio->pdl3_r(); m_joystick_y2_time = machine().time().as_double() + m_y_calibration * m_gameio->pdl3_r();
} }
}
u8 apple2_state::c080_r(offs_t offset) u8 apple2_state::c080_r(offs_t offset)
{ {
if(!machine().side_effects_disabled()) if(!machine().side_effects_disabled())

View File

@ -1903,10 +1903,23 @@ void apple2e_state::do_io(int offset, bool is_iic)
accel_normal_speed(); accel_normal_speed();
} }
// 558 monostable one-shot timers; a running timer cannot be restarted
if (machine().time().as_double() >= m_joystick_x1_time)
{
m_joystick_x1_time = machine().time().as_double() + m_x_calibration * m_gameio->pdl0_r(); m_joystick_x1_time = machine().time().as_double() + m_x_calibration * m_gameio->pdl0_r();
}
if (machine().time().as_double() >= m_joystick_y1_time)
{
m_joystick_y1_time = machine().time().as_double() + m_y_calibration * m_gameio->pdl1_r(); m_joystick_y1_time = machine().time().as_double() + m_y_calibration * m_gameio->pdl1_r();
}
if (machine().time().as_double() >= m_joystick_x2_time)
{
m_joystick_x2_time = machine().time().as_double() + m_x_calibration * m_gameio->pdl2_r(); m_joystick_x2_time = machine().time().as_double() + m_x_calibration * m_gameio->pdl2_r();
}
if (machine().time().as_double() >= m_joystick_y2_time)
{
m_joystick_y2_time = machine().time().as_double() + m_y_calibration * m_gameio->pdl3_r(); m_joystick_y2_time = machine().time().as_double() + m_y_calibration * m_gameio->pdl3_r();
}
break; break;
default: default:

View File

@ -2187,10 +2187,23 @@ void apple2gs_state::do_io(int offset)
accel_normal_speed(); accel_normal_speed();
} }
// 558 monostable one-shot timers; a running timer cannot be restarted
if (machine().time().as_double() >= m_joystick_x1_time)
{
m_joystick_x1_time = machine().time().as_double() + m_x_calibration * m_gameio->pdl0_r(); m_joystick_x1_time = machine().time().as_double() + m_x_calibration * m_gameio->pdl0_r();
}
if (machine().time().as_double() >= m_joystick_y1_time)
{
m_joystick_y1_time = machine().time().as_double() + m_y_calibration * m_gameio->pdl1_r(); m_joystick_y1_time = machine().time().as_double() + m_y_calibration * m_gameio->pdl1_r();
}
if (machine().time().as_double() >= m_joystick_x2_time)
{
m_joystick_x2_time = machine().time().as_double() + m_x_calibration * m_gameio->pdl2_r(); m_joystick_x2_time = machine().time().as_double() + m_x_calibration * m_gameio->pdl2_r();
}
if (machine().time().as_double() >= m_joystick_y2_time)
{
m_joystick_y2_time = machine().time().as_double() + m_y_calibration * m_gameio->pdl3_r(); m_joystick_y2_time = machine().time().as_double() + m_y_calibration * m_gameio->pdl3_r();
}
break; break;
default: default:
@ -2627,12 +2640,26 @@ u8 apple2gs_state::c000_r(offs_t offset)
accel_normal_speed(); accel_normal_speed();
} }
// 558 monostable one-shot timers; a running timer cannot be restarted
if (machine().time().as_double() >= m_joystick_x1_time)
{
m_joystick_x1_time = machine().time().as_double() + m_x_calibration * m_gameio->pdl0_r(); m_joystick_x1_time = machine().time().as_double() + m_x_calibration * m_gameio->pdl0_r();
}
if (machine().time().as_double() >= m_joystick_y1_time)
{
m_joystick_y1_time = machine().time().as_double() + m_y_calibration * m_gameio->pdl1_r(); m_joystick_y1_time = machine().time().as_double() + m_y_calibration * m_gameio->pdl1_r();
}
if (machine().time().as_double() >= m_joystick_x2_time)
{
m_joystick_x2_time = machine().time().as_double() + m_x_calibration * m_gameio->pdl2_r(); m_joystick_x2_time = machine().time().as_double() + m_x_calibration * m_gameio->pdl2_r();
}
if (machine().time().as_double() >= m_joystick_y2_time)
{
m_joystick_y2_time = machine().time().as_double() + m_y_calibration * m_gameio->pdl3_r(); m_joystick_y2_time = machine().time().as_double() + m_y_calibration * m_gameio->pdl3_r();
} }
}
return m_rom[offset + 0x3c000]; return m_rom[offset + 0x3c000];
break; break;