Esempio n. 1
0
        private void Dispatch0x08(ParsedOpCode parsedOpCode)
        {
            switch (parsedOpCode.N)
            {
            case 0x0:
                // 0x8XY0 Store the value of register VY in VX
                CPU.CopyRegisterYtoX(parsedOpCode.X, parsedOpCode.Y);
                break;

            case 0x01:
                // 0x8XY1 Set VX to VX OR VY
                CPU.OrRegisterXY(parsedOpCode.X, parsedOpCode.Y);
                break;

            case 0x02:
                // 0x8XY2 Set VX to VX AND VY
                CPU.AndRegisterXY(parsedOpCode.X, parsedOpCode.Y);
                break;

            case 0x03:
                // 0x8XY3 Set VX to VX XOR VY
                CPU.XorRegisterXY(parsedOpCode.X, parsedOpCode.Y);
                break;

            case 0x04:
                // 0x8XY4 Add the value of VY to VX.
                CPU.AddRegisterYtoX(parsedOpCode.X, parsedOpCode.Y);
                break;

            case 0x05:
                // 0x8XY5 Subtract the value of VY from VX
                CPU.SubtractRegisterYfromX(parsedOpCode.X, parsedOpCode.Y);
                break;

            case 0x06:
                // 0x8XY6 Store the value of register VY shifted to the right by one bit in register VX
                CPU.ShiftVxBy1Right(parsedOpCode.X);
                break;

            case 0x07:
                // Set register VX to the value of VY minus VX
                CPU.SubtractRegisterXFromY(parsedOpCode.X, parsedOpCode.Y);
                break;

            case 0x0E:
                // Store the value of register VY shifted left one bit in register VX.
                // Set VF to the MSB prior to the shift
                CPU.ShiftVxBy1Left(parsedOpCode.X);
                break;
            }
        }