FAILURE MAP
← Case archive

FA-89365 / Instruction set emulation / Member archive

Zero flag computed from the 9-bit sum · case 05

An addition that wraps to 0x00 with carry does not set Z.

Member previewVariant 5 · 3 implementations · 9 checks per implementation

Case contract

Input [a, c, ops] for an 8-bit accumulator with carry c; V starts 0. adc m: s = a+m+c, A = s & 0xFF, C = s > 0xFF, V = signed overflow of the 8-bit add. sbc m is adc of (m xor 0xFF) with the same carry (carry set means no borrow). cmp m: C = a >= m (unsigned), N/Z from (a-m) & 0xFF, A and V unchanged. After each op report [A, N, V, Z, C] where N is bit 7 and Z is result == 0.

Why this case matters

CPU emulators live or die on flag semantics; carry-as-inverted-borrow and overflow are the classic 8-bit emulation bugs.

One recorded failure

Sample boundary fixture

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

Boundary fixtureActualExpectedOutcome
adc carry out to zero[[0, 0, 0, 0, 1], [251, 1, 0, 0, 0]][[0, 0, 0, 1, 1], [251, 1, 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 ↗