2017-11-24 18:43:04 +00:00
|
|
|
|
using System;
|
2018-03-08 16:50:56 +00:00
|
|
|
|
using System.Collections;
|
2017-11-24 18:43:04 +00:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|
|
|
|
{
|
2018-06-12 09:16:43 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Utilities
|
|
|
|
|
/// </summary>
|
2017-11-24 18:43:04 +00:00
|
|
|
|
public partial class ZXSpectrum
|
|
|
|
|
{
|
2018-03-08 16:50:56 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Helper method that returns a single INT32 from a BitArray
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="bitarray"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static int GetIntFromBitArray(BitArray bitArray)
|
|
|
|
|
{
|
|
|
|
|
if (bitArray.Length > 32)
|
|
|
|
|
throw new ArgumentException("Argument length shall be at most 32 bits.");
|
|
|
|
|
|
|
|
|
|
int[] array = new int[1];
|
|
|
|
|
bitArray.CopyTo(array, 0);
|
|
|
|
|
return array[0];
|
|
|
|
|
}
|
2018-06-12 09:16:43 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// POKEs a memory bus address
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="addr"></param>
|
|
|
|
|
/// <param name="value"></param>
|
|
|
|
|
public void PokeMemory(ushort addr, byte value)
|
|
|
|
|
{
|
|
|
|
|
_machine.WriteBus(addr, value);
|
|
|
|
|
}
|
2017-11-24 18:43:04 +00:00
|
|
|
|
}
|
|
|
|
|
}
|