本文整理汇总了Python中utility.Bits.carryFlag方法的典型用法代码示例。如果您正苦于以下问题:Python Bits.carryFlag方法的具体用法?Python Bits.carryFlag怎么用?Python Bits.carryFlag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utility.Bits
的用法示例。
在下文中一共展示了Bits.carryFlag方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: cp
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import carryFlag [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)))
示例2: cp_hl
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import carryFlag [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: sub_n
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import carryFlag [as 别名]
def sub_n(cpu, opcode, logger):
n = cpu.ram[cpu.PC]
value = cpu.A - n
cpu.NFlag = Bits.set()
cpu.ZFlag = Bits.isZero(value)
cpu.HFlag = Bits.halfCarrySub(cpu.A, value)
cpu.PVFlag = Bits.overflow(cpu.A, value)
cpu.CFlag = Bits.carryFlag(value)
cpu.A = value
logger.info("SUB {:02X}".format(n))
示例4: cp
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import carryFlag [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: sbc_hl
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import carryFlag [as 别名]
def sbc_hl(cpu, opcode, logger):
old_val = cpu.A
cpu.A = old_val - cpu.ram[cpu.HL] - (1 if cpu.CFlag else 0)
cpu.SFlag = Bits.isNegative(cpu.A)
cpu.ZFlag = Bits.isZero(cpu.A)
cpu.NFlag = Bits.set()
cpu.HFlag = Bits.halfCarrySub(old_val, cpu.A)
cpu.PVFlag = Bits.overflow(old_val, cpu.A)
cpu.CFlag = Bits.carryFlag(cpu.A)
cpu.m_cycles, cpu.t_states = 2, 7
logger.info("SDC A, (HL)")
示例6: cp_n
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import carryFlag [as 别名]
def cp_n(cpu, opcode, logger):
n = cpu.ram[cpu.PC]
old = cpu.A
new = old - n
cpu.SFlag = Bits.isNegative(new)
cpu.ZFlag = Bits.isZero(new)
cpu.HFlag = Bits.halfCarrySub(old, new)
cpu.PVFlag = Bits.overflow(old, new)
cpu.NFlag = Bits.set()
cpu.CFlag = Bits.carryFlag(new)
cpu.m_cycles, cpu.t_states = 2, 7
logger.info("CP {:02X}".format(n))
示例7: add_r
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import carryFlag [as 别名]
def add_r(cpu, opcode, logger):
index = (opcode & 7)
old = cpu.A
cpu.A = old + cpu.regs[index]
cpu.SFlag = Bits.isNegative(cpu.A)
cpu.ZFlag = Bits.isZero(cpu.A)
cpu.HFlag = Bits.halfCarrySub(old, cpu.A)
cpu.PVFlag = Bits.overflow(old, cpu.A)
cpu.NFlag = Bits.reset()
cpu.CFlag = Bits.carryFlag(cpu.A)
cpu.m_cycles, cpu.t_states = 1, 4
logger.info("ADD A, {}".format(IndexToReg.translate8Bit(index)))
示例8: add_iy
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import carryFlag [as 别名]
def add_iy(cpu, opcode, logger):
d = cpu.ram[cpu.PC]
value = cpu.A + cpu.ram[cpu.IY+d]
cpu.NFlag = Bits.reset()
cpu.ZFlag = Bits.isZero(cpu.A)
cpu.CFlag = Bits.carryFlag(value)
cpu.SFlag = Bits.isNegative(cpu.A)
cpu.PVFlag = Bits.overflow(cpu.A, value)
cpu.HFlag = Bits.halfCarrySub(cpu.A, value)
cpu.A = value
cpu.m_cycles, cpu.t_states = 4, 15
logger.info("ADD A, (IY+{:02X})".format(d))
示例9: adc_n
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import carryFlag [as 别名]
def adc_n(cpu, opcode, logger):
n = cpu.ram[cpu.PC]
old_val = cpu.A
new_val = cpu.A + n + (1 if cpu.CFlag else 0)
cpu.A = new_val
cpu.SFlag = Bits.isNegative(cpu.A)
cpu.ZFlag = Bits.isZero(cpu.A)
cpu.HFlag = Bits.halfCarrySub(old_val, cpu.A)
cpu.PVFlag = Bits.overflow(old_val, cpu.A)
cpu.NFlag = Bits.reset()
cpu.CFlag = Bits.carryFlag(new_val)
logger.info("ADC A, {:02X}".format(n))
示例10: sbc_r
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import carryFlag [as 别名]
def sbc_r(cpu, opcode, logger):
reg_idx = (opcode & 7)
old_val = cpu.A
cpu.A = old_val - cpu.regs[reg_idx] - (1 if cpu.CFlag else 0)
cpu.SFlag = Bits.isNegative(cpu.A)
cpu.ZFlag = Bits.isZero(cpu.A)
cpu.NFlag = Bits.set()
cpu.HFlag = Bits.halfCarrySub(old_val, cpu.A)
cpu.PVFlag = Bits.overflow(old_val, cpu.A)
cpu.CFlag = Bits.carryFlag(cpu.A)
cpu.m_cycles, cpu.t_states = 1, 4
logger.info("SDC A, {}".format(IndexToReg.translate8Bit(reg_idx)))
示例11: sub_a_hl
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import carryFlag [as 别名]
def sub_a_hl(cpu, opcode, logger):
v = cpu.ram[cpu.HL]
old_A = cpu.AFPrim
cpu.A -= v
cpu.NFlag = Bits.set()
cpu.SFlag = Bits.isNegative(cpu.A)
cpu.ZFlag = Bits.isZero(cpu.A)
cpu.HFlag = Bits.halfCarrySub(old_A, cpu.A)
cpu.PVFlag = Bits.overflow(old_A, cpu.A)
cpu.CFlag = Bits.carryFlag(cpu.A)
cpu.m_cycles, cpu.t_states = 1, 7
logger.info("SUB A, (HL)")
示例12: adc_a_hl
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import carryFlag [as 别名]
def adc_a_hl(cpu, opcode, logger):
v = cpu.ram[cpu.HL]
old = cpu.A
cpu.A += v
cpu.SFlag = Bits.isNegative(cpu.A)
cpu.ZFlag = Bits.isZero(cpu.A)
cpu.NFlag = Bits.reset()
cpu.PVFlag = Bits.overflow(old, cpu.A)
cpu.HFlag = Bits.halfCarrySub(cpu.A, old)
cpu.CFlag = Bits.carryFlag(old + v)
cpu.m_cycles, cpu.t_states = 2, 7
logger.info("ADC A, (HL)")
示例13: add_a_hl
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import carryFlag [as 别名]
def add_a_hl(cpu, opcode, logger):
oldA = cpu.A
value = cpu.A + cpu.ram[cpu.HL]
cpu.A = value
cpu.SFlag = Bits.isNegative(cpu.A)
cpu.ZFlag = Bits.isZero(cpu.A)
cpu.NFlag = Bits.reset()
cpu.CFlag = Bits.carryFlag(value)
cpu.PVFlag = Bits.overflow(oldA, cpu.A)
cpu.HFlag = Bits.halfCarrySub(cpu.A, oldA)
cpu.m_cycles, cpu.t_states = 2, 7
logger.info("ADD A, (HL)")
示例14: sub_r
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import carryFlag [as 别名]
def sub_r(cpu, opcode, logger):
index = opcode & 7
old_A = cpu.A
cpu.A = cpu.A - cpu.regs[index]
cpu.NFlag = Bits.set()
cpu.SFlag = Bits.isNegative(cpu.A)
cpu.ZFlag = Bits.isZero(cpu.A)
cpu.HFlag = Bits.halfCarrySub(old_A, cpu.A)
cpu.PVFlag = Bits.overflow(cpu.A, old_A)
cpu.CFlag = Bits.carryFlag(cpu.A)
cpu.m_cycles, cpu.t_states = 1, 4
logger.info("SUB {}".format(IndexToReg.translate8Bit(index)))
示例15: add_r_n
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import carryFlag [as 别名]
def add_r_n(cpu, opcode, logger):
n = cpu.ram[cpu.PC]
old = cpu.A
value = cpu.A + n
cpu.A = value
cpu.SFlag = Bits.isNegative(value)
cpu.ZFlag = Bits.isZero(cpu.A)
cpu.HFlag = Bits.halfCarrySub(old, cpu.A)
cpu.PVFlag = Bits.overflow(old, cpu.A)
cpu.NFlag = Bits.reset()
cpu.CFlag = Bits.carryFlag(value)
cpu.m_cycles, cpu.t_states = 2, 7
logger.info("ADD A, {:02X}".format(n))