Exemplo n.º 1
0
        static void Main(string[] args)
        {
            List<ushort> mem = new List<ushort>();
            foreach (var line in Properties.Resources.ExampleProgram.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries)
                .Select(l => l.Split(':')[1]))
            {
                foreach (var b in line.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries))
                {
                    mem.Add(ushort.Parse(b, NumberStyles.HexNumber));
                }
            }

            var cpu = new Cpu(mem.ToArray());

            Console.WriteLine(cpu.Status());
            Console.WriteLine();

            while (true)
            {
                cpu.Tick();
                Console.WriteLine(cpu.Status());
                Console.WriteLine();
                Thread.Sleep(250);
            }
        }
Exemplo n.º 2
0
 public InternalValue(SaveLocation loc, Cpu cpu)
 {
     this.Buffer = null;
     this.Index = 0;
     this.SaveLoc = loc;
     this.Literal = 0;
     this.MyCpu = cpu;
 }
Exemplo n.º 3
0
 public InternalValue(ushort lit)
 {
     this.Buffer = null;
     this.Index = 0;
     this.SaveLoc = SaveLocation.Literal;
     this.Literal = lit;
     this.MyCpu = null;
 }
Exemplo n.º 4
0
 public InternalValue(ushort[] buffer, ushort index)
 {
     this.Buffer = buffer;
     this.Index = index;
     this.SaveLoc = SaveLocation.Memory;
     this.Literal = 0;
     this.MyCpu = null;
 }