예제 #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);
            }
        }
예제 #2
0
 public InternalValue(SaveLocation loc, Cpu cpu)
 {
     this.Buffer = null;
     this.Index = 0;
     this.SaveLoc = loc;
     this.Literal = 0;
     this.MyCpu = cpu;
 }
예제 #3
0
 public InternalValue(ushort lit)
 {
     this.Buffer = null;
     this.Index = 0;
     this.SaveLoc = SaveLocation.Literal;
     this.Literal = lit;
     this.MyCpu = null;
 }
예제 #4
0
 public InternalValue(ushort[] buffer, ushort index)
 {
     this.Buffer = buffer;
     this.Index = index;
     this.SaveLoc = SaveLocation.Memory;
     this.Literal = 0;
     this.MyCpu = null;
 }