Exemple #1
0
        private bool REG(ushort instruction)
        {
            byte subcommand = ParserFunctions.GetSubCommand(instruction);
            var  command    = RegisterCommands[subcommand];

            var regX = ParserFunctions.GetX(instruction);
            var regY = ParserFunctions.GetY(instruction);

            command(regX, regY);
            return(false);
        }
Exemple #2
0
        private bool DRW(ushort instruction)
        {
            var Vx    = ParserFunctions.GetX(instruction);
            var Vy    = ParserFunctions.GetY(instruction);
            var x     = Register[Vx];
            var y     = Register[Vy];
            var count = ParserFunctions.GetSubCommand(instruction);

            byte[] sprite = new byte[count];
            for (ushort i = 0; i < count; i++)
            {
                sprite[i] = memory.GetValue((ushort)(AddressRegister + i));
            }
            var collision = SetSprite(x, y, sprite, count);

            Register[0xF] = (byte)collision;
            // Draw screen
            display.Print();

            return(false);
        }