public byte[] GetBytes(IArgumentSymbol symbol) { string src = symbol.Source.Remove(0, 1); int val; if (src[0] == '$') { if (src.Length > 3) { throw new Exception($"The hexidecimal argument on line {symbol.LineNumber} is invalid. It should represent a single byte ($00-$FF)"); } val = Convert.ToInt32(src.Substring(1), 16); } else { val = Convert.ToInt32(src); } if (val > byte.MaxValue) { throw new Exception($"The value of the argument on {symbol.LineNumber} is too large, it should be between 0-{byte.MaxValue}"); } return(new byte[1] { (byte)val }); }
public byte[] GetBytes(IArgumentSymbol symbol) { //$0000,Y string src = symbol.Source.Substring(1, 4); ushort val = Convert.ToUInt16(src, 16); return(BitConverter.GetBytes(val)); }
public byte[] GetBytes(IArgumentSymbol symbol) { //$00 string src = symbol.Source.Substring(1); return(new byte[1] { Convert.ToByte(src, 16) }); }
public bool TryGetPossibleDefine(IArgumentSymbol symbol, out KeyValuePair <string, string> pair) { foreach (var kv in _defines) { // TODO: Should do what the label repository does here if (symbol.Source.Contains(kv.Key)) { pair = kv; return(true); } } pair = default; return(false); }
public bool ShouldHandle(IArgumentSymbol symbol) { return(ArgumentSymbol.RegexAddressY.IsMatch(symbol.Source)); }
public bool ShouldHandle(IArgumentSymbol symbol) { return(ArgumentSymbol.RegexZeroPage.IsMatch(symbol.Source)); }
public bool ShouldHandle(IArgumentSymbol symbol) { return(ArgumentSymbol.RegexIndirect.IsMatch(symbol.Source)); }
public bool ShouldHandle(IArgumentSymbol symbol) { return(ArgumentSymbol.RegexLiteral.IsMatch(symbol.Source)); }
public bool TryGetPossibleLabel(IArgumentSymbol symbol, out KeyValuePair <string, ushort> pair) { return(TryGetPossibleLabel(symbol.Source, out pair)); }