本文整理汇总了Python中utility.Bits.set方法的典型用法代码示例。如果您正苦于以下问题:Python Bits.set方法的具体用法?Python Bits.set怎么用?Python Bits.set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utility.Bits
的用法示例。
在下文中一共展示了Bits.set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: cpl
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import set [as 别名]
def cpl(cpu, opcode, logger):
old = cpu.A
new = ~old
cpu.A = new
cpu.HFlag = Bits.set()
cpu.NFlag = Bits.set()
cpu.m_cycles, cpu.t_states = 1, 4
logger.info("CPL")
示例2: test_add_a_d_with_C_flag_set_correctly_caluclates_value
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import set [as 别名]
def test_add_a_d_with_C_flag_set_correctly_caluclates_value(self):
cpu = CPU(ROM('\x8a'))
cpu.A = 0x22
cpu.D = 0x77
cpu.CFlag = Bits.set()
cpu.readOp()
self.assertEqual(0x9a, cpu.A)
示例3: test_add_a_b_with_C_flag_set_correctly_calculates_value
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import set [as 别名]
def test_add_a_b_with_C_flag_set_correctly_calculates_value(self):
cpu = CPU(ROM('\x88'))
cpu.A = 0x12
cpu.B = 0x12
cpu.CFlag = Bits.set()
cpu.readOp()
self.assertEqual(0x25, cpu.A)
示例4: test_add_HL_SP_with_C_flag_set_correctly_calculates_value
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import set [as 别名]
def test_add_HL_SP_with_C_flag_set_correctly_calculates_value(self):
cpu = CPU(ROM('\xed\x7a'))
cpu.HL = 0x1111
cpu.SP = 0x2222
cpu.CFlag = Bits.set()
cpu.readOp()
self.assertEqual(0x1111+0x2222+0x1, cpu.HL)
示例5: test_add_HL_DE_with_C_flag_set_correctly_calculates_value
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import set [as 别名]
def test_add_HL_DE_with_C_flag_set_correctly_calculates_value(self):
cpu = CPU(ROM('\xed\x5a'))
cpu.HL = 0xCDCD
cpu.DE = 0x1111
cpu.CFlag = Bits.set()
cpu.readOp()
self.assertEqual(0XCDCD+0x1111+0x1, cpu.HL)
示例6: test_adc_A_mem_HL_with_CFlag_set_correctly_sets_A_register
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import set [as 别名]
def test_adc_A_mem_HL_with_CFlag_set_correctly_sets_A_register(self):
cpu = CPU(ROM('\x8e\x15\x16\x17\x18'))
cpu.HL = 0x03
cpu.A = 0x5
cpu.CFlag = Bits.set()
cpu.readOp()
self.assertEqual(0x1c, cpu.A)
示例7: test_add_a_b_with_C_flag_set_takes_4_t_states
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import set [as 别名]
def test_add_a_b_with_C_flag_set_takes_4_t_states(self):
cpu = CPU(ROM('\x88'))
cpu.A = 0x12
cpu.B = 0x12
cpu.CFlag = Bits.set()
cpu.readOp()
self.assertEqual(4, cpu.t_states)
示例8: test_add_a_e_with_C_flag_set_correctly_caluclates_value
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import set [as 别名]
def test_add_a_e_with_C_flag_set_correctly_caluclates_value(self):
cpu = CPU(ROM('\x8b'))
cpu.A = 0x22
cpu.E = 0x66
cpu.CFlag = Bits.set()
cpu.readOp()
self.assertEqual(0x89, cpu.A)
示例9: test_jr_z_jumps_if_ZFlag_is_set
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import set [as 别名]
def test_jr_z_jumps_if_ZFlag_is_set(self):
rom = '\x00' * 0x0300+'\x28\x03'
cpu = CPU(ROM(rom))
cpu.PC = 0x0300
cpu.ZFlag = Bits.set()
cpu.readOp()
self.assertEqual(0x0305, cpu.PC)
示例10: test_add_iy_rr_resets_n_flag
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import set [as 别名]
def test_add_iy_rr_resets_n_flag(self):
cpu = CPU(ROM('\xfd\x39'))
cpu.IY = 0x1001
cpu.SP = 0x0880
cpu.NFlag = Bits.set()
cpu.readOp()
self.assertFalse(cpu.NFlag)
示例11: test_sbc_a_mem_hl_correctly_calculates_value
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import set [as 别名]
def test_sbc_a_mem_hl_correctly_calculates_value(self):
cpu = CPU(ROM('\x9e\x00\x00\x22'))
cpu.A = 0x23
cpu.HL = 0x3
cpu.CFlag = Bits.set()
cpu.readOp()
self.assertEqual(0, cpu.A)
示例12: test_jp_nz_jumps_takes_7_t_states_if_jump_is_taken
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import set [as 别名]
def test_jp_nz_jumps_takes_7_t_states_if_jump_is_taken(self):
rom = '\x00' * 0x0480+'\x20\xFA'
cpu = CPU(ROM(rom))
cpu.PC = 0x0480
cpu.ZFlag = Bits.set()
cpu.readOp()
self.assertEqual(7, cpu.t_states)
示例13: test_jp_nz_jumps_takes_2_m_cycles_if_jump_is_not_taken
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import set [as 别名]
def test_jp_nz_jumps_takes_2_m_cycles_if_jump_is_not_taken(self):
rom = '\x00' * 0x0480+'\x20\xFA'
cpu = CPU(ROM(rom))
cpu.PC = 0x0480
cpu.ZFlag = Bits.set()
cpu.readOp()
self.assertEqual(2, cpu.m_cycles)
示例14: rlca
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import set [as 别名]
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")
示例15: test_sbc_a_b_correctly_calculates_result
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import set [as 别名]
def test_sbc_a_b_correctly_calculates_result(self):
cpu = CPU(ROM('\x98'))
cpu.A = 0x40
cpu.B = 0x3f
cpu.CFlag = Bits.set()
cpu.readOp()
self.assertEquals(0, cpu.A)