FAILURE MAP
← Case archive

FA-89804 / Instruction set emulation / Member archive

Arithmetic right shift loses the sign bit · case 04

asr of a negative value turns it positive.

Member previewVariant 4 · 3 implementations · 8 checks per implementation

Case contract

Input [a, c, ops] with ops asl, lsr, rol, ror, asr on an 8-bit value and a carry bit. asl: C = bit 7, shift left. lsr: C = bit 0, shift right with 0. rol: shift left, bit 0 = old C, new C = old bit 7. ror: shift right, bit 7 = old C, new C = old bit 0. asr: C = bit 0, shift right keeping bit 7. Report [A, C, Z, N] after each op.

Why this case matters

Rotate-through-carry instructions implement multi-byte shifts in 8-bit code; emulating them with circular rotates or sequenced updates breaks arithmetic libraries.

One recorded failure

Sample boundary fixture

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

Boundary fixtureActualExpectedOutcome
arithmetic right shift keeps sign[[100, 0, 0, 0], [50, 0, 0, 0], [25, 0, 0, 0]][[228, 0, 0, 1], [242, 0, 0, 1], [249, 0, 0, 1]]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 ↗