Commodore64: Framework for a bit of an experiment..
This commit is contained in:
parent
634db7a30b
commit
155aea5b89
|
@ -98,10 +98,30 @@
|
||||||
<Compile Include="Computers\Commodore64\Cartridge\Mapper0020.cs" />
|
<Compile Include="Computers\Commodore64\Cartridge\Mapper0020.cs" />
|
||||||
<Compile Include="Computers\Commodore64\Disk\VIC1541.cs" />
|
<Compile Include="Computers\Commodore64\Disk\VIC1541.cs" />
|
||||||
<Compile Include="Computers\Commodore64\Disk\VIC1541.PLA.cs" />
|
<Compile Include="Computers\Commodore64\Disk\VIC1541.PLA.cs" />
|
||||||
<Compile Include="Computers\Commodore64\Experimental\MOS6569.cs" />
|
<Compile Include="Computers\Commodore64\Experimental\C64.cs" />
|
||||||
<Compile Include="Computers\Commodore64\Experimental\Vic.Interface.cs" />
|
<Compile Include="Computers\Commodore64\Experimental\C64.Glue.cs" />
|
||||||
<Compile Include="Computers\Commodore64\Experimental\Vic.Internal.cs" />
|
<Compile Include="Computers\Commodore64\Experimental\C64NTSC.cs" />
|
||||||
<Compile Include="Computers\Commodore64\Experimental\Vic.Rom.cs" />
|
<Compile Include="Computers\Commodore64\Experimental\C64PAL.cs" />
|
||||||
|
<Compile Include="Computers\Commodore64\Experimental\IMotherboard.cs" />
|
||||||
|
<Compile Include="Computers\Commodore64\Experimental\Chips\Internals\Cpu.Interface.cs" />
|
||||||
|
<Compile Include="Computers\Commodore64\Experimental\Chips\Internals\Cpu.Internal.cs" />
|
||||||
|
<Compile Include="Computers\Commodore64\Experimental\Chips\Internals\Expansion.cs" />
|
||||||
|
<Compile Include="Computers\Commodore64\Experimental\Chips\Internals\Cassette.cs" />
|
||||||
|
<Compile Include="Computers\Commodore64\Experimental\Chips\Internals\Joystick.cs" />
|
||||||
|
<Compile Include="Computers\Commodore64\Experimental\Chips\Internals\Keyboard.cs" />
|
||||||
|
<Compile Include="Computers\Commodore64\Experimental\Chips\Internals\Pla.cs" />
|
||||||
|
<Compile Include="Computers\Commodore64\Experimental\Chips\Internals\Serial.cs" />
|
||||||
|
<Compile Include="Computers\Commodore64\Experimental\Chips\Internals\Sid.Interface.cs" />
|
||||||
|
<Compile Include="Computers\Commodore64\Experimental\Chips\Internals\Sid.Internal.cs" />
|
||||||
|
<Compile Include="Computers\Commodore64\Experimental\Chips\MOS6569.cs" />
|
||||||
|
<Compile Include="Computers\Commodore64\Experimental\Chips\Internals\Ram.cs" />
|
||||||
|
<Compile Include="Computers\Commodore64\Experimental\Chips\Internals\Rom.cs" />
|
||||||
|
<Compile Include="Computers\Commodore64\Experimental\Chips\Internals\Vic.Interface.cs" />
|
||||||
|
<Compile Include="Computers\Commodore64\Experimental\Chips\Internals\Vic.Internal.cs" />
|
||||||
|
<Compile Include="Computers\Commodore64\Experimental\Chips\Ram2114.cs" />
|
||||||
|
<Compile Include="Computers\Commodore64\Experimental\Chips\Rom2332.cs" />
|
||||||
|
<Compile Include="Computers\Commodore64\Experimental\Chips\Rom2364.cs" />
|
||||||
|
<Compile Include="Computers\Commodore64\Experimental\Chips\Ram4864.cs" />
|
||||||
<Compile Include="Computers\Commodore64\Media\PRG.cs" />
|
<Compile Include="Computers\Commodore64\Media\PRG.cs" />
|
||||||
<Compile Include="Computers\Commodore64\Cartridge\Cart.cs" />
|
<Compile Include="Computers\Commodore64\Cartridge\Cart.cs" />
|
||||||
<Compile Include="Computers\Commodore64\MOS\CartridgePort.cs" />
|
<Compile Include="Computers\Commodore64\MOS\CartridgePort.cs" />
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace BizHawk.Emulation.Computers.Commodore64.Experimental
|
||||||
|
{
|
||||||
|
public abstract partial class C64
|
||||||
|
{
|
||||||
|
public void InitializeConnections()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public int ReadAddress()
|
||||||
|
{
|
||||||
|
int addr = 0xFFFF;
|
||||||
|
addr &= cpu.OutputAddress();
|
||||||
|
addr &= expansion.OutputAddress();
|
||||||
|
addr &= vic.OutputAddress();
|
||||||
|
return addr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,129 @@
|
||||||
|
using BizHawk.Emulation.Computers.Commodore64.Experimental.Chips.Internals;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace BizHawk.Emulation.Computers.Commodore64.Experimental
|
||||||
|
{
|
||||||
|
public abstract partial class C64 : IMotherboard
|
||||||
|
{
|
||||||
|
Rom basicRom;
|
||||||
|
Cassette cassette;
|
||||||
|
Rom characterRom;
|
||||||
|
Ram colorRam;
|
||||||
|
Cpu cpu;
|
||||||
|
Expansion expansion;
|
||||||
|
Joystick joystickA;
|
||||||
|
Joystick joystickB;
|
||||||
|
Rom kernalRom;
|
||||||
|
Keyboard keyboard;
|
||||||
|
Ram memory;
|
||||||
|
Pla pla;
|
||||||
|
Serial serial;
|
||||||
|
Sid sid;
|
||||||
|
Vic vic;
|
||||||
|
|
||||||
|
public C64(C64Timing timing)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ExecuteFrame()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte PeekBasicRom(int addr)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte PeekCartridge(int addr)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte PeekCharRom(int addr)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte PeekCpu(int addr)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte PeekKernalRom(int addr)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte PeekRam(int addr)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte PeekSerial(int addr)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte PeekSid(int addr)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte PeekVic(int addr)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void PokeBasicRom(int addr, byte val)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void PokeCartridge(int addr, byte val)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void PokeCharRom(int addr, byte val)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void PokeCpu(int addr, byte val)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void PokeKernalRom(int addr, byte val)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void PokeRam(int addr, byte val)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void PokeSerial(int addr, byte val)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void PokeSid(int addr, byte val)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void PokeVic(int addr, byte val)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class C64Timing
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,7 +5,12 @@ using System.Text;
|
||||||
|
|
||||||
namespace BizHawk.Emulation.Computers.Commodore64.Experimental
|
namespace BizHawk.Emulation.Computers.Commodore64.Experimental
|
||||||
{
|
{
|
||||||
public partial class Vic
|
public partial class C64NTSC : C64
|
||||||
{
|
{
|
||||||
|
static private C64Timing timing;
|
||||||
|
|
||||||
|
public C64NTSC() : base(timing)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -5,9 +5,11 @@ using System.Text;
|
||||||
|
|
||||||
namespace BizHawk.Emulation.Computers.Commodore64.Experimental
|
namespace BizHawk.Emulation.Computers.Commodore64.Experimental
|
||||||
{
|
{
|
||||||
public class MOS6569 : VIC
|
public partial class C64PAL : C64
|
||||||
{
|
{
|
||||||
public MOS6569()
|
static private C64Timing timing;
|
||||||
|
|
||||||
|
public C64PAL() : base(timing)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace BizHawk.Emulation.Computers.Commodore64.Experimental.Chips.Internals
|
||||||
|
{
|
||||||
|
public class Cassette
|
||||||
|
{
|
||||||
|
public Func<bool> InputData;
|
||||||
|
public Func<bool> InputMotor;
|
||||||
|
|
||||||
|
virtual public bool Data { get { return true; } }
|
||||||
|
public bool OutputData() { return Data; }
|
||||||
|
virtual public bool OutputSense() { return Sense; }
|
||||||
|
virtual public int Peek(int addr) { return 0xFF; }
|
||||||
|
virtual public void Poke(int addr, int val) { }
|
||||||
|
virtual public void Precache() { }
|
||||||
|
virtual public bool Sense { get { return true; } }
|
||||||
|
virtual public void SyncState(Serializer ser) { }
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace BizHawk.Emulation.Computers.Commodore64.Experimental.Chips.Internals
|
||||||
|
{
|
||||||
|
public partial class Cpu
|
||||||
|
{
|
||||||
|
public Func<int> InputAddress;
|
||||||
|
public Func<bool> InputAEC;
|
||||||
|
public Func<bool> InputClock;
|
||||||
|
public Func<int> InputData;
|
||||||
|
public Func<bool> InputIRQ;
|
||||||
|
public Func<bool> InputNMI;
|
||||||
|
public Func<int> InputPort;
|
||||||
|
public Func<bool> InputRDY;
|
||||||
|
public Func<bool> InputReset;
|
||||||
|
|
||||||
|
virtual public int Address { get { return 0xFFFF; } }
|
||||||
|
virtual public int Data { get { return 0xFF; } }
|
||||||
|
public int OutputAddress() { return Address; }
|
||||||
|
public int OutputData() { return Data; }
|
||||||
|
public int OutputPort() { return Port; }
|
||||||
|
virtual public int Port { get { return 0xFF; } }
|
||||||
|
virtual public void Precache() { }
|
||||||
|
virtual public void SyncState(Serializer ser) { }
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace BizHawk.Emulation.Computers.Commodore64.Experimental.Chips.Internals
|
||||||
|
{
|
||||||
|
public partial class Cpu
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace BizHawk.Emulation.Computers.Commodore64.Experimental.Chips.Internals
|
||||||
|
{
|
||||||
|
public class Expansion
|
||||||
|
{
|
||||||
|
public Func<int> InputAddress;
|
||||||
|
public Func<bool> InputBA;
|
||||||
|
public Func<int> InputData;
|
||||||
|
public Func<bool> InputDotClock;
|
||||||
|
public Func<bool> InputHiExpansion;
|
||||||
|
public Func<bool> InputHiRom;
|
||||||
|
public Func<bool> InputIRQ;
|
||||||
|
public Func<bool> InputLoExpansion;
|
||||||
|
public Func<bool> InputLoRom;
|
||||||
|
public Func<bool> InputNMI;
|
||||||
|
public Func<bool> InputRead;
|
||||||
|
public Func<bool> InputReset;
|
||||||
|
|
||||||
|
virtual public int Address { get { return 0xFFFF; } }
|
||||||
|
virtual public int Data { get { return 0xFF; } }
|
||||||
|
virtual public bool ExRom { get { return true; } }
|
||||||
|
virtual public bool Game { get { return true; } }
|
||||||
|
virtual public bool IRQ { get { return true; } }
|
||||||
|
virtual public bool NMI { get { return true; } }
|
||||||
|
public int OutputAddress() { return Address; }
|
||||||
|
public int OutputData() { return Data; }
|
||||||
|
public bool OutputExRom() { return ExRom; }
|
||||||
|
public bool OutputGame() { return Game; }
|
||||||
|
public bool OutputIRQ() { return IRQ; }
|
||||||
|
public bool OutputNMI() { return NMI; }
|
||||||
|
public bool OutputRead() { return Read; }
|
||||||
|
public bool OutputReset() { return Reset; }
|
||||||
|
virtual public void Precache() { }
|
||||||
|
virtual public bool Read { get { return true; } }
|
||||||
|
virtual public bool Reset { get { return true; } }
|
||||||
|
virtual public void SyncState(Serializer ser) { }
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace BizHawk.Emulation.Computers.Commodore64.Experimental.Chips.Internals
|
||||||
|
{
|
||||||
|
public class Joystick
|
||||||
|
{
|
||||||
|
virtual public int Data { get { return 0x1F; } }
|
||||||
|
public int OutputData() { return Data; }
|
||||||
|
public int OutputPotX() { return PotX; }
|
||||||
|
public int OutputPotY() { return PotY; }
|
||||||
|
virtual public int PotX { get { return 0xFF; } }
|
||||||
|
virtual public int PotY { get { return 0xFF; } }
|
||||||
|
virtual public void Precache() { }
|
||||||
|
virtual public void SyncState(Serializer ser) { }
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace BizHawk.Emulation.Computers.Commodore64.Experimental.Chips.Internals
|
||||||
|
{
|
||||||
|
public class Keyboard
|
||||||
|
{
|
||||||
|
virtual public int Column { get { return 0xFF; } }
|
||||||
|
public int OutputColumn() { return Column; }
|
||||||
|
public bool OutputRestore() { return Restore; }
|
||||||
|
public int OutputRow() { return Row; }
|
||||||
|
virtual public void Precache() { }
|
||||||
|
virtual public bool Restore { get { return true; } }
|
||||||
|
virtual public int Row { get { return 0xFF; } }
|
||||||
|
virtual public void SyncState(Serializer ser) { }
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace BizHawk.Emulation.Computers.Commodore64.Experimental.Chips.Internals
|
||||||
|
{
|
||||||
|
public class Pla
|
||||||
|
{
|
||||||
|
public Func<int> InputAddress;
|
||||||
|
public Func<bool> InputAEC;
|
||||||
|
public Func<bool> InputBA;
|
||||||
|
public Func<bool> InputCAS;
|
||||||
|
public Func<bool> InputCharen;
|
||||||
|
public Func<bool> InputExRom;
|
||||||
|
public Func<bool> InputGame;
|
||||||
|
public Func<bool> InputHiRam;
|
||||||
|
public Func<bool> InputLoRam;
|
||||||
|
public Func<bool> InputRead;
|
||||||
|
public Func<int> InputVA;
|
||||||
|
|
||||||
|
virtual public bool Basic { get { return true; } }
|
||||||
|
virtual public bool CASRam { get { return true; } }
|
||||||
|
virtual public bool CharRom { get { return true; } }
|
||||||
|
virtual public bool GraphicsRead { get { return true; } }
|
||||||
|
virtual public bool IO { get { return true; } }
|
||||||
|
virtual public bool Kernal { get { return true; } }
|
||||||
|
public bool OutputBasic() { return Basic; }
|
||||||
|
public bool OutputCASRam() { return CASRam; }
|
||||||
|
public bool OutputCharRom() { return CharRom; }
|
||||||
|
public bool OutputGraphicsRead() { return GraphicsRead; }
|
||||||
|
public bool OutputIO() { return IO; }
|
||||||
|
public bool OutputKernal() { return Kernal; }
|
||||||
|
public bool OutputRomHi() { return RomHi; }
|
||||||
|
public bool OutputRomLo() { return RomLo; }
|
||||||
|
virtual public void Precache() { }
|
||||||
|
virtual public bool RomHi { get { return true; } }
|
||||||
|
virtual public bool RomLo { get { return true; } }
|
||||||
|
virtual public void SyncState(Serializer ser) { }
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace BizHawk.Emulation.Computers.Commodore64.Experimental.Chips.Internals
|
||||||
|
{
|
||||||
|
public class Ram : Rom
|
||||||
|
{
|
||||||
|
public Func<bool> InputWrite;
|
||||||
|
|
||||||
|
public Ram(int size, int addressMask, int dataMask)
|
||||||
|
: base(size, addressMask, dataMask)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual public void Execute()
|
||||||
|
{
|
||||||
|
if (InputWrite() && InputSelect())
|
||||||
|
memory[InputAddress() & addressMask] = InputData() & dataMask;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace BizHawk.Emulation.Computers.Commodore64.Experimental.Chips.Internals
|
||||||
|
{
|
||||||
|
public class Rom
|
||||||
|
{
|
||||||
|
public Func<int> InputAddress;
|
||||||
|
public Func<int> InputData;
|
||||||
|
public Func<bool> InputSelect;
|
||||||
|
|
||||||
|
protected int addressMask;
|
||||||
|
protected int dataMask;
|
||||||
|
protected int[] memory;
|
||||||
|
|
||||||
|
public Rom(int size, int addressMask, int dataMask)
|
||||||
|
{
|
||||||
|
this.addressMask = addressMask;
|
||||||
|
this.dataMask = dataMask;
|
||||||
|
this.memory = new int[size];
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual public int Data
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (InputSelect())
|
||||||
|
return memory[InputAddress() & addressMask] & dataMask;
|
||||||
|
return 0xFF;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int OutputData() { return Data; }
|
||||||
|
virtual public void Precache() { }
|
||||||
|
virtual public void SyncState(Serializer ser) { }
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace BizHawk.Emulation.Computers.Commodore64.Experimental.Chips.Internals
|
||||||
|
{
|
||||||
|
public class Serial
|
||||||
|
{
|
||||||
|
public Func<bool> InputATN;
|
||||||
|
public Func<bool> InputClock;
|
||||||
|
public Func<bool> InputData;
|
||||||
|
public Func<bool> InputReset;
|
||||||
|
|
||||||
|
virtual public bool Clock { get { return true; } }
|
||||||
|
virtual public bool Data { get { return true; } }
|
||||||
|
public bool OutputClock() { return Clock; }
|
||||||
|
public bool OutputData() { return Data; }
|
||||||
|
public bool OutputSRQ() { return SRQ; }
|
||||||
|
virtual public void Precache() { }
|
||||||
|
virtual public bool SRQ { get { return true; } }
|
||||||
|
virtual public void SyncState(Serializer ser) { }
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace BizHawk.Emulation.Computers.Commodore64.Experimental.Chips.Internals
|
||||||
|
{
|
||||||
|
public abstract partial class Sid
|
||||||
|
{
|
||||||
|
public Func<int> InputAddress;
|
||||||
|
public Func<bool> InputChipSelect;
|
||||||
|
public Func<int> InputData;
|
||||||
|
public Func<bool> InputRead;
|
||||||
|
|
||||||
|
public int Data { get { return 0xFF; } }
|
||||||
|
virtual public int OutputData() { return Data; }
|
||||||
|
virtual public void Precache() { }
|
||||||
|
virtual public void SyncState(Serializer ser) { }
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace BizHawk.Emulation.Computers.Commodore64.Experimental.Chips.Internals
|
||||||
|
{
|
||||||
|
public partial class Sid
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,131 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace BizHawk.Emulation.Computers.Commodore64.Experimental.Chips.Internals
|
||||||
|
{
|
||||||
|
public abstract partial class Vic
|
||||||
|
{
|
||||||
|
public Func<int> InputAddress;
|
||||||
|
public Func<bool> InputChipSelect;
|
||||||
|
public Func<int> InputData;
|
||||||
|
public Func<bool> InputRead;
|
||||||
|
|
||||||
|
public Vic()
|
||||||
|
{
|
||||||
|
backgroundColor = new int[4];
|
||||||
|
spriteMultiColor = new int[2];
|
||||||
|
sprites = new Sprite[8];
|
||||||
|
for (int i = 0; i < 8; i++)
|
||||||
|
sprites[i] = new Sprite();
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual public int Address
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return bufferADDR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual public bool AEC
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return bufferAEC;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual public bool BA
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return bufferBA;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual public bool CAS
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return bufferCAS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual public int Data
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return bufferDATA;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual public bool IRQ
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return bufferIRQ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int OutputAddress()
|
||||||
|
{
|
||||||
|
return Address;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual public bool OutputAEC()
|
||||||
|
{
|
||||||
|
return AEC;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual public bool OutputBA()
|
||||||
|
{
|
||||||
|
return BA;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual public bool OutputCAS()
|
||||||
|
{
|
||||||
|
return CAS;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual public int OutputData()
|
||||||
|
{
|
||||||
|
return Data;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual public bool OutputIRQ()
|
||||||
|
{
|
||||||
|
return IRQ;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual public bool OutputPHI0()
|
||||||
|
{
|
||||||
|
return PHI0;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual public bool OutputRAS()
|
||||||
|
{
|
||||||
|
return RAS;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual public bool PHI0
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return bufferPHI0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual public bool RAS
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return bufferRAS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual public void Precache() { }
|
||||||
|
virtual public void SyncState(Serializer ser) { }
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,91 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace BizHawk.Emulation.Computers.Commodore64.Experimental.Chips.Internals
|
||||||
|
{
|
||||||
|
public partial class Vic
|
||||||
|
{
|
||||||
|
int bufferADDR;
|
||||||
|
bool bufferAEC;
|
||||||
|
bool bufferBA;
|
||||||
|
bool bufferCAS;
|
||||||
|
int bufferDATA;
|
||||||
|
bool bufferIRQ;
|
||||||
|
bool bufferPHI0;
|
||||||
|
bool bufferRAS;
|
||||||
|
|
||||||
|
class Sprite
|
||||||
|
{
|
||||||
|
public int Color;
|
||||||
|
public bool DataCollision;
|
||||||
|
public bool Enabled;
|
||||||
|
public bool ExpandX;
|
||||||
|
public bool ExpandY;
|
||||||
|
public bool Multicolor;
|
||||||
|
public bool Priority;
|
||||||
|
public bool SpriteCollision;
|
||||||
|
public int X;
|
||||||
|
public int Y;
|
||||||
|
}
|
||||||
|
|
||||||
|
int[] backgroundColor;
|
||||||
|
bool bitmapMode;
|
||||||
|
int borderColor;
|
||||||
|
int characterBitmap;
|
||||||
|
bool columnSelect;
|
||||||
|
bool dataCollisionInterrupt;
|
||||||
|
bool displayEnable;
|
||||||
|
bool extraColorMode;
|
||||||
|
byte interruptEnableRegister;
|
||||||
|
bool lightPenInterrupt;
|
||||||
|
int lightPenX;
|
||||||
|
int lightPenY;
|
||||||
|
bool multiColorMode;
|
||||||
|
bool rasterInterrupt;
|
||||||
|
int rasterX;
|
||||||
|
int rasterY;
|
||||||
|
bool reset;
|
||||||
|
bool rowSelect;
|
||||||
|
bool spriteCollisionInterrupt;
|
||||||
|
int[] spriteMultiColor;
|
||||||
|
Sprite[] sprites;
|
||||||
|
int videoMemory;
|
||||||
|
int xScroll;
|
||||||
|
int yScroll;
|
||||||
|
|
||||||
|
bool badLineCondition;
|
||||||
|
bool badLineEnable;
|
||||||
|
bool idleState;
|
||||||
|
int pixelTimer;
|
||||||
|
int rowCounter;
|
||||||
|
int videoCounter;
|
||||||
|
int videoCounterBase;
|
||||||
|
int videoMatrixLineIndex;
|
||||||
|
|
||||||
|
public void Execute()
|
||||||
|
{
|
||||||
|
if (pixelTimer == 0)
|
||||||
|
{
|
||||||
|
bufferPHI0 = !bufferPHI0;
|
||||||
|
pixelTimer = 8;
|
||||||
|
|
||||||
|
badLineEnable |= (rasterY == 0x30 && displayEnable);
|
||||||
|
if (!bufferPHI0)
|
||||||
|
{
|
||||||
|
badLineCondition = (
|
||||||
|
badLineEnable &&
|
||||||
|
rasterY >= 0x030 &&
|
||||||
|
rasterY <= 0x0F7 &&
|
||||||
|
(rasterY & 0x007) == yScroll
|
||||||
|
);
|
||||||
|
if (!idleState && badLineCondition)
|
||||||
|
idleState = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pixelTimer--;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace BizHawk.Emulation.Computers.Commodore64.Experimental.Chips
|
||||||
|
{
|
||||||
|
public class MOS6569 : Internals.Vic
|
||||||
|
{
|
||||||
|
public MOS6569()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace BizHawk.Emulation.Computers.Commodore64.Experimental.Chips
|
||||||
|
{
|
||||||
|
public class Ram2114 : Internals.Ram
|
||||||
|
{
|
||||||
|
public Ram2114() : base(0x800, 0x7FF, 0xF) { }
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace BizHawk.Emulation.Computers.Commodore64.Experimental.Chips
|
||||||
|
{
|
||||||
|
public class Ram4864 : Internals.Ram
|
||||||
|
{
|
||||||
|
public Ram4864() : base(0x10000, 0xFFFF, 0xFF) { }
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace BizHawk.Emulation.Computers.Commodore64.Experimental.Chips
|
||||||
|
{
|
||||||
|
public class Rom2332 : Internals.Rom
|
||||||
|
{
|
||||||
|
public Rom2332() : base(0x1000, 0xFFF, 0xFF) { }
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace BizHawk.Emulation.Computers.Commodore64.Experimental.Chips
|
||||||
|
{
|
||||||
|
public class Rom2364 : Internals.Rom
|
||||||
|
{
|
||||||
|
public Rom2364() : base(0x2000, 0x1FFF, 0xFF) { }
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace BizHawk.Emulation.Computers.Commodore64.Experimental
|
||||||
|
{
|
||||||
|
public interface IMotherboard
|
||||||
|
{
|
||||||
|
void ExecuteFrame();
|
||||||
|
|
||||||
|
byte PeekBasicRom(int addr);
|
||||||
|
byte PeekCartridge(int addr);
|
||||||
|
byte PeekCharRom(int addr);
|
||||||
|
byte PeekCpu(int addr);
|
||||||
|
byte PeekKernalRom(int addr);
|
||||||
|
byte PeekRam(int addr);
|
||||||
|
byte PeekSerial(int addr);
|
||||||
|
byte PeekSid(int addr);
|
||||||
|
byte PeekVic(int addr);
|
||||||
|
|
||||||
|
void PokeBasicRom(int addr, byte val);
|
||||||
|
void PokeCartridge(int addr, byte val);
|
||||||
|
void PokeCharRom(int addr, byte val);
|
||||||
|
void PokeCpu(int addr, byte val);
|
||||||
|
void PokeKernalRom(int addr, byte val);
|
||||||
|
void PokeRam(int addr, byte val);
|
||||||
|
void PokeSerial(int addr, byte val);
|
||||||
|
void PokeSid(int addr, byte val);
|
||||||
|
void PokeVic(int addr, byte val);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,126 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace BizHawk.Emulation.Computers.Commodore64.Experimental
|
|
||||||
{
|
|
||||||
public abstract partial class VIC
|
|
||||||
{
|
|
||||||
public Func<int> InputAddress;
|
|
||||||
public Func<bool> InputChipSelect;
|
|
||||||
public Func<int> InputData;
|
|
||||||
|
|
||||||
class Sprite
|
|
||||||
{
|
|
||||||
public int Color;
|
|
||||||
public bool DataCollision;
|
|
||||||
public bool Enabled;
|
|
||||||
public bool ExpandX;
|
|
||||||
public bool ExpandY;
|
|
||||||
public bool Multicolor;
|
|
||||||
public bool Priority;
|
|
||||||
public bool SpriteCollision;
|
|
||||||
public int X;
|
|
||||||
public int Y;
|
|
||||||
}
|
|
||||||
|
|
||||||
int[] backgroundColor;
|
|
||||||
bool bitmapMode;
|
|
||||||
int borderColor;
|
|
||||||
int characterBitmap;
|
|
||||||
bool columnSelect;
|
|
||||||
bool dataCollisionInterrupt;
|
|
||||||
bool displayEnable;
|
|
||||||
bool extraColorMode;
|
|
||||||
byte interruptEnableRegister;
|
|
||||||
bool lightPenInterrupt;
|
|
||||||
int lightPenX;
|
|
||||||
int lightPenY;
|
|
||||||
bool multiColorMode;
|
|
||||||
bool rasterInterrupt;
|
|
||||||
int rasterX;
|
|
||||||
int rasterY;
|
|
||||||
bool reset;
|
|
||||||
bool rowSelect;
|
|
||||||
bool spriteCollisionInterrupt;
|
|
||||||
int[] spriteMultiColor;
|
|
||||||
Sprite[] sprites;
|
|
||||||
int videoMemory;
|
|
||||||
int xScroll;
|
|
||||||
int yScroll;
|
|
||||||
|
|
||||||
public VIC()
|
|
||||||
{
|
|
||||||
backgroundColor = new int[4];
|
|
||||||
spriteMultiColor = new int[2];
|
|
||||||
sprites = new Sprite[8];
|
|
||||||
for (int i = 0; i < 8; i++)
|
|
||||||
sprites[i] = new Sprite();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Desired 14-bit address from the VIC.
|
|
||||||
/// </summary>
|
|
||||||
public int OutputAddress()
|
|
||||||
{
|
|
||||||
return ADDR;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// AEC pin output.
|
|
||||||
/// </summary>
|
|
||||||
public bool OutputAEC()
|
|
||||||
{
|
|
||||||
return AEC;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// BA pin output.
|
|
||||||
/// </summary>
|
|
||||||
public bool OutputBA()
|
|
||||||
{
|
|
||||||
return BA;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// CAS pin output.
|
|
||||||
/// </summary>
|
|
||||||
public bool OutputCAS()
|
|
||||||
{
|
|
||||||
return CAS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 12-bit data output from the VIC.
|
|
||||||
/// </summary>
|
|
||||||
public int OutputData()
|
|
||||||
{
|
|
||||||
return DATA;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// IRQ pin output.
|
|
||||||
/// </summary>
|
|
||||||
public bool OutputInterrupt()
|
|
||||||
{
|
|
||||||
return IRQ;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// PHI0 pin output.
|
|
||||||
/// </summary>
|
|
||||||
public bool OutputPHI0()
|
|
||||||
{
|
|
||||||
return PHI0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// RAS pin output.
|
|
||||||
/// </summary>
|
|
||||||
public bool OutputRAS()
|
|
||||||
{
|
|
||||||
return RAS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,52 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace BizHawk.Emulation.Computers.Commodore64.Experimental
|
|
||||||
{
|
|
||||||
public partial class VIC
|
|
||||||
{
|
|
||||||
int ADDR;
|
|
||||||
bool AEC;
|
|
||||||
bool BA;
|
|
||||||
bool CAS;
|
|
||||||
int DATA;
|
|
||||||
bool IRQ;
|
|
||||||
bool PHI0;
|
|
||||||
bool RAS;
|
|
||||||
|
|
||||||
bool badLineCondition;
|
|
||||||
bool badLineEnable;
|
|
||||||
bool idleState;
|
|
||||||
int pixelTimer;
|
|
||||||
int rowCounter;
|
|
||||||
int videoCounter;
|
|
||||||
int videoCounterBase;
|
|
||||||
int videoMatrixLineIndex;
|
|
||||||
|
|
||||||
public void Execute()
|
|
||||||
{
|
|
||||||
if (pixelTimer == 0)
|
|
||||||
{
|
|
||||||
PHI0 = !PHI0;
|
|
||||||
pixelTimer = 8;
|
|
||||||
|
|
||||||
badLineEnable |= (rasterY == 0x30 && displayEnable);
|
|
||||||
if (!PHI0)
|
|
||||||
{
|
|
||||||
badLineCondition = (
|
|
||||||
badLineEnable &&
|
|
||||||
rasterY >= 0x030 &&
|
|
||||||
rasterY <= 0x0F7 &&
|
|
||||||
(rasterY & 0x007) == yScroll
|
|
||||||
);
|
|
||||||
if (!idleState && badLineCondition)
|
|
||||||
idleState = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pixelTimer--;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue