Exemple #1
0
    def test_8xy2_leaves_other_registers_alone(self, x, y):
        """8xy2 leaves registers other than VX and VY alone"""

        vm = VM()
        vm.v_registers[x] = 0b10101010
        vm.v_registers[y] = 0b01010101

        load_and_execute_instruction(vm, 0x8002, x=x, y=y)

        assert other_registers_untouched(vm, (x, y))
Exemple #2
0
    def test_8xy0_leaves_original_alone(self, x, y):
        """8xy0 leaves VY alone"""

        vm = VM()
        vm.v_registers[x] = 2
        vm.v_registers[y] = 3

        load_and_execute_instruction(vm, 0x8000, x=x, y=y)

        assert other_registers_untouched(vm, {x, y})
Exemple #3
0
    def test_8xye_leaves_other_registers_alone_unless_theyre_vf(self, x, y):
        """8xy6 leaves registers other than VX alone except for VF"""

        vm = VM()

        vm.v_registers[x] = 2
        vm.v_registers[y] = 1

        load_and_execute_instruction(vm, 0x800E, x=x, y=y)

        # make sure we don't check VF since it should always be set
        touched = {x, 0xF}

        assert other_registers_untouched(vm, touched)