ZXHawk: codebase cleanup

This commit is contained in:
Asnivor 2018-06-14 11:31:09 +01:00
parent 76318fbc7a
commit 660fb500ae
74 changed files with 166 additions and 1420 deletions

View File

@ -274,14 +274,12 @@
<Compile Include="Computers\SinclairSpectrum\Hardware\Disk\NECUPD765.FDC.cs" />
<Compile Include="Computers\SinclairSpectrum\Hardware\Disk\NECUPD765.FDD.cs" />
<Compile Include="Computers\SinclairSpectrum\Hardware\Disk\NECUPD765.IPortIODevice.cs" />
<Compile Include="Computers\SinclairSpectrum\Hardware\Disk\NECUPD765.Registers.cs" />
<Compile Include="Computers\SinclairSpectrum\Hardware\Disk\NECUPD765.Timing.cs" />
<Compile Include="Computers\SinclairSpectrum\Hardware\Disk\NECUPS765.Static.cs" />
<Compile Include="Computers\SinclairSpectrum\Hardware\Input\CursorJoystick.cs" />
<Compile Include="Computers\SinclairSpectrum\Hardware\Input\SinclairJoystick2.cs" />
<Compile Include="Computers\SinclairSpectrum\Hardware\Input\SinclairJoystick1.cs" />
<Compile Include="Computers\SinclairSpectrum\Hardware\Input\NullJoystick.cs" />
<Compile Include="Computers\SinclairSpectrum\Hardware\SoundOuput\Buzzer.cs" />
<Compile Include="Computers\SinclairSpectrum\Hardware\Datacorder\DatacorderDevice.cs" />
<Compile Include="Computers\SinclairSpectrum\Hardware\Abstraction\IKeyboard.cs" />
<Compile Include="Computers\SinclairSpectrum\Hardware\Input\KempstonJoystick.cs" />
@ -314,7 +312,6 @@
<Compile Include="Computers\SinclairSpectrum\Machine\ZXSpectrum128K\ZX128.Port.cs" />
<Compile Include="Computers\SinclairSpectrum\Machine\ZXSpectrum48K\ZX48.cs" />
<Compile Include="Computers\SinclairSpectrum\Machine\ZXSpectrum48K\ZX48.Memory.cs" />
<Compile Include="Computers\SinclairSpectrum\Hardware\SoundOuput\Pulse.cs" />
<Compile Include="Computers\SinclairSpectrum\Hardware\Rom\RomData.cs" />
<Compile Include="Computers\SinclairSpectrum\ZXSpectrum.Controllers.cs" />
<Compile Include="Computers\SinclairSpectrum\ZXSpectrum.cs" />

View File

@ -1,22 +1,29 @@
using BizHawk.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
/// <summary>
/// Represents a beeper/buzzer device
/// </summary>
public interface IBeeperDevice
{
/// <summary>
/// Initialisation
/// </summary>
/// <param name="sampleRate"></param>
/// <param name="tStatesPerFrame"></param>
void Init(int sampleRate, int tStatesPerFrame);
/// <summary>
/// Processes an incoming pulse value and adds it to the blipbuffer
/// </summary>
/// <param name="pulse"></param>
void ProcessPulseValue(bool pulse);
void StartFrame();
void EndFrame();
/// <summary>
/// State serialization
/// </summary>
/// <param name="ser"></param>
void SyncState(Serializer ser);
}
}

View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
/// <summary>

View File

@ -1,10 +1,4 @@
using BizHawk.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
/// <summary>

View File

@ -1,6 +1,4 @@

using BizHawk.Common;
using BizHawk.Common;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
@ -77,8 +75,6 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
/// <returns></returns>
byte GetByteFromKeyMatrix(string key);
void SyncState(Serializer ser);
}
}

View File

