FA-89787 / Instruction set emulation / Member archive
Rotate left is circular instead of through carry · case 02
rol feeds bit 7 back into bit 0 instead of the carry flag.
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 fixtureThis sample comes from the broken implementation of a controlled reproducer.
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| rotate left through carry | [[3, 1, 0, 0], [6, 0, 0, 0], [12, 0, 0, 0], [24, 0, 0, 0], [48, 0, 0, 0]] | [[2, 1, 0, 0], [5, 0, 0, 0], [10, 0, 0, 0], [20, 0, 0, 0], [40, 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 ↗