2016-03-01 19:52:47 +00:00
|
|
|
|
using BizHawk.Common;
|
|
|
|
|
using BizHawk.Emulation.Cores.Computers.Commodore64.Media;
|
|
|
|
|
|
|
|
|
|
namespace BizHawk.Emulation.Cores.Computers.Commodore64.Cassette
|
|
|
|
|
{
|
2017-04-24 13:35:05 +00:00
|
|
|
|
public class TapeDrive : CassettePortDevice
|
|
|
|
|
{
|
|
|
|
|
private Tape _tape;
|
|
|
|
|
|
|
|
|
|
public override void ExecutePhase2()
|
|
|
|
|
{
|
2017-05-28 13:52:16 +00:00
|
|
|
|
if (_tape != null && !ReadMotor())
|
|
|
|
|
{
|
|
|
|
|
_tape.ExecuteCycle();
|
|
|
|
|
}
|
2017-04-24 13:35:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void HardReset()
|
|
|
|
|
{
|
2017-05-30 17:09:46 +00:00
|
|
|
|
_tape?.Rewind();
|
2017-04-24 13:35:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override bool ReadDataInputBuffer()
|
|
|
|
|
{
|
|
|
|
|
return _tape == null || _tape.Read();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override bool ReadSenseBuffer()
|
|
|
|
|
{
|
|
|
|
|
return _tape == null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void SyncState(Serializer ser)
|
|
|
|
|
{
|
2017-05-13 15:20:44 +00:00
|
|
|
|
_tape.SyncState(ser);
|
2017-04-24 13:35:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Insert(Tape tape)
|
|
|
|
|
{
|
|
|
|
|
_tape = tape;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void RemoveMedia()
|
|
|
|
|
{
|
|
|
|
|
_tape = null;
|
|
|
|
|
}
|
2017-05-28 13:52:16 +00:00
|
|
|
|
|
|
|
|
|
// Exposed for memory domains, should not be used for actual emulation implementation
|
|
|
|
|
public override byte[] TapeDataDomain => _tape.TapeDataDomain;
|
2017-04-24 13:35:05 +00:00
|
|
|
|
}
|
2016-03-01 19:52:47 +00:00
|
|
|
|
}
|