Fixed OPL chip detection.
- Increment timer counter before checking for overflow. - Implemented ISA bus delay in the pc_system code and use it for the SB16. This makes OPL chip detection work at ips values > 4 Mips. TODO: OPL chip should use wave output instead of MIDI (maybe port from DOSBox). TODO: Use isa_bus_delay() for other legacy devices if required.
This commit is contained in:
parent
33a633cbd2
commit
c7c92bb62b
@ -2428,7 +2428,7 @@ void bx_sb16_c::opl_timerevent()
|
||||
} else {
|
||||
mask = 0x3ff;
|
||||
}
|
||||
if (((OPL.timer[i]++) & mask) == 0) { // overflow occured, set flags accordingly
|
||||
if (((++OPL.timer[i]) & mask) == 0) { // overflow occured, set flags accordingly
|
||||
OPL.timer[i] = OPL.timerinit[i]; // reset the counter
|
||||
if ((OPL.tmask[i/2] >> (6 - (i % 2))) == 0) { // set flags only if unmasked
|
||||
writelog(MIDILOG(5), "OPL Timer Interrupt: Chip %d, Timer %d", i/2, 1 << (i % 2));
|
||||
@ -3372,8 +3372,9 @@ Bit32u bx_sb16_c::read(Bit32u address, unsigned io_len)
|
||||
UNUSED(this_ptr);
|
||||
#endif // !BX_USE_SB16_SMF
|
||||
|
||||
switch (address)
|
||||
{
|
||||
bx_pc_system.isa_bus_delay();
|
||||
|
||||
switch (address) {
|
||||
// 2x0: FM Music Status Port
|
||||
// 2x8 and 388 are aliases
|
||||
case BX_SB16_IO + 0x00:
|
||||
@ -3488,8 +3489,9 @@ void bx_sb16_c::write(Bit32u address, Bit32u value, unsigned io_len)
|
||||
UNUSED(this_ptr);
|
||||
#endif // !BX_USE_SB16_SMF
|
||||
|
||||
switch (address)
|
||||
{
|
||||
bx_pc_system.isa_bus_delay();
|
||||
|
||||
switch (address) {
|
||||
// 2x0: FM Music Register Port
|
||||
// 2x8 and 388 are aliases
|
||||
case BX_SB16_IO + 0x00:
|
||||
|
@ -582,3 +582,11 @@ void bx_pc_system_c::setTimerParam(unsigned timerIndex, Bit32u param)
|
||||
#endif
|
||||
timer[timerIndex].param = param;
|
||||
}
|
||||
|
||||
void bx_pc_system_c::isa_bus_delay(void)
|
||||
{
|
||||
// Emulate 8 MHz ISA bus speed
|
||||
if (m_ips > 4.0) {
|
||||
tickn((Bit32u)(m_ips * 2.0));
|
||||
}
|
||||
}
|
||||
|
@ -140,6 +140,7 @@ public:
|
||||
#if BX_ENABLE_STATISTICS
|
||||
static void dumpStatsTimer(void* this_ptr);
|
||||
#endif
|
||||
void isa_bus_delay(void);
|
||||
|
||||
// ===========================
|
||||
// Non-timer oriented features
|
||||
|
Loading…
Reference in New Issue
Block a user