KN7000 Program Data Region
KN7000: the program’s data region, typed from the code that reads it
Program build 941’s data region is file 0x186000..0x3B8B78 (CPU 0x48586000..0x487B8B78):
2,304,888 bytes of tables, records, text, pictures and compressed songs between code region 1 and
the MILK kernel’s flash tail (Firmware Images).
Until 2026-10-30 it ran on to the library image at 0x3B8FD1 (2,306,001 bytes); the last 1,113 of
those bytes are code (below). Until 2026-10-29 the
disassembly held it as three .incbin_range lines and a typed palette. It is now
kn7000/src/program/data/, generated by kn7000/tools/gen_data_s.py, and the image stays
byte-identical (make -C kn7000 verify). Builds 942 (SP7001), 935 and 893 get the same from the
same generator (--profile sp7001 / b935 / b893, src/<build>/program/data/,
make verify-sp7001 verify-935 verify-893).
The GUI part of the region, the 8,509 widget records and their classes, is on KN7000 Menu Map. This page covers the rest. The lanes of the data-semantics effort did the work; their notes, in the disassembly repository, are the reference:
| lane | notes | what it added |
|---|---|---|
| gui-kn7000 | kn7000/notes/gui-data-region/README.md |
the GUI, demo songs, the built-in style, jump tables, reader tables, sparse maps, panel memories |
| kn7000-data-rest | kn7000/notes/data-rest/README.md |
the reader walk; struct arrays and the records their pointers lead to; DSP records, bitmaps |
| kn7000-final | kn7000/notes/data-final/README.md |
the extended walk; the resource-id trie, SupportClass table, SysEx strings; the SP7001 plug-in |
| mn10300-formats | kn7000/notes/mn10300-formats/README.md |
the alphabetical sound lists, zlib’s tables, field names from their use (2026-10-31) |
| mn10300-typer | kn7000/notes/mn10300-typer/README.md |
pointers only at instruction starts, array ends, loop indexes, stepped arrays, record chains (2026-10-31) |
Structures that have a format of their own
- The built-in demo songs. The 30 zlib streams of each build are its 10 demo songs, three
streams each.
DemoSongLoad(d0 = the song) takes song n’s streams from three 12-entry tables in the initialised RAM and inflates them withfunc_48533758: the song record intoRec8E0TablePtr(0)(0x8E0bytes), the event memory into0x5003D36C(0x9800bytes) and a panel-memory bank. They are the formats of the floppies’.SQTand.PMTfiles, so the floppy describers type them, event by event and record by record (Floppy Disk Files and Formats), inside.zlib 6blocks: kn7asm compresses them with Python’s zlib, which reproduces all 30 streams byte-exactly. - The program’s own “Technics Rhythms” resource.
TechnicsRhythmsResource(9410x48729988) has IC18’s format (Rhythm ROM (IC18)) with a single style, “8 Beat 1”, the fallback.tools/program_rhythm.pytypes it with IC18’s macros: header, count block, the 2048-entry index, the tables, the 8 count-in patterns, the style record and its 20 variations, every event one line. - Built-in panel memories. The
0x486C..0x4870region holds 103 (941) built-in PANEL MEMORY records: tag / length lists that start with the name record, hold 43 records and fill exactly0x750bytes, several behind a 16-character bank name. They arePMR_*lines, the same macros as the floppies’.PMTfiles (Panel Memory Records). - The tone generator’s curves. The region
0x486C0000..0x486F0000is not style data: it is the tone generator’s curve and level tables, read by theTg*library routines (TgElemNoteOnStd_Tableis the curve at0x486D1F54, 128 x u16). - The effects-DSP download records, 80 of them, block by block, each program-memory word with its SHARC instruction (Effects DSP).
- Bitmaps. Procedures that answer
MT_GetBitmapData/Width/Height/Palette/MT_GetBitCountgive the bitmap resources, and pixels handed toDrawBitmapSPand its variants with a constant size give more; they are indexed PNGs in<data dir>/media/, packed back bytools/table_png.pyat build time. The 8 JPEG and 2 BMP files the region holds are whole files.
Typed from the code that reads it
Most of the region has no format of its own: it is tables and records that only the code
explains. kn7000/tools/data_readers.py walks the converted code function by function, with a
symbolic value per register:
| value | meaning |
|---|---|
C(c) |
a constant |
A(x) |
the address x (a data label, Label+N, or a number) |
S(s) |
an unknown index times s (mul / mulu by a constant, asl, asl2, add r, r) |
I(b,s,o) |
b + index * s + o: field o of an array of s-byte records at b |
P(key,o) |
a pointer loaded from the 32-bit field key, plus o |
D(key,o) |
a function’s own d0 / d1 argument: a pointer if it is dereferenced, else an index |
Every load, store and call argument through such a register is an access, with its width and
signedness (an extb / exth right after the load). A function’s accesses through its own
arguments are carried into every caller that passes a data address in them, so a record handed to
a helper is typed by what the helper reads. Every structure found is also checked against the
bytes.
Struct arrays. An access through base + index * stride + offset makes an array of
stride-byte records at base. Each record kind is one macro in <data dir>/data_structs.inc,
whose header lists every field, its type and its first readers, with the instruction:
# MusicStylistSetup: 24-byte records (StyleRecordTable, 1080 records); fields, and what reads them:
# +0 panel ptr StyleListItemTextBuild 0x4847B18C `mov (d2, a2), a0`; AcCategoryListBoxProc 0x4847B2AE `mov (d0, a0), d0` (+10)
# +4 name ptr MssNameFunc 0x4847AFDD `mov (4, a0), a1`; StyleRecNameGet 0x4847B14B `mov (4, a0), a1` (+3)
# +8 genre u16 AcCategoryListBoxProc 0x4847B2AE `movhu (8, a1), d0`; StyleSubCatHeaderBuild 0x4847BA42 `movhu (8, a1), d0` (+9)
# ...
# +22 x22 u8[2] no reader seen
Records a pointer leads to. When the code loads a pointer from a typed field and reads through
it, the targets of that field are records too, typed by the offsets those reads use. When the
targets lie a constant distance apart, that distance is the record size. StyleRecordTable’s field
+0 points at 1,037 records of 160 bytes, one per built-in style’s panel settings
(MusicStylistPanelData). Fields no traced reader names keep offset names (f / p / s / a / x +
offset), with every reader in the macro header; tools/data_struct_names.py names the kinds whose
role is known.
The extended walk (lane kn7000-final, Reader(ext=True), the four KN7000 program builds only)
follows what the plain walk lost:
| rule | what it follows | example |
|---|---|---|
| stack slots | mov aN, (8, sp) … mov (8, sp), a0: a slot keeps the value stored |
func_484C4229 spills a value block to (0x2c, sp) and reads it with movbu (a0), d2 |
| joins | a label that paths reach with different data addresses holds “one of them”; reads through it are reads of each | func_484C01F1, a 260-way switch that leaves one descriptor’s address in (0, sp) |
| return values | what a function returns in a0: one of a set of addresses, or a pointer loaded from a typed field | func_484C01F1 (260 records), SoundAlphaListGet (an entry of SoundAlphaListTable) |
| named loop labels | a label is a function start only at its header, or where nothing falls in and no branch reaches it | DrawIcons_Impl_RowLoop keeps a3 = DrawIcons_PixelPairTable |
| loop bodies | a label reached only by a backward branch keeps the frame’s slots | SoundAlphaIndexBuild’s movbu (d1, a0), d2 over a sound list |
| bounds | a load whose source the walk does not know drops the bound an earlier cmp gave the register |
DrawIcons_PixelPairTable is 256 entries, not the 240 of cmp 0xf0, d0 |
On program 941 the plain walk sees 22,372 distinct accesses and the extended one 26,677
(kn7000/notes/data-final-probes/reader_ext_stats.py); 126 functions return one of a set of data
addresses.
With it come new passes of gen_data_s.py:
| pass | what it types | evidence |
|---|---|---|
support_classes |
the SupportClass table (registry slot 0xD, 54 entries and an empty one) as SUPPORT_CLASS proc, x4, propsize, data |
InitSptClassTable registers it; SupportClassProc reads it |
resource_trie |
the resource-id trie: 177 tables, 940 entries, 7,400 bytes, as RES_TRIE_ENTRY target, inner, count |
ResourceIdFind: nibble-indexed 8-byte entries, inner 0 = a leaf |
sysex_strings |
MIDI SysEx messages a typed pointer points at (0xF0, data below 0x80, 0xF7; 0x50 = Matsushita), one row each |
the framing, and the pointer fields that hold them |
copied_blocks |
a data address passed to memcpy / memcmp / strncmp / strncpy with a constant length: that many bytes | the call’s a0 / a1 and d0, cited in the header |
pointer_runs |
aligned runs of 3 or more words that are each 0 or an address of the region: .long Label |
[INFERENCE] by value; the header says no reader was traced |
ptr_records |
records one function selects: <func>_Result / <func>_Selected; short records as <kind>_s<N> size variants |
the reads through the selected value |
The resource-id trie is the table every live panel parameter goes through: GetM3Em /
PutM3Em look a 24-bit parameter id up in ResourceIdTrie (0x4858B424, inside the typed
ResourceIdTrieNode_485897BC), a tree indexed by the id’s nibbles, whose 469 leaves say which byte
of the live panel record holds the parameter. What those leaves name is on
Panel Memory Records.
Other examples: TechniChordCompute_Table_2 is the chord-type switch of TechniChordCompute
(0x48472EBA), 42 code pointers (a table that holds code addresses spells each target loc_<ADDR>,
and code_refs.txt makes the code generator label it); the effect names and fixed-width value
strings (“ 0.1 “, “ 10 ms”) are string arrays; {u32 key, code address} runs are dispatch
tables, with a MILK-id key spelled by its name.
Sound lists, zlib’s tables and field names (lane mn10300-formats)
Lane mn10300-formats (2026-10-31, kn7000/notes/mn10300-formats/README.md) took the last open data-format items of the
MN10300 trees. Its KN2400 and KN6000 findings are on their pages
(the model strap and the effect descriptors,
the sound hash payloads);
the KN7000’s are here and on SP7001 Plug-in.
The alphabetical sound lists
SoundAlphaListTable’s lists were described here as demo-song streams of 4-byte events. They are no
demo songs. SoundAlphaIndexBuild (0x485831DC) reads +0 of each 4-byte entry and groups the
entries by that byte with the C library’s ctype table (letters first, then digits), and
SoundAlphaInitialGet (0x485834C0) matches +1 / +2 / +3 against a sound’s bank MSB, LSB and
program and answers +0. So an entry is {char initial; u8 bank MSB, LSB, program}, a list ends with a
zero entry, and SoundAlphaListGet (0x485831BA) picks one of the table’s 6 pointers by kind (the
sound group) and a variant. The four lists (941):
| label | entries | selected for |
|---|---|---|
SoundAlphaList_Groups00_12 |
1,236 | groups 0..0x12 and 0x1F, variant 0 |
SoundAlphaList_Groups00_12_Var1 |
1,215 | the same groups, variant 1 |
SoundAlphaList_Groups13_1E |
1,210 | groups 0x13..0x1E but 0x19 / 0x1A |
SoundAlphaList_DrumKits |
41 | groups 0x19 and 0x1A (the drum kits) |
gen_data_s.py’s sound_alpha_lists() pass writes one SOUND_ALPHA "A", 121, 2, 120 line an entry in
the four KN7000 program builds; the siblings have no such lists. Variant 1 is chosen when
func_484974A4 answers 0 for the group [INFERENCE on what it tests]. The real demo-song streams are
the inflated ones whose tables sit in the initialised RAM at 0x50000C20 / 0x50000C50 / 0x50000C80
(Work RAM).
zlib’s tables
kn7000/notes/mn10300-formats-probes/zlib_tables.py finds 19 of zlib 1.0.4’s
data tables by their contents (they are the zlib sources’ own) in every KN7000 build and in the KN6000,
KN6500 and KN2400; the HD-SX3 plug-in has no zlib. They are named at their RAM addresses (the
initialised-RAM image) in each tree’s manual symbol file: configuration_table, extra_lbits,
extra_dbits, extra_blbits, bl_order, static_l_desc / static_d_desc / static_bl_desc,
static_init_done, border, cplens, cplext, cpdist, cpdext, fixed_built, the two copyright
strings, inflate_mask and z_errmsg.
Field names from their use
kn7000/tools/data_field_uses.py follows the register a field’s
reading instruction loads through the next instructions, and into the routine it is handed to, two
levels deep; data_struct_names.auto_name() names the field after what is done with it: proc,
text, key, count, index, flags, kind, a parameter name of a known routine (view, title,
event, icon …), <Routine>_<reg> for another named routine, or a constant’s family. The curated
names still come first; a field whose places of reading disagree, or whose use the linear walk does
not see, keeps its offset name. Record-macro fields named, before and after
(kn7000/notes/mn10300-formats-probes/field_names_census.py, on the lane’s base f4045a81c and after
its regeneration):
| tree | fields after | named before | named after | offset-named with a reader, before | after |
|---|---|---|---|---|---|
| kn7000-941 | 1,436 | 31 | 601 | 893 | 628 |
| kn7000-942 | 1,446 | 30 | 605 | 898 | 630 |
| kn7000-935 | 1,440 | 26 | 599 | 901 | 634 |
| kn7000-893 | 1,440 | 26 | 600 | 901 | 633 |
| kn6000 | 1,330 | 30 | 525 | 1,156 | 668 |
| kn6500 | 1,331 | 30 | 523 | 1,156 | 670 |
| kn2400 | 1,281 | 36 | 524 | 1,111 | 622 |
| hdsx3 | 58 | 0 | 8 | 46 | 43 |
What stays offset-named: fields read in more than one place of a function with different uses, values stored to the frame and used later, and values whose only use is arithmetic.
Pointers, arrays and loops (lane mn10300-typer)
Lane mn10300-typer (2026-10-31, kn7000/notes/mn10300-typer/README.md) took the typer’s open items: text typed as pointers,
the array-end rule, and four extensions of the reader walk. The machinery is in kn7000/tools/
(gen_data_s.py, data_structs.py, data_readers.py, gen_program_s.py and the new
mn10300_insn_len.py) and applies to every MN10300 tree. Each rule is a key of gen_data_s.FEATURES,
on by default; GEN_DATA_S_OFF turns rules off, which is how the lane’s typer_stats.py measures each
one against the generator as it was:
| rule | what it does |
|---|---|
ptr_starts |
a 32-bit word is a pointer into code only when it is the first byte of an instruction; otherwise it is text or a number, as the readers say |
array_end |
a pointer loop proven to stop at an address (cmp End, aN and a branch back) ends the array it walks |
mem_ptrs |
data addresses stored to a memory slot (a RAM global, a data word, a field of a record) and loaded back elsewhere |
loop_index |
a constant in a data register a loop writes is the loop’s induction variable at its head; a pointer plus a scaled index keeps the scale |
step_arrays |
a block a routine steps through (or indexes) by s >= 2 is an array of s-byte records |
deep_records |
a loop that walks records through their own field types every record of the chain; blocks the code copies whole are typed copies |
Pointers only at instruction starts. Uppercase text often reads as a code address: "><SH" =
0x48533C3E in the feature demo’s XML script (REC_StartFeatureDemo_Table_p0), "RIGH" of
MidiPmemOutLGrid’s “RIGHT 1”, "PUSH" of “PUSH EXIT BUTTON”. tools/mn10300_insn_len.py ports the
KN7000 MAME driver’s instruction-length decoder and decodes forward from the anchors the converted code
gives (its function headers, func_<ADDR> and *_entry names, branch labels), and
gen_data_s.code_ptr_ok() asks it of every code value before it is taken for an address. Checked
against what kn7asm assembles, byte by byte (insn_starts_check.py):
| tree | instruction bytes | agree | disagree | undecided (before the first anchor) |
|---|---|---|---|---|
| kn7000-941 | 1,850,485 | 1,850,470 | 0 | 15 |
| kn7000-sp7001 | 1,853,070 | 1,853,055 | 0 | 15 |
| kn7000-b935 | 1,850,421 | 1,850,408 | 0 | 13 |
| kn7000-b893 | 1,845,605 | 1,845,592 | 0 | 13 |
| kn6000 | 1,544,492 | 1,544,474 | 0 | 18 |
| kn6500 | 1,546,542 | 1,546,524 | 0 | 18 |
| kn2400 | 1,778,472 | 1,778,452 | 0 | 20 |
| hdsx3 | 253,526 | 253,524 | 0 | 2 |
The feature demo’s record is now two fields and one 1,256-byte text field; “RIGHT 1”, “PUSH EXIT BUTTON”, “BRIGHTNESS”, “SLIDESHOW” (and the KN2400’s “MD_HSS”, “TT_HELP” …) are strings again.
The array-end rule. At cmp End, aN followed by a branch back, taken while aN < End, with aN
holding the array’s base at the loop head and base + s at the compare, the array ends at End; the
table header cites the compare. Only bottom-tested loops count. 40 bounds in build 941, 16 tables
shortened: MainMmmControl_Table is 256 entries, not 260 (its +1024 / +1028 are MainMmmControl’s
two variables), and the code that named the bytes after a shortened table now names their own tables:
movhu (CmpMCopyFieldApply_Table+20), d0 became movhu (FE_CmpMDelFstMeas_Table), d0, one of the FE_*
menu fields’ min / max pairs the table had swallowed.
The walk. (a) mem_ptrs follows a pointer stored to a memory slot and loaded back; it found 5
slots in 941 and types no new byte in the KN7000 builds. (b) loop_index treats a loop’s counter as an
index rather than its first value, and counts a loop that compares its counter with a constant
(DrawBitmapSPFast16_Impl’s palette index runs 0x20..0x2F). (c) step_arrays types a block a routine
is handed and steps through as an array of records (DrawBitmapSPFast4_ArgSp24_*, a palette of 4-byte
records); the count is the loop’s when it is proven, else the block’s extent [INFERENCE]. (d)
deep_records follows a loop that walks a chain through a field: the voice directory’s five hash
tables (VoiceDirRemapFind, VoiceDirClassFind, VoiceDirIndexFind, VoiceDirRefFind,
VoiceDirPartRefFind: a2 = Table[hash]; while (a2) { ...; a2 = *a2 }) go from 2,118 records (the
bucket heads) to 3,351 in build 941; and copied_blocks() now runs for the siblings too.
Figures (typer_stats.py: the generator with every rule off, which reproduces the committed
sources before the lane byte for byte, against every rule on; code_in_data.py for P, the
mid-instruction .long count; measured against main 868b201f0; n / bytes):
| tree | typed before | typed after | change | reader rows before | after | opaque before | opaque after | P before | P after |
|---|---|---|---|---|---|---|---|---|---|
| kn7000-941 | 2,125,911 | 2,143,981 | +18,070 | 85 / 995 | 78 / 905 | 3,448 / 63,227 | 2,174 / 45,394 | 3 | 0 |
| kn7000-942 | 2,132,336 | 2,150,400 | +18,064 | 87 / 1,091 | 81 / 1,013 | 3,471 / 61,497 | 2,196 / 43,654 | 3 | 0 |
| kn7000-935 | 2,126,637 | 2,144,574 | +17,937 | 87 / 1,091 | 84 / 1,049 | 3,459 / 64,020 | 2,193 / 46,280 | 1 | 0 |
| kn7000-893 | 2,126,357 | 2,144,470 | +18,113 | 85 / 995 | 79 / 917 | 3,453 / 62,910 | 2,177 / 45,007 | 2 | 0 |
| kn6000 | 2,424,027 | 2,436,905 | +12,878 | 185 / 11,215 | 142 / 9,370 | 2,833 / 65,733 | 2,347 / 54,782 | 0 | 0 |
| kn6500 | 1,935,342 | 1,948,203 | +12,861 | 190 / 11,331 | 147 / 9,486 | 2,849 / 69,967 | 2,364 / 59,027 | 0 | 0 |
| kn2400 | 1,670,358 | 1,688,962 | +18,604 | 218 / 9,889 | 184 / 8,255 | 4,448 / 172,071 | 3,419 / 155,297 | 1 | 0 |
| hdsx3 | 481,868 | 482,118 | +250 | 34 / 211 | 34 / 211 | 98 / 3,103 | 98 / 2,981 | 0 | 0 |
Of the rules alone on 941, deep_records types the most (+11,924 bytes) and loop_index next
(+5,959); they overlap. No tree loses typed coverage; a few bytes per tree that an over-long table or
record held before (6 to 87) are now rows, fill or opaque pieces, for instance the 0xFFFFFFFF after
PartHasDspUnit_Table (the loop stops before it) and func_48440E4D_Records, 3 “User Bank” records,
not 6.
Blocks a routine is handed
Much of the program data is never read where it is named: the code loads the block’s address and
passes it to a routine (in a0 / a1 for a pointer, d0 / d1 for a number, the rest in the
caller’s stack frame at +0x10, +0x14, …; calling convention),
and that routine reads the fields. Since lane callee-walk (2026-10-30,
kn7000/notes/callee-walk/README.md)
the data sources follow the address into the routine, and into the routines it hands it on to, and
write the block as a record of what they read: one macro per (routine, argument),
REC_<routine>_Arg<slot>, whose comment names each field’s reader, and a header on each block naming
the routine, its address, the argument and the call that passes it.
The walk already carried a callee’s reads through its register parameters into its callers. Three
things kept such blocks as rows: arguments past the fourth, which go on the stack, were not followed;
a callee’s read at +6 of its argument came back as a read of the fixed address Block+6, so each field
became a separate _Var / _Table; and the siblings’ walk lost the address on its way to the call.
Reader(callee=True) (profile key readers_callee, on the four KN7000 program builds and the four
siblings) adds:
| rule | what it follows |
|---|---|
| stack arguments | a call records each word of its frame holding a data address or a parameter as argument spN; the callee’s read of (N + frame, sp) is parameter spN |
| named branch labels | bne DrawString_DrawNow: a branch to a named label that no call and no routine header names stays inside the function |
| loop steps | a parameter pointer stepped (inc a0, add 2, a0) between a label and a branch back to it is stepped by a loop |
| jump-table cases | a label nothing branches to after the function’s jmp (aN) takes the addresses and parameters the dispatch held ([INFERENCE]) |
| layouts | per (function, parameter): every access relative to it, its own and its callees’, to a depth of 4 calls, and the calls that pass a fixed data address in it |
| siblings only | frame slots (narrowed), address joins and return sets, the KN7000 extended walk’s rules, so a switch that selects a record per case reaches the call |
tools/gen_data_s.py then types a block as such a record when the routine reads at least two of its
fields (or one past +0), and says why when it does not (arg_why()): a library routine (str*,
mem*, *printf), a routine that only stores the pointer (a timer, a registry, a queue), a byte loop,
or one field at +0. Two records of a kind a whole number of records apart with free bytes between have
the records between typed too ([INFERENCE]). Fields are offset-named (f12, p8, x4) except where
tools/data_struct_names.py knows their use: the kernel’s task-creation blocks are micro-ITRON
T_CTSK records {exinf, tskatr, task, itskpri, stksz} that cre_tsk (0x4C03D0C8) hands to
its body cre_tsk_Impl (func_4C03D154 until lane uitron-names, 2026-11-07); before, each field was a
separate one-word table. Other examples: REC_cre_flg_ArgA0 (REC_func_4C03C7EF_ArgA0 until the same
lane; 12 bytes, 10 blocks and one 8-byte variant: uITRON’s T_CFLG {exinf, flgatr, iflgptn} by size,
not yet typed as such), REC_func_48401F32_ArgA0_s4
(an array of 35 4-byte records that FdcPrgRequest steps through by 4; the callee walk first read it as one 28-byte
REC_func_48401F32_ArgA0, with one record between two passed ones inferred, until the mn10300-typer regen
d0adc5707), REC_func_4844416A_ArgA0 (read at
+3..+5 after an add 2, a0).
Reader rows and records, before and after, measured against disassembly 2a7b45be5
(kn7000/notes/callee-walk-probes/callee_walk_stats.py --reasons; n / bytes):
| build | address-only rows before | after | all rows before | after | callee records | inferred records |
|---|---|---|---|---|---|---|
| 941 | 50 / 1,037 | 39 / 682 | 86 / 1,358 | 88 / 1,055 | 39 / 535 | 1 / 28 |
| 942 | 52 / 1,133 | 41 / 778 | 88 / 1,454 | 90 / 1,151 | 44 / 635 | 1 / 28 |
| 935 | 52 / 1,133 | 41 / 778 | 88 / 1,454 | 90 / 1,151 | 40 / 547 | 1 / 28 |
| 893 | 49 / 1,033 | 39 / 682 | 85 / 1,354 | 88 / 1,055 | 40 / 547 | 1 / 28 |
The row count rises by 2 or 3 while the bytes fall: 13 empty strings handed to StrIsBlank (one of
a switch’s set, now followed) are written .asciz "" in place of a variable and a table. With the walk
on, each build types 333 to 335 more bytes of the data region than with it off
(callee_off_on.py --profile P), and 128 bytes typed only with it off are now string rows. In 941 the
39 address-only blocks left as rows (682 bytes) stay so because the address reaches no call the walk sees (18 / 400 bytes), the
routine only stores it (14 / 140), it goes to a library routine (5 / 48), or the routine’s reads are
lost inside it (2 / 94). The same walk did most for the siblings
(KN6000 / KN6500,
KN2400).
The last open items (lane mn10300-rest)
Lane mn10300-rest (2026-10-31, kn7000/notes/mn10300-rest/README.md,
probes in kn7000/notes/mn10300-rest-probes/) took the open items of the MN10300 trees’ notes. Every rule
it added to the generator is a switch (gen_data_s.FEATURES, environment variable GEN_DATA_S_OFF), so
rest_stats.py measures each one against main. Its KN2400 and KN6000 findings are on their pages
(the effect DSP,
the switch states,
the HD-SX6 plug-in’s entry points).
The ‘Tone’ hash and the switch-key hash (lane mn10300-rest)
The KN7000 reads the table flash’s ‘Tone’ hash with the KN6000’s routines, over four archive sources
(probe kn7000_tone_hash_readers.py): ToneKeyFind, SoundSwNoGet (payload +3 .. +8, the four switch
states), SoundIconGet (+2), SoundToneIndexGet (+0), ShortKeyLookup, SoundSwNoBankGet (state 1’s
offset is 0x12, because the KN7000 has 18 panel groups), SoundGroupNameGet, SoundGroupSizeGet and
PartHasDspUnit: 31 names in kn7000_manual.sym, ported to 942, 935 and 893. In the archive’s source
(tools/gen_table_voices.py) the payload is jk_tone_key; the table called “Dir1” is the switch-key
hash (u16 key = key group « 8 | number, payload {MSB, LSB, program}: JkSwKey*), and JkGroupTable (the generator’s old name) is
JkGroupSizes. The generator’s “entry +14” zone pointers were payload bytes +6..+9 read as an offset;
they labelled nothing and are gone. The round trip agrees for all 3,323 entries.
The tone generators’ side bits (probe tg_side_bits.py): 0x400 is the MAIN tone generator at
0x98050000 (wave ROMs IC203 / IC204), 0x800 the SUB one at 0x98040000 (IC207 / IC208). The chain is
TgVoiceSideSelect -> TgElemRequestFlags (bits 0x08 / 0x10) -> TgVoiceNodePick (TgNodeScanSideA
keeps the slots below 0x40) -> TgVoiceRegWrite (slots below 0x40 to 0x98050000). All 5,215 zones name an
existing wave entry on that side (with the sides swapped 2,120 do not), so each zone’s comment now names
only that side’s recording.
Loops, memory slots and field names
- Top-tested loops (
top_tested): a loopL: cmp End, aN/ exit / … /add s, aN/bra Lnow bounds its array as the bottom-tested ones do. It adds no bound in the images: the compiler writes its pointer loops bottom-tested, and no top-testedcmp <data label>, aNwith a branch back exists in the four trees’ code. The top-tested loops the opaque search found compare a loaded field with a terminator. - Memory slots (
fld_slots): a pointer loaded from a typed field and stored to a memory slot, the only thing ever stored there, is that field’s pointer again where the slot is loaded back: 131 such slots in 941; they type no new byte, because their targets are typed already. - What stays out of reach is a run-time dispatch, not a limit of the walk:
SetApTimer’s message field is read only byApTimer, which hands it toProcCall, andProcCallcalls the procedure a task registered in the RAM table0x5011FAACwhen its window registered itself. - Field names.
tools/data_field_uses.pynow follows the loaded register from the access’s own place, follows a value parked in the frame to its reloads, goes on at an unconditional branch’s target, reads a compare before a backward branch as a search key, and names a field whose readers still disagree by the uses of all of them. A field compared only with 640 / 639 isx, with 240 / 239y. Record fields still named only by their offset although a reader touches them (field_names_census.py):
| tree | before | after |
|---|---|---|
| kn7000-941 | 630 | 256 |
| kn7000-942 | 633 | 258 |
| kn7000-935 | 639 | 263 |
| kn7000-893 | 638 | 263 |
| kn6000 | 683 | 264 |
| kn6500 | 685 | 263 |
| kn2400 | 637 | 208 |
| hdsx3 | 43 | 37 |
What stays offset-named in 941: values whose only use is a store, an arithmetic combination or a return
(156), uses that name nothing (73), and fields read through memcpy / strcpy (12).
The opaque blocks
Four probes grouped every census: opaque -- unknown-dump piece and searched each group’s readers
beyond the linear walk. New passes type the C library’s powers of ten (Pow10Table, 309 doubles that
PfDoubleToDecimal reads; 941 0x486D06DC, 942 0x486D1700, 935 0x486BCEFC, 893 0x486BB6A4), which
were the “high-entropy” bytes; the EUC-JP strings of the language tables (AcLanguageTextProc); the
siblings’ parameter-id tries; and the KN7000 builds’ own “Technics Pads” copy. Opaque bytes, before and
after (typer_stats.text_stats on the lane’s committed sources, its table “Measurements”; no census
snapshot holds these figures yet):
| tree | opaque before (n / bytes) | after |
|---|---|---|
| 941 | 2,174 / 45,394 | 2,073 / 33,741 |
| 942 | 2,196 / 43,654 | 2,094 / 31,158 |
| 935 | 2,192 / 46,280 | 2,090 / 34,612 |
| 893 | 2,177 / 45,007 | 2,076 / 33,339 |
| kn6000 | 2,347 / 54,782 | 2,175 / 39,985 |
| kn6500 | 2,364 / 59,027 | 2,189 / 44,212 |
| kn2400 | 3,419 / 155,297 | 2,885 / 61,226 |
| hdsx3 | 98 / 2,981 | 95 / 594 |
That is 173,555 bytes over the eight trees. The groups with a traced reader that no generator pass types
yet are the next lane’s list (941 bytes): terminator-ended lists of 12 / 13-byte records 7,516, 128 x 64
code / chord maps 5,352, chord voicings and inversions 5,008, fixed-count tables past their typed part
4,663 (ChordRecogTable2, the 32-slot hash tables, HpFlashWriteDefaults …), widget variables in the
initialised RAM image 3,526, style / setup lists 638. What stays opaque, and why, is listed in the README:
alignment padding and record tails no reader reaches, the IvCustomizeBase record’s x / y (no routine reads them), the reflection tables’
second halves, the flash sector tables’ unread words.
More of the data typed from the code that reads it (lane mn10300-data)
Every widget’s state variable in the initialised RAM – the selected item of a list, the value of a number box, the window a screen opens – is now written at the width its class’s procedure reads it, with that instruction cited. The chord and code maps (128 rows by 64 entries, one row per note, one column per chord type) and the chord voicings (twelve keys, up to seven notes each, and the inversions) are tables of their own; so are the lists the firmware walks until an end marker (the panel buttons’ descriptors, the effect programs’ command lists, the style lists) and the tables whose size the code checks before indexing them (the 32-slot hash tables, the 101-entry curves, the 99 words the hard-disk defaults copy).
| tree | typed bytes before | typed bytes after | opaque pieces / bytes before | opaque pieces / bytes after |
|---|---|---|---|---|
| 941 | 2,154,302 | 2,256,494 | 2,073 / 33,741 | 912 / 15,782 |
| 942 (SP7001) | 2,161,564 | 2,261,320 | 2,094 / 31,158 | 917 / 15,655 |
| 935 | 2,154,908 | 2,257,439 | 2,090 / 34,612 | 929 / 16,310 |
| 893 | 2,156,004 | 2,257,726 | 2,076 / 33,339 | 918 / 15,843 |
Measured by kn7000/notes/mn10300-data-probes/data_stats.py --dirs BEFORE AFTER --brief (typed bytes from
labels.sym’s item sizes; opaque pieces as the generator counts them, not the data-incbin census), before =
disassembly c240d1c0b, after = the lane’s regenerated sources; the rules are the gen_data_s.FEATURES keys
(disassembly kn7000/notes/mn10300-data/README.md). The census below predates this lane.
Value names, boot sectors, style lists (lane mn10300-data2)
The framework’s value names, the disk formats’ boot sectors, the style lists. Each of the MILK
framework’s 54 support classes (the integer, ID, pointer, rectangle and flag types an object’s
properties have) points at a list of value names, {name, value} pairs ended by an empty name:
“True” / “False”, the view flags VF_*, the colours CL_*, the borders BD_* …; the classes’
common handler turns a value into its name and back with them. The disk formatters’ boot sectors are
typed too: the jump, the OEM name “Technics” and the BIOS parameter block of a 720 KB disk (1,440
sectors, media 0xF9) and of a 1.44 MB one (2,880 sectors, media 0xF0), then a two-byte jmp $. The
Music Stylist’s genre lists now show every style with its four setups.
| tree | typed bytes before | typed bytes after | opaque pieces / bytes before | opaque pieces / bytes after |
|---|---|---|---|---|
| 941 | 2,256,494 | 2,264,713 | 912 / 15,782 | 629 / 9,760 |
| 942 (SP7001) | 2,261,320 | 2,265,957 | 917 / 15,655 | 641 / 11,133 |
| 935 | 2,257,429 | 2,262,066 | 930 / 16,322 | 654 / 11,800 |
| 893 | 2,257,716 | 2,262,353 | 919 / 15,855 | 643 / 11,333 |
Measured by kn7000/notes/mn10300-data-probes/data_stats.py --dirs BEFORE AFTER --brief, before = disassembly
1345995bc’s committed data directories, after = the lane’s regenerated sources; the rules are the
gen_data_s.FEATURES keys support_values, sibling_support, boot_sectors, panel_700, style_lists,
reclaim_strings and curated_counts (disassembly
kn7000/notes/mn10300-data2/README.md).
Stable names, track lists, the APC / SEQUENCER slider (lane mn10300-data3)
Stable names, track parameter lists and the APC / SEQUENCER slider. The firmware’s screens
hold thousands of widgets with no resource name of their own; the disassembly invents a name for
each (its screen, its class and the text it shows) and now keeps those names in a table beside the
source (<src>/data/gui_object_names.tsv), so that they no longer change when the source is
regenerated: a run reads the table before it makes any name and writes it back, and editing one row
renames that object and nothing else. The five lists of parameter ids that func_4845BC68 walks by
index to the end marker -1 (one 32-bit word per id; picked by the sequencer track kind, through the
byte table func_4845BC68_Table for kinds 0..0x12 and cmp 0x40 / 0x41 / 0x42 for APC, CONTROL and RHYTHM)
are typed as lists; they are the ids a song track of that kind may carry (on the KN7000 82 for a part
track, 62 for PART 10, 12 for APC, 32 for CONTROL, 8 for RHYTHM; see
Sequencer). In the one-touch settings and panel memories, the
byte that was called m008008 is apc_volume, the APC VOLUME (parameter 0x008008): the APC /
SEQUENCER VOLUME slider (the panel CPU’s input AD2, VR1102, read through PanelCtrlValueGet(0xC2)) sets the APC VOLUME while no song plays and the SEQ VOLUME
(0x008006) while the sequencer plays, holding the other at full level (127). The other m<id>
fields the firmware’s own parameter dump names were renamed with it: master_tune, msa_on,
apc_type, apc_type_alt, rhythm_sync, drawbar_type, tabs_1, tabs_2
(Panel Memory Records). The C library’s
locale tables (LconvMonetary / LconvNumeric), the voice directory’s hash chains and the
chord-recognition table’s 2,048 entries are typed in every build.
| tree | typed bytes before | typed bytes after | opaque pieces / bytes before | opaque pieces / bytes after |
|---|---|---|---|---|
| 941 | 2,264,713 | 2,264,713 | 629 / 9,760 | 629 / 9,760 |
| 942 (SP7001) | 2,265,957 | 2,269,541 | 641 / 11,133 | 634 / 9,633 |
| 935 | 2,262,066 | 2,265,650 | 654 / 11,800 | 647 / 10,300 |
| 893 | 2,262,353 | 2,265,937 | 643 / 11,333 | 636 / 9,833 |
941 gains no typed byte: its lists were already typed (a 4-byte record and an indexed tail) and are now lists; 942, 935 and 893 gain the chord-recognition table’s last 1,500 bytes and the lists.
Measured by kn7000/notes/mn10300-data-probes/data_stats.py --dirs BEFORE AFTER --brief, before = disassembly
2bde950fa’s committed data directories, after = the lane’s regenerated sources; the rules are the
gen_data_s.FEATURES keys sentinel_indexed, frozen_obj_names and host_widget_vars (disassembly
kn7000/notes/mn10300-data3/README.md,
merged in 3834c8773).
The plug-in regenerates again; field names (lane mn10300-data4)
The KN7000 builds gain no typed byte in this round: their opaque bytes stay 9,760 (941), 9,633 (942),
10,300 (935) and 9,833 (893). Their change is field names: ToneTypeFeature, the per-tone-type record of
TgPartEditLfoLoadA_Records that the LFO EDIT loaders read (a 19-byte head with four LFO triples, then
four 5-byte EG segment entries from +0x13), so the offset-named fields with a reader fall from 203 to 185
(941 / 942) and 225 to 207 (935 / 893). A curated field name is no longer given to a multi-byte field no
reader of the build touches. The SP7001 plug-in’s data regenerates again (make -C kn7000 plugin-src
reaches its fixpoint, verify-sp7001 is byte-identical): the generator now follows a plug-in’s host
Function-table record reached by an address sum, so all ten RegisterObjectTable calls of
func_483E8071 are seen, and the plug-in’s object names are frozen in its gui_object_names.tsv (311
objects) like every other tree’s (SP7001 Plug-in). The
siblings’ share of the round, the KN6000 / KN6500 effect-DSP parameter lists and the name tables’ file
halves, is on KN6000 Program Data
and KN2400 Program Data.
The sound-kind test and the kits’ key maps (see
Sound Subsystem)
kept their func_ names in this round, because the data labels derived from them would have changed
under other lanes; they are SoundKindGet and TableToneKeyMap since 2026-11-07, with the data labels
TableToneKeyMap_Records / _Table renamed in the same step (lane kn7000-subsystems,
kn7000/tools/derived_label_renames.py).
Measured by kn7000/notes/mn10300-data-probes/data_stats.py --dirs BEFORE AFTER --brief, before = disassembly
e53dc9b3a’s committed data directories, after = the lane’s regenerated sources; the rules are the
gen_data_s.FEATURES keys named_base_not_end and the milk_model / data_structs changes (disassembly
kn7000/notes/mn10300-data4/README.md,
merged in 8d0865c27).
Hook dispatch lists, accordion diagrams, copies (lane mn10300-data5)
Hook dispatch lists. Parameter changes are fanned out through lists of {mask, value, handler}
records, 12 bytes each: for a parameter id the firmware calls every handler whose (id & mask) == value,
until a record whose handler is 0. The dispatcher picks the list by the parameter’s group, and the
lists are now typed whole. Accordion register diagrams. The accordion tab’s register symbols are
18-byte pictures, three cells of five characters and a NUL, blanks and bullets (0x95 in the
firmware’s font), which AcAcdnTabProc copies whole (memcpy of 0x12 bytes) for drawing; they had
been guessed as strings. Copies. Some tables stand twice in an image with nothing seen to read the
second copy; the copies are now written as copies of the typed originals, each item by its own rule,
under <item>_Copy. Every image keeps the EQ band labels (“ 20”, “ 25”, “ 31.5” …) twice.
In program 941 the two dispatchers are func_4C021761 (nine lists, func_4C021761_Selected_0 ..
_8) and M3HookDispatch (eight); the lists are {mask, value, handler} walks the reader steps by 0xC.
The same rules and four new curated kinds (SdCommandFrame for SdCommandSend’s 10-byte command frame,
StylePartTemplate for StylePartTemplateDefault’s answer, BlockPatch, the JPEG encoder’s per-mode
sampling / table-selection records) apply to every build; an array whose label was kept from before its
reader had a name is also looked up under the reader’s present name, which gives 935’s localeconv
records 941’s LconvMonetary / LconvNumeric fields and TtMessage’s table MessageBoxDef.
| build | opaque bytes before | after | offset-named fields with a reader, lane | at 7283a6d69 |
|---|---|---|---|---|
| 941 | 9,760 | 8,038 | 185 -> 136 | 135 |
| 942 | 9,633 | 7,911 | 185 -> 148 | 145 |
| 935 | 10,300 | 8,578 | 207 -> 140 | 139 |
| 893 | 9,833 | 8,111 | 207 -> 152 | 149 |
Opaque bytes are kn7000/notes/mn10300-data5-probes/opaque_diff.py (before = the base 92b5cc4a7’s data
directories; “newly opaque” is 0 in every build) and kn7000/notes/mn10300-data-probes/opaque_left.py,
which gives the same totals at 486525b6e. The fields are
kn7000/notes/mn10300-formats-probes/field_names_census.py --md: the lane measured 136 / 148 / 140 / 152
on its branch. At 486525b6e, after lane kn7000-subsystems renamed the data labels derived from the
routines it named, the curated kinds keyed by the old labels (AppTaskState, the cyclic-handler packet,
the four JPEG mode records) were no longer applied and the census read 160 / 168 / 164 / 172;
data_struct_names.py now also looks such an array up under its reader’s address (reader_unalias,
7283a6d69), and the census reads 135 / 145 / 139 / 149. The rules are the
gen_data_s.FEATURES keys sentinel_copy, float_pairs, dup_spans and copied_reclaim (disassembly
kn7000/notes/mn10300-data5/README.md,
merged in 4e1d77a5b).
What is left in 941, by class (opaque_left.py --tree 941, bytes, base -> after): false-string 2,426 ->
2,282, table-tail 3,556 -> 2,800, after-string 1,389 -> 567, labelled-held 1,398 -> 1,398, other groups 991
-> 991. The largest pieces left are table tails (TgPartEgRampBuild_Table_3 304 bytes,
func_4843CAF9_Block_2 198) and bytes a string guess took after a NUL (Str_empty_276, 641 bytes).
What is left: the census
The instrument is scripts/analysis/data_incbin_census.py
(ROM Reconstruction). Its fourth
committed snapshot,
docs/coverage/data-incbin-2026-10-30-04.txt
(measured at b84f732aa, committed in a25c88274; its rows for these trees are those of -03, measured at a9b5cf764 after lanes media-files, code-island and callee-walk merged), reads for the four program builds (count / bytes; from media is the part
of generated made from a PNG or WAV by a committed converter):
| tree | generated | from media | media | opaque | generic n | generic bytes |
|---|---|---|---|---|---|---|
kn7000-program |
88 / 162,974 | 88 / 162,974 | 10 / 58,992 | 3449 / 63,392 | 0 | 0 |
kn7000-sp7001 |
527 / 462,486 | 527 / 462,486 | 169 / 1,375,301 | 3472 / 61,662 | 0 | 0 |
kn7000-b935 |
88 / 162,974 | 88 / 162,974 | 10 / 58,992 | 3460 / 64,185 | 0 | 0 |
kn7000-b893 |
88 / 162,974 | 88 / 162,974 | 10 / 58,992 | 3454 / 63,075 | 0 | 0 |
(kn7000-sp7001 also holds table build 83, whose media and generated items are most of its first
two columns.) For comparison: before the work the program tree was 3 generic entries of 2,563,794
bytes; after lane gui-kn7000 6,294 pieces of 793,436 bytes; after kn7000-data-rest 433 pieces of
17,416 bytes; in the first snapshot (data-incbin-2026-10-30-01, after lane kn7000-final) 177
pieces of 2,948 bytes; since the second (-02, at 141313939, lane generic-zero) none. Generic and
opaque over the snapshots (-04 = -03 for these trees):
| tree | generic -01 n / bytes | opaque -01 | generic -02 | opaque -02 | generic -04 | opaque -04 |
|---|---|---|---|---|---|---|
kn7000-program |
177 / 2,948 | 4298 / 82,196 | 0 / 0 | 3459 / 63,917 | 0 / 0 | 3449 / 63,392 |
kn7000-sp7001 |
179 / 3,044 | 4321 / 80,480 | 0 / 0 | 3482 / 62,187 | 0 / 0 | 3472 / 61,662 |
kn7000-b935 |
179 / 3,044 | 4309 / 83,003 | 0 / 0 | 3470 / 64,710 | 0 / 0 | 3460 / 64,185 |
kn7000-b893 |
176 / 2,944 | 4303 / 81,886 | 0 / 0 | 3464 / 63,600 | 0 / 0 | 3454 / 63,075 |
From -02 to -03 (and -04) opaque fell by 10 pieces / 525 bytes in each build: 8 / 507 when the kernel’s
flash tail became code (above) and 2 / 18 when the callee walk typed them
(above). The generated entry added in each build is SjisMissingGlyph’s
PNG.
The current snapshot, docs/coverage/data-incbin-2026-10-31-02.txt (measured at 6ca33e656, committed in c58fe3de7), after lanes mn10300-formats and mn10300-typer, reads
generic 0 and opaque (count / bytes) kn7000-program 2174 / 45,394, kn7000-sp7001 2196 / 43,654,
kn7000-b935 2192 / 46,280 and kn7000-b893 2177 / 45,007; the generated and media columns are those
of -04. The fall from -04 (about 1,275 pieces and 18,000 bytes per build) is the typer’s
(above) and the drum-kit sound list’s 165 bytes.
Before lane generic-zero, gen_data_s.py typed 2,106,173 of the region’s then 2,306,001 bytes in
build 941 (91.3%); lane callee-walk’s callee_off_on.py measured 2,125,687 typed bytes with its walk
on, against 2,125,352 with it off, at disassembly 2a7b45be5. The generated column is the bitmaps
(census: generated -- tools/table_png.py).
What the last generic pieces became (lane generic-zero, disassembly 4653d696b;
kn7000/notes/data-final/README.md, section “generic-zero”). A generic piece was one that some
instruction reads, loads as a base or passes to a call, with no pass turning it into a type. By the
owner’s rule none of them could stay a binary include, and none could be declared opaque either,
since each had a reader. In 941:
- The 260-way switch’s descriptors (
func_484C01F1) and the resource-id trie’s leaves are typed records,REC_func_484C01F1_Resultand trie-leaf records. They had been 30-byte pieces whose first bytes an earlier pass took for short strings.record_start()now stops a target from being taken for a string when the walk reads fields past its NUL. Each descriptor’s pointer field now names its SysEx (SysEx_48615730…), which is typed as SysEx too. The same fix moved about 18 KB out of the opaque declarations: the 14-byte “binary nothing reads” pieces after each mistyped string were the records’ tails. - Reader rows, 87 pieces / 1,390 bytes: each is written as rows at the width and signedness of
the reads that land in it (
tab_u8…tab_u32), its address words as.long Label/Label+N, under a header naming the readers. Four are read at a known width (the tail ofDialEventRepost_Table, u32; the 33 bytes beforefunc_4856E588’s 16-byte records; …). The rest are pieces whose address the code only takes: the RAM-image tablesdata_500077A4(208 bytes, u8 rows), two u32 tables at0x5000102C/0x50001120(zlib 1.0.4’scplextandcpdext: since lane callee-walk typed from the reads ofhuft_build, to whichinflate_trees_dynamic/inflate_trees_fixedpass them, and since lane mn10300-formats named so, below), the three 20-byte records_tr_inittakes (zlib’sstatic_l_desc/static_d_desc/static_bl_desc, named the same way), the 16-colour tables ofVwUserBitmapProc/AcMonImageProc(0x00BBGGRRrows at0x4859E484/0x485EFF04; since lane callee-walkDrawBitmapSPFast16_Impl_Table/_Table_2, 16 x u32, from the reads ofDrawBitmapSPFast16_Impl, to which they are passed),SjisMissingGlyph(32 bytes; since lane media-files a 16 x 16 one-bit PNG,media/SjisMissingGlyph.png, column-major, whichDrawString_Impldraws for an absent Shift-JIS code), andMainTitleControl’s MILK id pairs. - Strings: 32 empty strings (
.asciz "") handed to strcpy or named only as an address.
A reader row keeps the reader’s widths, not the callee’s layout: for a block whose address is only passed on, the walk did not follow the argument into the routine that reads it. (Lane callee-walk changed that: Blocks a routine is handed.)
The kernel’s flash tail
The generic-zero snapshot still declared one piece of code as data: func_487B8E34, 301 bytes the
library’s func_4C03B514 calls (call func_487B8E34, [d2,a2,a3], 0x1c), was
census: opaque -- unknown-dump, followed by more opaque pieces that were call targets
(func_487B8F9B, func_487B8F9E, func_487B8FA1) and a jump target (loc_487B8FA4). Lane
code-island (2026-10-30,
kn7000/notes/code-island/README.md)
found why: the MILK kernel keeps 1,317 bytes in the flash, right before the library image the boot
copies, and the generator’s split knew only two code ranges, code region 1 and the copied image.
Everything between was data, so the kernel’s flash-resident routines fell in the data region, where
no instruction loads from them and the reader search declared them unread.
gen_program_s.py now walks every call and jump target the converted code has in the data region
by control flow, emits what it reaches (and the unreached runs up to the library image, which must
decode into code ending in a return or jump) as src/<build>/program/tail_code.s, and writes the
range to <data dir>/tail_code.txt; gen_data_s.py ends the data region there. In 941 the 1,113
bytes from KernelInit on are code, and the 204 bytes before them stay typed data:
Str_MILK_MN10300_Ver1_0R1, KernelServiceHash, KernelRamLayout, KernelParams. The old
func_487B8E34 is KernelWaitRelease_entry, five bytes into KernelWaitRelease. Every routine, with
its evidence and its address in each build, is on
Firmware Images.
KernelTaskReadyRemove_Table’s true extent. KernelTaskReadyRemove reads it four times, always as
movhu (KernelTaskReadyRemove_Table), dN, with no index and no offset, so it reaches exactly one halfword,
KernelParams + 0x16 (value 10). The two halfwords after it (30, 0) are the end of KernelParams,
which no instruction the walk sees reads. The table had been typed “353 x s16” because
reader_tables() runs a fixed-address read up to the next label, and the next label was the call
target func_487B8E34, 706 bytes on: entries [3] .. [352] were the 695 bytes of KernelInit and the
5-byte prologue of KernelWaitRelease. (The many 20,536 = 0x5038 halfwords in it were the high
halves of KernelInit’s mov 0x5038xxxx, aN immediates.) It now reads 3 x s16, 0..30, its header
saying which index is read; KernelTimerTask_Table next door is two halfwords of KernelParams the
same way.
The opaque census fell by 8 pieces / 507 bytes in each of the four builds (the tail’s 7 pieces and
the 94 bytes before them). The same lane gave the MN10300 siblings’ generator the encodings it had
left as .byte escapes (278 instructions; branch targets landed on them), so no sibling has a .byte
run in its code any more. Its probe,
kn7000/notes/code-island-probes/code_in_data.py, lists every branch target, code-named label,
fall-through and code pointer that lands on bytes a tree emits as data: after the lane, none in any
MN10300 tree except struct fields that hold text which reads as a code address
(REC_StartFeatureDemo_Table_p0’s p28, the "><SH" of the feature demo’s XML script) and two
words of the KN2400 typed as pointers by value. Since lane mn10300-typer none at all: its P column
(mid-instruction .longs) is 0 in every tree (above).
Opaque (census: opaque -- unknown-dump) means that no load, store, base or call argument of
the converted code lands in the bytes under the extended walk, and the line says whether a typed
pointer or a code immediate still holds their address. kn7000/notes/data-final-probes/opaque_holders.py
also searched the whole image for any 32-bit word, at any alignment, holding an address in the
piece or up to 64 bytes before it. The biggest in 941:
| piece | bytes | holders | what the bytes look like |
|---|---|---|---|
0x48730AB3 |
2,101 | 0 | 7-byte groups xx 90 xx xx xx 00 00; no word points in or just before it |
0x486D0A8F |
1,525 | 0 | high-entropy bytes; since lane mn10300-rest part of Pow10Table, the powers of ten |
0x486CFC43 |
641 | 17 | held by the tone generator’s tables, read through no instruction the walk follows |
0x48715746 |
458 | 0 | more of func_48412A17’s 128-byte records’ tails, past its index bound |
0x48733632 / 0x48733428 |
774 | 0 | after ChordRecogTable2: [INFERENCE] chord-recognition rows read from a computed base |
0x485ED01C / 0x485ECDA0 |
824 | 20 | records with pointers, held by typed records, read by none the walk sees |
0x485F95E0 (HpFlashWriteDefaults_Table) |
304 | 0 | the table’s tail past the bound its reader checks |
These are the walk’s limits ([INFERENCE] on what they are): an address computed from a pointer the walk does not carry across a loop iteration, a RAM pointer set at start-up, or a table read only in a branch the linear walk enters with no state.
Open
Recursive structures besides the resource-id trie are typed one level deep: lane mn10300-typer’sdeep_recordstypes every record of a chain a loop walks (the voice directory’s hash buckets).Top-tested pointer loops do not bound their arrays: they do since lane mn10300-rest, and none occurs in the images (above).The 4-byte demo-stream events of the table’s three streams are byte rows: they are no demo streams but the alphabetical sound lists, typed since lane mn10300-formats (above).- Records whose pointer fields point into their own tail want a “record + inline payload”
representation. (The KN7000’s switch descriptors are records since lane generic-zero; the
KN2400’s twins, reached only as a base, are u8 rows with
.long data_X+20.) - Blocks the walk cannot follow stay rows: a pointer a routine stores (
SetApTimer/KillApTimer’s message argument,RegisterObjectTable,PutM3Em’s queue, zlib’s_tr_init), which whoever loads it back later reads; library copies (memcpy, strcpy,LibStrlen). Since lane mn10300-typer the walk follows a pointer stored to memory and loaded back (mem_ptrs, though it finds few such slots: most stored pointers are computed, andSetApTimer’s message is read through a function pointer), arrays indexed by a loop counter (loop_index) and loop-stepped records (step_arrays). Field names pastT_CTSK’s need each routine read. (Naming zlib’s tables in the symbol files: done by lane mn10300-formats, ported to 935 / 893 / 942, above.) andfunc_487B8E34is declaredunknown-dump: both settled by lane code-island (above).func_4C03B799_Table(353 x s16) runs on into code:func_487B8FB2, afterKernelInitHook, entered by no traced pathKernelTickIsrDefault, the kernel configuration’s default tick handler, which the application replaces (Firmware Images).Struct fields typed as pointers whose words are textandpointer-walk bounds: both settled by lane mn10300-typer (ptr_starts,array_end;MainMmmControl_Tableis 256 entries).- Field names left offset-named by the field-use walk (
f0,p8,x2): see Field names from their use. - An array’s record count, where the readers check no bound, is where its records stop being free or another name begins; such counts are inferences, listed in each macro header.