FAILURE MAP
← Case archive

FA-89416 / Instruction set emulation / Open access

Zero-page indexed address leaves page zero · case 01

zp,X with a large index addresses page one instead of wrapping inside page zero.

Verified by executionVariant 1 · 13 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The indexed zero-page sum is not masked to 8 bits.

VERIFIED REPAIR

Wrap zero-page indexed addresses modulo 256.

Unsuccessful approach: Masking to 16 bits still lets the address leave page zero.

Case contract

Input [mode, operand, x, y, mem] with mem mapping decimal-string addresses to bytes (missing = 0). zp: operand & 0xFF. zpx: (operand + x) & 0xFF. abs: operand. absx: (operand + x) & 0xFFFF. absy: (operand + y) & 0xFFFF. ind: little-endian pointer at operand, where the high byte is fetched from the same page ((operand & 0xFF00) | ((operand + 1) & 0xFF)). indx: pointer at zero-page (operand + x) & 0xFF, high byte from the next zero-page byte (wrapping). indy: pointer at zero-page operand (high byte wrapping in zero page), plus y, wrapped to 16 bits.

Why this case matters

Addressing-mode decoding is the core of any 8-bit CPU emulator; page-wrap quirks are observable program behaviour.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(*args):
    mode, operand, x, y, mem = args
    def rd(a):
        return mem.get(str(a & 0xFFFF), 0)
    if mode == 'zp': return operand & 0xFF
    if mode == 'zpx': return operand + x
    if mode == 'abs': return operand
    if mode == 'absx': return (operand + x) & 0xFFFF
    if mode == 'absy': return (operand + y) & 0xFFFF
    if mode == 'ind':
        lo = rd(operand)
        hi = rd((operand & 0xFF00) | ((operand + 1) & 0xFF))
        return hi << 8 | lo
    if mode == 'indx':
        p = (operand + x) & 0xFF
        return rd((p + 1) & 0xFF) << 8 | rd(p)
    if mode == 'indy':
        p = operand & 0xFF
        base = rd((p + 1) & 0xFF) << 8 | rd(p)
        return (base + y) & 0xFFFF
    return None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('zero page indexed wraps', ['zpx', 241, 32, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 17), ('absolute indexed crosses page', ['absx', 4336, 33, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 4369), ('absolute indexed wraps top', ['absx', 65520, 49, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 33), ('indirect jump page bug', ['ind', 4351, 0, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 25889), ('indirect jump normal', ['ind', 8448, 0, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 119), ('indexed indirect pointer wraps', ['indx', 254, 1, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 13432), ('indexed indirect plain', ['indx', 14, 2, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 43981), ('indirect indexed adds after load', ['indy', 16, 0, 17, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 43998), ('indirect indexed pointer wraps and crosses', ['indy', 255, 0, 240, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 13672), ('indirect indexed result wraps', ['indy', 128, 0, 33, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 17), ('zero page plain', ['zp', 511, 0, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 255), ('absolute Y with X set', ['absy', 8193, 17, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 8193), ('absolute Y indexed', ['absy', 12528, 5, 33, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 12561)], [('zero page indexed wraps', ['zpx', 242, 32, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 18), ('absolute indexed crosses page', ['absx', 4336, 34, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 4370), ('absolute indexed wraps top', ['absx', 65520, 50, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 34), ('indirect jump page bug', ['ind', 4351, 0, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 25889), ('indirect jump normal', ['ind', 16, 0, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 43981), ('indexed indirect pointer wraps', ['indx', 254, 1, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 13432), ('indexed indirect plain', ['indx', 14, 2, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 43981), ('indirect indexed adds after load', ['indy', 16, 0, 18, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 43999), ('indirect indexed pointer wraps and crosses', ['indy', 255, 0, 240, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 13672), ('indirect indexed result wraps', ['indy', 128, 0, 34, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 18), ('zero page plain', ['zp', 511, 0, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 255), ('absolute Y with X set', ['absy', 8194, 17, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 8194), ('absolute Y indexed', ['absy', 12528, 5, 34, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 12562)], [('zero page indexed wraps', ['zpx', 243, 32, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 19), ('absolute indexed crosses page', ['absx', 4336, 35, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 4371), ('absolute indexed wraps top', ['absx', 65520, 51, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 35), ('indirect jump page bug', ['ind', 4351, 0, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 25889), ('indirect jump normal', ['ind', 8448, 0, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 119), ('indexed indirect pointer wraps', ['indx', 254, 1, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 13432), ('indexed indirect plain', ['indx', 14, 2, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 43981), ('indirect indexed adds after load', ['indy', 16, 0, 19, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 44000), ('indirect indexed pointer wraps and crosses', ['indy', 255, 0, 240, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 13672), ('indirect indexed result wraps', ['indy', 128, 0, 35, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 19), ('zero page plain', ['zp', 511, 0, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 255), ('absolute Y with X set', ['absy', 8195, 17, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 8195), ('absolute Y indexed', ['absy', 12528, 5, 35, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 12563)], [('zero page indexed wraps', ['zpx', 244, 32, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 20), ('absolute indexed crosses page', ['absx', 4336, 36, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 4372), ('absolute indexed wraps top', ['absx', 65520, 52, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 36), ('indirect jump page bug', ['ind', 4351, 0, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 25889), ('indirect jump normal', ['ind', 16, 0, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 43981), ('indexed indirect pointer wraps', ['indx', 254, 1, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 13432), ('indexed indirect plain', ['indx', 14, 2, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 43981), ('indirect indexed adds after load', ['indy', 16, 0, 20, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 44001), ('indirect indexed pointer wraps and crosses', ['indy', 255, 0, 240, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 13672), ('indirect indexed result wraps', ['indy', 128, 0, 36, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 20), ('zero page plain', ['zp', 511, 0, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 255), ('absolute Y with X set', ['absy', 8196, 17, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 8196), ('absolute Y indexed', ['absy', 12528, 5, 36, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 12564)], [('zero page indexed wraps', ['zpx', 245, 32, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 21), ('absolute indexed crosses page', ['absx', 4336, 37, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 4373), ('absolute indexed wraps top', ['absx', 65520, 53, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 37), ('indirect jump page bug', ['ind', 4351, 0, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 25889), ('indirect jump normal', ['ind', 8448, 0, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 119), ('indexed indirect pointer wraps', ['indx', 254, 1, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 13432), ('indexed indirect plain', ['indx', 14, 2, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 43981), ('indirect indexed adds after load', ['indy', 16, 0, 21, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 44002), ('indirect indexed pointer wraps and crosses', ['indy', 255, 0, 240, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 13672), ('indirect indexed result wraps', ['indy', 128, 0, 37, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 21), ('zero page plain', ['zp', 511, 0, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 255), ('absolute Y with X set', ['absy', 8197, 17, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 8197), ('absolute Y indexed', ['absy', 12528, 5, 37, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 12565)]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
zero page indexed wraps27317Failed
absolute indexed crosses page43694369Passed
absolute indexed wraps top3333Passed
indirect jump page bug2588925889Passed
indirect jump normal119119Passed
indexed indirect pointer wraps1343213432Passed
indexed indirect plain4398143981Passed
indirect indexed adds after load4399843998Passed
indirect indexed pointer wraps and crosses1367213672Passed
indirect indexed result wraps1717Passed
zero page plain255255Passed
absolute Y with X set81938193Passed
absolute Y indexed1256112561Passed

SHA-256 / 853e3293c920474c490cc4eaef174dc233db2dc8e2cdbda5adb5a1c8b74336ec

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(*args):
    mode, operand, x, y, mem = args
    def rd(a):
        return mem.get(str(a & 0xFFFF), 0)
    if mode == 'zp': return operand & 0xFF
    if mode == 'zpx': return (operand + x) & 0xFFFF
    if mode == 'abs': return operand
    if mode == 'absx': return (operand + x) & 0xFFFF
    if mode == 'absy': return (operand + y) & 0xFFFF
    if mode == 'ind':
        lo = rd(operand)
        hi = rd((operand & 0xFF00) | ((operand + 1) & 0xFF))
        return hi << 8 | lo
    if mode == 'indx':
        p = (operand + x) & 0xFF
        return rd((p + 1) & 0xFF) << 8 | rd(p)
    if mode == 'indy':
        p = operand & 0xFF
        base = rd((p + 1) & 0xFF) << 8 | rd(p)
        return (base + y) & 0xFFFF
    return None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('zero page indexed wraps', ['zpx', 241, 32, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 17), ('absolute indexed crosses page', ['absx', 4336, 33, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 4369), ('absolute indexed wraps top', ['absx', 65520, 49, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 33), ('indirect jump page bug', ['ind', 4351, 0, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 25889), ('indirect jump normal', ['ind', 8448, 0, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 119), ('indexed indirect pointer wraps', ['indx', 254, 1, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 13432), ('indexed indirect plain', ['indx', 14, 2, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 43981), ('indirect indexed adds after load', ['indy', 16, 0, 17, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 43998), ('indirect indexed pointer wraps and crosses', ['indy', 255, 0, 240, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 13672), ('indirect indexed result wraps', ['indy', 128, 0, 33, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 17), ('zero page plain', ['zp', 511, 0, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 255), ('absolute Y with X set', ['absy', 8193, 17, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 8193), ('absolute Y indexed', ['absy', 12528, 5, 33, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 12561)], [('zero page indexed wraps', ['zpx', 242, 32, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 18), ('absolute indexed crosses page', ['absx', 4336, 34, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 4370), ('absolute indexed wraps top', ['absx', 65520, 50, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 34), ('indirect jump page bug', ['ind', 4351, 0, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 25889), ('indirect jump normal', ['ind', 16, 0, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 43981), ('indexed indirect pointer wraps', ['indx', 254, 1, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 13432), ('indexed indirect plain', ['indx', 14, 2, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 43981), ('indirect indexed adds after load', ['indy', 16, 0, 18, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 43999), ('indirect indexed pointer wraps and crosses', ['indy', 255, 0, 240, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 13672), ('indirect indexed result wraps', ['indy', 128, 0, 34, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 18), ('zero page plain', ['zp', 511, 0, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 255), ('absolute Y with X set', ['absy', 8194, 17, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 8194), ('absolute Y indexed', ['absy', 12528, 5, 34, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 12562)], [('zero page indexed wraps', ['zpx', 243, 32, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 19), ('absolute indexed crosses page', ['absx', 4336, 35, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 4371), ('absolute indexed wraps top', ['absx', 65520, 51, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 35), ('indirect jump page bug', ['ind', 4351, 0, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 25889), ('indirect jump normal', ['ind', 8448, 0, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 119), ('indexed indirect pointer wraps', ['indx', 254, 1, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 13432), ('indexed indirect plain', ['indx', 14, 2, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 43981), ('indirect indexed adds after load', ['indy', 16, 0, 19, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 44000), ('indirect indexed pointer wraps and crosses', ['indy', 255, 0, 240, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 13672), ('indirect indexed result wraps', ['indy', 128, 0, 35, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 19), ('zero page plain', ['zp', 511, 0, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 255), ('absolute Y with X set', ['absy', 8195, 17, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 8195), ('absolute Y indexed', ['absy', 12528, 5, 35, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 12563)], [('zero page indexed wraps', ['zpx', 244, 32, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 20), ('absolute indexed crosses page', ['absx', 4336, 36, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 4372), ('absolute indexed wraps top', ['absx', 65520, 52, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 36), ('indirect jump page bug', ['ind', 4351, 0, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 25889), ('indirect jump normal', ['ind', 16, 0, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 43981), ('indexed indirect pointer wraps', ['indx', 254, 1, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 13432), ('indexed indirect plain', ['indx', 14, 2, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 43981), ('indirect indexed adds after load', ['indy', 16, 0, 20, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 44001), ('indirect indexed pointer wraps and crosses', ['indy', 255, 0, 240, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 13672), ('indirect indexed result wraps', ['indy', 128, 0, 36, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 20), ('zero page plain', ['zp', 511, 0, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 255), ('absolute Y with X set', ['absy', 8196, 17, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 8196), ('absolute Y indexed', ['absy', 12528, 5, 36, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 12564)], [('zero page indexed wraps', ['zpx', 245, 32, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 21), ('absolute indexed crosses page', ['absx', 4336, 37, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 4373), ('absolute indexed wraps top', ['absx', 65520, 53, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 37), ('indirect jump page bug', ['ind', 4351, 0, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 25889), ('indirect jump normal', ['ind', 8448, 0, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 119), ('indexed indirect pointer wraps', ['indx', 254, 1, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 13432), ('indexed indirect plain', ['indx', 14, 2, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 43981), ('indirect indexed adds after load', ['indy', 16, 0, 21, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 44002), ('indirect indexed pointer wraps and crosses', ['indy', 255, 0, 240, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 13672), ('indirect indexed result wraps', ['indy', 128, 0, 37, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 21), ('zero page plain', ['zp', 511, 0, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 255), ('absolute Y with X set', ['absy', 8197, 17, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 8197), ('absolute Y indexed', ['absy', 12528, 5, 37, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 12565)]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
zero page indexed wraps27317Failed
absolute indexed crosses page43694369Passed
absolute indexed wraps top3333Passed
indirect jump page bug2588925889Passed
indirect jump normal119119Passed
indexed indirect pointer wraps1343213432Passed
indexed indirect plain4398143981Passed
indirect indexed adds after load4399843998Passed
indirect indexed pointer wraps and crosses1367213672Passed
indirect indexed result wraps1717Passed
zero page plain255255Passed
absolute Y with X set81938193Passed
absolute Y indexed1256112561Passed

SHA-256 / 4b4fc49f16907a0842bd46c3d53f37a86cd9671ad0786e5f30243a5408738a40

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(*args):
    mode, operand, x, y, mem = args
    def rd(a):
        return mem.get(str(a & 0xFFFF), 0)
    if mode == 'zp': return operand & 0xFF
    if mode == 'zpx': return (operand + x) & 0xFF
    if mode == 'abs': return operand
    if mode == 'absx': return (operand + x) & 0xFFFF
    if mode == 'absy': return (operand + y) & 0xFFFF
    if mode == 'ind':
        lo = rd(operand)
        hi = rd((operand & 0xFF00) | ((operand + 1) & 0xFF))
        return hi << 8 | lo
    if mode == 'indx':
        p = (operand + x) & 0xFF
        return rd((p + 1) & 0xFF) << 8 | rd(p)
    if mode == 'indy':
        p = operand & 0xFF
        base = rd((p + 1) & 0xFF) << 8 | rd(p)
        return (base + y) & 0xFFFF
    return None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('zero page indexed wraps', ['zpx', 241, 32, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 17), ('absolute indexed crosses page', ['absx', 4336, 33, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 4369), ('absolute indexed wraps top', ['absx', 65520, 49, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 33), ('indirect jump page bug', ['ind', 4351, 0, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 25889), ('indirect jump normal', ['ind', 8448, 0, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 119), ('indexed indirect pointer wraps', ['indx', 254, 1, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 13432), ('indexed indirect plain', ['indx', 14, 2, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 43981), ('indirect indexed adds after load', ['indy', 16, 0, 17, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 43998), ('indirect indexed pointer wraps and crosses', ['indy', 255, 0, 240, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 13672), ('indirect indexed result wraps', ['indy', 128, 0, 33, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 17), ('zero page plain', ['zp', 511, 0, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 255), ('absolute Y with X set', ['absy', 8193, 17, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 8193), ('absolute Y indexed', ['absy', 12528, 5, 33, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 12561)], [('zero page indexed wraps', ['zpx', 242, 32, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 18), ('absolute indexed crosses page', ['absx', 4336, 34, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 4370), ('absolute indexed wraps top', ['absx', 65520, 50, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 34), ('indirect jump page bug', ['ind', 4351, 0, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 25889), ('indirect jump normal', ['ind', 16, 0, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 43981), ('indexed indirect pointer wraps', ['indx', 254, 1, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 13432), ('indexed indirect plain', ['indx', 14, 2, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 43981), ('indirect indexed adds after load', ['indy', 16, 0, 18, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 43999), ('indirect indexed pointer wraps and crosses', ['indy', 255, 0, 240, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 13672), ('indirect indexed result wraps', ['indy', 128, 0, 34, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 18), ('zero page plain', ['zp', 511, 0, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 255), ('absolute Y with X set', ['absy', 8194, 17, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 8194), ('absolute Y indexed', ['absy', 12528, 5, 34, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 12562)], [('zero page indexed wraps', ['zpx', 243, 32, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 19), ('absolute indexed crosses page', ['absx', 4336, 35, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 4371), ('absolute indexed wraps top', ['absx', 65520, 51, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 35), ('indirect jump page bug', ['ind', 4351, 0, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 25889), ('indirect jump normal', ['ind', 8448, 0, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 119), ('indexed indirect pointer wraps', ['indx', 254, 1, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 13432), ('indexed indirect plain', ['indx', 14, 2, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 43981), ('indirect indexed adds after load', ['indy', 16, 0, 19, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 44000), ('indirect indexed pointer wraps and crosses', ['indy', 255, 0, 240, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 13672), ('indirect indexed result wraps', ['indy', 128, 0, 35, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 19), ('zero page plain', ['zp', 511, 0, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 255), ('absolute Y with X set', ['absy', 8195, 17, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 8195), ('absolute Y indexed', ['absy', 12528, 5, 35, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 12563)], [('zero page indexed wraps', ['zpx', 244, 32, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 20), ('absolute indexed crosses page', ['absx', 4336, 36, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 4372), ('absolute indexed wraps top', ['absx', 65520, 52, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 36), ('indirect jump page bug', ['ind', 4351, 0, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 25889), ('indirect jump normal', ['ind', 16, 0, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 43981), ('indexed indirect pointer wraps', ['indx', 254, 1, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 13432), ('indexed indirect plain', ['indx', 14, 2, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 43981), ('indirect indexed adds after load', ['indy', 16, 0, 20, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 44001), ('indirect indexed pointer wraps and crosses', ['indy', 255, 0, 240, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 13672), ('indirect indexed result wraps', ['indy', 128, 0, 36, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 20), ('zero page plain', ['zp', 511, 0, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 255), ('absolute Y with X set', ['absy', 8196, 17, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 8196), ('absolute Y indexed', ['absy', 12528, 5, 36, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 12564)], [('zero page indexed wraps', ['zpx', 245, 32, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 21), ('absolute indexed crosses page', ['absx', 4336, 37, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 4373), ('absolute indexed wraps top', ['absx', 65520, 53, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 37), ('indirect jump page bug', ['ind', 4351, 0, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 25889), ('indirect jump normal', ['ind', 8448, 0, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 119), ('indexed indirect pointer wraps', ['indx', 254, 1, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 13432), ('indexed indirect plain', ['indx', 14, 2, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 43981), ('indirect indexed adds after load', ['indy', 16, 0, 21, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 44002), ('indirect indexed pointer wraps and crosses', ['indy', 255, 0, 240, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 13672), ('indirect indexed result wraps', ['indy', 128, 0, 37, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 21), ('zero page plain', ['zp', 511, 0, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 255), ('absolute Y with X set', ['absy', 8197, 17, 0, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 8197), ('absolute Y indexed', ['absy', 12528, 5, 37, {'0': 52, '1': 18, '255': 120, '254': 86, '16': 205, '17': 171, '4351': 33, '4352': 67, '4096': 101, '8447': 153, '8192': 136, '8448': 119, '128': 240, '129': 255}], 12565)]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
zero page indexed wraps1717Passed
absolute indexed crosses page43694369Passed
absolute indexed wraps top3333Passed
indirect jump page bug2588925889Passed
indirect jump normal119119Passed
indexed indirect pointer wraps1343213432Passed
indexed indirect plain4398143981Passed
indirect indexed adds after load4399843998Passed
indirect indexed pointer wraps and crosses1367213672Passed
indirect indexed result wraps1717Passed
zero page plain255255Passed
absolute Y with X set81938193Passed
absolute Y indexed1256112561Passed

SHA-256 / 6b4721ce1c1d5d79891fed31a54ec8ca18fc97a8eabafcb6f201e02c44b3c252

Verification & scope

A deterministic bounded teaching model of one emulator rule; the instruction semantics are a stipulated contract inspired by common ISAs and are not a claim of cycle-exact or architectural conformance. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-29T14:51:17.258233+00:00.

Case digest / c55edbdf7d0b6781d0052e54c71b013ceadd3b38ae9e49c511a8fefb94bd139b