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

@ -585,10 +585,24 @@ uint8_t agat_base_state::controller_strobe_r()
void agat_base_state::controller_strobe_w(uint8_t data)
{
m_joystick_x1_time = machine().time().as_double() + m_x_calibration * m_joy1x->read();
m_joystick_y1_time = machine().time().as_double() + m_y_calibration * m_joy1y->read();
m_joystick_x2_time = machine().time().as_double() + m_x_calibration * m_joy2x->read();
m_joystick_y2_time = machine().time().as_double() + m_y_calibration * m_joy2y->read();
// 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();
}
if (machine().time().as_double() >= m_joystick_y1_time)
{
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();
}
if (machine().time().as_double() >= m_joystick_y2_time)
{
m_joystick_y2_time = machine().time().as_double() + m_y_calibration * m_joy2y->read();
}
}
uint8_t agat_base_state::c080_r(offs_t offset)

View File

@ -677,10 +677,24 @@ u8 apple2_state::controller_strobe_r()
void apple2_state::controller_strobe_w(u8 data)
{
m_joystick_x1_time = machine().time().as_double() + m_x_calibration * m_gameio->pdl0_r();
m_joystick_y1_time = machine().time().as_double() + m_y_calibration * m_gameio->pdl1_r();
m_joystick_x2_time = machine().time().as_double() + m_x_calibration * m_gameio->pdl2_r();
m_joystick_y2_time = machine().time().as_double() + m_y_calibration * m_gameio->pdl3_r();
// 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();
}
if (machine().time().as_double() >= m_joystick_y1_time)
{
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();
}
if (machine().time().as_double() >= m_joystick_y2_time)
{
m_joystick_y2_time = machine().time().as_double() + m_y_calibration * m_gameio->pdl3_r();
}
}
u8 apple2_state::c080_r(offs_t offset)

View File

@ -1903,10 +1903,23 @@ void apple2e_state::do_io(int offset, bool is_iic)
accel_normal_speed();
}
m_joystick_x1_time = machine().time().as_double() + m_x_calibration * m_gameio->pdl0_r();
m_joystick_y1_time = machine().time().as_double() + m_y_calibration * m_gameio->pdl1_r();
m_joystick_x2_time = machine().time().as_double() + m_x_calibration * m_gameio->pdl2_r();
m_joystick_y2_time = machine().time().as_double() + m_y_calibration * m_gameio->pdl3_r();
// 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();
}
if (machine().time().as_double() >= m_joystick_y1_time)
{
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();
}
if (machine().time().as_double() >= m_joystick_y2_time)
{
m_joystick_y2_time = machine().time().as_double() + m_y_calibration * m_gameio->pdl3_r();
}
break;
default:

View File

@ -2187,10 +2187,23 @@ void apple2gs_state::do_io(int offset)
accel_normal_speed();
}
m_joystick_x1_time = machine().time().as_double() + m_x_calibration * m_gameio->pdl0_r();
m_joystick_y1_time = machine().time().as_double() + m_y_calibration * m_gameio->pdl1_r();
m_joystick_x2_time = machine().time().as_double() + m_x_calibration * m_gameio->pdl2_r();
m_joystick_y2_time = machine().time().as_double() + m_y_calibration * m_gameio->pdl3_r();
// 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();
}
if (machine().time().as_double() >= m_joystick_y1_time)
{
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();
}
if (machine().time().as_double() >= m_joystick_y2_time)
{
m_joystick_y2_time = machine().time().as_double() + m_y_calibration * m_gameio->pdl3_r();
}
break;
default:
@ -2627,10 +2640,24 @@ u8 apple2gs_state::c000_r(offs_t offset)
accel_normal_speed();
}
m_joystick_x1_time = machine().time().as_double() + m_x_calibration * m_gameio->pdl0_r();
m_joystick_y1_time = machine().time().as_double() + m_y_calibration * m_gameio->pdl1_r();
m_joystick_x2_time = machine().time().as_double() + m_x_calibration * m_gameio->pdl2_r();
m_joystick_y2_time = machine().time().as_double() + m_y_calibration * m_gameio->pdl3_r();
// 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();
}
if (machine().time().as_double() >= m_joystick_y1_time)
{
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();
}
if (machine().time().as_double() >= m_joystick_y2_time)
{
m_joystick_y2_time = machine().time().as_double() + m_y_calibration * m_gameio->pdl3_r();
}
}
return m_rom[offset + 0x3c000];