def _dec_value(processor, value): processor.set_condition('p', value == 0x80) result, half_carry, _ = bitwise_sub(value, 1) processor.set_condition('s', to_signed(result) < 0) processor.set_condition('z', result == 0) processor.set_condition('h', half_carry) processor.set_condition('n', True) return result
def _inc_value(processor, value): processor.set_condition('p', value == 0x7f) result, half_carry, _ = bitwise_add(value, 1) processor.set_condition('s', to_signed(result) < 0) processor.set_condition('z', result == 0) processor.set_condition('h', half_carry) processor.set_condition('n', False) return result