Commodore64: Removed a lot of unnecessary function chains and converted unsigned types to int.
This commit is contained in:
parent
18582d7c4f
commit
5c37b64eec
|
@ -99,7 +99,6 @@
|
|||
<Compile Include="Computers\Commodore64\Disk\VIC1541.cs" />
|
||||
<Compile Include="Computers\Commodore64\Disk\VIC1541.PLA.cs" />
|
||||
<Compile Include="Computers\Commodore64\Media\PRG.cs" />
|
||||
<Compile Include="Computers\Commodore64\Memory.cs" />
|
||||
<Compile Include="Computers\Commodore64\Cartridge\Cart.cs" />
|
||||
<Compile Include="Computers\Commodore64\MOS\CartridgePort.cs" />
|
||||
<Compile Include="Computers\Commodore64\MOS\CassettePort.cs" />
|
||||
|
|
|
@ -106,7 +106,7 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
|||
|
||||
static public class C64Util
|
||||
{
|
||||
static public string ToBinary(uint n, uint charsmin)
|
||||
static public string ToBinary(int n, int charsmin)
|
||||
{
|
||||
string result = "";
|
||||
|
||||
|
@ -121,13 +121,13 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
|||
return result;
|
||||
}
|
||||
|
||||
static public string ToHex(uint n, uint charsmin)
|
||||
static public string ToHex(int n, int charsmin)
|
||||
{
|
||||
string result = "";
|
||||
|
||||
while (n > 0 || charsmin > 0)
|
||||
{
|
||||
result = "0123456789ABCDEF".Substring((int)(n & 0xF), 1) + result;
|
||||
result = "0123456789ABCDEF".Substring((n & 0xF), 1) + result;
|
||||
n >>= 4;
|
||||
if (charsmin > 0)
|
||||
charsmin--;
|
||||
|
|
|
@ -61,9 +61,9 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
|||
byte joyA = 0xFF;
|
||||
byte joyB = 0xFF;
|
||||
|
||||
for (uint i = 0; i < 8; i++)
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
for (uint j = 0; j < 8; j++)
|
||||
for (int j = 0; j < 8; j++)
|
||||
{
|
||||
if (keyboardPressed[i, j])
|
||||
{
|
||||
|
@ -76,7 +76,7 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
|||
}
|
||||
}
|
||||
|
||||
for (uint i = 0; i < 5; i++)
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
if (joystickPressed[1, i])
|
||||
joyA &= inputBitMask[i];
|
||||
|
@ -89,6 +89,9 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
|||
|
||||
cia0InputLatchA = resultA;
|
||||
cia0InputLatchB = resultB;
|
||||
|
||||
// this joystick has special rules.
|
||||
cia0.PortAMask = joyA;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
|
||||
namespace BizHawk.Emulation.Computers.Commodore64
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains the onboard chipset and glue.
|
||||
/// </summary>
|
||||
public partial class Motherboard
|
||||
{
|
||||
// chips
|
||||
|
@ -25,9 +28,11 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
|||
public UserPort userPort;
|
||||
|
||||
// state
|
||||
public ushort address;
|
||||
public int address;
|
||||
public byte bus;
|
||||
public bool inputRead;
|
||||
public bool irq;
|
||||
public bool nmi;
|
||||
|
||||
public Motherboard(Region initRegion)
|
||||
{
|
||||
|
@ -92,25 +97,32 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
|||
|
||||
public void Init()
|
||||
{
|
||||
cassPort.ReadDataOutput = CassPort_DeviceReadLevel;
|
||||
cassPort.ReadMotor = CassPort_DeviceReadMotor;
|
||||
cartPort.ReadIRQ = Glue_ReadIRQ;
|
||||
cartPort.ReadNMI = cia1.ReadIRQBuffer;
|
||||
|
||||
cia0.ReadFlag = Cia0_ReadFlag;
|
||||
cassPort.ReadDataOutput = CassPort_ReadDataOutput;
|
||||
cassPort.ReadMotor = CassPort_ReadMotor;
|
||||
|
||||
cia0.ReadCNT = Cia0_ReadCnt;
|
||||
cia0.ReadFlag = cassPort.ReadDataInputBuffer;
|
||||
cia0.ReadPortA = Cia0_ReadPortA;
|
||||
cia0.ReadPortB = Cia0_ReadPortB;
|
||||
cia0.ReadSP = Cia0_ReadSP;
|
||||
|
||||
cia1.ReadFlag = Cia1_ReadFlag;
|
||||
cia1.ReadCNT = Cia1_ReadCnt;
|
||||
cia1.ReadFlag = userPort.ReadFlag2;
|
||||
cia1.ReadPortA = Cia1_ReadPortA;
|
||||
cia1.ReadPortB = Cia1_ReadPortB;
|
||||
cia1.ReadPortB = userPort.ReadData;
|
||||
cia1.ReadSP = Cia1_ReadSP;
|
||||
|
||||
cpu.PeekMemory = pla.Peek;
|
||||
cpu.PokeMemory = pla.Poke;
|
||||
cpu.ReadAEC = vic.ReadAEC;
|
||||
cpu.ReadIRQ = Cpu_ReadIRQ;
|
||||
cpu.ReadNMI = cia1.ReadIRQ;
|
||||
cpu.ReadAEC = vic.ReadAECBuffer;
|
||||
cpu.ReadIRQ = Glue_ReadIRQ;
|
||||
cpu.ReadNMI = cia1.ReadIRQBuffer;
|
||||
cpu.ReadPort = Cpu_ReadPort;
|
||||
cpu.ReadRDY = vic.ReadBA;
|
||||
cpu.ReadMemory = pla.Read;
|
||||
cpu.ReadRDY = vic.ReadBABuffer;
|
||||
cpu.ReadMemory = pla.Read;
|
||||
cpu.WriteMemory = pla.Write;
|
||||
|
||||
pla.PeekBasicRom = basicRom.Peek;
|
||||
|
@ -136,8 +148,8 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
|||
pla.PokeMemory = ram.Poke;
|
||||
pla.PokeSid = sid.Poke;
|
||||
pla.PokeVic = vic.Poke;
|
||||
pla.ReadAEC = vic.ReadAEC;
|
||||
pla.ReadBA = vic.ReadBA;
|
||||
pla.ReadAEC = vic.ReadAECBuffer;
|
||||
pla.ReadBA = vic.ReadBABuffer;
|
||||
pla.ReadBasicRom = Pla_ReadBasicRom;
|
||||
pla.ReadCartridgeHi = Pla_ReadCartridgeHi;
|
||||
pla.ReadCartridgeLo = Pla_ReadCartridgeLo;
|
||||
|
@ -167,21 +179,15 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
|||
pla.WriteSid = Pla_WriteSid;
|
||||
pla.WriteVic = Pla_WriteVic;
|
||||
|
||||
// note: c64 serport lines are inverted
|
||||
serPort.DeviceReadAtn = SerPort_DeviceReadAtn;
|
||||
serPort.DeviceReadClock = SerPort_DeviceReadClock;
|
||||
serPort.DeviceReadData = SerPort_DeviceReadData;
|
||||
serPort.DeviceReadReset = SerPort_DeviceReadReset;
|
||||
serPort.DeviceWriteAtn = SerPort_DeviceWriteAtn;
|
||||
serPort.DeviceWriteClock = SerPort_DeviceWriteClock;
|
||||
serPort.DeviceWriteData = SerPort_DeviceWriteData;
|
||||
serPort.DeviceWriteSrq = SerPort_DeviceWriteSrq;
|
||||
serPort.ReadAtnOut = SerPort_ReadAtnOut;
|
||||
serPort.ReadClockOut = SerPort_ReadClockOut;
|
||||
serPort.ReadDataOut = SerPort_ReadDataOut;
|
||||
|
||||
sid.ReadPotX = Sid_ReadPotX;
|
||||
sid.ReadPotY = Sid_ReadPotY;
|
||||
|
||||
vic.ReadMemory = Vic_ReadMemory;
|
||||
vic.ReadColorRam = Vic_ReadColorRam;
|
||||
vic.ReadColorRam = colorRam.Read;
|
||||
}
|
||||
|
||||
public void SyncState(Serializer ser)
|
||||
|
|
|
@ -9,19 +9,21 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
|||
{
|
||||
public partial class Motherboard
|
||||
{
|
||||
bool CassPort_DeviceReadLevel()
|
||||
|
||||
|
||||
bool CassPort_ReadDataOutput()
|
||||
{
|
||||
return (cpu.PortData & 0x08) != 0;
|
||||
}
|
||||
|
||||
bool CassPort_DeviceReadMotor()
|
||||
bool CassPort_ReadMotor()
|
||||
{
|
||||
return (cpu.PortData & 0x20) != 0;
|
||||
}
|
||||
|
||||
bool Cia0_ReadFlag()
|
||||
bool Cia0_ReadCnt()
|
||||
{
|
||||
return cassPort.DataInput;
|
||||
return (userPort.ReadCounter1Buffer() && cia0.ReadCNTBuffer());
|
||||
}
|
||||
|
||||
byte Cia0_ReadPortA()
|
||||
|
@ -36,55 +38,60 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
|||
return cia0InputLatchB;
|
||||
}
|
||||
|
||||
bool Cia1_ReadFlag()
|
||||
bool Cia0_ReadSP()
|
||||
{
|
||||
return true;
|
||||
return (userPort.ReadSerial1Buffer() && cia0.ReadSPBuffer());
|
||||
}
|
||||
|
||||
bool Cia1_ReadCnt()
|
||||
{
|
||||
return (userPort.ReadCounter2Buffer() && cia1.ReadCNTBuffer());
|
||||
}
|
||||
|
||||
byte Cia1_ReadPortA()
|
||||
{
|
||||
// the low bits are actually the VIC memory address.
|
||||
return 0x3F;
|
||||
byte result = 0xFF;
|
||||
if (serPort.WriteDataIn())
|
||||
result &= 0x7F;
|
||||
if (serPort.WriteClockIn())
|
||||
result &= 0xBF;
|
||||
return result;
|
||||
}
|
||||
|
||||
byte Cia1_ReadPortB()
|
||||
bool Cia1_ReadSP()
|
||||
{
|
||||
return 0xFF;
|
||||
}
|
||||
|
||||
bool Cpu_ReadCassetteButton()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Cpu_ReadIRQ()
|
||||
{
|
||||
return cia0.IRQ & vic.IRQ & cartPort.IRQ;
|
||||
return (userPort.ReadSerial2Buffer() && cia1.ReadSPBuffer());
|
||||
}
|
||||
|
||||
byte Cpu_ReadPort()
|
||||
{
|
||||
byte data = 0x1F;
|
||||
if (!cassPort.Sense)
|
||||
if (!cassPort.ReadSenseBuffer())
|
||||
data &= 0xEF;
|
||||
return data;
|
||||
}
|
||||
|
||||
byte Pla_ReadBasicRom(ushort addr)
|
||||
bool Glue_ReadIRQ()
|
||||
{
|
||||
return cia0.ReadIRQBuffer() & vic.ReadIRQBuffer() & cartPort.ReadIRQBuffer();
|
||||
}
|
||||
|
||||
byte Pla_ReadBasicRom(int addr)
|
||||
{
|
||||
address = addr;
|
||||
bus = basicRom.Read(addr);
|
||||
return bus;
|
||||
}
|
||||
|
||||
byte Pla_ReadCartridgeHi(ushort addr)
|
||||
byte Pla_ReadCartridgeHi(int addr)
|
||||
{
|
||||
address = addr;
|
||||
bus = cartPort.ReadHiRom(addr);
|
||||
return bus;
|
||||
}
|
||||
|
||||
byte Pla_ReadCartridgeLo(ushort addr)
|
||||
byte Pla_ReadCartridgeLo(int addr)
|
||||
{
|
||||
address = addr;
|
||||
bus = cartPort.ReadLoRom(addr);
|
||||
|
@ -96,14 +103,14 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
|||
return (cpu.PortData & 0x04) != 0;
|
||||
}
|
||||
|
||||
byte Pla_ReadCharRom(ushort addr)
|
||||
byte Pla_ReadCharRom(int addr)
|
||||
{
|
||||
address = addr;
|
||||
bus = charRom.Read(addr);
|
||||
return bus;
|
||||
}
|
||||
|
||||
byte Pla_ReadCia0(ushort addr)
|
||||
byte Pla_ReadCia0(int addr)
|
||||
{
|
||||
address = addr;
|
||||
bus = cia0.Read(addr);
|
||||
|
@ -112,14 +119,14 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
|||
return bus;
|
||||
}
|
||||
|
||||
byte Pla_ReadCia1(ushort addr)
|
||||
byte Pla_ReadCia1(int addr)
|
||||
{
|
||||
address = addr;
|
||||
bus = cia1.Read(addr);
|
||||
return bus;
|
||||
}
|
||||
|
||||
byte Pla_ReadColorRam(ushort addr)
|
||||
byte Pla_ReadColorRam(int addr)
|
||||
{
|
||||
address = addr;
|
||||
bus &= 0xF0;
|
||||
|
@ -127,14 +134,14 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
|||
return bus;
|
||||
}
|
||||
|
||||
byte Pla_ReadExpansionHi(ushort addr)
|
||||
byte Pla_ReadExpansionHi(int addr)
|
||||
{
|
||||
address = addr;
|
||||
bus = cartPort.ReadHiExp(addr);
|
||||
return bus;
|
||||
}
|
||||
|
||||
byte Pla_ReadExpansionLo(ushort addr)
|
||||
byte Pla_ReadExpansionLo(int addr)
|
||||
{
|
||||
address = addr;
|
||||
bus = cartPort.ReadLoExp(addr);
|
||||
|
@ -146,7 +153,7 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
|||
return (cpu.PortData & 0x02) != 0;
|
||||
}
|
||||
|
||||
byte Pla_ReadKernalRom(ushort addr)
|
||||
byte Pla_ReadKernalRom(int addr)
|
||||
{
|
||||
address = addr;
|
||||
bus = kernalRom.Read(addr);
|
||||
|
@ -158,139 +165,112 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
|||
return (cpu.PortData & 0x01) != 0;
|
||||
}
|
||||
|
||||
byte Pla_ReadMemory(ushort addr)
|
||||
byte Pla_ReadMemory(int addr)
|
||||
{
|
||||
address = addr;
|
||||
bus = ram.Read(addr);
|
||||
return bus;
|
||||
}
|
||||
|
||||
byte Pla_ReadSid(ushort addr)
|
||||
byte Pla_ReadSid(int addr)
|
||||
{
|
||||
address = addr;
|
||||
bus = sid.Read(addr);
|
||||
return bus;
|
||||
}
|
||||
|
||||
byte Pla_ReadVic(ushort addr)
|
||||
byte Pla_ReadVic(int addr)
|
||||
{
|
||||
address = addr;
|
||||
bus = vic.Read(addr);
|
||||
return bus;
|
||||
}
|
||||
|
||||
void Pla_WriteCartridgeHi(ushort addr, byte val)
|
||||
void Pla_WriteCartridgeHi(int addr, byte val)
|
||||
{
|
||||
address = addr;
|
||||
bus = val;
|
||||
cartPort.WriteHiRom(addr, val);
|
||||
}
|
||||
|
||||
void Pla_WriteCartridgeLo(ushort addr, byte val)
|
||||
void Pla_WriteCartridgeLo(int addr, byte val)
|
||||
{
|
||||
address = addr;
|
||||
bus = val;
|
||||
cartPort.WriteLoRom(addr, val);
|
||||
}
|
||||
|
||||
void Pla_WriteCia0(ushort addr, byte val)
|
||||
void Pla_WriteCia0(int addr, byte val)
|
||||
{
|
||||
address = addr;
|
||||
bus = val;
|
||||
cia0.Write(addr, val);
|
||||
}
|
||||
|
||||
void Pla_WriteCia1(ushort addr, byte val)
|
||||
void Pla_WriteCia1(int addr, byte val)
|
||||
{
|
||||
address = addr;
|
||||
bus = val;
|
||||
cia1.Write(addr, val);
|
||||
}
|
||||
|
||||
void Pla_WriteColorRam(ushort addr, byte val)
|
||||
void Pla_WriteColorRam(int addr, byte val)
|
||||
{
|
||||
address = addr;
|
||||
bus = val;
|
||||
colorRam.Write(addr, val);
|
||||
}
|
||||
|
||||
void Pla_WriteExpansionHi(ushort addr, byte val)
|
||||
void Pla_WriteExpansionHi(int addr, byte val)
|
||||
{
|
||||
address = addr;
|
||||
bus = val;
|
||||
cartPort.WriteHiExp(addr, val);
|
||||
}
|
||||
|
||||
void Pla_WriteExpansionLo(ushort addr, byte val)
|
||||
void Pla_WriteExpansionLo(int addr, byte val)
|
||||
{
|
||||
address = addr;
|
||||
bus = val;
|
||||
cartPort.WriteLoExp(addr, val);
|
||||
}
|
||||
|
||||
void Pla_WriteMemory(ushort addr, byte val)
|
||||
void Pla_WriteMemory(int addr, byte val)
|
||||
{
|
||||
address = addr;
|
||||
bus = val;
|
||||
ram.Write(addr, val);
|
||||
}
|
||||
|
||||
void Pla_WriteSid(ushort addr, byte val)
|
||||
void Pla_WriteSid(int addr, byte val)
|
||||
{
|
||||
address = addr;
|
||||
bus = val;
|
||||
sid.Write(addr, val);
|
||||
}
|
||||
|
||||
void Pla_WriteVic(ushort addr, byte val)
|
||||
void Pla_WriteVic(int addr, byte val)
|
||||
{
|
||||
address = addr;
|
||||
bus = val;
|
||||
vic.Write(addr, val);
|
||||
}
|
||||
|
||||
bool SerPort_DeviceReadAtn()
|
||||
bool SerPort_ReadAtnOut()
|
||||
{
|
||||
return (cia1.PortBData & 0x08) == 0;
|
||||
}
|
||||
|
||||
bool SerPort_DeviceReadClock()
|
||||
bool SerPort_ReadClockOut()
|
||||
{
|
||||
return (cia1.PortAData & 0x10) == 0;
|
||||
}
|
||||
|
||||
bool SerPort_DeviceReadData()
|
||||
bool SerPort_ReadDataOut()
|
||||
{
|
||||
return (cia1.PortAData & 0x20) == 0;
|
||||
}
|
||||
|
||||
bool SerPort_DeviceReadReset()
|
||||
{
|
||||
// this triggers hard reset on ext device when low
|
||||
return true;
|
||||
}
|
||||
|
||||
void SerPort_DeviceWriteAtn(bool val)
|
||||
{
|
||||
// currently not wired
|
||||
}
|
||||
|
||||
void SerPort_DeviceWriteClock(bool val)
|
||||
{
|
||||
//cia1DataA = Port.ExternalWrite(cia1DataA, (byte)((cia1DataA & 0xBF) | (val ? 0x00 : 0x40)), cia1DirA);
|
||||
}
|
||||
|
||||
void SerPort_DeviceWriteData(bool val)
|
||||
{
|
||||
//cia1DataA = Port.ExternalWrite(cia1DataA, (byte)((cia1DataA & 0x7F) | (val ? 0x00 : 0x80)), cia1DirA);
|
||||
}
|
||||
|
||||
void SerPort_DeviceWriteSrq(bool val)
|
||||
{
|
||||
//cia0FlagSerial = val;
|
||||
//cia0.FLAG = cia0FlagCassette & cia0FlagSerial;
|
||||
}
|
||||
|
||||
byte Sid_ReadPotX()
|
||||
{
|
||||
return 0;
|
||||
|
@ -301,7 +281,7 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
|||
return 0;
|
||||
}
|
||||
|
||||
byte Vic_ReadMemory(ushort addr)
|
||||
byte Vic_ReadMemory(int addr)
|
||||
{
|
||||
switch (cia1.PortAData & 0x3)
|
||||
{
|
||||
|
@ -323,7 +303,7 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
|||
return bus;
|
||||
}
|
||||
|
||||
byte Vic_ReadColorRam(ushort addr)
|
||||
byte Vic_ReadColorRam(int addr)
|
||||
{
|
||||
address = addr;
|
||||
bus &= 0xF0;
|
||||
|
|
|
@ -146,12 +146,12 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
|||
{
|
||||
// chips must be initialized before this code runs!
|
||||
var domains = new List<MemoryDomain>(1);
|
||||
domains.Add(new MemoryDomain("System Bus", 0x10000, Endian.Little, new Func<int, byte>(board.cpu.Peek), new Action<int, byte>(board.cpu.Poke)));
|
||||
domains.Add(new MemoryDomain("RAM", 0x10000, Endian.Little, new Func<int, byte>(board.ram.Peek), new Action<int, byte>(board.ram.Poke)));
|
||||
domains.Add(new MemoryDomain("CIA0", 0x10, Endian.Little, new Func<int, byte>(board.cia0.Peek), new Action<int, byte>(board.cia0.Poke)));
|
||||
domains.Add(new MemoryDomain("CIA1", 0x10, Endian.Little, new Func<int, byte>(board.cia1.Peek), new Action<int, byte>(board.cia1.Poke)));
|
||||
domains.Add(new MemoryDomain("VIC", 0x40, Endian.Little, new Func<int, byte>(board.vic.Peek), new Action<int, byte>(board.vic.Poke)));
|
||||
domains.Add(new MemoryDomain("SID", 0x20, Endian.Little, new Func<int, byte>(board.sid.Peek), new Action<int, byte>(board.sid.Poke)));
|
||||
domains.Add(new MemoryDomain("System Bus", 0x10000, Endian.Little, board.cpu.Peek, board.cpu.Poke));
|
||||
domains.Add(new MemoryDomain("RAM", 0x10000, Endian.Little, board.ram.Peek, board.ram.Poke));
|
||||
domains.Add(new MemoryDomain("CIA0", 0x10, Endian.Little, board.cia0.Peek, board.cia0.Poke));
|
||||
domains.Add(new MemoryDomain("CIA1", 0x10, Endian.Little, board.cia1.Peek, board.cia1.Poke));
|
||||
domains.Add(new MemoryDomain("VIC", 0x40, Endian.Little, board.vic.Peek, board.vic.Poke));
|
||||
domains.Add(new MemoryDomain("SID", 0x20, Endian.Little, board.sid.Peek, board.sid.Poke));
|
||||
//domains.Add(new MemoryDomain("1541 Bus", 0x10000, Endian.Little, new Func<int, byte>(disk.Peek), new Action<int, byte>(disk.Poke)));
|
||||
//domains.Add(new MemoryDomain("1541 VIA0", 0x10, Endian.Little, new Func<int, byte>(disk.PeekVia0), new Action<int, byte>(disk.PokeVia0)));
|
||||
//domains.Add(new MemoryDomain("1541 VIA1", 0x10, Endian.Little, new Func<int, byte>(disk.PeekVia1), new Action<int, byte>(disk.PokeVia1)));
|
||||
|
|
|
@ -18,14 +18,14 @@ namespace BizHawk.Emulation.Computers.Commodore64.Cartridge
|
|||
|
||||
if (new string(reader.ReadChars(16)) == "C64 CARTRIDGE ")
|
||||
{
|
||||
List<uint> chipAddress = new List<uint>();
|
||||
List<uint> chipBank = new List<uint>();
|
||||
List<int> chipAddress = new List<int>();
|
||||
List<int> chipBank = new List<int>();
|
||||
List<byte[]> chipData = new List<byte[]>();
|
||||
List<uint> chipType = new List<uint>();
|
||||
List<int> chipType = new List<int>();
|
||||
|
||||
uint headerLength = ReadCRTInt(reader);
|
||||
uint version = ReadCRTShort(reader);
|
||||
uint mapper = ReadCRTShort(reader);
|
||||
int headerLength = ReadCRTInt(reader);
|
||||
int version = ReadCRTShort(reader);
|
||||
int mapper = ReadCRTShort(reader);
|
||||
bool exrom = (reader.ReadByte() != 0);
|
||||
bool game = (reader.ReadByte() != 0);
|
||||
|
||||
|
@ -38,7 +38,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.Cartridge
|
|||
// skip extra header bytes
|
||||
if (headerLength > 0x40)
|
||||
{
|
||||
reader.ReadBytes((int)headerLength - 0x40);
|
||||
reader.ReadBytes(headerLength - 0x40);
|
||||
}
|
||||
|
||||
// read chips
|
||||
|
@ -46,15 +46,15 @@ namespace BizHawk.Emulation.Computers.Commodore64.Cartridge
|
|||
{
|
||||
if (new string(reader.ReadChars(4)) == "CHIP")
|
||||
{
|
||||
uint chipLength = ReadCRTInt(reader);
|
||||
int chipLength = ReadCRTInt(reader);
|
||||
chipType.Add(ReadCRTShort(reader));
|
||||
chipBank.Add(ReadCRTShort(reader));
|
||||
chipAddress.Add(ReadCRTShort(reader));
|
||||
uint chipDataLength = ReadCRTShort(reader);
|
||||
chipData.Add(reader.ReadBytes((int)chipDataLength));
|
||||
int chipDataLength = ReadCRTShort(reader);
|
||||
chipData.Add(reader.ReadBytes(chipDataLength));
|
||||
chipLength -= (chipDataLength + 0x10);
|
||||
if (chipLength > 0)
|
||||
reader.ReadBytes((int)chipLength);
|
||||
reader.ReadBytes(chipLength);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -96,21 +96,21 @@ namespace BizHawk.Emulation.Computers.Commodore64.Cartridge
|
|||
return result;
|
||||
}
|
||||
|
||||
static private uint ReadCRTShort(BinaryReader reader)
|
||||
static private int ReadCRTShort(BinaryReader reader)
|
||||
{
|
||||
uint result;
|
||||
result = (uint)reader.ReadByte() << 8;
|
||||
result |= (uint)reader.ReadByte();
|
||||
int result;
|
||||
result = (int)reader.ReadByte() << 8;
|
||||
result |= (int)reader.ReadByte();
|
||||
return result;
|
||||
}
|
||||
|
||||
static private uint ReadCRTInt(BinaryReader reader)
|
||||
static private int ReadCRTInt(BinaryReader reader)
|
||||
{
|
||||
uint result;
|
||||
result = (uint)reader.ReadByte() << 24;
|
||||
result |= (uint)reader.ReadByte() << 16;
|
||||
result |= (uint)reader.ReadByte() << 8;
|
||||
result |= (uint)reader.ReadByte();
|
||||
int result;
|
||||
result = (int)reader.ReadByte() << 24;
|
||||
result |= (int)reader.ReadByte() << 16;
|
||||
result |= (int)reader.ReadByte() << 8;
|
||||
result |= (int)reader.ReadByte();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -206,22 +206,22 @@ namespace BizHawk.Emulation.Computers.Commodore64.Cartridge
|
|||
{
|
||||
}
|
||||
|
||||
public virtual byte Read8000(ushort addr)
|
||||
public virtual byte Read8000(int addr)
|
||||
{
|
||||
return 0xFF;
|
||||
}
|
||||
|
||||
public virtual byte ReadA000(ushort addr)
|
||||
public virtual byte ReadA000(int addr)
|
||||
{
|
||||
return 0xFF;
|
||||
}
|
||||
|
||||
public virtual byte ReadDE00(ushort addr)
|
||||
public virtual byte ReadDE00(int addr)
|
||||
{
|
||||
return 0xFF;
|
||||
}
|
||||
|
||||
public virtual byte ReadDF00(ushort addr)
|
||||
public virtual byte ReadDF00(int addr)
|
||||
{
|
||||
return 0xFF;
|
||||
}
|
||||
|
@ -252,19 +252,19 @@ namespace BizHawk.Emulation.Computers.Commodore64.Cartridge
|
|||
}
|
||||
}
|
||||
|
||||
public virtual void Write8000(ushort addr, byte val)
|
||||
public virtual void Write8000(int addr, byte val)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void WriteA000(ushort addr, byte val)
|
||||
public virtual void WriteA000(int addr, byte val)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void WriteDE00(ushort addr, byte val)
|
||||
public virtual void WriteDE00(int addr, byte val)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void WriteDF00(ushort addr, byte val)
|
||||
public virtual void WriteDF00(int addr, byte val)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,14 +6,14 @@ namespace BizHawk.Emulation.Computers.Commodore64.Cartridge
|
|||
public class Mapper0000 : Cart
|
||||
{
|
||||
private byte[] romA;
|
||||
private uint romAMask;
|
||||
private int romAMask;
|
||||
private byte[] romB;
|
||||
private uint romBMask;
|
||||
private int romBMask;
|
||||
|
||||
// standard cartridge mapper (Commodore)
|
||||
// note that this format also covers Ultimax carts
|
||||
|
||||
public Mapper0000(List<uint> newAddresses, List<uint> newBanks, List<byte[]> newData, bool game, bool exrom)
|
||||
public Mapper0000(List<int> newAddresses, List<int> newBanks, List<byte[]> newData, bool game, bool exrom)
|
||||
{
|
||||
pinGame = game;
|
||||
pinExRom = exrom;
|
||||
|
@ -83,12 +83,12 @@ namespace BizHawk.Emulation.Computers.Commodore64.Cartridge
|
|||
return romB[addr & romBMask];
|
||||
}
|
||||
|
||||
public override byte Read8000(ushort addr)
|
||||
public override byte Read8000(int addr)
|
||||
{
|
||||
return romA[addr & romAMask];
|
||||
}
|
||||
|
||||
public override byte ReadA000(ushort addr)
|
||||
public override byte ReadA000(int addr)
|
||||
{
|
||||
return romB[addr & romBMask];
|
||||
}
|
||||
|
|
|
@ -7,19 +7,19 @@ namespace BizHawk.Emulation.Computers.Commodore64.Cartridge
|
|||
{
|
||||
private byte[][] banksA = new byte[0][]; //8000
|
||||
private byte[][] banksB = new byte[0][]; //A000
|
||||
private uint bankMask;
|
||||
private uint bankNumber;
|
||||
private int bankMask;
|
||||
private int bankNumber;
|
||||
private byte[] currentBankA;
|
||||
private byte[] currentBankB;
|
||||
private byte[] dummyBank;
|
||||
|
||||
public Mapper0005(List<uint> newAddresses, List<uint> newBanks, List<byte[]> newData)
|
||||
public Mapper0005(List<int> newAddresses, List<int> newBanks, List<byte[]> newData)
|
||||
{
|
||||
uint count = (uint)newAddresses.Count;
|
||||
int count = newAddresses.Count;
|
||||
|
||||
// build dummy bank
|
||||
dummyBank = new byte[0x2000];
|
||||
for (uint i = 0; i < 0x2000; i++)
|
||||
for (int i = 0; i < 0x2000; i++)
|
||||
dummyBank[i] = 0xFF; // todo: determine if this is correct
|
||||
|
||||
if (count == 64) //512k
|
||||
|
@ -80,9 +80,9 @@ namespace BizHawk.Emulation.Computers.Commodore64.Cartridge
|
|||
}
|
||||
|
||||
// for safety, initialize all banks to dummy
|
||||
for (uint i = 0; i < banksA.Length; i++)
|
||||
for (int i = 0; i < banksA.Length; i++)
|
||||
banksA[i] = dummyBank;
|
||||
for (uint i = 0; i < banksB.Length; i++)
|
||||
for (int i = 0; i < banksB.Length; i++)
|
||||
banksB[i] = dummyBank;
|
||||
|
||||
// now load in the banks
|
||||
|
@ -101,7 +101,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.Cartridge
|
|||
BankSet(0);
|
||||
}
|
||||
|
||||
private void BankSet(uint index)
|
||||
private void BankSet(int index)
|
||||
{
|
||||
bankNumber = index & bankMask;
|
||||
if (!pinExRom)
|
||||
|
@ -131,17 +131,17 @@ namespace BizHawk.Emulation.Computers.Commodore64.Cartridge
|
|||
BankSet(val);
|
||||
}
|
||||
|
||||
public override byte Read8000(ushort addr)
|
||||
public override byte Read8000(int addr)
|
||||
{
|
||||
return currentBankA[addr];
|
||||
}
|
||||
|
||||
public override byte ReadA000(ushort addr)
|
||||
public override byte ReadA000(int addr)
|
||||
{
|
||||
return currentBankB[addr];
|
||||
}
|
||||
|
||||
public override void WriteDE00(ushort addr, byte val)
|
||||
public override void WriteDE00(int addr, byte val)
|
||||
{
|
||||
if (addr == 0x00)
|
||||
BankSet(val);
|
||||
|
|
|
@ -14,11 +14,11 @@ namespace BizHawk.Emulation.Computers.Commodore64.Cartridge
|
|||
{
|
||||
private byte[] rom = new byte[0x4000];
|
||||
|
||||
public Mapper000B(List<uint> newAddresses, List<uint> newBanks, List<byte[]> newData)
|
||||
public Mapper000B(List<int> newAddresses, List<int> newBanks, List<byte[]> newData)
|
||||
{
|
||||
validCartridge = false;
|
||||
|
||||
for (uint i = 0; i < 0x4000; i++)
|
||||
for (int i = 0; i < 0x4000; i++)
|
||||
rom[i] = 0xFF;
|
||||
|
||||
if (newAddresses[0] == 0x8000)
|
||||
|
@ -38,17 +38,17 @@ namespace BizHawk.Emulation.Computers.Commodore64.Cartridge
|
|||
return rom[addr | 0x2000];
|
||||
}
|
||||
|
||||
public override byte Read8000(ushort addr)
|
||||
public override byte Read8000(int addr)
|
||||
{
|
||||
return rom[addr];
|
||||
}
|
||||
|
||||
public override byte ReadA000(ushort addr)
|
||||
public override byte ReadA000(int addr)
|
||||
{
|
||||
return rom[addr | 0x2000];
|
||||
}
|
||||
|
||||
public override byte ReadDF00(ushort addr)
|
||||
public override byte ReadDF00(int addr)
|
||||
{
|
||||
pinGame = true;
|
||||
return base.ReadDF00(addr);
|
||||
|
|
|
@ -13,21 +13,21 @@ namespace BizHawk.Emulation.Computers.Commodore64.Cartridge
|
|||
public class Mapper000F : Cart
|
||||
{
|
||||
private byte[][] banks = new byte[0][]; //8000
|
||||
private uint bankMask;
|
||||
private uint bankNumber;
|
||||
private int bankMask;
|
||||
private int bankNumber;
|
||||
private byte[] currentBank;
|
||||
private byte[] dummyBank;
|
||||
|
||||
public Mapper000F(List<uint> newAddresses, List<uint> newBanks, List<byte[]> newData)
|
||||
public Mapper000F(List<int> newAddresses, List<int> newBanks, List<byte[]> newData)
|
||||
{
|
||||
uint count = (uint)newAddresses.Count;
|
||||
int count = newAddresses.Count;
|
||||
|
||||
pinGame = true;
|
||||
pinExRom = false;
|
||||
|
||||
// build dummy bank
|
||||
dummyBank = new byte[0x2000];
|
||||
for (uint i = 0; i < 0x2000; i++)
|
||||
for (int i = 0; i < 0x2000; i++)
|
||||
dummyBank[i] = 0xFF; // todo: determine if this is correct
|
||||
|
||||
if (count == 64) //512k
|
||||
|
@ -72,7 +72,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.Cartridge
|
|||
}
|
||||
|
||||
// for safety, initialize all banks to dummy
|
||||
for (uint i = 0; i < banks.Length; i++)
|
||||
for (int i = 0; i < banks.Length; i++)
|
||||
banks[i] = dummyBank;
|
||||
|
||||
// now load in the banks
|
||||
|
@ -87,7 +87,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.Cartridge
|
|||
BankSet(0);
|
||||
}
|
||||
|
||||
protected void BankSet(uint index)
|
||||
protected void BankSet(int index)
|
||||
{
|
||||
bankNumber = index & bankMask;
|
||||
UpdateState();
|
||||
|
@ -100,10 +100,10 @@ namespace BizHawk.Emulation.Computers.Commodore64.Cartridge
|
|||
|
||||
public override void PokeDE00(int addr, byte val)
|
||||
{
|
||||
BankSet((uint)addr);
|
||||
BankSet(addr);
|
||||
}
|
||||
|
||||
public override byte Read8000(ushort addr)
|
||||
public override byte Read8000(int addr)
|
||||
{
|
||||
return currentBank[addr];
|
||||
}
|
||||
|
@ -113,9 +113,9 @@ namespace BizHawk.Emulation.Computers.Commodore64.Cartridge
|
|||
currentBank = banks[bankNumber];
|
||||
}
|
||||
|
||||
public override void WriteDE00(ushort addr, byte val)
|
||||
public override void WriteDE00(int addr, byte val)
|
||||
{
|
||||
BankSet((uint)addr);
|
||||
BankSet(addr);
|
||||
}
|
||||
|
||||
public override void SyncState(Serializer ser)
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.Cartridge
|
|||
|
||||
public class Mapper0011 : Mapper000F
|
||||
{
|
||||
public Mapper0011(List<uint> newAddresses, List<uint> newBanks, List<byte[]> newData)
|
||||
public Mapper0011(List<int> newAddresses, List<int> newBanks, List<byte[]> newData)
|
||||
: base(newAddresses, newBanks, newData)
|
||||
{
|
||||
// required to pass information to base class
|
||||
|
@ -20,13 +20,13 @@ namespace BizHawk.Emulation.Computers.Commodore64.Cartridge
|
|||
// do nothing
|
||||
}
|
||||
|
||||
public override byte ReadDE00(ushort addr)
|
||||
public override byte ReadDE00(int addr)
|
||||
{
|
||||
BankSet((uint)addr);
|
||||
BankSet(addr);
|
||||
return base.ReadDE00(addr);
|
||||
}
|
||||
|
||||
public override void WriteDE00(ushort addr, byte val)
|
||||
public override void WriteDE00(int addr, byte val)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
|
|
@ -8,21 +8,21 @@ namespace BizHawk.Emulation.Computers.Commodore64.Cartridge
|
|||
private byte[] bankMain;
|
||||
private byte[][] bankHigh;
|
||||
private byte[] bankHighSelected;
|
||||
private uint bankIndex;
|
||||
private int bankIndex;
|
||||
private byte[] dummyBank;
|
||||
|
||||
// Zaxxon and Super Zaxxon cartridges
|
||||
// - read to 8xxx selects bank 0 in A000-BFFF
|
||||
// - read to 9xxx selects bank 1 in A000-BFFF
|
||||
|
||||
public Mapper0012(List<uint> newAddresses, List<uint> newBanks, List<byte[]> newData)
|
||||
public Mapper0012(List<int> newAddresses, List<int> newBanks, List<byte[]> newData)
|
||||
{
|
||||
bankMain = new byte[0x2000];
|
||||
bankHigh = new byte[2][];
|
||||
dummyBank = new byte[0x2000];
|
||||
|
||||
// create dummy bank just in case
|
||||
for (uint i = 0; i < 0x2000; i++)
|
||||
for (int i = 0; i < 0x2000; i++)
|
||||
dummyBank[i] = 0xFF;
|
||||
|
||||
bankHigh[0] = dummyBank;
|
||||
|
@ -56,14 +56,14 @@ namespace BizHawk.Emulation.Computers.Commodore64.Cartridge
|
|||
return bankHighSelected[addr];
|
||||
}
|
||||
|
||||
public override byte Read8000(ushort addr)
|
||||
public override byte Read8000(int addr)
|
||||
{
|
||||
bankIndex = (addr & (uint)0x1000) >> 12;
|
||||
bankIndex = (addr & 0x1000) >> 12;
|
||||
bankHighSelected = bankHigh[bankIndex];
|
||||
return bankMain[addr];
|
||||
}
|
||||
|
||||
public override byte ReadA000(ushort addr)
|
||||
public override byte ReadA000(int addr)
|
||||
{
|
||||
return bankHighSelected[addr];
|
||||
}
|
||||
|
|
|
@ -14,15 +14,15 @@ namespace BizHawk.Emulation.Computers.Commodore64.Cartridge
|
|||
public class Mapper0013 : Cart
|
||||
{
|
||||
private byte[][] banks = new byte[0][]; //8000
|
||||
private uint bankMask;
|
||||
private uint bankNumber;
|
||||
private int bankMask;
|
||||
private int bankNumber;
|
||||
private byte[] currentBank;
|
||||
private byte[] dummyBank;
|
||||
private bool romEnable;
|
||||
|
||||
public Mapper0013(List<uint> newAddresses, List<uint> newBanks, List<byte[]> newData)
|
||||
public Mapper0013(List<int> newAddresses, List<int> newBanks, List<byte[]> newData)
|
||||
{
|
||||
uint count = (uint)newAddresses.Count;
|
||||
int count = newAddresses.Count;
|
||||
|
||||
pinGame = true;
|
||||
pinExRom = false;
|
||||
|
@ -30,7 +30,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.Cartridge
|
|||
|
||||
// build dummy bank
|
||||
dummyBank = new byte[0x2000];
|
||||
for (uint i = 0; i < 0x2000; i++)
|
||||
for (int i = 0; i < 0x2000; i++)
|
||||
dummyBank[i] = 0xFF; // todo: determine if this is correct
|
||||
|
||||
if (count == 16) //128k
|
||||
|
@ -55,7 +55,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.Cartridge
|
|||
}
|
||||
|
||||
// for safety, initialize all banks to dummy
|
||||
for (uint i = 0; i < banks.Length; i++)
|
||||
for (int i = 0; i < banks.Length; i++)
|
||||
banks[i] = dummyBank;
|
||||
|
||||
// now load in the banks
|
||||
|
@ -70,7 +70,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.Cartridge
|
|||
BankSet(0);
|
||||
}
|
||||
|
||||
private void BankSet(uint index)
|
||||
private void BankSet(int index)
|
||||
{
|
||||
bankNumber = index & bankMask;
|
||||
romEnable = ((index & 0x80) == 0);
|
||||
|
@ -88,7 +88,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.Cartridge
|
|||
BankSet(val);
|
||||
}
|
||||
|
||||
public override byte Read8000(ushort addr)
|
||||
public override byte Read8000(int addr)
|
||||
{
|
||||
return currentBank[addr];
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.Cartridge
|
|||
}
|
||||
}
|
||||
|
||||
public override void WriteDE00(ushort addr, byte val)
|
||||
public override void WriteDE00(int addr, byte val)
|
||||
{
|
||||
if (addr == 0x00)
|
||||
BankSet(val);
|
||||
|
@ -121,7 +121,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.Cartridge
|
|||
ser.Sync("bankNumber", ref bankNumber);
|
||||
ser.Sync("romEnable", ref romEnable);
|
||||
if (ser.IsReader)
|
||||
BankSet(bankNumber | (uint)(romEnable ? 0x00 : 0x80));
|
||||
BankSet(bankNumber | (romEnable ? 0x00 : 0x80));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,20 +21,20 @@ namespace BizHawk.Emulation.Computers.Commodore64.Cartridge
|
|||
{
|
||||
private byte[][] banksA = new byte[64][]; //8000
|
||||
private byte[][] banksB = new byte[64][]; //A000
|
||||
private uint bankNumber;
|
||||
private int bankNumber;
|
||||
private bool boardLed;
|
||||
private byte[] currentBankA;
|
||||
private byte[] currentBankB;
|
||||
private byte[] dummyBank;
|
||||
private byte[] ram = new byte[256];
|
||||
|
||||
public Mapper0020(List<uint> newAddresses, List<uint> newBanks, List<byte[]> newData)
|
||||
public Mapper0020(List<int> newAddresses, List<int> newBanks, List<byte[]> newData)
|
||||
{
|
||||
uint count = (uint)newAddresses.Count;
|
||||
int count = newAddresses.Count;
|
||||
|
||||
// build dummy bank
|
||||
dummyBank = new byte[0x2000];
|
||||
for (uint i = 0; i < 0x2000; i++)
|
||||
for (int i = 0; i < 0x2000; i++)
|
||||
dummyBank[i] = 0xFF; // todo: determine if this is correct
|
||||
|
||||
// force ultimax mode (the cart SHOULD set this
|
||||
|
@ -43,9 +43,9 @@ namespace BizHawk.Emulation.Computers.Commodore64.Cartridge
|
|||
pinExRom = true;
|
||||
|
||||
// for safety, initialize all banks to dummy
|
||||
for (uint i = 0; i < 64; i++)
|
||||
for (int i = 0; i < 64; i++)
|
||||
banksA[i] = dummyBank;
|
||||
for (uint i = 0; i < 64; i++)
|
||||
for (int i = 0; i < 64; i++)
|
||||
banksB[i] = dummyBank;
|
||||
|
||||
// load in all banks
|
||||
|
@ -65,7 +65,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.Cartridge
|
|||
BankSet(0);
|
||||
}
|
||||
|
||||
private void BankSet(uint index)
|
||||
private void BankSet(int index)
|
||||
{
|
||||
bankNumber = index & 0x3F;
|
||||
UpdateState();
|
||||
|
@ -121,17 +121,17 @@ namespace BizHawk.Emulation.Computers.Commodore64.Cartridge
|
|||
ram[addr] = val;
|
||||
}
|
||||
|
||||
public override byte Read8000(ushort addr)
|
||||
public override byte Read8000(int addr)
|
||||
{
|
||||
return currentBankA[addr];
|
||||
}
|
||||
|
||||
public override byte ReadA000(ushort addr)
|
||||
public override byte ReadA000(int addr)
|
||||
{
|
||||
return currentBankB[addr];
|
||||
}
|
||||
|
||||
public override byte ReadDF00(ushort addr)
|
||||
public override byte ReadDF00(int addr)
|
||||
{
|
||||
return ram[addr];
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.Cartridge
|
|||
currentBankB = banksB[bankNumber];
|
||||
}
|
||||
|
||||
public override void WriteDE00(ushort addr, byte val)
|
||||
public override void WriteDE00(int addr, byte val)
|
||||
{
|
||||
if (addr == 0x00)
|
||||
BankSet(val);
|
||||
|
@ -158,7 +158,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.Cartridge
|
|||
StateSet(val);
|
||||
}
|
||||
|
||||
public override void WriteDF00(ushort addr, byte val)
|
||||
public override void WriteDF00(int addr, byte val)
|
||||
{
|
||||
ram[addr] = val;
|
||||
}
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
using BizHawk.Emulation.Computers.Commodore64.Cartridge;
|
||||
using System;
|
||||
using BizHawk.Emulation.Computers.Commodore64.Cartridge;
|
||||
|
||||
namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
||||
{
|
||||
public class CartridgePort
|
||||
{
|
||||
public Func<bool> ReadIRQ;
|
||||
public Func<bool> ReadNMI;
|
||||
|
||||
private Cart cart;
|
||||
private bool connected;
|
||||
|
||||
|
@ -27,15 +31,15 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
|
||||
public bool ReadExRom() { if (connected) { return cart.ExRom; } else { return true; } }
|
||||
public bool ReadGame() { if (connected) { return cart.Game; } else { return true; } }
|
||||
public byte ReadHiExp(ushort addr) { if (connected) { return cart.ReadDF00((ushort)(addr & 0x00FF)); } else { return 0xFF; } }
|
||||
public byte ReadHiRom(ushort addr) { if (connected) { return cart.ReadA000((ushort)(addr & 0x1FFF)); } else { return 0xFF; } }
|
||||
public byte ReadLoExp(ushort addr) { if (connected) { return cart.ReadDE00((ushort)(addr & 0x00FF)); } else { return 0xFF; } }
|
||||
public byte ReadLoRom(ushort addr) { if (connected) { return cart.Read8000((ushort)(addr & 0x1FFF)); } else { return 0xFF; } }
|
||||
public byte ReadHiExp(int addr) { if (connected) { return cart.ReadDF00((addr & 0x00FF)); } else { return 0xFF; } }
|
||||
public byte ReadHiRom(int addr) { if (connected) { return cart.ReadA000((addr & 0x1FFF)); } else { return 0xFF; } }
|
||||
public byte ReadLoExp(int addr) { if (connected) { return cart.ReadDE00((addr & 0x00FF)); } else { return 0xFF; } }
|
||||
public byte ReadLoRom(int addr) { if (connected) { return cart.Read8000((addr & 0x1FFF)); } else { return 0xFF; } }
|
||||
|
||||
public void WriteHiExp(ushort addr, byte val) { if (connected) { cart.WriteDF00((ushort)(addr & 0x00FF), val); } }
|
||||
public void WriteHiRom(ushort addr, byte val) { if (connected) { cart.WriteA000((ushort)(addr & 0x1FFF), val); } }
|
||||
public void WriteLoExp(ushort addr, byte val) { if (connected) { cart.WriteDE00((ushort)(addr & 0x00FF), val); } }
|
||||
public void WriteLoRom(ushort addr, byte val) { if (connected) { cart.Write8000((ushort)(addr & 0x1FFF), val); } }
|
||||
public void WriteHiExp(int addr, byte val) { if (connected) { cart.WriteDF00((addr & 0x00FF), val); } }
|
||||
public void WriteHiRom(int addr, byte val) { if (connected) { cart.WriteA000((addr & 0x1FFF), val); } }
|
||||
public void WriteLoExp(int addr, byte val) { if (connected) { cart.WriteDE00((addr & 0x00FF), val); } }
|
||||
public void WriteLoRom(int addr, byte val) { if (connected) { cart.Write8000((addr & 0x1FFF), val); } }
|
||||
|
||||
// ------------------------------------------
|
||||
|
||||
|
@ -56,14 +60,6 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
// note: this will not disconnect any attached media
|
||||
}
|
||||
|
||||
public bool IRQ
|
||||
{
|
||||
get
|
||||
{
|
||||
return true; //todo: hook this up to cartridge
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsConnected
|
||||
{
|
||||
get
|
||||
|
@ -72,15 +68,17 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
}
|
||||
}
|
||||
|
||||
public bool NMI
|
||||
{
|
||||
get
|
||||
{
|
||||
return true; //todo: hook this up to cartridge
|
||||
}
|
||||
}
|
||||
public bool ReadIRQBuffer()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void SyncState(Serializer ser)
|
||||
public bool ReadNMIBuffer()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void SyncState(Serializer ser)
|
||||
{
|
||||
ser.Sync("connected", ref connected);
|
||||
if (connected)
|
||||
|
|
|
@ -11,20 +11,14 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
{
|
||||
}
|
||||
|
||||
public bool DataInput
|
||||
public bool ReadDataInputBuffer()
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Sense
|
||||
public bool ReadSenseBuffer()
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,12 +31,12 @@
|
|||
ram[addr & 0x3FF] = (byte)(val & 0xF);
|
||||
}
|
||||
|
||||
public byte Read(ushort addr)
|
||||
public byte Read(int addr)
|
||||
{
|
||||
return (byte)(ram[addr & 0x3FF]);
|
||||
}
|
||||
|
||||
public byte Read(ushort addr, byte bus)
|
||||
public byte Read(int addr, byte bus)
|
||||
{
|
||||
return (byte)(ram[addr & 0x3FF] | (bus & 0xF0));
|
||||
}
|
||||
|
@ -47,7 +47,7 @@
|
|||
ser.Sync("ram", ref buffer);
|
||||
}
|
||||
|
||||
public void Write(ushort addr, byte val)
|
||||
public void Write(int addr, byte val)
|
||||
{
|
||||
ram[addr & 0x3FF] = (byte)(val & 0xF);
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
|
||||
public byte Peek(int addr)
|
||||
{
|
||||
return rom[addr & (int)addrMask];
|
||||
return rom[addr & addrMask];
|
||||
}
|
||||
|
||||
public void Poke(int addr, byte val)
|
||||
|
@ -51,7 +51,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
// do nothing (this is rom)
|
||||
}
|
||||
|
||||
public byte Read(ushort addr)
|
||||
public byte Read(int addr)
|
||||
{
|
||||
return rom[addr & addrMask];
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
ser.Sync("rom", ref buffer);
|
||||
}
|
||||
|
||||
public void Write(ushort addr, byte val)
|
||||
public void Write(int addr, byte val)
|
||||
{
|
||||
// do nothing (this is rom)
|
||||
}
|
||||
|
|
|
@ -30,15 +30,15 @@
|
|||
|
||||
public byte Peek(int addr)
|
||||
{
|
||||
return ram[addr & 0xFFFF];
|
||||
return ram[addr];
|
||||
}
|
||||
|
||||
public void Poke(int addr, byte val)
|
||||
{
|
||||
ram[addr & 0xFFFF] = val;
|
||||
ram[addr] = val;
|
||||
}
|
||||
|
||||
public byte Read(ushort addr)
|
||||
public byte Read(int addr)
|
||||
{
|
||||
return ram[addr];
|
||||
}
|
||||
|
@ -49,7 +49,7 @@
|
|||
ser.Sync("ram", ref buffer);
|
||||
}
|
||||
|
||||
public void Write(ushort addr, byte val)
|
||||
public void Write(int addr, byte val)
|
||||
{
|
||||
ram[addr] = val;
|
||||
}
|
||||
|
|
|
@ -28,9 +28,9 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
public Func<bool> ReadIRQ;
|
||||
public Func<bool> ReadNMI;
|
||||
public Func<bool> ReadRDY;
|
||||
public Func<ushort, byte> ReadMemory;
|
||||
public Func<int, byte> ReadMemory;
|
||||
public Func<byte> ReadPort;
|
||||
public Action<ushort, byte> WriteMemory;
|
||||
public Action<int, byte> WriteMemory;
|
||||
|
||||
// ------------------------------------
|
||||
|
||||
|
@ -65,7 +65,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
cpu.FlagI = true;
|
||||
cpu.BCD_Enabled = true;
|
||||
if (ReadMemory != null)
|
||||
cpu.PC = (ushort)(ReadMemory(0xFFFC) | (ReadMemory(0xFFFD) << 8));
|
||||
cpu.PC = (ushort)(ReadMemory(0x0FFFC) | (ReadMemory(0x0FFFD) << 8));
|
||||
|
||||
// configure data port defaults
|
||||
port = new LatchedPort();
|
||||
|
@ -130,6 +130,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
|
||||
public byte Peek(int addr)
|
||||
{
|
||||
addr &= 0xFFFF;
|
||||
if (addr == 0x0000)
|
||||
return port.Direction;
|
||||
else if (addr == 0x0001)
|
||||
|
@ -140,7 +141,8 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
|
||||
public void Poke(int addr, byte val)
|
||||
{
|
||||
if (addr == 0x0000)
|
||||
addr &= 0xFFFF;
|
||||
if (addr == 0x0000)
|
||||
port.Direction = val;
|
||||
else if (addr == 0x0001)
|
||||
port.Latch = val;
|
||||
|
|
|
@ -45,6 +45,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
|
||||
public Func<bool> ReadCNT;
|
||||
public Func<bool> ReadFlag;
|
||||
public Func<bool> ReadSP;
|
||||
|
||||
// ------------------------------------
|
||||
|
||||
|
@ -60,9 +61,11 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
private bool intSP;
|
||||
private bool[] intTimer;
|
||||
private bool pinCnt;
|
||||
private bool pinPC;
|
||||
private bool pinCntLast;
|
||||
private bool pinPC;
|
||||
private bool pinSP;
|
||||
private byte sr;
|
||||
private uint[] timerDelay;
|
||||
private int[] timerDelay;
|
||||
private InMode[] timerInMode;
|
||||
private OutMode[] timerOutMode;
|
||||
private bool[] timerPortEnable;
|
||||
|
@ -72,8 +75,8 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
private byte[] tod;
|
||||
private byte[] todAlarm;
|
||||
private bool todAlarmPM;
|
||||
private uint todCounter;
|
||||
private uint todCounterLatch;
|
||||
private int todCounter;
|
||||
private int todCounterLatch;
|
||||
private bool todIn;
|
||||
private bool todPM;
|
||||
|
||||
|
@ -84,7 +87,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
chipRegion = region;
|
||||
enableIntTimer = new bool[2];
|
||||
intTimer = new bool[2];
|
||||
timerDelay = new uint[2];
|
||||
timerDelay = new int[2];
|
||||
timerInMode = new InMode[2];
|
||||
timerOutMode = new OutMode[2];
|
||||
timerPortEnable = new bool[2];
|
||||
|
@ -106,8 +109,12 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
public void ExecutePhase2()
|
||||
{
|
||||
{
|
||||
pinPC = true;
|
||||
TODRun();
|
||||
bool sumCnt = ReadCNT();
|
||||
cntPos |= (!pinCntLast && sumCnt);
|
||||
pinCntLast = sumCnt;
|
||||
|
||||
pinPC = true;
|
||||
TODRun();
|
||||
|
||||
if (timerPulse[0])
|
||||
{
|
||||
|
@ -217,12 +224,12 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
{
|
||||
|
||||
{
|
||||
uint lo;
|
||||
uint hi;
|
||||
uint result;
|
||||
int lo;
|
||||
int hi;
|
||||
int result;
|
||||
|
||||
lo = (i & (uint)0x0F) + (j & (uint)0x0F);
|
||||
hi = (i & (uint)0x70) + (j & (uint)0x70);
|
||||
lo = (i & 0x0F) + (j & 0x0F);
|
||||
hi = (i & 0x70) + (j & 0x70);
|
||||
if (lo > 0x09)
|
||||
{
|
||||
hi += 0x10;
|
||||
|
@ -238,13 +245,13 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
}
|
||||
}
|
||||
|
||||
private void TimerRun(uint index)
|
||||
private void TimerRun(int index)
|
||||
{
|
||||
|
||||
{
|
||||
if (timerOn[index])
|
||||
{
|
||||
uint t = timer[index];
|
||||
int t = timer[index];
|
||||
bool u = false;
|
||||
|
||||
{
|
||||
|
@ -356,33 +363,22 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
|
||||
// ------------------------------------
|
||||
|
||||
public bool CNT
|
||||
{
|
||||
get { return pinCnt; }
|
||||
set { cntPos |= (!pinCnt && value); pinCnt = value; }
|
||||
}
|
||||
|
||||
public bool PC
|
||||
{
|
||||
get { return pinPC; }
|
||||
}
|
||||
|
||||
public byte Peek(int addr)
|
||||
{
|
||||
return ReadRegister((ushort)(addr & 0xF));
|
||||
return ReadRegister((addr & 0xF));
|
||||
}
|
||||
|
||||
public void Poke(int addr, byte val)
|
||||
{
|
||||
WriteRegister((ushort)(addr & 0xF), val);
|
||||
WriteRegister((addr & 0xF), val);
|
||||
}
|
||||
|
||||
public byte Read(ushort addr)
|
||||
public byte Read(int addr)
|
||||
{
|
||||
return Read(addr, 0xFF);
|
||||
}
|
||||
|
||||
public byte Read(ushort addr, byte mask)
|
||||
public byte Read(int addr, byte mask)
|
||||
{
|
||||
addr &= 0xF;
|
||||
byte val;
|
||||
|
@ -411,18 +407,28 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
return val;
|
||||
}
|
||||
|
||||
private byte ReadRegister(ushort addr)
|
||||
public bool ReadCNTBuffer()
|
||||
{
|
||||
return pinCnt;
|
||||
}
|
||||
|
||||
public bool ReadPCBuffer()
|
||||
{
|
||||
return pinPC;
|
||||
}
|
||||
|
||||
private byte ReadRegister(int addr)
|
||||
{
|
||||
byte val = 0x00; //unused pin value
|
||||
uint timerVal;
|
||||
int timerVal;
|
||||
|
||||
switch (addr)
|
||||
{
|
||||
case 0x0:
|
||||
val = portA.ReadInput(ReadPortA());
|
||||
val = (byte)(portA.ReadInput(ReadPortA()) & PortAMask);
|
||||
break;
|
||||
case 0x1:
|
||||
val = portB.ReadInput(ReadPortB());
|
||||
val = (byte)(portB.ReadInput(ReadPortB()) & PortBMask);
|
||||
break;
|
||||
case 0x2:
|
||||
val = portA.Direction;
|
||||
|
@ -512,7 +518,12 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
return val;
|
||||
}
|
||||
|
||||
private uint ReadTimerValue(uint index)
|
||||
public bool ReadSPBuffer()
|
||||
{
|
||||
return pinSP;
|
||||
}
|
||||
|
||||
private int ReadTimerValue(int index)
|
||||
{
|
||||
if (timerOn[index])
|
||||
{
|
||||
|
@ -530,13 +541,13 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
public void SyncState(Serializer ser)
|
||||
{
|
||||
int chipRegionInt = (int)chipRegion;
|
||||
int timerInModeInt0 = (int)timerInMode[0];
|
||||
int timerInModeInt1 = (int)timerInMode[1];
|
||||
int timerOutModeInt0 = (int)timerOutMode[0];
|
||||
int timerOutModeInt1 = (int)timerOutMode[1];
|
||||
int timerRunModeInt0 = (int)timerRunMode[0];
|
||||
int timerRunModeInt1 = (int)timerRunMode[1];
|
||||
int timerSPModeInt = (int)timerSPMode;
|
||||
int timerInModeInt0 = (int)timerInMode[0];
|
||||
int timerInModeInt1 = (int)timerInMode[1];
|
||||
int timerOutModeInt0 = (int)timerOutMode[0];
|
||||
int timerOutModeInt1 = (int)timerOutMode[1];
|
||||
int timerRunModeInt0 = (int)timerRunMode[0];
|
||||
int timerRunModeInt1 = (int)timerRunMode[1];
|
||||
int timerSPModeInt = (int)timerSPMode;
|
||||
|
||||
SyncInternal(ser);
|
||||
ser.Sync("alarmSelect", ref alarmSelect);
|
||||
|
@ -592,12 +603,12 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
timerSPMode = (SPMode)timerSPModeInt;
|
||||
}
|
||||
|
||||
public void Write(ushort addr, byte val)
|
||||
public void Write(int addr, byte val)
|
||||
{
|
||||
Write(addr, val, 0xFF);
|
||||
}
|
||||
|
||||
public void Write(ushort addr, byte val, byte mask)
|
||||
public void Write(int addr, byte val, byte mask)
|
||||
{
|
||||
addr &= 0xF;
|
||||
val &= mask;
|
||||
|
@ -635,7 +646,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
}
|
||||
}
|
||||
|
||||
public void WriteRegister(ushort addr, byte val)
|
||||
public void WriteRegister(int addr, byte val)
|
||||
{
|
||||
bool intReg;
|
||||
|
||||
|
@ -659,7 +670,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
break;
|
||||
case 0x5:
|
||||
timerLatch[0] &= 0x00FF;
|
||||
timerLatch[0] |= (uint)val << 8;
|
||||
timerLatch[0] |= val << 8;
|
||||
break;
|
||||
case 0x6:
|
||||
timerLatch[1] &= 0xFF00;
|
||||
|
@ -667,7 +678,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
break;
|
||||
case 0x7:
|
||||
timerLatch[1] &= 0x00FF;
|
||||
timerLatch[1] |= (uint)val << 8;
|
||||
timerLatch[1] |= val << 8;
|
||||
break;
|
||||
case 0x8:
|
||||
if (alarmSelect)
|
||||
|
|
|
@ -34,34 +34,34 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
public Action<int, byte> PokeVic;
|
||||
public Func<bool> ReadAEC;
|
||||
public Func<bool> ReadBA;
|
||||
public Func<ushort, byte> ReadBasicRom;
|
||||
public Func<ushort, byte> ReadCartridgeLo;
|
||||
public Func<ushort, byte> ReadCartridgeHi;
|
||||
public Func<int, byte> ReadBasicRom;
|
||||
public Func<int, byte> ReadCartridgeLo;
|
||||
public Func<int, byte> ReadCartridgeHi;
|
||||
public Func<bool> ReadCharen;
|
||||
public Func<ushort, byte> ReadCharRom;
|
||||
public Func<ushort, byte> ReadCia0;
|
||||
public Func<ushort, byte> ReadCia1;
|
||||
public Func<ushort, byte> ReadColorRam;
|
||||
public Func<ushort, byte> ReadExpansionLo;
|
||||
public Func<ushort, byte> ReadExpansionHi;
|
||||
public Func<int, byte> ReadCharRom;
|
||||
public Func<int, byte> ReadCia0;
|
||||
public Func<int, byte> ReadCia1;
|
||||
public Func<int, byte> ReadColorRam;
|
||||
public Func<int, byte> ReadExpansionLo;
|
||||
public Func<int, byte> ReadExpansionHi;
|
||||
public Func<bool> ReadExRom;
|
||||
public Func<bool> ReadGame;
|
||||
public Func<bool> ReadHiRam;
|
||||
public Func<ushort, byte> ReadKernalRom;
|
||||
public Func<int, byte> ReadKernalRom;
|
||||
public Func<bool> ReadLoRam;
|
||||
public Func<ushort, byte> ReadMemory;
|
||||
public Func<ushort, byte> ReadSid;
|
||||
public Func<ushort, byte> ReadVic;
|
||||
public Action<ushort, byte> WriteCartridgeLo;
|
||||
public Action<ushort, byte> WriteCartridgeHi;
|
||||
public Action<ushort, byte> WriteCia0;
|
||||
public Action<ushort, byte> WriteCia1;
|
||||
public Action<ushort, byte> WriteColorRam;
|
||||
public Action<ushort, byte> WriteExpansionLo;
|
||||
public Action<ushort, byte> WriteExpansionHi;
|
||||
public Action<ushort, byte> WriteMemory;
|
||||
public Action<ushort, byte> WriteSid;
|
||||
public Action<ushort, byte> WriteVic;
|
||||
public Func<int, byte> ReadMemory;
|
||||
public Func<int, byte> ReadSid;
|
||||
public Func<int, byte> ReadVic;
|
||||
public Action<int, byte> WriteCartridgeLo;
|
||||
public Action<int, byte> WriteCartridgeHi;
|
||||
public Action<int, byte> WriteCia0;
|
||||
public Action<int, byte> WriteCia1;
|
||||
public Action<int, byte> WriteColorRam;
|
||||
public Action<int, byte> WriteExpansionLo;
|
||||
public Action<int, byte> WriteExpansionHi;
|
||||
public Action<int, byte> WriteMemory;
|
||||
public Action<int, byte> WriteSid;
|
||||
public Action<int, byte> WriteVic;
|
||||
|
||||
// ------------------------------------
|
||||
|
||||
|
@ -127,16 +127,16 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
bool aec;
|
||||
bool cas;
|
||||
|
||||
private PLABank Bank(ushort addr, bool read)
|
||||
private PLABank Bank(int addr, bool read)
|
||||
{
|
||||
loram = ReadLoRam();
|
||||
hiram = ReadHiRam();
|
||||
game = ReadGame();
|
||||
|
||||
a15 = (addr & 0x8000) != 0;
|
||||
a14 = (addr & 0x4000) != 0;
|
||||
a13 = (addr & 0x2000) != 0;
|
||||
a12 = (addr & 0x1000) != 0;
|
||||
a15 = (addr & 0x08000) != 0;
|
||||
a14 = (addr & 0x04000) != 0;
|
||||
a13 = (addr & 0x02000) != 0;
|
||||
a12 = (addr & 0x01000) != 0;
|
||||
aec = !ReadAEC(); //active low
|
||||
|
||||
p0 = loram && hiram && a15 && !a14 && a13 && !aec && read && game;
|
||||
|
@ -228,7 +228,8 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
|
||||
public byte Peek(int addr)
|
||||
{
|
||||
switch (Bank((ushort)(addr & 0xFFFF), true))
|
||||
addr &= 0x0FFFF;
|
||||
switch (Bank(addr, true))
|
||||
{
|
||||
case PLABank.BasicROM:
|
||||
return PeekBasicRom(addr);
|
||||
|
@ -250,8 +251,6 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
return PeekExpansionHi(addr);
|
||||
case PLABank.KernalROM:
|
||||
return PeekKernalRom(addr);
|
||||
case PLABank.None:
|
||||
return 0xFF;
|
||||
case PLABank.RAM:
|
||||
return PeekMemory(addr);
|
||||
case PLABank.Sid:
|
||||
|
@ -264,18 +263,15 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
|
||||
public void Poke(int addr, byte val)
|
||||
{
|
||||
switch (Bank((ushort)(addr & 0xFFFF), false))
|
||||
addr &= 0x0FFFF;
|
||||
switch (Bank(addr, false))
|
||||
{
|
||||
case PLABank.BasicROM:
|
||||
break;
|
||||
case PLABank.CartridgeHi:
|
||||
PokeCartridgeHi(addr, val);
|
||||
break;
|
||||
case PLABank.CartridgeLo:
|
||||
PokeCartridgeLo(addr, val);
|
||||
break;
|
||||
case PLABank.CharROM:
|
||||
break;
|
||||
case PLABank.Cia0:
|
||||
PokeCia0(addr, val);
|
||||
break;
|
||||
|
@ -291,10 +287,6 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
case PLABank.Expansion1:
|
||||
PokeExpansionHi(addr, val);
|
||||
break;
|
||||
case PLABank.KernalROM:
|
||||
break;
|
||||
case PLABank.None:
|
||||
break;
|
||||
case PLABank.RAM:
|
||||
PokeMemory(addr, val);
|
||||
break;
|
||||
|
@ -307,8 +299,9 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
}
|
||||
}
|
||||
|
||||
public byte Read(ushort addr)
|
||||
public byte Read(int addr)
|
||||
{
|
||||
addr &= 0x0FFFF;
|
||||
switch (Bank(addr, true))
|
||||
{
|
||||
case PLABank.BasicROM:
|
||||
|
@ -341,8 +334,9 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
return 0xFF;
|
||||
}
|
||||
|
||||
public void Write(ushort addr, byte val)
|
||||
public void Write(int addr, byte val)
|
||||
{
|
||||
addr &= 0x0FFFF;
|
||||
switch (Bank(addr, false))
|
||||
{
|
||||
case PLABank.BasicROM:
|
||||
|
@ -355,8 +349,6 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
WriteCartridgeLo(addr, val);
|
||||
WriteMemory(addr, val);
|
||||
break;
|
||||
case PLABank.CharROM:
|
||||
break;
|
||||
case PLABank.Cia0:
|
||||
WriteCia0(addr, val);
|
||||
break;
|
||||
|
@ -372,10 +364,6 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
case PLABank.Expansion1:
|
||||
WriteExpansionHi(addr, val);
|
||||
return;
|
||||
case PLABank.KernalROM:
|
||||
break;
|
||||
case PLABank.None:
|
||||
break;
|
||||
case PLABank.RAM:
|
||||
WriteMemory(addr, val);
|
||||
break;
|
||||
|
|
|
@ -36,4 +36,39 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
return (byte)((Latch & Direction) | (Direction ^ 0xFF));
|
||||
}
|
||||
}
|
||||
|
||||
public class LatchedBooleanPort
|
||||
{
|
||||
public bool Direction;
|
||||
public bool Latch;
|
||||
|
||||
public LatchedBooleanPort()
|
||||
{
|
||||
Direction = false;
|
||||
Latch = false;
|
||||
}
|
||||
|
||||
// data dir bus out
|
||||
// 0 0 0 0
|
||||
// 0 0 1 1
|
||||
|
||||
// 0 1 0 0
|
||||
// 0 1 1 0
|
||||
|
||||
// 1 0 0 0
|
||||
// 1 0 1 1
|
||||
|
||||
// 1 1 0 1
|
||||
// 1 1 1 1
|
||||
|
||||
public bool ReadInput(bool bus)
|
||||
{
|
||||
return (Direction && Latch) || (!Direction && bus);
|
||||
}
|
||||
|
||||
public bool ReadOutput()
|
||||
{
|
||||
return (Latch || !Direction);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,48 +7,26 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
|
||||
public class SerialPort
|
||||
{
|
||||
public Func<bool> DeviceReadAtn;
|
||||
public Func<bool> DeviceReadClock;
|
||||
public Func<bool> DeviceReadData;
|
||||
public Func<bool> DeviceReadReset;
|
||||
public Action<bool> DeviceWriteAtn;
|
||||
public Action<bool> DeviceWriteClock;
|
||||
public Action<bool> DeviceWriteData;
|
||||
public Action<bool> DeviceWriteSrq;
|
||||
|
||||
public Func<bool> SystemReadAtn;
|
||||
public Func<bool> SystemReadClock;
|
||||
public Func<bool> SystemReadData;
|
||||
public Func<bool> SystemReadSrq;
|
||||
public Action<bool> SystemWriteAtn;
|
||||
public Action<bool> SystemWriteClock;
|
||||
public Action<bool> SystemWriteData;
|
||||
public Action<bool> SystemWriteReset;
|
||||
|
||||
// Connect() needs to set System functions above
|
||||
public Func<bool> ReadAtnOut;
|
||||
public Func<bool> ReadClockOut;
|
||||
public Func<bool> ReadDataOut;
|
||||
|
||||
public SerialPort()
|
||||
{
|
||||
DeviceReadAtn = (() => { return true; });
|
||||
DeviceReadClock = (() => { return true; });
|
||||
DeviceReadData = (() => { return true; });
|
||||
DeviceReadReset = (() => { return true; });
|
||||
DeviceWriteAtn = ((bool val) => { });
|
||||
DeviceWriteClock = ((bool val) => { });
|
||||
DeviceWriteData = ((bool val) => { });
|
||||
DeviceWriteSrq = ((bool val) => { });
|
||||
SystemReadAtn = (() => { return true; });
|
||||
SystemReadClock = (() => { return true; });
|
||||
SystemReadData = (() => { return true; });
|
||||
SystemReadSrq = (() => { return true; });
|
||||
SystemWriteAtn = ((bool val) => { });
|
||||
SystemWriteClock = ((bool val) => { });
|
||||
SystemWriteData = ((bool val) => { });
|
||||
SystemWriteReset = ((bool val) => { });
|
||||
}
|
||||
|
||||
public void HardReset()
|
||||
{
|
||||
}
|
||||
|
||||
public bool WriteClockIn()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool WriteDataIn()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -419,9 +419,9 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
waveform = (value >> 4) & 0x0F;
|
||||
wave = waveTable[waveform & 0x07];
|
||||
ringMsbMask = ((~value >> 5) & (value >> 2) & 0x1) << 23;
|
||||
noNoise = ((waveform & 0x8) != 0) ? (int)0x000 : (int)0xFFF;
|
||||
noNoise = ((waveform & 0x8) != 0) ? 0x000 : 0xFFF;
|
||||
noNoiseOrNoise = noNoise | noise;
|
||||
noPulse = ((waveform & 0x4) != 0) ? (int)0x000 : (int)0xFFF;
|
||||
noPulse = ((waveform & 0x4) != 0) ? 0x000 : 0xFFF;
|
||||
|
||||
if (!testPrev && test)
|
||||
{
|
||||
|
@ -503,7 +503,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
if (floatOutputTTL != 0 && --floatOutputTTL == 0)
|
||||
output = 0x000;
|
||||
}
|
||||
pulse = ((accumulator >> 12) >= pulseWidth) ? (int)0xFFF : (int)0x000;
|
||||
pulse = ((accumulator >> 12) >= pulseWidth) ? 0xFFF : 0x000;
|
||||
return output;
|
||||
}
|
||||
}
|
||||
|
@ -759,15 +759,15 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
|
||||
public byte Peek(int addr)
|
||||
{
|
||||
return ReadRegister((ushort)(addr & 0x1F));
|
||||
return ReadRegister((addr & 0x1F));
|
||||
}
|
||||
|
||||
public void Poke(int addr, byte val)
|
||||
{
|
||||
WriteRegister((ushort)(addr & 0x1F), val);
|
||||
WriteRegister((addr & 0x1F), val);
|
||||
}
|
||||
|
||||
public byte Read(ushort addr)
|
||||
public byte Read(int addr)
|
||||
{
|
||||
addr &= 0x1F;
|
||||
byte result = 0x00;
|
||||
|
@ -783,7 +783,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
return result;
|
||||
}
|
||||
|
||||
private byte ReadRegister(ushort addr)
|
||||
private byte ReadRegister(int addr)
|
||||
{
|
||||
byte result = 0x00;
|
||||
|
||||
|
@ -892,7 +892,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
return result;
|
||||
}
|
||||
|
||||
public void Write(ushort addr, byte val)
|
||||
public void Write(int addr, byte val)
|
||||
{
|
||||
addr &= 0x1F;
|
||||
switch (addr)
|
||||
|
@ -912,7 +912,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
}
|
||||
}
|
||||
|
||||
private void WriteRegister(ushort addr, byte val)
|
||||
private void WriteRegister(int addr, byte val)
|
||||
{
|
||||
switch (addr)
|
||||
{
|
||||
|
|
|
@ -6,11 +6,14 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
|
||||
public abstract class Timer
|
||||
{
|
||||
public byte PortAMask = 0xFF;
|
||||
public byte PortBMask = 0xFF;
|
||||
|
||||
protected bool pinIRQ;
|
||||
protected LatchedPort portA;
|
||||
protected LatchedPort portB;
|
||||
protected uint[] timer;
|
||||
protected uint[] timerLatch;
|
||||
protected int[] timer;
|
||||
protected int[] timerLatch;
|
||||
protected bool[] timerOn;
|
||||
protected bool[] underflow;
|
||||
|
||||
|
@ -21,8 +24,8 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
{
|
||||
portA = new LatchedPort();
|
||||
portB = new LatchedPort();
|
||||
timer = new uint[2];
|
||||
timerLatch = new uint[2];
|
||||
timer = new int[2];
|
||||
timerLatch = new int[2];
|
||||
timerOn = new bool[2];
|
||||
underflow = new bool[2];
|
||||
}
|
||||
|
@ -36,14 +39,6 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
pinIRQ = true;
|
||||
}
|
||||
|
||||
public bool IRQ
|
||||
{
|
||||
get
|
||||
{
|
||||
return pinIRQ;
|
||||
}
|
||||
}
|
||||
|
||||
public byte PortAData
|
||||
{
|
||||
get
|
||||
|
@ -60,7 +55,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
}
|
||||
}
|
||||
|
||||
public bool ReadIRQ() { return pinIRQ; }
|
||||
public bool ReadIRQBuffer() { return pinIRQ; }
|
||||
|
||||
protected void SyncInternal(Serializer ser)
|
||||
{
|
||||
|
|
|
@ -4,51 +4,14 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
{
|
||||
public class UserPort
|
||||
{
|
||||
private Func<int, byte> peekMemory;
|
||||
private Action<int, byte> pokeMemory;
|
||||
private Func<ushort, byte> readMemory;
|
||||
private Action<ushort, byte> writeMemory;
|
||||
public Func<bool> ReadCounter1;
|
||||
public Func<bool> ReadCounter2;
|
||||
public Func<bool> ReadHandshake;
|
||||
public Func<bool> ReadSerial1;
|
||||
public Func<bool> ReadSerial2;
|
||||
|
||||
public UserPort()
|
||||
{
|
||||
// start up with no media connected
|
||||
Disconnect();
|
||||
}
|
||||
|
||||
public void Connect(Func<int, byte> funcPeek, Action<int, byte> actPoke, Func<ushort, byte> funcRead, Action<ushort, byte> actWrite)
|
||||
{
|
||||
peekMemory = funcPeek;
|
||||
pokeMemory = actPoke;
|
||||
readMemory = funcRead;
|
||||
writeMemory = actWrite;
|
||||
}
|
||||
|
||||
public void Disconnect()
|
||||
{
|
||||
peekMemory = DummyPeek;
|
||||
pokeMemory = DummyPoke;
|
||||
readMemory = DummyRead;
|
||||
writeMemory = DummyWrite;
|
||||
}
|
||||
|
||||
private byte DummyPeek(int addr)
|
||||
{
|
||||
return 0xFF;
|
||||
}
|
||||
|
||||
private void DummyPoke(int addr, byte val)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
private byte DummyRead(ushort addr)
|
||||
{
|
||||
return 0xFF;
|
||||
}
|
||||
|
||||
private void DummyWrite(ushort addr, byte val)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
public void HardReset()
|
||||
|
@ -56,24 +19,49 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
// note: this will not disconnect any attached media
|
||||
}
|
||||
|
||||
public byte Peek(int addr)
|
||||
{
|
||||
return peekMemory(addr);
|
||||
}
|
||||
public bool ReadAtn()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Poke(int addr, byte val)
|
||||
{
|
||||
pokeMemory(addr, val);
|
||||
}
|
||||
public bool ReadCounter1Buffer()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public byte Read(ushort addr)
|
||||
{
|
||||
return readMemory(addr);
|
||||
}
|
||||
public bool ReadCounter2Buffer()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Write(ushort addr, byte val)
|
||||
{
|
||||
writeMemory(addr, val);
|
||||
}
|
||||
}
|
||||
public byte ReadData()
|
||||
{
|
||||
return 0xFF;
|
||||
}
|
||||
|
||||
public bool ReadFlag2()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool ReadPA2()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool ReadReset()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool ReadSerial1Buffer()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool ReadSerial2Buffer()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -105,7 +105,8 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
private int cycleIndex;
|
||||
private int dataC;
|
||||
private int dataG;
|
||||
private int displayC;
|
||||
private bool debugScreen;
|
||||
private int displayC;
|
||||
private bool displayEnable;
|
||||
private int displayIndex;
|
||||
private bool enableIntLightPen;
|
||||
|
@ -159,8 +160,8 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
|
||||
// ------------------------------------
|
||||
|
||||
public Func<ushort, byte> ReadColorRam;
|
||||
public Func<ushort, byte> ReadMemory;
|
||||
public Func<int, byte> ReadColorRam;
|
||||
public Func<int, byte> ReadMemory;
|
||||
|
||||
// ------------------------------------
|
||||
|
||||
|
@ -168,13 +169,23 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
{
|
||||
|
||||
{
|
||||
totalCycles = newCycles;
|
||||
debugScreen = false;
|
||||
|
||||
totalCycles = newCycles;
|
||||
totalLines = newLines;
|
||||
pipeline = newPipeline;
|
||||
cyclesPerSec = newCyclesPerSec;
|
||||
pixelBufferDelay = 12;
|
||||
pixelBackgroundBufferDelay = 4;
|
||||
bufRect = new Rectangle(136 - 24, 51 - 24, 320 + 48, 200 + 48);
|
||||
|
||||
if (debugScreen)
|
||||
{
|
||||
bufRect = new Rectangle(0, 0, totalCycles * 8, totalLines);
|
||||
}
|
||||
else
|
||||
{
|
||||
bufRect = new Rectangle(136 - 24, 51 - 24, 320 + 48, 200 + 48);
|
||||
}
|
||||
|
||||
buf = new int[bufRect.Width * bufRect.Height];
|
||||
bufLength = buf.Length;
|
||||
|
@ -425,7 +436,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
{
|
||||
|
||||
{
|
||||
ushort addr = 0x3FFF;
|
||||
int addr = 0x3FFF;
|
||||
int cycleBAsprite0;
|
||||
int cycleBAsprite1;
|
||||
int cycleBAsprite2;
|
||||
|
@ -443,7 +454,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
case 0x0100:
|
||||
// fetch R
|
||||
refreshCounter = (refreshCounter - 1) & 0xFF;
|
||||
addr = (ushort)(0x3F00 | refreshCounter);
|
||||
addr = (0x3F00 | refreshCounter);
|
||||
ReadMemory(addr);
|
||||
break;
|
||||
case 0x0200:
|
||||
|
@ -452,7 +463,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
{
|
||||
if (badline)
|
||||
{
|
||||
addr = (ushort)((pointerVM << 10) | vc);
|
||||
addr = ((pointerVM << 10) | vc);
|
||||
dataC = ReadMemory(addr);
|
||||
dataC |= ((int)ReadColorRam(addr) & 0xF) << 8;
|
||||
bufferC[vmli] = dataC;
|
||||
|
@ -475,9 +486,9 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
else
|
||||
{
|
||||
if (bitmapMode)
|
||||
addr = (ushort)(rc | (vc << 3) | ((pointerCB & 0x4) << 11));
|
||||
addr = (rc | (vc << 3) | ((pointerCB & 0x4) << 11));
|
||||
else
|
||||
addr = (ushort)(rc | ((dataC & 0xFF) << 3) | (pointerCB << 11));
|
||||
addr = (rc | ((dataC & 0xFF) << 3) | (pointerCB << 11));
|
||||
}
|
||||
if (extraColorMode)
|
||||
addr &= 0x39FF;
|
||||
|
@ -491,7 +502,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
break;
|
||||
case 0x0400:
|
||||
// fetch I
|
||||
addr = (extraColorMode ? (ushort)0x39FF : (ushort)0x3FFF);
|
||||
addr = (extraColorMode ? 0x39FF : 0x3FFF);
|
||||
dataG = ReadMemory(addr);
|
||||
dataC = 0;
|
||||
break;
|
||||
|
@ -504,7 +515,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
{
|
||||
case 0x00:
|
||||
// fetch P
|
||||
addr = (ushort)(0x3F8 | (pointerVM << 10) | cycleFetchSpriteIndex);
|
||||
addr = (0x3F8 | (pointerVM << 10) | cycleFetchSpriteIndex);
|
||||
sprites[cycleFetchSpriteIndex].pointer = ReadMemory(addr);
|
||||
sprites[cycleFetchSpriteIndex].shiftEnable = false;
|
||||
break;
|
||||
|
@ -515,7 +526,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
if (sprites[cycleFetchSpriteIndex].dma)
|
||||
{
|
||||
Sprite spr = sprites[cycleFetchSpriteIndex];
|
||||
addr = (ushort)(spr.mc | (spr.pointer << 6));
|
||||
addr = (spr.mc | (spr.pointer << 6));
|
||||
spr.sr <<= 8;
|
||||
spr.sr |= ReadMemory(addr);
|
||||
spr.mc++;
|
||||
|
@ -878,13 +889,9 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
|
||||
// ------------------------------------
|
||||
|
||||
public bool AEC { get { return pinAEC; } }
|
||||
public bool BA { get { return pinBA; } }
|
||||
public bool IRQ { get { return pinIRQ; } }
|
||||
|
||||
public bool ReadAEC() { return pinAEC; }
|
||||
public bool ReadBA() { return pinBA; }
|
||||
public bool ReadIRQ() { return pinIRQ; }
|
||||
public bool ReadAECBuffer() { return pinAEC; }
|
||||
public bool ReadBABuffer() { return pinBA; }
|
||||
public bool ReadIRQBuffer() { return pinIRQ; }
|
||||
|
||||
// ------------------------------------
|
||||
|
||||
|
@ -892,7 +899,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
{
|
||||
get
|
||||
{
|
||||
return (int)(totalCycles * totalLines);
|
||||
return (totalCycles * totalLines);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -908,15 +915,15 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
|
||||
public byte Peek(int addr)
|
||||
{
|
||||
return ReadRegister((ushort)(addr & 0x3F));
|
||||
return ReadRegister((addr & 0x3F));
|
||||
}
|
||||
|
||||
public void Poke(int addr, byte val)
|
||||
{
|
||||
WriteRegister((ushort)(addr & 0x3F), val);
|
||||
WriteRegister((addr & 0x3F), val);
|
||||
}
|
||||
|
||||
public byte Read(ushort addr)
|
||||
public byte Read(int addr)
|
||||
{
|
||||
byte result;
|
||||
addr &= 0x3F;
|
||||
|
@ -930,13 +937,13 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
WriteRegister(addr, 0);
|
||||
break;
|
||||
default:
|
||||
result = ReadRegister((ushort)(addr & 0x3F));
|
||||
result = ReadRegister((addr & 0x3F));
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private byte ReadRegister(ushort addr)
|
||||
private byte ReadRegister(int addr)
|
||||
{
|
||||
byte result = 0xFF; //unused bit value
|
||||
|
||||
|
@ -1158,7 +1165,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
return result;
|
||||
}
|
||||
|
||||
public void Write(ushort addr, byte val)
|
||||
public void Write(int addr, byte val)
|
||||
{
|
||||
addr &= 0x3F;
|
||||
switch (addr)
|
||||
|
@ -1207,7 +1214,7 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
|||
}
|
||||
}
|
||||
|
||||
private void WriteRegister(ushort addr, byte val)
|
||||
private void WriteRegister(int addr, byte val)
|
||||
{
|
||||
switch (addr)
|
||||
{
|
||||
|
|
|
@ -6,11 +6,11 @@ namespace BizHawk.Emulation.Computers.Commodore64.Media
|
|||
{
|
||||
static public void Load(MOSPLA pla, byte[] prgFile)
|
||||
{
|
||||
uint length = (uint)prgFile.Length;
|
||||
int length = prgFile.Length;
|
||||
if (length > 2)
|
||||
{
|
||||
ushort addr = (ushort)(prgFile[0] | (prgFile[1] << 8));
|
||||
uint offset = 2;
|
||||
int addr = (prgFile[0] | (prgFile[1] << 8));
|
||||
int offset = 2;
|
||||
unchecked
|
||||
{
|
||||
while (offset < length)
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
namespace BizHawk.Emulation.Computers.Commodore64
|
||||
{
|
||||
class Memory
|
||||
{
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue