本文整理汇总了Python中utility.Bits.isNegative方法的典型用法代码示例。如果您正苦于以下问题:Python Bits.isNegative方法的具体用法?Python Bits.isNegative怎么用?Python Bits.isNegative使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utility.Bits
的用法示例。
在下文中一共展示了Bits.isNegative方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: dec_at_hl
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import isNegative [as 别名]
def dec_at_hl(cpu, opcode, logger):
old_val = cpu.ram[cpu.HL]
new_val = old_val - 1
cpu.ram[cpu.HL] = new_val
cpu.ZFlag = Bits.isZero(new_val)
cpu.SFlag = Bits.isNegative(new_val)
cpu.NFlag = Bits.set()
cpu.PVFlag = Bits.halfCarrySub(old_val, new_val)
cpu.m_cycles, cpu.t_states = 3, 11
logger.info("DEC (HL)")
示例2: neg
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import isNegative [as 别名]
def neg(cpu, opcode, logger):
old = cpu.A
cpu.A = 0 - cpu.A
cpu.NFlag = Bits.reset()
cpu.ZFlag = Bits.isZero(cpu.A)
cpu.SFlag = Bits.isNegative(cpu.A)
cpu.PVFlag = Bits.set() if old == 0x80 else Bits.reset()
cpu.CFlag = Bits.isZero(old)
cpu.HFlag = Bits.halfCarrySub(0x0, old)
cpu.m_cycles, cpu.t_states = 2, 8
logger.info("NEG")
示例3: adc_r
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import isNegative [as 别名]
def adc_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.reset()
cpu.m_cycles, cpu.t_states = 1, 4
logger.info("ADC A, {}".format(IndexToReg.translate8Bit(reg_idx)))
示例4: ldar
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import isNegative [as 别名]
def ldar(cpu, opcode, logger):
cpu.A = cpu.R
cpu.SFlag = Bits.isNegative(cpu.R)
cpu.ZFlag = Bits.isZero(cpu.R)
cpu.HFlag = Bits.reset()
cpu.PVFlag = Bits.set() if cpu.iff2 == 1 else Bits.reset()
cpu.NFlag = Bits.reset()
cpu.m_cycles, cpu.t_states = 2, 9
logger.info("LD A, R")
示例5: _or_hl
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import isNegative [as 别名]
def _or_hl(cpu, opcode, logger):
cpu.A = cpu.A | cpu.ram[cpu.HL]
cpu.HFlag = Bits.reset()
cpu.CFlag = Bits.reset()
cpu.NFlag = Bits.reset()
cpu.ZFlag = Bits.isZero(cpu.A)
cpu.SFlag = Bits.isNegative(cpu.A)
cpu.PVFlag = Bits.isEvenParity(cpu.A)
cpu.m_cycles, cpu.t_states = 2, 7
logger.info("OR (HL)")
示例6: dec_at_ix_d
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import isNegative [as 别名]
def dec_at_ix_d(cpu, opcode, logger):
d = cpu.ram[cpu.PC]
old_val = cpu.ram[cpu.IX+d]
new_val = old_val - 1
cpu.ram[cpu.IX+d] = new_val
cpu.ZFlag = Bits.isZero(new_val)
cpu.SFlag = Bits.isNegative(new_val)
cpu.NFlag = Bits.set()
cpu.PVFlag = Bits.halfCarrySub(old_val, new_val)
cpu.m_cycles, cpu.t_states = 6, 23
logger.info("DEC (IX+{:02X})".format(d))
示例7: _or
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import isNegative [as 别名]
def _or(cpu, opcode, logger):
regInd = opcode & 7
cpu.A = cpu.A | cpu.regs[regInd]
cpu.HFlag = Bits.reset()
cpu.CFlag = Bits.reset()
cpu.NFlag = Bits.reset()
cpu.ZFlag = Bits.isZero(cpu.A)
cpu.SFlag = Bits.isNegative(cpu.A)
cpu.PVFlag = Bits.isEvenParity(cpu.A)
cpu.m_cycles, cpu.t_states = 1, 4
logger.info("OR {}".format(IndexToReg.translate8Bit(regInd)))
示例8: cp_n
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import isNegative [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))
示例9: inc8
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import isNegative [as 别名]
def inc8(cpu, opcode, logger):
index = (opcode >> 3) & 7
oldValue = cpu.regs[index]
cpu.regs[index] = Bits.limitTo8Bits(cpu.regs[index] + 1)
cpu.NFlag = Bits.reset()
cpu.ZFlag = Bits.isZero(cpu.regs[index])
cpu.HFlag = Bits.halfCarrySub(oldValue, cpu.regs[index])
cpu.PVFlag = True if oldValue == 0x7f else False
cpu.SFlag = Bits.isNegative(cpu.regs[index])
cpu.m_cycles, cpu.t_states = 1, 4
logger.info("INC {}".format(IndexToReg.translate8Bit(index)))
示例10: dec8b
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import isNegative [as 别名]
def dec8b(cpu, opcode, logger):
reg_index = (opcode >> 3) & 7
old_val = cpu.regs[reg_index]
cpu.regs[reg_index] = cpu.regs[reg_index] - 1
cpu.ZFlag = Bits.isZero(cpu.regs[reg_index])
cpu.SFlag = Bits.isNegative(cpu.regs[reg_index])
cpu.NFlag = Bits.set()
cpu.PVFlag = Bits.halfCarrySub(old_val, cpu.regs[reg_index])
cpu.HFlag = Bits.halfCarrySub(old_val, cpu.regs[reg_index])
cpu.m_cycles, cpu.t_states = 1, 4
logger.info("DEC {}".format(IndexToReg.translate8Bit(reg_index)))
示例11: dec_mem_at_iy
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import isNegative [as 别名]
def dec_mem_at_iy(cpu, opcode, logger):
displacement = cpu.ram[cpu.PC]
addr = cpu.IY + displacement
value = cpu.ram[addr]
new_value = value - 1
cpu.ram[addr] = new_value
cpu.NFlag = Bits.set()
cpu.SFlag = Bits.isNegative(new_value)
cpu.ZFlag = Bits.isZero(new_value)
cpu.PVFlag = True if value == 0x80 else False
cpu.HFlag = Bits.halfCarrySub(value, new_value)
logger.info("DEC (IY+{:2X})".format(displacement))
示例12: sbc_hl
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import isNegative [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)")
示例13: adc_a_hl
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import isNegative [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)")
示例14: adc_n
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import isNegative [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))
示例15: add_iy
# 需要导入模块: from utility import Bits [as 别名]
# 或者: from utility.Bits import isNegative [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))