@ -1,10 +1,5 @@
using BizHawk.Common;
using BizHawk.Emulation.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{

View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
/// <summary>

View File

@ -1,12 +1,9 @@
using BizHawk.Common;
using BizHawk.Emulation.Cores.Components.Z80A;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{

View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
/// <summary>

View File

@ -1,9 +1,5 @@
using BizHawk.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{

View File

@ -1,10 +1,7 @@
using BizHawk.Common.NumberExtensions;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{

View File

@ -1,10 +1,7 @@
using BizHawk.Common;
using BizHawk.Common.NumberExtensions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{

View File

@ -1,9 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
@ -20,6 +17,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
#endregion
public partial class NECUPD765 : IPortIODevice
{
#region Dev Logging
public string outputfile = @"D:\Dropbox\Dropbox\_Programming\TASVideos\BizHawk\output\zxhawkio-" + DateTime.Now.ToString("yyyyMMdd_HHmmss") + ".csv";
public string outputString = "STATUS,WRITE,READ,CODE,MT,MF,SK,CMDCNT,RESCNT,EXECCNT,EXECLEN\r\n";
@ -48,7 +46,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
}
sb.Append(ActiveCommand.CommandCode).Append(",");
sb.Append(CMD_FLAG_MT).Append(",");
sb.Append(CMD_FLAG_MF).Append(",");
sb.Append(CMD_FLAG_SK).Append(",");
@ -63,6 +61,8 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
outputString += sb.ToString();
}
#endregion
/// <summary>
/// Device responds to an IN instruction
/// </summary>

View File

@ -1,554 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
/// <summary>
/// Registers
/// </summary>
#region Attribution
/*
Implementation based on the information contained here:
http://www.cpcwiki.eu/index.php/765_FDC
and here:
http://www.cpcwiki.eu/imgs/f/f3/UPD765_Datasheet_OCRed.pdf
*/
#endregion
public partial class NECUPD765
{
/*
#region Main Status Register
/// <summary>
/// Main status register (accessed via reads to port 0x2ffd)
/// </summary>
private byte _RegMain;
/// <summary>
/// FDD0 Busy (seek/recalib active, until succesful sense intstat)
/// </summary>
private bool MainDB0
{
get { return GetBit(0, _RegMain); }
set
{
if (value) { SetBit(0, ref _RegMain); }
else { UnSetBit(0, ref _RegMain); }
}
}
/// <summary>
/// FDD1 Busy (seek/recalib active, until succesful sense intstat)
/// </summary>
private bool MainDB1
{
get { return GetBit(1, _RegMain); }
set
{
if (value) { SetBit(1, ref _RegMain); }
else { UnSetBit(1, ref _RegMain); }
}
}
/// <summary>
/// FDD2 Busy (seek/recalib active, until succesful sense intstat)
/// </summary>
private bool MainDB2
{
get { return GetBit(2, _RegMain); }
set
{
if (value) { SetBit(2, ref _RegMain); }
else { UnSetBit(2, ref _RegMain); }
}
}
/// <summary>
/// FDD3 Busy (seek/recalib active, until succesful sense intstat)
/// </summary>
private bool MainDB3
{
get { return GetBit(3, _RegMain); }
set
{
if (value) { SetBit(3, ref _RegMain); }
else { UnSetBit(3, ref _RegMain); }
}
}
/// <summary>
/// FDC Busy (still in command-, execution- or result-phase)
/// </summary>
private bool MainCB
{
get { return GetBit(4, _RegMain); }
set
{
if (value) { SetBit(4, ref _RegMain); }
else { UnSetBit(4, ref _RegMain); }
}
}
/// <summary>
/// Execution Mode (still in execution-phase, non_DMA_only)
/// </summary>
private bool MainEXM
{
get { return GetBit(5, _RegMain); }
set
{
if (value) { SetBit(5, ref _RegMain); }
else { UnSetBit(5, ref _RegMain); }
}
}
/// <summary>
/// Data Input/Output (0=CPU->FDC, 1=FDC->CPU) (see b7)
/// </summary>
private bool MainDIO
{
get { return GetBit(6, _RegMain); }
set
{
if (value) { SetBit(6, ref _RegMain); }
else { UnSetBit(6, ref _RegMain); }
}
}
/// <summary>
/// Request For Master (1=ready for next byte) (see b6 for direction)
/// </summary>
private bool MainRQM
{
get { return GetBit(7, _RegMain); }
set
{
if (value) { SetBit(7, ref _RegMain); }
else { UnSetBit(7, ref _RegMain); }
}
}
#endregion
#region Status Register 0
/// <summary>
/// Status Register 0
/// </summary>
private byte _Reg0;
/// <summary>
/// Unit Select (driveno during interrupt)
/// </summary>
private bool ST0US0
{
get { return GetBit(0, _Reg0); }
set
{
if (value) { SetBit(0, ref _Reg0); }
else { UnSetBit(0, ref _Reg0); }
}
}
/// <summary>
/// Unit Select (driveno during interrupt)
/// </summary>
private bool ST0US1
{
get { return GetBit(1, _Reg0); }
set
{
if (value) { SetBit(1, ref _Reg0); }
else { UnSetBit(1, ref _Reg0); }
}
}
/// <summary>
/// Head Address (head during interrupt)
/// </summary>
private bool ST0HD
{
get { return GetBit(2, _Reg0); }
set
{
if (value) { SetBit(2, ref _Reg0); }
else { UnSetBit(2, ref _Reg0); }
}
}
/// <summary>
/// Not Ready (drive not ready or non-existing 2nd head selected)
/// </summary>
private bool ST0NR
{
get { return GetBit(3, _Reg0); }
set
{
if (value) { SetBit(3, ref _Reg0); }
else { UnSetBit(3, ref _Reg0); }
}
}
/// <summary>
/// Equipment Check (drive failure or recalibrate failed (retry))
/// </summary>
private bool ST0EC
{
get { return GetBit(4, _Reg0); }
set
{
if (value) { SetBit(4, ref _Reg0); }
else { UnSetBit(4, ref _Reg0); }
}
}
/// <summary>
/// Seek End (Set if seek-command completed)
/// </summary>
private bool ST0SE
{
get { return GetBit(5, _Reg0); }
set
{
if (value) { SetBit(5, ref _Reg0); }
else { UnSetBit(5, ref _Reg0); }
}
}
/// <summary>
/// Interrupt Code (0=OK, 1=aborted:readfail/OK if EN, 2=unknown cmd
/// or senseint with no int occured, 3=aborted:disc removed etc.)
/// </summary>
private bool ST0IC0
{
get { return GetBit(6, _Reg0); }
set
{
if (value) { SetBit(6, ref _Reg0); }
else { UnSetBit(6, ref _Reg0); }
}
}
/// <summary>
/// Interrupt Code (0=OK, 1=aborted:readfail/OK if EN, 2=unknown cmd
/// or senseint with no int occured, 3=aborted:disc removed etc.)
/// </summary>
private bool ST0IC1
{
get { return GetBit(7, _Reg0); }
set
{
if (value) { SetBit(7, ref _Reg0); }
else { UnSetBit(7, ref _Reg0); }
}
}
#endregion
#region Status Register 1
/// <summary>
/// Status Register 1
/// </summary>
private byte _Reg1;
/// <summary>
/// Missing Address Mark (Sector_ID or DAM not found)
/// </summary>
private bool ST1MA
{
get { return GetBit(0, _Reg1); }
set
{
if (value) { SetBit(0, ref _Reg1); }
else { UnSetBit(0, ref _Reg1); }
}
}
/// <summary>
/// Not Writeable (tried to write/format disc with wprot_tab=on)
/// </summary>
private bool ST1NW
{
get { return GetBit(1, _Reg1); }
set
{
if (value) { SetBit(1, ref _Reg1); }
else { UnSetBit(1, ref _Reg1); }
}
}
/// <summary>
/// No Data (Sector_ID not found, CRC fail in ID_field)
/// </summary>
private bool ST1ND
{
get { return GetBit(2, _Reg1); }
set
{
if (value) { SetBit(2, ref _Reg1); }
else { UnSetBit(2, ref _Reg1); }
}
}
/// <summary>
/// Over Run (CPU too slow in execution-phase (ca. 26us/Byte))
/// </summary>
private bool ST1OR
{
get { return GetBit(4, _Reg1); }
set
{
if (value) { SetBit(4, ref _Reg1); }
else { UnSetBit(4, ref _Reg1); }
}
}
/// <summary>
/// Data Error (CRC-fail in ID- or Data-Field)
/// </summary>
private bool ST1DE
{
get { return GetBit(5, _Reg1); }
set
{
if (value) { SetBit(5, ref _Reg1); }
else { UnSetBit(5, ref _Reg1); }
}
}
/// <summary>
/// End of Track (set past most read/write commands) (see IC)
/// </summary>
private bool ST1EN
{
get { return GetBit(7, _Reg1); }
set
{
if (value) { SetBit(7, ref _Reg1); }
else { UnSetBit(7, ref _Reg1); }
}
}
#endregion
#region Status Register 2
/// <summary>
/// Status Register 2
/// </summary>
private byte _Reg2;
/// <summary>
/// Missing Address Mark in Data Field (DAM not found)
/// </summary>
private bool ST2MD
{
get { return GetBit(0, _Reg2); }
set
{
if (value) { SetBit(0, ref _Reg2); }
else { UnSetBit(0, ref _Reg2); }
}
}
/// <summary>
/// Bad Cylinder (read/programmed track-ID different and read-ID = FF)
/// </summary>
private bool ST2BC
{
get { return GetBit(1, _Reg2); }
set
{
if (value) { SetBit(1, ref _Reg2); }
else { UnSetBit(1, ref _Reg2); }
}
}
/// <summary>
/// Scan Not Satisfied (no fitting sector found)
/// </summary>
private bool ST2SN
{
get { return GetBit(2, _Reg2); }
set
{
if (value) { SetBit(2, ref _Reg2); }
else { UnSetBit(2, ref _Reg2); }
}
}
/// <summary>
/// Scan Equal Hit (equal)
/// </summary>
private bool ST2SH
{
get { return GetBit(3, _Reg2); }
set
{
if (value) { SetBit(3, ref _Reg2); }
else { UnSetBit(3, ref _Reg2); }
}
}
/// <summary>
/// Wrong Cylinder (read/programmed track-ID different) (see b1)
/// </summary>
private bool ST2WC
{
get { return GetBit(4, _Reg2); }
set
{
if (value) { SetBit(4, ref _Reg2); }
else { UnSetBit(4, ref _Reg2); }
}
}
/// <summary>
/// Data Error in Data Field (CRC-fail in data-field)
/// </summary>
private bool ST2DD
{
get { return GetBit(5, _Reg2); }
set
{
if (value) { SetBit(5, ref _Reg2); }
else { UnSetBit(5, ref _Reg2); }
}
}
/// <summary>
/// Control Mark (read/scan command found sector with deleted DAM)
/// </summary>
private bool ST2CM
{
get { return GetBit(6, _Reg2); }
set
{
if (value) { SetBit(6, ref _Reg2); }
else { UnSetBit(6, ref _Reg2); }
}
}
#endregion
#region Status Register 3
/// <summary>
/// Status Register 3
/// </summary>
private byte _Reg3;
/// <summary>
/// Unit Select (pin 28,29 of FDC)
/// </summary>
private bool ST3US0
{
get { return GetBit(0, _Reg3); }
set
{
if (value) { SetBit(0, ref _Reg3); }
else { UnSetBit(0, ref _Reg3); }
}
}
/// <summary>
/// Unit Select (pin 28,29 of FDC)
/// </summary>
private bool ST3US1
{
get { return GetBit(1, _Reg3); }
set
{
if (value) { SetBit(1, ref _Reg3); }
else { UnSetBit(1, ref _Reg3); }
}
}
/// <summary>
/// Head Address (pin 27 of FDC)
/// </summary>
private bool ST3HD
{
get { return GetBit(2, _Reg3); }
set
{
if (value) { SetBit(2, ref _Reg3); }
else { UnSetBit(2, ref _Reg3); }
}
}
/// <summary>
/// Two Side (0=yes, 1=no (!))
/// </summary>
private bool ST3TS
{
get { return GetBit(3, _Reg3); }
set
{
if (value) { SetBit(3, ref _Reg3); }
else { UnSetBit(3, ref _Reg3); }
}
}
/// <summary>
/// Track 0 (on track 0 we are)
/// </summary>
private bool ST3T0
{
get { return GetBit(4, _Reg3); }
set
{
if (value) { SetBit(4, ref _Reg3); }
else { UnSetBit(4, ref _Reg3); }
}
}
/// <summary>
/// Ready (drive ready signal)
/// </summary>
private bool ST3RY
{
get { return GetBit(5, _Reg3); }
set
{
if (value) { SetBit(5, ref _Reg3); }
else { UnSetBit(5, ref _Reg3); }
}
}
/// <summary>
/// Write Protected (write protected)
/// </summary>
private bool ST3WP
{
get { return GetBit(6, _Reg3); }
set
{
if (value) { SetBit(6, ref _Reg3); }
else { UnSetBit(6, ref _Reg3); }
}
}
/// <summary>
/// Fault (if supported: 1=Drive failure)
/// </summary>
private bool ST3FT
{
get { return GetBit(7, _Reg3); }
set
{
if (value) { SetBit(7, ref _Reg3); }
else { UnSetBit(7, ref _Reg3); }
}
}
#endregion
*/
}
}

View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
/// <summary>
@ -95,29 +90,6 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
StatesPerDriveTick = TStatesPerDriveCycle;
}
/*
/// <summary>
/// Called every cycle by the emulated machine
/// Simulates the floppy drive and updates execution phase bits
/// </summary>
public void RunCPUCycle()
{
// decrement tick counter
TickCounter--;
if (TickCounter > 0)
{
// not ready to emulate a floppy drive cycle yet
return;
}
// time to emulate a floppy drive cycle
// reset the tick counter
TickCounter = StatesPerDriveTick;
//RunDriveCycle();
}
*/
/// <summary>
/// Called by reads to the main status register
@ -144,9 +116,6 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
LastCPUCycle = CurrentCPUCycle;
return true;
}
}
}
}

