Example #1
0
    def rlca(cpu, opcode, logger):
        cflag = Bits.getNthBit(cpu.A, 7)
        cpu.A = Bits.setNthBit(cpu.A << 1, 0, cflag)
        cpu.CFlag = Bits.set() if cflag != 0 else Bits.reset()

        cpu.m_cycles, cpu.t_states = 1, 4
        logger.info("RLCA")
Example #2
0
 def rra(cpu, opcode, logger):
     cflag = Bits.getNthBit(cpu.A, 0)
     cpu.A = Bits.setNthBit((cpu.A >> 1), 7, cpu.CFlag)
     cpu.CFlag = Bits.set() if cflag == 1 else Bits.reset()
     cpu.HFlag = Bits.reset()
     cpu.NFlag = Bits.reset()
     cpu.m_cycles, cpu.t_states = 1, 4
     logger.info("RRA")
Example #3
0
    def bit_res(cpu, opcode, logger):
        index = (opcode >> 8) & 255
        bit = (opcode >> 3) & 7
        val = cpu.ram[cpu.IY+index]
        val = Bits.setNthBit(val, bit, 0)
        cpu.ram[cpu.IY+index] = val

        cpu.m_cycles, cpu.t_states = 6, 23
        logger.info("RES {}, (IY+{:02X})".format(bit, index))
Example #4
0
 def lra(cpu, opcode, logger):
     cflag = Bits.getNthBit(cpu.A, 7)
     cpu.A = Bits.setNthBit((cpu.A << 1), 0, cpu.CFlag)
     cpu.CFlag = Bits.set() if cflag == 1 else Bits.reset()
     cpu.m_cycles, cpu.t_states = 1, 4
     logger.info("LRA")
Example #5
0
 def PVFlag(self, value):
     self.F = Bits.setNthBit(self.F, PVF, 1 if value else 0)
Example #6
0
 def ZFlag(self, value):
     self.F = Bits.setNthBit(self.F, ZF, 1 if value else 0)
Example #7
0
 def test_bits_setNthBit_correctly_set_the_but(self):
     self.assertEquals(32, Bits.setNthBit(0, 5, 1))
Example #8
0
 def XFlag(self, value: bool):
     self.F = Bits.setNthBit(self.F, XF, 1 if value else 0)
Example #9
0
 def PVFlag(self, value):
     self.F = Bits.setNthBit(self.F, PVF, 1 if value else 0)
Example #10
0
 def SFlag(self, value):
     self.F = Bits.setNthBit(self.F, SF, 1 if value else 0)
Example #11
0
 def test_bits_setNthBit_correctly_set_the_but(self):
     self.assertEqual(32, Bits.setNthBit(0, 5, 1))