commodore64: add SyncSoundProvider for SID, placeholder for 1541 disk drive and VIA I/O chip
This commit is contained in:
parent
98902b1a4a
commit
7bd469d514
|
@ -79,6 +79,7 @@
|
|||
<Link>VersionInfo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="Buffer.cs" />
|
||||
<Compile Include="Computers\Commodore64\1541.cs" />
|
||||
<Compile Include="Computers\Commodore64\C64.core.cs" />
|
||||
<Compile Include="Computers\Commodore64\C64.cs" />
|
||||
<Compile Include="Computers\Commodore64\C64.PeekPoke.cs" />
|
||||
|
@ -92,6 +93,7 @@
|
|||
<Compile Include="Computers\Commodore64\MemBus.cs" />
|
||||
<Compile Include="Computers\Commodore64\Sid.cs" />
|
||||
<Compile Include="Computers\Commodore64\SidSoundProvider.cs" />
|
||||
<Compile Include="Computers\Commodore64\Via.cs" />
|
||||
<Compile Include="Computers\Commodore64\VicII.cs" />
|
||||
<Compile Include="Computers\Commodore64\VicIIBackgroundGenerator.cs" />
|
||||
<Compile Include="Computers\Commodore64\VicIISpriteGenerator.cs" />
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
using BizHawk.Emulation.CPUs.M6502;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace BizHawk.Emulation.Computers.Commodore64
|
||||
{
|
||||
public class Drive1541
|
||||
{
|
||||
// the 1541 drive:
|
||||
//
|
||||
// 2kb ram, mapped 0000-07FF
|
||||
// two 6522 VIA chips, mapped at 1800 (communication to C64) and 1C00 (drive mechanics)
|
||||
|
||||
public MOS6502X cpu;
|
||||
public Via via0;
|
||||
public Via via1;
|
||||
|
||||
public Drive1541()
|
||||
{
|
||||
HardReset();
|
||||
}
|
||||
|
||||
public void HardReset()
|
||||
{
|
||||
cpu = new MOS6502X();
|
||||
via0 = new Via();
|
||||
via1 = new Via();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -45,7 +45,7 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
|||
}
|
||||
|
||||
/*TODO*/
|
||||
public ISyncSoundProvider SyncSoundProvider { get { return null; } } //TODO
|
||||
public ISyncSoundProvider SyncSoundProvider { get { return new SidSyncSoundProvider(sid); ; } }
|
||||
public bool StartAsyncSound() { return true; } //TODO
|
||||
public void EndAsyncSound() { } //TODO
|
||||
public bool DeterministicEmulation { get; set; } //TODO
|
||||
|
|
|
@ -19,6 +19,19 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
|||
ResetBuffer();
|
||||
}
|
||||
|
||||
public short[] GetAllSamples()
|
||||
{
|
||||
List<short> samples = new List<short>();
|
||||
while (sampleBufferReadIndex != sampleBufferIndex)
|
||||
{
|
||||
samples.Add(sampleBuffer[sampleBufferReadIndex]);
|
||||
sampleBufferReadIndex++;
|
||||
if (sampleBufferReadIndex == sampleBufferCapacity)
|
||||
sampleBufferReadIndex = 0;
|
||||
}
|
||||
return samples.ToArray();
|
||||
}
|
||||
|
||||
public void GetSamples(short[] samples)
|
||||
{
|
||||
int count = samples.Length;
|
||||
|
@ -87,4 +100,25 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
|||
sampleCounter--;
|
||||
}
|
||||
}
|
||||
|
||||
public class SidSyncSoundProvider : ISyncSoundProvider
|
||||
{
|
||||
private Sid sid;
|
||||
|
||||
public SidSyncSoundProvider(Sid source)
|
||||
{
|
||||
sid = source;
|
||||
}
|
||||
|
||||
public void DiscardSamples()
|
||||
{
|
||||
sid.DiscardSamples();
|
||||
}
|
||||
|
||||
public void GetSamples(out short[] samples, out int nsamp)
|
||||
{
|
||||
samples = sid.GetAllSamples();
|
||||
nsamp = samples.Length / 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace BizHawk.Emulation.Computers.Commodore64
|
||||
{
|
||||
// MOS Technologies VIA 6522
|
||||
// register count: 16
|
||||
// IO port count: 2
|
||||
|
||||
public class ViaRegs
|
||||
{
|
||||
public int ACR;
|
||||
public int IER;
|
||||
public int IFR;
|
||||
public int PCR;
|
||||
public int SR;
|
||||
public int[] TC;
|
||||
public int[] TL;
|
||||
}
|
||||
|
||||
public class Via
|
||||
{
|
||||
public ViaRegs regs;
|
||||
|
||||
public Via()
|
||||
{
|
||||
HardReset();
|
||||
}
|
||||
|
||||
public void HardReset()
|
||||
{
|
||||
regs = new ViaRegs();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue