Exemplo n.º 1
0
Arquivo: cpu.cs Projeto: Gareth422/tac
 public static void Main()
 {
     Console.WriteLine("CPUEm");
     CPU cpu = new CPU();
     //uint op = (uint)Convert.ToInt32("00001000000000000101010000011111", 2);
     Console.WriteLine(cpu.GetRegister(1));
     cpu.RunOp((uint)Convert.ToInt32("00000100000000100000000000000110", 2));
     cpu.RunOp((uint)Convert.ToInt32("00000100000000110000000000000010", 2));
     cpu.RunOp((uint)Convert.ToInt32("00001000000000000000010001000011", 2));
     Console.WriteLine(cpu.GetRegister(1));
 }
Exemplo n.º 2
0
Arquivo: cpu.cs Projeto: Gareth422/tac
 public static void Main()
 {
     Console.WriteLine ("CPUEm");
     CPU cpu = new CPU ();
     BinaryReader br = new BinaryReader (new FileStream (@"prog.bin", FileMode.Open));
     int i = 0;
     while (br.PeekChar() >= 0)
     {
         cpu.ram[i] = br.ReadByte();
         i++;
     }
     //cpu.RunOp(Convert.ToUInt32("04010006", 16));
     cpu.Emulate();
     cpu.Emulate();
     cpu.Emulate();
     cpu.Emulate();
     Console.WriteLine(cpu.registers[Registers.G4]);
     Console.ReadLine();
 }