View File

@ -1,10 +1,5 @@
using BizHawk.Common;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{

View File

@ -1,9 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{

View File

@ -1,9 +1,5 @@
using BizHawk.Common;
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{

View File

@ -1,9 +1,5 @@
using BizHawk.Common;
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{

View File

@ -1,9 +1,5 @@
using BizHawk.Common;
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{

View File

@ -1,9 +1,5 @@
using BizHawk.Common;
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{

View File

@ -1,9 +1,5 @@
using BizHawk.Common;
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{

View File

@ -2,8 +2,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
@ -95,118 +93,6 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
? (byte)(_keyLine[lineIndex] & ~lineMask)
: (byte)(_keyLine[lineIndex] | lineMask);
}
/*
if (isPressed)
{
switch (k)
{
// 0xfefe - 0 - 4
case 0: _keyLine[0] = (_keyLine[0] & ~(0x1)); break;
case 1: _keyLine[0] = (_keyLine[0] & ~(0x02)); break;
case 2: _keyLine[0] = (_keyLine[0] & ~(0x04)); break;
case 3: _keyLine[0] = (_keyLine[0] & ~(0x08)); break;
case 4: _keyLine[0] = (_keyLine[0] & ~(0x10)); break;
// 0xfdfe - 5 - 9
case 5: _keyLine[1] = (_keyLine[1] & ~(0x1)); break;
case 6: _keyLine[1] = (_keyLine[1] & ~(0x02)); break;
case 7: _keyLine[1] = (_keyLine[1] & ~(0x04)); break;
case 8: _keyLine[1] = (_keyLine[1] & ~(0x08)); break;
case 9: _keyLine[1] = (_keyLine[1] & ~(0x10)); break;
// 0xfbfe - 10 - 14
case 10: _keyLine[2] = (_keyLine[2] & ~(0x1)); break;
case 11: _keyLine[2] = (_keyLine[2] & ~(0x02)); break;
case 12: _keyLine[2] = (_keyLine[2] & ~(0x04)); break;
case 13: _keyLine[2] = (_keyLine[2] & ~(0x08)); break;
case 14: _keyLine[2] = (_keyLine[2] & ~(0x10)); break;
// 0xf7fe - 15 - 19
case 15: _keyLine[3] = (_keyLine[3] & ~(0x1)); break;
case 16: _keyLine[3] = (_keyLine[3] & ~(0x02)); break;
case 17: _keyLine[3] = (_keyLine[3] & ~(0x04)); break;
case 18: _keyLine[3] = (_keyLine[3] & ~(0x08)); break;
case 19: _keyLine[3] = (_keyLine[3] & ~(0x10)); break;
// 0xeffe - 20 - 24
case 20: _keyLine[4] = (_keyLine[4] & ~(0x1)); break;
case 21: _keyLine[4] = (_keyLine[4] & ~(0x02)); break;
case 22: _keyLine[4] = (_keyLine[4] & ~(0x04)); break;
case 23: _keyLine[4] = (_keyLine[4] & ~(0x08)); break;
case 24: _keyLine[4] = (_keyLine[4] & ~(0x10)); break;
// 0xdffe - 25 - 29
case 25: _keyLine[5] = (_keyLine[5] & ~(0x1)); break;
case 26: _keyLine[5] = (_keyLine[5] & ~(0x02)); break;
case 27: _keyLine[5] = (_keyLine[5] & ~(0x04)); break;
case 28: _keyLine[5] = (_keyLine[5] & ~(0x08)); break;
case 29: _keyLine[5] = (_keyLine[5] & ~(0x10)); break;
// 0xbffe - 30 - 34
case 30: _keyLine[6] = (_keyLine[6] & ~(0x1)); break;
case 31: _keyLine[6] = (_keyLine[6] & ~(0x02)); break;
case 32: _keyLine[6] = (_keyLine[6] & ~(0x04)); break;
case 33: _keyLine[6] = (_keyLine[6] & ~(0x08)); break;
case 34: _keyLine[6] = (_keyLine[6] & ~(0x10)); break;
// 0x7ffe - 35 - 39
case 35: _keyLine[7] = (_keyLine[7] & ~(0x1)); break;
case 36: _keyLine[7] = (_keyLine[7] & ~(0x02)); break;
case 37: _keyLine[7] = (_keyLine[7] & ~(0x04)); break;
case 38: _keyLine[7] = (_keyLine[7] & ~(0x08)); break;
case 39: _keyLine[7] = (_keyLine[7] & ~(0x10)); break;
}
}
else
{
switch (k)
{
// 0xfefe - 0 - 4
case 0: _keyLine[0] = (_keyLine[0] | (0x1)); break;
case 1: _keyLine[0] = (_keyLine[0] | (0x02)); break;
case 2: _keyLine[0] = (_keyLine[0] | (0x04)); break;
case 3: _keyLine[0] = (_keyLine[0] | (0x08)); break;
case 4: _keyLine[0] = (_keyLine[0] | (0x10)); break;
// 0xfdfe - 5 - 9
case 5: _keyLine[1] = (_keyLine[1] | (0x1)); break;
case 6: _keyLine[1] = (_keyLine[1] | (0x02)); break;
case 7: _keyLine[1] = (_keyLine[1] | (0x04)); break;
case 8: _keyLine[1] = (_keyLine[1] | (0x08)); break;
case 9: _keyLine[1] = (_keyLine[1] | (0x10)); break;
// 0xfbfe - 10 - 14
case 10: _keyLine[2] = (_keyLine[2] | (0x1)); break;
case 11: _keyLine[2] = (_keyLine[2] | (0x02)); break;
case 12: _keyLine[2] = (_keyLine[2] | (0x04)); break;
case 13: _keyLine[2] = (_keyLine[2] | (0x08)); break;
case 14: _keyLine[2] = (_keyLine[2] | (0x10)); break;
// 0xf7fe - 15 - 19
case 15: _keyLine[3] = (_keyLine[3] | (0x1)); break;
case 16: _keyLine[3] = (_keyLine[3] | (0x02)); break;
case 17: _keyLine[3] = (_keyLine[3] | (0x04)); break;
case 18: _keyLine[3] = (_keyLine[3] | (0x08)); break;
case 19: _keyLine[3] = (_keyLine[3] | (0x10)); break;
// 0xeffe - 20 - 24
case 20: _keyLine[4] = (_keyLine[4] | (0x1)); break;
case 21: _keyLine[4] = (_keyLine[4] | (0x02)); break;
case 22: _keyLine[4] = (_keyLine[4] | (0x04)); break;
case 23: _keyLine[4] = (_keyLine[4] | (0x08)); break;
case 24: _keyLine[4] = (_keyLine[4] | (0x10)); break;
// 0xdffe - 25 - 29
case 25: _keyLine[5] = (_keyLine[5] | (0x1)); break;
case 26: _keyLine[5] = (_keyLine[5] | (0x02)); break;
case 27: _keyLine[5] = (_keyLine[5] | (0x04)); break;
case 28: _keyLine[5] = (_keyLine[5] | (0x08)); break;
case 29: _keyLine[5] = (_keyLine[5] | (0x10)); break;
// 0xbffe - 30 - 34
case 30: _keyLine[6] = (_keyLine[6] | (0x1)); break;
case 31: _keyLine[6] = (_keyLine[6] | (0x02)); break;
case 32: _keyLine[6] = (_keyLine[6] | (0x04)); break;
case 33: _keyLine[6] = (_keyLine[6] | (0x08)); break;
case 34: _keyLine[6] = (_keyLine[6] | (0x10)); break;
// 0x7ffe - 35 - 39
case 35: _keyLine[7] = (_keyLine[7] | (0x1)); break;
case 36: _keyLine[7] = (_keyLine[7] | (0x02)); break;
case 37: _keyLine[7] = (_keyLine[7] | (0x04)); break;
case 38: _keyLine[7] = (_keyLine[7] | (0x08)); break;
case 39: _keyLine[7] = (_keyLine[7] | (0x10)); break;
}
}
*/
// Combination keys that are not in the keyboard matrix
// but are available on the Spectrum+, 128k +2 & +3
@ -284,21 +170,6 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
return result;
}
/*
switch (lines)
{
case 0xfe: return (byte)KeyLine[0];
case 0xfd: return (byte)KeyLine[1];
case 0xfb: return (byte)KeyLine[2];
case 0xf7: return (byte)KeyLine[3];
case 0xef: return (byte)KeyLine[4];
case 0xdf: return (byte)KeyLine[5];
case 0xbf: return (byte)KeyLine[6];
case 0x7f: return (byte)KeyLine[7];
default: return 0;
}
*/
}
public byte ReadKeyboardByte(ushort addr)

View File

@ -1,13 +1,9 @@
using BizHawk.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
/// <summary>
/// Information about spectrum ROM
/// </summary>
public class RomData
{
/// <summary>
@ -83,17 +79,5 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
return RD;
}
public void SyncState(Serializer ser)
{
ser.BeginSection("RomData");
ser.Sync("RomBytes", ref _romBytes, false);
ser.Sync("_saveBytesRoutineAddress", ref _saveBytesRoutineAddress);
ser.Sync("_loadBytesRoutineAddress", ref _loadBytesRoutineAddress);
ser.Sync("_saveBytesResumeAddress", ref _saveBytesResumeAddress);
ser.Sync("_loadBytesResumeAddress", ref _loadBytesResumeAddress);
ser.Sync("_loadBytesInvalidHeaderAddress", ref _loadBytesInvalidHeaderAddress);
ser.EndSection();
}
}
}

View File

@ -2,9 +2,6 @@
using BizHawk.Emulation.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{

View File

@ -1,10 +1,6 @@
using BizHawk.Common;
using BizHawk.Emulation.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
@ -166,19 +162,9 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
LastPulse = pulse;
}
public void StartFrame()
{
}
public void EndFrame()
{
}
#endregion
#region ISoundProvider
public bool CanProvideAsync => false;

View File

@ -1,325 +0,0 @@

using BizHawk.Common;
using BizHawk.Emulation.Common;
using System;
using System.Collections.Generic;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
/*
/// <summary>
/// Represents the piezoelectric buzzer used in the Spectrum to produce sound
/// The beeper is controlled by rapidly toggling bit 4 of port &FE
///
/// For the purposes of emulation this devices is locked to a frame
/// a list of Pulses is built up over the course of the frame and outputted at the end of the frame
///
/// ZXHawk instantiates multiples of these buzzers to achieve separation between tape and spectrum audio output
/// </summary>
public class Buzzer : ISoundProvider, IBeeperDevice
{
#region Fields and Properties
/// <summary>
/// Sample Rate
/// This usually has to be 44100 for ISoundProvider
/// </summary>
private int _sampleRate;
public int SampleRate
{
get { return _sampleRate; }
set { _sampleRate = value; }
}
/// <summary>
/// Number of samples in one frame
/// </summary>
private int _samplesPerFrame;
public int SamplesPerFrame
{
get { return _samplesPerFrame; }
set { _samplesPerFrame = value; }
}
/// <summary>
/// Number of TStates in each sample
/// </summary>
private int _tStatesPerSample;
public int TStatesPerSample
{
get { return _tStatesPerSample; }
set { _tStatesPerSample = value; }
}
/// <summary>
/// Buzzer volume
/// Accepts an int 0-100 value
/// </summary>
private int _volume;
public int Volume
{
get
{
return VolumeConverterOut(_volume);
}
set
{
_volume = VolumeConverterIn(value);
}
}
/// <summary>
/// The number of cpu cycles per frame
/// </summary>
private long _tStatesPerFrame;
/// <summary>
/// The cycle at which the frame starts
/// </summary>
private long _frameStart;
/// <summary>
/// The parent emulated machine
/// </summary>
private SpectrumBase _machine;
/// <summary>
/// Pulses collected during the last frame
/// </summary>
public List<Pulse> Pulses { get; private set; }
/// <summary>
/// The last pulse
/// </summary>
public bool LastPulse { get; set; }
/// <summary>
/// The last T-State (cpu cycle) that the last pulse was received
/// </summary>
public long LastPulseTState { get; set; }
#endregion
#region Private Methods
/// <summary>
/// Takes an int 0-100 and returns the relevant short volume to output
/// </summary>
/// <param name="vol"></param>
/// <returns></returns>
private int VolumeConverterIn(int vol)
{
int maxLimit = short.MaxValue / 3;
int increment = maxLimit / 100;
return vol * increment;
}
/// <summary>
/// Takes an short volume and returns the relevant int value 0-100
/// </summary>
/// <param name="vol"></param>
/// <returns></returns>
private int VolumeConverterOut(int shortvol)
{
int maxLimit = short.MaxValue / 3;
int increment = maxLimit / 100;
if (shortvol > maxLimit)
shortvol = maxLimit;
return shortvol / increment;
}
#endregion
#region Construction & Initialisation
public Buzzer(SpectrumBase machine)
{
_machine = machine;
}
/// <summary>
/// Initialises the buzzer
/// </summary>
public void Init(int sampleRate, int tStatesPerFrame)
{
_sampleRate = sampleRate;
_tStatesPerFrame = tStatesPerFrame;
_tStatesPerSample = 99; // 79;
_samplesPerFrame = 705; // 882; // (int)_tStatesPerFrame / _tStatesPerSample;
Pulses = new List<Pulse>(1000);
}
#endregion
#region IBeeperDevice
/// <summary>
/// When the pulse value changes it is processed here
/// </summary>
/// <param name="pulse"></param>
public void ProcessPulseValue(bool pulse)
{
if (!_machine._renderSound)
return;
if (pulse == LastPulse)
{
// no change detected
return;
}
// set the lastpulse
LastPulse = pulse;
// get where we are in the frame
var currentULACycle = _machine.CurrentFrameCycle;
var currentBuzzerCycle = currentULACycle <= _tStatesPerFrame ? currentULACycle : _tStatesPerFrame;
var length = currentBuzzerCycle - LastPulseTState;
if (length == 0)
{
// the first T-State has changed the pulse
// do not add it
}
else if (length > 0)
{
// add the pulse
Pulse p = new Pulse
{
State = !pulse,
Length = length
};
Pulses.Add(p);
}
// set the last pulse tstate
LastPulseTState = currentBuzzerCycle;
}
/// <summary>
/// New frame starts
/// </summary>
public void StartFrame()
{
Pulses.Clear();
LastPulseTState = 0;
}
/// <summary>
/// Frame is completed
/// </summary>
public void EndFrame()
{
// store the last pulse information
if (LastPulseTState <= _tStatesPerFrame - 1)
{
Pulse p = new Pulse
{
State = LastPulse,
Length = _tStatesPerFrame - LastPulseTState
};
Pulses.Add(p);
}
// create the sample array
var firstSampleOffset = _frameStart % TStatesPerSample == 0 ? 0 : TStatesPerSample - (_frameStart + TStatesPerSample) % TStatesPerSample;
var samplesInFrame = (_tStatesPerFrame - firstSampleOffset - 1) / TStatesPerSample + 1;
var samples = new short[samplesInFrame];
// convert pulses to samples
var sampleIndex = 0;
var currentEnd = _frameStart;
foreach (var pulse in Pulses)
{
var firstSample = currentEnd % TStatesPerSample == 0
? currentEnd : currentEnd + TStatesPerSample - currentEnd % TStatesPerSample;
for (var i = firstSample; i < currentEnd + pulse.Length; i += TStatesPerSample)
{
samples[sampleIndex++] = pulse.State ? (short)(_volume) : (short)0;
}
currentEnd += pulse.Length;
}
// fill the _sampleBuffer for ISoundProvider
soundBufferContains = (int)samplesInFrame;
if (soundBuffer.Length != soundBufferContains)
soundBuffer = new short[soundBufferContains];
samples.CopyTo(soundBuffer, 0);
_frameStart += _tStatesPerFrame;
}
#endregion
#region ISoundProvider
private short[] soundBuffer = new short[882];
private int soundBufferContains = 0;
public bool CanProvideAsync => false;
public SyncSoundMode SyncMode => SyncSoundMode.Sync;
public void SetSyncMode(SyncSoundMode mode)
{
if (mode != SyncSoundMode.Sync)
throw new InvalidOperationException("Only Sync mode is supported.");
}
public void GetSamplesAsync(short[] samples)
{
throw new NotSupportedException("Async is not available");
}
public void DiscardSamples()
{
soundBufferContains = 0;
soundBuffer = new short[SamplesPerFrame];
}
public void GetSamplesSync(out short[] samples, out int nsamp)
{
// convert to stereo
short[] stereoBuffer = new short[soundBufferContains * 2];
int index = 0;
for (int i = 0; i < soundBufferContains; i++)
{
stereoBuffer[index++] = soundBuffer[i];
stereoBuffer[index++] = soundBuffer[i];
}
samples = stereoBuffer;
nsamp = soundBufferContains; // _samplesPerFrame; // soundBufferContains;
}
#endregion
#region State Serialization
public void SyncState(Serializer ser)
{
ser.BeginSection("Buzzer");
ser.Sync("_frameStart", ref _frameStart);
ser.Sync("_tStatesPerFrame", ref _tStatesPerFrame);
ser.Sync("_sampleRate", ref _sampleRate);
ser.Sync("_samplesPerFrame", ref _samplesPerFrame);
ser.Sync("_tStatesPerSample", ref _tStatesPerSample);
ser.Sync("soundBuffer", ref soundBuffer, false);
ser.Sync("soundBufferContains", ref soundBufferContains);
ser.EndSection();
}
#endregion
}
*/
}

View File

@ -1,26 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
/// <summary>
/// The MIC and EAR pins in the spectrum deal in on/off pulses of varying lengths
/// This struct therefore represents 1 of these pulses
/// </summary>
public struct Pulse
{
/// <summary>
/// True: High State
/// False: Low State
/// </summary>
public bool State { get; set; }
/// <summary>
/// Pulse length in Z80 T-States (cycles)
/// </summary>
public long Length { get; set; }
}
}

