当前位置: 首页>>代码示例>>Python>>正文


Python Bits.overflow方法代码示例

本文整理汇总了Python中utility.Bits.overflow方法的典型用法代码示例。如果您正苦于以下问题:Python Bits.overflow方法的具体用法?Python Bits.overflow怎么用?Python Bits.overflow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在utility.Bits的用法示例。


在下文中一共展示了Bits.overflow方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: sbc

# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import overflow [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)
开发者ID:,项目名称:,代码行数:27,代码来源:

示例2: cp_hl

# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import overflow [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)")
开发者ID:pawlos,项目名称:Timex.Emu,代码行数:13,代码来源:opcodes.py

示例3: cp

# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import overflow [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)))
开发者ID:pawlos,项目名称:Timex.Emu,代码行数:13,代码来源:opcodes.py

示例4: add_iy_rr

# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import overflow [as 别名]
    def add_iy_rr(cpu, opcode, logger):
        regInd = (opcode >> 4) & 3
        val = cpu.Reg16(regInd, iy=True)

        old = cpu.IY
        cpu.IY = cpu.IY + val
        cpu.NFlag = Bits.reset()
        cpu.HFlag = Bits.carryFlagAdd16(old, cpu.IY)
        cpu.CFlag = Bits.overflow(old, cpu.IY, bits=16)
        cpu.m_cycles, cpu.t_states = 4, 15
        logger.info("ADD IY, {}".format(IndexToReg.translate16Bit(regInd)))
开发者ID:pawlos,项目名称:Timex.Emu,代码行数:13,代码来源:opcodes.py

示例5: sub_n

# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import overflow [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))
开发者ID:pawlos,项目名称:Timex.Emu,代码行数:14,代码来源:opcodes.py

示例6: cp

# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import overflow [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")
开发者ID:,项目名称:,代码行数:14,代码来源:

示例7: cp_n

# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import overflow [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))
开发者ID:pawlos,项目名称:Timex.Emu,代码行数:15,代码来源:opcodes.py

示例8: sbc_hl

# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import overflow [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)")
开发者ID:pawlos,项目名称:Timex.Emu,代码行数:15,代码来源:opcodes.py

示例9: or_n

# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import overflow [as 别名]
    def or_n(cpu, opcode, logger):
        n = cpu.ram[cpu.PC]
        old = cpu.A
        cpu.A = cpu.A | n

        cpu.SFlag = Bits.isNegative(cpu.A)
        cpu.ZFlag = Bits.isZero(cpu.A)
        cpu.HFlag = Bits.reset()
        cpu.PVFlag = Bits.overflow(old, cpu.A)
        cpu.NFlag = Bits.reset()
        cpu.CFlag = Bits.reset()

        cpu.m_cycles, cpu.t_states = 2, 7
        logger.info("OR {:02X}".format(n))
开发者ID:pawlos,项目名称:Timex.Emu,代码行数:16,代码来源:opcodes.py

示例10: add_r

# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import overflow [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)))
开发者ID:pawlos,项目名称:Timex.Emu,代码行数:16,代码来源:opcodes.py

示例11: adc_n

# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import overflow [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))
开发者ID:pawlos,项目名称:Timex.Emu,代码行数:16,代码来源:opcodes.py

示例12: add_iy

# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import overflow [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))
开发者ID:pawlos,项目名称:Timex.Emu,代码行数:16,代码来源:opcodes.py

示例13: add_a_hl

# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import overflow [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)")
开发者ID:pawlos,项目名称:Timex.Emu,代码行数:16,代码来源:opcodes.py

示例14: adc_a_hl

# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import overflow [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)")
开发者ID:pawlos,项目名称:Timex.Emu,代码行数:16,代码来源:opcodes.py

示例15: sbc_r

# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import overflow [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)))
开发者ID:pawlos,项目名称:Timex.Emu,代码行数:16,代码来源:opcodes.py


注:本文中的utility.Bits.overflow方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。