本文整理汇总了Python中utility.Bits.setNthBit方法的典型用法代码示例。如果您正苦于以下问题:Python Bits.setNthBit方法的具体用法?Python Bits.setNthBit怎么用?Python Bits.setNthBit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utility.Bits
的用法示例。
在下文中一共展示了Bits.setNthBit方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: rlca
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import setNthBit [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")
示例2: rra
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import setNthBit [as 别名]
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")
示例3: bit_res
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import setNthBit [as 别名]
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))
示例4: lra
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import setNthBit [as 别名]
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")
示例5: ZFlag
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import setNthBit [as 别名]
def ZFlag(self, value):
self.F = Bits.setNthBit(self.F, ZF, 1 if value else 0)
示例6: PVFlag
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import setNthBit [as 别名]
def PVFlag(self, value):
self.F = Bits.setNthBit(self.F, PVF, 1 if value else 0)
示例7: test_bits_setNthBit_correctly_set_the_but
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import setNthBit [as 别名]
def test_bits_setNthBit_correctly_set_the_but(self):
self.assertEquals(32, Bits.setNthBit(0, 5, 1))