{"abstract":"Incrementing 0xFF sets carry, clobbering a carry from an earlier add.","category":"Instruction set emulation","checks":9,"contract":"Input [a, ops]; ops are 'inc', 'dec', ['add', v], ['sub', v] on 8-bit A; carry starts 0. After each op report [A, S, Z, H, PV, N, C]. inc: H = carry out of bit 3, PV = (A was 0x7F), N = 0, C unchanged. dec: H = borrow from bit 4 (low nibble was 0), PV = (A was 0x80), N = 1, C unchanged. add: H = carry out of bit 3, PV = signed overflow, N = 0, C = carry out. sub: H = borrow into bit 4 (low nibble of A < low nibble of v), PV = signed overflow, N = 1, C = borrow.","evaluation_group":"w2-instruction-set-emulation-z80-flags","failed_approach":"Clearing carry on INC also destroys the previous carry.","family":"w2-instruction-set-emulation-z80-flags-inc-preserves-carry","id":"FA-89651","implementations":{"attempt":{"sha256":"ff4cab8f73d842d98c24e6237609e7209dd760db235ed24698c6a545c27a1b71","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(*args):\n    a, ops = args\n    c = 0\n    out = []\n    for op in ops:\n        if op == 'inc':\n            r = (a + 1) & 0xFF\n            h = int((a & 0x0F) == 0x0F)\n            pv = int(a == 0x7F)\n            c = 0\n            nflag = 0\n        elif op == 'dec':\n            r = (a - 1) & 0xFF\n            h = int((a & 0x0F) == 0x00)\n            pv = int(a == 0x80)\n            nflag = 1\n        else:\n            kind, v = op\n            if kind == 'add':\n                full = a + v\n                h = int((a & 0x0F) + (v & 0x0F) > 0x0F)\n                pv = int(((a ^ ~v) & (a ^ full) & 0x80) != 0)\n                nflag = 0\n            else:\n                full = a - v\n                h = int((a & 0x0F) < (v & 0x0F))\n                pv = int(((a ^ v) & (a ^ full) & 0x80) != 0)\n                nflag = 1\n            c = int(full > 0xFF or full < 0)\n            r = full & 0xFF\n        a = r\n        out.append([a, r >> 7, int(r == 0), h, pv, nflag, c])\n    return out\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('inc across nibble', [31, ['inc', 'inc']], [[32, 0, 0, 1, 0, 0, 0], [33, 0, 0, 0, 0, 0, 0]]), ('inc into sign overflow', [126, ['inc', 'inc', 'inc']], [[127, 0, 0, 0, 0, 0, 0], [128, 1, 0, 1, 1, 0, 0], [129, 1, 0, 0, 0, 0, 0]]), ('inc wraps to zero keeps carry', [240, [['add', 32], 'inc', 'dec']], [[16, 0, 0, 0, 0, 0, 1], [17, 0, 0, 0, 0, 0, 1], [16, 0, 0, 0, 0, 1, 1]]), ('inc from ff', [255, ['inc', ['sub', 1], 'inc']], [[0, 0, 1, 1, 0, 0, 0], [255, 1, 0, 1, 0, 1, 1], [0, 0, 1, 1, 0, 0, 1]]), ('dec across nibble', [17, ['dec', 'dec', 'dec']], [[16, 0, 0, 0, 0, 1, 0], [15, 0, 0, 1, 0, 1, 0], [14, 0, 0, 0, 0, 1, 0]]), ('dec out of sign overflow', [129, ['dec', 'dec', 'dec']], [[128, 1, 0, 0, 0, 1, 0], [127, 0, 0, 1, 1, 1, 0], [126, 0, 0, 0, 0, 1, 0]]), ('sub half borrow', [50, [['sub', 18], ['sub', 4], ['sub', 15]]], [[32, 0, 0, 0, 0, 1, 0], [28, 0, 0, 1, 0, 1, 0], [13, 0, 0, 1, 0, 1, 0]]), ('sub overflow', [128, [['sub', 1], ['add', 113], ['sub', 144]]], [[127, 0, 0, 1, 1, 1, 0], [240, 1, 0, 1, 1, 0, 0], [96, 0, 0, 0, 0, 1, 0]]), ('add half carry and overflow', [58, [['add', 7], ['add', 64]]], [[65, 0, 0, 1, 0, 0, 0], [129, 1, 0, 0, 1, 0, 0]])], [('inc across nibble', [47, ['inc', 'inc']], [[48, 0, 0, 1, 0, 0, 0], [49, 0, 0, 0, 0, 0, 0]]), ('inc into sign overflow', [126, ['inc', 'inc', 'inc']], [[127, 0, 0, 0, 0, 0, 0], [128, 1, 0, 1, 1, 0, 0], [129, 1, 0, 0, 0, 0, 0]]), ('inc wraps to zero keeps carry', [240, [['add', 32], 'inc', 'dec', 'dec']], [[16, 0, 0, 0, 0, 0, 1], [17, 0, 0, 0, 0, 0, 1], [16, 0, 0, 0, 0, 1, 1], [15, 0, 0, 1, 0, 1, 1]]), ('inc from ff', [255, ['inc', ['sub', 1], 'inc']], [[0, 0, 1, 1, 0, 0, 0], [255, 1, 0, 1, 0, 1, 1], [0, 0, 1, 1, 0, 0, 1]]), ('dec across nibble', [18, ['dec', 'dec', 'dec']], [[17, 0, 0, 0, 0, 1, 0], [16, 0, 0, 0, 0, 1, 0], [15, 0, 0, 1, 0, 1, 0]]), ('dec out of sign overflow', [129, ['dec', 'dec', 'dec']], [[128, 1, 0, 0, 0, 1, 0], [127, 0, 0, 1, 1, 1, 0], [126, 0, 0, 0, 0, 1, 0]]), ('sub half borrow', [50, [['sub', 18], ['sub', 5], ['sub', 15]]], [[32, 0, 0, 0, 0, 1, 0], [27, 0, 0, 1, 0, 1, 0], [12, 0, 0, 1, 0, 1, 0]]), ('sub overflow', [128, [['sub', 1], ['add', 114], ['sub', 144]]], [[127, 0, 0, 1, 1, 1, 0], [241, 1, 0, 1, 1, 0, 0], [97, 0, 0, 0, 0, 1, 0]]), ('add half carry and overflow', [58, [['add', 8], ['add', 64]]], [[66, 0, 0, 1, 0, 0, 0], [130, 1, 0, 0, 1, 0, 0]])], [('inc across nibble', [63, ['inc', 'inc']], [[64, 0, 0, 1, 0, 0, 0], [65, 0, 0, 0, 0, 0, 0]]), ('inc into sign overflow', [126, ['inc', 'inc', 'inc']], [[127, 0, 0, 0, 0, 0, 0], [128, 1, 0, 1, 1, 0, 0], [129, 1, 0, 0, 0, 0, 0]]), ('inc wraps to zero keeps carry', [240, [['add', 32], 'inc', 'dec', 'dec', 'dec']], [[16, 0, 0, 0, 0, 0, 1], [17, 0, 0, 0, 0, 0, 1], [16, 0, 0, 0, 0, 1, 1], [15, 0, 0, 1, 0, 1, 1], [14, 0, 0, 0, 0, 1, 1]]), ('inc from ff', [255, ['inc', ['sub', 1], 'inc']], [[0, 0, 1, 1, 0, 0, 0], [255, 1, 0, 1, 0, 1, 1], [0, 0, 1, 1, 0, 0, 1]]), ('dec across nibble', [19, ['dec', 'dec', 'dec']], [[18, 0, 0, 0, 0, 1, 0], [17, 0, 0, 0, 0, 1, 0], [16, 0, 0, 0, 0, 1, 0]]), ('dec out of sign overflow', [129, ['dec', 'dec', 'dec']], [[128, 1, 0, 0, 0, 1, 0], [127, 0, 0, 1, 1, 1, 0], [126, 0, 0, 0, 0, 1, 0]]), ('sub half borrow', [50, [['sub', 18], ['sub', 6], ['sub', 15]]], [[32, 0, 0, 0, 0, 1, 0], [26, 0, 0, 1, 0, 1, 0], [11, 0, 0, 1, 0, 1, 0]]), ('sub overflow', [128, [['sub', 1], ['add', 115], ['sub', 144]]], [[127, 0, 0, 1, 1, 1, 0], [242, 1, 0, 1, 1, 0, 0], [98, 0, 0, 0, 0, 1, 0]]), ('add half carry and overflow', [58, [['add', 9], ['add', 64]]], [[67, 0, 0, 1, 0, 0, 0], [131, 1, 0, 0, 1, 0, 0]])], [('inc across nibble', [79, ['inc', 'inc']], [[80, 0, 0, 1, 0, 0, 0], [81, 0, 0, 0, 0, 0, 0]]), ('inc into sign overflow', [126, ['inc', 'inc', 'inc']], [[127, 0, 0, 0, 0, 0, 0], [128, 1, 0, 1, 1, 0, 0], [129, 1, 0, 0, 0, 0, 0]]), ('inc wraps to zero keeps carry', [240, [['add', 32], 'inc', 'dec', 'dec', 'dec', 'dec']], [[16, 0, 0, 0, 0, 0, 1], [17, 0, 0, 0, 0, 0, 1], [16, 0, 0, 0, 0, 1, 1], [15, 0, 0, 1, 0, 1, 1], [14, 0, 0, 0, 0, 1, 1], [13, 0, 0, 0, 0, 1, 1]]), ('inc from ff', [255, ['inc', ['sub', 1], 'inc']], [[0, 0, 1, 1, 0, 0, 0], [255, 1, 0, 1, 0, 1, 1], [0, 0, 1, 1, 0, 0, 1]]), ('dec across nibble', [20, ['dec', 'dec', 'dec']], [[19, 0, 0, 0, 0, 1, 0], [18, 0, 0, 0, 0, 1, 0], [17, 0, 0, 0, 0, 1, 0]]), ('dec out of sign overflow', [129, ['dec', 'dec', 'dec']], [[128, 1, 0, 0, 0, 1, 0], [127, 0, 0, 1, 1, 1, 0], [126, 0, 0, 0, 0, 1, 0]]), ('sub half borrow', [50, [['sub', 18], ['sub', 7], ['sub', 15]]], [[32, 0, 0, 0, 0, 1, 0], [25, 0, 0, 1, 0, 1, 0], [10, 0, 0, 1, 0, 1, 0]]), ('sub overflow', [128, [['sub', 1], ['add', 116], ['sub', 144]]], [[127, 0, 0, 1, 1, 1, 0], [243, 1, 0, 1, 1, 0, 0], [99, 0, 0, 0, 0, 1, 0]]), ('add half carry and overflow', [58, [['add', 10], ['add', 64]]], [[68, 0, 0, 1, 0, 0, 0], [132, 1, 0, 0, 1, 0, 0]])], [('inc across nibble', [95, ['inc', 'inc']], [[96, 0, 0, 1, 0, 0, 0], [97, 0, 0, 0, 0, 0, 0]]), ('inc into sign overflow', [126, ['inc', 'inc', 'inc']], [[127, 0, 0, 0, 0, 0, 0], [128, 1, 0, 1, 1, 0, 0], [129, 1, 0, 0, 0, 0, 0]]), ('inc wraps to zero keeps carry', [240, [['add', 32], 'inc', 'dec', 'dec', 'dec', 'dec', 'dec']], [[16, 0, 0, 0, 0, 0, 1], [17, 0, 0, 0, 0, 0, 1], [16, 0, 0, 0, 0, 1, 1], [15, 0, 0, 1, 0, 1, 1], [14, 0, 0, 0, 0, 1, 1], [13, 0, 0, 0, 0, 1, 1], [12, 0, 0, 0, 0, 1, 1]]), ('inc from ff', [255, ['inc', ['sub', 1], 'inc']], [[0, 0, 1, 1, 0, 0, 0], [255, 1, 0, 1, 0, 1, 1], [0, 0, 1, 1, 0, 0, 1]]), ('dec across nibble', [21, ['dec', 'dec', 'dec']], [[20, 0, 0, 0, 0, 1, 0], [19, 0, 0, 0, 0, 1, 0], [18, 0, 0, 0, 0, 1, 0]]), ('dec out of sign overflow', [129, ['dec', 'dec', 'dec']], [[128, 1, 0, 0, 0, 1, 0], [127, 0, 0, 1, 1, 1, 0], [126, 0, 0, 0, 0, 1, 0]]), ('sub half borrow', [50, [['sub', 18], ['sub', 8], ['sub', 15]]], [[32, 0, 0, 0, 0, 1, 0], [24, 0, 0, 1, 0, 1, 0], [9, 0, 0, 1, 0, 1, 0]]), ('sub overflow', [128, [['sub', 1], ['add', 117], ['sub', 144]]], [[127, 0, 0, 1, 1, 1, 0], [244, 1, 0, 1, 1, 0, 0], [100, 0, 0, 0, 0, 1, 0]]), ('add half carry and overflow', [58, [['add', 11], ['add', 64]]], [[69, 0, 0, 1, 0, 0, 0], [133, 1, 0, 0, 1, 0, 0]])]]\nfor label, args, expected in fixtures[N-1]:\n    check(label, solve(*args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"5ebdaa7119947805fa043fa1d193ab9b69643669c8d8207ea8388e423d77a71b","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(*args):\n    a, ops = args\n    c = 0\n    out = []\n    for op in ops:\n        if op == 'inc':\n            r = (a + 1) & 0xFF\n            h = int((a & 0x0F) == 0x0F)\n            pv = int(a == 0x7F)\n            c = int(a == 0xFF)\n            nflag = 0\n        elif op == 'dec':\n            r = (a - 1) & 0xFF\n            h = int((a & 0x0F) == 0x00)\n            pv = int(a == 0x80)\n            nflag = 1\n        else:\n            kind, v = op\n            if kind == 'add':\n                full = a + v\n                h = int((a & 0x0F) + (v & 0x0F) > 0x0F)\n                pv = int(((a ^ ~v) & (a ^ full) & 0x80) != 0)\n                nflag = 0\n            else:\n                full = a - v\n                h = int((a & 0x0F) < (v & 0x0F))\n                pv = int(((a ^ v) & (a ^ full) & 0x80) != 0)\n                nflag = 1\n            c = int(full > 0xFF or full < 0)\n            r = full & 0xFF\n        a = r\n        out.append([a, r >> 7, int(r == 0), h, pv, nflag, c])\n    return out\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('inc across nibble', [31, ['inc', 'inc']], [[32, 0, 0, 1, 0, 0, 0], [33, 0, 0, 0, 0, 0, 0]]), ('inc into sign overflow', [126, ['inc', 'inc', 'inc']], [[127, 0, 0, 0, 0, 0, 0], [128, 1, 0, 1, 1, 0, 0], [129, 1, 0, 0, 0, 0, 0]]), ('inc wraps to zero keeps carry', [240, [['add', 32], 'inc', 'dec']], [[16, 0, 0, 0, 0, 0, 1], [17, 0, 0, 0, 0, 0, 1], [16, 0, 0, 0, 0, 1, 1]]), ('inc from ff', [255, ['inc', ['sub', 1], 'inc']], [[0, 0, 1, 1, 0, 0, 0], [255, 1, 0, 1, 0, 1, 1], [0, 0, 1, 1, 0, 0, 1]]), ('dec across nibble', [17, ['dec', 'dec', 'dec']], [[16, 0, 0, 0, 0, 1, 0], [15, 0, 0, 1, 0, 1, 0], [14, 0, 0, 0, 0, 1, 0]]), ('dec out of sign overflow', [129, ['dec', 'dec', 'dec']], [[128, 1, 0, 0, 0, 1, 0], [127, 0, 0, 1, 1, 1, 0], [126, 0, 0, 0, 0, 1, 0]]), ('sub half borrow', [50, [['sub', 18], ['sub', 4], ['sub', 15]]], [[32, 0, 0, 0, 0, 1, 0], [28, 0, 0, 1, 0, 1, 0], [13, 0, 0, 1, 0, 1, 0]]), ('sub overflow', [128, [['sub', 1], ['add', 113], ['sub', 144]]], [[127, 0, 0, 1, 1, 1, 0], [240, 1, 0, 1, 1, 0, 0], [96, 0, 0, 0, 0, 1, 0]]), ('add half carry and overflow', [58, [['add', 7], ['add', 64]]], [[65, 0, 0, 1, 0, 0, 0], [129, 1, 0, 0, 1, 0, 0]])], [('inc across nibble', [47, ['inc', 'inc']], [[48, 0, 0, 1, 0, 0, 0], [49, 0, 0, 0, 0, 0, 0]]), ('inc into sign overflow', [126, ['inc', 'inc', 'inc']], [[127, 0, 0, 0, 0, 0, 0], [128, 1, 0, 1, 1, 0, 0], [129, 1, 0, 0, 0, 0, 0]]), ('inc wraps to zero keeps carry', [240, [['add', 32], 'inc', 'dec', 'dec']], [[16, 0, 0, 0, 0, 0, 1], [17, 0, 0, 0, 0, 0, 1], [16, 0, 0, 0, 0, 1, 1], [15, 0, 0, 1, 0, 1, 1]]), ('inc from ff', [255, ['inc', ['sub', 1], 'inc']], [[0, 0, 1, 1, 0, 0, 0], [255, 1, 0, 1, 0, 1, 1], [0, 0, 1, 1, 0, 0, 1]]), ('dec across nibble', [18, ['dec', 'dec', 'dec']], [[17, 0, 0, 0, 0, 1, 0], [16, 0, 0, 0, 0, 1, 0], [15, 0, 0, 1, 0, 1, 0]]), ('dec out of sign overflow', [129, ['dec', 'dec', 'dec']], [[128, 1, 0, 0, 0, 1, 0], [127, 0, 0, 1, 1, 1, 0], [126, 0, 0, 0, 0, 1, 0]]), ('sub half borrow', [50, [['sub', 18], ['sub', 5], ['sub', 15]]], [[32, 0, 0, 0, 0, 1, 0], [27, 0, 0, 1, 0, 1, 0], [12, 0, 0, 1, 0, 1, 0]]), ('sub overflow', [128, [['sub', 1], ['add', 114], ['sub', 144]]], [[127, 0, 0, 1, 1, 1, 0], [241, 1, 0, 1, 1, 0, 0], [97, 0, 0, 0, 0, 1, 0]]), ('add half carry and overflow', [58, [['add', 8], ['add', 64]]], [[66, 0, 0, 1, 0, 0, 0], [130, 1, 0, 0, 1, 0, 0]])], [('inc across nibble', [63, ['inc', 'inc']], [[64, 0, 0, 1, 0, 0, 0], [65, 0, 0, 0, 0, 0, 0]]), ('inc into sign overflow', [126, ['inc', 'inc', 'inc']], [[127, 0, 0, 0, 0, 0, 0], [128, 1, 0, 1, 1, 0, 0], [129, 1, 0, 0, 0, 0, 0]]), ('inc wraps to zero keeps carry', [240, [['add', 32], 'inc', 'dec', 'dec', 'dec']], [[16, 0, 0, 0, 0, 0, 1], [17, 0, 0, 0, 0, 0, 1], [16, 0, 0, 0, 0, 1, 1], [15, 0, 0, 1, 0, 1, 1], [14, 0, 0, 0, 0, 1, 1]]), ('inc from ff', [255, ['inc', ['sub', 1], 'inc']], [[0, 0, 1, 1, 0, 0, 0], [255, 1, 0, 1, 0, 1, 1], [0, 0, 1, 1, 0, 0, 1]]), ('dec across nibble', [19, ['dec', 'dec', 'dec']], [[18, 0, 0, 0, 0, 1, 0], [17, 0, 0, 0, 0, 1, 0], [16, 0, 0, 0, 0, 1, 0]]), ('dec out of sign overflow', [129, ['dec', 'dec', 'dec']], [[128, 1, 0, 0, 0, 1, 0], [127, 0, 0, 1, 1, 1, 0], [126, 0, 0, 0, 0, 1, 0]]), ('sub half borrow', [50, [['sub', 18], ['sub', 6], ['sub', 15]]], [[32, 0, 0, 0, 0, 1, 0], [26, 0, 0, 1, 0, 1, 0], [11, 0, 0, 1, 0, 1, 0]]), ('sub overflow', [128, [['sub', 1], ['add', 115], ['sub', 144]]], [[127, 0, 0, 1, 1, 1, 0], [242, 1, 0, 1, 1, 0, 0], [98, 0, 0, 0, 0, 1, 0]]), ('add half carry and overflow', [58, [['add', 9], ['add', 64]]], [[67, 0, 0, 1, 0, 0, 0], [131, 1, 0, 0, 1, 0, 0]])], [('inc across nibble', [79, ['inc', 'inc']], [[80, 0, 0, 1, 0, 0, 0], [81, 0, 0, 0, 0, 0, 0]]), ('inc into sign overflow', [126, ['inc', 'inc', 'inc']], [[127, 0, 0, 0, 0, 0, 0], [128, 1, 0, 1, 1, 0, 0], [129, 1, 0, 0, 0, 0, 0]]), ('inc wraps to zero keeps carry', [240, [['add', 32], 'inc', 'dec', 'dec', 'dec', 'dec']], [[16, 0, 0, 0, 0, 0, 1], [17, 0, 0, 0, 0, 0, 1], [16, 0, 0, 0, 0, 1, 1], [15, 0, 0, 1, 0, 1, 1], [14, 0, 0, 0, 0, 1, 1], [13, 0, 0, 0, 0, 1, 1]]), ('inc from ff', [255, ['inc', ['sub', 1], 'inc']], [[0, 0, 1, 1, 0, 0, 0], [255, 1, 0, 1, 0, 1, 1], [0, 0, 1, 1, 0, 0, 1]]), ('dec across nibble', [20, ['dec', 'dec', 'dec']], [[19, 0, 0, 0, 0, 1, 0], [18, 0, 0, 0, 0, 1, 0], [17, 0, 0, 0, 0, 1, 0]]), ('dec out of sign overflow', [129, ['dec', 'dec', 'dec']], [[128, 1, 0, 0, 0, 1, 0], [127, 0, 0, 1, 1, 1, 0], [126, 0, 0, 0, 0, 1, 0]]), ('sub half borrow', [50, [['sub', 18], ['sub', 7], ['sub', 15]]], [[32, 0, 0, 0, 0, 1, 0], [25, 0, 0, 1, 0, 1, 0], [10, 0, 0, 1, 0, 1, 0]]), ('sub overflow', [128, [['sub', 1], ['add', 116], ['sub', 144]]], [[127, 0, 0, 1, 1, 1, 0], [243, 1, 0, 1, 1, 0, 0], [99, 0, 0, 0, 0, 1, 0]]), ('add half carry and overflow', [58, [['add', 10], ['add', 64]]], [[68, 0, 0, 1, 0, 0, 0], [132, 1, 0, 0, 1, 0, 0]])], [('inc across nibble', [95, ['inc', 'inc']], [[96, 0, 0, 1, 0, 0, 0], [97, 0, 0, 0, 0, 0, 0]]), ('inc into sign overflow', [126, ['inc', 'inc', 'inc']], [[127, 0, 0, 0, 0, 0, 0], [128, 1, 0, 1, 1, 0, 0], [129, 1, 0, 0, 0, 0, 0]]), ('inc wraps to zero keeps carry', [240, [['add', 32], 'inc', 'dec', 'dec', 'dec', 'dec', 'dec']], [[16, 0, 0, 0, 0, 0, 1], [17, 0, 0, 0, 0, 0, 1], [16, 0, 0, 0, 0, 1, 1], [15, 0, 0, 1, 0, 1, 1], [14, 0, 0, 0, 0, 1, 1], [13, 0, 0, 0, 0, 1, 1], [12, 0, 0, 0, 0, 1, 1]]), ('inc from ff', [255, ['inc', ['sub', 1], 'inc']], [[0, 0, 1, 1, 0, 0, 0], [255, 1, 0, 1, 0, 1, 1], [0, 0, 1, 1, 0, 0, 1]]), ('dec across nibble', [21, ['dec', 'dec', 'dec']], [[20, 0, 0, 0, 0, 1, 0], [19, 0, 0, 0, 0, 1, 0], [18, 0, 0, 0, 0, 1, 0]]), ('dec out of sign overflow', [129, ['dec', 'dec', 'dec']], [[128, 1, 0, 0, 0, 1, 0], [127, 0, 0, 1, 1, 1, 0], [126, 0, 0, 0, 0, 1, 0]]), ('sub half borrow', [50, [['sub', 18], ['sub', 8], ['sub', 15]]], [[32, 0, 0, 0, 0, 1, 0], [24, 0, 0, 1, 0, 1, 0], [9, 0, 0, 1, 0, 1, 0]]), ('sub overflow', [128, [['sub', 1], ['add', 117], ['sub', 144]]], [[127, 0, 0, 1, 1, 1, 0], [244, 1, 0, 1, 1, 0, 0], [100, 0, 0, 0, 0, 1, 0]]), ('add half carry and overflow', [58, [['add', 11], ['add', 64]]], [[69, 0, 0, 1, 0, 0, 0], [133, 1, 0, 0, 1, 0, 0]])]]\nfor label, args, expected in fixtures[N-1]:\n    check(label, solve(*args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"fixed":{"sha256":"2e1f0f8ed98dcaf75321998c3a9a050941fbdd602e5f683b75dfad3fc1131bf9","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(*args):\n    a, ops = args\n    c = 0\n    out = []\n    for op in ops:\n        if op == 'inc':\n            r = (a + 1) & 0xFF\n            h = int((a & 0x0F) == 0x0F)\n            pv = int(a == 0x7F)\n            nflag = 0\n        elif op == 'dec':\n            r = (a - 1) & 0xFF\n            h = int((a & 0x0F) == 0x00)\n            pv = int(a == 0x80)\n            nflag = 1\n        else:\n            kind, v = op\n            if kind == 'add':\n                full = a + v\n                h = int((a & 0x0F) + (v & 0x0F) > 0x0F)\n                pv = int(((a ^ ~v) & (a ^ full) & 0x80) != 0)\n                nflag = 0\n            else:\n                full = a - v\n                h = int((a & 0x0F) < (v & 0x0F))\n                pv = int(((a ^ v) & (a ^ full) & 0x80) != 0)\n                nflag = 1\n            c = int(full > 0xFF or full < 0)\n            r = full & 0xFF\n        a = r\n        out.append([a, r >> 7, int(r == 0), h, pv, nflag, c])\n    return out\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('inc across nibble', [31, ['inc', 'inc']], [[32, 0, 0, 1, 0, 0, 0], [33, 0, 0, 0, 0, 0, 0]]), ('inc into sign overflow', [126, ['inc', 'inc', 'inc']], [[127, 0, 0, 0, 0, 0, 0], [128, 1, 0, 1, 1, 0, 0], [129, 1, 0, 0, 0, 0, 0]]), ('inc wraps to zero keeps carry', [240, [['add', 32], 'inc', 'dec']], [[16, 0, 0, 0, 0, 0, 1], [17, 0, 0, 0, 0, 0, 1], [16, 0, 0, 0, 0, 1, 1]]), ('inc from ff', [255, ['inc', ['sub', 1], 'inc']], [[0, 0, 1, 1, 0, 0, 0], [255, 1, 0, 1, 0, 1, 1], [0, 0, 1, 1, 0, 0, 1]]), ('dec across nibble', [17, ['dec', 'dec', 'dec']], [[16, 0, 0, 0, 0, 1, 0], [15, 0, 0, 1, 0, 1, 0], [14, 0, 0, 0, 0, 1, 0]]), ('dec out of sign overflow', [129, ['dec', 'dec', 'dec']], [[128, 1, 0, 0, 0, 1, 0], [127, 0, 0, 1, 1, 1, 0], [126, 0, 0, 0, 0, 1, 0]]), ('sub half borrow', [50, [['sub', 18], ['sub', 4], ['sub', 15]]], [[32, 0, 0, 0, 0, 1, 0], [28, 0, 0, 1, 0, 1, 0], [13, 0, 0, 1, 0, 1, 0]]), ('sub overflow', [128, [['sub', 1], ['add', 113], ['sub', 144]]], [[127, 0, 0, 1, 1, 1, 0], [240, 1, 0, 1, 1, 0, 0], [96, 0, 0, 0, 0, 1, 0]]), ('add half carry and overflow', [58, [['add', 7], ['add', 64]]], [[65, 0, 0, 1, 0, 0, 0], [129, 1, 0, 0, 1, 0, 0]])], [('inc across nibble', [47, ['inc', 'inc']], [[48, 0, 0, 1, 0, 0, 0], [49, 0, 0, 0, 0, 0, 0]]), ('inc into sign overflow', [126, ['inc', 'inc', 'inc']], [[127, 0, 0, 0, 0, 0, 0], [128, 1, 0, 1, 1, 0, 0], [129, 1, 0, 0, 0, 0, 0]]), ('inc wraps to zero keeps carry', [240, [['add', 32], 'inc', 'dec', 'dec']], [[16, 0, 0, 0, 0, 0, 1], [17, 0, 0, 0, 0, 0, 1], [16, 0, 0, 0, 0, 1, 1], [15, 0, 0, 1, 0, 1, 1]]), ('inc from ff', [255, ['inc', ['sub', 1], 'inc']], [[0, 0, 1, 1, 0, 0, 0], [255, 1, 0, 1, 0, 1, 1], [0, 0, 1, 1, 0, 0, 1]]), ('dec across nibble', [18, ['dec', 'dec', 'dec']], [[17, 0, 0, 0, 0, 1, 0], [16, 0, 0, 0, 0, 1, 0], [15, 0, 0, 1, 0, 1, 0]]), ('dec out of sign overflow', [129, ['dec', 'dec', 'dec']], [[128, 1, 0, 0, 0, 1, 0], [127, 0, 0, 1, 1, 1, 0], [126, 0, 0, 0, 0, 1, 0]]), ('sub half borrow', [50, [['sub', 18], ['sub', 5], ['sub', 15]]], [[32, 0, 0, 0, 0, 1, 0], [27, 0, 0, 1, 0, 1, 0], [12, 0, 0, 1, 0, 1, 0]]), ('sub overflow', [128, [['sub', 1], ['add', 114], ['sub', 144]]], [[127, 0, 0, 1, 1, 1, 0], [241, 1, 0, 1, 1, 0, 0], [97, 0, 0, 0, 0, 1, 0]]), ('add half carry and overflow', [58, [['add', 8], ['add', 64]]], [[66, 0, 0, 1, 0, 0, 0], [130, 1, 0, 0, 1, 0, 0]])], [('inc across nibble', [63, ['inc', 'inc']], [[64, 0, 0, 1, 0, 0, 0], [65, 0, 0, 0, 0, 0, 0]]), ('inc into sign overflow', [126, ['inc', 'inc', 'inc']], [[127, 0, 0, 0, 0, 0, 0], [128, 1, 0, 1, 1, 0, 0], [129, 1, 0, 0, 0, 0, 0]]), ('inc wraps to zero keeps carry', [240, [['add', 32], 'inc', 'dec', 'dec', 'dec']], [[16, 0, 0, 0, 0, 0, 1], [17, 0, 0, 0, 0, 0, 1], [16, 0, 0, 0, 0, 1, 1], [15, 0, 0, 1, 0, 1, 1], [14, 0, 0, 0, 0, 1, 1]]), ('inc from ff', [255, ['inc', ['sub', 1], 'inc']], [[0, 0, 1, 1, 0, 0, 0], [255, 1, 0, 1, 0, 1, 1], [0, 0, 1, 1, 0, 0, 1]]), ('dec across nibble', [19, ['dec', 'dec', 'dec']], [[18, 0, 0, 0, 0, 1, 0], [17, 0, 0, 0, 0, 1, 0], [16, 0, 0, 0, 0, 1, 0]]), ('dec out of sign overflow', [129, ['dec', 'dec', 'dec']], [[128, 1, 0, 0, 0, 1, 0], [127, 0, 0, 1, 1, 1, 0], [126, 0, 0, 0, 0, 1, 0]]), ('sub half borrow', [50, [['sub', 18], ['sub', 6], ['sub', 15]]], [[32, 0, 0, 0, 0, 1, 0], [26, 0, 0, 1, 0, 1, 0], [11, 0, 0, 1, 0, 1, 0]]), ('sub overflow', [128, [['sub', 1], ['add', 115], ['sub', 144]]], [[127, 0, 0, 1, 1, 1, 0], [242, 1, 0, 1, 1, 0, 0], [98, 0, 0, 0, 0, 1, 0]]), ('add half carry and overflow', [58, [['add', 9], ['add', 64]]], [[67, 0, 0, 1, 0, 0, 0], [131, 1, 0, 0, 1, 0, 0]])], [('inc across nibble', [79, ['inc', 'inc']], [[80, 0, 0, 1, 0, 0, 0], [81, 0, 0, 0, 0, 0, 0]]), ('inc into sign overflow', [126, ['inc', 'inc', 'inc']], [[127, 0, 0, 0, 0, 0, 0], [128, 1, 0, 1, 1, 0, 0], [129, 1, 0, 0, 0, 0, 0]]), ('inc wraps to zero keeps carry', [240, [['add', 32], 'inc', 'dec', 'dec', 'dec', 'dec']], [[16, 0, 0, 0, 0, 0, 1], [17, 0, 0, 0, 0, 0, 1], [16, 0, 0, 0, 0, 1, 1], [15, 0, 0, 1, 0, 1, 1], [14, 0, 0, 0, 0, 1, 1], [13, 0, 0, 0, 0, 1, 1]]), ('inc from ff', [255, ['inc', ['sub', 1], 'inc']], [[0, 0, 1, 1, 0, 0, 0], [255, 1, 0, 1, 0, 1, 1], [0, 0, 1, 1, 0, 0, 1]]), ('dec across nibble', [20, ['dec', 'dec', 'dec']], [[19, 0, 0, 0, 0, 1, 0], [18, 0, 0, 0, 0, 1, 0], [17, 0, 0, 0, 0, 1, 0]]), ('dec out of sign overflow', [129, ['dec', 'dec', 'dec']], [[128, 1, 0, 0, 0, 1, 0], [127, 0, 0, 1, 1, 1, 0], [126, 0, 0, 0, 0, 1, 0]]), ('sub half borrow', [50, [['sub', 18], ['sub', 7], ['sub', 15]]], [[32, 0, 0, 0, 0, 1, 0], [25, 0, 0, 1, 0, 1, 0], [10, 0, 0, 1, 0, 1, 0]]), ('sub overflow', [128, [['sub', 1], ['add', 116], ['sub', 144]]], [[127, 0, 0, 1, 1, 1, 0], [243, 1, 0, 1, 1, 0, 0], [99, 0, 0, 0, 0, 1, 0]]), ('add half carry and overflow', [58, [['add', 10], ['add', 64]]], [[68, 0, 0, 1, 0, 0, 0], [132, 1, 0, 0, 1, 0, 0]])], [('inc across nibble', [95, ['inc', 'inc']], [[96, 0, 0, 1, 0, 0, 0], [97, 0, 0, 0, 0, 0, 0]]), ('inc into sign overflow', [126, ['inc', 'inc', 'inc']], [[127, 0, 0, 0, 0, 0, 0], [128, 1, 0, 1, 1, 0, 0], [129, 1, 0, 0, 0, 0, 0]]), ('inc wraps to zero keeps carry', [240, [['add', 32], 'inc', 'dec', 'dec', 'dec', 'dec', 'dec']], [[16, 0, 0, 0, 0, 0, 1], [17, 0, 0, 0, 0, 0, 1], [16, 0, 0, 0, 0, 1, 1], [15, 0, 0, 1, 0, 1, 1], [14, 0, 0, 0, 0, 1, 1], [13, 0, 0, 0, 0, 1, 1], [12, 0, 0, 0, 0, 1, 1]]), ('inc from ff', [255, ['inc', ['sub', 1], 'inc']], [[0, 0, 1, 1, 0, 0, 0], [255, 1, 0, 1, 0, 1, 1], [0, 0, 1, 1, 0, 0, 1]]), ('dec across nibble', [21, ['dec', 'dec', 'dec']], [[20, 0, 0, 0, 0, 1, 0], [19, 0, 0, 0, 0, 1, 0], [18, 0, 0, 0, 0, 1, 0]]), ('dec out of sign overflow', [129, ['dec', 'dec', 'dec']], [[128, 1, 0, 0, 0, 1, 0], [127, 0, 0, 1, 1, 1, 0], [126, 0, 0, 0, 0, 1, 0]]), ('sub half borrow', [50, [['sub', 18], ['sub', 8], ['sub', 15]]], [[32, 0, 0, 0, 0, 1, 0], [24, 0, 0, 1, 0, 1, 0], [9, 0, 0, 1, 0, 1, 0]]), ('sub overflow', [128, [['sub', 1], ['add', 117], ['sub', 144]]], [[127, 0, 0, 1, 1, 1, 0], [244, 1, 0, 1, 1, 0, 0], [100, 0, 0, 0, 0, 1, 0]]), ('add half carry and overflow', [58, [['add', 11], ['add', 64]]], [[69, 0, 0, 1, 0, 0, 0], [133, 1, 0, 0, 1, 0, 0]])]]\nfor label, args, expected in fixtures[N-1]:\n    check(label, solve(*args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"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.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"w2-instruction-set-emulation-z80-flags-inc-preserves-carry","generated_at":"2026-09-29T14:51:19.339651+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Half-carry and parity/overflow flags are observable through DAA and conditional branches; emulators often get the INC/DEC special cases wrong.","repair":"Leave carry unchanged on INC and DEC.","root_cause":"The INC path writes the carry flag like an add.","sha256":"fcd5f8bcef71b3d476941d8927da027adf831f25e214a63e02b9a5b25b81dcf0","title":"INC updates the carry flag · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":38.644,"exit_code":1,"observations":[{"actual":[[32,0,0,1,0,0,0],[33,0,0,0,0,0,0]],"check":"inc across nibble","expected":[[32,0,0,1,0,0,0],[33,0,0,0,0,0,0]],"passed":true},{"actual":[[127,0,0,0,0,0,0],[128,1,0,1,1,0,0],[129,1,0,0,0,0,0]],"check":"inc into sign overflow","expected":[[127,0,0,0,0,0,0],[128,1,0,1,1,0,0],[129,1,0,0,0,0,0]],"passed":true},{"actual":[[16,0,0,0,0,0,1],[17,0,0,0,0,0,0],[16,0,0,0,0,1,0]],"check":"inc wraps to zero keeps carry","expected":[[16,0,0,0,0,0,1],[17,0,0,0,0,0,1],[16,0,0,0,0,1,1]],"passed":false},{"actual":[[0,0,1,1,0,0,0],[255,1,0,1,0,1,1],[0,0,1,1,0,0,0]],"check":"inc from ff","expected":[[0,0,1,1,0,0,0],[255,1,0,1,0,1,1],[0,0,1,1,0,0,1]],"passed":false},{"actual":[[16,0,0,0,0,1,0],[15,0,0,1,0,1,0],[14,0,0,0,0,1,0]],"check":"dec across nibble","expected":[[16,0,0,0,0,1,0],[15,0,0,1,0,1,0],[14,0,0,0,0,1,0]],"passed":true},{"actual":[[128,1,0,0,0,1,0],[127,0,0,1,1,1,0],[126,0,0,0,0,1,0]],"check":"dec out of sign overflow","expected":[[128,1,0,0,0,1,0],[127,0,0,1,1,1,0],[126,0,0,0,0,1,0]],"passed":true},{"actual":[[32,0,0,0,0,1,0],[28,0,0,1,0,1,0],[13,0,0,1,0,1,0]],"check":"sub half borrow","expected":[[32,0,0,0,0,1,0],[28,0,0,1,0,1,0],[13,0,0,1,0,1,0]],"passed":true},{"actual":[[127,0,0,1,1,1,0],[240,1,0,1,1,0,0],[96,0,0,0,0,1,0]],"check":"sub overflow","expected":[[127,0,0,1,1,1,0],[240,1,0,1,1,0,0],[96,0,0,0,0,1,0]],"passed":true},{"actual":[[65,0,0,1,0,0,0],[129,1,0,0,1,0,0]],"check":"add half carry and overflow","expected":[[65,0,0,1,0,0,0],[129,1,0,0,1,0,0]],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"inc across nibble\", \"actual\": [[32, 0, 0, 1, 0, 0, 0], [33, 0, 0, 0, 0, 0, 0]], \"expected\": [[32, 0, 0, 1, 0, 0, 0], [33, 0, 0, 0, 0, 0, 0]], \"passed\": true}, {\"check\": \"inc into sign overflow\", \"actual\": [[127, 0, 0, 0, 0, 0, 0], [128, 1, 0, 1, 1, 0, 0], [129, 1, 0, 0, 0, 0, 0]], \"expected\": [[127, 0, 0, 0, 0, 0, 0], [128, 1, 0, 1, 1, 0, 0], [129, 1, 0, 0, 0, 0, 0]], \"passed\": true}, {\"check\": \"inc wraps to zero keeps carry\", \"actual\": [[16, 0, 0, 0, 0, 0, 1], [17, 0, 0, 0, 0, 0, 0], [16, 0, 0, 0, 0, 1, 0]], \"expected\": [[16, 0, 0, 0, 0, 0, 1], [17, 0, 0, 0, 0, 0, 1], [16, 0, 0, 0, 0, 1, 1]], \"passed\": false}, {\"check\": \"inc from ff\", \"actual\": [[0, 0, 1, 1, 0, 0, 0], [255, 1, 0, 1, 0, 1, 1], [0, 0, 1, 1, 0, 0, 0]], \"expected\": [[0, 0, 1, 1, 0, 0, 0], [255, 1, 0, 1, 0, 1, 1], [0, 0, 1, 1, 0, 0, 1]], \"passed\": false}, {\"check\": \"dec across nibble\", \"actual\": [[16, 0, 0, 0, 0, 1, 0], [15, 0, 0, 1, 0, 1, 0], [14, 0, 0, 0, 0, 1, 0]], \"expected\": [[16, 0, 0, 0, 0, 1, 0], [15, 0, 0, 1, 0, 1, 0], [14, 0, 0, 0, 0, 1, 0]], \"passed\": true}, {\"check\": \"dec out of sign overflow\", \"actual\": [[128, 1, 0, 0, 0, 1, 0], [127, 0, 0, 1, 1, 1, 0], [126, 0, 0, 0, 0, 1, 0]], \"expected\": [[128, 1, 0, 0, 0, 1, 0], [127, 0, 0, 1, 1, 1, 0], [126, 0, 0, 0, 0, 1, 0]], \"passed\": true}, {\"check\": \"sub half borrow\", \"actual\": [[32, 0, 0, 0, 0, 1, 0], [28, 0, 0, 1, 0, 1, 0], [13, 0, 0, 1, 0, 1, 0]], \"expected\": [[32, 0, 0, 0, 0, 1, 0], [28, 0, 0, 1, 0, 1, 0], [13, 0, 0, 1, 0, 1, 0]], \"passed\": true}, {\"check\": \"sub overflow\", \"actual\": [[127, 0, 0, 1, 1, 1, 0], [240, 1, 0, 1, 1, 0, 0], [96, 0, 0, 0, 0, 1, 0]], \"expected\": [[127, 0, 0, 1, 1, 1, 0], [240, 1, 0, 1, 1, 0, 0], [96, 0, 0, 0, 0, 1, 0]], \"passed\": true}, {\"check\": \"add half carry and overflow\", \"actual\": [[65, 0, 0, 1, 0, 0, 0], [129, 1, 0, 0, 1, 0, 0]], \"expected\": [[65, 0, 0, 1, 0, 0, 0], [129, 1, 0, 0, 1, 0, 0]], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":42.168,"exit_code":1,"observations":[{"actual":[[32,0,0,1,0,0,0],[33,0,0,0,0,0,0]],"check":"inc across nibble","expected":[[32,0,0,1,0,0,0],[33,0,0,0,0,0,0]],"passed":true},{"actual":[[127,0,0,0,0,0,0],[128,1,0,1,1,0,0],[129,1,0,0,0,0,0]],"check":"inc into sign overflow","expected":[[127,0,0,0,0,0,0],[128,1,0,1,1,0,0],[129,1,0,0,0,0,0]],"passed":true},{"actual":[[16,0,0,0,0,0,1],[17,0,0,0,0,0,0],[16,0,0,0,0,1,0]],"check":"inc wraps to zero keeps carry","expected":[[16,0,0,0,0,0,1],[17,0,0,0,0,0,1],[16,0,0,0,0,1,1]],"passed":false},{"actual":[[0,0,1,1,0,0,1],[255,1,0,1,0,1,1],[0,0,1,1,0,0,1]],"check":"inc from ff","expected":[[0,0,1,1,0,0,0],[255,1,0,1,0,1,1],[0,0,1,1,0,0,1]],"passed":false},{"actual":[[16,0,0,0,0,1,0],[15,0,0,1,0,1,0],[14,0,0,0,0,1,0]],"check":"dec across nibble","expected":[[16,0,0,0,0,1,0],[15,0,0,1,0,1,0],[14,0,0,0,0,1,0]],"passed":true},{"actual":[[128,1,0,0,0,1,0],[127,0,0,1,1,1,0],[126,0,0,0,0,1,0]],"check":"dec out of sign overflow","expected":[[128,1,0,0,0,1,0],[127,0,0,1,1,1,0],[126,0,0,0,0,1,0]],"passed":true},{"actual":[[32,0,0,0,0,1,0],[28,0,0,1,0,1,0],[13,0,0,1,0,1,0]],"check":"sub half borrow","expected":[[32,0,0,0,0,1,0],[28,0,0,1,0,1,0],[13,0,0,1,0,1,0]],"passed":true},{"actual":[[127,0,0,1,1,1,0],[240,1,0,1,1,0,0],[96,0,0,0,0,1,0]],"check":"sub overflow","expected":[[127,0,0,1,1,1,0],[240,1,0,1,1,0,0],[96,0,0,0,0,1,0]],"passed":true},{"actual":[[65,0,0,1,0,0,0],[129,1,0,0,1,0,0]],"check":"add half carry and overflow","expected":[[65,0,0,1,0,0,0],[129,1,0,0,1,0,0]],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"inc across nibble\", \"actual\": [[32, 0, 0, 1, 0, 0, 0], [33, 0, 0, 0, 0, 0, 0]], \"expected\": [[32, 0, 0, 1, 0, 0, 0], [33, 0, 0, 0, 0, 0, 0]], \"passed\": true}, {\"check\": \"inc into sign overflow\", \"actual\": [[127, 0, 0, 0, 0, 0, 0], [128, 1, 0, 1, 1, 0, 0], [129, 1, 0, 0, 0, 0, 0]], \"expected\": [[127, 0, 0, 0, 0, 0, 0], [128, 1, 0, 1, 1, 0, 0], [129, 1, 0, 0, 0, 0, 0]], \"passed\": true}, {\"check\": \"inc wraps to zero keeps carry\", \"actual\": [[16, 0, 0, 0, 0, 0, 1], [17, 0, 0, 0, 0, 0, 0], [16, 0, 0, 0, 0, 1, 0]], \"expected\": [[16, 0, 0, 0, 0, 0, 1], [17, 0, 0, 0, 0, 0, 1], [16, 0, 0, 0, 0, 1, 1]], \"passed\": false}, {\"check\": \"inc from ff\", \"actual\": [[0, 0, 1, 1, 0, 0, 1], [255, 1, 0, 1, 0, 1, 1], [0, 0, 1, 1, 0, 0, 1]], \"expected\": [[0, 0, 1, 1, 0, 0, 0], [255, 1, 0, 1, 0, 1, 1], [0, 0, 1, 1, 0, 0, 1]], \"passed\": false}, {\"check\": \"dec across nibble\", \"actual\": [[16, 0, 0, 0, 0, 1, 0], [15, 0, 0, 1, 0, 1, 0], [14, 0, 0, 0, 0, 1, 0]], \"expected\": [[16, 0, 0, 0, 0, 1, 0], [15, 0, 0, 1, 0, 1, 0], [14, 0, 0, 0, 0, 1, 0]], \"passed\": true}, {\"check\": \"dec out of sign overflow\", \"actual\": [[128, 1, 0, 0, 0, 1, 0], [127, 0, 0, 1, 1, 1, 0], [126, 0, 0, 0, 0, 1, 0]], \"expected\": [[128, 1, 0, 0, 0, 1, 0], [127, 0, 0, 1, 1, 1, 0], [126, 0, 0, 0, 0, 1, 0]], \"passed\": true}, {\"check\": \"sub half borrow\", \"actual\": [[32, 0, 0, 0, 0, 1, 0], [28, 0, 0, 1, 0, 1, 0], [13, 0, 0, 1, 0, 1, 0]], \"expected\": [[32, 0, 0, 0, 0, 1, 0], [28, 0, 0, 1, 0, 1, 0], [13, 0, 0, 1, 0, 1, 0]], \"passed\": true}, {\"check\": \"sub overflow\", \"actual\": [[127, 0, 0, 1, 1, 1, 0], [240, 1, 0, 1, 1, 0, 0], [96, 0, 0, 0, 0, 1, 0]], \"expected\": [[127, 0, 0, 1, 1, 1, 0], [240, 1, 0, 1, 1, 0, 0], [96, 0, 0, 0, 0, 1, 0]], \"passed\": true}, {\"check\": \"add half carry and overflow\", \"actual\": [[65, 0, 0, 1, 0, 0, 0], [129, 1, 0, 0, 1, 0, 0]], \"expected\": [[65, 0, 0, 1, 0, 0, 0], [129, 1, 0, 0, 1, 0, 0]], \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":42.49,"exit_code":0,"observations":[{"actual":[[32,0,0,1,0,0,0],[33,0,0,0,0,0,0]],"check":"inc across nibble","expected":[[32,0,0,1,0,0,0],[33,0,0,0,0,0,0]],"passed":true},{"actual":[[127,0,0,0,0,0,0],[128,1,0,1,1,0,0],[129,1,0,0,0,0,0]],"check":"inc into sign overflow","expected":[[127,0,0,0,0,0,0],[128,1,0,1,1,0,0],[129,1,0,0,0,0,0]],"passed":true},{"actual":[[16,0,0,0,0,0,1],[17,0,0,0,0,0,1],[16,0,0,0,0,1,1]],"check":"inc wraps to zero keeps carry","expected":[[16,0,0,0,0,0,1],[17,0,0,0,0,0,1],[16,0,0,0,0,1,1]],"passed":true},{"actual":[[0,0,1,1,0,0,0],[255,1,0,1,0,1,1],[0,0,1,1,0,0,1]],"check":"inc from ff","expected":[[0,0,1,1,0,0,0],[255,1,0,1,0,1,1],[0,0,1,1,0,0,1]],"passed":true},{"actual":[[16,0,0,0,0,1,0],[15,0,0,1,0,1,0],[14,0,0,0,0,1,0]],"check":"dec across nibble","expected":[[16,0,0,0,0,1,0],[15,0,0,1,0,1,0],[14,0,0,0,0,1,0]],"passed":true},{"actual":[[128,1,0,0,0,1,0],[127,0,0,1,1,1,0],[126,0,0,0,0,1,0]],"check":"dec out of sign overflow","expected":[[128,1,0,0,0,1,0],[127,0,0,1,1,1,0],[126,0,0,0,0,1,0]],"passed":true},{"actual":[[32,0,0,0,0,1,0],[28,0,0,1,0,1,0],[13,0,0,1,0,1,0]],"check":"sub half borrow","expected":[[32,0,0,0,0,1,0],[28,0,0,1,0,1,0],[13,0,0,1,0,1,0]],"passed":true},{"actual":[[127,0,0,1,1,1,0],[240,1,0,1,1,0,0],[96,0,0,0,0,1,0]],"check":"sub overflow","expected":[[127,0,0,1,1,1,0],[240,1,0,1,1,0,0],[96,0,0,0,0,1,0]],"passed":true},{"actual":[[65,0,0,1,0,0,0],[129,1,0,0,1,0,0]],"check":"add half carry and overflow","expected":[[65,0,0,1,0,0,0],[129,1,0,0,1,0,0]],"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"inc across nibble\", \"actual\": [[32, 0, 0, 1, 0, 0, 0], [33, 0, 0, 0, 0, 0, 0]], \"expected\": [[32, 0, 0, 1, 0, 0, 0], [33, 0, 0, 0, 0, 0, 0]], \"passed\": true}, {\"check\": \"inc into sign overflow\", \"actual\": [[127, 0, 0, 0, 0, 0, 0], [128, 1, 0, 1, 1, 0, 0], [129, 1, 0, 0, 0, 0, 0]], \"expected\": [[127, 0, 0, 0, 0, 0, 0], [128, 1, 0, 1, 1, 0, 0], [129, 1, 0, 0, 0, 0, 0]], \"passed\": true}, {\"check\": \"inc wraps to zero keeps carry\", \"actual\": [[16, 0, 0, 0, 0, 0, 1], [17, 0, 0, 0, 0, 0, 1], [16, 0, 0, 0, 0, 1, 1]], \"expected\": [[16, 0, 0, 0, 0, 0, 1], [17, 0, 0, 0, 0, 0, 1], [16, 0, 0, 0, 0, 1, 1]], \"passed\": true}, {\"check\": \"inc from ff\", \"actual\": [[0, 0, 1, 1, 0, 0, 0], [255, 1, 0, 1, 0, 1, 1], [0, 0, 1, 1, 0, 0, 1]], \"expected\": [[0, 0, 1, 1, 0, 0, 0], [255, 1, 0, 1, 0, 1, 1], [0, 0, 1, 1, 0, 0, 1]], \"passed\": true}, {\"check\": \"dec across nibble\", \"actual\": [[16, 0, 0, 0, 0, 1, 0], [15, 0, 0, 1, 0, 1, 0], [14, 0, 0, 0, 0, 1, 0]], \"expected\": [[16, 0, 0, 0, 0, 1, 0], [15, 0, 0, 1, 0, 1, 0], [14, 0, 0, 0, 0, 1, 0]], \"passed\": true}, {\"check\": \"dec out of sign overflow\", \"actual\": [[128, 1, 0, 0, 0, 1, 0], [127, 0, 0, 1, 1, 1, 0], [126, 0, 0, 0, 0, 1, 0]], \"expected\": [[128, 1, 0, 0, 0, 1, 0], [127, 0, 0, 1, 1, 1, 0], [126, 0, 0, 0, 0, 1, 0]], \"passed\": true}, {\"check\": \"sub half borrow\", \"actual\": [[32, 0, 0, 0, 0, 1, 0], [28, 0, 0, 1, 0, 1, 0], [13, 0, 0, 1, 0, 1, 0]], \"expected\": [[32, 0, 0, 0, 0, 1, 0], [28, 0, 0, 1, 0, 1, 0], [13, 0, 0, 1, 0, 1, 0]], \"passed\": true}, {\"check\": \"sub overflow\", \"actual\": [[127, 0, 0, 1, 1, 1, 0], [240, 1, 0, 1, 1, 0, 0], [96, 0, 0, 0, 0, 1, 0]], \"expected\": [[127, 0, 0, 1, 1, 1, 0], [240, 1, 0, 1, 1, 0, 0], [96, 0, 0, 0, 0, 1, 0]], \"passed\": true}, {\"check\": \"add half carry and overflow\", \"actual\": [[65, 0, 0, 1, 0, 0, 0], [129, 1, 0, 0, 1, 0, 0]], \"expected\": [[65, 0, 0, 1, 0, 0, 0], [129, 1, 0, 0, 1, 0, 0]], \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}