FA-89374 / Instruction set emulation / Member archive
Displacement 0x80 treated as positive · case 04
A branch with displacement 0x80 jumps forward 128 bytes instead of back 128.
Case contract
Input [pc, disp, taken] for a 2-byte conditional branch at pc in a 16-bit address space. The next instruction is (pc+2) & 0xFFFF; disp is an 8-bit two's complement offset from that address. Not taken: [next, 2]. Taken: target = (next + offset) & 0xFFFF and cost 3 cycles plus 1 when target and next lie on different 256-byte pages. Return [pc', cycles].
Why this case matters
Branch emulation must use the post-fetch PC, sign-extend the offset and charge page-crossing cycles exactly.
One recorded failure
Sample boundary fixtureThis sample comes from the broken implementation of a controlled reproducer.
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| most negative displacement | [8466, 4] | [8210, 3] | 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 ↗