re: built-in 108 is deploy_squadron_ex — deploy plus a 1<<n selector

1146 sites in 22 stages, the second-largest unnamed built-in. Its method
sub_822646B8 (vtable slot 300) and built-in 2's sub_822642E0 (slot 12) are
190 and 199 instructions and differ in exactly one block. Diffed instruction
by instruction, 108 adds:

  lwz   r11, 16(r29)     the blob's slot-16 int
  cmpwi/blt/cmpwi/bgt    range-check n to [0, 31]
  slw   r21, r25, r11    r21 = 1 << n     <- a 32-bit selector
  ...                    default 1 when out of range

Everywhere built-in 2 passes its r21, 108 passes r20 and reserves r21 for the
mask, so the bit is an EXTRA argument to the same call rather than a
replacement. Both post the identical command word AB0100BA, opcode 256.

The operand is always a valid bit index: over all 1146 sites slot 16 is in
[0, 31], 1146 of 1146, none outside, so the out-of-range default never fires
in shipped content. Fifteen distinct values clustered at 16 (531x), 31
(165x), 20 (161x) and 2 (90x); 21 of 22 stages use more than one.

What the bit SELECTS is not established and the name does not claim it. There
is plainly a 32-bit space -- built-in 92 reportedly allocates a free bit by
OR-ing over live units, which would make 108 its "place in a named slot"
counterpart -- but I have not verified that, so the name says only what is
proven: the same deploy as built-in 2, with an extra selector.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PMRJjbxLqZtsb5Vb7KunPE
This commit is contained in:
Sylpheed RE agent
2026-08-26 01:31:39 +00:00
parent 4764e3d5f2
commit 679812f1c9
3 changed files with 40 additions and 1 deletions

View File

@@ -92,6 +92,7 @@ Generated by `tools/re-capture/isl_report.py calls`.
20 hp_pct_test 167
47 squadron_attack 137
15 set_group_speed 127
108 deploy_squadron_ex 117
18 dist_lt 92
12 activate_unit 86
5 kill_coroutine 83

View File

@@ -140,6 +140,43 @@ and spread checks but its maximum *exceeds* the table — flag indices run 0..31
against symbol tables as small as 40 — so it is excluded, and the disassembler
now declines to resolve it rather than printing an invented name.
### ✅ Built-in 108 is `deploy_squadron_ex` — `deploy_squadron` plus a `1 << n` selector
1146 sites in 22 stages, the second-largest unnamed built-in. Its method
(`sub_822646B8`, vtable slot 300) and built-in 2's (`sub_822642E0`, slot 12) are
190 and 199 instructions and **differ in one block**. Diffed instruction by
instruction, 108 adds:
```
lwz r11, 16(r29) ; the blob's slot-16 int
cmpwi cr6, r11, 0
blt cr6, … ; n < 0 -> default
cmpwi cr6, r11, 31
bgt cr6, … ; n > 31 -> default
li r25, 1
slw r21, r25, r11 ; r21 = 1 << n <- a 32-bit selector
b …
li r25, 1
mr r21, r25 ; default: 1
```
Everywhere built-in 2 passes its `r21`, 108 passes `r20` and reserves `r21` for
the mask — so the bit is an **extra argument to the same call**, not a
replacement. And both post the identical command word **`AB0100BA`, opcode 256**.
#### ✅ The operand is always a valid bit index
Over all 1146 sites the slot-16 value is in **[0, 31] — 1146 / 1146, none
outside**, so the out-of-range default never fires in shipped content. Fifteen
distinct values, clustered at 16 (531×), 31 (165×), 20 (161×) and 2 (90×);
21 of the 22 stages use more than one.
**What the bit selects is not established.** There is a 32-bit space here —
built-in 92 reportedly allocates a *free* bit by OR-ing over live units, which
would make 108 the "place this squadron in a named slot" counterpart — but I have
not verified that, so the name says only what is proven: the same deploy as
built-in 2, with an extra selector.
### ✅ Built-in 12 is `activate_unit` — 1197 sites, all 28 stages
The highest-traffic unnamed built-in. `sub_822659F0`, read directly:

View File

@@ -101,7 +101,8 @@ BUILTIN = {
81: 'banner_objective_update', 82: 'banner_mission_failed',
135: 'banner_mission_restart',
93: 'clear_flag', 94: 'is_engaged', 95: 'unit_hp_pct', 100: 'reset_phase_threads',
102: 'prompt_yes_no', 109: 'set_unit_flags', 115: 'named_event',
102: 'prompt_yes_no', 108: 'deploy_squadron_ex',
109: 'set_unit_flags', 115: 'named_event',
120: 'wait_cmds_drained', 123: 'timer_resume', 124: 'timer_stop',
125: 'timer_reset', 126: 'timer_elapsed', 127: 'timer_set',
132: 'player_gauge0_test', 133: 'player_gauge1_test', 134: 'player_byte',