2017-11-28 19:28:22 +00:00
|
|
|
|
using BizHawk.Common;
|
|
|
|
|
using System;
|
2017-11-24 18:43:04 +00:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public class RomData
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// ROM Contents
|
|
|
|
|
/// </summary>
|
2017-11-28 19:28:22 +00:00
|
|
|
|
public byte[] RomBytes
|
|
|
|
|
{
|
|
|
|
|
get { return _romBytes; }
|
|
|
|
|
set { _romBytes = value; }
|
|
|
|
|
}
|
|
|
|
|
|
2017-11-24 18:43:04 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Useful ROM addresses that are needed during tape operations
|
|
|
|
|
/// </summary>
|
2017-11-28 19:28:22 +00:00
|
|
|
|
public ushort SaveBytesRoutineAddress
|
|
|
|
|
{
|
|
|
|
|
get { return _saveBytesRoutineAddress; }
|
|
|
|
|
set { _saveBytesRoutineAddress = value; }
|
|
|
|
|
}
|
|
|
|
|
public ushort LoadBytesRoutineAddress
|
|
|
|
|
{
|
|
|
|
|
get { return _loadBytesRoutineAddress; }
|
|
|
|
|
set { _loadBytesRoutineAddress = value; }
|
|
|
|
|
}
|
|
|
|
|
public ushort SaveBytesResumeAddress
|
|
|
|
|
{
|
|
|
|
|
get { return _saveBytesResumeAddress; }
|
|
|
|
|
set { _saveBytesResumeAddress = value; }
|
|
|
|
|
}
|
|
|
|
|
public ushort LoadBytesResumeAddress
|
|
|
|
|
{
|
|
|
|
|
get { return _loadBytesResumeAddress; }
|
|
|
|
|
set { _loadBytesResumeAddress = value; }
|
|
|
|
|
}
|
|
|
|
|
public ushort LoadBytesInvalidHeaderAddress
|
|
|
|
|
{
|
|
|
|
|
get { return _loadBytesInvalidHeaderAddress; }
|
|
|
|
|
set { _loadBytesInvalidHeaderAddress = value; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private byte[] _romBytes;
|
|
|
|
|
private ushort _saveBytesRoutineAddress;
|
|
|
|
|
private ushort _loadBytesRoutineAddress;
|
|
|
|
|
private ushort _saveBytesResumeAddress;
|
|
|
|
|
private ushort _loadBytesResumeAddress;
|
|
|
|
|
private ushort _loadBytesInvalidHeaderAddress;
|
|
|
|
|
|
2017-11-24 18:43:04 +00:00
|
|
|
|
|
|
|
|
|
public static RomData InitROM(MachineType machineType, byte[] rom)
|
|
|
|
|
{
|
|
|
|
|
RomData RD = new RomData();
|
|
|
|
|
RD.RomBytes = new byte[rom.Length];
|
|
|
|
|
RD.RomBytes = rom;
|
|
|
|
|
|
|
|
|
|
switch (machineType)
|
|
|
|
|
{
|
|
|
|
|
case MachineType.ZXSpectrum48:
|
|
|
|
|
RD.SaveBytesRoutineAddress = 0x04C2;
|
|
|
|
|
RD.SaveBytesResumeAddress = 0x0000;
|
2017-11-28 19:28:22 +00:00
|
|
|
|
RD.LoadBytesRoutineAddress = 0x0808; //0x0556; //0x056C;
|
2017-11-24 18:43:04 +00:00
|
|
|
|
RD.LoadBytesResumeAddress = 0x05E2;
|
|
|
|
|
RD.LoadBytesInvalidHeaderAddress = 0x05B6;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return RD;
|
|
|
|
|
}
|
|
|
|
|
|
2017-11-28 19:28:22 +00:00
|
|
|
|
public void SyncState(Serializer ser)
|
|
|
|
|
{
|
|
|
|
|
ser.BeginSection("RomData");
|
|
|
|
|
ser.Sync("RomBytes", ref _romBytes, false);
|
|
|
|
|
ser.Sync("_saveBytesRoutineAddress", ref _saveBytesRoutineAddress);
|
|
|
|
|
ser.Sync("_loadBytesRoutineAddress", ref _loadBytesRoutineAddress);
|
|
|
|
|
ser.Sync("_saveBytesResumeAddress", ref _saveBytesResumeAddress);
|
|
|
|
|
ser.Sync("_loadBytesResumeAddress", ref _loadBytesResumeAddress);
|
|
|
|
|
ser.Sync("_loadBytesInvalidHeaderAddress", ref _loadBytesInvalidHeaderAddress);
|
|
|
|
|
ser.EndSection();
|
|
|
|
|
}
|
2017-11-24 18:43:04 +00:00
|
|
|
|
}
|
|
|
|
|
}
|