View File

@ -1,13 +1,12 @@
using BizHawk.Common;
using BizHawk.Emulation.Cores.Components.Z80A;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
/// <summary>
/// An intermediary class that manages cycling the ULA and CPU
/// along with inherent Port and Memory contention
/// </summary>
public class CPUMonitor
{
#region Devices

View File

@ -1,11 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
/// <summary>
/// The various spectrum models ZXHawk emulates
/// </summary>
public enum MachineType
{
/// <summary>

View File

@ -1,11 +1,11 @@

using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
/// <summary>
/// Handles all ZX-level input
/// The abstract class that all emulated models will inherit from
/// * Input *
/// </summary>
public abstract partial class SpectrumBase
{

View File

@ -1,11 +1,13 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
/// <summary>
/// The abstract class that all emulated models will inherit from
/// * Imported media *
/// </summary>
public abstract partial class SpectrumBase
{
/// <summary>

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{

View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
/// <summary>

View File

@ -1,8 +1,5 @@
using BizHawk.Common;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Components.Z80A;
using System;
using System.Collections.Generic;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{

View File

@ -2,14 +2,11 @@
using BizHawk.Emulation.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
/// <summary>
/// 3rd attempt at a base ULA implementation
/// Uncommitted logic array implementation (ULA)
/// </summary>
public abstract class ULA : IVideoProvider
{

View File

@ -1,11 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
/// <summary>
/// 128K and +2 Memory
/// </summary>
public partial class ZX128 : SpectrumBase
{
/* 128k paging controlled by writes to port 0x7ffd

View File

@ -1,12 +1,11 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
/// <summary>
/// 128K/+2 Port
/// </summary>
public partial class ZX128 : SpectrumBase
{
/// <summary>

View File

@ -1,11 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
/// <summary>
/// 128K/+2 ULA
/// </summary>
class Screen128 : ULA
{
#region Construction

View File

@ -1,12 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Generic;
using BizHawk.Emulation.Cores.Components.Z80A;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
/// <summary>
/// 128K Constructor
/// </summary>
public partial class ZX128 : SpectrumBase
{
#region Construction
@ -28,9 +27,8 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
SHADOWPaged = false;
RAMPaged = 0;
PagingDisabled = false;
//ULADevice = new ULA128(this);
ULADevice = new Screen128(this); // still todo
ULADevice = new Screen128(this);
BuzzerDevice = new Beeper(this);
BuzzerDevice.Init(44100, ULADevice.FrameLength);
@ -51,7 +49,6 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
InitializeMedia(files);
}
#endregion
#endregion
}
}

View File

@ -1,9 +1,5 @@
using BizHawk.Emulation.Cores.Components.Z80A;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{

View File

@ -7,6 +7,9 @@ using System.Threading.Tasks;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
/// <summary>
/// +2A Memory
/// </summary>
public partial class ZX128Plus2a : SpectrumBase
{
/* http://www.worldofspectrum.org/faq/reference/128kreference.htm

View File

@ -1,12 +1,11 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
/// <summary>
/// +2a Port
/// </summary>
public partial class ZX128Plus2a : SpectrumBase
{
/// <summary>

View File

@ -1,11 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
/// <summary>
/// +2A/+3 ULA
/// </summary>
class Screen128Plus2a : ULA
{
#region Construction

View File

@ -1,12 +1,11 @@
using BizHawk.Emulation.Cores.Components.Z80A;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
/// <summary>
/// +2A Constructor
/// </summary>
public partial class ZX128Plus2a : SpectrumBase
{
#region Construction
@ -28,9 +27,8 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
SHADOWPaged = false;
RAMPaged = 0;
PagingDisabled = false;
//ULADevice = new ULAPlus2a(this);
ULADevice = new Screen128Plus2a(this); // still todo
ULADevice = new Screen128Plus2a(this);
BuzzerDevice = new Beeper(this);
BuzzerDevice.Init(44100, ULADevice.FrameLength);

View File

@ -7,6 +7,9 @@ using System.Threading.Tasks;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
/// <summary>
/// +3 Memory
/// </summary>
public partial class ZX128Plus3 : SpectrumBase
{
/* http://www.worldofspectrum.org/faq/reference/128kreference.htm

View File

@ -1,12 +1,11 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
/// <summary>
/// +3 Port
/// </summary>
public partial class ZX128Plus3 : SpectrumBase
{
/// <summary>

View File

@ -1,12 +1,11 @@
using BizHawk.Emulation.Cores.Components.Z80A;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
/// <summary>
/// +3 Constructor
/// </summary>
public partial class ZX128Plus3 : SpectrumBase
{
#region Construction
@ -29,9 +28,8 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
SHADOWPaged = false;
RAMPaged = 0;
PagingDisabled = false;
// ULADevice = new ULAPlus3(this);
ULADevice = new Screen128Plus2a(this); // still todo
ULADevice = new Screen128Plus2a(this);
BuzzerDevice = new Beeper(this);
BuzzerDevice.Init(44100, ULADevice.FrameLength);

View File

@ -1,12 +1,11 @@
using BizHawk.Emulation.Cores.Components.Z80A;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
/// <summary>
/// 16K is idential to 48K, just without the top 32KB of RAM
/// </summary>
public class ZX16 : ZX48
{
#region Construction

View File

@ -6,6 +6,9 @@ using System.Threading.Tasks;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
/// <summary>
/// 48K Memory
/// </summary>
public partial class ZX48 : SpectrumBase
{
/* 48K Spectrum has NO memory paging

View File

@ -1,11 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
/// <summary>
/// 48K Port
/// </summary>
public partial class ZX48 : SpectrumBase
{
/// <summary>

View File

@ -1,11 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
/// <summary>
/// 48K ULA
/// </summary>
class Screen48 : ULA
{
#region Construction

View File

@ -1,12 +1,12 @@
using BizHawk.Emulation.Cores.Components.Z80A;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
/// <summary>
/// 48K construction
/// </summary>
public partial class ZX48 : SpectrumBase
{
#region Construction

View File

@ -1,9 +1,4 @@
using BizHawk.Common.NumberExtensions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text;
using BizHawk.Common;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum

View File

@ -1,9 +1,4 @@
using BizHawk.Common.NumberExtensions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text;
using BizHawk.Common;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum

View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
/// <summary>

View File

@ -1,15 +1,13 @@
using BizHawk.Common;
using BizHawk.Common.NumberExtensions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
/// <summary>
/// This interface defines a logical floppy disk
/// This abstract class defines a logical floppy disk
/// </summary>
public abstract class FloppyDisk
{

View File

@ -1,13 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
/// <summary>
/// Abtract class that represents all Media Serializers
/// Abtract class that represents all Media Converters
/// </summary>
public abstract class MediaConverter
{

View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
/// <summary>

View File

@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{

View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
/// <summary>

View File

@ -1,9 +1,7 @@
using BizHawk.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{

View File

@ -1,9 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{

View File

@ -9,7 +9,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
/// My attempt at mixing multiple ISoundProvider sources together and outputting another ISoundProvider
/// Currently only supports SyncSoundMode.Sync
/// Attached ISoundProvider sources must already be stereo 44.1khz and ideally sound buffers should be the same length (882)
/// (if not, their buffer will be truncated/expanded)
/// (if not, only 882 samples of their buffer will be used)
/// </summary>
internal sealed class SoundProviderMixer : ISoundProvider
{
@ -209,6 +209,5 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
#endregion
}
}

View File

@ -1,13 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using BizHawk.Common;
using BizHawk.Common.ReflectionExtensions;
using System.Collections.Generic;
using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
/// <summary>
/// ZXHawk: Core Class
/// * Controllers *
/// </summary>
public partial class ZXSpectrum
{
/// <summary>
@ -125,38 +124,6 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
return definition;
}
}
/*
/// <summary>
/// Controller mapping includes all keyboard keys from the following models:
/// https://upload.wikimedia.org/wikipedia/commons/thumb/3/33/ZXSpectrum48k.jpg/1200px-ZXSpectrum48k.jpg
/// https://upload.wikimedia.org/wikipedia/commons/c/ca/ZX_Spectrum%2B.jpg
/// </summary>
public static readonly ControllerDefinition ZXSpectrumControllerDefinition = new ControllerDefinition
{
Name = "ZXSpectrum Controller",
BoolButtons =
{
// Kempston Joystick (P1)
"P1 Up", "P1 Down", "P1 Left", "P1 Right", "P1 Button",
// Keyboard - row 1
"Key True Video", "Key Inv Video", "Key 1", "Key 2", "Key 3", "Key 4", "Key 5", "Key 6", "Key 7", "Key 8", "Key 9", "Key 0", "Key Break",
// Keyboard - row 2
"Key Delete", "Key Graph", "Key Q", "Key W", "Key E", "Key R", "Key T", "Key Y", "Key U", "Key I", "Key O", "Key P",
// Keyboard - row 3
"Key Extend Mode", "Key Edit", "Key A", "Key S", "Key D", "Key F", "Key G", "Key H", "Key J", "Key K", "Key L", "Key Return",
// Keyboard - row 4
"Key Caps Shift", "Key Caps Lock", "Key Z", "Key X", "Key C", "Key V", "Key B", "Key N", "Key M", "Key Period",
// Keyboard - row 5
"Key Symbol Shift", "Key Semi-Colon", "Key Quote", "Key Left Cursor", "Key Right Cursor", "Key Space", "Key Up Cursor", "Key Down Cursor", "Key Comma",
// Tape functions
"Play Tape", "Stop Tape", "RTZ Tape", "Record Tape", "Insert Next Tape", "Insert Previous Tape", "Next Tape Block", "Prev Tape Block"
}
};
*/
}
/// <summary>

View File

@ -1,11 +1,13 @@
using System;
using System.Collections.Generic;
using BizHawk.Common.NumberExtensions;
using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
/// <summary>
/// ZXHawk: Core Class
/// * IDebugggable *
/// </summary>
public partial class ZXSpectrum : IDebuggable
{
public IDictionary<string, RegisterValue> GetCpuFlagsAndRegisters()

View File

@ -1,8 +1,11 @@
using BizHawk.Emulation.Common;
using BizHawk.Common.NumberExtensions;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
/// <summary>
/// ZXHawk: Core Class
/// * IEmulator *
/// </summary>
public partial class ZXSpectrum : IEmulator
{
public IEmulatorServiceProvider ServiceProvider { get; }
@ -60,8 +63,6 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
get { return deterministicEmulation; }
}
//public bool DeterministicEmulation => true;
public void ResetCounters()
{
_machine.FrameCount = 0;

View File

@ -1,9 +1,12 @@

using System;
using System;
using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
/// <summary>
/// ZXHawk: Core Class
/// * IInputPollable *
/// </summary>
public partial class ZXSpectrum : IInputPollable
{
public int LagCount

View File

@ -1,12 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
public partial class ZXSpectrum //: IMemoryDomains
/// <summary>
/// ZXHawk: Core Class
/// * Memory Domains *
/// </summary>
public partial class ZXSpectrum
{
internal IMemoryDomains memoryDomains;
private readonly Dictionary<string, MemoryDomainByteArray> _byteArrayDomains = new Dictionary<string, MemoryDomainByteArray>();

View File

@ -1,13 +1,14 @@
using System;
using Newtonsoft.Json;
using BizHawk.Common;
using BizHawk.Common;
using BizHawk.Emulation.Common;
using System.ComponentModel;
using System.Text;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
/// <summary>
/// ZXHawk: Core Class
/// * ISettable *
/// </summary>
public partial class ZXSpectrum : ISettable<ZXSpectrum.ZXSpectrumSettings, ZXSpectrum.ZXSpectrumSyncSettings>
{
internal ZXSpectrumSettings Settings = new ZXSpectrumSettings();
@ -150,6 +151,9 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
}
}
/// <summary>
/// Verbosity of the ZXHawk generated OSD messages
/// </summary>
public enum OSDVerbosity
{
/// <summary>

View File

@ -1,10 +1,13 @@
using System.IO;
using BizHawk.Common;
using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
/// <summary>
/// ZXHawk: Core Class
/// * IStatable *
/// </summary>
public partial class ZXSpectrum : IStatable
{
public bool BinarySaveStatesPreferred

View File

@ -1,13 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
/// <summary>
/// Handles all messaging (OSD) operations
/// ZXHawk: Core Class
/// * Handles all messaging (OSD) operations *
/// </summary>
public partial class ZXSpectrum
{

View File

@ -1,14 +1,11 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
/// <summary>
/// Utilities
/// ZXHawk: Core Class
/// * Misc Utilities *
/// </summary>
public partial class ZXSpectrum
{

View File

@ -1,6 +1,5 @@
using BizHawk.Common;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Components;
using BizHawk.Emulation.Cores.Components.Z80A;
using BizHawk.Emulation.Cores.Properties;
using System;
@ -10,6 +9,10 @@ using System.Linq;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
/// <summary>
/// ZXHawk: Core Class
/// * Main Initialization *
/// </summary>
[Core(
"ZXHawk",
"Asnivor, Alyosha",