FAILURE MAP
← Case archive

FA-89650 / Instruction set emulation / Member archive

INC half carry tested on the result nibble · case 05

Incrementing 0x0F leaves H clear and incrementing 0x0E sets it.

Member previewVariant 5 · 3 implementations · 9 checks per implementation

Case contract

Input [a, ops]; ops are 'inc', 'dec', ['add', v], ['sub', v] on 8-bit A; carry starts 0. After each op report [A, S, Z, H, PV, N, C]. inc: H = carry out of bit 3, PV = (A was 0x7F), N = 0, C unchanged. dec: H = borrow from bit 4 (low nibble was 0), PV = (A was 0x80), N = 1, C unchanged. add: H = carry out of bit 3, PV = signed overflow, N = 0, C = carry out. sub: H = borrow into bit 4 (low nibble of A < low nibble of v), PV = signed overflow, N = 1, C = borrow.

Why this case matters

Half-carry and parity/overflow flags are observable through DAA and conditional branches; emulators often get the INC/DEC special cases wrong.

One recorded failure

Sample boundary fixture

This sample comes from the broken implementation of a controlled reproducer.

Boundary fixtureActualExpectedOutcome
inc across nibble[[96, 0, 0, 0, 0, 0, 0], [97, 0, 0, 0, 0, 0, 0]][[96, 0, 0, 1, 0, 0, 0], [97, 0, 0, 0, 0, 0, 0]]Failed

MEMBER ARCHIVE

The complete case is available to members.

This record includes three runnable implementations, regression fixtures, execution results, and source hashes.

Member access is invitation-based. Sign in with your invited account to inspect the sources.

Sign in to the archive ↗