PATCH Solution
THRESHOLD GATE
PATCH comparison direction

Prerequisites
Unlocks
gate=jle
Accepted keysACED
Editable slots1
Rulenonzero
Walkthrough
The end-rank gate is pointing the wrong way. The code only clears when its last byte outranks its first, but this build bounces the codes that climb and would pass the ones that sit flat. Only the marked branch can move. Aim the comparison at the right side, then TEST.
This is a direction bug, not an equality flip. The cmp already set the flags from last versus first. You want to reject when the last byte is not above the first, so the branch has to fire on less-or-equal, not on greater-or-equal.
Valid Patch Combos
- gate=jle
Reject Battery
- ACEA
- ACAD
- XCED
- ACEED
- ACE
Editable Slot Options
- gate: jg, jl, jge, jle
Broken Listing
; THRESHOLD GATE: a PATCH job. The code must read ASCENDING at its ends: the
; LAST byte has to outrank the FIRST byte, with two fixed bytes in the middle.
; Only the marked branch (label "gate") is yours to edit; the verdict block is
; frozen. The defect is not an equality flip, it is a DIRECTION flip: the gate
; rejects on the wrong side of the comparison, so it turns away codes that
; really do climb and would wave through codes that sit flat at the ends.
;
; The real key is ACED. r1 holds the first byte, r0 holds the last byte, and the
; cmp just above the gate sets the flags from (last vs first). The gate must
; bounce a code whose last byte does NOT outrank its first, that is, reject when
; last <= first; accept only when last > first.
;
; r0 = 1 on accept; rule: nonzero. SHIPPED gate is "jge bad", which jumps when
; last >= first and so rejects the climbing key it should pass.
len r2
cmp r2, 4
jnz bad
mov r7, 0
ldb r1, [r7] ; r1 = first byte
mov r7, 1
ldb r0, [r7]
cmp r0, 0x43 ; 'C'
jnz bad
mov r7, 2
ldb r0, [r7]
cmp r0, 0x45 ; 'E'
jnz bad
mov r7, 3
ldb r0, [r7] ; r0 = last byte
cmp r0, r1 ; flags from last vs first
gate: jge bad ; SHIPPED BROKEN: rejects last >= first -> want jle
mov r0, 1
ret
bad: mov r0, 0
ret