예제 #1
0
        public static void Callm(Cpu cpu, uint rX)
        {
            var vAddr = cpu.Registers[rX];
            var value = cpu.Read(vAddr);

            cpu.Call(value);
        }
예제 #2
0
        public static void Printm(Cpu cpu, uint rX)
        {
            var vAddr = cpu.Registers[rX];
            var value = cpu.Read(vAddr);

            cpu.Print(value);
        }
예제 #3
0
        public static void Movmm(Cpu cpu, uint rX, uint rY)
        {
            var vAddr = cpu.Registers[rY];
            var value = cpu.Read(vAddr);

            vAddr = cpu.Registers[rX];
            cpu.Write(vAddr, value);
        }
예제 #4
0
        public static void Cmprm(Cpu cpu, uint rX, uint rY)
        {
            var vAddr = cpu.Registers[rY];

            var lValue = cpu.Registers[rX];
            var rValue = cpu.Read(vAddr);

            cpu.Sf = (lValue < rValue);
            cpu.Zf = (lValue == rValue);
        }
예제 #5
0
        private static uint ReadValue(Cpu cpu, OpCodeFlag flag, uint param)
        {
            switch (flag)
            {
            case OpCodeFlag.Register:
                return(cpu.Registers[param]);

            case OpCodeFlag.MemoryAddress:
                return(cpu.Read(cpu.Registers[param]));

            case OpCodeFlag.Constant:
                return(param);

            default:
                throw new ArgumentOutOfRangeException(nameof(flag));
            }
        }
예제 #6
0
        public static void Movmr(Cpu cpu, uint rX, uint rY)
        {
            var vAddr = cpu.Registers[rY];

            cpu.Registers[rX] = cpu.Read(vAddr);
        }
예제 #7
0
 public static void Callm(Cpu cpu, uint rX)
 {
     var vAddr = cpu.Registers[rX];
     var value = cpu.Read(vAddr);
     cpu.Call(value);
 }
예제 #8
0
 public static void Printm(Cpu cpu, uint rX)
 {
     var vAddr = cpu.Registers[rX];
     var value = cpu.Read(vAddr);
     cpu.Print(value);
 }
예제 #9
0
 public static void Movmr(Cpu cpu, uint rX, uint rY)
 {
     var vAddr = cpu.Registers[rY];
     cpu.Registers[rX] = cpu.Read(vAddr);
 }
예제 #10
0
        public static void Movmm(Cpu cpu, uint rX, uint rY)
        {
            var vAddr = cpu.Registers[rY];
            var value = cpu.Read(vAddr);

            vAddr = cpu.Registers[rX];
            cpu.Write(vAddr, value);
        }
예제 #11
0
        public static void Cmprm(Cpu cpu, uint rX, uint rY)
        {
            var vAddr = cpu.Registers[rY];

            var lValue = cpu.Registers[rX];
            var rValue = cpu.Read(vAddr);

            cpu.Sf = (lValue < rValue);
            cpu.Zf = (lValue == rValue);
        }
예제 #12
0
 private static uint ReadValue(Cpu cpu, OpCodeFlag flag, uint param)
 {
     switch (flag)
     {
         case OpCodeFlag.Register:
             return cpu.Registers[param];
         case OpCodeFlag.MemoryAddress:
             return cpu.Read(cpu.Registers[param]);
         case OpCodeFlag.Constant:
             return param;
         default:
             throw new ArgumentOutOfRangeException(nameof(flag));
     }
 }