protected void HandleMemLong(string[] tokens) { if (tokens is null) { throw new ArgumentNullException(nameof(tokens)); } if (tokens.Length != 2 && tokens.Length != 3) { writer.WriteLine("usage: ml <address> [value]"); } else { string address = tokens[1]; if (tokens.Length == 2) { try { int addr = ParseInt(address); if (addr < 0 || addr >= memory.Size()) { writer.WriteLine("Address out of range"); return; } writer.WriteLine("{0} {1}", addr.ToString("x", CultureInfo.InvariantCulture), cpu.ReadMemoryLong(addr).ToString("x", CultureInfo.InvariantCulture)); } catch (FormatException e) { writer.Write(e.StackTrace); } } else { string value = tokens[2]; try { int addr = ParseInt(address); if (addr < 0 || addr >= memory.Size()) { writer.WriteLine("Address out of range"); return; } int v = ParseInt(value); cpu.WriteMemoryLong(addr, v); } catch (FormatException e) { writer.Write(e.StackTrace); } } } }