Apple II - some reorg
This commit is contained in:
parent
748e770ba7
commit
9f02fd75af
|
@ -116,6 +116,15 @@
|
|||
</Compile>
|
||||
<Compile Include="Calculator\TI83LinkPort.cs" />
|
||||
<Compile Include="Computers\AppleII\AppleII.cs" />
|
||||
<Compile Include="Computers\AppleII\AppleII.IEmulator.cs">
|
||||
<DependentUpon>AppleII.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Computers\AppleII\AppleII.IStatable.cs">
|
||||
<DependentUpon>AppleII.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Computers\AppleII\AppleII.IVideoProvider.cs">
|
||||
<DependentUpon>AppleII.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Computers\AppleII\Virtu\Cassette.cs" />
|
||||
<Compile Include="Computers\AppleII\Virtu\Cpu.cs" />
|
||||
<Compile Include="Computers\AppleII\Virtu\CpuData.cs" />
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Emulation.Cores.Computers.AppleII
|
||||
{
|
||||
public partial class AppleII : IEmulator
|
||||
{
|
||||
public IEmulatorServiceProvider ServiceProvider { get; private set; }
|
||||
|
||||
[FeatureNotImplemented]
|
||||
public ISoundProvider SoundProvider
|
||||
{
|
||||
get { return NullSound.SilenceProvider; }
|
||||
}
|
||||
|
||||
[FeatureNotImplemented]
|
||||
public ISyncSoundProvider SyncSoundProvider
|
||||
{
|
||||
get { return new FakeSyncSound(NullSound.SilenceProvider, 735); }
|
||||
}
|
||||
|
||||
[FeatureNotImplemented]
|
||||
public bool StartAsyncSound()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
[FeatureNotImplemented]
|
||||
public void EndAsyncSound() { }
|
||||
|
||||
public ControllerDefinition ControllerDefinition
|
||||
{
|
||||
get { return AppleIIController; }
|
||||
}
|
||||
|
||||
public IController Controller { get; set; }
|
||||
|
||||
|
||||
public int Frame { get; set; }
|
||||
|
||||
public string SystemId { get { return "AppleII"; } }
|
||||
|
||||
public bool DeterministicEmulation { get { return true; } }
|
||||
|
||||
public void FrameAdvance(bool render, bool rendersound)
|
||||
{
|
||||
FrameAdv(render, rendersound);
|
||||
}
|
||||
|
||||
public string BoardName { get { return null; } }
|
||||
|
||||
public void ResetCounters()
|
||||
{
|
||||
Frame = 0;
|
||||
}
|
||||
|
||||
public CoreComm CoreComm { get; private set; }
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_machine.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
using BizHawk.Emulation.Common;
|
||||
using System.IO;
|
||||
|
||||
namespace BizHawk.Emulation.Cores.Computers.AppleII
|
||||
{
|
||||
public partial class AppleII : IStatable
|
||||
{
|
||||
public bool BinarySaveStatesPreferred { get { return true; } }
|
||||
|
||||
[FeatureNotImplemented]
|
||||
public void SaveStateText(TextWriter writer)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[FeatureNotImplemented]
|
||||
public void LoadStateText(TextReader reader)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void SaveStateBinary(BinaryWriter writer)
|
||||
{
|
||||
_machine.SaveState(writer);
|
||||
}
|
||||
|
||||
public void LoadStateBinary(BinaryReader reader)
|
||||
{
|
||||
_machine.LoadState(reader);
|
||||
}
|
||||
|
||||
public byte[] SaveStateBinary()
|
||||
{
|
||||
if (_stateBuffer == null)
|
||||
{
|
||||
var stream = new MemoryStream();
|
||||
var writer = new BinaryWriter(stream);
|
||||
SaveStateBinary(writer);
|
||||
_stateBuffer = stream.ToArray();
|
||||
writer.Close();
|
||||
return _stateBuffer;
|
||||
}
|
||||
else
|
||||
{
|
||||
var stream = new MemoryStream(_stateBuffer);
|
||||
var writer = new BinaryWriter(stream);
|
||||
SaveStateBinary(writer);
|
||||
writer.Close();
|
||||
return _stateBuffer;
|
||||
}
|
||||
}
|
||||
|
||||
private byte[] _stateBuffer;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
using BizHawk.Emulation.Common;
|
||||
using Jellyfish.Virtu;
|
||||
|
||||
namespace BizHawk.Emulation.Cores.Computers.AppleII
|
||||
{
|
||||
public partial class AppleII
|
||||
{
|
||||
public class BizVideoService : Jellyfish.Virtu.Services.VideoService, IVideoProvider
|
||||
{
|
||||
public int[] fb;
|
||||
|
||||
int[] IVideoProvider.GetVideoBuffer() { return fb; }
|
||||
|
||||
// put together, these describe a metric on the screen
|
||||
// they should define the smallest size that the buffer can be placed inside such that:
|
||||
// 1. no actual pixel data is lost
|
||||
// 2. aspect ratio is accurate
|
||||
int IVideoProvider.VirtualWidth { get { return 560; } }
|
||||
int IVideoProvider.VirtualHeight { get { return 384; } }
|
||||
|
||||
int IVideoProvider.BufferWidth { get { return 560; } }
|
||||
int IVideoProvider.BufferHeight { get { return 384; } }
|
||||
int IVideoProvider.BackgroundColor { get { return 0; } }
|
||||
|
||||
public BizVideoService(Machine machine) :
|
||||
base(machine)
|
||||
{
|
||||
fb = new int[560 * 384];
|
||||
}
|
||||
|
||||
public override void SetFullScreen(bool isFullScreen)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void SetPixel(int x, int y, uint color)
|
||||
{
|
||||
int i = 560 * y + x;
|
||||
fb[i] = fb[i + 560] = (int)color;
|
||||
}
|
||||
public override void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
using System.IO;
|
||||
using BizHawk.Emulation.Common;
|
||||
using Jellyfish.Virtu;
|
||||
using Jellyfish.Virtu.Services;
|
||||
|
||||
namespace BizHawk.Emulation.Cores.Computers.AppleII
|
||||
{
|
||||
|
@ -50,62 +51,6 @@ namespace BizHawk.Emulation.Cores.Computers.AppleII
|
|||
Jellyfish.Virtu.Services.StorageService.LoadFile(ms, stream => _machine.BootDiskII.Drives[0].InsertDisk("junk.dsk", stream, writeProtected));
|
||||
}
|
||||
|
||||
class BizKeyboardService : Jellyfish.Virtu.Services.KeyboardService
|
||||
{
|
||||
public BizKeyboardService(Machine _machine) : base(_machine) { }
|
||||
public override bool IsKeyDown(int key)
|
||||
{
|
||||
return key > 0;
|
||||
}
|
||||
}
|
||||
|
||||
class BizAudioService : Jellyfish.Virtu.Services.AudioService
|
||||
{
|
||||
public BizAudioService(Machine _machine) : base(_machine) { }
|
||||
public override void SetVolume(float volume)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class BizVideoService : Jellyfish.Virtu.Services.VideoService, IVideoProvider
|
||||
{
|
||||
public int[] fb;
|
||||
|
||||
int[] IVideoProvider.GetVideoBuffer() { return fb; }
|
||||
|
||||
// put together, these describe a metric on the screen
|
||||
// they should define the smallest size that the buffer can be placed inside such that:
|
||||
// 1. no actual pixel data is lost
|
||||
// 2. aspect ratio is accurate
|
||||
int IVideoProvider.VirtualWidth { get { return 560; } }
|
||||
int IVideoProvider.VirtualHeight { get { return 384; } }
|
||||
|
||||
int IVideoProvider.BufferWidth { get { return 560; } }
|
||||
int IVideoProvider.BufferHeight { get { return 384; } }
|
||||
int IVideoProvider.BackgroundColor { get { return 0; } }
|
||||
|
||||
public BizVideoService(Machine machine) :
|
||||
base(machine)
|
||||
{
|
||||
fb = new int[560*384];
|
||||
}
|
||||
|
||||
public override void SetFullScreen(bool isFullScreen)
|
||||
{
|
||||
}
|
||||
|
||||
public override void SetPixel(int x, int y, uint color)
|
||||
{
|
||||
int i = 560 * y + x;
|
||||
fb[i] = fb[i + 560] = (int)color;
|
||||
}
|
||||
public override void Update()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private readonly Machine _machine;
|
||||
private readonly byte[] _disk1;
|
||||
private readonly byte[] _appleIIRom;
|
||||
|
@ -120,7 +65,6 @@ namespace BizHawk.Emulation.Cores.Computers.AppleII
|
|||
"Up", "Down", "Left", "Right",
|
||||
"Tab", "Enter", "Escape", "Back", "Space",
|
||||
"Ctrl", "Shift", "Caps",
|
||||
//there has got to be a better way than assigning every one of these manually
|
||||
"1", "2", "3", "4", "5", "6", "7", "8", "9", "0",
|
||||
"A", "B", "C", "D", "E", "F", "G", "H", "I",
|
||||
"J", "K", "L", "M", "N", "O", "P", "Q", "R",
|
||||
|
@ -128,6 +72,24 @@ namespace BizHawk.Emulation.Cores.Computers.AppleII
|
|||
}
|
||||
};
|
||||
|
||||
private class BizKeyboardService : KeyboardService
|
||||
{
|
||||
public BizKeyboardService(Machine _machine) : base(_machine) { }
|
||||
public override bool IsKeyDown(int key)
|
||||
{
|
||||
return key > 0;
|
||||
}
|
||||
}
|
||||
|
||||
private class BizAudioService : AudioService
|
||||
{
|
||||
public BizAudioService(Machine _machine) : base(_machine) { }
|
||||
public override void SetVolume(float volume)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void FrameAdv(bool render, bool rendersound)
|
||||
{
|
||||
_machine.Buttons = GetButtons();
|
||||
|
@ -135,41 +97,7 @@ namespace BizHawk.Emulation.Cores.Computers.AppleII
|
|||
Frame++;
|
||||
}
|
||||
|
||||
#region IEmulator
|
||||
|
||||
public IEmulatorServiceProvider ServiceProvider { get; private set; }
|
||||
|
||||
[FeatureNotImplemented]
|
||||
public ISoundProvider SoundProvider
|
||||
{
|
||||
get { return NullSound.SilenceProvider; }
|
||||
}
|
||||
|
||||
[FeatureNotImplemented]
|
||||
public ISyncSoundProvider SyncSoundProvider
|
||||
{
|
||||
get { return new FakeSyncSound(NullSound.SilenceProvider, 735); }
|
||||
}
|
||||
|
||||
[FeatureNotImplemented]
|
||||
public bool StartAsyncSound()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
[FeatureNotImplemented]
|
||||
public void EndAsyncSound() { }
|
||||
|
||||
public ControllerDefinition ControllerDefinition
|
||||
{
|
||||
get { return AppleIIController; }
|
||||
}
|
||||
|
||||
public IController Controller { get; set; }
|
||||
|
||||
|
||||
|
||||
Jellyfish.Virtu.Buttons GetButtons()
|
||||
private Buttons GetButtons()
|
||||
{
|
||||
Jellyfish.Virtu.Buttons ret = 0;
|
||||
if (Controller["Up"]) ret |= Jellyfish.Virtu.Buttons.Up;
|
||||
|
@ -223,84 +151,5 @@ namespace BizHawk.Emulation.Cores.Computers.AppleII
|
|||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public int Frame { get; set; }
|
||||
|
||||
[FeatureNotImplemented]
|
||||
public void FrameAdvance(bool render, bool rendersound)
|
||||
{
|
||||
FrameAdv(render, rendersound);
|
||||
}
|
||||
|
||||
public string SystemId { get { return "AppleII"; } }
|
||||
|
||||
public bool DeterministicEmulation { get { return true; } }
|
||||
|
||||
public string BoardName { get { return null; } }
|
||||
|
||||
public void ResetCounters()
|
||||
{
|
||||
Frame = 0;
|
||||
}
|
||||
|
||||
public CoreComm CoreComm { get; private set; }
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_machine.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IStatable
|
||||
|
||||
public bool BinarySaveStatesPreferred { get { return true; } }
|
||||
|
||||
[FeatureNotImplemented]
|
||||
public void SaveStateText(TextWriter writer)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[FeatureNotImplemented]
|
||||
public void LoadStateText(TextReader reader)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void SaveStateBinary(BinaryWriter writer)
|
||||
{
|
||||
_machine.SaveState(writer);
|
||||
}
|
||||
|
||||
public void LoadStateBinary(BinaryReader reader)
|
||||
{
|
||||
_machine.LoadState(reader);
|
||||
}
|
||||
|
||||
public byte[] SaveStateBinary()
|
||||
{
|
||||
if (_stateBuffer == null)
|
||||
{
|
||||
var stream = new MemoryStream();
|
||||
var writer = new BinaryWriter(stream);
|
||||
SaveStateBinary(writer);
|
||||
_stateBuffer = stream.ToArray();
|
||||
writer.Close();
|
||||
return _stateBuffer;
|
||||
}
|
||||
else
|
||||
{
|
||||
var stream = new MemoryStream(_stateBuffer);
|
||||
var writer = new BinaryWriter(stream);
|
||||
SaveStateBinary(writer);
|
||||
writer.Close();
|
||||
return _stateBuffer;
|
||||
}
|
||||
}
|
||||
|
||||
private byte[] _stateBuffer;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ namespace Jellyfish.Virtu.Services
|
|||
}
|
||||
}
|
||||
|
||||
static int t = 0;
|
||||
//static int t = 0;
|
||||
|
||||
private void UpdateKey(ulong key, bool isActive, ref bool isKeyDown, ref bool wasKeyDown)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue