feat(phase-31): S78 #3 — 13 "game code" subsegs were PsyQ objects: wired LINKED (libgte 70/30, libgs 33/7, snd 62/11); main's game-code metric corrected to 91.8%

- exact tiles, 0 tokens: libgte23-26 (MSC01/02/05/09, SMP_00, FGO_01-06, PATCHGTE), libgte9 re-derived
  as SMP_05 NormalClip (SMP_06 NormalClipS = nested sub-pattern; psyq_integrate now drops nested
  placements), libgte27-30 (the libgs-gap MTX_05/07/11, REG03+REG11), libgs7 (2D_BG0+2D_BG1), snd10
  (VM_NO1), snd11 (VM_NOWON carved off sgap_8). LINKED 959->1040, REAL 912->886 (SDK inline-asm wrappers
  re-provenanced), VERBATIM 146->85, 13 TUs deleted; splat re-emits the stub records.
- main 143dbb89 WITH and WITHOUT the SDK objects. The no-SDK fallback had been red since S7x
  (CdReadyCallback called by its SDK name while the libcd stub carried func_800435B4) — curated
  CdReadyCallback = 0x800435B4, refs unified. R22 clean fleet 213/213; tools-health OK.
- METRIC CORRECTION (R35): progress.py's "MAIN game-code weighted" sig never excluded the LINKED
  objects (its comment said it did) — ~31k linked-SDK ins sat in the denominator as unmatched game
  code. Exclusion now derived LIVE from the Makefile stub lists + yaml ranges: 91.8% (44,562/48,537),
  not 59.8%; the 3,975-ins remainder equals the open-stub sum exactly.
- VM_F.o probed SPLITTABLE at .bss 0x50c (SYS.o's class -> task #4). cookbook §488; worklist S78 #3;
  decision-log + accelerators; SETUP rows.
This commit is contained in:
Drew T
2026-09-04 16:26:12 -06:00
parent b212f40f19
commit a85733a487
44 changed files with 402 additions and 4151 deletions
+6 -5
View File
@@ -585,14 +585,15 @@ LIBC2_ELF := .run/obj40/libc2
LIBC2_OBJDIR := build/psyq/libc2
LIBC2_SYMS := build/psyq/libc2_externals.ld
# libgte (Phase 8): GTE math, 53 objects in 22 blocks across the 800b region (subseg lines generated by
# libgte (Phase 8): GTE math, 53 objects in 22 blocks across the 800b region; S78 +4 blocks (libgte23..26: the
# MSC/SMP_00/FGO/PATCHGTE objects the §485 psyq_identify fix located in the former 800b* 'game code' gaps) + libgte9 re-derived as SMP_05 (subseg lines generated by
# tools/gen_lib_subsegs.py). The integrate window 0x4787C..0x51804 restricts placement to 800b so it
# sees 22 blocks (excludes the 5 deferred libgs-gap objects MTX_05/07/11/REG03/REG11; gsgap1/2/4/5 stay
# stubs). Clean (no scattered .bss). stub list = libgte1..libgte22.
LIBGTE_ELF := .run/obj40/libgte
LIBGTE_OBJDIR := build/psyq/libgte
LIBGTE_SYMS := build/psyq/libgte_externals.ld
LIBGTE_STUBS := libgte1,libgte2,libgte3,libgte4,libgte5,libgte6,libgte7,libgte8,libgte9,libgte10,libgte11,libgte12,libgte13,libgte14,libgte15,libgte16,libgte17,libgte18,libgte19,libgte20,libgte21,libgte22
LIBGTE_STUBS := libgte1,libgte2,libgte3,libgte4,libgte5,libgte6,libgte7,libgte8,libgte9,libgte10,libgte11,libgte12,libgte13,libgte14,libgte15,libgte16,libgte17,libgte18,libgte19,libgte20,libgte21,libgte22,libgte23,libgte24,libgte25,libgte26,libgte27,libgte28,libgte29,libgte30
# Combined libspu+libsnd sound region (Phase 8): the two SDK sound libs interleave in 0x3A444..0x4239C
# so they link as one 60-object region (snd1..snd9). Curated dir .run/obj40/snd_used built by
@@ -600,7 +601,7 @@ LIBGTE_STUBS := libgte1,libgte2,libgte3,libgte4,libgte5,libgte6,libgte7,libgte8
SND_ELF := .run/obj40/snd_used
SND_OBJDIR := build/psyq/snd
SND_SYMS := build/psyq/snd_externals.ld
SND_STUBS := snd1,snd2,snd3,snd4,snd5,snd6,snd7,snd8,snd9
SND_STUBS := snd1,snd2,snd3,snd4,snd5,snd6,snd7,snd8,snd9,snd10,snd11
# Combined libapi+libcard 800c2 region (Phase 8): 22 objects in 4 blocks (apicard1..4). Curated dir
# .run/obj40/apicard_used (tools/make_apicard_used.py). Window 0x61F38..0x62888. (libapi's ~22 objects
@@ -838,7 +839,7 @@ ifeq ($(BINARY),main)
echo " (no $(LIBCD_ELF) — libcd region stays asm stubs; run tools/psyq_build_libs.sh LIBCD)"
fi
if [ -d "$(LIBGS_ELF)" ]; then
$(PYTHON) tools/psyq_integrate.py --vram-base $(main_VRAM_BASE) --exe $(main_EXE) --symbols $(main_SYMBOLS) --yaml $(main_SPLAT_YAML) $(LIBGS_ELF) $(LD_SCRIPT) $(LIBGS_OBJDIR) $(LIBGS_SYMS) libgs1,libgs2,libgs3,libgs4,libgs5,libgs6 0x80051804 0x80057928
$(PYTHON) tools/psyq_integrate.py --vram-base $(main_VRAM_BASE) --exe $(main_EXE) --symbols $(main_SYMBOLS) --yaml $(main_SPLAT_YAML) $(LIBGS_ELF) $(LD_SCRIPT) $(LIBGS_OBJDIR) $(LIBGS_SYMS) libgs1,libgs2,libgs3,libgs4,libgs5,libgs6,libgs7 0x8005080C 0x80057928
else
echo " (no $(LIBGS_ELF) — libgs region stays asm stubs; run tools/make_libgs.sh)"
fi
@@ -863,7 +864,7 @@ ifeq ($(BINARY),main)
echo " (no $(LIBC2_ELF) — libc2 region stays asm stubs; run tools/psyq_build_libs.sh LIBC2)"
fi
if [ -d "$(LIBGTE_ELF)" ]; then
$(PYTHON) tools/psyq_integrate.py --vram-base $(main_VRAM_BASE) --exe $(main_EXE) --symbols $(main_SYMBOLS) --yaml $(main_SPLAT_YAML) $(LIBGTE_ELF) $(LD_SCRIPT) $(LIBGTE_OBJDIR) $(LIBGTE_SYMS) $(LIBGTE_STUBS) 0x8004787C 0x80051804
$(PYTHON) tools/psyq_integrate.py --vram-base $(main_VRAM_BASE) --exe $(main_EXE) --symbols $(main_SYMBOLS) --yaml $(main_SPLAT_YAML) $(LIBGTE_ELF) $(LD_SCRIPT) $(LIBGTE_OBJDIR) $(LIBGTE_SYMS) $(LIBGTE_STUBS) 0x8004787C 0x80053AF8
else
echo " (no $(LIBGTE_ELF) — libgte region stays asm stubs; run tools/psyq_build_libs.sh LIBGTE)"
fi
+13 -14
View File
@@ -109,9 +109,10 @@ segments:
- [0x2EB10, c, snd6] # snd block 6: 12 obj (MIDIREAD.o..VM_ALOC2.o) vram 0x8003E310-0x8003FA54
- [0x30254, c, sgap_6] # game code + excluded VM_F stub (vram 0x8003FA54-0x8003FE18)
- [0x30618, c, snd7] # snd block 7: 5 obj (S_SNV.o..VM_N2P.o) vram 0x8003FE18-0x800403A4
- [0x30BA4, c, sgap_7] # game code (vram 0x800403A4-0x80040868)
- [0x30BA4, c, snd10] # snd block 10 (S78): VM_NO1.o (305 ins, exact tile) vram 0x800403A4-0x80040868 — was 'sgap_7' game code (§485)
- [0x31068, c, snd8] # snd block 8: 1 obj (VM_NOWOF.o) vram 0x80040868-0x80040938
- [0x31138, c, sgap_8] # game code (vram 0x80040938-0x800414E4)
- [0x31138, c, snd11] # snd block 11 (S78): VM_NOWON.o (300 ins, exact tile) vram 0x80040938-0x80040DE8 — carved off the old sgap_8
- [0x315E8, c, sgap_8] # game code (vram 0x80040DE8-0x800414E4)
- [0x31CE4, c, snd9] # snd block 9: 11 obj (VM_VSU.o..VS_VTC.o) vram 0x800414E4-0x8004239C
# PsyQ libetc region (Phase 8): 5 objects (VSYNC/INTR/INTR_VB/INTR_DMA/VMODE) form ONE
# contiguous block at the tail of the old 800 subseg, ending exactly at libcd1 (0x80043088).
@@ -135,44 +136,42 @@ segments:
# (section-size-correct boundaries). integrate window 0x4787C..0x51804. The 5 libgs-gap libgte
# objects (MTX_05/07/11/REG03/REG11) are DEFERRED — gsgap1/2/4/5 stay stubs (see worklist).
- [0x3807C, c, libgte1] # libgte block 1: 5 obj (GEO_00.o..MSC00.o) vram 0x8004787C-0x80047D3C
- [0x3853C, c, 800b] # game code (vram 0x80047D3C-0x8004818C)
- [0x3853C, c, libgte23] # libgte block 23 (S78): MSC01/MSC02/MSC05/MSC09 (276 ins, exact tile) vram 0x80047D3C-0x8004818C — was '800b' game code
- [0x3898C, c, libgte2] # libgte block 2: 2 obj (MTX_000.o..MTX_001.o) vram 0x8004818C-0x8004838C
- [0x38B8C, c, libgte3] # libgte block 3: 5 obj (MTX_003.o..MTX_009.o) vram 0x8004838C-0x8004880C
- [0x3900C, c, libgte4] # libgte block 4: 3 obj (MTX_00B.o..MTX_01.o) vram 0x8004880C-0x80048CAC
- [0x394AC, c, libgte5] # libgte block 5: 5 obj (MTX_02.o..MTX_08.o) vram 0x80048CAC-0x8004914C
- [0x3994C, c, libgte6] # libgte block 6: 7 obj (MTX_09.o..REG12.o) vram 0x8004914C-0x8004923C
- [0x39A3C, c, libgte7] # libgte block 7: 1 obj (REG13.o) vram 0x8004923C-0x8004924C
- [0x39A4C, c, 800b_2] # game code (vram 0x8004924C-0x8004945C)
- [0x39A4C, c, libgte24] # libgte block 24 (S78): SMP_00.o (132 ins, exact tile) vram 0x8004924C-0x8004945C — was '800b_2'
- [0x39C5C, c, libgte8] # libgte block 8: 3 obj (SMP_01.o..SMP_03.o) vram 0x8004945C-0x800495EC
- [0x39DEC, c, 800b_3] # game code (vram 0x800495EC-0x80049600)
- [0x39E00, c, libgte9] # libgte block 9: 1 obj (SMP_06.o) vram 0x80049600-0x80049610
- [0x39E10, c, 800b_4] # game code (vram 0x80049610-0x8004961C)
- [0x39DEC, c, libgte9] # libgte block 9 (S78 re-derived): SMP_05.o NormalClip (12 ins, byte-identical over the whole span; SMP_06 NormalClipS is its nested sub-pattern) vram 0x800495EC-0x8004961C — absorbs the old 800b_3 / 800b_4 'game code' and the 3-nop pad
- [0x39E1C, c, libgte10] # libgte block 10: 1 obj (CMB_00.o) vram 0x8004961C-0x8004969C
- [0x39E9C, c, libgte11] # libgte block 11: 2 obj (CMB_05.o..FGO_00.o) vram 0x8004969C-0x8004978C
- [0x39F8C, c, 800b_5] # game code (vram 0x8004978C-0x8004A41C)
- [0x39F8C, c, libgte25] # libgte block 25 (S78): FGO_01..FGO_06 (804 ins, exact tile) vram 0x8004978C-0x8004A41C — was '800b_5'
- [0x3AC1C, c, libgte12] # libgte block 12: 2 obj (PRS_F3.o..PRS_F4.o) vram 0x8004A41C-0x8004AE3C
- [0x3B63C, c, libgte13] # libgte block 13: 3 obj (PRS_G3.o..PRS_FT3.o) vram 0x8004AE3C-0x8004BE8C
- [0x3C68C, c, libgte14] # libgte block 14: 2 obj (PRS_FT4.o..PRS_GT3.o) vram 0x8004BE8C-0x8004C98C
- [0x3D18C, c, libgte15] # libgte block 15: 1 obj (PRS_GT4.o) vram 0x8004C98C-0x8004CFEC
- [0x3D7EC, c, libgte16] # libgte block 16: 1 obj (RATAN.o) vram 0x8004CFEC-0x8004D16C
- [0x3D96C, c, 800b_6] # game code (vram 0x8004D16C-0x8004D20C)
- [0x3D96C, c, libgte26] # libgte block 26 (S78): PATCHGTE.o (40 ins, exact tile) vram 0x8004D16C-0x8004D20C — was '800b_6'
- [0x3DA0C, c, libgte17] # libgte block 17: 1 obj (TRR.o) vram 0x8004D20C-0x8004D6BC
- [0x3DEBC, c, libgte18] # libgte block 18: 2 obj (F3.o..F4.o) vram 0x8004D6BC-0x8004E19C
- [0x3E99C, c, libgte19] # libgte block 19: 1 obj (G3.o) vram 0x8004E19C-0x8004E74C
- [0x3EF4C, c, libgte20] # libgte block 20: 1 obj (G4.o) vram 0x8004E74C-0x8004EE0C
- [0x3F60C, c, libgte21] # libgte block 21: 2 obj (FT3.o..FT4.o) vram 0x8004EE0C-0x8004FA5C
- [0x4025C, c, libgte22] # libgte block 22: 2 obj (GT3.o..GT4.o) vram 0x8004FA5C-0x8005080C
- [0x4100C, c, 800b_7] # game code (vram 0x8005080C-0x80051804)
- [0x4100C, c, libgs7] # libgs block 7 (S78): 2D_BG0.o + 2D_BG1.o (1022 ins, exact tile) -> src/libgs7.c (vram 0x8005080C-0x80051804) — was '800b_7' game code (§485)
- [0x42004, c, libgs1] # libgs block 1: 2D_COM0 -> src/libgs1.c (vram 0x80051804-0x80051D78, 1 obj)
- [0x42578, c, gsgap1] # gap 80 B (non-libgs stub) -> src/gsgap1.c (vram 0x80051D78-0x80051DC8)
- [0x42578, c, libgte27] # libgte block 27 (S78): MTX_05.o (20 ins, exact tile) vram 0x80051D78-0x80051DC8 — was gsgap1
- [0x425C8, c, libgs2] # libgs block 2: 2D_LIN0/COM1/SP0 -> src/libgs2.c (vram 0x80051DC8-0x80052430, 3 objs)
- [0x42C30, c, gsgap2] # gap 48 B (non-libgs stub) -> src/gsgap2.c (vram 0x80052430-0x80052460)
- [0x42C30, c, libgte28] # libgte block 28 (S78): MTX_07.o (12 ins, exact tile) vram 0x80052430-0x80052460 — was gsgap2
- [0x42C60, c, libgs3] # libgs block 3: 2D_SP1 -> src/libgs3.c (vram 0x80052460-0x800525DC, 1 obj)
- [0x42DDC, c, gsgap3] # gap 1536 B: GS_001 excluded -> src/gsgap3.c (vram 0x800525DC-0x80052BDC)
- [0x433DC, c, libgs4] # libgs block 4: GS_002/003/MATRIX/103/104/105/106/107 -> src/libgs4.c (vram 0x80052BDC-0x800538BC, 8 objs)
- [0x440BC, c, gsgap4] # gap 48 B (non-libgs stub) -> src/gsgap4.c (vram 0x800538BC-0x800538EC)
- [0x440BC, c, libgte29] # libgte block 29 (S78): MTX_11.o (12 ins, exact tile) vram 0x800538BC-0x800538EC — was gsgap4
- [0x440EC, c, libgs5] # libgs block 5: GS_108/109 -> src/libgs5.c (vram 0x800538EC-0x800539C8, 2 objs)
- [0x441C8, c, gsgap5] # gap 304 B (non-libgs stub) -> src/gsgap5.c (vram 0x800539C8-0x80053AF8)
- [0x441C8, c, libgte30] # libgte block 30 (S78): REG03.o + REG11.o (76 ins, exact tile) vram 0x800539C8-0x80053AF8 — was gsgap5
- [0x442F8, c, libgs6] # libgs block 6 (16 objs) -> src/libgs6.c (vram 0x80053AF8-0x80057928)
- [0x48128, c, 800b2] # -O2 game code (post-libgs, pre-libgpu) -> src/800b2.c (vram 0x80057928-0x80058890)
# PsyQ libgpu (Phase 8): EXT/PRIM linked; SYS.o EXCLUDED — scattered-.bss commons (cookbook §9.1,
+2 -1
View File
@@ -6,7 +6,7 @@
// - `D_800629D4` added: a data label in the text->data boundary region that the boot code
// references but splat did not auto-label (keeps the all-asm link resolving; no bytes change).
// Durable text record of manual RE work (the .rep is gitignored).
// count=1081
// count=1082
lzss_ringBuffer = 0x1F800000; // data
start = 0x80010000; // func
@@ -245,6 +245,7 @@ CdComstr = 0x800434F4; // func
SYS_OBJ_110 = 0x80043520; // func
CdIntstr = 0x80043528; // func
SYS_OBJ_144 = 0x80043554; // func
CdReadyCallback = 0x800435B4; // func PsyQ libcd global (S78 - the no-SDK fallback needs the stub to carry the name the game C calls)
SYS_OBJ_538 = 0x80043948; // func
BIOS_OBJ_64 = 0x80043C00; // func
BIOS_OBJ_26C = 0x80043E08; // func
+1
View File
@@ -732,6 +732,7 @@ Every script under `tools/` (plus the two report make-targets), grouped by purpo
| | `tools/psyq_link.py` | Link identified PsyQ objects into the build. |
| | `tools/psyq_link_lib.py` | Per-library link driver. |
| | `tools/psyq_link_region.py` | Link a specific address region from PsyQ libs. |
| | `tools/progress.py` (weighted main) | **(P31 S78)** `MAIN game-code weighted` now excludes LINKED subsegs LIVE (`_main_linked_ranges`: Makefile `psyq_integrate` stub lists → yaml ranges, R33); the 2026-08-05 sig had carried all linked-SDK instructions, under-reporting main by ~32 points (59.8% → 91.8%). |
| | `tools/psyq_integrate.py` | Integrate linked PsyQ results back into the source tree. **P31 S78:** `--yaml <splat yaml>` (every main call passes `$(main_SPLAT_YAML)`) maps stub↔objects by SUBSEG RANGE with an exact-tiling check and PRINTS the located-but-unwired objects (`~~ N located object(s) / M ins OUTSIDE the stub subsegs`) — the completion contract's SDK-residue line; and a library object's DEFINED symbol whose recovered address the curated symbol file names differently is `--redefine-sym`'d to the curated name (R15; e.g. libapi 4.0 `A66.o` `firstfile`→`firstfile2`). Without `--yaml` the old contiguity mapping runs (overlay-free libraries only). |
| | `tools/make_libgs.sh` | Build/link the `libgs` block (cookbook §9). |
| | `tools/gen_lib_subsegs.py` | **(Phase 8)** Generate splat subseg lines + integrate stub list for a multi-block library (section-size-correct boundaries; cookbook §9.6). |
+8
View File
@@ -655,3 +655,11 @@ the version that places the most objects byte-exact is the linked one.** Second,
gates only ever built main WITHOUT the SDK objects (worktrees carry no `.run/obj40`), so the LINKED
path was never gated — `make build BINARY=main` in the real tree is the only check of it; run it
after any change to `psyq_identify`/`psyq_integrate`.
## S78 (2) — check a percentage against a case you already know the answer to
`MAIN game-code weighted 59.8%` stood for six weeks. Its remainder (~32,000 ins) never matched the
frontier's own stub sum (~4,000 ins), and nobody subtracted the two. One subtraction would have shown
the denominator was carrying the 31,000 linked-SDK instructions. Accelerator: **every headline % ships
with its remainder, and the remainder is reconciled against an independently-derived list of what is
actually open.**
+5 -2
View File
@@ -2,7 +2,7 @@
> **Generated by `tools/cookbook_index.py` — do not hand-edit** (R33). Regenerate after adding a cookbook section.
>
> `docs/matching-cookbook.md` is ~716 KB / 1155 sections. Grepping it blind is how three P30 wave-1 agents each "discovered" an idiom that was already written down. **Start here, then read the section.** A section appears under every symptom it addresses.
> `docs/matching-cookbook.md` is ~716 KB / 1156 sections. Grepping it blind is how three P30 wave-1 agents each "discovered" an idiom that was already written down. **Start here, then read the section.** A section appears under every symptom it addresses.
**How to use:** name what you SEE in the diff (a stolen delay slot, an extra `la`, a swapped register pair, a `conflicting types` error), find that symptom below, read those sections first. If nothing fits, THEN grind — and add a section when you win.
@@ -1080,7 +1080,7 @@
- **§442** — ★★★ — A RECOVERY RUNG THAT REWRITES A LEGAL CONSTRUCT INTO AN ILLEGAL ONE READS EXACTLY LIKE A CODEGEN WALL (P31 S75; `reconcile_tu`, 344 ins unblocked) <sub>L34647</sub>
- **§477** — ★★★ — THE `self_decl_tu` CLASS IS A SOLVED, MECHANICAL LANE: 16 DRAFTS, 16 BANKS (P31 S77) <sub>L35713</sub>
### build graph, splat & the harness (207)
### build graph, splat & the harness (208)
- **§4** — Flag/toolchain gotchas <sub>L190</sub>
- **Build** — mechanism — per-file opt override (splat resegmentation) <sub>L307</sub>
@@ -1289,6 +1289,7 @@
- **§484** — ★★★ — "NO SINGLE NOLOAD BASE" IS NOT "UNLINKABLE": ASK WHETHER THE `.bss` OFFSETS ARE DISJOINT (P31 S77) <sub>L36023</sub>
- **§485** — ★★★ — THE PLACEMENT MAP WAS PARSING A PRETTY-PRINTER: 25 PsyQ OBJECTS WERE INVISIBLE, NOT ABSENT (P31 S77) <sub>L36069</sub>
- **§487** — ★★★ — THE PSX LOADER'S PER-VERSION SIGNATURE SETS ARE A FREE PROVENANCE ORACLE: main's "WALL" BAND IS LIBPAD 4.2.1 (P31 S78) <sub>L36150</sub>
- **§488** — ★★ — THE "GAME CODE" GAPS BETWEEN LIBRARY BLOCKS WERE LIBRARY OBJECTS: 13 SUBSEGS → LINKED, EXACT-TILED, ZERO TOKENS (P31 S78) <sub>L36202</sub>
### process, measurement & doctrine (141)
@@ -2932,6 +2933,7 @@
- **§485** — ★★★ — THE PLACEMENT MAP WAS PARSING A PRETTY-PRINTER: 25 PsyQ OBJECTS WERE INVISIBLE, NOT ABSENT (P31 S77) <sub>L36069</sub>
- **§486** — ★★★ — CARVING AN `-O0` ISLAND IN **main**: FIVE COUPLED PIECES, AND THE TWO THAT ANNOUNCE THEMSELVES (P31 S77) <sub>L36105</sub>
- **§487** — ★★★ — THE PSX LOADER'S PER-VERSION SIGNATURE SETS ARE A FREE PROVENANCE ORACLE: main's "WALL" BAND IS LIBPAD 4.2.1 (P31 S78) <sub>L36150</sub>
- **§488** — ★★ — THE "GAME CODE" GAPS BETWEEN LIBRARY BLOCKS WERE LIBRARY OBJECTS: 13 SUBSEGS → LINKED, EXACT-TILED, ZERO TOKENS (P31 S78) <sub>L36202</sub>
---
@@ -4099,3 +4101,4 @@ Notes routinely quote that as a section id. This table resolves it. Grep bait: `
| L36069 | §485 | ★★★ — THE PLACEMENT MAP WAS PARSING A PRETTY-PRINTER: 25 PsyQ OBJECTS WERE INVISIBLE, NOT |
| L36105 | §486 | ★★★ — CARVING AN `-O0` ISLAND IN **main**: FIVE COUPLED PIECES, AND THE TWO THAT ANNOUNCE |
| L36150 | §487 | ★★★ — THE PSX LOADER'S PER-VERSION SIGNATURE SETS ARE A FREE PROVENANCE ORACLE: main's "WA |
| L36202 | §488 | ★★ — THE "GAME CODE" GAPS BETWEEN LIBRARY BLOCKS WERE LIBRARY OBJECTS: 13 SUBSEGS → LINKED |
+11
View File
@@ -3100,3 +3100,14 @@ regex and to the string-masking linter — the linter now scans asm bodies (nega
would have named the band, explained the 4.2 stamps, and kept the §332 wall verdicts from ever being
written. General form (now cookbook §487): a wall inside bytes no archive you hold can place is a
provenance question before it is a compiler question.
### S78 addendum — main was 91.8% game-code all along; the instrument said 59.8%
Wiring thirteen "game code" subsegs as LINKED (task #3) moved `MAIN game-code weighted` from 59.8%
to **56.1%** with no game-code change — the tell of a broken denominator (R35). `progress.py`'s
comment asserted the Ghidra sig excluded LINKED objects; measured, it carried every one of them
(~31,000 ins), and their `INCLUDE_ASM` stub records counted as unmatched game code. With the
exclusion derived live (Makefile stub lists → yaml ranges), main reads **91.8% (44,562 / 48,537)** and
the remainder equals the open-stub instruction sum to the instruction. Hindsight: a metric whose
denominator is a snapshot will drift the first time the thing it snapshots changes; derive it (R33),
and check it against a case whose answer you already know (the 28 stubs' size).
+10 -10
View File
@@ -1,8 +1,8 @@
# Unmatched difficulty inventory (generated by tools/difficulty.py — harvest queue)
unmatched functions : 988
trivial (<=5 ins) : 215
non-jtbl leaves : 661 (best harvest targets)
unmatched functions : 1069
trivial (<=5 ins) : 228
non-jtbl leaves : 734 (best harvest targets)
jump-table funcs : 36 (deferred — need the rodata-island workflow, Task 2')
## Easiest 120 unmatched (score asc) — the work queue
@@ -49,6 +49,10 @@ jump-table funcs : 36 (deferred — need the rodata-island workflow, Task
| 3 | MIDIREAD_OBJ_6C0 | 3 | 0 | 0 | - | Y |
| 3 | PRESET2_OBJ_A88 | 3 | 0 | 0 | - | Y |
| 3 | PRNT_OBJ_380 | 3 | 0 | 0 | - | Y |
| 3 | SetDQA | 3 | 0 | 0 | - | Y |
| 3 | SetDQB | 3 | 0 | 0 | - | Y |
| 3 | SetData32 | 3 | 0 | 0 | - | Y |
| 3 | SetIR0 | 3 | 0 | 0 | - | Y |
| 3 | UT_KEYV_OBJ_174 | 3 | 0 | 0 | - | Y |
| 4 | CD_set_test_parmnum | 4 | 0 | 0 | - | Y |
| 4 | C_011_OBJ_960 | 4 | 0 | 0 | - | Y |
@@ -73,6 +77,9 @@ jump-table funcs : 36 (deferred — need the rodata-island workflow, Task
| 4 | S_SCA_OBJ_384 | 4 | 0 | 0 | - | Y |
| 4 | S_SRMP_OBJ_170 | 4 | 0 | 0 | - | Y |
| 4 | S_STSA_OBJ_48 | 4 | 0 | 0 | - | Y |
| 4 | SetVertex0 | 4 | 0 | 0 | - | Y |
| 4 | SetVertex1 | 4 | 0 | 0 | - | Y |
| 4 | SetVertex2 | 4 | 0 | 0 | - | Y |
| 4 | USERFUNC_OBJ_84 | 4 | 0 | 0 | - | Y |
| 4 | UT_KEYV_OBJ_350 | 4 | 0 | 0 | - | Y |
| 4 | UT_KEYV_OBJ_3FC | 4 | 0 | 0 | - | Y |
@@ -85,7 +92,6 @@ jump-table funcs : 36 (deferred — need the rodata-island workflow, Task
| 4 | func_80043440 | 4 | 0 | 0 | - | Y |
| 4 | func_800491EC | 4 | 0 | 0 | - | Y |
| 4 | func_8004923C | 4 | 0 | 0 | - | Y |
| 4 | func_80049600 | 4 | 0 | 0 | - | Y |
| 4 | func_8005C4CC | 4 | 0 | 0 | - | Y |
| 4 | func_80062988 | 4 | 0 | 0 | - | Y |
| 4 | gfx2D_COM0_OBJ_30 | 4 | 0 | 0 | - | Y |
@@ -122,9 +128,3 @@ jump-table funcs : 36 (deferred — need the rodata-island workflow, Task
| 5 | SR_SV_OBJ_20C | 2 | 1 | 0 | - | Y |
| 5 | SR_SV_OBJ_214 | 2 | 1 | 0 | - | Y |
| 5 | SR_SV_OBJ_21C | 2 | 1 | 0 | - | Y |
| 5 | SR_SV_OBJ_2BC | 2 | 1 | 0 | - | Y |
| 5 | SR_SV_OBJ_2C4 | 2 | 1 | 0 | - | Y |
| 5 | SR_SV_OBJ_2CC | 2 | 1 | 0 | - | Y |
| 5 | SR_SV_OBJ_2D4 | 2 | 1 | 0 | - | Y |
| 5 | SR_SV_OBJ_2DC | 2 | 1 | 0 | - | Y |
| 5 | SR_SV_OBJ_2E4 | 2 | 1 | 0 | - | Y |
+40
View File
@@ -36198,3 +36198,43 @@ name inside `__asm__("… .ent\tfunc_X …")`. The C-side rename regex with `\b`
to a constant`, and the string-masking linter was blind to it by construction. The linter now scans
asm string bodies too; negative control: red on the pre-fix TUs (4 hits), green on the fixed tree
and on every previously-passing TU (the `func_8005C324`→`memcpy` `__asm__`-label binding exempted).
#### §488 ★★ — THE "GAME CODE" GAPS BETWEEN LIBRARY BLOCKS WERE LIBRARY OBJECTS: 13 SUBSEGS → LINKED, EXACT-TILED, ZERO TOKENS (P31 S78)
**What the residue printer said, and what it meant.** After §487's `--yaml` change, `make build` listed
libgte's located-but-unwired objects: `MSC01/02/05/09` fill `800b` (276 ins) to the byte, `SMP_00`
fills `800b_2`, `FGO_01–06` fill `800b_5` (804 ins), `PATCHGTE` fills `800b_6`, `MTX_05/07/11` and
`REG03+REG11` fill the four `gsgap` stubs inside libgs, `2D_BG0+2D_BG1` fill `800b_7` (1,022), and
`VM_NO1` / `VM_NOWON` fill `sgap_7` and the head of `sgap_8`. Every one an **exact tile** — the subseg
IS the object. Those subsegs had carried 106 verbatim `__asm__` bodies (SDK-ASM "permanent" GTE
macros, libsnd voice code) and four inline-asm wrappers counted as REAL for twenty phases.
**The conversion is mechanical.** Per subseg: rename the yaml row to the next `<lib>N` block name
(comment: objects, ins, "exact tile"), append the name to that library's stub list in the Makefile
(and widen its scan window if the block sits outside it), add any newly-placed objects to the curated
dir (`make_libgs.sh` OBJS, `make_snd_used.py` re-run), `git rm` the verbatim-only TU, and
`make extract` — splat re-emits `src/<lib>N.c` as an `INCLUDE_ASM` stub record for the fallback. A
subseg that is only PARTLY an object is split at the object's end (`sgap_8` → `snd11` + a shorter
`sgap_8` keeping its game C). Gate: `make build BINARY=main` byte-identical WITH the SDK objects, then
the fresh-clone fallback: move `.run/obj40` aside, **re-extract**, build, restore.
**Three things the bytes settled on the way.**
1. **A placement nested inside another placement is a sub-pattern, not a second object.** `SMP_06.o`
(`NormalClipS`, 4 ins) matches inside `SMP_05.o` (`NormalClip`, 12 ins), which tiles the whole
`800b_3`+`libgte9`+`800b_4` span byte-identically — including the "3-nop NOTCODE-PAD function"
that was the object's alignment padding. `psyq_integrate` now drops nested placements and says so.
2. **The fallback build is a separate invariant and had been red.** With `.run/obj40` absent, the
libcd stub defined `func_800435B4` while `src/800.c`/`800_c.c` had called `CdReadyCallback` by
its SDK name since S7x — undefined at link. The SDK build hid it (the linked object defines the
name) and the worktree gates never build main. Curating `CdReadyCallback = 0x800435B4` fixes it;
**`lint_symbol_refs` reports the stale `INCLUDE_ASM` line — read its whole output, not the last
line.** Verify the fallback from a FRESH extract: a stale `.s` under `asm/nonmatchings/` still
defines the old name and masks the miss (the §486 signature again).
3. **VM_F.o is SYS.o's class, not GS_001's:** `psyq_bss_probe` — two `.bss` bases, disjoint offset
ranges, split at `0x50c` → the `.bss`-split lever (task #4) covers both.
**Yield:** libgte 53→70 objects / 22→30 blocks, libgs 31→33 / 7 blocks, sound 60→62 / 11 blocks;
≈3,000 instructions of "game code" re-provenanced as LINKED, 106 verbatim bodies retired, 13 TUs
deleted, REAL −4 (inline-asm wrappers), 0 agent tokens. Remaining LINKED residue: `SYS.o` (3,109),
`VM_F` (237), the libpad/libapi band pieces (task #5), `SSGM.o` (8 ins amid matched C), and the
GS_001 / S_R / S_GRMDT scattered-`.bss` genuine walls.
+8 -8
View File
@@ -4,21 +4,21 @@
# cross-binary collapsible-byte leverage: docs/duplicates.cross.md.
# THREE progress metrics (all matter — see the labels):
FLEET fn-count byte-ident: 363100 / 363151 = 99.99% (REAL+LINKED+empties; FUNCTION-count, ×134-inflated — one crack counts per overlay)
FLEET instr-weighted : 13488257 / 13523865 = 99.7% (shipped .text across main + resident + 211 overlays; the decomp.dev-DISPLAY number)
FLEET distinct-code(uniq): 5816503 / 5851972 = 99.4% (90909/90929 unique fns; the DISTINCT-RE number)
MAIN game-code weighted : 47521 / 79510 = 59.8% (INCLUDED in the fleet numbers above since 2026-07-22 — roadmap §1 metrics contract; LINKED-excluding Ghidra sig dated 2026-08-05; boundaries INDEPENDENTLY VERIFIED since P31 S77 — `make sig-main-oracle` + `make audit-corpus`: 0 phantom, 0 truncated, 1 explained pad-tail)
FLEET fn-count byte-ident: 363098 / 363149 = 99.99% (REAL+LINKED+empties; FUNCTION-count, ×134-inflated — one crack counts per overlay)
FLEET instr-weighted : 13485298 / 13492892 = 99.9% (shipped .text across main + resident + 211 overlays; the decomp.dev-DISPLAY number)
FLEET distinct-code(uniq): 5813544 / 5820999 = 99.9% (90909/90929 unique fns; the DISTINCT-RE number)
MAIN game-code weighted : 44562 / 48537 = 91.8% (INCLUDED in the fleet numbers above since 2026-07-22 — roadmap §1 metrics contract; LINKED-excluding Ghidra sig dated 2026-08-05; boundaries INDEPENDENTLY VERIFIED since P31 S77 — `make sig-main-oracle` + `make audit-corpus`: 0 phantom, 0 truncated, 1 explained pad-tail)
(fleet EXCLUDING main, for continuity with pre-2026-07-22 readings: 13440736 / 13444355 = 100.0%)
FLEET REAL substantive : 360781 (of which dedup-shared 255632 via 2220 groups / 255708 instances)
FLEET LINKED PsyQ objs : 959
FLEET REAL substantive : 360755 (of which dedup-shared 255632 via 2220 groups / 255708 instances)
FLEET LINKED PsyQ objs : 1040
FLEET NON_MATCHING : 0 (0 in any default build — G4)
FLEET INCLUDE_ASM stubs : 51
FLEET matchable : 363151
FLEET matchable : 363149
| binary | REAL | shared | LINKED | byte-ident | matchable | byte-ident % |
|---|---:|---:|---:|---:|---:|---:|
| main | 912 | 2 | 959 | 2056 | 2085 | 98.6% |
| main | 886 | 2 | 1040 | 2054 | 2083 | 98.6% |
| resident | 141 | 0 | 0 | 143 | 145 | 98.6% |
| md_MAIN_001 | 11 | 0 | 0 | 11 | 11 | 100.0% |
| md_MAIN_003 | 53 | 0 | 0 | 59 | 64 | 92.2% |
+10 -8
View File
File diff suppressed because one or more lines are too long
+29
View File
@@ -154,3 +154,32 @@ RANGE with an exact-tiling check, residue printed; (2) a library object's DEFINE
recovered address the curated file names differently is `--redefine-sym`'d to the curated name (R15)
— `A66.o` `firstfile`→`firstfile2`, and it also exposed `TOC.o` `CdGetToc`@0x800430B8 mis-curated as
`DecDCToutCallback` (an xdedup-vs-VS mislabel; libcd 4.0's linked object is the stronger oracle).
### S78 task #3 — thirteen "game code" subsegs were library objects: wired as LINKED (exact tiles, 0 tokens)
| new block | was | objects | ins | note |
|---|---|---|---|---|
| `libgte23` | 800b | MSC01, MSC02, MSC05, MSC09 | 276 | GTE macro wrappers (SetRGBfifo…) that had been hand-matched as REAL |
| `libgte24` | 800b_2 | SMP_00 | 132 | |
| `libgte9` (re-derived) | 800b_3 + libgte9 + 800b_4 | SMP_05 (`NormalClip`) | 12 | SMP_06 `NormalClipS` is its nested sub-pattern; the "3-nop NOTCODE-PAD" was the object's alignment |
| `libgte25` | 800b_5 | FGO_01…FGO_06 | 804 | |
| `libgte26` | 800b_6 | PATCHGTE | 40 | `.sbss` 0x10, single base |
| `libgte27/28/29` | gsgap1/2/4 | MTX_05 / MTX_07 / MTX_11 | 20/12/12 | the Phase-8 "deferred (T11)" libgs-gap objects |
| `libgte30` | gsgap5 | REG03 + REG11 | 76 | |
| `libgs7` | 800b_7 | 2D_BG0 + 2D_BG1 | 1022 | §485's headline find |
| `snd10` | sgap_7 | VM_NO1 | 305 | |
| `snd11` | sgap_8 (head) | VM_NOWON | 300 | sgap_8 now starts at 0x80040DE8 with its game C |
Result: libgte **70 objects / 30 blocks** (was 53/22), libgs **33 / 7**, sound **62 / 11**; LINKED fns
959 → **1,040**; REAL 912 → 886 (26 inline-asm SDK wrappers re-provenanced); VERBATIM 146 → **85**;
13 TUs deleted; main `143dbb89` byte-identical **with and without** the SDK objects (the fallback had
been red since S7x: `CdReadyCallback` was called by its SDK name but the libcd stub carried
`func_800435B4` — curated now). Remaining located-but-unwired: `SYS.o` 3,109 + `VM_F` 237 (both
`.bss`-splittable, task #4), the libpad/libapi band pieces (task #5), `SSGM.o` 8, and the genuine
scattered-`.bss` walls `GS_001` / `S_R` / `S_GRMDT`.
**The metric correction this exposed (R35).** `progress.py`'s "MAIN game-code weighted" line claimed
its sig excluded the LINKED objects; it never did — the 2026-08-05 Ghidra sig carried all ~31,000
linked-SDK instructions, whose stub records read as unmatched game code. Honest figure, LINKED now
excluded live from the Makefile stub lists + yaml ranges: **91.8% (44,562 / 48,537)**, not 59.8%; the
3,975-ins remainder equals the sum of main's open stubs in `frontier_classify` exactly.
+15
View File
@@ -54,6 +54,21 @@ Instead of roadmap-v2 P31's per-function grind, Phase 31 organizes the 12,059 re
byte-identical `143dbb89…` after the last src-only fix (the `DecDCToutCallback` caller) → 213/213.
`tools-health` OK. Ghidra DB deliberately NOT staged (the mirror is text-derived and re-applicable;
`db.*.gbf` churn stays restart-noise).
**#3 DONE (S78):** thirteen "game code" subsegs were library objects, exact tiles — wired as
LINKED for 0 tokens: `libgte23–26` (800b/800b_2/800b_5/800b_6: MSC01/02/05/09, SMP_00, FGO_01–06,
PATCHGTE), `libgte9` re-derived as SMP_05 `NormalClip` (800b_3+libgte9+800b_4; SMP_06 is its nested
sub-pattern — integrate now drops nested placements), `libgte27–30` (gsgap1/2/4/5: MTX_05/07/11,
REG03+REG11), `libgs7` (800b_7: 2D_BG0+2D_BG1), `snd10` (sgap_7: VM_NO1), `snd11` (VM_NOWON, carved
off sgap_8). libgte 53→70 objs/22→30 blocks · libgs 31→33/7 · snd 60→62/11 · LINKED 959→**1,040**
· REAL 912→886 (SDK inline-asm wrappers re-provenanced) · VERBATIM 146→**85** · 13 TUs deleted.
main `143dbb89` **with AND without** the SDK objects (the no-SDK fallback had been RED since
S7x — `CdReadyCallback` called by name, stub carried `func_800435B4`; curated + refs fixed).
**R22:** clean extract-all 212/212 + check-all **213/213**. `tools-health` OK.
**Instrument correction (R35):** `MAIN game-code weighted` fell 59.8%→56.1% on this change with no
game-code change → the 08-05 sig had carried ALL ~31k linked-SDK ins (its comment claimed otherwise);
exclusion now derived live → **91.8% (44,562 / 48,537)**; remainder 3,975 ins == the open-stub sum.
`VM_F.o` probed SPLITTABLE at 0x50c (same class as SYS.o → #4). cookbook §488; worklist/decision-log/
accelerators/SETUP updated.
- [ ] **Tclose — PhaseEnd** (gate 2). (Max)
## Standing verification (every task)
+5 -5
View File
@@ -6891,7 +6891,7 @@ setDefault:
extern s32 func_800435CC(s32 mode, void *buf, void *param); /* CdControl */
extern s32 func_8004355C(s32 mode, u8 *result); /* CdSync */
extern void *func_800435B4(void *func); /* CdReadyCallback */
extern void *CdReadyCallback(void *func); /* CdReadyCallback */
extern void func_800434BC(void); /* CdFlush */
extern void CdReadSectorReadyCB(u8); /* §376: def takes u8; only ever passed BY ADDRESS */
extern s32 func_8002FD14(s32, s32);
@@ -7056,7 +7056,7 @@ void CdReadStateMachine(s32 pauseAfterSeek) {
cdReq_sink = (s32)cdReq_dest;
}
p3 = (u8 *)&cdReq_savedReadyCB;
*(void **)p3 = func_800435B4(CdReadSectorReadyCB);
*(void **)p3 = CdReadyCallback(CdReadSectorReadyCB);
func_800435CC(6, 0, p3 + 4);
if ((p3[4] & 0x10) != 0) {
goto setStateNine;
@@ -7067,7 +7067,7 @@ void CdReadStateMachine(s32 pauseAfterSeek) {
case 6:
dp = &cdReq_drainPhase;
if (*dp == 1) {
func_800435B4(cdReq_savedReadyCB);
CdReadyCallback(cdReq_savedReadyCB);
func_800435CC(9, 0, (u8 *)dp - 0x14);
if ((*((u8 *)dp - 0x14) & 0x10) != 0) {
goto setStateNine;
@@ -7081,14 +7081,14 @@ void CdReadStateMachine(s32 pauseAfterSeek) {
break;
}
if (*dp == 2) {
func_800435B4(cdReq_savedReadyCB);
CdReadyCallback(cdReq_savedReadyCB);
goto resetState;
}
cdReq_retry++;
if (cdReq_retry < 0x12C) {
break;
}
func_800435B4(cdReq_savedReadyCB);
CdReadyCallback(cdReq_savedReadyCB);
cdReq_state = 0;
func_800434BC();
break;
+7 -7
View File
@@ -777,7 +777,7 @@ void func_8003621C(void) {
extern void func_80037334(void);
extern void func_800434BC(void);
extern void func_800435B4(void *);
extern void *CdReadyCallback(void *);
extern int func_800435CC(s32, void *, void *);
extern s32 func_8004355C(s32 mode, u8 *result); /* §376: adopt the TU's spelling verbatim */
extern void func_800415A8(s32);
@@ -825,7 +825,7 @@ int func_80036260(void) {
break;
case 12:
if (streamLoad_cbActive != 0) {
func_800435B4(streamLoad_savedReadyCB);
CdReadyCallback(streamLoad_savedReadyCB);
streamLoad_savedReadyCB = 0;
streamLoad_cbActive = 0;
}
@@ -1092,7 +1092,7 @@ int StreamLoadStateMachine(int param_1, void *param_2, int param_3) { /* param_
extern void func_80037334(void);
extern void func_800434BC(void);
extern void func_800435B4(void *); /* CdReadyCallback; §376: keep the TU's void spelling */
extern void *CdReadyCallback(void *); /* CdReadyCallback; §376: keep the TU's void spelling */
extern int func_800435CC(s32, void *, void *); /* CdControl */
extern s32 func_8004355C(s32 mode, u8 *result); /* CdSync */
@@ -1271,9 +1271,9 @@ int StreamLoadStateMachine(int arg0, void *loc, int n) {
return 2;
}
if (streamLoad_cbActive == 0) {
streamLoad_savedReadyCB = ((void *(*)(void *))func_800435B4)((void *)func_800377D8);
streamLoad_savedReadyCB = ((void *(*)(void *))CdReadyCallback)((void *)func_800377D8);
} else {
func_800435B4((void *)func_800377D8);
CdReadyCallback((void *)func_800377D8);
}
streamLoad_cbActive = 1;
streamLoad_state++;
@@ -1287,7 +1287,7 @@ int StreamLoadStateMachine(int arg0, void *loc, int n) {
}
if (D_800A4F28 < 0x12D) break;
if (streamLoad_cbActive != 0) {
func_800435B4(streamLoad_savedReadyCB);
CdReadyCallback(streamLoad_savedReadyCB);
streamLoad_savedReadyCB = 0;
streamLoad_cbActive = 0;
}
@@ -1295,7 +1295,7 @@ int StreamLoadStateMachine(int arg0, void *loc, int n) {
break;
}
if (streamLoad_cbActive != 0) {
func_800435B4(streamLoad_savedReadyCB);
CdReadyCallback(streamLoad_savedReadyCB);
streamLoad_savedReadyCB = 0;
streamLoad_cbActive = 0;
}
-456
View File
@@ -1,456 +0,0 @@
#include "common.h"
/*
* func_80047D3C == PsyQ SquareRoot0(long a): hand-written GTE-assisted integer
* square root (splat marks it "Handwritten function"). The argument goes
* straight into the GTE (mtc2 $a0,$30 = lzcs), the leading-zero count comes
* back (mfc2 $v0,$31 = lzcr), the mantissa is normalised, a table at
* D_8006D8EC is indexed and the half-word result shifted out. Un-compilable
* tells: direct cop2 transfers with hand-placed hazard nops, `sub`/`addi`
* where cc1 emits `subu`/`addiu`, a dead `andi $t0,$v0,1`, a branch target
* that doubles as the preceding `b`'s delay slot (0x80047D84), and a second
* exit whose return value sits in the final `jr`'s delay slot. No -O2 C can
* emit this, so per cookbook §265 the body is banked as a verbatim file-scope
* __asm__ transcription of the target .s, with the full form-1 directive
* scaffold (.ent/.frame/.end) used by the two gate-proven banked precedents.
*
* maspsx interaction: the leading ".set noreorder" is SPACE-formed so maspsx's
* is_reorder tracker stays True and IT fills every empty branch delay slot --
* so the nops after beq/bltz/b/jr are deliberately NOT written by hand. The
* two mtc2 hazard nops ARE hand-written (maspsx knows nothing about cop2
* latency), and so is the nop after `lh $t5,%lo(...)($t5)`: maspsx's
* load-delay pass does not fire on this lh/base-reuse shape (measured).
* Immediates are decimal (maspsx int()s them); %hi/%lo relocate correctly.
*
* Recovered C semantics:
* long SquareRoot0(long a) {
* gte_ldLZCS(a); u = gte_stLZCR();
* if (u == 0x20) return 0;
* e = u & ~1;
* sh = (0x1f - e) >> 1;
* m = (e - 0x18 < 0) ? (a >> (0x18 - e)) : (a << (e - 0x18));
* return ((int)*(short *)&D_8006D8EC[(m - 0x40)] << sh) >> 12;
* }
*/
__asm__(
".text\n"
".align 2\n"
".globl func_80047D3C\n"
".ent func_80047D3C\n"
"func_80047D3C:\n"
".frame $sp, 0, $31\n"
".set noreorder\n"
"mtc2 $4, $30\n"
"nop\n"
"nop\n"
"mfc2 $2, $31\n"
"addiu $1, $0, 32\n"
"beq $2, $1, 3f\n"
"andi $8, $2, 1\n"
"addiu $10, $0, -2\n"
"and $10, $2, $10\n"
"addiu $9, $0, 31\n"
"sub $9, $9, $10\n"
"sra $9, $9, 1\n"
"addi $11, $10, -24\n"
"bltz $11, 1f\n"
"sllv $12, $4, $11\n"
"b 2f\n"
"1:\n"
"addiu $11, $0, 24\n"
"sub $11, $11, $10\n"
"srav $12, $4, $11\n"
"2:\n"
"addi $12, $12, -64\n"
"sll $12, $12, 1\n"
"lui $13, %hi(D_8006D8EC)\n"
"addu $13, $13, $12\n"
"lh $13, %lo(D_8006D8EC)($13)\n"
"nop\n"
"sllv $13, $13, $9\n"
"srl $2, $13, 12\n"
"jr $31\n"
"nop\n"
"3:\n"
"jr $31\n"
"addiu $2, $0, 0\n"
".set reorder\n"
"nop\n"
"nop\n"
"nop\n"
".end func_80047D3C\n"
);
__asm__(
".text\n"
".align 2\n"
".globl InvSquareRoot\n"
".ent InvSquareRoot\n"
"InvSquareRoot:\n"
".frame $sp, 0, $31\n"
".set noreorder\n"
"mtc2 $4, $30\n"
"nop\n"
"nop\n"
"mfc2 $2, $31\n"
"addiu $1, $0, 32\n"
"beq $2, $1, 3f\n"
"beq $2, $0, 3f\n"
"andi $8, $2, 1\n"
"addiu $10, $0, -2\n"
"and $10, $2, $10\n"
"addiu $9, $0, 31\n"
"sub $9, $9, $10\n"
"sra $9, $9, 1\n"
"addi $11, $10, -24\n"
"bltz $11, 1f\n"
"sllv $12, $4, $11\n"
"b 2f\n"
"1:\n"
"addiu $11, $0, 24\n"
"sub $11, $11, $10\n"
"srav $12, $4, $11\n"
"2:\n"
"addi $12, $12, -64\n"
"sll $12, $12, 1\n"
"lui $13, %hi(D_8006DA80)\n"
"addu $13, $13, $12\n"
"lh $13, %lo(D_8006DA80)($13)\n"
"sw $9, 0($6)\n"
"sw $13, 0($5)\n"
"addiu $2, $0, 1\n"
"jr $31\n"
"nop\n"
"3:\n"
"jr $31\n"
"addiu $2, $0, -1\n"
".set reorder\n"
".end InvSquareRoot\n"
);
__asm__(".text\n.align 2\n.globl func_80047E58\n.ent\tfunc_80047E58\n"
"func_80047E58:\n.frame $sp,0,$31\n.mask 0x00000000,0\n.fmask 0x00000000,0\n"
".set\tnoreorder\n"
"lw $t0, 0($a0)\n"
"lw $t1, 4($a0)\n"
"lw $t2, 8($a0)\n"
"b .L80047EAC\n"
"addu $a3, $ra, $zero\n"
".set\treorder\n.end\tfunc_80047E58\n");
/* VectorNormal @ 0x80047E6C -- HANDWRITTEN PsyQ libgte-style wrapper (cookbook §179-B/§179-C,
* §265 form 1; byte-proven exemplars: func_80059234 in src/800c.c, func_800D0440 in
* src/md_MAIN_003/md_MAIN_003.c).
*
* Tell-tales that this is NOT compiler output:
* - $ra is stashed in $a3 across the call and restored after
* (addu $a3,$ra,$zero / addu $ra,$a3,$zero) -- a hand-written leaf-caller idiom
* gcc-2.7.2 never emits;
* - the FINAL store (sw $t2,8($a1)) sits IN the jr $ra delay slot -- unreachable from a
* C function body, whose epilogue (jr $ra; nop) cc1 appends unconditionally;
* - callee func_80047EC8 is itself splat-marked "Handwritten function" (raw GTE sqr/gpf body).
*
* Hence the whole function is FILE-SCOPE basic asm (no enclosing C function => no generated
* prologue/epilogue), transcribed 1:1 from asm/nonmatchings/800b/VectorNormal.s:
* - ".ent\t"/".end\t" with literal TABS: maspsx process_line special-cases ".ent\t" and
* emits a fresh ".set noreorder"; a plain ".set noreorder" line is swallowed as state only.
* - every displacement/immediate DECIMAL (maspsx int(operand) is base-10).
* - delay-slot contents (the jal's nop, the jr's sw) written by hand, matching the target,
* same as the banked func_80059234 / func_80059FC0 bodies.
* - no .frame/.mask/.fmask: frameless (nothing saved, sp untouched); the banked
* func_80059234 passed the whole-binary gate without them, proving the gate ignores
* non-text frame metadata.
*
* Symbol audit vs the target's own relocation lines: the ONLY relocation in the target is
* the jal to func_80047EC8 (line 8 of the .s); spelled identically here. The function
* references no data symbols, no jumptables, and no hi-lo pairs.
*
* INTEGRATION NOTE: this REPLACES the INCLUDE_ASM("asm/nonmatchings/800b", VectorNormal)
* stub line in src/800b.c. The stub must be deleted, not kept beside this block -- a
* leftover stub defines the same symbol twice and the whole-binary gate fails at link
* scope (the §14b failure class match_one cannot see). Sibling VectorNormalSS (0x30,
* lh/sh variant, same handwritten idiom) banks with the identical template; its
* .L80047EAC label is dead text (single fall-through path).
*/
__asm__(
".text\n"
".align\t2\n"
".globl\tVectorNormal\n"
".ent\tVectorNormal\n"
"VectorNormal:\n"
".set\tnoreorder\n"
"lw $t0, 0($a0)\n"
"lw $t1, 4($a0)\n"
"lw $t2, 8($a0)\n"
"addu $a3, $ra, $zero\n"
"jal func_80047EC8\n"
"nop\n"
"addu $ra, $a3, $zero\n"
"sw $t0, 0($a1)\n"
"sw $t1, 4($a1)\n"
"jr $ra\n"
"sw $t2, 8($a1)\n"
".set\treorder\n"
".end\tVectorNormal\n"
);
__asm__(".text\n.align 2\n.globl VectorNormalSS\n.ent\tVectorNormalSS\n"
"VectorNormalSS:\n.frame $sp,0,$31\n.mask 0x00000000,0\n.fmask 0x00000000,0\n"
".set\tnoreorder\n"
"lh $t0, 0($a0)\n"
"lh $t1, 2($a0)\n"
"lh $t2, 4($a0)\n"
"nop\n"
"addu $a3, $ra, $zero\n"
".L80047EAC:\n"
"jal func_80047EC8\n"
"nop\n"
"addu $ra, $a3, $zero\n"
"sh $t0, 0($a1)\n"
"sh $t1, 2($a1)\n"
"jr $ra\n"
"sh $t2, 4($a1)\n"
".set\treorder\n.end\tVectorNormalSS\n");
__asm__(
".text\n"
".align\t2\n"
".globl\tfunc_80047EC8\n"
".ent\tfunc_80047EC8\n"
"func_80047EC8:\n"
".set\tnoreorder\n"
"mtc2 $t0, $9\n"
"mtc2 $t1, $10\n"
"mtc2 $t2, $11\n"
"nop\n"
"sqr 0\n"
"mfc2 $t3, $25\n"
"mfc2 $t4, $26\n"
"mfc2 $t5, $27\n"
"add $t3, $t3, $t4\n"
"add $v0, $t3, $t5\n"
"mtc2 $v0, $30\n"
"nop\n"
"nop\n"
"mfc2 $v1, $31\n"
"addiu $at, $zero, -2\n"
"and $v1, $v1, $at\n"
"addiu $t6, $zero, 31\n"
"sub $t6, $t6, $v1\n"
"addi $t3, $v1, -24\n"
"bltz $t3, 1f\n"
"sra $t6, $t6, 1\n"
"b 2f\n"
"sllv $t4, $v0, $t3\n"
"1:\n"
"addiu $t3, $zero, 24\n"
"sub $t3, $t3, $v1\n"
"srav $t4, $v0, $t3\n"
"2:\n"
"addi $t4, $t4, -64\n"
"sll $t4, $t4, 1\n"
"lui $t5, %hi(D_8006DA80)\n"
"addu $t5, $t5, $t4\n"
"lh $t5, %lo(D_8006DA80)($t5)\n"
"nop\n"
"mtc2 $t5, $8\n"
"mtc2 $t0, $9\n"
"mtc2 $t1, $10\n"
"mtc2 $t2, $11\n"
"nop\n"
"nop\n"
"gpf 0\n"
"mfc2 $t0, $25\n"
"mfc2 $t1, $26\n"
"mfc2 $t2, $27\n"
"srav $t0, $t0, $t6\n"
"srav $t1, $t1, $t6\n"
"srav $t2, $t2, $t6\n"
"jr $ra\n"
"nop\n"
".set\treorder\n"
".end\tfunc_80047EC8\n"
);
/*
* MatrixNormal (0x80047F84) -- HANDWRITTEN libgte-style GTE routine
* (splat marks every cop2 instruction "handwritten"): six lh loads of the source
* MATRIX row pairs, cfc2/ctc2 rotation-control save/set, mtc2 vector loads, two
* identical GTE compute ops (word 0x4B78000C -> cop2 0x178000C, same encoding
* rule as the banked GsTMDfastG3GL: emitted word = 0x4A000000 | imm), three tail
* calls to func_80047EC8 interleaved with sh runs to the out-matrix, and a
* return sequence `jr $ra` whose DELAY SLOT holds a live `sh $t2,0x10($a1)`
* plus one literal trailing nop.
*
* gcc-2.7.2 cannot express any of this from a C function body: the cop2 traffic
* is unreachable, and the live delay-slot return is impossible because cc1
* unconditionally appends its own `jr $ra; nop` epilogue (probed in this
* project: neither noreturn nor an asm-jump tail suppresses it). So the whole
* function is FILE-SCOPE __asm__ -- opaque text cc1 copies verbatim with no RTL
* function wrapped around it, exactly like func_80059234 (src/800c.c) and
* GsSortClear (src/gsgap3.c). The literal ".ent\tMatrixNormal" line is
* load-bearing: maspsx special-cases ".ent<TAB>" to emit a fresh
* ".set noreorder" (an ordinary .set line is swallowed, tracked only); writing
* glabel/endlabel instead would leave gas in reorder mode, auto-nopping every
* branch/jal slot and displacing the hand-placed delay-slot instructions.
* `jal func_80047EC8` carries the only relocations; the symbol is named exactly
* as the target's own relocation lines spell it (each jal encodes 0x80047EC8).
*/
__asm__(
".text\n"
".align\t2\n"
".globl\tMatrixNormal\n"
".ent\tMatrixNormal\n"
"MatrixNormal:\n"
".set\tnoreorder\n"
"lh $t0, 0($a0)\n"
"lh $t1, 2($a0)\n"
"lh $t2, 4($a0)\n"
"lh $t3, 6($a0)\n"
"lh $t4, 8($a0)\n"
"lh $t5, 10($a0)\n"
"cfc2 $v0, $0\n"
"cfc2 $v1, $2\n"
"cfc2 $a2, $4\n"
"ctc2 $t0, $0\n"
"ctc2 $t1, $2\n"
"ctc2 $t2, $4\n"
"mtc2 $t5, $11\n"
"mtc2 $t3, $9\n"
"mtc2 $t4, $10\n"
"nop\n"
"cop2 0x178000C\n"
"mfc2 $t7, $25\n"
"mfc2 $t8, $26\n"
"mfc2 $t9, $27\n"
"ctc2 $t3, $0\n"
"ctc2 $t4, $2\n"
"ctc2 $t5, $4\n"
"nop\n"
"cop2 0x178000C\n"
"mtc2 $t3, $0\n"
"mtc2 $t4, $1\n"
"mtc2 $t5, $2\n"
"mfc2 $t0, $25\n"
"mfc2 $t1, $26\n"
"mfc2 $t2, $27\n"
"ctc2 $v0, $0\n"
"ctc2 $v1, $2\n"
"ctc2 $a2, $4\n"
"addu $a3, $ra, $zero\n"
"jal func_80047EC8\n"
"nop\n"
"sh $t0, 0($a1)\n"
"sh $t1, 2($a1)\n"
"sh $t2, 4($a1)\n"
"mfc2 $t0, $0\n"
"mfc2 $t1, $1\n"
"mfc2 $t2, $2\n"
"jal func_80047EC8\n"
"nop\n"
"sh $t0, 6($a1)\n"
"sh $t1, 8($a1)\n"
"sh $t2, 10($a1)\n"
"addu $t0, $t7, $zero\n"
"addu $t1, $t8, $zero\n"
"jal func_80047EC8\n"
"addu $t2, $t9, $zero\n"
"addu $ra, $a3, $zero\n"
"sh $t0, 12($a1)\n"
"sh $t1, 14($a1)\n"
"jr $ra\n"
"sh $t2, 16($a1)\n"
"nop\n"
".set\treorder\n"
".end\tMatrixNormal\n"
);
void gteMIMefunc()
{
__asm__ __volatile__(
".set\tnoreorder\n"
"sll $6, $6, 3\n"
"add $6, $6, $5\n"
"mtc2 $7, $8\n"
".L80048078:\n"
"lw $8, 0($5)\n"
"lh $10, 4($5)\n"
"sra $9, $8, 16\n"
"andi $8, $8, 65535\n"
"mtc2 $8, $9\n"
"mtc2 $9, $10\n"
"mtc2 $10, $11\n"
"nop\n"
"nop\n"
"cop2 0x198003D\n"
"lw $2, 0($4)\n"
"lh $7, 4($4)\n"
"sra $3, $2, 16\n"
"andi $2, $2, 65535\n"
"addi $5, $5, 8\n"
"mfc2 $8, $9\n"
"mfc2 $9, $10\n"
"mfc2 $10, $11\n"
"add $2, $2, $8\n"
"add $3, $3, $9\n"
"add $7, $7, $10\n"
"sh $2, 0($4)\n"
"sh $3, 2($4)\n"
"sh $7, 4($4)\n"
"addi $4, $4, 8\n"
"bne $5, $6, .L80048078\n"
"nop\n"
".set\treorder\n"
);
}
__asm__(
".text\n"
".align 2\n"
".globl SquareRoot12\n"
"SquareRoot12:\n"
".set\tnoreorder\n"
"mtc2 $4, $30\n"
"nop\n"
"nop\n"
"mfc2 $2, $31\n"
"addiu $1, $0, 32\n"
".word 0x1041001d\n"
"nop\n"
"andi $8, $2, 1\n"
"addiu $10, $0, -2\n"
"and $10, $2, $10\n"
"addiu $9, $0, 19\n"
"sub $9, $9, $10\n"
"sra $9, $9, 1\n"
"addi $11, $10, -24\n"
".word 0x05600003\n"
"nop\n"
"sllv $12, $4, $11\n"
".word 0x10000003\n"
"addiu $11, $0, 24\n"
"sub $11, $11, $10\n"
"srav $12, $4, $11\n"
"addi $12, $12, -64\n"
"sll $12, $12, 1\n"
"lui $13, %hi(D_8006D8EC)\n"
"addu $13, $13, $12\n"
"lh $13, %lo(D_8006D8EC)($13)\n"
"nop\n"
".word 0x05200004\n"
"nop\n"
"sllv $2, $13, $9\n"
".word 0x03e00008\n"
"nop\n"
"neg $9, $9\n"
".word 0x03e00008\n"
"srlv $2, $13, $9\n"
".word 0x03e00008\n"
"addiu $2, $0, 0\n"
"nop\n"
"nop\n"
"nop\n"
".set\treorder\n"
);
-228
View File
@@ -1,228 +0,0 @@
#include "common.h"
void LightColor(void)
{
__asm__ __volatile__(
".set\tnoreorder\n"
"lwc2 $9, 0($4)\n"
"lwc2 $10, 4($4)\n"
"lwc2 $11, 8($4)\n"
"nop\n"
"mvmva 1, 2, 3, 1, 1\n"
"swc2 $9, 0($5)\n"
"swc2 $10, 4($5)\n"
"swc2 $11, 8($5)\n"
".set\treorder\n"
: : : "memory");
}
void DpqColorLight()
{
__asm__ __volatile__(
".set\tnoreorder\n"
"lwc2 $9, 0($4)\n"
"lwc2 $10, 4($4)\n"
"lwc2 $11, 8($4)\n"
"lwc2 $6, 0($5)\n"
"mtc2 $6, $8\n"
"nop\n"
"dpcl\n"
"swc2 $22, 0($7)\n"
".set\treorder\n"
);
}
/* DpqColor3 @ 0x8004929C -- handwritten PsyQ depth-cue colour routine.
* Splat marks this "Handwritten function": raw GTE assembly, not compiler
* output --
* - three 32-bit colour loads straight into GTE regs $20/$21/$22 from the
* caller's argument pointers ($4/$5/$6), then the same pointer ($6)
* re-loaded into GTE reg $6,
* - `mtc2 $7,$8` writes the OT code from argument $7 into GTE reg $8,
* - one cop2-latency `nop` before `dpct` (depth-cue colour transform),
* - three result pointers read from the CALLER's frame at 0x10..0x24($sp)
* (incoming stack arguments, private calling convention) receiving
* swc2 stores of $20/$21/$22.
* None of that is reachable from C, so the body is one full inline asm block
* (cookbook §265 form 2; precedents func_800CBA44 / GsTMDfastG4GL).
*
* maspsx interaction:
* - leading `.set<TAB>noreorder` (literal tab) flips maspsx's is_reorder
* tracker; the trailing `.set<TAB>reorder` hands it back so maspsx fills
* the delay slot of gcc's own frameless-leaf epilogue `j $31` -- the
* target's trailing `jr $ra; nop` is therefore deliberately NOT
* transcribed.
* - every memory offset is DECIMAL (maspsx int() is base-10).
* - the hazard `nop` between mtc2 and dpct is transcribed literally;
* maspsx's load-delay pass fires on none of these instructions (no
* GTE-reg base reads), so nothing is auto-inserted.
*/
void DpqColor3(void)
{
__asm__ __volatile__(
".set\tnoreorder\n"
"lwc2 $20, 0($4)\n"
"lwc2 $21, 0($5)\n"
"lwc2 $22, 0($6)\n"
"lwc2 $6, 0($6)\n"
"mtc2 $7, $8\n"
"nop\n"
"dpct\n"
"lw $8, 16($29)\n"
"lw $9, 20($29)\n"
"lw $10, 24($29)\n"
"swc2 $20, 0($8)\n"
"swc2 $21, 0($9)\n"
"swc2 $22, 0($10)\n"
".set\treorder\n"
: : : "memory");
}
void Intpl()
{
__asm__ __volatile__(
".set\tnoreorder\n"
"lwc2 $9, 0($4)\n"
"lwc2 $10, 4($4)\n"
"lwc2 $11, 8($4)\n"
"mtc2 $5, $8\n"
"nop\n"
"intpl\n"
"swc2 $22, 0($6)\n"
".set\treorder\n"
: : : "memory");
}
s32 *Square12(s32 *a0, s32 *a1)
{
register s32 *out __asm__("$5");
out = a1;
__asm__ __volatile__(
".set\tnoreorder\n"
"lwc2 $9, 0(%0)\n"
"lwc2 $10, 4(%0)\n"
"lwc2 $11, 8(%0)\n"
"nop\n"
"sqr 1\n"
"swc2 $25, 0(%1)\n"
"swc2 $26, 4(%1)\n"
"swc2 $27, 8(%1)\n"
".set\treorder\n"
: : "r"(a0), "r"(out) : "$9", "$10", "$11", "memory");
return a1;
}
s32 *Square0(s32 *a0, s32 *a1)
{
register s32 *out __asm__("$5");
out = a1;
__asm__ __volatile__(
".set\tnoreorder\n"
"lwc2 $9, 0(%0)\n"
"lwc2 $10, 4(%0)\n"
"lwc2 $11, 8(%0)\n"
"nop\n"
"sqr 0\n"
"swc2 $25, 0(%1)\n"
"swc2 $26, 4(%1)\n"
"swc2 $27, 8(%1)\n"
".set\treorder\n"
: : "r"(a0), "r"(out) : "$9", "$10", "$11", "memory");
return a1;
}
void AverageZ3()
{
__asm__ __volatile__(
".set\tnoreorder\n"
"mtc2 $4, $17\n"
"mtc2 $5, $18\n"
"mtc2 $6, $19\n"
"nop\n"
"cop2 22544429\n" /* avsz3 = 0x4B58002D */
"mfc2 $2, $7\n"
".set\treorder\n"
);
}
__asm__(".text\n.align 2\n.globl AverageZ4\n.ent\tAverageZ4\n"
"AverageZ4:\n.frame $sp,0,$31\n.mask 0x00000000,0\n.fmask 0,0\n"
".set\tnoreorder\n"
"mtc2 $a0, $16\n"
"mtc2 $a1, $17\n"
"mtc2 $a2, $18\n"
"mtc2 $a3, $19\n"
"nop\n"
"avsz4\n"
"mfc2 $v0, $7\n"
"jr $ra\n"
"nop\n"
".set\treorder\n.end\tAverageZ4\n");
__asm__(".text\n.align 2\n.globl OuterProduct12\n.ent\tOuterProduct12\n"
"OuterProduct12:\n.frame $sp,0,$31\n.mask 0x00000000,0\n.fmask 0,0\n"
".set\tnoreorder\n"
"cfc2 $t5, $0\n"
"cfc2 $t6, $2\n"
"cfc2 $t7, $4\n"
"lw $t0, 0($a0)\n"
"lw $t1, 4($a0)\n"
"lw $t2, 8($a0)\n"
"ctc2 $t0, $0\n"
"ctc2 $t1, $2\n"
"ctc2 $t2, $4\n"
"lwc2 $11, 8($a1)\n"
"lwc2 $9, 0($a1)\n"
"lwc2 $10, 4($a1)\n"
"nop\n"
"op 1\n"
"swc2 $25, 0($a2)\n"
"swc2 $26, 4($a2)\n"
"swc2 $27, 8($a2)\n"
"ctc2 $t5, $0\n"
"ctc2 $t6, $2\n"
"ctc2 $t7, $4\n"
"jr $ra\n"
"nop\n"
".set\treorder\n.end\tOuterProduct12\n");
__asm__(".text\n.align 2\n.globl OuterProduct0\n.ent\tOuterProduct0\n"
"OuterProduct0:\n.frame $sp,0,$31\n.mask 0x00000000,0\n.fmask 0,0\n"
".set\tnoreorder\n"
"cfc2 $t5, $0\n"
"cfc2 $t6, $2\n"
"cfc2 $t7, $4\n"
"lw $t0, 0($a0)\n"
"lw $t1, 4($a0)\n"
"lw $t2, 8($a0)\n"
"ctc2 $t0, $0\n"
"ctc2 $t1, $2\n"
"ctc2 $t2, $4\n"
"lwc2 $11, 8($a1)\n"
"lwc2 $9, 0($a1)\n"
"lwc2 $10, 4($a1)\n"
"nop\n"
"op 0\n"
"swc2 $25, 0($a2)\n"
"swc2 $26, 4($a2)\n"
"swc2 $27, 8($a2)\n"
"ctc2 $t5, $0\n"
"ctc2 $t6, $2\n"
"ctc2 $t7, $4\n"
"jr $ra\n"
"nop\n"
".set\treorder\n.end\tOuterProduct0\n");
__asm__(".text\n.align 2\n.globl func_80049440\n.ent\tfunc_80049440\n"
"func_80049440:\n.frame $sp,0,$31\n.mask 0x00000000,0\n.fmask 0,0\n"
".set\tnoreorder\n"
"mtc2 $a0, $30\n"
"nop\n"
"nop\n"
"mfc2 $v0, $31\n"
"jr $ra\n"
"nop\n"
"nop\n"
".set\treorder\n.end\tfunc_80049440\n");
-22
View File
@@ -1,22 +0,0 @@
#include "common.h"
/* func_800495EC -- handwritten GTE SXY-load entry (splat: Handwritten function).
* Three mtc2 stores of the incoming $a0-$a2 words into cop2 regs SXY0/SXY2/SXY1,
* then TWO bare nops and NO jr: control falls through into func_80049600
* (nclip + mfc2 $v0,$24 + jr $ra) in the next object. Any C function definition
* would emit a jr $ra epilogue the target does not have, so the body is
* transcribed verbatim as a file-scope asm block (cookbook §265 lane 1;
* SetSZfifo3 form @ src/gsgap5.c:54). Decimal immediates only (maspsx).
* Recovered semantics: gte_ldsxy3(a0,a1,a2); gte_nclip(); return gte_stMAC0();
* via the fallthrough. */
__asm__(".text\n.align 2\n.globl func_800495EC\n.ent\tfunc_800495EC\n"
"func_800495EC:\n"
".set\tnoreorder\n"
"mtc2 $4, $12\n"
"mtc2 $6, $14\n"
"mtc2 $5, $13\n"
"nop\n"
"nop\n"
".set\treorder\n"
".end\tfunc_800495EC\n");
-10
View File
@@ -1,10 +0,0 @@
#include "common.h"
__asm__(".text\n.align 2\n.globl func_80049610\n.ent\tfunc_80049610\n"
"func_80049610:\n"
".set\tnoreorder\n"
"nop\n"
"nop\n"
"nop\n"
".set\treorder\n"
".end\tfunc_80049610\n");
-984
View File
@@ -1,984 +0,0 @@
#include "common.h"
/* func_8004978C (0x8004978C): tail FRAGMENT of the RotMatrix family dispatcher, not a
* standalone callable: it loads r->vx, folds |vx|&0xFFF through D_8006DF1C, and TAIL-JUMPS
* into FGO_01_OBJ_64 with sin in $t3 (sll/sra 16 pair on the register-held word — §172b-1)
* and cos in $t0 ($t9>>16); the negative-vx arm negates the sine. No jal anywhere, no $ra
* save, args staged in the j's own delay slot — a shape gcc-2.7.2 -O2 C cannot emit (§265:
* bgez whose OR-path falls through into a j chain). Banked verbatim per the FGO_01_OBJ_160
* idiom already gate-proven in this TU: tab-separated .ent/.end keeps maspsx's fresh
* ".set noreorder", immediates DECIMAL (maspsx int()-parses hex and crashes).
*/
__asm__(".text\n.align 2\n.globl func_8004978C\n.ent\tfunc_8004978C\n"
"func_8004978C:\n.frame $sp,0,$31\n"
".set\tnoreorder\n"
"lh $t7, 0($a0)\n"
"addu $v0, $a1, $zero\n"
"bgez $t7, .L800497D0\n"
"andi $t9, $t7, 4095\n"
"negu $t7, $t7\n"
"bgez $t7, .L800497A8\n"
"andi $t7, $t7, 4095\n"
".L800497A8:\n"
"sll $t8, $t7, 2\n"
"lui $t9, %hi(D_8006DF1C)\n"
"addu $t9, $t9, $t8\n"
"lw $t9, %lo(D_8006DF1C)($t9)\n"
"nop\n"
"sll $t8, $t9, 16\n"
"sra $t8, $t8, 16\n"
"negu $t3, $t8\n"
"j FGO_01_OBJ_64\n"
"sra $t0, $t9, 16\n"
".L800497D0:\n"
"sll $t8, $t9, 2\n"
"lui $t9, %hi(D_8006DF1C)\n"
"addu $t9, $t9, $t8\n"
"lw $t9, %lo(D_8006DF1C)($t9)\n"
"nop\n"
"sll $t8, $t9, 16\n"
"sra $t3, $t8, 16\n"
"sra $t0, $t9, 16\n"
".set\treorder\n.end\tfunc_8004978C\n");
/* FGO_01_OBJ_64 (0x800497F0) is NOT a callable function: it is the second code FRAGMENT of one
* larger routine (func_8004978C -> FGO_01_OBJ_64 -> FGO_01_OBJ_CC -> FGO_01_OBJ_160). It is
* entered by `j FGO_01_OBJ_64` with live values in $t registers and exits by `j FGO_01_OBJ_CC`
* (one arm) or by FALLING THROUGH into FGO_01_OBJ_CC (the other), handing on $t4/$t5/$t6/$t1 --
* none of which any C calling convention expresses, and it has ZERO trailing `jr $ra`, so per
* §179-C every C shape gains a phantom epilogue (+2). Banked as a file-scope inline asm blob per
* the SYS_OBJ_1DC0 idiom (src/800c.c), exactly like the FGO_01_OBJ_160 blob below in this TU:
* literal tab-separated ".ent\t"/".end\t" so maspsx emits a fresh ".set\tnoreorder" and keeps
* every delay-slot instruction in place; DECIMAL immediates (maspsx int()-parses offsets);
* single-% %hi/%lo (file-scope asm); .L local labels; no trailing pad -- FGO_01_OBJ_CC follows
* at +0x68 exactly. Recovered semantics: w = (s16)obj->[0x2]; idx = (w >= 0 ? w : -w) & 0xFFF;
* e = D_8006DF1C[idx]; outputs $t1 = e >> 16 (high halfword) and $t6/$t4 = -(s16)e (negated low
* halfword) -- a +/-sin/cos table lookup feeding the matrix build. Body transcribed 1:1 from
* asm/nonmatchings/800b_5/FGO_01_OBJ_64.s.
*/
__asm__(".text\n.align 2\n.globl FGO_01_OBJ_64\n.ent\tFGO_01_OBJ_64\n"
"FGO_01_OBJ_64:\n.frame $sp,0,$31\n"
".set\tnoreorder\n"
"lh $t7, 2($a0)\n"
"nop\n"
"bgez $t7, .L80049834\n"
"andi $t9, $t7, 4095\n"
"negu $t7, $t7\n"
"bgez $t7, .L8004980C\n"
"andi $t7, $t7, 4095\n"
".L8004980C:\n"
"sll $t8, $t7, 2\n"
"lui $t9, %hi(D_8006DF1C)\n"
"addu $t9, $t9, $t8\n"
"lw $t9, %lo(D_8006DF1C)($t9)\n"
"nop\n"
"sll $t4, $t9, 16\n"
"sra $t4, $t4, 16\n"
"negu $t6, $t4\n"
"j FGO_01_OBJ_CC\n"
"sra $t1, $t9, 16\n"
".L80049834:\n"
"sll $t8, $t9, 2\n"
"lui $t9, %hi(D_8006DF1C)\n"
"addu $t9, $t9, $t8\n"
"lw $t9, %lo(D_8006DF1C)($t9)\n"
"nop\n"
"sll $t6, $t9, 16\n"
"sra $t6, $t6, 16\n"
"negu $t4, $t6\n"
"sra $t1, $t9, 16\n"
".set\treorder\n.end\tFGO_01_OBJ_64\n");
__asm__(".text\n.align 2\n.globl FGO_01_OBJ_CC\n.ent\tFGO_01_OBJ_CC\n"
"FGO_01_OBJ_CC:\n.frame $sp,0,$31\n"
".set\tnoreorder\n"
"multu $t1, $t3\n"
"lh $t7, 4($a0)\n"
"sh $t6, 4($a1)\n"
"mflo $t8\n"
"negu $t9, $t8\n"
"sra $t6, $t9, 12\n"
"multu $t1, $t0\n"
"sh $t6, 10($a1)\n"
"bgez $t7, .L800498C0\n"
"andi $t9, $t7, 4095\n"
"mflo $t8\n"
"sra $t6, $t8, 12\n"
"sh $t6, 16($a1)\n"
"negu $t7, $t7\n"
"bgez $t7, .L80049898\n"
"andi $t7, $t7, 4095\n"
".L80049898:\n"
"sll $t8, $t7, 2\n"
"lui $t9, %hi(D_8006DF1C)\n"
"addu $t9, $t9, $t8\n"
"lw $t9, %lo(D_8006DF1C)($t9)\n"
"nop\n"
"sll $t8, $t9, 16\n"
"sra $t8, $t8, 16\n"
"negu $t5, $t8\n"
"j FGO_01_OBJ_160\n"
"sra $t2, $t9, 16\n"
".L800498C0:\n"
"mflo $t7\n"
"sra $t6, $t7, 12\n"
"sh $t6, 16($a1)\n"
"sll $t8, $t9, 2\n"
"lui $t9, %hi(D_8006DF1C)\n"
"addu $t9, $t9, $t8\n"
"lw $t9, %lo(D_8006DF1C)($t9)\n"
"nop\n"
"sll $t8, $t9, 16\n"
"sra $t5, $t8, 16\n"
"sra $t2, $t9, 16\n"
".set\treorder\n.end\tFGO_01_OBJ_CC\n");
/* FGO_01_OBJ_160 (0x800498EC) is NOT a callable function: it is the tail FRAGMENT of one
* larger routine. FGO_01_OBJ_CC (0x80049858) computes $t2/$t5 from D_8006DF1C and tail-jumps
* straight into it (`j FGO_01_OBJ_160`, no jal anywhere in asm/); the live inputs arrive in
* $t0-$t5 with the destination pointer in $a1 -- none of which any C calling convention
* expresses. Banked as a file-scope inline asm blob per the SYS_OBJ_1DC0 idiom (src/800c.c):
* the literal ".ent\t"/".end\t" pair (tab-separated) makes maspsx emit a fresh
* ".set\tnoreorder", keeping every hand-placed delay-slot nop in place; store offsets are
* DECIMAL because maspsx int()-parses them and a hex "0x0($a1)" crashes it
* ("invalid literal for int() with base 10") -- the exact defect that made the previous
* attempt's whole-binary gate reject a COMPILE error, not a byte mismatch. Body transcribed
* 1:1 from asm/nonmatchings/800b_5/FGO_01_OBJ_160.s (oracle MATCH 76/76; the region contains
* ZERO relocations -- no jal/j/lui -- so relocation masking hides nothing). The trailing
* __asm__(".word 0") reproduces the padding nop at 0x80049A18 before RotMatrixYXZ
* (0x80049A1C), matching the banked FGO_02/03_OBJ_160 siblings whose own .s tails carry the
* same post-endlabel pad (0x80049CA8 / 0x80049F38) and whose blobs use this identical form,
* gate-proven twice in this very TU.
*/
__asm__(".text\n.align 2\n.globl FGO_01_OBJ_160\n.ent\tFGO_01_OBJ_160\n"
"FGO_01_OBJ_160:\n.frame $sp,0,$31\n"
".set\tnoreorder\n"
"multu $t2, $t1\n"
"nop\n"
"nop\n"
"mflo $t7\n"
"sra $t6, $t7, 12\n"
"sh $t6, 0($a1)\n"
"multu $t5, $t1\n"
"nop\n"
"nop\n"
"mflo $t7\n"
"negu $t6, $t7\n"
"sra $t7, $t6, 12\n"
"multu $t2, $t4\n"
"sh $t7, 2($a1)\n"
"nop\n"
"mflo $t7\n"
"sra $t8, $t7, 12\n"
"nop\n"
"multu $t8, $t3\n"
"nop\n"
"nop\n"
"mflo $t7\n"
"sra $t6, $t7, 12\n"
"nop\n"
"multu $t5, $t0\n"
"nop\n"
"nop\n"
"mflo $t7\n"
"sra $t9, $t7, 12\n"
"subu $t7, $t9, $t6\n"
"multu $t8, $t0\n"
"sh $t7, 6($a1)\n"
"nop\n"
"mflo $t6\n"
"sra $t7, $t6, 12\n"
"nop\n"
"multu $t5, $t3\n"
"nop\n"
"nop\n"
"mflo $t6\n"
"sra $t9, $t6, 12\n"
"addu $t6, $t9, $t7\n"
"multu $t5, $t4\n"
"sh $t6, 12($a1)\n"
"nop\n"
"mflo $t7\n"
"sra $t8, $t7, 12\n"
"nop\n"
"multu $t8, $t3\n"
"nop\n"
"nop\n"
"mflo $t7\n"
"sra $t6, $t7, 12\n"
"nop\n"
"multu $t2, $t0\n"
"nop\n"
"nop\n"
"mflo $t7\n"
"sra $t9, $t7, 12\n"
"addu $t7, $t9, $t6\n"
"multu $t8, $t0\n"
"sh $t7, 8($a1)\n"
"nop\n"
"mflo $t6\n"
"sra $t7, $t6, 12\n"
"nop\n"
"multu $t2, $t3\n"
"nop\n"
"nop\n"
"mflo $t6\n"
"sra $t9, $t6, 12\n"
"subu $t6, $t9, $t7\n"
"sh $t6, 14($a1)\n"
"jr $ra\n"
"nop\n"
".set\treorder\n.end\tFGO_01_OBJ_160\n");
__asm__(".word 0");
__asm__(".text\n.align 2\n.globl RotMatrixYXZ\n.ent\tRotMatrixYXZ\n"
"RotMatrixYXZ:\n.frame $sp,0,$31\n"
".set\tnoreorder\n"
"lh $t7, 0($a0)\n"
"addu $v0, $a1, $zero\n"
"bgez $t7, .L80049A60\n"
"andi $t9, $t7, 4095\n"
"negu $t7, $t7\n"
"bgez $t7, .L80049A38\n"
"andi $t7, $t7, 4095\n"
".L80049A38:\n"
"sll $t8, $t7, 2\n"
"lui $t9, %hi(D_8006DF1C)\n"
"addu $t9, $t9, $t8\n"
"lw $t9, %lo(D_8006DF1C)($t9)\n"
"nop\n"
"sll $t6, $t9, 16\n"
"sra $t6, $t6, 16\n"
"negu $t3, $t6\n"
"j FGO_02_OBJ_68\n"
"sra $t0, $t9, 16\n"
".L80049A60:\n"
"sll $t8, $t9, 2\n"
"lui $t9, %hi(D_8006DF1C)\n"
"addu $t9, $t9, $t8\n"
"lw $t9, %lo(D_8006DF1C)($t9)\n"
"nop\n"
"sll $t8, $t9, 16\n"
"sra $t3, $t8, 16\n"
"negu $t6, $t3\n"
"sra $t0, $t9, 16\n"
".set\treorder\n.end\tRotMatrixYXZ\n");
__asm__(".text\n.align 2\n.globl FGO_02_OBJ_68\n.ent\tFGO_02_OBJ_68\n"
"FGO_02_OBJ_68:\n.frame $sp,0,$31\n"
".set\tnoreorder\n"
"lh $t7, 2($a0)\n"
"nop\n"
"bgez $t7, .L80049AC8\n"
"andi $t9, $t7, 4095\n"
"negu $t7, $t7\n"
"bgez $t7, .L80049AA0\n"
"andi $t7, $t7, 4095\n"
".L80049AA0:\n"
"sll $t8, $t7, 2\n"
"lui $t9, %hi(D_8006DF1C)\n"
"addu $t9, $t9, $t8\n"
"lw $t9, %lo(D_8006DF1C)($t9)\n"
"nop\n"
"sll $t8, $t9, 16\n"
"sra $t8, $t8, 16\n"
"negu $t4, $t8\n"
"j FGO_02_OBJ_CC\n"
"sra $t1, $t9, 16\n"
".L80049AC8:\n"
"sll $t8, $t9, 2\n"
"lui $t9, %hi(D_8006DF1C)\n"
"addu $t9, $t9, $t8\n"
"lw $t9, %lo(D_8006DF1C)($t9)\n"
"nop\n"
"sll $t8, $t9, 16\n"
"sra $t4, $t8, 16\n"
"sra $t1, $t9, 16\n"
".set\treorder\n.end\tFGO_02_OBJ_68\n");
__asm__(".text\n.align 2\n.globl FGO_02_OBJ_CC\n.ent\tFGO_02_OBJ_CC\n"
"FGO_02_OBJ_CC:\n.frame $sp,0,$31\n"
".set\tnoreorder\n"
"multu $t4, $t0\n"
"lh $t7, 4($a0)\n"
"sh $t6, 10($a1)\n"
"mflo $t8\n"
"sra $t6, $t8, 12\n"
"nop\n"
"multu $t1, $t0\n"
"sh $t6, 4($a1)\n"
"bgez $t7, 1f\n"
"andi $t9, $t7, 0xFFF\n"
"mflo $t8\n"
"sra $t6, $t8, 12\n"
"sh $t6, 16($a1)\n"
"negu $t7, $t7\n"
"bgez $t7, 2f\n"
"andi $t7, $t7, 0xFFF\n"
"2:\n"
"sll $t8, $t7, 2\n"
"lui $t9, %hi(D_8006DF1C)\n"
"addu $t9, $t9, $t8\n"
"lw $t9, %lo(D_8006DF1C)($t9)\n"
"nop\n"
"sll $t8, $t9, 16\n"
"sra $t8, $t8, 16\n"
"negu $t5, $t8\n"
"j FGO_02_OBJ_160\n"
"sra $t2, $t9, 16\n"
"1:\n"
"mflo $t7\n"
"sra $t6, $t7, 12\n"
"sh $t6, 16($a1)\n"
"sll $t8, $t9, 2\n"
"lui $t9, %hi(D_8006DF1C)\n"
"addu $t9, $t9, $t8\n"
"lw $t9, %lo(D_8006DF1C)($t9)\n"
"nop\n"
"sll $t8, $t9, 16\n"
"sra $t5, $t8, 16\n"
"sra $t2, $t9, 16\n"
".set\treorder\n.end\tFGO_02_OBJ_CC\n");
__asm__(".text\n.align 2\n.globl FGO_02_OBJ_160\n.ent\tFGO_02_OBJ_160\n"
"FGO_02_OBJ_160:\n.frame $sp,0,$31\n"
".set\tnoreorder\n"
"multu $t5, $t0\n"
"nop\n"
"nop\n"
"mflo $t7\n"
"sra $t6, $t7, 12\n"
"sh $t6, 6($a1)\n"
"multu $t2, $t0\n"
"nop\n"
"nop\n"
"mflo $t7\n"
"sra $t6, $t7, 12\n"
"nop\n"
"multu $t4, $t3\n"
"sh $t6, 8($a1)\n"
"nop\n"
"mflo $t7\n"
"sra $t8, $t7, 12\n"
"nop\n"
"multu $t8, $t5\n"
"nop\n"
"nop\n"
"mflo $t7\n"
"sra $t6, $t7, 12\n"
"nop\n"
"multu $t1, $t2\n"
"nop\n"
"nop\n"
"mflo $t7\n"
"sra $t9, $t7, 12\n"
"addu $t7, $t9, $t6\n"
"multu $t1, $t5\n"
"sh $t7, 0($a1)\n"
"nop\n"
"mflo $t6\n"
"sra $t9, $t6, 12\n"
"negu $t7, $t9\n"
"multu $t8, $t2\n"
"nop\n"
"nop\n"
"mflo $t6\n"
"sra $t9, $t6, 12\n"
"addu $t6, $t7, $t9\n"
"multu $t1, $t3\n"
"sh $t6, 2($a1)\n"
"nop\n"
"mflo $t7\n"
"sra $t8, $t7, 12\n"
"nop\n"
"multu $t8, $t2\n"
"nop\n"
"nop\n"
"mflo $t7\n"
"sra $t6, $t7, 12\n"
"nop\n"
"multu $t4, $t5\n"
"nop\n"
"nop\n"
"mflo $t7\n"
"sra $t9, $t7, 12\n"
"addu $t7, $t9, $t6\n"
"multu $t4, $t2\n"
"sh $t7, 14($a1)\n"
"nop\n"
"mflo $t6\n"
"sra $t9, $t6, 12\n"
"negu $t7, $t9\n"
"multu $t8, $t5\n"
"nop\n"
"nop\n"
"mflo $t6\n"
"sra $t9, $t6, 12\n"
"addu $t6, $t7, $t9\n"
"sh $t6, 12($a1)\n"
"jr $ra\n"
"nop\n"
".set\treorder\n.end\tFGO_02_OBJ_160\n");
__asm__(".word 0");
/* func_80049CAC (0x80049CAC) is NOT independently C-compilable, for the same reason as
* FGO_01_OBJ_160 below: it is the HEAD FRAGMENT of one larger routine that this project's
* tooling split into four addressable chunks -- func_80049CAC (x row-setup) -> FGO_03_OBJ_64
* (y) -> FGO_03_OBJ_CC (z, first half) -> FGO_03_OBJ_160 (z, second half, banked as a blob
* beneath). Every exit of the head is a bare "j FGO_03_OBJ_64" (or fallthrough into it --
* FGO_03_OBJ_64's own address 0x80049D10 IS this function's fall-through address) with NO
* epilogue, and the fragments share ONE register allocation ($v0 = m lives across all four;
* $t3/$t0 carry +-sin(x)/cos(x) into the next fragment). gcc-2.7.2 has no sibcall/tail-merge
* (cookbook L17430), and empirically (src/800c.c, SYS_OBJ trampoline) cc1 -O2 ALWAYS
* synthesizes a trailing return/jump for a C function and a real cross-function jal+return
* grows the frame -- the target here has a ZERO-byte frame (no sw $ra, no addiu $sp) and no
* jr $ra anywhere, so no C body (the previous attempt's `return FGO_03_OBJ_64(...)` shape)
* can ever reproduce these 25 instructions. Banked as a file-scope inline asm blob per the
* SYS_OBJ_1DC0/FGO_n_OBJ_160 idiom already proven in this TU: the literal ".ent\t"/".end\t"
* pair (tab-separated) makes maspsx emit a fresh ".set\tnoreorder", keeping every
* hand-placed delay-slot instruction in place; all displacement/immediate offsets are
* DECIMAL because maspsx int()-parses operands and a hex "0x0($a0)" crashes it. Body
* transcribed 1:1 from asm/nonmatchings/800b_5/func_80049CAC.s (25/25 instructions, in
* order, including both delay-slot fills and the branch-to-next-instruction masked-andi
* idiom); the only relocations are `j FGO_03_OBJ_64` and the %hi/%lo pair on D_8006DF1C,
* both resolved exactly as the target's own relocation lines name them. No trailing pad:
* FGO_03_OBJ_64 abuts this function at 0x80049D10 with no gap (unlike the *_OBJ_160 blobs,
* whose .word 0 pads precede a differently-aligned neighbour).
*/
__asm__(".text\n.align 2\n.globl func_80049CAC\n.ent\tfunc_80049CAC\n"
"func_80049CAC:\n.frame $sp,0,$31\n"
".set\tnoreorder\n"
"lh $t7, 0($a0)\n"
"addu $v0, $a1, $zero\n"
"bgez $t7, .L80049CF0\n"
"andi $t9, $t7, 0xFFF\n"
"negu $t7, $t7\n"
"bgez $t7, .L80049CC8\n"
"andi $t7, $t7, 0xFFF\n"
".L80049CC8:\n"
"sll $t8, $t7, 2\n"
"lui $t9, %hi(D_8006DF1C)\n"
"addu $t9, $t9, $t8\n"
"lw $t9, %lo(D_8006DF1C)($t9)\n"
"nop\n"
"sll $t6, $t9, 16\n"
"sra $t6, $t6, 16\n"
"negu $t3, $t6\n"
"j FGO_03_OBJ_64\n"
"sra $t0, $t9, 16\n"
".L80049CF0:\n"
"sll $t8, $t9, 2\n"
"lui $t9, %hi(D_8006DF1C)\n"
"addu $t9, $t9, $t8\n"
"lw $t9, %lo(D_8006DF1C)($t9)\n"
"nop\n"
"sll $t8, $t9, 16\n"
"sra $t3, $t8, 16\n"
"sra $t0, $t9, 16\n"
".set\treorder\n.end\tfunc_80049CAC\n");
__asm__(".text\n.align 2\n.globl FGO_03_OBJ_64\n.ent\tFGO_03_OBJ_64\n"
"FGO_03_OBJ_64:\n.frame $sp,0,$31\n"
".set\tnoreorder\n"
"lh $t7, 2($a0)\n"
"nop\n"
"bgez $t7, .L80049D54\n"
"andi $t9, $t7, 4095\n"
"negu $t7, $t7\n"
"bgez $t7, .L80049D2C\n"
"andi $t7, $t7, 4095\n"
".L80049D2C:\n"
"sll $t8, $t7, 2\n"
"lui $t9, %hi(D_8006DF1C)\n"
"addu $t9, $t9, $t8\n"
"lw $t9, %lo(D_8006DF1C)($t9)\n"
"nop\n"
"sll $t6, $t9, 16\n"
"sra $t6, $t6, 16\n"
"negu $t4, $t6\n"
"j FGO_03_OBJ_CC\n"
"sra $t1, $t9, 16\n"
".L80049D54:\n"
"sll $t8, $t9, 2\n"
"lui $t9, %hi(D_8006DF1C)\n"
"addu $t9, $t9, $t8\n"
"lw $t9, %lo(D_8006DF1C)($t9)\n"
"nop\n"
"sll $t6, $t9, 16\n"
"sra $t4, $t6, 16\n"
"negu $t6, $t4\n"
"sra $t1, $t9, 16\n"
".set\treorder\n.end\tFGO_03_OBJ_64\n");
__asm__(".text\n.align 2\n.globl FGO_03_OBJ_CC\n.ent\tFGO_03_OBJ_CC\n"
"FGO_03_OBJ_CC:\n.frame $sp,0,$31\n"
".set\tnoreorder\n"
"multu $t3, $t1\n"
"lh $t7, 4($a0)\n"
"sh $t6, 12($a1)\n"
"mflo $t8\n"
"sra $t6, $t8, 12\n"
"nop\n"
"multu $t0, $t1\n"
"sh $t6, 14($a1)\n"
"bgez $t7, .L80049DE0\n"
"andi $t9, $t7, 0xFFF\n"
"mflo $t8\n"
"sra $t6, $t8, 12\n"
"sh $t6, 16($a1)\n"
"negu $t7, $t7\n"
"bgez $t7, .L80049DB8\n"
"andi $t7, $t7, 0xFFF\n"
".L80049DB8:\n"
"sll $t8, $t7, 2\n"
"lui $t9, %hi(D_8006DF1C)\n"
"addu $t9, $t9, $t8\n"
"lw $t9, %lo(D_8006DF1C)($t9)\n"
"nop\n"
"sll $t8, $t9, 16\n"
"sra $t8, $t8, 16\n"
"negu $t5, $t8\n"
"j FGO_03_OBJ_160\n"
"sra $t2, $t9, 16\n"
".L80049DE0:\n"
"mflo $t7\n"
"sra $t6, $t7, 12\n"
"sh $t6, 16($a1)\n"
"sll $t8, $t9, 2\n"
"lui $t9, %hi(D_8006DF1C)\n"
"addu $t9, $t9, $t8\n"
"lw $t9, %lo(D_8006DF1C)($t9)\n"
"nop\n"
"sll $t8, $t9, 16\n"
"sra $t5, $t8, 16\n"
"sra $t2, $t9, 16\n"
".set\treorder\n.end\tFGO_03_OBJ_CC\n");
__asm__(".text\n.align 2\n.globl FGO_03_OBJ_160\n.ent\tFGO_03_OBJ_160\n"
"FGO_03_OBJ_160:\n.frame $sp,0,$31\n"
".set\tnoreorder\n"
"multu $t1, $t2\n"
"nop\n"
"nop\n"
"mflo $t7\n"
"sra $t6, $t7, 12\n"
"sh $t6, 0($a1)\n"
"multu $t5, $t1\n"
"nop\n"
"nop\n"
"mflo $t7\n"
"sra $t6, $t7, 12\n"
"nop\n"
"multu $t3, $t4\n"
"sh $t6, 6($a1)\n"
"nop\n"
"mflo $t7\n"
"sra $t8, $t7, 12\n"
"nop\n"
"multu $t8, $t2\n"
"nop\n"
"nop\n"
"mflo $t7\n"
"sra $t6, $t7, 12\n"
"nop\n"
"multu $t5, $t0\n"
"nop\n"
"nop\n"
"mflo $t7\n"
"sra $t9, $t7, 12\n"
"subu $t7, $t6, $t9\n"
"multu $t0, $t2\n"
"sh $t7, 2($a1)\n"
"nop\n"
"mflo $t6\n"
"sra $t7, $t6, 12\n"
"nop\n"
"multu $t8, $t5\n"
"nop\n"
"nop\n"
"mflo $t6\n"
"sra $t9, $t6, 12\n"
"addu $t6, $t9, $t7\n"
"multu $t4, $t0\n"
"sh $t6, 8($a1)\n"
"nop\n"
"mflo $t7\n"
"sra $t8, $t7, 12\n"
"nop\n"
"multu $t8, $t2\n"
"nop\n"
"nop\n"
"mflo $t7\n"
"sra $t6, $t7, 12\n"
"nop\n"
"multu $t3, $t5\n"
"nop\n"
"nop\n"
"mflo $t7\n"
"sra $t9, $t7, 12\n"
"addu $t7, $t6, $t9\n"
"multu $t3, $t2\n"
"sh $t7, 4($a1)\n"
"nop\n"
"mflo $t6\n"
"sra $t7, $t6, 12\n"
"nop\n"
"multu $t8, $t5\n"
"nop\n"
"nop\n"
"mflo $t6\n"
"sra $t9, $t6, 12\n"
"subu $t6, $t9, $t7\n"
"sh $t6, 10($a1)\n"
"jr $ra\n"
"nop\n"
".set\treorder\n.end\tFGO_03_OBJ_160\n");
__asm__(".word 0");
__asm__(".text\n.align 2\n.globl RotMatrixX\n.ent\tRotMatrixX\n"
"RotMatrixX:\n.frame $sp,0,$31\n"
".set\tnoreorder\n"
"addu $t7, $a0, $zero\n"
"addu $v0, $a1, $zero\n"
"bgez $t7, .L80049F80\n"
"andi $t9, $t7, 4095\n"
"negu $t7, $t7\n"
"bgez $t7, .L80049F58\n"
"andi $t7, $t7, 4095\n"
".L80049F58:\n"
"sll $t8, $t7, 2\n"
"lui $t9, %hi(D_8006DF1C)\n"
"addu $t9, $t9, $t8\n"
"lw $t9, %lo(D_8006DF1C)($t9)\n"
"nop\n"
"sll $t6, $t9, 16\n"
"sra $t6, $t6, 16\n"
"negu $t1, $t6\n"
"j FGO_04_OBJ_64\n"
"sra $t0, $t9, 16\n"
".L80049F80:\n"
"sll $t8, $t9, 2\n"
"lui $t9, %hi(D_8006DF1C)\n"
"addu $t9, $t9, $t8\n"
"lw $t9, %lo(D_8006DF1C)($t9)\n"
"nop\n"
"sll $t8, $t9, 16\n"
"sra $t1, $t8, 16\n"
"sra $t0, $t9, 16\n"
".set\treorder\n.end\tRotMatrixX\n");
__asm__(".text\n.align 2\n.globl FGO_04_OBJ_64\n.ent\tFGO_04_OBJ_64\n"
"FGO_04_OBJ_64:\n.frame $sp,0,$31\n"
".set\tnoreorder\n"
"lh $t2, 6($a1)\n"
"lh $t5, 12($a1)\n"
"multu $t0, $t2\n"
"lh $t3, 8($a1)\n"
"lh $t6, 14($a1)\n"
"mflo $t8\n"
"lh $t4, 10($a1)\n"
"lh $t7, 16($a1)\n"
"multu $t1, $t5\n"
"nop\n"
"nop\n"
"mflo $t9\n"
"subu $t9, $t8, $t9\n"
"sra $t8, $t9, 12\n"
"multu $t0, $t3\n"
"sh $t8, 6($a1)\n"
"nop\n"
"mflo $t8\n"
"nop\n"
"nop\n"
"multu $t1, $t6\n"
"nop\n"
"nop\n"
"mflo $t9\n"
"subu $t9, $t8, $t9\n"
"sra $t8, $t9, 12\n"
"multu $t0, $t4\n"
"sh $t8, 8($a1)\n"
"nop\n"
"mflo $t8\n"
"nop\n"
"nop\n"
"multu $t1, $t7\n"
"nop\n"
"nop\n"
"mflo $t9\n"
"subu $t9, $t8, $t9\n"
"sra $t8, $t9, 12\n"
"multu $t1, $t2\n"
"sh $t8, 10($a1)\n"
"nop\n"
"mflo $t8\n"
"nop\n"
"nop\n"
"multu $t0, $t5\n"
"nop\n"
"nop\n"
"mflo $t9\n"
"addu $t9, $t8, $t9\n"
"sra $t8, $t9, 12\n"
"multu $t1, $t3\n"
"sh $t8, 12($a1)\n"
"nop\n"
"mflo $t8\n"
"nop\n"
"nop\n"
"multu $t0, $t6\n"
"nop\n"
"nop\n"
"mflo $t9\n"
"addu $t9, $t8, $t9\n"
"sra $t8, $t9, 12\n"
"multu $t1, $t4\n"
"sh $t8, 14($a1)\n"
"nop\n"
"mflo $t8\n"
"nop\n"
"nop\n"
"multu $t0, $t7\n"
"nop\n"
"nop\n"
"mflo $t9\n"
"addu $t9, $t8, $t9\n"
"sra $t8, $t9, 12\n"
"sh $t8, 16($a1)\n"
"jr $ra\n"
"nop\n"
".set\treorder\n.end\tFGO_04_OBJ_64\n");
__asm__(".word 0");
__asm__(".word 0");
__asm__(".text\n.align 2\n.globl RotMatrixY\n.ent\tRotMatrixY\n"
"RotMatrixY:\n.frame $sp,0,$31\n"
".set\tnoreorder\n"
"addu $t7, $a0, $zero\n"
"addu $v0, $a1, $zero\n"
"bgez $t7, .L8004A11C\n"
"andi $t9, $t7, 4095\n"
"negu $t7, $t7\n"
"bgez $t7, .L8004A0F8\n"
"andi $t7, $t7, 4095\n"
".L8004A0F8:\n"
"sll $t8, $t7, 2\n"
"lui $t9, %hi(D_8006DF1C)\n"
"addu $t9, $t9, $t8\n"
"lw $t9, %lo(D_8006DF1C)($t9)\n"
"nop\n"
"sll $t6, $t9, 16\n"
"sra $t1, $t6, 16\n"
"j FGO_05_OBJ_64\n"
"sra $t0, $t9, 16\n"
".L8004A11C:\n"
"sll $t8, $t9, 2\n"
"lui $t9, %hi(D_8006DF1C)\n"
"addu $t9, $t9, $t8\n"
"lw $t9, %lo(D_8006DF1C)($t9)\n"
"nop\n"
"sll $t8, $t9, 16\n"
"sra $t7, $t8, 16\n"
"negu $t1, $t7\n"
"sra $t0, $t9, 16\n"
".set\treorder\n.end\tRotMatrixY\n");
__asm__(".text\n.align 2\n.globl FGO_05_OBJ_64\n.ent\tFGO_05_OBJ_64\n"
"FGO_05_OBJ_64:\n.frame $sp,0,$31\n"
".set\tnoreorder\n"
"lh $t2, 0($a1)\n"
"lh $t5, 12($a1)\n"
"multu $t0, $t2\n"
"lh $t3, 2($a1)\n"
"lh $t6, 14($a1)\n"
"mflo $t8\n"
"lh $t4, 4($a1)\n"
"lh $t7, 16($a1)\n"
"multu $t1, $t5\n"
"nop\n"
"nop\n"
"mflo $t9\n"
"subu $t9, $t8, $t9\n"
"sra $t8, $t9, 12\n"
"multu $t0, $t3\n"
"sh $t8, 0($a1)\n"
"nop\n"
"mflo $t8\n"
"nop\n"
"nop\n"
"multu $t1, $t6\n"
"nop\n"
"nop\n"
"mflo $t9\n"
"subu $t9, $t8, $t9\n"
"sra $t8, $t9, 12\n"
"multu $t0, $t4\n"
"sh $t8, 2($a1)\n"
"nop\n"
"mflo $t8\n"
"nop\n"
"nop\n"
"multu $t1, $t7\n"
"nop\n"
"nop\n"
"mflo $t9\n"
"subu $t9, $t8, $t9\n"
"sra $t8, $t9, 12\n"
"multu $t1, $t2\n"
"sh $t8, 4($a1)\n"
"nop\n"
"mflo $t8\n"
"nop\n"
"nop\n"
"multu $t0, $t5\n"
"nop\n"
"nop\n"
"mflo $t9\n"
"addu $t9, $t8, $t9\n"
"sra $t8, $t9, 12\n"
"multu $t1, $t3\n"
"sh $t8, 12($a1)\n"
"nop\n"
"mflo $t8\n"
"nop\n"
"nop\n"
"multu $t0, $t6\n"
"nop\n"
"nop\n"
"mflo $t9\n"
"addu $t9, $t8, $t9\n"
"sra $t8, $t9, 12\n"
"multu $t1, $t4\n"
"sh $t8, 14($a1)\n"
"nop\n"
"mflo $t8\n"
"nop\n"
"nop\n"
"multu $t0, $t7\n"
"nop\n"
"nop\n"
"mflo $t9\n"
"addu $t9, $t8, $t9\n"
"sra $t8, $t9, 12\n"
"sh $t8, 16($a1)\n"
"jr $ra\n"
"nop\n"
".set\treorder\n.end\tFGO_05_OBJ_64\n");
__asm__(".word 0");
__asm__(".word 0");
__asm__(".text\n.align 2\n.globl RotMatrixZ\n.ent\tRotMatrixZ\n"
"RotMatrixZ:\n.frame $sp,0,$31\n"
".set\tnoreorder\n"
"addu $t7, $a0, $zero\n"
"addu $v0, $a1, $zero\n"
"bgez $t7, .L8004A2C0\n"
"andi $t9, $t7, 4095\n"
"negu $t7, $t7\n"
"bgez $t7, .L8004A298\n"
"andi $t7, $t7, 4095\n"
".L8004A298:\n"
"sll $t8, $t7, 2\n"
"lui $t9, %hi(D_8006DF1C)\n"
"addu $t9, $t9, $t8\n"
"lw $t9, %lo(D_8006DF1C)($t9)\n"
"nop\n"
"sll $t6, $t9, 16\n"
"sra $t6, $t6, 16\n"
"negu $t1, $t6\n"
"j FGO_06_OBJ_64\n"
"sra $t0, $t9, 16\n"
".L8004A2C0:\n"
"sll $t8, $t9, 2\n"
"lui $t9, %hi(D_8006DF1C)\n"
"addu $t9, $t9, $t8\n"
"lw $t9, %lo(D_8006DF1C)($t9)\n"
"nop\n"
"sll $t8, $t9, 16\n"
"sra $t1, $t8, 16\n"
"sra $t0, $t9, 16\n"
".set\treorder\n.end\tRotMatrixZ\n");
__asm__(".text\n.align 2\n.globl FGO_06_OBJ_64\n.ent\tFGO_06_OBJ_64\n"
"FGO_06_OBJ_64:\n.frame $sp,0,$31\n"
".set\tnoreorder\n"
"lh $t2, 0($a1)\n"
"lh $t5, 6($a1)\n"
"multu $t0, $t2\n"
"lh $t3, 2($a1)\n"
"lh $t6, 8($a1)\n"
"mflo $t8\n"
"lh $t4, 4($a1)\n"
"lh $t7, 10($a1)\n"
"multu $t1, $t5\n"
"nop\n"
"nop\n"
"mflo $t9\n"
"subu $t9, $t8, $t9\n"
"sra $t8, $t9, 12\n"
"multu $t0, $t3\n"
"sh $t8, 0($a1)\n"
"nop\n"
"mflo $t8\n"
"nop\n"
"nop\n"
"multu $t1, $t6\n"
"nop\n"
"nop\n"
"mflo $t9\n"
"subu $t9, $t8, $t9\n"
"sra $t8, $t9, 12\n"
"multu $t0, $t4\n"
"sh $t8, 2($a1)\n"
"nop\n"
"mflo $t8\n"
"nop\n"
"nop\n"
"multu $t1, $t7\n"
"nop\n"
"nop\n"
"mflo $t9\n"
"subu $t9, $t8, $t9\n"
"sra $t8, $t9, 12\n"
"multu $t1, $t2\n"
"sh $t8, 4($a1)\n"
"nop\n"
"mflo $t8\n"
"nop\n"
"nop\n"
"multu $t0, $t5\n"
"nop\n"
"nop\n"
"mflo $t9\n"
"addu $t9, $t8, $t9\n"
"sra $t8, $t9, 12\n"
"multu $t1, $t3\n"
"sh $t8, 6($a1)\n"
"nop\n"
"mflo $t8\n"
"nop\n"
"nop\n"
"multu $t0, $t6\n"
"nop\n"
"nop\n"
"mflo $t9\n"
"addu $t9, $t8, $t9\n"
"sra $t8, $t9, 12\n"
"multu $t1, $t4\n"
"sh $t8, 8($a1)\n"
"nop\n"
"mflo $t8\n"
"nop\n"
"nop\n"
"multu $t0, $t7\n"
"nop\n"
"nop\n"
"mflo $t9\n"
"addu $t9, $t8, $t9\n"
"sra $t8, $t9, 12\n"
"sh $t8, 10($a1)\n"
"jr $ra\n"
"nop\n"
".set\treorder\n.end\tFGO_06_OBJ_64\n");
__asm__(".word 0");
__asm__(".word 0");
-71
View File
@@ -1,71 +0,0 @@
#include "common.h"
__asm__(
".text\n"
".align 2\n"
".globl func_8004D16C\n"
".ent\tfunc_8004D16C\n"
"func_8004D16C:\n"
".frame $sp, 0, $31\n"
".mask 0x00000000, 0\n"
".fmask 0x00000000, 0\n"
".set\tnoreorder\n"
"lui $at, %hi(D_80074754)\n"
"sw $ra, %lo(D_80074754)($at)\n"
"jal func_8005CF08\n"
"nop\n"
"addiu $t2, $0, 176\n"
"jalr $t2\n"
"addiu $t1, $0, 86\n"
"lui $t2, %hi(func_8004D16C+104)\n"
"lui $t1, %hi(TransRot_32)\n"
"lw $v0, 24($v0)\n"
"addiu $t2, $t2, %lo(func_8004D16C+104)\n"
"addiu $t1, $t1, %lo(TransRot_32)\n"
".L8004D19C:\n"
"lw $v1, 0($t2)\n"
"addiu $t2, $t2, 4\n"
"addiu $v0, $v0, 4\n"
"bne $t2, $t1, .L8004D19C\n"
"sw $v1, -4($v0)\n"
"jal FlushCache\n"
"nop\n"
"jal func_8005CF18\n"
"nop\n"
"lui $ra, %hi(D_80074754)\n"
"lw $ra, %lo(D_80074754)($ra)\n"
"nop\n"
"jr $ra\n"
"nop\n"
".set\treorder\n"
".end\tfunc_8004D16C\n"
"nop\n"
"nop\n"
);
__asm__(
".text\n"
".align 2\n"
".globl func_8004D1DC\n"
".type func_8004D1DC, @function\n"
"func_8004D1DC:\n"
".ent func_8004D1DC\n"
".set\tnoreorder\n"
".set\tnoat\n"
"addiu $k0, $zero, 256\n"
"lw $k0, 8($k0)\n"
"nop\n"
"lw $k0, 0($k0)\n"
"nop\n"
"addi $k0, $k0, 8\n"
"sw $at, 4($k0)\n"
"sw $v0, 8($k0)\n"
"sw $v1, 12($k0)\n"
"sw $ra, 124($k0)\n"
"mfc0 $v0, $13\n"
".size func_8004D1DC, . - func_8004D1DC\n"
"nop\n"
".set\treorder\n"
".set\tat\n"
".end func_8004D1DC\n"
);
-1254
View File
File diff suppressed because it is too large Load Diff
-31
View File
@@ -1,31 +0,0 @@
#include "common.h"
__asm__(
".text\n"
".align 2\n"
".globl ApplyMatrix\n"
".ent ApplyMatrix\n"
"ApplyMatrix:\n"
".set\tnoreorder\n"
"lw $8, 0($4)\n"
"lw $9, 4($4)\n"
"lw $10, 8($4)\n"
"lw $11, 12($4)\n"
"lw $12, 16($4)\n"
"ctc2 $8, $0\n"
"ctc2 $9, $1\n"
"ctc2 $10, $2\n"
"ctc2 $11, $3\n"
"ctc2 $12, $4\n"
"lwc2 $0, 0($5)\n"
"lwc2 $1, 4($5)\n"
"nop\n"
"mvmva 1, 0, 0, 3, 0\n"
"swc2 $25, 0($6)\n"
"swc2 $26, 4($6)\n"
"swc2 $27, 8($6)\n"
"addu $2, $6, $0\n"
"jr $ra\n"
".set\treorder\n"
".end ApplyMatrix\n"
);
-18
View File
@@ -1,18 +0,0 @@
#include "common.h"
__asm__(".text\n.align 2\n.globl func_80052430\n.ent\tfunc_80052430\n"
"func_80052430:\n.frame $sp,0,$31\n.mask 0x00000000,0\n.fmask 0,0\n"
".set\tnoreorder\n"
"lw $8, 0($5)\n"
"lw $9, 4($5)\n"
"lw $10, 8($5)\n"
"sw $8, 20($4)\n"
"sw $9, 24($4)\n"
"sw $10, 28($4)\n"
"addu $2, $4, $0\n"
"jr $31\n"
"nop\n"
"nop\n"
"nop\n"
"nop\n"
".set\treorder\n.end\tfunc_80052430\n");
-18
View File
@@ -1,18 +0,0 @@
#include "common.h"
void func_800538BC(void *m) {
__asm__ volatile (
"lw $8, 0( %0 );"
"lw $9, 4( %0 );"
"lw $10, 8( %0 );"
"lw $11, 12( %0 );"
"lw $12, 16( %0 );"
"ctc2 $8, $16;"
"ctc2 $9, $17;"
"ctc2 $10, $18;"
"ctc2 $11, $19;"
"ctc2 $12, $20"
:
: "r"( m )
: "$8", "$9", "$10", "$11", "$12" );
}
-171
View File
@@ -1,171 +0,0 @@
#include "common.h"
void SetVertex0(long *r0)
{
__asm__ volatile(
"lwc2 $0, 0( %0 );"
"lwc2 $1, 4( %0 )"
:
: "r"(r0));
}
void SetVertex1(long *r0)
{
__asm__ volatile(
"lwc2 $2, 0( %0 );"
"lwc2 $3, 4( %0 )"
:
: "r"(r0));
}
void SetVertex2(long *r0)
{
__asm__ __volatile__(
"lwc2 $4, 0( %0 );"
"lwc2 $5, 4( %0 )"
:
: "r"(r0));
}
void SetVertexTri(long *r0, long *r1, long *r2)
{
__asm__ volatile(
"lwc2 $0, 0( %0 );"
"lwc2 $1, 4( %0 );"
"lwc2 $2, 0( %1 );"
"lwc2 $3, 4( %1 );"
"lwc2 $4, 0( %2 );"
"lwc2 $5, 4( %2 )"
:
: "r"(r0), "r"(r1), "r"(r2));
}
void SetRGBfifo(void* r0, void* r1, void* r2)
{
__asm__ __volatile__ (
"lwc2 $20, 0( %0 );"
"lwc2 $21, 0( %1 );"
"lwc2 $22, 0( %2 )"
:
: "r"( r0 ), "r"( r1 ), "r"( r2 )
: "memory" );
}
void SetIR123(long r0, long r1, long r2)
{
__asm__ __volatile__(
"mtc2 %0, $9\n"
"mtc2 %1, $10\n"
"mtc2 %2, $11"
:
: "r"(r0), "r"(r1), "r"(r2));
}
void SetIR0(long r0)
{
__asm__ __volatile__(
"mtc2 %0, $8"
:
: "r"(r0));
}
/* SetSZfifo3 (0x80053A4C) -- handwritten GTE fifo-load wrapper (splat marks it
* "Handwritten function"): three mtc2 stores of the incoming $a0-$a2 words into
* cop2 data registers SZ1/SZ2/SZ3 ($17/$18/$19), then the frameless leaf return.
* gcc-2.7.2 -O2 cannot emit bare cop2 register writes from C, so the body is
* transcribed verbatim as a file-scope asm block (cookbook §265 lane 1,
* func_800D0440 form @ src/md_MAIN_003/md_MAIN_003.c:329): the block carries the
* .globl/.ent directives and the explicit jr $ra + nop tail -- no C codegen and
* no declaration surface at all. No relocations, no symbol references.
*/
__asm__(".text\n.align 2\n.globl SetSZfifo3\n.ent\tSetSZfifo3\n"
"SetSZfifo3:\n"
".set\tnoreorder\n"
"mtc2 $4, $17\n"
"mtc2 $5, $18\n"
"mtc2 $6, $19\n"
"jr $ra\n"
"nop\n"
".set\treorder\n"
".end\tSetSZfifo3\n");
/* probe: naive spelling -- no volatile, no .set noreorder */
void SetSZfifo4()
{
__asm__(
"mtc2 $4, $16\n"
"mtc2 $5, $17\n"
"mtc2 $6, $18\n"
"mtc2 $7, $19\n");
}
void SetSXSYfifo(long r0, long r1, long r2)
{
__asm__ __volatile__(
"mtc2 %0, $12\n"
"mtc2 %1, $13\n"
"mtc2 %2, $14"
:
: "r"(r0), "r"(r1), "r"(r2));
}
void SetRii()
{
__asm__ __volatile__(
".set\tnoreorder\n"
"ctc2 $4, $0\n"
"ctc2 $5, $2\n"
"ctc2 $6, $4\n"
".set\treorder\n");
}
void SetMAC123(long r0, long r1, long r2)
{
__asm__ __volatile__(
"mtc2 %0, $25\n"
"mtc2 %1, $26\n"
"mtc2 %2, $27"
:
: "r"(r0), "r"(r1), "r"(r2));
}
void SetData32(long r0)
{
__asm__ __volatile__(
"mtc2 %0, $30"
:
: "r"(r0));
}
void SetDQA()
{
__asm__ __volatile__(
".set\tnoreorder\n"
"ctc2 $4, $27\n"
".set\treorder\n"
);
}
void SetDQB()
{
__asm__ __volatile__(
".set\tnoreorder\n"
"ctc2 $4, $28\n"
".set\treorder\n"
);
}
void func_80053AD8()
{
__asm__ __volatile__(
".set\tnoreorder\n"
"sll $4, $4, 4\n"
"sll $5, $5, 4\n"
"sll $6, $6, 4\n"
"ctc2 $4, $21\n"
"ctc2 $5, $22\n"
"ctc2 $6, $23\n"
".set\treorder\n"
);
}
+1 -1
View File
@@ -50,7 +50,7 @@ INCLUDE_ASM("asm/nonmatchings/libcd1", func_8004357C);
INCLUDE_ASM("asm/nonmatchings/libcd1", func_8004359C);
INCLUDE_ASM("asm/nonmatchings/libcd1", func_800435B4);
INCLUDE_ASM("asm/nonmatchings/libcd1", CdReadyCallback);
INCLUDE_ASM("asm/nonmatchings/libcd1", func_800435CC);
+17
View File
@@ -0,0 +1,17 @@
#include "common.h"
INCLUDE_ASM("asm/nonmatchings/libgs7", GsSortBg);
INCLUDE_ASM("asm/nonmatchings/libgs7", gfx2D_BG0_OBJ_1B4);
INCLUDE_ASM("asm/nonmatchings/libgs7", gfx2D_BG0_OBJ_4A0);
INCLUDE_ASM("asm/nonmatchings/libgs7", gfx2D_BG0_OBJ_4D8);
INCLUDE_ASM("asm/nonmatchings/libgs7", gfx2D_BG0_OBJ_658);
INCLUDE_ASM("asm/nonmatchings/libgs7", gfx2D_BG0_OBJ_698);
INCLUDE_ASM("asm/nonmatchings/libgs7", GsSortFastBg);
INCLUDE_ASM("asm/nonmatchings/libgs7", gfx2D_BG1_OBJ_648);
+19
View File
@@ -0,0 +1,19 @@
#include "common.h"
INCLUDE_ASM("asm/nonmatchings/libgte23", func_80047D3C);
INCLUDE_ASM("asm/nonmatchings/libgte23", InvSquareRoot);
INCLUDE_ASM("asm/nonmatchings/libgte23", func_80047E58);
INCLUDE_ASM("asm/nonmatchings/libgte23", VectorNormal);
INCLUDE_ASM("asm/nonmatchings/libgte23", VectorNormalSS);
INCLUDE_ASM("asm/nonmatchings/libgte23", func_80047EC8);
INCLUDE_ASM("asm/nonmatchings/libgte23", MatrixNormal);
INCLUDE_ASM("asm/nonmatchings/libgte23", gteMIMefunc);
INCLUDE_ASM("asm/nonmatchings/libgte23", SquareRoot12);
+23
View File
@@ -0,0 +1,23 @@
#include "common.h"
INCLUDE_ASM("asm/nonmatchings/libgte24", LightColor);
INCLUDE_ASM("asm/nonmatchings/libgte24", DpqColorLight);
INCLUDE_ASM("asm/nonmatchings/libgte24", DpqColor3);
INCLUDE_ASM("asm/nonmatchings/libgte24", Intpl);
INCLUDE_ASM("asm/nonmatchings/libgte24", Square12);
INCLUDE_ASM("asm/nonmatchings/libgte24", Square0);
INCLUDE_ASM("asm/nonmatchings/libgte24", AverageZ3);
INCLUDE_ASM("asm/nonmatchings/libgte24", AverageZ4);
INCLUDE_ASM("asm/nonmatchings/libgte24", OuterProduct12);
INCLUDE_ASM("asm/nonmatchings/libgte24", OuterProduct0);
INCLUDE_ASM("asm/nonmatchings/libgte24", func_80049440);
+37
View File
@@ -0,0 +1,37 @@
#include "common.h"
INCLUDE_ASM("asm/nonmatchings/libgte25", func_8004978C);
INCLUDE_ASM("asm/nonmatchings/libgte25", FGO_01_OBJ_64);
INCLUDE_ASM("asm/nonmatchings/libgte25", FGO_01_OBJ_CC);
INCLUDE_ASM("asm/nonmatchings/libgte25", FGO_01_OBJ_160);
INCLUDE_ASM("asm/nonmatchings/libgte25", RotMatrixYXZ);
INCLUDE_ASM("asm/nonmatchings/libgte25", FGO_02_OBJ_68);
INCLUDE_ASM("asm/nonmatchings/libgte25", FGO_02_OBJ_CC);
INCLUDE_ASM("asm/nonmatchings/libgte25", FGO_02_OBJ_160);
INCLUDE_ASM("asm/nonmatchings/libgte25", func_80049CAC);
INCLUDE_ASM("asm/nonmatchings/libgte25", FGO_03_OBJ_64);
INCLUDE_ASM("asm/nonmatchings/libgte25", FGO_03_OBJ_CC);
INCLUDE_ASM("asm/nonmatchings/libgte25", FGO_03_OBJ_160);
INCLUDE_ASM("asm/nonmatchings/libgte25", RotMatrixX);
INCLUDE_ASM("asm/nonmatchings/libgte25", FGO_04_OBJ_64);
INCLUDE_ASM("asm/nonmatchings/libgte25", RotMatrixY);
INCLUDE_ASM("asm/nonmatchings/libgte25", FGO_05_OBJ_64);
INCLUDE_ASM("asm/nonmatchings/libgte25", RotMatrixZ);
INCLUDE_ASM("asm/nonmatchings/libgte25", FGO_06_OBJ_64);
+5
View File
@@ -0,0 +1,5 @@
#include "common.h"
INCLUDE_ASM("asm/nonmatchings/libgte26", func_8004D16C);
INCLUDE_ASM("asm/nonmatchings/libgte26", func_8004D1DC);
+3
View File
@@ -0,0 +1,3 @@
#include "common.h"
INCLUDE_ASM("asm/nonmatchings/libgte27", ApplyMatrix);
+3
View File
@@ -0,0 +1,3 @@
#include "common.h"
INCLUDE_ASM("asm/nonmatchings/libgte28", func_80052430);
+3
View File
@@ -0,0 +1,3 @@
#include "common.h"
INCLUDE_ASM("asm/nonmatchings/libgte29", func_800538BC);
+33
View File
@@ -0,0 +1,33 @@
#include "common.h"
INCLUDE_ASM("asm/nonmatchings/libgte30", SetVertex0);
INCLUDE_ASM("asm/nonmatchings/libgte30", SetVertex1);
INCLUDE_ASM("asm/nonmatchings/libgte30", SetVertex2);
INCLUDE_ASM("asm/nonmatchings/libgte30", SetVertexTri);
INCLUDE_ASM("asm/nonmatchings/libgte30", SetRGBfifo);
INCLUDE_ASM("asm/nonmatchings/libgte30", SetIR123);
INCLUDE_ASM("asm/nonmatchings/libgte30", SetIR0);
INCLUDE_ASM("asm/nonmatchings/libgte30", SetSZfifo3);
INCLUDE_ASM("asm/nonmatchings/libgte30", SetSZfifo4);
INCLUDE_ASM("asm/nonmatchings/libgte30", SetSXSYfifo);
INCLUDE_ASM("asm/nonmatchings/libgte30", SetRii);
INCLUDE_ASM("asm/nonmatchings/libgte30", SetMAC123);
INCLUDE_ASM("asm/nonmatchings/libgte30", SetData32);
INCLUDE_ASM("asm/nonmatchings/libgte30", SetDQA);
INCLUDE_ASM("asm/nonmatchings/libgte30", SetDQB);
INCLUDE_ASM("asm/nonmatchings/libgte30", func_80053AD8);
+1 -1
View File
@@ -1,3 +1,3 @@
#include "common.h"
INCLUDE_ASM("asm/nonmatchings/libgte9", func_80049600);
INCLUDE_ASM("asm/nonmatchings/libgte9", func_800495EC);
-400
View File
@@ -1,400 +0,0 @@
#include "common.h"
__asm__(
".text\n"
".align\t2\n"
".globl\tvmNoiseOn\n"
".type\tvmNoiseOn, @function\n"
".ent\tvmNoiseOn\n"
"vmNoiseOn:\n"
".set\tnoreorder\n"
"lui $v1, %hi(D_800B9B36)\n"
"lhu $v1, %lo(D_800B9B36)($v1)\n"
"addu $t2, $a0, $zero\n"
"andi $a0, $v1, 0xFF\n"
"sll $a0, $a0, 2\n"
"srl $v1, $v1, 8\n"
"sll $v0, $v1, 1\n"
"addu $v0, $v0, $v1\n"
"sll $v0, $v0, 2\n"
"subu $v0, $v0, $v1\n"
"lui $at, %hi(D_800C73D8)\n"
"addu $at, $at, $a0\n"
"lw $a0, %lo(D_800C73D8)($at)\n"
"sll $v0, $v0, 4\n"
"addu $a0, $a0, $v0\n"
"lhu $v0, 88($a0)\n"
"lui $v1, %hi(D_800B9B2A)\n"
"lbu $v1, %lo(D_800B9B2A)($v1)\n"
"sll $a1, $v0, 7\n"
"addu $a1, $a1, $v0\n"
"mult $a1, $v1\n"
"lhu $a0, 90($a0)\n"
"mflo $a1\n"
"sll $v0, $a0, 7\n"
"addu $a3, $v0, $a0\n"
"mult $a3, $v1\n"
"mflo $v1\n"
"lui $a2, 0x204\n"
"ori $a2, $a2, 0x811\n"
"multu $a1, $a2\n"
"mfhi $v0\n"
"nop\n"
"nop\n"
"multu $v1, $a2\n"
"lui $a0, %hi(D_800B9B2D)\n"
"lbu $a0, %lo(D_800B9B2D)($a0)\n"
"subu $a1, $a1, $v0\n"
"srl $a1, $a1, 1\n"
"mfhi $a3\n"
"addu $v0, $v0, $a1\n"
"srl $a1, $v0, 6\n"
"mult $a1, $a0\n"
"subu $v1, $v1, $a3\n"
"srl $v1, $v1, 1\n"
"mflo $a1\n"
"addu $a3, $a3, $v1\n"
"srl $a3, $a3, 6\n"
"mult $a3, $a0\n"
"mflo $a0\n"
"nop\n"
"nop\n"
"multu $a1, $a2\n"
"mfhi $v0\n"
"nop\n"
"nop\n"
"multu $a0, $a2\n"
"addiu $sp, $sp, -8\n"
"lui $v1, %hi(D_8006B8FC)\n"
"lw $v1, %lo(D_8006B8FC)($v1)\n"
"lui $t0, %hi(D_800B9B2E)\n"
"lbu $t0, %lo(D_800B9B2E)($t0)\n"
"lhu $t1, 426($v1)\n"
"subu $a1, $a1, $v0\n"
"srl $a1, $a1, 1\n"
"addu $v0, $v0, $a1\n"
"srl $a1, $v0, 6\n"
"sltiu $v0, $t0, 0x40\n"
"mfhi $a2\n"
"subu $a0, $a0, $a2\n"
"srl $a0, $a0, 1\n"
"addu $a2, $a2, $a0\n"
"beqz $v0, .L800404F4\n"
" srl $a3, $a2, 6\n"
"mult $a3, $t0\n"
"mflo $v0\n"
"lui $v1, 0x410\n"
"ori $v1, $v1, 0x4105\n"
"multu $v0, $v1\n"
"mfhi $v1\n"
"subu $v0, $v0, $v1\n"
"srl $v0, $v0, 1\n"
"addu $v1, $v1, $v0\n"
"j VM_NO1_OBJ_184\n"
" srl $a2, $v1, 5\n"
".L800404F4:\n"
"addiu $v0, $zero, 0x7F\n"
"subu $v0, $v0, $t0\n"
"mult $a1, $v0\n"
"mflo $v0\n"
"lui $v1, 0x410\n"
"ori $v1, $v1, 0x4105\n"
"multu $v0, $v1\n"
"addu $a2, $a3, $zero\n"
"mfhi $v1\n"
"subu $v0, $v0, $v1\n"
"srl $v0, $v0, 1\n"
"addu $v1, $v1, $v0\n"
"srl $a1, $v1, 5\n"
".set\treorder\n"
".size\tvmNoiseOn, . - vmNoiseOn\n"
".end\tvmNoiseOn\n"
);
__asm__(
".text\n"
".align\t2\n"
".globl\tVM_NO1_OBJ_184\n"
".type\tVM_NO1_OBJ_184, @function\n"
".ent\tVM_NO1_OBJ_184\n"
"VM_NO1_OBJ_184:\n"
".set\tnoreorder\n"
"lui $t0, %hi(D_800B9B2B)\n"
"lbu $t0, %lo(D_800B9B2B)($t0)\n"
"nop\n"
"sltiu $v0, $t0, 0x40\n"
"beqz $v0, .L80040568\n"
" mult $a2, $t0\n"
"mflo $v0\n"
"lui $v1, 0x0410\n"
"ori $v1, $v1, 0x4105\n"
"multu $v0, $v1\n"
"mfhi $v1\n"
"subu $v0, $v0, $v1\n"
"srl $v0, $v0, 1\n"
"addu $v1, $v1, $v0\n"
"j VM_NO1_OBJ_1F4\n"
" srl $a2, $v1, 5\n"
".L80040568:\n"
"addiu $v0, $zero, 0x7F\n"
"subu $v0, $v0, $t0\n"
"mult $a1, $v0\n"
"mflo $v0\n"
"lui $v1, 0x0410\n"
"ori $v1, $v1, 0x4105\n"
"multu $v0, $v1\n"
"mfhi $v1\n"
"subu $v0, $v0, $v1\n"
"srl $v0, $v0, 1\n"
"addu $v1, $v1, $v0\n"
"srl $a1, $v1, 5\n"
".set\treorder\n"
".size\tVM_NO1_OBJ_184, . - VM_NO1_OBJ_184\n"
".end\tVM_NO1_OBJ_184\n"
);
__asm__(
".text\n"
".align\t2\n"
".globl\tVM_NO1_OBJ_1F4\n"
".type\tVM_NO1_OBJ_1F4, @function\n"
".ent\tVM_NO1_OBJ_1F4\n"
"VM_NO1_OBJ_1F4:\n"
".set\tnoreorder\n"
"lui $t0, %hi(D_800B9B25)\n"
"lbu $t0, %lo(D_800B9B25)($t0)\n"
"nop\n"
"sltiu $v0, $t0, 0x40\n"
"beqz $v0, .L800405D8\n"
" mult $t0, $a2\n"
"mflo $v0\n"
"lui $v1, 0x410\n"
"ori $v1, $v1, 0x4105\n"
"multu $v0, $v1\n"
"mfhi $v1\n"
"subu $v0, $v0, $v1\n"
"srl $v0, $v0, 1\n"
"addu $v1, $v1, $v0\n"
"j VM_NO1_OBJ_264\n"
" srl $a2, $v1, 5\n"
".L800405D8:\n"
"addiu $v0, $zero, 0x7F\n"
"subu $v0, $v0, $t0\n"
"mult $a1, $v0\n"
"mflo $v0\n"
"lui $v1, 0x410\n"
"ori $v1, $v1, 0x4105\n"
"multu $v0, $v1\n"
"mfhi $v1\n"
"subu $v0, $v0, $v1\n"
"srl $v0, $v0, 1\n"
"addu $v1, $v1, $v0\n"
"srl $a1, $v1, 5\n"
".set\treorder\n"
".size\tVM_NO1_OBJ_1F4, . - VM_NO1_OBJ_1F4\n"
".end\tVM_NO1_OBJ_1F4\n"
);
__asm__(
".text\n"
".align\t2\n"
".globl\tVM_NO1_OBJ_264\n"
".ent\tVM_NO1_OBJ_264\n"
"VM_NO1_OBJ_264:\n"
".set\tnoreorder\n"
"lui $v1, %hi(D_800A6434)\n"
"lh $v1, %lo(D_800A6434)($v1)\n"
"addiu $v0, $zero, 0x1\n"
"bne $v1, $v0, .L80040630\n"
" .word 0x00A6102B\n"
"beqz $v0, .L8004062C\n"
" nop\n"
"j VM_NO1_OBJ_28C\n"
" addu $a1, $a2, $zero\n"
".L8004062C:\n"
"addu $a2, $a1, $zero\n"
".L80040630:\n"
".set\treorder\n"
".end\tVM_NO1_OBJ_264\n"
);
__asm__(
".text\n"
".align 2\n"
".globl VM_NO1_OBJ_28C\n"
".ent\tVM_NO1_OBJ_28C\n"
"VM_NO1_OBJ_28C:\n"
".frame $sp,0,$31\n"
".mask 0,0\n"
".fmask 0,0\n"
".set\tnoreorder\n"
"lui $v0, %hi(D_800B9B22)\n"
"lbu $v0, %lo(D_800B9B22)($v0)\n"
"lui $v1, %hi(D_800B9B30)\n"
"lbu $v1, %lo(D_800B9B30)($v1)\n"
"andi $a0, $t1, 0xC0FF\n"
"subu $v0, $v0, $v1\n"
"andi $v0, $v0, 0x3F\n"
"sll $v0, $v0, 8\n"
"or $t1, $a0, $v0\n"
"lui $v1, %hi(D_8006B8FC)\n"
"lw $v1, %lo(D_8006B8FC)($v1)\n"
"andi $a0, $t2, 0xFF\n"
"sh $t1, 426($v1)\n"
"sll $v1, $a0, 4\n"
"lui $at, %hi(D_800B9B5A)\n"
"addu $at, $at, $v1\n"
"sh $a2, %lo(D_800B9B5A)($at)\n"
"lui $at, %hi(D_800A4620)\n"
"addu $at, $at, $a0\n"
"lbu $v0, %lo(D_800A4620)($at)\n"
"lui $at, %hi(D_800B9B58)\n"
"addu $at, $at, $v1\n"
"sh $a1, %lo(D_800B9B58)($at)\n"
"ori $v0, $v0, 0x3\n"
"lui $at, %hi(D_800A4620)\n"
"addu $at, $at, $a0\n"
"sb $v0, %lo(D_800A4620)($at)\n"
"sltiu $v0, $a0, 0x10\n"
"beqz $v0, .L800406B4\n"
"addiu $v0, $zero, 0x1\n"
"sllv $a3, $v0, $a0\n"
"j VM_NO1_OBJ_31C\n"
"addu $a2, $zero, $zero\n"
".L800406B4:\n"
"addu $a3, $zero, $zero\n"
"addiu $v1, $a0, -0x10\n"
"sllv $a2, $v0, $v1\n"
".set\treorder\n"
".end\tVM_NO1_OBJ_28C\n");
__asm__(
".text\n"
".align\t2\n"
".globl\tVM_NO1_OBJ_31C\n"
".type\tVM_NO1_OBJ_31C, @function\n"
".ent\tVM_NO1_OBJ_31C\n"
"VM_NO1_OBJ_31C:\n"
".frame\t$sp,0,$31\n"
".mask\t0x00000000,0\n"
".fmask\t0x00000000,0\n"
".set\tnoreorder\n"
"andi $v1, $t2, 0xFF\n"
"sll $v0, $v1, 1\n"
"addu $v0, $v0, $v1\n"
"sll $v0, $v0, 2\n"
"addu $v0, $v0, $v1\n"
"sll $v0, $v0, 2\n"
"lui $a0, %hi(D_800AE614)\n"
"lbu $a0, %lo(D_800AE614)($a0)\n"
"addiu $v1, $zero, 0xA\n"
"lui $at, %hi(D_8007958C)\n"
"addu $at, $at, $v0\n"
"sh $v1, %lo(D_8007958C)($at)\n"
"beqz $a0, .L80040754\n"
"addu $a1, $zero, $zero\n"
"sll $v1, $a1, 16\n"
".L800406FC:\n"
"sra $v1, $v1, 16\n"
"sll $v0, $v1, 1\n"
"addu $v0, $v0, $v1\n"
"sll $v0, $v0, 2\n"
"addu $v0, $v0, $v1\n"
"sll $v0, $v0, 2\n"
"addiu $v1, $a1, 0x1\n"
"addu $a1, $v1, $zero\n"
"lui $at, %hi(D_800795A3)\n"
"addu $at, $at, $v0\n"
"lbu $a0, %lo(D_800795A3)($at)\n"
"sll $v1, $v1, 16\n"
"andi $a0, $a0, 0x1\n"
"lui $at, %hi(D_800795A3)\n"
"addu $at, $at, $v0\n"
"sb $a0, %lo(D_800795A3)($at)\n"
"lui $v0, %hi(D_800AE614)\n"
"lbu $v0, %lo(D_800AE614)($v0)\n"
"sra $v1, $v1, 16\n"
"slt $v1, $v1, $v0\n"
"bnez $v1, .L800406FC\n"
"sll $v1, $a1, 16\n"
".L80040754:\n"
"andi $v1, $t2, 0xFF\n"
"sll $v0, $v1, 1\n"
"addu $v0, $v0, $v1\n"
"sll $v0, $v0, 2\n"
"addu $v0, $v0, $v1\n"
"sll $v0, $v0, 2\n"
"addiu $v1, $zero, 0x2\n"
"lui $at, %hi(D_800795A3)\n"
"addu $at, $at, $v0\n"
"sb $v1, %lo(D_800795A3)($at)\n"
"lui $v1, %hi(D_80078D8C)\n"
"lhu $v1, %lo(D_80078D8C)($v1)\n"
"lui $a0, %hi(D_80078D8E)\n"
"lhu $a0, %lo(D_80078D8E)($a0)\n"
"lui $v0, %hi(D_800C7F04)\n"
"lhu $v0, %lo(D_800C7F04)($v0)\n"
"or $v1, $v1, $a3\n"
"or $a0, $a0, $a2\n"
"lui $at, %hi(D_80078D8C)\n"
"sh $v1, %lo(D_80078D8C)($at)\n"
"nor $v1, $zero, $v1\n"
"and $v0, $v0, $v1\n"
"lui $at, %hi(D_80078D8E)\n"
"sh $a0, %lo(D_80078D8E)($at)\n"
"nor $a0, $zero, $a0\n"
"lui $at, %hi(D_800C7F04)\n"
"sh $v0, %lo(D_800C7F04)($at)\n"
"lui $v0, %hi(D_800C7F06)\n"
"lhu $v0, %lo(D_800C7F06)($v0)\n"
"lui $v1, %hi(D_800B9B34)\n"
"lbu $v1, %lo(D_800B9B34)($v1)\n"
"and $v0, $v0, $a0\n"
"andi $v1, $v1, 0x4\n"
"lui $at, %hi(D_800C7F06)\n"
"sh $v0, %lo(D_800C7F06)($at)\n"
"beqz $v1, .L80040818\n"
"nor $v1, $zero, $a3\n"
"lui $v0, %hi(D_80078D90)\n"
"lhu $v0, %lo(D_80078D90)($v0)\n"
"lui $v1, %hi(D_80078D92)\n"
"lhu $v1, %lo(D_80078D92)($v1)\n"
"or $v0, $v0, $a3\n"
"or $v1, $v1, $a2\n"
"lui $at, %hi(D_80078D90)\n"
"sh $v0, %lo(D_80078D90)($at)\n"
"lui $at, %hi(D_80078D92)\n"
"sh $v1, %lo(D_80078D92)($at)\n"
"j VM_NO1_OBJ_4A4\n"
"nop\n"
".L80040818:\n"
"lui $v0, %hi(D_80078D90)\n"
"lhu $v0, %lo(D_80078D90)($v0)\n"
"nop\n"
"and $v0, $v0, $v1\n"
"lui $at, %hi(D_80078D90)\n"
"sh $v0, %lo(D_80078D90)($at)\n"
"lui $v0, %hi(D_80078D92)\n"
"lhu $v0, %lo(D_80078D92)($v0)\n"
"nor $v1, $zero, $a2\n"
"and $v0, $v0, $v1\n"
"lui $at, %hi(D_80078D92)\n"
"sh $v0, %lo(D_80078D92)($at)\n"
".set\treorder\n"
".end\tVM_NO1_OBJ_31C\n"
);
extern u32 D_8006B8FC;
void VM_NO1_OBJ_4A4() {
__asm__ __volatile__(
".set\tnoreorder\n"
"lui\t$v0, %hi(D_8006B8FC)\n"
"lw\t$v0, %lo(D_8006B8FC)($v0)\n"
"nop\n"
"sh\t$a3, 404($v0)\n"
"sh\t$a2, 406($v0)\n"
"addiu\t$sp, $sp, 8\n"
".set\treorder\n");
}
-421
View File
@@ -1,426 +1,5 @@
#include "common.h"
__asm__(
".text\n"
".align\t2\n"
".globl\t_SsVmKeyOnNow\n"
".type\t_SsVmKeyOnNow, @function\n"
".ent\t_SsVmKeyOnNow\n"
"_SsVmKeyOnNow:\n"
".set\tnoreorder\n"
"lui $v0, %hi(D_800A6580)\n"
"lw $v0, %lo(D_800A6580)($v0)\n"
"nop\n"
"lbu $a0, 24($v0)\n"
"lui $v1, %hi(D_800B9B24)\n"
"lbu $v1, %lo(D_800B9B24)($v1)\n"
"sll $v0, $a0, 14\n"
"subu $v0, $v0, $a0\n"
"mult $v1, $v0\n"
"mflo $v1\n"
"lui $v0, 0x8206\n"
"ori $v0, $v0, 0x1029\n"
"mult $v1, $v0\n"
"lui $a0, %hi(D_800B9B2A)\n"
"lbu $a0, %lo(D_800B9B2A)($a0)\n"
"mfhi $v0\n"
"addu $v0, $v0, $v1\n"
"sra $v0, $v0, 13\n"
"sra $v1, $v1, 31\n"
"subu $a3, $v0, $v1\n"
"mult $a3, $a0\n"
"mflo $v1\n"
"lui $v0, %hi(D_800B9B2D)\n"
"lbu $v0, %lo(D_800B9B2D)($v0)\n"
"nop\n"
"mult $v1, $v0\n"
"mflo $v0\n"
"lui $a0, 0x040C\n"
"ori $a0, $a0, 0x2051\n"
"multu $v0, $a0\n"
"addiu $sp, $sp, -16\n"
"lui $v1, %hi(D_800B9B3A)\n"
"lh $v1, %lo(D_800B9B3A)($v1)\n"
"addu $t0, $a1, $zero\n"
"sll $t1, $v1, 3\n"
"lui $v1, %hi(D_800B9B36)\n"
"lhu $v1, %lo(D_800B9B36)($v1)\n"
"mfhi $a0\n"
"subu $v0, $v0, $a0\n"
"srl $v0, $v0, 1\n"
"addu $a0, $a0, $v0\n"
"srl $a2, $a0, 13\n"
"andi $a0, $v1, 0xFF\n"
"sll $a0, $a0, 2\n"
"sll $v1, $v1, 16\n"
"sra $a1, $v1, 16\n"
"srl $v1, $v1, 24\n"
"sll $v0, $v1, 1\n"
"addu $v0, $v0, $v1\n"
"sll $v0, $v0, 2\n"
"subu $v0, $v0, $v1\n"
"lui $at, %hi(D_800C73D8)\n"
"addu $at, $at, $a0\n"
"lw $v1, %lo(D_800C73D8)($at)\n"
"sll $v0, $v0, 4\n"
"addu $v1, $v1, $v0\n"
"addiu $v0, $zero, 0x21\n"
"beq $a1, $v0, .L80040A84\n"
" addu $a3, $a2, $zero\n"
"lhu $v0, 88($v1)\n"
"nop\n"
"mult $a2, $v0\n"
"mflo $v0\n"
"lhu $v1, 90($v1)\n"
"nop\n"
"mult $a2, $v1\n"
"mflo $v1\n"
"lui $a0, 0x0204\n"
"ori $a0, $a0, 0x0811\n"
"multu $v0, $a0\n"
"mfhi $a1\n"
"nop\n"
"nop\n"
"multu $v1, $a0\n"
"subu $v0, $v0, $a1\n"
"srl $v0, $v0, 1\n"
"addu $a1, $a1, $v0\n"
"srl $a3, $a1, 6\n"
"mfhi $a0\n"
"subu $v1, $v1, $a0\n"
"srl $v1, $v1, 1\n"
"addu $a0, $a0, $v1\n"
"srl $a2, $a0, 6\n"
".L80040A84:\n"
"lui $v1, %hi(D_800B9B2E)\n"
"lbu $v1, %lo(D_800B9B2E)($v1)\n"
"nop\n"
"sltiu $v0, $v1, 0x40\n"
"beqz $v0, .L80040AC8\n"
" mult $a2, $v1\n"
"mflo $v0\n"
"lui $v1, 0x0410\n"
"ori $v1, $v1, 0x4105\n"
"multu $v0, $v1\n"
"addu $a1, $a3, $zero\n"
"mfhi $v1\n"
"subu $v0, $v0, $v1\n"
"srl $v0, $v0, 1\n"
"addu $v1, $v1, $v0\n"
"j VM_NOWON_OBJ_1C0\n"
" srl $a2, $v1, 5\n"
".L80040AC8:\n"
"addiu $v0, $zero, 0x7F\n"
"subu $v0, $v0, $v1\n"
"mult $a3, $v0\n"
"mflo $v0\n"
"lui $v1, 0x0410\n"
"ori $v1, $v1, 0x4105\n"
"multu $v0, $v1\n"
"mfhi $v1\n"
"subu $v0, $v0, $v1\n"
"srl $v0, $v0, 1\n"
"addu $v1, $v1, $v0\n"
"srl $a1, $v1, 5\n"
".set\treorder\n"
".size\t_SsVmKeyOnNow, . - _SsVmKeyOnNow\n"
".end\t_SsVmKeyOnNow\n"
);
__asm__(
".text\n"
".align\t2\n"
".globl\tVM_NOWON_OBJ_1C0\n"
".type\tVM_NOWON_OBJ_1C0, @function\n"
".ent\tVM_NOWON_OBJ_1C0\n"
"VM_NOWON_OBJ_1C0:\n"
".set\tnoreorder\n"
"lui $v1, %hi(D_800B9B2B)\n"
"lbu $v1, %lo(D_800B9B2B)($v1)\n"
"nop\n"
"sltiu $v0, $v1, 0x40\n"
"beqz $v0, .L80040B38\n"
" mult $a2, $v1\n"
"mflo $v0\n"
"lui $v1, 0x410\n"
"ori $v1, $v1, 0x4105\n"
"multu $v0, $v1\n"
"mfhi $v1\n"
"subu $v0, $v0, $v1\n"
"srl $v0, $v0, 1\n"
"addu $v1, $v1, $v0\n"
"j VM_NOWON_OBJ_230\n"
" srl $a2, $v1, 5\n"
".L80040B38:\n"
"addiu $v0, $zero, 0x7F\n"
"subu $v0, $v0, $v1\n"
"mult $a1, $v0\n"
"mflo $v0\n"
"lui $v1, 0x410\n"
"ori $v1, $v1, 0x4105\n"
"multu $v0, $v1\n"
"mfhi $v1\n"
"subu $v0, $v0, $v1\n"
"srl $v0, $v0, 1\n"
"addu $v1, $v1, $v0\n"
"srl $a1, $v1, 5\n"
".set\treorder\n"
".size\tVM_NOWON_OBJ_1C0, . - VM_NOWON_OBJ_1C0\n"
".end\tVM_NOWON_OBJ_1C0\n"
);
__asm__(
".text\n"
".align\t2\n"
".globl\tVM_NOWON_OBJ_230\n"
".type\tVM_NOWON_OBJ_230, @function\n"
".ent\tVM_NOWON_OBJ_230\n"
"VM_NOWON_OBJ_230:\n"
".set\tnoreorder\n"
"lui $v1, %hi(D_800B9B25)\n"
"lbu $v1, %lo(D_800B9B25)($v1)\n"
"nop\n"
"sltiu $v0, $v1, 0x40\n"
"beqz $v0, .L80040BA8\n"
" mult $a2, $v1\n"
"mflo $v0\n"
"lui $v1, 0x410\n"
"ori $v1, $v1, 0x4105\n"
"multu $v0, $v1\n"
"mfhi $v1\n"
"subu $v0, $v0, $v1\n"
"srl $v0, $v0, 1\n"
"addu $v1, $v1, $v0\n"
"j VM_NOWON_OBJ_2A0\n"
" srl $a2, $v1, 5\n"
".L80040BA8:\n"
"addiu $v0, $zero, 0x7F\n"
"subu $v0, $v0, $v1\n"
"mult $a1, $v0\n"
"mflo $v0\n"
"lui $v1, 0x410\n"
"ori $v1, $v1, 0x4105\n"
"multu $v0, $v1\n"
"mfhi $v1\n"
"subu $v0, $v0, $v1\n"
"srl $v0, $v0, 1\n"
"addu $v1, $v1, $v0\n"
"srl $a1, $v1, 5\n"
".set\treorder\n"
".size\tVM_NOWON_OBJ_230, . - VM_NOWON_OBJ_230\n"
".end\tVM_NOWON_OBJ_230\n"
);
/*
* VM_NOWON_OBJ_2A0 -- cookbook §179-C: the target has NO trailing jr $ra. Every exit is either a
* raw `bne`/`j VM_NOWON_OBJ_2C8` (args already live in $a0-$a2) or a one-instruction join block
* (`addu $a2,$a1,$zero` at 0x80040BFC) that FALLS THROUGH into VM_NOWON_OBJ_2C8 at 0x80040C00 --
* the callee owns the shared epilogue for this fallthrough chain (230 -> 2A0 -> 2C8 -> 3D4).
* gcc-2.7.2 has no sibcall/tail-merge and unconditionally appends its own return sequence to
* every ordinary C function (function.c:expand_function_end), so a C-bodied spelling can only
* reach +2 instructions (phantom jr/nop). FILE-SCOPE asm is the only spelling that emits exactly
* the target bytes: cc1 copies the blob verbatim, no .ent-triggered epilogue machinery runs.
* Literal tab-separated ".ent"/".end" text is load-bearing (maspsx process_line special-cases
* lines starting with ".ent\t"); "glabel" would leave `as` in reorder mode and scramble the
* hand-placed delay slots. In file-scope asm % is literal, so %hi/%lo stay un-doubled.
*
* MASPSX CRACK: maspsx raises "not enough values to unpack (expected 3, got 2)" on the bare
* mnemonic `sltu` -- proven by isolation bisect (head-only compiles; head+sltu alone crashes;
* every crashing variant contained sltu, every passing one lacked it). The instruction is
* therefore emitted as its raw word 0x00A6102B (== sltu $v0,$a1,$a2, byte-identical to the
* target column), which passes through maspsx untouched -- §179-C's sanctioned raw-.word escape.
*
* BNE SPELLING (gate-driven): the target's bne displacement is +6 == 0x80040C00 == the first
* instruction AFTER this blob, so it is spelled against a LOCAL .L label placed at the blob's
* end. That encodes 0x14620006 at assembly time, independent of TU emission order. The
* external-symbol spelling is NOT verifiable by match_one (R_MIPS_PC16 is masked 0xFFFF0000,
* §195-D/tooling-audit) and resolved against the real TU's layout at the gate, where it failed;
* the local-label form is byte-identical and layout-independent. The j (R_MIPS_26,
* position-independent within the region) keeps the target's own symbol.
*/
__asm__(
".text\n"
".align\t2\n"
".globl\tVM_NOWON_OBJ_2A0\n"
".ent\tVM_NOWON_OBJ_2A0\n"
"VM_NOWON_OBJ_2A0:\n"
".set\tnoreorder\n"
"lui $v1, %hi(D_800A6434)\n"
"lh $v1, %lo(D_800A6434)($v1)\n"
"addiu $v0, $zero, 0x1\n"
"bne $v1, $v0, .L80040C00\n"
" .word 0x00A6102B\n"
"beqz $v0, .L80040BFC\n"
" nop\n"
"j VM_NOWON_OBJ_2C8\n"
" addu $a1, $a2, $zero\n"
".L80040BFC:\n"
"addu $a2, $a1, $zero\n"
".L80040C00:\n"
".set\treorder\n"
".end\tVM_NOWON_OBJ_2A0\n"
);
/*
* VM_NOWON_OBJ_2C8 -- no epilogue: the not-taken arm FALLS THROUGH into
* VM_NOWON_OBJ_3D4's own code (which owns the shared tail). gcc-2.7.2 has no
* sibcall / cross-function tail-merge pass (matching-cookbook.md §179-C) and
* unconditionally appends its own return sequence to any ordinary C function
* body, so this can only be written as FILE-SCOPE __asm__ -- opaque text the
* compiler never runs expand_function_end over. Literal ".ent"/".end" (not
* glabel) so maspsx sees the boundary and leaves our hand-written delay slots
* and mult/mflo hazard nops alone; %hi/%lo un-doubled (file-scope asm).
*
* Placement: this block takes the INCLUDE_ASM(..., VM_NOWON_OBJ_2C8) slot.
* The TU's own INCLUDE_ASM(..., VM_NOWON_OBJ_3D4) follows on the next line --
* do NOT add a second one here (duplicate glabel breaks the link).
*/
__asm__(
".text\n"
".align\t2\n"
".globl\tVM_NOWON_OBJ_2C8\n"
".ent\tVM_NOWON_OBJ_2C8\n"
"VM_NOWON_OBJ_2C8:\n"
".frame\t$sp,0,$31\n"
".mask\t0x00000000,0\n"
".fmask\t0x00000000,0\n"
".set\tnoreorder\n"
"mult $5, $5\n"
"mflo $3\n"
"nop\n"
"nop\n"
"mult $6, $6\n"
"mflo $6\n"
"lui $2, 0x4\n"
"ori $2, $2, 0x11\n"
"multu $3, $2\n"
"mfhi $5\n"
"nop\n"
"nop\n"
"multu $6, $2\n"
"andi $4, $9, 0xFFFF\n"
"sll $4, $4, 1\n"
"lui $1, %hi(D_800B9B5C)\n"
"addu $1, $1, $4\n"
"sh $8, %lo(D_800B9B5C)($1)\n"
"subu $3, $3, $5\n"
"srl $3, $3, 1\n"
"addu $5, $5, $3\n"
"srl $5, $5, 13\n"
"lui $3, %hi(D_800B9B5C)\n"
"addiu $3, $3, %lo(D_800B9B5C)\n"
"mfhi $2\n"
"subu $6, $6, $2\n"
"srl $6, $6, 1\n"
"addu $2, $2, $6\n"
"srl $6, $2, 13\n"
"addiu $2, $3, -4\n"
"addu $2, $4, $2\n"
"addiu $3, $3, -2\n"
"addu $4, $4, $3\n"
"sh $5, 0($2)\n"
"sh $6, 0($4)\n"
"lui $4, %hi(D_800B9B3A)\n"
"addiu $4, $4, %lo(D_800B9B3A)\n"
"lh $3, 0($4)\n"
"lui $1, %hi(D_800A4620)\n"
"addu $1, $1, $3\n"
"lbu $2, %lo(D_800A4620)($1)\n"
"nop\n"
"ori $2, $2, 0x7\n"
"lui $1, %hi(D_800A4620)\n"
"addu $1, $1, $3\n"
"sb $2, %lo(D_800A4620)($1)\n"
"lh $3, 0($4)\n"
"nop\n"
"sll $2, $3, 1\n"
"addu $2, $2, $3\n"
"sll $2, $2, 2\n"
"addu $2, $2, $3\n"
"sll $2, $2, 2\n"
"lui $1, %hi(D_8007958C)\n"
"addu $1, $1, $2\n"
"sh $8, %lo(D_8007958C)($1)\n"
"lh $3, 0($4)\n"
"nop\n"
"slti $2, $3, 0x10\n"
"beqz $2, 1f\n"
"addiu $2, $0, 0x1\n"
"sllv $6, $2, $3\n"
"j VM_NOWON_OBJ_3D4\n"
"addu $5, $0, $0\n"
"1:\n"
"addu $6, $0, $0\n"
"addiu $3, $3, -0x10\n"
"sllv $5, $2, $3\n"
".set\treorder\n"
".end\tVM_NOWON_OBJ_2C8\n"
);
__asm__(".text\n.align 2\n.globl VM_NOWON_OBJ_3D4\n.ent VM_NOWON_OBJ_3D4\n"
"VM_NOWON_OBJ_3D4:\n"
".frame $sp,16,$31\n.mask 0,0\n.fmask 0,0\n.set noreorder\n"
"lui $v0, %hi(D_800B9B34)\n"
"lbu $v0, %lo(D_800B9B34)($v0)\n"
"nop\n"
"andi $v0, $v0, 4\n"
"beqz $v0, .L80040D54\n"
"nor $v1, $zero, $a2\n"
"lui $v0, %hi(D_80078D90)\n"
"lhu $v0, %lo(D_80078D90)($v0)\n"
"lui $v1, %hi(D_80078D92)\n"
"lhu $v1, %lo(D_80078D92)($v1)\n"
"or $v0, $v0, $a2\n"
"or $v1, $v1, $a1\n"
"lui $at, %hi(D_80078D90)\n"
"sh $v0, %lo(D_80078D90)($at)\n"
"lui $at, %hi(D_80078D92)\n"
"sh $v1, %lo(D_80078D92)($at)\n"
"j VM_NOWON_OBJ_44C\n"
".L80040D54:\n"
"lui $v0, %hi(D_80078D90)\n"
"lhu $v0, %lo(D_80078D90)($v0)\n"
"nop\n"
"and $v0, $v0, $v1\n"
"lui $at, %hi(D_80078D90)\n"
"sh $v0, %lo(D_80078D90)($at)\n"
"lui $v0, %hi(D_80078D92)\n"
"lhu $v0, %lo(D_80078D92)($v0)\n"
"nor $v1, $zero, $a1\n"
"and $v0, $v0, $v1\n"
"lui $at, %hi(D_80078D92)\n"
"sh $v0, %lo(D_80078D92)($at)\n"
".set reorder\n.end VM_NOWON_OBJ_3D4\n");
void VM_NOWON_OBJ_44C(s32 arg0, s32 arg1, s32 arg2) {
extern u16 D_80078D8C;
extern u16 D_80078D8E;
extern u16 D_800C7F04;
extern u16 D_800C7F06;
u16 a = D_80078D8C;
u16 b = D_80078D8E;
register u16 m __asm__("2");
__asm__ __volatile__("" ::: "memory");
m = D_800C7F04;
a |= arg2;
D_80078D8C = a;
__asm__ __volatile__("" ::: "memory");
m &= ~a;
D_800C7F04 = m;
m = D_800C7F06;
b |= arg1;
D_80078D8E = b;
__asm__ __volatile__("" ::: "memory");
m &= ~b;
D_800C7F06 = m;
__asm__ __volatile__("addiu $sp,$sp,0x10" ::: "memory");
}
extern s32 D_800C73D8[];
extern s16 D_800B9B36;
extern u8 D_800AE614;
+15
View File
@@ -0,0 +1,15 @@
#include "common.h"
INCLUDE_ASM("asm/nonmatchings/snd10", vmNoiseOn);
INCLUDE_ASM("asm/nonmatchings/snd10", VM_NO1_OBJ_184);
INCLUDE_ASM("asm/nonmatchings/snd10", VM_NO1_OBJ_1F4);
INCLUDE_ASM("asm/nonmatchings/snd10", VM_NO1_OBJ_264);
INCLUDE_ASM("asm/nonmatchings/snd10", VM_NO1_OBJ_28C);
INCLUDE_ASM("asm/nonmatchings/snd10", VM_NO1_OBJ_31C);
INCLUDE_ASM("asm/nonmatchings/snd10", VM_NO1_OBJ_4A4);
+15
View File
@@ -0,0 +1,15 @@
#include "common.h"
INCLUDE_ASM("asm/nonmatchings/snd11", _SsVmKeyOnNow);
INCLUDE_ASM("asm/nonmatchings/snd11", VM_NOWON_OBJ_1C0);
INCLUDE_ASM("asm/nonmatchings/snd11", VM_NOWON_OBJ_230);
INCLUDE_ASM("asm/nonmatchings/snd11", VM_NOWON_OBJ_2A0);
INCLUDE_ASM("asm/nonmatchings/snd11", VM_NOWON_OBJ_2C8);
INCLUDE_ASM("asm/nonmatchings/snd11", VM_NOWON_OBJ_3D4);
INCLUDE_ASM("asm/nonmatchings/snd11", VM_NOWON_OBJ_44C);
+2 -2
View File
@@ -27,7 +27,7 @@ set -euo pipefail
cd "$(dirname "$0")/.."
LIBGS=.run/obj40/libgs
DST=.run/obj40/libgs_used
OBJS=(2D_COM0 2D_LIN0 2D_COM1 2D_SP0 2D_SP1 \
OBJS=(2D_COM0 2D_LIN0 2D_COM1 2D_SP0 2D_SP1 2D_BG0 2D_BG1 \
GS_002 GS_003 MATRIX GS_103 GS_104 GS_105 GS_106 GS_107 GS_108 GS_109 \
GS_110 GS_119 GS_120 GS_121 GS_122 GS_123 GS_127 GS_131 GS_133 GS_134 GS_135 GS_137 \
PRESET PRESET3 OBJT OBJT3)
@@ -41,5 +41,5 @@ done
echo "libgs_used: ${#OBJS[@]} objects -> $DST"
# Optional self-check: verify the whole region links per-object .text byte-identical.
if [ "${1:-}" = "--verify" ]; then
.venv/bin/python tools/psyq_link_region.py "$DST" 0x80051804 0x80057928
.venv/bin/python tools/psyq_link_region.py "$DST" 0x8005080C 0x80057928
fi
+45 -3
View File
@@ -494,6 +494,12 @@ def linked_subsegs():
"first. Returning an empty set here would silently claim 'no linked subsegs'.")
if BINARY != "main":
return set()
return _main_linked_segs_from_makefile()
def _main_linked_segs_from_makefile():
"""The EXE's LINKED subseg names, parsed from the Makefile's psyq_integrate calls — BINARY-independent
(P31 S78: the fleet's weighted metric needs main's link state while iterating other binaries)."""
if not MAKEFILE.exists():
return set()
txt = MAKEFILE.read_text()
@@ -844,6 +850,29 @@ def _sig_binary(sigpath):
return "main" if b == "SLUS_007.26" else b
def _main_linked_ranges():
"""[(vram_lo, vram_hi)] of main's LINKED subsegs, derived from the Makefile's psyq_integrate stub
lists (LINKED_SEGS) and the splat yaml's subseg rows (vram = fileoff + (segment vram - segment start)).
P31 S78 (R33): the game-code denominator must follow the LIVE link state, not a sig's snapshot."""
import yaml as _yaml
y = _yaml.safe_load(open(ROOT / "config/splat.us.exe.yaml"))
out, rows, vb = [], [], None
for seg in y["segments"]:
if isinstance(seg, dict) and "subsegments" in seg:
vb = int(seg["vram"]) - int(seg["start"])
for r in seg["subsegments"]:
if isinstance(r, list) and len(r) >= 3:
rows.append((int(r[0]), str(r[2])))
elif isinstance(r, list) and len(r) == 1:
rows.append((int(r[0]), None))
rows.sort()
linked = _main_linked_segs_from_makefile()
for i, (off, name) in enumerate(rows):
if name in linked and i + 1 < len(rows):
out.append((off + vb, rows[i + 1][0] + vb))
return out
def weighted_metrics():
"""Instruction/byte-weighted matching % from the committed sigs (.run/sig.*.jsonl) + the DERIVED
stub oracle (corpus.stubs, R33 — NOT a func_-only regex, which missed curated-named stubs and, for
@@ -907,11 +936,18 @@ def weighted_metrics():
import datetime
main_date = datetime.date.fromtimestamp(mp.stat().st_mtime).isoformat()
mst = stub_addrs("main")
# P31 S78: exclude LINKED subsegs LIVE (R33 — derive from the Makefile stub lists + the yaml
# ranges), not by trusting the sig's generation-time exclusion. When 13 "game code" subsegs
# became libgte23..30/libgs7/snd10/snd11 the 2026-08-05 sig still carried their 2,907 ins,
# which then read as unmatched game code (59.8% -> 56.1% with no game-code change).
lr = _main_linked_ranges()
for line in open(mp):
r = json.loads(line)
a, n = int(r["addr"], 16), r["nins"]
if n == 0:
continue # GTE thunks / no-body
if any(lo <= a < hi for lo, hi in lr):
continue # LINKED PsyQ object — not game code
mt += n
if a not in mst:
mm += n
@@ -925,10 +961,16 @@ def weighted_metrics():
# comes from Ghidra (2026-06-14), and function BOUNDARIES derive from the original bytes, which
# do not change — matched-vs-stub comes from the LIVE corpus.stubs. So the numbers do not drift.
# The real limitation is R34: `sig_image` cannot independently validate a PS-X EXE's boundaries,
# so main has no SECOND, DISAGREEING oracle for the PHANTOM/TRUNCATED class. The sig also
# EXCLUDES the LINKED PsyQ objects, which is exactly right for a GAME-CODE contract.
# so main has no SECOND, DISAGREEING oracle for the PHANTOM/TRUNCATED class (closed P31 S77:
# `make sig-main-oracle`).
#
# Effect: the headline instr number DROPS, because main is ~0.7% matched. That is the point.
# CORRECTION (P31 S78): this block used to claim "the sig also EXCLUDES the LINKED PsyQ objects".
# It did not. The 2026-08-05 sig carried every Ghidra function including the ~31,000 ins of linked
# SDK objects, whose INCLUDE_ASM stub records read as UNMATCHED game code — so main's game-code
# weighted % was reported as 59.8% (47,521 / 79,510) when the game-code denominator is 48,537 ins
# and the honest figure was 91.8%. The LINKED exclusion is now applied LIVE above
# (_main_linked_ranges, R33/R35); the remainder 48,537 − 44,562 = 3,975 ins equals the sum of
# main's open stubs in `frontier_classify` (a known-true-case check).
fleet_m_all, fleet_t_all = fm + mm, ft + mt
dedup_m_all, dedup_t_all = um + mm, ut + mt # main's fns are unique — no h_exact sharing
return dict(fleet_m=fleet_m_all, fleet_t=fleet_t_all,
+10
View File
@@ -103,6 +103,16 @@ def integrate(elf_dir, ld_path, objdir, syms_path, stubs, lo=None, hi=None,
# named on this call are wired; the others are the LINKED RESIDUE and are printed, not swallowed
# (the completion contract's "residue empties" line reads exactly this).
ranges = stub_ranges(yaml_path, stubs, vram_base)
# A placement NESTED inside another object's placement is a sub-pattern match, not a link
# (libgte SMP_06.o `NormalClipS`, 4 ins, matches inside SMP_05.o `NormalClip`, 12 ins, which
# tiles the whole span byte-identically). Keep the enclosing object; print the nested one.
kept, prev = [], None
for nm, (v, n) in order:
if prev is not None and v >= prev[1] and v + n * 4 <= prev[1] + prev[2] * 4:
print(f" .. {nm} @0x{v:08X} ({n} ins) is NESTED inside {prev[0]} — sub-pattern, not wired")
continue
kept.append((nm, (v, n))); prev = (nm, v, n)
order = kept
residue = [(nm, v, n) for nm, (v, n) in order if not any(a <= v < b for a, b in ranges.values())]
order = [(nm, vn) for nm, vn in order if any(a <= vn[0] < b for a, b in ranges.values())]
if residue: