mirror of
https://github.com/ekeeke/Genesis-Plus-GX.git
synced 2024-12-28 04:01:48 +01:00
Merge pull request #210 from nukeykt/ym3438
[Core/Sound] accurate YM2612/3438 status read emulation on invalid port
This commit is contained in:
commit
f3549f21b5
@ -1355,6 +1355,9 @@ void OPN2_Clock(ym3438_t *chip, Bit16s *buffer)
|
|||||||
|
|
||||||
buffer[0] = chip->mol;
|
buffer[0] = chip->mol;
|
||||||
buffer[1] = chip->mor;
|
buffer[1] = chip->mor;
|
||||||
|
|
||||||
|
if (chip->status_time)
|
||||||
|
chip->status_time--;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OPN2_Write(ym3438_t *chip, Bit32u port, Bit8u data)
|
void OPN2_Write(ym3438_t *chip, Bit32u port, Bit8u data)
|
||||||
@ -1411,18 +1414,30 @@ Bit8u OPN2_Read(ym3438_t *chip, Bit32u port)
|
|||||||
}
|
}
|
||||||
if (chip->mode_test_21[7])
|
if (chip->mode_test_21[7])
|
||||||
{
|
{
|
||||||
return testdata & 0xff;
|
chip->status = testdata & 0xff;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return testdata >> 8;
|
chip->status = testdata >> 8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return (chip->busy << 7) | (chip->timer_b_overflow_flag << 1)
|
chip->status = (chip->busy << 7) | (chip->timer_b_overflow_flag << 1)
|
||||||
| chip->timer_a_overflow_flag;
|
| chip->timer_a_overflow_flag;
|
||||||
}
|
}
|
||||||
|
if (chip_type == ym3438_type_ym2612)
|
||||||
|
{
|
||||||
|
chip->status_time = 300000;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
chip->status_time = 40000000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (chip->status_time)
|
||||||
|
{
|
||||||
|
return chip->status;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -205,6 +205,8 @@ typedef struct
|
|||||||
Bit8u pan_l[6], pan_r[6];
|
Bit8u pan_l[6], pan_r[6];
|
||||||
Bit8u ams[6];
|
Bit8u ams[6];
|
||||||
Bit8u pms[6];
|
Bit8u pms[6];
|
||||||
|
Bit8u status;
|
||||||
|
Bit32u status_time;
|
||||||
} ym3438_t;
|
} ym3438_t;
|
||||||
|
|
||||||
void OPN2_Reset(ym3438_t *chip);
|
void OPN2_Reset(ym3438_t *chip);
|
||||||
|
Loading…
Reference in New Issue
Block a user