Example #1
0
 /// <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;
     }
 }
Example #2
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++;
     }
 }
Example #3
0
 /// <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++;
     }
 }
Example #4
0
 /// <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);
     }
 }
Example #5
0
 /// <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;
 }
Example #6
0
 /// <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);
 }
Example #7
0
 /// <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);
 }
Example #8
0
 /// <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;
 }