本文整理汇总了Python中utility.Bits.signFlag方法的典型用法代码示例。如果您正苦于以下问题:Python Bits.signFlag方法的具体用法?Python Bits.signFlag怎么用?Python Bits.signFlag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utility.Bits
的用法示例。
在下文中一共展示了Bits.signFlag方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: sbc
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import signFlag [as 别名]
def sbc(cpu, opcode, logger):
logger.info("SBC HL")
regInd = (opcode & 0x30) >> 4
value = 0
if regInd == 0:
value = cpu.BC
elif regInd == 1:
value = cpu.DE
elif regInd == 2:
value = cpu.HL
elif regInd == 3:
value = cpu.SP
oldHL = cpu.HL
logger.info("Old value of HL: " + str(oldHL))
cpu.HL = cpu.HL - value - (1 if cpu.CFlag else 0)
logger.info("New value of HL: " + str(cpu.HL))
cpu.flags[SF] = Bits.signFlag(cpu.HL, bits=16)
cpu.flags[ZF] = Bits.isZero(cpu.HL)
cpu.flags[HF] = Bits.halfCarrySub16(oldHL, cpu.HL)
cpu.flags[PVF] = Bits.overflow(Bits.twos_comp(oldHL, bits=16),
Bits.twos_comp(cpu.HL, bits=16))
cpu.flags[NF] = True
cpu.flags[CF] = Bits.borrow(cpu.HL, bits=16)
示例2: cp_hl
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import signFlag [as 别名]
def cp_hl(cpu, opcode, logger):
value = cpu.A - cpu.ram[cpu.HL]
cpu.ZFlag = Bits.isZero(value)
cpu.CFlag = Bits.carryFlag(value)
cpu.NFlag = Bits.set()
cpu.HFlag = Bits.halfCarrySub(cpu.A, value)
cpu.SFlag = Bits.signFlag(value)
cpu.PVFlag = Bits.overflow(value, cpu.A)
cpu.m_cycles, cpu.t_states = 1, 7
logger.info("CP (HL)")
示例3: cp
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import signFlag [as 别名]
def cp(cpu, opcode, logger):
regInd = opcode & 7
value = cpu.A - cpu.regs[regInd]
cpu.ZFlag = Bits.isZero(value)
cpu.CFlag = Bits.carryFlag(value)
cpu.NFlag = Bits.set()
cpu.HFlag = Bits.halfCarrySub(cpu.A, value)
cpu.SFlag = Bits.signFlag(value)
cpu.PVFlag = Bits.overflow(value, cpu.A)
cpu.m_cycles, cpu.t_states = 1, 4
logger.info("CP {}".format(IndexToReg.translate8Bit(regInd)))
示例4: cp
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import signFlag [as 别名]
def cp(cpu, opcode, logger):
regInd = opcode & 7
logger.info(regInd)
value = cpu.A - cpu.regs[regInd]
"""Flags"""
cpu.flags[ZF] = Bits.isZero(value)
cpu.flags[CF] = Bits.carryFlag(value)
cpu.flags[NF] = True
cpu.flags[HF] = Bits.halfCarrySub(cpu.A, value)
cpu.flags[SF] = Bits.signFlag(value)
cpu.flags[PVF] = Bits.overflow(cpu.A, value)
logger.info("CP r")
示例5: add_Hl_rr_c
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import signFlag [as 别名]
def add_Hl_rr_c(cpu, opcode, logger):
regInd = (opcode >> 4) & 3
val = cpu.Reg16(regInd)
old = cpu.HL
cpu.HL = cpu.HL + val + (1 if cpu.CFlag else 0)
cpu.SFlag = Bits.signFlag(cpu.HL, bits=16)
cpu.ZFlag = Bits.isZero(cpu.HL)
cpu.HFlag = Bits.halfCarrySub16(old, cpu.HL)
cpu.PVFlag = Bits.overflow(old, cpu.HL, bits=16)
cpu.NFlag = Bits.reset()
cpu.CFlag = Bits.set() if (Bits.getNthBit(old, 15) == 1 and
Bits.getNthBit(cpu.HL, 15) == 0) else Bits.reset()
cpu.m_cycles, cpu.t_states = 4, 15
logger.info("ADC HL, {}".format(IndexToReg.translate16Bit(regInd)))
示例6: sbc
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import signFlag [as 别名]
def sbc(cpu, opcode, logger):
regInd = (opcode & 0x30) >> 4
value = cpu.Reg16(regInd)
oldHL = cpu.HL
cpu.HL = cpu.HL - value - (1 if cpu.CFlag else 0)
cpu.SFlag = Bits.signFlag(cpu.HL, bits=16)
cpu.ZFlag = Bits.isZero(cpu.HL)
cpu.HFlag = Bits.halfCarrySub16(oldHL, cpu.HL)
cpu.PVFlag = Bits.overflow(oldHL, cpu.HL, bits=16)
cpu.NFlag = Bits.set()
cpu.CFlag = Bits.borrow(cpu.HL, bits=16)
cpu.m_cycles, cpu.t_states = 4, 15
logger.info("SBC HL, {}".format(IndexToReg.translate16Bit(regInd)))