Finally fixed tape trap auto loading/stopping routines

This commit is contained in:
Asnivor 2018-03-13 20:31:13 +00:00
parent 5a2b0ae6a6
commit d23dc0a296
8 changed files with 89 additions and 5 deletions

View File

@ -607,11 +607,30 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
_monitorLastPC = _cpu.RegPC;
}
public void AutoStopTape()
{
if (!_tapeIsPlaying)
return;
Stop();
_machine.Spectrum.OSD_TapeStoppedAuto();
}
public void AutoStartTape()
{
if (_tapeIsPlaying)
return;
Play();
_machine.Spectrum.OSD_TapePlayingAuto();
}
private void MonitorFrame()
{
/*
if (_tapeIsPlaying && _machine.Spectrum.Settings.AutoLoadTape)
{
_monitorTimeOut--;
if (_monitorTimeOut < 0)
@ -620,6 +639,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
//_machine.Spectrum.OSD_TapeStoppedAuto();
}
}
*/
}
#endregion

View File

@ -176,6 +176,39 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
return false;
}
public virtual void TestForTapeTraps(int addr)
{
if (!TapeDevice.TapeIsPlaying)
{
if (addr == 8)
{
TapeDevice?.AutoStopTape();
return;
}
if (addr == 4223)
{
TapeDevice?.AutoStopTape();
return;
}
if (addr == 83)
{
TapeDevice?.AutoStopTape();
return;
}
}
else
{
if (addr == 1366)
{
TapeDevice?.AutoStartTape();
return;
}
}
}
#endregion
}
}

View File

@ -54,6 +54,8 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
// ROM 0x000
case 0:
TestForTapeTraps(addr % 0x4000);
if (ROMPaged == 0)
result = ROM0[addr % 0x4000];
else

View File

@ -137,9 +137,11 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
case 0:
result = ROM0[addr % 0x4000];
TestForTapeTraps(addr % 0x4000);
break;
case 1:
result = ROM1[addr % 0x4000];
TestForTapeTraps(addr % 0x4000);
break;
case 2:
result = ROM2[addr % 0x4000];

View File

@ -45,7 +45,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
InputRead = true;
// tape loading monitor cycle
TapeDevice.MonitorRead();
//TapeDevice.MonitorRead();
// process tape INs
TapeDevice.ReadPort(port, ref result);

View File

@ -137,9 +137,11 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
case 0:
result = ROM0[addr % 0x4000];
TestForTapeTraps(addr % 0x4000);
break;
case 1:
result = ROM1[addr % 0x4000];
TestForTapeTraps(addr % 0x4000);
break;
case 2:
result = ROM2[addr % 0x4000];

View File

@ -57,7 +57,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];
default:
// memory does not exist

View File

@ -15,8 +15,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
"Asnivor",
isPorted: false,
isReleased: false)]
[ServiceNotApplicable(typeof(IDriveLight))]
public partial class ZXSpectrum : IRegionable
public partial class ZXSpectrum : IRegionable, IDriveLight
{
public ZXSpectrum(CoreComm comm, IEnumerable<byte[]> files, List<GameInfo> game, object settings, object syncSettings)
{
@ -238,6 +237,30 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
#endregion
#region IDriveLight
public bool DriveLightEnabled
{
get
{
return true;
}
}
public bool DriveLightOn
{
get
{
if (_machine != null &&
_machine.TapeDevice != null &&
_machine.TapeDevice.TapeIsPlaying)
return true;
return false;
}
}
#endregion
}
}