FA-89809 / Instruction set emulation / Member archive
Logical shift carry taken after shifting · case 04
lsr reports bit 1 of the original value as carry.
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 |
|---|---|---|---|
| logical right shift carry | [[8, 0, 0, 0], [4, 0, 0, 0]] | [[8, 1, 0, 0], [4, 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 ↗