ZXHawk: Better detect maskable interrupt used as a tape trap

This commit is contained in:
Asnivor 2018-03-21 16:48:14 +00:00
parent 0ae1910259
commit 76904df015
3 changed files with 22 additions and 2 deletions

View File

@ -193,6 +193,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
if (_currentDataBlockIndex >= _dataBlocks.Count)
{
// end of tape reached. Rewind to beginning
AutoStopTape();
RTZ();
return;
}
@ -736,6 +737,8 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
_machine.Spectrum.OSD_TapePlayingAuto();
}
public int MaskableInterruptCount = 0;
private void MonitorFrame()
{
if (_tapeIsPlaying && _machine.Spectrum.Settings.AutoLoadTape)
@ -770,7 +773,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
AutoStopTape();
_lastCycle = _cpu.TotalExecutedCycles;
MonitorReset();
//MonitorReset();
}
}
}
@ -807,6 +810,11 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
result &= ~TAPE_BIT;
}
if (!TapeIsPlaying)
{
MonitorRead();
}
MonitorRead();
/*

View File

@ -207,8 +207,18 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
}
// THE 'MASKABLE INTERRUPT' ROUTINE
// This is sometimes used when the tape is to be stopped
//
if (addr == 56)
{
TapeDevice.MaskableInterruptCount++;
if (TapeDevice.MaskableInterruptCount > 20)
{
TapeDevice.MaskableInterruptCount = 0;
TapeDevice.AutoStopTape();
}
//TapeDevice?.AutoStopTape();
return;
}

View File

@ -48,7 +48,9 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
switch (divisor)
{
case 0: return ROM0[index];
case 0:
TestForTapeTraps(addr % 0x4000);
return ROM0[index];
case 1: return RAM0[index];
case 2: return RAM1[index];
case 3: return RAM2[index];