commodore64: disk and tape framework added
This commit is contained in:
parent
cdd0e49726
commit
526ad358d1
|
@ -91,6 +91,8 @@
|
||||||
<Compile Include="Computers\Commodore64\Cartridge\Mapper0012.cs" />
|
<Compile Include="Computers\Commodore64\Cartridge\Mapper0012.cs" />
|
||||||
<Compile Include="Computers\Commodore64\Cartridge\Mapper0013.cs" />
|
<Compile Include="Computers\Commodore64\Cartridge\Mapper0013.cs" />
|
||||||
<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.PLA.cs" />
|
||||||
<Compile Include="Computers\Commodore64\Media\PRG.cs" />
|
<Compile Include="Computers\Commodore64\Media\PRG.cs" />
|
||||||
<Compile Include="Computers\Commodore64\Memory.cs" />
|
<Compile Include="Computers\Commodore64\Memory.cs" />
|
||||||
<Compile Include="Computers\Commodore64\Cartridge\Cart.cs" />
|
<Compile Include="Computers\Commodore64\Cartridge\Cart.cs" />
|
||||||
|
@ -119,6 +121,7 @@
|
||||||
<Compile Include="Computers\Commodore64\MOS\UserPort.cs" />
|
<Compile Include="Computers\Commodore64\MOS\UserPort.cs" />
|
||||||
<Compile Include="Computers\Commodore64\MOS\Vic.cs" />
|
<Compile Include="Computers\Commodore64\MOS\Vic.cs" />
|
||||||
<Compile Include="Computers\Commodore64\MOS\Vic.VideoProvider.cs" />
|
<Compile Include="Computers\Commodore64\MOS\Vic.VideoProvider.cs" />
|
||||||
|
<Compile Include="Computers\Commodore64\Tape\VIC1530.cs" />
|
||||||
<Compile Include="Consoles\Atari\2600\Atari2600.cs" />
|
<Compile Include="Consoles\Atari\2600\Atari2600.cs" />
|
||||||
<Compile Include="Consoles\Atari\2600\Atari2600.Core.cs" />
|
<Compile Include="Consoles\Atari\2600\Atari2600.Core.cs" />
|
||||||
<Compile Include="Consoles\Atari\2600\Mappers\m3Fe.cs" />
|
<Compile Include="Consoles\Atari\2600\Mappers\m3Fe.cs" />
|
||||||
|
@ -568,9 +571,7 @@
|
||||||
</BootstrapperPackage>
|
</BootstrapperPackage>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="Computers\Commodore64\Disk\" />
|
|
||||||
<Folder Include="Computers\Commodore64\Peripheral\" />
|
<Folder Include="Computers\Commodore64\Peripheral\" />
|
||||||
<Folder Include="Computers\Commodore64\Tape\" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup />
|
<ItemGroup />
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
using BizHawk.Emulation.CPUs.M6502;
|
using BizHawk.Emulation.CPUs.M6502;
|
||||||
using BizHawk.Emulation.Computers.Commodore64.Cartridge;
|
using BizHawk.Emulation.Computers.Commodore64.Cartridge;
|
||||||
|
using BizHawk.Emulation.Computers.Commodore64.Disk;
|
||||||
using BizHawk.Emulation.Computers.Commodore64.MOS;
|
using BizHawk.Emulation.Computers.Commodore64.MOS;
|
||||||
|
using BizHawk.Emulation.Computers.Commodore64.Tape;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
@ -33,6 +35,8 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
||||||
// ------------------------------------
|
// ------------------------------------
|
||||||
|
|
||||||
private Motherboard board;
|
private Motherboard board;
|
||||||
|
private VIC1541 disk;
|
||||||
|
private VIC1530 tape;
|
||||||
|
|
||||||
// ------------------------------------
|
// ------------------------------------
|
||||||
|
|
||||||
|
@ -45,6 +49,7 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
||||||
board = new Motherboard(initRegion);
|
board = new Motherboard(initRegion);
|
||||||
InitRoms();
|
InitRoms();
|
||||||
board.Init();
|
board.Init();
|
||||||
|
InitDisk(initRegion);
|
||||||
InitMedia();
|
InitMedia();
|
||||||
|
|
||||||
// configure video
|
// configure video
|
||||||
|
@ -52,6 +57,19 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
||||||
CoreOutputComm.VsyncNum = board.vic.CyclesPerSecond;
|
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()
|
private void InitMedia()
|
||||||
{
|
{
|
||||||
switch (extension.ToUpper())
|
switch (extension.ToUpper())
|
||||||
|
@ -79,6 +97,7 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
||||||
string basicFile = "basic";
|
string basicFile = "basic";
|
||||||
string charFile = "chargen";
|
string charFile = "chargen";
|
||||||
string kernalFile = "kernal";
|
string kernalFile = "kernal";
|
||||||
|
string diskFile = "dos1541";
|
||||||
|
|
||||||
string basicPath = Path.Combine(sourceFolder, basicFile);
|
string basicPath = Path.Combine(sourceFolder, basicFile);
|
||||||
string charPath = Path.Combine(sourceFolder, charFile);
|
string charPath = Path.Combine(sourceFolder, charFile);
|
||||||
|
|
|
@ -235,14 +235,6 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
||||||
serPort.DeviceWriteClock = ((bool val) => { cia1DataA = Port.ExternalWrite(cia1DataA, (byte)(cia1DataA | (val ? 0x40 : 0x00)), cia1DirA); });
|
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.DeviceWriteData = ((bool val) => { cia1DataA = Port.ExternalWrite(cia1DataA, (byte)(cia1DataA | (val ? 0x80 : 0x00)), cia1DirA); });
|
||||||
serPort.DeviceWriteSrq = ((bool val) => { cia0FlagSerial = val; cia0.FLAG = cia0FlagCassette & cia0FlagSerial; });
|
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.ReadPotX = (() => { return 0; });
|
||||||
sid.ReadPotY = (() => { return 0; });
|
sid.ReadPotY = (() => { return 0; });
|
||||||
|
|
|
@ -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
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
|
@ -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) => { });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -30,6 +30,26 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
||||||
|
|
||||||
// Connect() needs to set System functions above
|
// 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()
|
public void HardReset()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue