Skip to content

104. 0x1F band 0xFC is intercepted before the dispatcher, on all four architectures

Found while asking how a band change reaches a config. 0x2346A announces one by calling 0x24BF0, which pushes three bytes onto the action list queue: the code, 0xFC, 0x1F. The queue is popped in the same order into operand low, operand high and opcode, so the instruction is 0x1F with operand 0xFC00 | code.

packages/codec said that instruction does nothing. It says so because section 73 read the 0x1F dispatcher and its 0xFC arm genuinely falls through to the common exit. The dispatcher never sees it. The instruction fetch tests for it first:

24dd2: RCALL 0x24b40        ; pop three bytes
24dde: RCALL 0x24b40
24de4: MOVLW 0x1f
24de6: SUBWF 0xd46,W        ; the opcode
24de8: BNZ   0x24df8        ; not this: dispatch normally
24dea: MOVLW 0xfc
24dec: SUBWF 0xd45,W        ; the operand's high byte
24dee: BNZ   0x24df8
24df0: MOVFF 0xd44,0xeb2    ; the low byte becomes the event code
24df4: GOTO  0x24d40        ; and the dispatcher is skipped entirely

0x24D40 walks the stack of active handlers downwards from 0xE19 and offers the code to each until one accepts it. So the reading is "deliver the low byte as an event to the innermost handler that will take it", and a table built from the dispatcher alone cannot see that.

All four architectures do it, with the same two comparisons in the same place: arch 12 0x24DE4, the Harmony 600 0x0E752, the Harmony 700 0x0EB38, the Harmony 525 0x01BB4. So this is not an arch 12 divergence, unlike band 0xC0.

No config in the corpus uses it, in any of the six samples, which is why nothing caught it: the wrong reading was never exercised. That also means the correction moves no numbers. It is worth recording anyway, because the shape of the mistake generalises: this project's rule is "read a dispatcher, not one handler at a time", and the rule has a second half it did not state, which is that a dispatcher is not the only thing that can consume an opcode. Anything upstream of it gets a first look.


Section 103 | the archive | section 105. Section 104 of the findings archive, which is frozen; the reference holds the current answer. The archive on GitHub.