EightBitNet/LR35902/LR35902.FuseTest/MemoryDatum.cs
Adrian Conlon ed92ce33f6 Starting to port Fuse test runner for LR35902 emulator. Not running yet.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2019-07-19 23:59:32 +01:00

35 lines
886 B
C#

namespace Fuse
{
using System;
using System.Collections.Generic;
public class MemoryDatum
{
public ushort Address { get; private set; } = (ushort)EightBit.Mask.Mask16;
public List<byte> Bytes { get; } = new List<byte>();
public void Parse(string line)
{
var tokens = line.Split(new char[] { ' ', '\t' });
this.Parse(tokens);
}
public void Parse(string[] tokens)
{
this.Address = Convert.ToUInt16(tokens[0], 16);
var finished = false;
for (var i = 1; !finished && (i < tokens.Length); ++i)
{
var token = tokens[i];
finished = token == "-1";
if (!finished)
{
this.Bytes.Add(Convert.ToByte(token, 16));
}
}
}
}
}