/// <summary> /// Writes zeroes to the destination locations. /// </summary> /// <param name="address">The destination address</param> /// <param name="count">The number of values to be zeroed</param> /// <param name="data">The destination Data object</param> public void Read(ushort address, int count, Data data) { for (int i = 0; i < count; i++) { data[address++] = 0; } }
/// <summary> /// Writes integer values to the Null device. /// </summary> /// <remarks> /// In effect, the values are discarded, but they are read from /// the memory to trigger memory-based breakpoints. /// </remarks> /// <param name="address">The source address</param> /// <param name="count">The number of values to write to the null device</param> /// <param name="data">The source Data object</param> public void Write(ushort address, int count, Data data) { for (int i = 0; i < count; i++) { short value = (short)data[address]; address++; } }
/// <summary> /// Writes integer values to the Console. /// </summary> /// <param name="address">The source address</param> /// <param name="count">The number of values to write</param> /// <param name="data">The source Data object</param> public void Write(ushort address, int count, Data data) { for (int i = 0; i < count; i++) { short value = (short)data[address]; Console.WriteLine(string.Format("The contents of memory location #{0} = {1}", address, value)); address++; } }
/// <summary> /// Reads integer values from the Console. /// </summary> /// <param name="address">The destination address</param> /// <param name="count">The number of values to read</param> /// <param name="data">The destination Data object</param> public void Read(ushort address, int count, Data data) { for (int i = 0; i < count; i++) { Console.Write(string.Format("An integer value for location #{0} (other values cause interrupt): ", address)); string input = Console.ReadLine(); data[address++] = (ushort)short.Parse(input); } }
/// <summary> /// Creates a new Processor object. /// </summary> /// <param name="data">A Data object that represents the machine state.</param> /// <param name="ioDevice">An IIODevice object that represents the IODevice.</param> public Processor(Data data, IIODevice ioDevice) { Data = data; IODevice = ioDevice; }
/// <summary> /// Constructs the object using the specifyed custom Data storage and I/O device /// objects. /// </summary> /// <param name="data">The Data object that stores memory and registers</param> /// <param name="ioDevice">The I/O device to be used by the I/O instructions</param> public VirtualMachine(Data data, IIODevice ioDevice) { Data = data; Processor = new Processor(Data, ioDevice); Disassembler = new Disassembler(Data); }
/// <summary> /// Constructs the object using the I/O Device and /// Data object with specified History size. /// </summary> /// <param name="historySize">History size for Data object.</param> public VirtualMachine(int historySize) { Data = new Data(historySize); Processor = new Processor(Data, new ConsoleIODevice()); Disassembler = new Disassembler(Data); }
/// <summary> /// Creates a new Processor object. /// </summary> /// <param name="data">A Data object that represents the machine state.</param> public Disassembler(Data data) { Data = data; }