diff --git a/BizHawk.Emulation/BizHawk.Emulation.csproj b/BizHawk.Emulation/BizHawk.Emulation.csproj
index 8292de32b8..6f6a10cd86 100644
--- a/BizHawk.Emulation/BizHawk.Emulation.csproj
+++ b/BizHawk.Emulation/BizHawk.Emulation.csproj
@@ -91,6 +91,8 @@
+
+
@@ -119,6 +121,7 @@
+
@@ -568,9 +571,7 @@
-
-
diff --git a/BizHawk.Emulation/Computers/Commodore64/C64.Core.cs b/BizHawk.Emulation/Computers/Commodore64/C64.Core.cs
index d1eff4afce..12a75c6146 100644
--- a/BizHawk.Emulation/Computers/Commodore64/C64.Core.cs
+++ b/BizHawk.Emulation/Computers/Commodore64/C64.Core.cs
@@ -1,6 +1,8 @@
using BizHawk.Emulation.CPUs.M6502;
using BizHawk.Emulation.Computers.Commodore64.Cartridge;
+using BizHawk.Emulation.Computers.Commodore64.Disk;
using BizHawk.Emulation.Computers.Commodore64.MOS;
+using BizHawk.Emulation.Computers.Commodore64.Tape;
using System;
using System.Collections.Generic;
using System.IO;
@@ -33,6 +35,8 @@ namespace BizHawk.Emulation.Computers.Commodore64
// ------------------------------------
private Motherboard board;
+ private VIC1541 disk;
+ private VIC1530 tape;
// ------------------------------------
@@ -45,6 +49,7 @@ namespace BizHawk.Emulation.Computers.Commodore64
board = new Motherboard(initRegion);
InitRoms();
board.Init();
+ InitDisk(initRegion);
InitMedia();
// configure video
@@ -52,6 +57,19 @@ namespace BizHawk.Emulation.Computers.Commodore64
CoreOutputComm.VsyncNum = board.vic.CyclesPerSecond;
}
+ private void InitDisk(Region initRegion)
+ {
+ string sourceFolder = CoreInputComm.C64_FirmwaresPath;
+ if (sourceFolder == null)
+ sourceFolder = @".\C64\Firmwares";
+ string diskFile = "dos1541";
+ string diskPath = Path.Combine(sourceFolder, diskFile);
+ if (!File.Exists(diskPath)) HandleFirmwareError(diskFile);
+ byte[] diskRom = File.ReadAllBytes(diskPath);
+
+ disk = new VIC1541(initRegion, diskRom);
+ }
+
private void InitMedia()
{
switch (extension.ToUpper())
@@ -79,6 +97,7 @@ namespace BizHawk.Emulation.Computers.Commodore64
string basicFile = "basic";
string charFile = "chargen";
string kernalFile = "kernal";
+ string diskFile = "dos1541";
string basicPath = Path.Combine(sourceFolder, basicFile);
string charPath = Path.Combine(sourceFolder, charFile);
@@ -91,7 +110,7 @@ namespace BizHawk.Emulation.Computers.Commodore64
byte[] basicRom = File.ReadAllBytes(basicPath);
byte[] charRom = File.ReadAllBytes(charPath);
byte[] kernalRom = File.ReadAllBytes(kernalPath);
-
+
board.basicRom = new Chip23XX(Chip23XXmodel.Chip2364, basicRom);
board.kernalRom = new Chip23XX(Chip23XXmodel.Chip2364, kernalRom);
board.charRom = new Chip23XX(Chip23XXmodel.Chip2332, charRom);
diff --git a/BizHawk.Emulation/Computers/Commodore64/C64.Motherboard.cs b/BizHawk.Emulation/Computers/Commodore64/C64.Motherboard.cs
index 31d5324c66..966deeb679 100644
--- a/BizHawk.Emulation/Computers/Commodore64/C64.Motherboard.cs
+++ b/BizHawk.Emulation/Computers/Commodore64/C64.Motherboard.cs
@@ -235,14 +235,6 @@ namespace BizHawk.Emulation.Computers.Commodore64
serPort.DeviceWriteClock = ((bool val) => { cia1DataA = Port.ExternalWrite(cia1DataA, (byte)(cia1DataA | (val ? 0x40 : 0x00)), cia1DirA); });
serPort.DeviceWriteData = ((bool val) => { cia1DataA = Port.ExternalWrite(cia1DataA, (byte)(cia1DataA | (val ? 0x80 : 0x00)), cia1DirA); });
serPort.DeviceWriteSrq = ((bool val) => { cia0FlagSerial = val; cia0.FLAG = cia0FlagCassette & cia0FlagSerial; });
- serPort.SystemReadAtn = (() => { return true; });
- serPort.SystemReadClock = (() => { return true; });
- serPort.SystemReadData = (() => { return true; });
- serPort.SystemReadSrq = (() => { return true; });
- serPort.SystemWriteAtn = ((bool val) => { });
- serPort.SystemWriteClock = ((bool val) => { });
- serPort.SystemWriteData = ((bool val) => { });
- serPort.SystemWriteReset = ((bool val) => { });
sid.ReadPotX = (() => { return 0; });
sid.ReadPotY = (() => { return 0; });
diff --git a/BizHawk.Emulation/Computers/Commodore64/Disk/VIC1541.PLA.cs b/BizHawk.Emulation/Computers/Commodore64/Disk/VIC1541.PLA.cs
new file mode 100644
index 0000000000..c15c84d7e5
--- /dev/null
+++ b/BizHawk.Emulation/Computers/Commodore64/Disk/VIC1541.PLA.cs
@@ -0,0 +1,11 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace BizHawk.Emulation.Computers.Commodore64.Disk
+{
+ public class VIC1541PLA
+ {
+ }
+}
diff --git a/BizHawk.Emulation/Computers/Commodore64/Disk/VIC1541.cs b/BizHawk.Emulation/Computers/Commodore64/Disk/VIC1541.cs
new file mode 100644
index 0000000000..b0b175bf3c
--- /dev/null
+++ b/BizHawk.Emulation/Computers/Commodore64/Disk/VIC1541.cs
@@ -0,0 +1,59 @@
+using BizHawk.Emulation.CPUs.M6502;
+using BizHawk.Emulation.Computers.Commodore64.MOS;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace BizHawk.Emulation.Computers.Commodore64.Disk
+{
+ public class VIC1541
+ {
+ public VIC1541Motherboard board;
+
+ public VIC1541(Region initRegion, byte[] rom)
+ {
+ board = new VIC1541Motherboard(initRegion);
+ }
+
+ public void ConnectSerial(SerialPort newSerialPort)
+ {
+ board.Connect(newSerialPort);
+ }
+
+ public void Execute()
+ {
+ }
+ }
+
+ public class VIC1541Motherboard
+ {
+ public MOS6502X cpu;
+ public VIC1541PLA pla;
+ public SerialPort serPort;
+ public MOS6522 via0;
+ public MOS6522 via1;
+
+ public VIC1541Motherboard(Region initRegion)
+ {
+ cpu = new MOS6502X();
+ pla = new VIC1541PLA();
+ serPort = new SerialPort();
+ via0 = new MOS6522();
+ via1 = new MOS6522();
+ }
+
+ public void Connect(SerialPort newSerPort)
+ {
+ serPort = newSerPort;
+ serPort.SystemReadAtn = (() => { return true; });
+ serPort.SystemReadClock = (() => { return true; });
+ serPort.SystemReadData = (() => { return true; });
+ serPort.SystemReadSrq = (() => { return true; });
+ serPort.SystemWriteAtn = ((bool val) => { });
+ serPort.SystemWriteClock = ((bool val) => { });
+ serPort.SystemWriteData = ((bool val) => { });
+ serPort.SystemWriteReset = ((bool val) => { });
+ }
+ }
+}
diff --git a/BizHawk.Emulation/Computers/Commodore64/MOS/SerialPort.cs b/BizHawk.Emulation/Computers/Commodore64/MOS/SerialPort.cs
index 267ba2345c..daf07102c8 100644
--- a/BizHawk.Emulation/Computers/Commodore64/MOS/SerialPort.cs
+++ b/BizHawk.Emulation/Computers/Commodore64/MOS/SerialPort.cs
@@ -30,6 +30,26 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
// Connect() needs to set System functions above
+ 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()
{
}
diff --git a/BizHawk.Emulation/Computers/Commodore64/Tape/VIC1530.cs b/BizHawk.Emulation/Computers/Commodore64/Tape/VIC1530.cs
new file mode 100644
index 0000000000..56e73f3c64
--- /dev/null
+++ b/BizHawk.Emulation/Computers/Commodore64/Tape/VIC1530.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace BizHawk.Emulation.Computers.Commodore64.Tape
+{
+ // common tape drive that works with the C64.
+
+ public class VIC1530
+ {
+ }
+}