103. The 0x3F band 0xC0 state machine sets the display's light level, and base slot 15's twelve spare bytes are read after all¶
Section 102 stopped at the door of 0x23952 and said what was behind it would need a subsystem
read rather than an opcode. It did, and the subsystem turns out to be the one part of the remote's
own behaviour that the config controls end to end: four brightness levels, four pairs of device
levels, three thresholds and a fade rate, all stated by base slot 15, driving one analogue output and
one pin.
The state machine is eight states over one variable¶
0xF10 is the state, and the arms are a descending chain plus two tests above it:
| state | what it does |
|---|---|
| 7 | continues only if the light is currently on, 0x23CA6 being "is the cached level nonzero", then falls to 6 |
| 6 | re-derives the band from the measurement, 0x2346A, then maps band 0 to 3 onto states 2 to 5 |
| 5, 4, 3, 2 | target level = the band's level, and send the band's pair of device levels |
| 1, 0 | target level = 0, which turns it off |
Every arm converges on 0x23B7E, which saves the state in 0x112 and, when the target is nonzero,
applies it. The operand's bit 0 picks how: 0x23BA0 sets the level in one step, 0x23C02 walks
one index at a time towards it with a delay between steps. So bit 0 is fade against snap, and bits
1 to 3 are the state, which is exactly the field split section 102 read out of the dispatcher
without knowing what either field selected.
The level is an index into the comparator reference, and the table proves it¶
0x23BA0 is nine lines of arithmetic and one store:
23ba0: MOVF gprF12,W ; the level
23ba4: SUBLW 0x1b ; refuse anything above 27
23baa: MOVF 0x113,W ; the cached level
23bb0: BZ 0x23c00 ; and do nothing when it has not changed
23bb2: BSF WDTCON,4
23be2: TBLRD* ; from 0x2EA54 + level
23be6: MOVWF CVRCON
23bf6: BSF LATA,5 ; when the level is nonzero
23bfa: BCF LATA,5 ; when it is zero
CVRCON is 0x0F77, the comparator voltage reference control, and the 28 bytes at 0x2EA54 are
not a tuned list. CVREF with CVRSS clear takes CVR/24 of AVDD in the low range and
1/4 + CVR/32 in the high range, thirty settings for CVR 1 to 15 in each, three of which collide
at 0.375, 0.5 and 0.625. Merge the two ranges, prefer the high range on a tie, and you get 27
distinct voltages in ascending order. The table is 0x00 for off followed by exactly those 27, in
exactly that order, and the code's own ceiling of 27 is their count:
00 e1 e2 e3 e4 e5 e6 c1 e7 c2 e8 c3 c4 c5 ea c6 eb c7 c8 c9 ed ca ee cb cc cd ce cf
That is the independent numeric closure this project's standard asks for: the table is derivable
from the part's datasheet and from nothing in the config, and the derivation reproduces both the
byte order and the bound. packages/codec does not need the table, so it is asserted in
tests/test_backlight.py against the derivation rather than against a copy of itself.
A second build carries the same routine. The One's safe mode image, internal page 0xFE, has
it at 0x04F16 with the same SUBLW 0x1b, the same MOVWF CVRCON, the same LATA bit 5, and the
same 28 bytes at 0xC0E0. Two independently built images, one architecture; there is no arch 14 or
arch 9 equivalent, which is consistent with band 0xC0 being the one part of the second operand
space that does not port.
Do not read the ADSHR window around the store as evidence. 0xF77 is not one of the ten
shadowed addresses, so BSF WDTCON,4 changes nothing there, and the same empty bracket appears at
0x23440 and 0x232AE with no instruction at all between the set and the clear. It is a
compiler idiom for a block that might have needed the shadow set, and a listing that treats every
occurrence as meaningful will invent a second register.
Base slot 15 states all of it, and four groups get names¶
The guard 0x23262 is the one section 44 read: its first argument is a byte offset into the
pointer array, so offset 3 * n reaches group n. Four groups feed this subsystem, and the
lengths it demands are the ones section 44 already predicted from the call sites:
| group | length | what it holds | the Harmony One's values | firmware default |
|---|---|---|---|---|
| 0 | 1 | the fade's per step delay | 44 | 50 |
| 1 | 6 | entries 2 to 5 are the four levels; entries 0 and 1 are read and discarded | 20, 20, 26, 26 | 9, 16, 24, 27 |
| 4 | 6 | three threshold pairs, two apart, that turn the measurement into a band 0 to 3 | 96, 98, 308, 310, 768, 770 | none, the band stays put |
| 9 | 6 | four pairs at 4 * band, so band 3's pair is past the declared end. Called timeouts here first and they are not, section 106: both halves go straight out over I2C as device register values |
16, 16, 64, 64, 128, 128 | 64 |
Group 1's first two entries are the interesting detail: the code reads six u16 values and keeps
the last four. Both One configs carry 38 there, which is above the ceiling of 27, so they could
not be levels even if something read them. Whatever they were for, nothing in this firmware reads
them.
Section 44 left group 4 as "three thresholds with hysteresis, what they threshold is not
established". What they threshold is the four sample sum of analogue channel 1, and
the hysteresis is real: inside a band the level only moves if it has crossed the whole band,
0x2353A.
The twelve spare bytes are read by exactly two sites, and nothing is left over¶
Section 44 called them "the only untidy number here" and section 84 claimed them by position rather than by reading. They are read, they are read by this band, and the two readers account for all twelve:
group 9's declared entries 10 00 10 00 40 00 40 00 80 00 80 00
the twelve bytes above them ff 00 ff 00 00 00 00 00 55 55 55 55
\________/ \_________________________/
band 3's a table of two bit fields
pair band 0xC0 selectors 0 to 12 index
0x249A0 adds 4 * band to the cursor and reads two u16 values, so band 3 reads bytes 12 to 15
of a group whose header declares six entries. It gets 255 and 255, which continues 16, 64, 128 as a
ratchet upwards rather than being noise. 0x2492E, which is band 0xC0's handler for selectors 0
to 12, reads a single byte at 0x10 + 4 * flag + (selector >> 2) and then extracts the two bit
field selector & 3 from it, so eight bytes hold sixteen fields per value of the flag, thirteen of
which the selector range uses. The values are 0x00 four times and 0x55 four times, which is
every field zero for the flag clear and every field one for it set.
flag is bits 1 to 3, squashed to a boolean, and this section said bit 0 for a few hours.
0x24F6C reads 0xEBB, which the dispatcher filled from bits 1 to 3, tests it against zero and
normalises it to 0 or 1 before handing it on; bit 0 reaches 0x2492E not at all. The corpus agrees
with the corrected reading and not the wrong one: every use of selectors 0 to 12 has bit 0 clear, and
they come in pairs with bits 1 to 3 zero and nonzero, which under the wrong reading would have been
the same instruction twice. The mistake is the one this project keeps recording in other forms: the
field split was read correctly out of the dispatcher and then the wrong field was carried into the
handler.
So the instruction is "set property selector to the state base slot 15 gives for bits 1 to 3 being
nonzero", and both One configs make that a plain on and off. What the thirteen properties are is
section 106, and it is a device rather than thirteen loose ends.
Twelve bytes, twelve accounted for, in both One configs. The accounting number does not move, because section 84 had already claimed them; what moves is that arch 12's base slot 15 no longer has a run whose only justification is that it sits between two things.
The band it responds to is not the battery, and separating the two closes something else¶
There are two four sample-or-more analogue quantities in this firmware and only two analogue channels, and the earlier reading of this subsystem had them confused.
- Channel 0, eight samples averaged at
0x2372A, then compared against base slot 15 group 5 or group 6 at0x238BC, giving an eight level result in0x111. That is section 44's millivolt curve, and it is the battery. - Channel 1, four samples summed at
0x235D2, then group 4's three pairs at0x234D4, giving a four level result in0x110. That is what this subsystem reads.
What channel 1 measures is not established and is deliberately not named here. Two readings fit and they differ only in how the sensor is wired: an ambient light sensor whose voltage rises with light, in which case a brighter room gets a brighter screen for longer, or one whose voltage rises in the dark, in which case a dark room does. The firmware cannot distinguish them, and this project has already recorded what happens when a peripheral is named from its shape, section 13's inverted polarities. It is left as "the band".
A read only bench measurement settles it in one command, and the prediction goes here first.
0x110 is a single data memory byte, so read-ram.ts --address 0x110 reads it, and covering the
sensor while the remote is on USB should move it. Three outcomes, committed before anyone looks:
- it reads 0 to 3 and changes when the sensor is covered, which names the polarity and therefore the sensor;
- it reads a plausible value and never changes, which means the sampler does not run while the remote is on USB, section 48's finding about the keypad applied to the analogue path;
- it reads 0 always, which is the same conclusion with less information.
Outcomes 2 and 3 are the likely ones and they are worth having: they would say this whole subsystem is unobservable over USB, which is a fact FreeHarmony needs about what it can and cannot show.
Outcome 2, measured on 10 August 2026, section 111.
0x110is 1,0x112is 3 and0x113is 20, and the three agree with each other through this config's own group 1 and the band to state map above, so the value is config derived rather than a default or a leftover zero. Nothing recomputes it: over 60 seconds the converter stayed off, its result register stayed at 966, and the four bytes stayed put while the clock's seconds moved. So the band is readable and stale, covering the sensor cannot move it, and what channel 1 measures is still not established. The one thing this section did not consider is the one that mattered: a stale value is evidence that the config was read.
What this does to the reading depth¶
Selector 17 is a meaning by the definition in packages/codec/src/actions.ts: its effect is tied to
data the config states, and an editor could put "turn the display light off", "bring it up to the
automatic level" and "fade rather than snap" in front of a user. Selector 16 and selectors 0 to 12
stay placement, because LATC bit 5 and the thirteen properties have no names.
So the band resolves by selector now, the way the firmware does, rather than carrying one reading for three mechanisms. The split in each One config is 68 uses of selector 17 against 36 of selectors 0 to 12 and 2 of selector 16, and 65 of the 68 are state 6 without a fade, which is "bring the light up to whatever the band says". Three instructions in the whole corpus set bit 0.
Section 102 | the archive | section 104. Section 103 of the findings archive, which is frozen; the reference holds the current answer. The archive on GitHub.