diff --git a/BizHawk.Emulation/BizHawk.Emulation.csproj b/BizHawk.Emulation/BizHawk.Emulation.csproj index 3e270dcca8..96e5564448 100644 --- a/BizHawk.Emulation/BizHawk.Emulation.csproj +++ b/BizHawk.Emulation/BizHawk.Emulation.csproj @@ -98,10 +98,30 @@ - - - - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BizHawk.Emulation/Computers/Commodore64/Experimental/C64.Glue.cs b/BizHawk.Emulation/Computers/Commodore64/Experimental/C64.Glue.cs new file mode 100644 index 0000000000..5a56508d1e --- /dev/null +++ b/BizHawk.Emulation/Computers/Commodore64/Experimental/C64.Glue.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; + } + } +} diff --git a/BizHawk.Emulation/Computers/Commodore64/Experimental/C64.cs b/BizHawk.Emulation/Computers/Commodore64/Experimental/C64.cs new file mode 100644 index 0000000000..5a7bb4f3fb --- /dev/null +++ b/BizHawk.Emulation/Computers/Commodore64/Experimental/C64.cs @@ -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 + { + } +} diff --git a/BizHawk.Emulation/Computers/Commodore64/Experimental/Vic.Rom.cs b/BizHawk.Emulation/Computers/Commodore64/Experimental/C64NTSC.cs similarity index 51% rename from BizHawk.Emulation/Computers/Commodore64/Experimental/Vic.Rom.cs rename to BizHawk.Emulation/Computers/Commodore64/Experimental/C64NTSC.cs index 383f8be5e3..403fba09cb 100644 --- a/BizHawk.Emulation/Computers/Commodore64/Experimental/Vic.Rom.cs +++ b/BizHawk.Emulation/Computers/Commodore64/Experimental/C64NTSC.cs @@ -5,7 +5,12 @@ using System.Text; namespace BizHawk.Emulation.Computers.Commodore64.Experimental { - public partial class Vic + public partial class C64NTSC : C64 { + static private C64Timing timing; + + public C64NTSC() : base(timing) + { + } } } diff --git a/BizHawk.Emulation/Computers/Commodore64/Experimental/MOS6569.cs b/BizHawk.Emulation/Computers/Commodore64/Experimental/C64PAL.cs similarity index 58% rename from BizHawk.Emulation/Computers/Commodore64/Experimental/MOS6569.cs rename to BizHawk.Emulation/Computers/Commodore64/Experimental/C64PAL.cs index 090587e1b2..be7beebadc 100644 --- a/BizHawk.Emulation/Computers/Commodore64/Experimental/MOS6569.cs +++ b/BizHawk.Emulation/Computers/Commodore64/Experimental/C64PAL.cs @@ -5,9 +5,11 @@ using System.Text; 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) { } } diff --git a/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/Internals/Cassette.cs b/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/Internals/Cassette.cs new file mode 100644 index 0000000000..974cb72838 --- /dev/null +++ b/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/Internals/Cassette.cs @@ -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 InputData; + public Func 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) { } + } +} diff --git a/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/Internals/Cpu.Interface.cs b/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/Internals/Cpu.Interface.cs new file mode 100644 index 0000000000..036ac6cd85 --- /dev/null +++ b/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/Internals/Cpu.Interface.cs @@ -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 InputAddress; + public Func InputAEC; + public Func InputClock; + public Func InputData; + public Func InputIRQ; + public Func InputNMI; + public Func InputPort; + public Func InputRDY; + public Func 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) { } + } +} diff --git a/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/Internals/Cpu.Internal.cs b/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/Internals/Cpu.Internal.cs new file mode 100644 index 0000000000..e8cfbc0ce3 --- /dev/null +++ b/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/Internals/Cpu.Internal.cs @@ -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 + { + } +} diff --git a/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/Internals/Expansion.cs b/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/Internals/Expansion.cs new file mode 100644 index 0000000000..536551a77e --- /dev/null +++ b/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/Internals/Expansion.cs @@ -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 InputAddress; + public Func InputBA; + public Func InputData; + public Func InputDotClock; + public Func InputHiExpansion; + public Func InputHiRom; + public Func InputIRQ; + public Func InputLoExpansion; + public Func InputLoRom; + public Func InputNMI; + public Func InputRead; + public Func 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) { } + } +} diff --git a/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/Internals/Joystick.cs b/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/Internals/Joystick.cs new file mode 100644 index 0000000000..4039c03f75 --- /dev/null +++ b/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/Internals/Joystick.cs @@ -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) { } + } +} diff --git a/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/Internals/Keyboard.cs b/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/Internals/Keyboard.cs new file mode 100644 index 0000000000..bfedcff1ef --- /dev/null +++ b/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/Internals/Keyboard.cs @@ -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) { } + } +} diff --git a/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/Internals/Pla.cs b/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/Internals/Pla.cs new file mode 100644 index 0000000000..3247d3c225 --- /dev/null +++ b/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/Internals/Pla.cs @@ -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 InputAddress; + public Func InputAEC; + public Func InputBA; + public Func InputCAS; + public Func InputCharen; + public Func InputExRom; + public Func InputGame; + public Func InputHiRam; + public Func InputLoRam; + public Func InputRead; + public Func 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) { } + } +} diff --git a/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/Internals/Ram.cs b/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/Internals/Ram.cs new file mode 100644 index 0000000000..d9e4f77c4a --- /dev/null +++ b/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/Internals/Ram.cs @@ -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 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; + } + } +} diff --git a/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/Internals/Rom.cs b/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/Internals/Rom.cs new file mode 100644 index 0000000000..1568d57666 --- /dev/null +++ b/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/Internals/Rom.cs @@ -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 InputAddress; + public Func InputData; + public Func 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) { } + } +} diff --git a/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/Internals/Serial.cs b/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/Internals/Serial.cs new file mode 100644 index 0000000000..cc3ed9220b --- /dev/null +++ b/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/Internals/Serial.cs @@ -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 InputATN; + public Func InputClock; + public Func InputData; + public Func 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) { } + } +} diff --git a/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/Internals/Sid.Interface.cs b/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/Internals/Sid.Interface.cs new file mode 100644 index 0000000000..b08b0e2aa5 --- /dev/null +++ b/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/Internals/Sid.Interface.cs @@ -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 InputAddress; + public Func InputChipSelect; + public Func InputData; + public Func InputRead; + + public int Data { get { return 0xFF; } } + virtual public int OutputData() { return Data; } + virtual public void Precache() { } + virtual public void SyncState(Serializer ser) { } + } +} diff --git a/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/Internals/Sid.Internal.cs b/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/Internals/Sid.Internal.cs new file mode 100644 index 0000000000..52ee01bfa4 --- /dev/null +++ b/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/Internals/Sid.Internal.cs @@ -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 + { + } +} diff --git a/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/Internals/Vic.Interface.cs b/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/Internals/Vic.Interface.cs new file mode 100644 index 0000000000..f1e0c802c6 --- /dev/null +++ b/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/Internals/Vic.Interface.cs @@ -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 InputAddress; + public Func InputChipSelect; + public Func InputData; + public Func 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) { } + } +} diff --git a/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/Internals/Vic.Internal.cs b/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/Internals/Vic.Internal.cs new file mode 100644 index 0000000000..bc8a117824 --- /dev/null +++ b/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/Internals/Vic.Internal.cs @@ -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--; + + } + } +} diff --git a/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/MOS6569.cs b/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/MOS6569.cs new file mode 100644 index 0000000000..3d77b287c5 --- /dev/null +++ b/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/MOS6569.cs @@ -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() + { + } + } +} diff --git a/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/Ram2114.cs b/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/Ram2114.cs new file mode 100644 index 0000000000..04d4353edf --- /dev/null +++ b/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/Ram2114.cs @@ -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) { } + } +} diff --git a/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/Ram4864.cs b/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/Ram4864.cs new file mode 100644 index 0000000000..9769b11edf --- /dev/null +++ b/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/Ram4864.cs @@ -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) { } + } +} diff --git a/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/Rom2332.cs b/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/Rom2332.cs new file mode 100644 index 0000000000..4b166f39e6 --- /dev/null +++ b/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/Rom2332.cs @@ -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) { } + } +} diff --git a/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/Rom2364.cs b/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/Rom2364.cs new file mode 100644 index 0000000000..c0bc7797a5 --- /dev/null +++ b/BizHawk.Emulation/Computers/Commodore64/Experimental/Chips/Rom2364.cs @@ -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) { } + } +} diff --git a/BizHawk.Emulation/Computers/Commodore64/Experimental/IMotherboard.cs b/BizHawk.Emulation/Computers/Commodore64/Experimental/IMotherboard.cs new file mode 100644 index 0000000000..032d0b6aa3 --- /dev/null +++ b/BizHawk.Emulation/Computers/Commodore64/Experimental/IMotherboard.cs @@ -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); + } +} diff --git a/BizHawk.Emulation/Computers/Commodore64/Experimental/Vic.Interface.cs b/BizHawk.Emulation/Computers/Commodore64/Experimental/Vic.Interface.cs deleted file mode 100644 index bbd0041fc0..0000000000 --- a/BizHawk.Emulation/Computers/Commodore64/Experimental/Vic.Interface.cs +++ /dev/null @@ -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 InputAddress; - public Func InputChipSelect; - public Func 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(); - } - - /// - /// Desired 14-bit address from the VIC. - /// - public int OutputAddress() - { - return ADDR; - } - - /// - /// AEC pin output. - /// - public bool OutputAEC() - { - return AEC; - } - - /// - /// BA pin output. - /// - public bool OutputBA() - { - return BA; - } - - /// - /// CAS pin output. - /// - public bool OutputCAS() - { - return CAS; - } - - /// - /// 12-bit data output from the VIC. - /// - public int OutputData() - { - return DATA; - } - - /// - /// IRQ pin output. - /// - public bool OutputInterrupt() - { - return IRQ; - } - - /// - /// PHI0 pin output. - /// - public bool OutputPHI0() - { - return PHI0; - } - - /// - /// RAS pin output. - /// - public bool OutputRAS() - { - return RAS; - } - } -} diff --git a/BizHawk.Emulation/Computers/Commodore64/Experimental/Vic.Internal.cs b/BizHawk.Emulation/Computers/Commodore64/Experimental/Vic.Internal.cs deleted file mode 100644 index a72f11e794..0000000000 --- a/BizHawk.Emulation/Computers/Commodore64/Experimental/Vic.Internal.cs +++ /dev/null @@ -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--; - - } - } -}