diff --git a/Makefile b/Makefile index 6dd747a90..cf33f5431 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/config/splat.us.exe.yaml b/config/splat.us.exe.yaml index fcf5d5c89..ef49b49ce 100644 --- a/config/splat.us.exe.yaml +++ b/config/splat.us.exe.yaml @@ -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, diff --git a/config/symbols.us.txt b/config/symbols.us.txt index 4a78bc3fa..13dd79aa2 100644 --- a/config/symbols.us.txt +++ b/config/symbols.us.txt @@ -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 diff --git a/docs/SETUP.md b/docs/SETUP.md index 72c3e6fd5..08f794472 100644 --- a/docs/SETUP.md +++ b/docs/SETUP.md @@ -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 ` (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). | diff --git a/docs/accelerators.md b/docs/accelerators.md index 9b9e2ae26..baf9ddec4 100644 --- a/docs/accelerators.md +++ b/docs/accelerators.md @@ -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.** diff --git a/docs/cookbook-index.md b/docs/cookbook-index.md index 72c7baecf..0be8d45b6 100644 --- a/docs/cookbook-index.md +++ b/docs/cookbook-index.md @@ -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) L34647 - **§477** — ★★★ — THE `self_decl_tu` CLASS IS A SOLVED, MECHANICAL LANE: 16 DRAFTS, 16 BANKS (P31 S77) L35713 -### build graph, splat & the harness (207) +### build graph, splat & the harness (208) - **§4** — Flag/toolchain gotchas L190 - **Build** — mechanism — per-file opt override (splat resegmentation) L307 @@ -1289,6 +1289,7 @@ - **§484** — ★★★ — "NO SINGLE NOLOAD BASE" IS NOT "UNLINKABLE": ASK WHETHER THE `.bss` OFFSETS ARE DISJOINT (P31 S77) L36023 - **§485** — ★★★ — THE PLACEMENT MAP WAS PARSING A PRETTY-PRINTER: 25 PsyQ OBJECTS WERE INVISIBLE, NOT ABSENT (P31 S77) L36069 - **§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) L36150 +- **§488** — ★★ — THE "GAME CODE" GAPS BETWEEN LIBRARY BLOCKS WERE LIBRARY OBJECTS: 13 SUBSEGS → LINKED, EXACT-TILED, ZERO TOKENS (P31 S78) L36202 ### 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) L36069 - **§486** — ★★★ — CARVING AN `-O0` ISLAND IN **main**: FIVE COUPLED PIECES, AND THE TWO THAT ANNOUNCE THEMSELVES (P31 S77) L36105 - **§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) L36150 +- **§488** — ★★ — THE "GAME CODE" GAPS BETWEEN LIBRARY BLOCKS WERE LIBRARY OBJECTS: 13 SUBSEGS → LINKED, EXACT-TILED, ZERO TOKENS (P31 S78) L36202 --- @@ -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 | diff --git a/docs/decision-log.md b/docs/decision-log.md index dcf068a84..aa59e1a50 100644 --- a/docs/decision-log.md +++ b/docs/decision-log.md @@ -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). diff --git a/docs/difficulty.md b/docs/difficulty.md index f696f7eb1..85874d08a 100644 --- a/docs/difficulty.md +++ b/docs/difficulty.md @@ -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 | diff --git a/docs/matching-cookbook.md b/docs/matching-cookbook.md index f6f7bdda3..06b0b99e1 100644 --- a/docs/matching-cookbook.md +++ b/docs/matching-cookbook.md @@ -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 `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/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. diff --git a/docs/progress.fleet.md b/docs/progress.fleet.md index 4333fbb59..874844a82 100644 --- a/docs/progress.fleet.md +++ b/docs/progress.fleet.md @@ -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% | diff --git a/docs/progress.md b/docs/progress.md index 4cccacf73..a049c8c66 100644 --- a/docs/progress.md +++ b/docs/progress.md @@ -1,20 +1,22 @@ # BFM matching progress (generated by tools/progress.py — authoritative) -REAL substantive matches : 912 <- the Gen1-exit >=25 bar counts THIS +REAL substantive matches : 886 <- the Gen1-exit >=25 bar counts THIS (of which dedup-shared : 2 one body -> N sites, config/dedup.us.yaml) -LINKED real PsyQ objects : 959 <- byte-identical via linked SDK objects -VERBATIM __asm__ bodies : 142 <- §265: BYTES, NOT A DECOMPILE (byte-identical by construction, unexplained; NOT counted in REAL) +LINKED real PsyQ objects : 1040 <- byte-identical via linked SDK objects +VERBATIM __asm__ bodies : 85 <- §265: BYTES, NOT A DECOMPILE (byte-identical by construction, unexplained; NOT counted in REAL) NON_MATCHING (near-miss) : 0 splat-auto empty no-ops : 43 INCLUDE_ASM stubs : 29 data blobs (excluded) : 1 ---------------------------------------- -matchable functions : 2085 -REAL / matchable : 912 / 2085 = 43.74% -byte-identical/ matchable: 2056 / 2085 = 98.61% (REAL+LINKED+empties+VERBATIM) +matchable functions : 2083 +REAL / matchable : 886 / 2083 = 42.53% +byte-identical/ matchable: 2054 / 2083 = 98.61% (REAL+LINKED+empties+VERBATIM) -LINKED subsegs: apicard1 apicard2 apicard3 apicard4 libc2_1 libc2_2 libcd1 libcd2 libetc libgpu libgs1 libgs2 libgs3 libgs4 libgs5 libgs6 libgte1 libgte10 libgte11 libgte12 libgte13 libgte14 libgte15 libgte16 libgte17 libgte18 libgte19 libgte2 libgte20 libgte21 libgte22 libgte3 libgte4 libgte5 libgte6 libgte7 libgte8 libgte9 libmcrd1 libmcrd2 snd1 snd2 snd3 snd4 snd5 snd6 snd7 snd8 snd9 (959 fns) -REAL matches: AverageZ3 CdQueueBusy CdReadRequest CdReadSectorReadyCB CdReadStateMachine ClearImage2 ClearOTag DebugMenuHandler DpqColor3 DpqColorLight DrawOTagEnv DrawPrim DsDataCallback DsReadyCallback DsSyncCallback GameModeDispatch GetDispEnv GetDrawEnv GetGraphDebug GetGraphType GetODE GetRCnt GsInitGraph2_body GsTMDfastF3GL GsTMDfastF3GNL GsTMDfastF4GL GsTMDfastF4GNL GsTMDfastG3GL GsTMDfastG3GNL GsTMDfastG4GL GsTMDfastG4GNL InitPAD Intpl LightColor LoaderInitFileTable LoaderResetReadState LzssDecodeSector MoveImage PAD_init PadChkMtap PadChkVsync PadEnableCom PadGetState PadInfoComb PadInfoMode PadSetAct PadSetActAlign PadSetMainMode PadStartCom PadStopCom ReadInitPadFlag ResetRCnt ResourceGetCdLoc ResourceLoadStateMachine SYS_OBJ_191C SYS_OBJ_19D8 SYS_OBJ_1AA4 SYS_OBJ_1AF0 SYS_OBJ_1B78 SetDQA SetDQB SetData32 SetDrawArea SetDrawOffset SetGraphQueue SetIR0 SetIR123 SetMAC123 SetPriority SetRCnt SetRGBfifo SetRii SetSXSYfifo SetSZfifo4 SetTexWindow SetVertex0 SetVertex1 SetVertex2 SetVertexTri SpuWrite Square0 Square12 SsGetMute SsUtReverbOff StartPAD StartRCnt StopPAD StopRCnt StoreImage StreamLoadStateMachine VM_NO1_OBJ_4A4 VM_NOWON_OBJ_44C _SsSndPlay _addque _cwb _getctl _padClrIntSio0 _padCmdParaMode _padGetActSize _padLoadActInfo _padRecvAtLoadInfo _padSendAtLoadInfo _padSetAct _padSetActAlign _padSetCmd _padSetVsyncParam _padSioRW _padSioRW2 _padStopCom _padWaitRXready _status aF800301A4 chkRC2wait firstfile func_8001096C func_8001099C func_80010A08 func_80010A98 func_80010AE0 func_80010B10 func_80010BB4 func_80010C7C func_80010CEC func_80010D60 func_80010DA0 func_80010DE0 func_80010E14 func_80010E48 func_80010E7C func_80010ED4 func_80010F80 func_800110CC func_800111BC func_80011220 func_8001125C func_800112C8 func_80011320 func_80011350 func_80011680 func_800116E0 func_80011778 func_80011818 func_800118AC func_80011928 func_80011998 func_800119F0 func_80011A3C func_80011ADC func_80011B7C func_80011C10 func_80011C8C func_80011CFC func_80011D54 func_80011DA0 func_80011DCC func_80011DF4 func_80011E24 func_80011E84 func_80011EB4 func_800120DC func_8001212C func_800123F0 func_80012558 func_800126C4 func_8001282C func_800128B4 func_800128EC func_800129CC func_80012A60 func_80012AB0 func_80012ABC func_80012B04 func_80012B58 func_80012C6C func_80012CB8 func_80012D0C func_80012DBC func_80012E0C func_80012E6C func_80012F74 func_80012FC8 func_80013028 func_800130D0 func_8001311C func_80013154 func_80013200 func_80013228 func_80013294 func_800132BC func_80013328 func_80013350 func_800133BC func_800133E4 func_80013450 func_80013478 func_800134FC func_80013694 func_8001382C func_800139C8 func_80013B64 func_80013CFC func_80013E94 func_80013ED0 func_80013F3C func_80013F68 func_80013F98 func_80013FBC func_80013FE0 func_80014004 func_80014028 func_8001404C func_80014070 func_80014094 func_800140B8 func_80014128 func_80014148 func_80014168 func_800141AC func_800141F0 func_80014238 func_800142C8 func_80014338 func_80014390 func_800143AC func_80014444 func_800144D4 func_80014564 func_80014588 func_800145EC func_800146B0 func_80014774 func_800147B8 func_80014928 func_80014960 func_80014998 func_800149E0 func_80014B10 func_80014BFC func_80014C28 func_80014C54 func_80014CAC func_80014CF8 func_80014D30 func_80014D68 func_80014D94 func_80014DC0 func_80014DEC func_80014E24 func_80014E80 func_80014ED4 func_80015018 func_80015118 func_80015144 func_80015208 func_800152F4 func_80015310 func_8001534C func_800153A4 func_800153CC func_80015424 func_8001544C func_80015498 func_80015908 func_80015954 func_80015978 func_8001599C func_800159C0 func_800159E4 func_80015A08 func_80015A2C func_80015A50 func_80015A74 func_80015AD0 func_80015D4C func_80015F04 func_80016110 func_80016224 func_80016450 func_80016638 func_800166E8 func_80016714 func_800167B8 func_800167F0 func_800168B4 func_800168C4 func_80016940 func_80016978 func_80016A3C func_80016A5C func_80016A7C func_80016B60 func_80016C28 func_80016D78 func_80016EB0 func_80016ED4 func_80016EF8 func_80016F18 func_80017168 func_80017254 func_80017274 func_80017294 func_8001739C func_800173BC func_800173DC func_800174DC func_800174FC func_8001751C func_800176F0 func_80017714 func_80017738 func_80017758 func_80017778 func_800178C8 func_800178EC func_80017910 func_80017930 func_80017B98 func_80017D98 func_80017DC4 func_80017DF8 func_80017E30 func_80017E68 func_80017E8C func_80017F14 func_80018094 func_80018194 func_8001820C func_80018384 func_800183E0 func_80018450 func_800184F0 func_80018918 func_800189A8 func_80018A20 func_80018C64 func_80018CE8 func_80018E78 func_80018E9C func_80018F20 func_80018F88 func_80018FC8 func_80019018 func_80019028 func_8001903C func_80019064 func_800190AC func_80019198 func_800191A8 func_800191BC func_800191D4 func_8001923C func_8001931C func_80019378 func_80019388 func_80019398 func_800193A8 func_800193B8 func_80019930 func_80019A10 func_8001A0FC func_8001A114 func_8001A9D8 func_8001A9F8 func_8001AA78 func_8001AA88 func_8001AAA0 func_8001AAD0 func_8001ABBC func_8001ACF0 func_8001AE90 func_8001AF04 func_8001AF34 func_8001B0D4 func_8001B22C func_8001B23C func_8001B26C func_8001B324 func_8001B34C func_8001B374 func_8001B384 func_8001B394 func_8001B710 func_8001B7C4 func_8001B85C func_8001B86C func_8001BA84 func_8001BADC func_8001BB60 func_8001BBBC func_8001BDA0 func_8001BE20 func_8001BE30 func_8001BFA0 func_8001BFB0 func_8001BFD0 func_8001BFE8 func_8001BFF8 func_8001C00C func_8001C044 func_8001C0C8 func_8001C14C func_8001C1E4 func_8001C214 func_8001C2C4 func_8001C320 func_8001C448 func_8001C4A4 func_8001C558 func_8001C5B8 func_8001C6E4 func_8001C744 func_8001C7B0 func_8001C810 func_8001C8C4 func_8001C924 func_8001C97C func_8001C9D0 func_8001CA1C func_8001CA88 func_8001CB00 func_8001CB6C func_8001CBDC func_8001CC3C func_8001CCA0 func_8001CD04 func_8001CD50 func_8001CD9C func_8001CDE8 func_8001CE28 func_8001CE68 func_8001CEC0 func_8001CF00 func_8001CF30 func_8001CF48 func_8001CFB8 func_8001CFDC_impl func_8001D050 func_8001D074_impl func_8001D0E8 func_8001D0F4 func_8001D130 func_8001D150 func_8001D16C func_8001D1C4 func_8001D388 func_8001D3FC func_8001D70C func_8001D8C4 func_8001DA34 func_8001E094 func_8001E378 func_8001E668 func_8001E7E0 func_8001EA14 func_8001F730 func_8001F97C func_8001F9F8 func_8001FB8C func_8001FC08 func_80020248 func_80020598 func_80020A28 func_80020F34 func_80021008 func_80021050 func_8002109C func_80021120 func_80021174 func_80021284 func_800215F4 func_80021D38 func_800221A8 func_800226C0 func_80023138 func_800233CC func_800234E4 func_80023570 func_8002374C func_80024054 func_800241C0 func_800242D0 func_800243EC func_80024448 func_800249F0 func_80024BC0 func_80024DE8 func_80025000 func_8002528C func_80025504 func_80025818 func_80025A30 func_80025CBC func_80025EB8 func_80026128 func_800262D8 func_80026514 func_800268D0 func_80026D64 func_80027058 func_80027200 func_800273F4 func_800275BC func_800277DC func_800279AC func_80027BF0 func_80027C10 func_80027D20 func_80027F4C func_80028200 func_8002823C func_80028304 func_80028394 func_80028428 func_80028488 func_80028558 func_800285CC func_80028620 func_80028694 func_80028A48 func_80028C50 func_80028D58 func_80028D78 func_80028D9C func_80028DBC func_80028DE0 func_80028E00 func_80028E24 func_80028E44 func_80028E68 func_80028E88 func_80028EAC func_80028ECC func_80028EF0 func_80028F10 func_80028F34 func_80028F54 func_80028F78 func_80028F98 func_80028FBC func_80028FDC func_80029000 func_80029020 func_80029044 func_8002906C func_80029094 func_800290BC func_800290E0 func_80029104 func_80029124 func_80029178 func_800291A0 func_800291B4 func_800291C8 func_800291DC func_800291F0 func_80029204 func_80029218 func_80029240 func_80029254 func_80029264 func_80029274 func_8002931C func_80029344 func_8002941C func_80029444 func_80029504 func_80029514 func_80029524 func_8002953C func_8002954C func_8002955C func_8002957C func_8002958C func_8002959C func_800295D4 func_80029664 func_80029690 func_800296F8 func_80029774 func_800298BC func_8002992C func_80029A58 func_80029A94 func_80029AAC func_80029AF4 func_80029B4C func_80029BC8 func_80029C44 func_80029CD4 func_80029D3C func_80029DB4 func_80029E30 func_80029E94 func_80029EC0 func_80029ED4 func_80029FD4 func_80029FE4 func_8002A04C func_8002A088 func_8002A108 func_8002A1B4 func_8002A200 func_8002A234 func_8002A26C func_8002A27C func_8002A28C func_8002A2B0 func_8002A2D4 func_8002A354 func_8002A400 func_8002A44C func_8002A480 func_8002A4B8 func_8002A4C8 func_8002A4D8 func_8002A4FC func_8002A520 func_8002A544 func_8002A5C4 func_8002A670 func_8002A6BC func_8002A6F0 func_8002A728 func_8002A738 func_8002A748 func_8002A76C func_8002A790 func_8002A7B4 func_8002A834 func_8002A8E0 func_8002A92C func_8002A960 func_8002A998 func_8002A9A8 func_8002A9B8 func_8002A9DC func_8002AA00 func_8002AA3C func_8002AAB4 func_8002AB64 func_8002AC00 func_8002AE60 func_8002AED0 func_8002AEE4 func_8002AEF8 func_8002AF08 func_8002AF18 func_8002AF48 func_8002AF60 func_8002AF70 func_8002B00C func_8002B064 func_8002B08C func_8002B0B4 func_8002C320 func_8002C3B0 func_8002C410 func_8002C8BC func_8002C8F4 func_8002CC4C func_8002CCB4 func_8002CCD8 func_8002CDD8 func_8002CFE4 func_8002D034 func_8002D1F0 func_8002D240 func_8002D29C func_8002D320 func_8002D4B8 func_8002D4C8 func_8002D59C func_8002D678 func_8002D6D8 func_8002D7FC func_8002D80C func_8002D834 func_8002D844 func_8002D858 func_8002D8A8 func_8002D8D4 func_8002D904 func_8002DC68 func_8002DF80 func_8002E138 func_8002E5BC func_8002E5F8 func_8002E638 func_8002E700 func_8002E79C func_8002E818 func_8002E8DC func_8002E94C func_8002EA10 func_8002EAB0 func_8002EB10 func_8002EBAC func_8002EC10 func_8002ED90 func_8002EDE4 func_8002EE64 func_8002EE90 func_8002EEB8 func_8002EED8 func_8002EFD0 func_8002EFF8 func_8002F064 func_8002F0D0 func_8002F0F4 func_8002F12C func_8002F150 func_8002F1CC func_8002F248 func_8002F4E4 func_8002F5C8 func_8002F620 func_8002F648 func_8002F658 func_8002F67C func_8002F714 func_8002F80C func_8002FA3C func_8002FAE0 func_8002FB08 func_8002FC64 func_8002FD14 func_8002FDC8 func_8002FF0C func_800301C8 func_80030470 func_800304C8 func_80030538 func_80030634 func_80030730 func_80030A14 func_80030CA4 func_80030D80 func_80030F80 func_800314DC func_800316F8 func_80031988 func_80031A98 func_80031B7C func_80031BE0 func_80031CC8 func_80031D70 func_80031DEC func_80031E94 func_80031F14 func_80031FC8 func_80032048 func_800322A8 func_800324A4 func_80032774 func_8003310C func_800331D4 func_8003324C func_80033324 func_80033398 func_8003350C func_800335B8 func_800336A8 func_8003388C func_800342E8 func_80034314 func_80034650 func_800346D0 func_800347C8 func_80034844 func_800348A8 func_8003491C func_80034A54 func_80034A9C func_80034AE0 func_80034B0C func_80034B3C func_80034C24 func_80034CF0 func_80034DFC func_8003500C func_800351E8 func_80035210 func_80035270 func_800359B0 func_80035C4C func_8003602C func_80036130 func_800361CC func_8003621C func_80036260 func_80036AF8 func_80036D24 func_80036D58 func_80036EB4 func_80036EE8 func_80036F18 func_80036F98 func_80036FB0 func_80037004 func_80037028 func_80037144 func_80037334 func_80037358 func_80037368 func_800373D0 func_800374CC func_8003750C func_8003775C func_800377D8 func_80037CC8 func_80037CD8 func_80037D74 func_80037D98 func_80037EA0 func_80037F3C func_80037FC4 func_8003819C func_800381E4 func_80038210 func_80038308 func_8003834C func_8003836C func_800383A4 func_800384A8 func_800385C0 func_80038638 func_80038668 func_800387C0 func_80038838 func_800388E8 func_80038908 func_80038958 func_80038A00 func_80038A58 func_80038FC4 func_80038FFC func_8003916C func_80039C5C func_80039C70 func_80039F14 func_80039F50 func_8003A098 func_8003A0D0 func_8003A0E4 func_8003A234 func_8003A3D8 func_8003A404 func_8003A424 func_8003D424 func_8003D630 func_8003DC90 func_8003DF8C func_8003FA54 func_8003FA64 func_80040DE8 func_80041354 func_800413B8 func_80041400 func_80041448 func_800525DC func_80052654 func_8005283C func_800538BC func_80053AD8 func_800594CC func_80059658 func_800596F4 func_80059888 func_800599B8 func_80059BFC func_80059CF4 func_80059D68 func_8005A600 func_8005AE80 func_8005B684 func_8005B710 func_8005B75C func_8005B7B0 func_8005BA90 func_8005C020 func_8005C29C func_8005CF08 func_8005CF18 func_8005D6CC func_8005DBD8 func_8005E480 func_8005E528 func_8005E804 func_8005E820 func_8005E980 func_8005E9D4 func_8005EA54 func_8005EA68 func_8005EA88 func_8005EAA8 func_8005EAC8 func_8005EAE8 func_8005EB28 func_8005EC00 func_8005F228 func_8005F384 func_8005F394 func_8005F6CC func_8005F704 func_8005F75C func_8005FB70 func_8006252C func_800625A4 func_800625DC func_80062644 gteMIMefunc main +LINKED subsegs: apicard1 apicard2 apicard3 apicard4 libc2_1 libc2_2 libcd1 libcd2 libetc libgpu libgs1 libgs2 libgs3 libgs4 libgs5 libgs6 libgs7 libgte1 libgte10 libgte11 libgte12 libgte13 libgte14 libgte15 libgte16 libgte17 libgte18 libgte19 libgte2 libgte20 libgte21 libgte22 libgte23 libgte24 libgte25 libgte26 libgte27 libgte28 libgte29 libgte3 libgte30 libgte4 libgte5 libgte6 libgte7 libgte8 libgte9 libmcrd1 libmcrd2 snd1 snd10 snd11 snd2 snd3 snd4 snd5 snd6 snd7 snd8 snd9 (1040 fns) +REAL matches: CdQueueBusy CdReadRequest CdReadSectorReadyCB CdReadStateMachine ClearImage2 ClearOTag DebugMenuHandler DrawOTagEnv DrawPrim DsDataCallback DsReadyCallback DsSyncCallback GameModeDispatch GetDispEnv GetDrawEnv GetGraphDebug GetGraphType GetODE GetRCnt GsInitGraph2_body GsTMDfastF3GL GsTMDfastF3GNL GsTMDfastF4GL GsTMDfastF4GNL GsTMDfastG3GL GsTMDfastG3GNL GsTMDfastG4GL GsTMDfastG4GNL InitPAD LoaderInitFileTable LoaderResetReadState LzssDecodeSector MoveImage PAD_init PadChkMtap PadChkVsync PadEnableCom PadGetState PadInfoComb PadInfoMode PadSetAct PadSetActAlign PadSetMainMode PadStartCom PadStopCom ReadInitPadFlag ResetRCnt ResourceGetCdLoc ResourceLoadStateMachine SYS_OBJ_191C SYS_OBJ_19D8 SYS_OBJ_1AA4 SYS_OBJ_1AF0 SYS_OBJ_1B78 SetDrawArea SetDrawOffset SetGraphQueue SetPriority SetRCnt SetTexWindow SpuWrite SsGetMute SsUtReverbOff StartPAD StartRCnt StopPAD StopRCnt StoreImage StreamLoadStateMachine _SsSndPlay _addque _cwb _getctl _padClrIntSio0 _padCmdParaMode _padGetActSize _padLoadActInfo _padRecvAtLoadInfo _padSendAtLoadInfo _padSetAct _padSetActAlign _padSetCmd _padSetVsyncParam _padSioRW _padSioRW2 _padStopCom _padWaitRXready _status aF800301A4 chkRC2wait firstfile func_8001096C func_8001099C func_80010A08 func_80010A98 func_80010AE0 func_80010B10 func_80010BB4 func_80010C7C func_80010CEC func_80010D60 func_80010DA0 func_80010DE0 func_80010E14 func_80010E48 func_80010E7C func_80010ED4 func_80010F80 func_800110CC func_800111BC func_80011220 func_8001125C func_800112C8 func_80011320 func_80011350 func_80011680 func_800116E0 func_80011778 func_80011818 func_800118AC func_80011928 func_80011998 func_800119F0 func_80011A3C func_80011ADC func_80011B7C func_80011C10 func_80011C8C func_80011CFC func_80011D54 func_80011DA0 func_80011DCC func_80011DF4 func_80011E24 func_80011E84 func_80011EB4 func_800120DC func_8001212C func_800123F0 func_80012558 func_800126C4 func_8001282C func_800128B4 func_800128EC func_800129CC func_80012A60 func_80012AB0 func_80012ABC func_80012B04 func_80012B58 func_80012C6C func_80012CB8 func_80012D0C func_80012DBC func_80012E0C func_80012E6C func_80012F74 func_80012FC8 func_80013028 func_800130D0 func_8001311C func_80013154 func_80013200 func_80013228 func_80013294 func_800132BC func_80013328 func_80013350 func_800133BC func_800133E4 func_80013450 func_80013478 func_800134FC func_80013694 func_8001382C func_800139C8 func_80013B64 func_80013CFC func_80013E94 func_80013ED0 func_80013F3C func_80013F68 func_80013F98 func_80013FBC func_80013FE0 func_80014004 func_80014028 func_8001404C func_80014070 func_80014094 func_800140B8 func_80014128 func_80014148 func_80014168 func_800141AC func_800141F0 func_80014238 func_800142C8 func_80014338 func_80014390 func_800143AC func_80014444 func_800144D4 func_80014564 func_80014588 func_800145EC func_800146B0 func_80014774 func_800147B8 func_80014928 func_80014960 func_80014998 func_800149E0 func_80014B10 func_80014BFC func_80014C28 func_80014C54 func_80014CAC func_80014CF8 func_80014D30 func_80014D68 func_80014D94 func_80014DC0 func_80014DEC func_80014E24 func_80014E80 func_80014ED4 func_80015018 func_80015118 func_80015144 func_80015208 func_800152F4 func_80015310 func_8001534C func_800153A4 func_800153CC func_80015424 func_8001544C func_80015498 func_80015908 func_80015954 func_80015978 func_8001599C func_800159C0 func_800159E4 func_80015A08 func_80015A2C func_80015A50 func_80015A74 func_80015AD0 func_80015D4C func_80015F04 func_80016110 func_80016224 func_80016450 func_80016638 func_800166E8 func_80016714 func_800167B8 func_800167F0 func_800168B4 func_800168C4 func_80016940 func_80016978 func_80016A3C func_80016A5C func_80016A7C func_80016B60 func_80016C28 func_80016D78 func_80016EB0 func_80016ED4 func_80016EF8 func_80016F18 func_80017168 func_80017254 func_80017274 func_80017294 func_8001739C func_800173BC func_800173DC func_800174DC func_800174FC func_8001751C func_800176F0 func_80017714 func_80017738 func_80017758 func_80017778 func_800178C8 func_800178EC func_80017910 func_80017930 func_80017B98 func_80017D98 func_80017DC4 func_80017DF8 func_80017E30 func_80017E68 func_80017E8C func_80017F14 func_80018094 func_80018194 func_8001820C func_80018384 func_800183E0 func_80018450 func_800184F0 func_80018918 func_800189A8 func_80018A20 func_80018C64 func_80018CE8 func_80018E78 func_80018E9C func_80018F20 func_80018F88 func_80018FC8 func_80019018 func_80019028 func_8001903C func_80019064 func_800190AC func_80019198 func_800191A8 func_800191BC func_800191D4 func_8001923C func_8001931C func_80019378 func_80019388 func_80019398 func_800193A8 func_800193B8 func_80019930 func_80019A10 func_8001A0FC func_8001A114 func_8001A9D8 func_8001A9F8 func_8001AA78 func_8001AA88 func_8001AAA0 func_8001AAD0 func_8001ABBC func_8001ACF0 func_8001AE90 func_8001AF04 func_8001AF34 func_8001B0D4 func_8001B22C func_8001B23C func_8001B26C func_8001B324 func_8001B34C func_8001B374 func_8001B384 func_8001B394 func_8001B710 func_8001B7C4 func_8001B85C func_8001B86C func_8001BA84 func_8001BADC func_8001BB60 func_8001BBBC func_8001BDA0 func_8001BE20 func_8001BE30 func_8001BFA0 func_8001BFB0 func_8001BFD0 func_8001BFE8 func_8001BFF8 func_8001C00C func_8001C044 func_8001C0C8 func_8001C14C func_8001C1E4 func_8001C214 func_8001C2C4 func_8001C320 func_8001C448 func_8001C4A4 func_8001C558 func_8001C5B8 func_8001C6E4 func_8001C744 func_8001C7B0 func_8001C810 func_8001C8C4 func_8001C924 func_8001C97C func_8001C9D0 func_8001CA1C func_8001CA88 func_8001CB00 func_8001CB6C func_8001CBDC func_8001CC3C func_8001CCA0 func_8001CD04 func_8001CD50 func_8001CD9C func_8001CDE8 func_8001CE28 func_8001CE68 func_8001CEC0 func_8001CF00 func_8001CF30 func_8001CF48 func_8001CFB8 func_8001CFDC_impl func_8001D050 func_8001D074_impl func_8001D0E8 func_8001D0F4 func_8001D130 func_8001D150 func_8001D16C func_8001D1C4 func_8001D388 func_8001D3FC func_8001D70C func_8001D8C4 func_8001DA34 func_8001E094 func_8001E378 func_8001E668 func_8001E7E0 func_8001EA14 func_8001F730 func_8001F97C func_8001F9F8 func_8001FB8C func_8001FC08 func_80020248 func_80020598 func_80020A28 func_80020F34 func_80021008 func_80021050 func_8002109C func_80021120 func_80021174 func_80021284 func_800215F4 func_80021D38 func_800221A8 func_800226C0 func_80023138 func_800233CC func_800234E4 func_80023570 func_8002374C func_80024054 func_800241C0 func_800242D0 func_800243EC func_80024448 func_800249F0 func_80024BC0 func_80024DE8 func_80025000 func_8002528C func_80025504 func_80025818 func_80025A30 func_80025CBC func_80025EB8 func_80026128 func_800262D8 func_80026514 func_800268D0 func_80026D64 func_80027058 func_80027200 func_800273F4 func_800275BC func_800277DC func_800279AC func_80027BF0 func_80027C10 func_80027D20 func_80027F4C func_80028200 func_8002823C func_80028304 func_80028394 func_80028428 func_80028488 func_80028558 func_800285CC func_80028620 func_80028694 func_80028A48 func_80028C50 func_80028D58 func_80028D78 func_80028D9C func_80028DBC func_80028DE0 func_80028E00 func_80028E24 func_80028E44 func_80028E68 func_80028E88 func_80028EAC func_80028ECC func_80028EF0 func_80028F10 func_80028F34 func_80028F54 func_80028F78 func_80028F98 func_80028FBC func_80028FDC func_80029000 func_80029020 func_80029044 func_8002906C func_80029094 func_800290BC func_800290E0 func_80029104 func_80029124 func_80029178 func_800291A0 func_800291B4 func_800291C8 func_800291DC func_800291F0 func_80029204 func_80029218 func_80029240 func_80029254 func_80029264 func_80029274 func_8002931C func_80029344 func_8002941C func_80029444 func_80029504 func_80029514 func_80029524 func_8002953C func_8002954C func_8002955C func_8002957C func_8002958C func_8002959C func_800295D4 func_80029664 func_80029690 func_800296F8 func_80029774 func_800298BC func_8002992C func_80029A58 func_80029A94 func_80029AAC func_80029AF4 func_80029B4C func_80029BC8 func_80029C44 func_80029CD4 func_80029D3C func_80029DB4 func_80029E30 func_80029E94 func_80029EC0 func_80029ED4 func_80029FD4 func_80029FE4 func_8002A04C func_8002A088 func_8002A108 func_8002A1B4 func_8002A200 func_8002A234 func_8002A26C func_8002A27C func_8002A28C func_8002A2B0 func_8002A2D4 func_8002A354 func_8002A400 func_8002A44C func_8002A480 func_8002A4B8 func_8002A4C8 func_8002A4D8 func_8002A4FC func_8002A520 func_8002A544 func_8002A5C4 func_8002A670 func_8002A6BC func_8002A6F0 func_8002A728 func_8002A738 func_8002A748 func_8002A76C func_8002A790 func_8002A7B4 func_8002A834 func_8002A8E0 func_8002A92C func_8002A960 func_8002A998 func_8002A9A8 func_8002A9B8 func_8002A9DC func_8002AA00 func_8002AA3C func_8002AAB4 func_8002AB64 func_8002AC00 func_8002AE60 func_8002AED0 func_8002AEE4 func_8002AEF8 func_8002AF08 func_8002AF18 func_8002AF48 func_8002AF60 func_8002AF70 func_8002B00C func_8002B064 func_8002B08C func_8002B0B4 func_8002C320 func_8002C3B0 func_8002C410 func_8002C8BC func_8002C8F4 func_8002CC4C func_8002CCB4 func_8002CCD8 func_8002CDD8 func_8002CFE4 func_8002D034 func_8002D1F0 func_8002D240 func_8002D29C func_8002D320 func_8002D4B8 func_8002D4C8 func_8002D59C func_8002D678 func_8002D6D8 func_8002D7FC func_8002D80C func_8002D834 func_8002D844 func_8002D858 func_8002D8A8 func_8002D8D4 func_8002D904 func_8002DC68 func_8002DF80 func_8002E138 func_8002E5BC func_8002E5F8 func_8002E638 func_8002E700 func_8002E79C func_8002E818 func_8002E8DC func_8002E94C func_8002EA10 func_8002EAB0 func_8002EB10 func_8002EBAC func_8002EC10 func_8002ED90 func_8002EDE4 func_8002EE64 func_8002EE90 func_8002EEB8 func_8002EED8 func_8002EFD0 func_8002EFF8 func_8002F064 func_8002F0D0 func_8002F0F4 func_8002F12C func_8002F150 func_8002F1CC func_8002F248 func_8002F4E4 func_8002F5C8 func_8002F620 func_8002F648 func_8002F658 func_8002F67C func_8002F714 func_8002F80C func_8002FA3C func_8002FAE0 func_8002FB08 func_8002FC64 func_8002FD14 func_8002FDC8 func_8002FF0C func_800301C8 func_80030470 func_800304C8 func_80030538 func_80030634 func_80030730 func_80030A14 func_80030CA4 func_80030D80 func_80030F80 func_800314DC func_800316F8 func_80031988 func_80031A98 func_80031B7C func_80031BE0 func_80031CC8 func_80031D70 func_80031DEC func_80031E94 func_80031F14 func_80031FC8 func_80032048 func_800322A8 func_800324A4 func_80032774 func_8003310C func_800331D4 func_8003324C func_80033324 func_80033398 func_8003350C func_800335B8 func_800336A8 func_8003388C func_800342E8 func_80034314 func_80034650 func_800346D0 func_800347C8 func_80034844 func_800348A8 func_8003491C func_80034A54 func_80034A9C func_80034AE0 func_80034B0C func_80034B3C func_80034C24 func_80034CF0 func_80034DFC func_8003500C func_800351E8 func_80035210 func_80035270 func_800359B0 func_80035C4C func_8003602C func_80036130 func_800361CC func_8003621C func_80036260 func_80036AF8 func_80036D24 func_80036D58 func_80036EB4 func_80036EE8 func_80036F18 func_80036F98 func_80036FB0 func_80037004 func_80037028 func_80037144 func_80037334 func_80037358 func_80037368 func_800373D0 func_800374CC func_8003750C func_8003775C func_800377D8 func_80037CC8 func_80037CD8 func_80037D74 func_80037D98 func_80037EA0 func_80037F3C func_80037FC4 func_8003819C func_800381E4 func_80038210 func_80038308 func_8003834C func_8003836C func_800383A4 func_800384A8 func_800385C0 func_80038638 func_80038668 func_800387C0 func_80038838 func_800388E8 func_80038908 func_80038958 func_80038A00 func_80038A58 func_80038FC4 func_80038FFC func_8003916C func_80039C5C func_80039C70 func_80039F14 func_80039F50 func_8003A098 func_8003A0D0 func_8003A0E4 func_8003A234 func_8003A3D8 func_8003A404 func_8003A424 func_8003D424 func_8003D630 func_8003DC90 func_8003DF8C func_8003FA54 func_8003FA64 func_80040DE8 func_80041354 func_800413B8 func_80041400 func_80041448 func_800525DC func_80052654 func_8005283C func_800594CC func_80059658 func_800596F4 func_80059888 func_800599B8 func_80059BFC func_80059CF4 func_80059D68 func_8005A600 func_8005AE80 func_8005B684 func_8005B710 func_8005B75C func_8005B7B0 func_8005BA90 func_8005C020 func_8005C29C func_8005CF08 func_8005CF18 func_8005D6CC func_8005DBD8 func_8005E480 func_8005E528 func_8005E804 func_8005E820 func_8005E980 func_8005E9D4 func_8005EA54 func_8005EA68 func_8005EA88 func_8005EAA8 func_8005EAC8 func_8005EAE8 func_8005EB28 func_8005EC00 func_8005F228 func_8005F384 func_8005F394 func_8005F6CC func_8005F704 func_8005F75C func_8005FB70 func_8006252C func_800625A4 func_800625DC func_80062644 main NON_MATCHING: +build SHA1: 143dbb89f34491258bbc27810d0a12ec8b43a8dd (byte-identical) + empties audit: 43/43 genuine jr;nop (all clean) diff --git a/docs/psyq-worklist.md b/docs/psyq-worklist.md index a4ebf0c3a..d1111d9d9 100644 --- a/docs/psyq-worklist.md +++ b/docs/psyq-worklist.md @@ -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. diff --git a/phase-ends/CURRENT_PHASE.md b/phase-ends/CURRENT_PHASE.md index 4a979f0fa..c8396c636 100644 --- a/phase-ends/CURRENT_PHASE.md +++ b/phase-ends/CURRENT_PHASE.md @@ -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) diff --git a/src/800.c b/src/800.c index ad1bc0a54..f72fccc21 100644 --- a/src/800.c +++ b/src/800.c @@ -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; diff --git a/src/800_c.c b/src/800_c.c index e5d45d9d2..6852ee00e 100644 --- a/src/800_c.c +++ b/src/800_c.c @@ -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; } diff --git a/src/800b.c b/src/800b.c deleted file mode 100644 index 0136cd98f..000000000 --- a/src/800b.c +++ /dev/null @@ -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" 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" -); diff --git a/src/800b_2.c b/src/800b_2.c deleted file mode 100644 index 006b3599e..000000000 --- a/src/800b_2.c +++ /dev/null @@ -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 `.setnoreorder` (literal tab) flips maspsx's is_reorder - * tracker; the trailing `.setreorder` 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"); diff --git a/src/800b_3.c b/src/800b_3.c deleted file mode 100644 index b348d7008..000000000 --- a/src/800b_3.c +++ /dev/null @@ -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"); diff --git a/src/800b_4.c b/src/800b_4.c deleted file mode 100644 index 61ad17767..000000000 --- a/src/800b_4.c +++ /dev/null @@ -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"); diff --git a/src/800b_5.c b/src/800b_5.c deleted file mode 100644 index 84891db5b..000000000 --- a/src/800b_5.c +++ /dev/null @@ -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"); diff --git a/src/800b_6.c b/src/800b_6.c deleted file mode 100644 index da4b580fb..000000000 --- a/src/800b_6.c +++ /dev/null @@ -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" -); diff --git a/src/800b_7.c b/src/800b_7.c deleted file mode 100644 index 102bd1d00..000000000 --- a/src/800b_7.c +++ /dev/null @@ -1,1254 +0,0 @@ -#include "common.h" - - -/* GsSortBg (asm/nonmatchings/800b_7/GsSortBg.s, 0x1B4 = 109 ins). - * - * This chunk has NO epilogue: it ends on "jal gte_scale_matrix" + delay slot and - * simply falls through into the next symbol, gfx2D_BG0_OBJ_1B4 (0x800509C0), which - * has no prologue either -- it consumes $s5/$fp/$s1 and stack slots set up here. - * GsSortBg also exits mid-body with a bare "j gfx2D_BG0_OBJ_1B4". gcc-2.7.2 cannot - * express this from C: expand_function_end/function_epilogue unconditionally append - * "jr $ra; nop" to any cc1-compiled function (no sibcall, no tail-merge pass), and - * neither noreturn nor __builtin_unreachable suppresses it. Matching-cookbook - * SS179-C: emit the whole function as FILE-SCOPE basic __asm__, transcribed 1:1, - * with literal tab-formed ".ent\t"/".end\t" text (maspsx special-cases lines - * starting with ".ent\t" to emit a fresh ".set\tnoreorder"; a plain ".set" line is - * swallowed, and using the .s macros glabel/endlabel would leave GNU as in default - * REORDER mode, auto-inserting nops after every branch and displacing our - * hand-filled delay slots). Memory displacements are written in DECIMAL because - * maspsx parses load/store offsets with base-10 int() before its range check. - * Branch targets .L80051010 (defined in gfx2D_BG0_OBJ_698.s, included later in - * this same translation unit) and the cross-TU callees resolve at assembly/link - * time exactly as the target's own relocation lines name them. - */ -__asm__( - ".text\n" - ".align\t2\n" - ".globl\tGsSortBg\n" - ".ent\tGsSortBg\n" - "GsSortBg:\n" - ".set\tnoreorder\n" - "addiu $sp, $sp, -224\n" - "sw $s5, 204($sp)\n" - "addu $s5, $a0, $zero\n" - "sw $ra, 220($sp)\n" - "sw $fp, 216($sp)\n" - "sw $s7, 212($sp)\n" - "sw $s6, 208($sp)\n" - "sw $s4, 200($sp)\n" - "sw $s3, 196($sp)\n" - "sw $s2, 192($sp)\n" - "sw $s1, 188($sp)\n" - "sw $s0, 184($sp)\n" - "sw $a1, 80($sp)\n" - "lw $a1, 0($s5)\n" - "nop\n" - "bltz $a1, .L80051010\n" - "sh $a2, 88($sp)\n" - "lw $v0, 20($s5)\n" - "nop\n" - "lhu $a2, 2($v0)\n" - "nop\n" - "andi $a0, $a2, 0xFFFF\n" - "beqz $a0, .L80051010\n" - "nop\n" - "lhu $a3, 4($v0)\n" - "nop\n" - "beqz $a3, .L80051010\n" - "nop\n" - "lbu $t8, 0($v0)\n" - "nop\n" - "bnez $t8, .L80050894\n" - "sh $t8, 128($sp)\n" - "addiu $t8, $zero, 256\n" - "sh $t8, 128($sp)\n" - ".L80050894:\n" - "lbu $fp, 1($v0)\n" - "nop\n" - "bnez $fp, .L800508A8\n" - "nop\n" - "addiu $fp, $zero, 256\n" - ".L800508A8:\n" - "lhu $t8, 128($sp)\n" - "nop\n" - "mult $t8, $a0\n" - "srl $v1, $a1, 29\n" - "andi $v1, $v1, 0x2\n" - "srl $v0, $a1, 6\n" - "andi $v0, $v0, 0x1\n" - "ori $v0, $v0, 0x2C\n" - "or $v1, $v1, $v0\n" - "sb $v1, 48($sp)\n" - "srl $v1, $a1, 17\n" - "andi $v1, $v1, 0x180\n" - "lbu $v0, 16($s5)\n" - "mflo $t8\n" - "sb $v0, 49($sp)\n" - "lbu $v0, 17($s5)\n" - "mult $fp, $a3\n" - "addu $s1, $a2, $zero\n" - "sb $v0, 50($sp)\n" - "srl $v0, $a1, 23\n" - "andi $v0, $v0, 0x60\n" - "or $v1, $v1, $v0\n" - "lui $v0, 0x800\n" - "sw $t8, 112($sp)\n" - "lbu $a0, 18($s5)\n" - "and $v0, $a1, $v0\n" - "sh $v1, 96($sp)\n" - "sb $a0, 51($sp)\n" - "mflo $t8\n" - "bnez $v0, .L80050948\n" - "sw $t8, 120($sp)\n" - "lui $v1, 0x1000\n" - "lw $v0, 28($s5)\n" - "ori $v1, $v1, 0x1000\n" - "bne $v0, $v1, .L80050950\n" - "addiu $v0, $zero, 1\n" - "lw $v0, 32($s5)\n" - "nop\n" - "bnez $v0, .L80050950\n" - "addiu $v0, $zero, 1\n" - ".L80050948:\n" - "j gfx2D_BG0_OBJ_1B4\n" - "sw $zero, 72($sp)\n" - ".L80050950:\n" - "sw $v0, 72($sp)\n" - "lui $a1, %hi(D_800AE620)\n" - "addiu $a1, $a1, %lo(D_800AE620)\n" - "lw $v0, 0($a1)\n" - "lw $v1, 4($a1)\n" - "lw $a0, 8($a1)\n" - "sw $v0, 16($sp)\n" - "sw $v1, 20($sp)\n" - "sw $a0, 24($sp)\n" - "lw $v0, 12($a1)\n" - "lw $v1, 16($a1)\n" - "lw $a0, 20($a1)\n" - "sw $v0, 28($sp)\n" - "sw $v1, 32($sp)\n" - "sw $a0, 36($sp)\n" - "lw $v0, 24($a1)\n" - "lw $v1, 28($a1)\n" - "sw $v0, 40($sp)\n" - "sw $v1, 44($sp)\n" - "addiu $s0, $sp, 16\n" - "lw $a1, 32($s5)\n" - "jal func_80053B20\n" - "addu $a0, $s0, $zero\n" - "addu $a0, $s0, $zero\n" - "lh $a1, 28($s5)\n" - "lh $a2, 30($s5)\n" - "jal gte_scale_matrix\n" - "addiu $a3, $zero, 4096\n" - ".set\treorder\n" - ".end\tGsSortBg\n" -); - -/* gfx2D_BG0_OBJ_1B4 (0x800509C0) is NOT a callable function: fragment 2 of one larger routine - * beginning in GsSortBg (owns the 0xE0 frame + saves), continuing through - * gfx2D_BG0_OBJ_4A0/_4D8/_658/_698. No prologue/epilogue: entered by `j gfx2D_BG0_OBJ_1B4` - * with live values in $s5/$fp/$s1, stores into the CALLER's frame; exits via - * `j gfx2D_BG0_OBJ_4A0` on one path and falls through into it on the other. Expressed as the - * byte-verified file-scope inline-asm fragment idiom of src/800c.c (SYS_OBJ_1DC0). - * Transcription laws learned here: maspsx rejects HEX immediates in __asm__ strings (decimal - * only); its expand-div parser requires cc1-style TIGHT COMMAS; and ASPSX break encoding puts - * the trap code in the HIGH field (word 0x0007000D) -- spelled `break 7168`/`break 6144` - * (= code<<10, GNU-as places code at bits 25..6) since bare `break 7` encodes 0x0000018D. - * Body transcribed 1:1 from asm/nonmatchings/800b_7/gfx2D_BG0_OBJ_1B4.s; - * `beq $a1,$v0,.L80050D5C` forward-references the label defined in gfx2D_BG0_OBJ_4D8.s of the - * SAME assembly unit (INCLUDE_ASM .includes all sibling .s files into one assembly stream). - */ -__asm__( - ".text\n" - ".align\t2\n" - ".globl\tgfx2D_BG0_OBJ_1B4\n" - ".ent\tgfx2D_BG0_OBJ_1B4\n" - "gfx2D_BG0_OBJ_1B4:\n" - ".set\tnoreorder\n" - "lh $v0,12($s5)\n" - "lw $t8,112($sp)\n" - "nop\n" - "div $zero,$v0,$t8\n" - "bnez $t8,.L800509DC\n" - "nop\n" - "break 7168\n" - ".L800509DC:\n" - "addiu $at,$zero,-1\n" - "bne $t8,$at,.L800509F4\n" - "lui $at,32768\n" - "bne $v0,$at,.L800509F4\n" - "nop\n" - "break 6144\n" - ".L800509F4:\n" - "mfhi $t3\n" - "lui $s2,%hi(D_800A5E60)\n" - "lw $s2,%lo(D_800A5E60)($s2)\n" - "lh $t8,8($s5)\n" - "nop\n" - "sw $t8,104($sp)\n" - "lh $v1,10($s5)\n" - "bgez $t3,.L80050A24\n" - "andi $a0,$fp,65535\n" - "lw $t8,112($sp)\n" - "nop\n" - "addu $t3,$t3,$t8\n" - ".L80050A24:\n" - "lh $v0,14($s5)\n" - "lw $t8,120($sp)\n" - "nop\n" - "div $zero,$v0,$t8\n" - "bnez $t8,.L80050A40\n" - "nop\n" - "break 7168\n" - ".L80050A40:\n" - "addiu $at,$zero,-1\n" - "bne $t8,$at,.L80050A58\n" - "lui $at,32768\n" - "bne $v0,$at,.L80050A58\n" - "nop\n" - "break 6144\n" - ".L80050A58:\n" - "mfhi $t7\n" - "nop\n" - "bgez $t7,.L80050A70\n" - "addu $s6,$t7,$zero\n" - "addu $t7,$t7,$t8\n" - "addu $s6,$t7,$zero\n" - ".L80050A70:\n" - "div $zero,$s6,$a0\n" - "bnez $a0,.L80050A80\n" - "nop\n" - "break 7168\n" - ".L80050A80:\n" - "addiu $at,$zero,-1\n" - "bne $a0,$at,.L80050A98\n" - "lui $at,32768\n" - "bne $s6,$at,.L80050A98\n" - "nop\n" - "break 6144\n" - ".L80050A98:\n" - "mfhi $t2\n" - "lh $t8,6($s5)\n" - "subu $s7,$fp,$t2\n" - "andi $v0,$s7,65535\n" - "slt $v0,$v1,$v0\n" - "beqz $v0,.L80050AB8\n" - "sw $t8,136($sp)\n" - "addu $s7,$v1,$zero\n" - ".L80050AB8:\n" - "andi $t4,$s1,65535\n" - "addu $v1,$s6,$v1\n" - "lhu $t5,128($sp)\n" - "lw $t8,104($sp)\n" - "addiu $t1,$s2,4\n" - "sw $v1,144($sp)\n" - "lhu $v0,26($s5)\n" - "sh $s7,64($sp)\n" - "addu $t6,$t3,$t8\n" - "lhu $t8,136($sp)\n" - "negu $v0,$v0\n" - "sh $v0,68($sp)\n" - "sh $t8,60($sp)\n" - ".L80050AEC:\n" - "addu $s0,$t3,$zero\n" - "div $zero,$s0,$t5\n" - "bnez $t5,.L80050B00\n" - "nop\n" - "break 7168\n" - ".L80050B00:\n" - "addiu $at,$zero,-1\n" - "bne $t5,$at,.L80050B18\n" - "lui $at,32768\n" - "bne $s0,$at,.L80050B18\n" - "nop\n" - "break 6144\n" - ".L80050B18:\n" - "mfhi $a2\n" - "lhu $t8,128($sp)\n" - "lh $t0,4($s5)\n" - "subu $s3,$t8,$a2\n" - "lw $t8,104($sp)\n" - "andi $v0,$s3,65535\n" - "slt $v0,$t8,$v0\n" - "beqz $v0,.L80050B40\n" - "nop\n" - "lhu $s3,104($sp)\n" - ".L80050B40:\n" - "lw $t8,120($sp)\n" - "nop\n" - "div $zero,$s6,$t8\n" - "bnez $t8,.L80050B58\n" - "nop\n" - "break 7168\n" - ".L80050B58:\n" - "addiu $at,$zero,-1\n" - "bne $t8,$at,.L80050B70\n" - "lui $at,32768\n" - "bne $s6,$at,.L80050B70\n" - "nop\n" - "break 6144\n" - ".L80050B70:\n" - "mfhi $v0\n" - "lw $t8,112($sp)\n" - "nop\n" - "div $zero,$s0,$t8\n" - "bnez $t8,.L80050B8C\n" - "nop\n" - "break 7168\n" - ".L80050B8C:\n" - "addiu $at,$zero,-1\n" - "bne $t8,$at,.L80050BA4\n" - "lui $at,32768\n" - "bne $s0,$at,.L80050BA4\n" - "nop\n" - "break 6144\n" - ".L80050BA4:\n" - "mfhi $v1\n" - "nop\n" - "nop\n" - "div $zero,$v0,$fp\n" - "bnez $fp,.L80050BC0\n" - "nop\n" - "break 7168\n" - ".L80050BC0:\n" - "addiu $at,$zero,-1\n" - "bne $fp,$at,.L80050BD8\n" - "lui $at,32768\n" - "bne $v0,$at,.L80050BD8\n" - "nop\n" - "break 6144\n" - ".L80050BD8:\n" - "mflo $v0\n" - "nop\n" - "nop\n" - "div $zero,$v1,$t5\n" - "bnez $t5,.L80050BF4\n" - "nop\n" - "break 7168\n" - ".L80050BF4:\n" - "addiu $at,$zero,-1\n" - "bne $t5,$at,.L80050C0C\n" - "lui $at,32768\n" - "bne $v1,$at,.L80050C0C\n" - "nop\n" - "break 6144\n" - ".L80050C0C:\n" - "mflo $v1\n" - "nop\n" - "nop\n" - "mult $v0,$t4\n" - "lw $a0,20($s5)\n" - "mflo $t8\n" - "addu $s1,$v1,$t8\n" - "lw $v1,12($a0)\n" - "sll $v0,$s1,1\n" - "addu $v0,$v0,$v1\n" - "lhu $a1,0($v0)\n" - "ori $v0,$zero,65535\n" - "beq $a1,$v0,.L80050D5C\n" - "addiu $v0,$s2,40\n" - "lw $v1,8($a0)\n" - "sw $v0,0($s2)\n" - "addiu $v0,$zero,9\n" - "sb $v0,-1($t1)\n" - "sll $v0,$a1,3\n" - "addu $a3,$v1,$v0\n" - "lhu $v0,6($a3)\n" - "lhu $t8,96($sp)\n" - "andi $v0,$v0,31\n" - "or $v0,$t8,$v0\n" - "sh $v0,52($sp)\n" - "lhu $v0,2($a3)\n" - "sh $t0,58($sp)\n" - "sh $v0,54($sp)\n" - "lhu $v0,4($a3)\n" - "nop\n" - "andi $v0,$v0,2\n" - "beqz $v0,.L80050C9C\n" - "nop\n" - "lbu $v0,0($a3)\n" - "j gfx2D_BG0_OBJ_4A0\n" - "sb $v0,56($sp)\n" - ".L80050C9C:\n" - "lbu $v0,0($a3)\n" - "nop\n" - "addu $v0,$v0,$a2\n" - "sb $v0,56($sp)\n" - ".set\treorder\n" - ".end\tgfx2D_BG0_OBJ_1B4\n" -); - -__asm__( - ".text\n" - ".align\t2\n" - ".globl\tgfx2D_BG0_OBJ_4A0\n" - ".ent\tgfx2D_BG0_OBJ_4A0\n" - "gfx2D_BG0_OBJ_4A0:\n" - ".set\tnoreorder\n" - "lhu $v0, 4($a3)\n" - "nop\n" - "andi $v0, $v0, 0x1\n" - "beqz $v0, .L80050CD8\n" - "nop\n" - "lbu $v0, 1($a3)\n" - "nop\n" - "addu $v0, $fp, $v0\n" - "subu $v0, $v0, $s7\n" - "j gfx2D_BG0_OBJ_4D8\n" - "subu $v0, $v0, $t2\n" - ".L80050CD8:\n" - "lbu $v0, 1($a3)\n" - "nop\n" - "addu $v0, $v0, $t2\n" - ".set\treorder\n" - ".end\tgfx2D_BG0_OBJ_4A0\n" -); - -__asm__( - ".text\n" - ".align\t2\n" - ".globl\tgfx2D_BG0_OBJ_4D8\n" - ".ent\tgfx2D_BG0_OBJ_4D8\n" - "gfx2D_BG0_OBJ_4D8:\n" - ".set\tnoreorder\n" - "sb $v0, 57($sp)\n" - "addu $a0, $t1, $zero\n" - "addiu $a1, $sp, 48\n" - "addiu $a2, $sp, 16\n" - "addiu $t1, $t1, 40\n" - "sh $s3, 62($sp)\n" - "lhu $v0, 24($s5)\n" - "subu $v1, $s0, $t3\n" - "subu $v1, $v1, $v0\n" - "sh $v1, 66($sp)\n" - "lhu $v0, 4($a3)\n" - "addiu $s2, $s2, 40\n" - "sw $t0, 152($sp)\n" - "sw $t1, 156($sp)\n" - "sw $t2, 160($sp)\n" - "sw $t3, 164($sp)\n" - "sw $t4, 168($sp)\n" - "sw $t5, 172($sp)\n" - "sw $t6, 176($sp)\n" - "sw $t7, 180($sp)\n" - "jal _mk_spr_packet\n" - "sh $v0, 70($sp)\n" - "lw $t7, 180($sp)\n" - "lw $t6, 176($sp)\n" - "lw $t5, 172($sp)\n" - "lw $t4, 168($sp)\n" - "lw $t3, 164($sp)\n" - "lw $t2, 160($sp)\n" - "lw $t1, 156($sp)\n" - "lw $t0, 152($sp)\n" - ".L80050D5C:\n" - "slt $v0, $s0, $t6\n" - ".word 0x10400073\n" - "nop\n" - "addiu $s4, $s2, 4\n" - "addiu $s1, $s1, 1\n" - ".L80050D70:\n" - ".word 0x022C001A\n" - "bnez $t4, .L80050D80\n" - "nop\n" - ".word 0x0007000D\n" - ".L80050D80:\n" - "addiu $at, $zero, -1\n" - "bne $t4, $at, .L80050D98\n" - "lui $at, 0x8000\n" - "bne $s1, $at, .L80050D98\n" - "nop\n" - ".word 0x0006000D\n" - ".L80050D98:\n" - "mfhi $v0\n" - "nop\n" - "bnez $v0, .L80050DAC\n" - "andi $v0, $s3, 0xFFFF\n" - "subu $s1, $s1, $t4\n" - ".L80050DAC:\n" - "addu $s0, $s0, $v0\n" - "addu $t0, $t0, $v0\n" - "subu $s3, $t6, $s0\n" - "andi $v0, $s3, 0xFFFF\n" - ".word 0x01A2102B\n" - "beqz $v0, .L80050DCC\n" - "nop\n" - "lhu $s3, 128($sp)\n" - ".L80050DCC:\n" - "lw $a0, 20($s5)\n" - "nop\n" - "lw $v0, 12($a0)\n" - "sll $v1, $s1, 1\n" - "addu $v1, $v1, $v0\n" - "lhu $a1, 0($v1)\n" - "ori $v0, $zero, 0xFFFF\n" - ".word 0x10A2004E\n" - "slt $v0, $s0, $t6\n" - "lw $v1, 8($a0)\n" - "addiu $v0, $s2, 40\n" - "sw $v0, 0($s2)\n" - "addiu $v0, $zero, 9\n" - "sb $v0, -1($s4)\n" - "sll $v0, $a1, 3\n" - "addu $a3, $v1, $v0\n" - "lhu $v0, 6($a3)\n" - "lhu $t8, 96($sp)\n" - "andi $v0, $v0, 0x1F\n" - "or $v0, $t8, $v0\n" - "sh $v0, 52($sp)\n" - "subu $v0, $t0, $s0\n" - "lhu $v1, 2($a3)\n" - "addu $v0, $v0, $t3\n" - "sh $v0, 58($sp)\n" - "sh $v1, 54($sp)\n" - "lhu $v0, 4($a3)\n" - "nop\n" - "andi $v0, $v0, 2\n" - "beqz $v0, .L80050E60\n" - "nop\n" - "lbu $v0, 0($a3)\n" - "lhu $t8, 128($sp)\n" - "nop\n" - "addu $v0, $t8, $v0\n" - "j gfx2D_BG0_OBJ_658\n" - "subu $v0, $v0, $s3\n" - ".L80050E60:\n" - "lbu $v0, 0($a3)\n" - ".set\treorder\n" - ".end\tgfx2D_BG0_OBJ_4D8\n" -); - -__asm__(".text\n.align 2\n.globl gfx2D_BG0_OBJ_658\n.ent\tgfx2D_BG0_OBJ_658\n" - "gfx2D_BG0_OBJ_658:\n.frame $sp,0,$31\n.mask 0,0\n.fmask 0,0\n" - ".set\tnoreorder\n" - "nop\n" - "sb $2, 56($sp)\n" - "lhu $2, 4($7)\n" - "nop\n" - "andi $2, $2, 1\n" - "beq $2, $0, .L80050E98\n" - "nop\n" - "lbu $2, 1($7)\n" - "nop\n" - "addu $2, $30, $2\n" - "subu $2, $2, $23\n" - "j gfx2D_BG0_OBJ_698\n" - "subu $2, $2, $10\n" - ".L80050E98:\n" - "lbu $2, 1($7)\n" - "nop\n" - "addu $2, $2, $10\n" - ".set\treorder\n.end\tgfx2D_BG0_OBJ_658\n"); - -extern s32 D_800A5E60; - -__asm__( -".text\n" -".align\t2\n" -".globl\tgfx2D_BG0_OBJ_698\n" -".ent\tgfx2D_BG0_OBJ_698\n" -"gfx2D_BG0_OBJ_698:\n" -".set\tnoreorder\n" -"sb $v0,57($sp)\n" -"addu $a0,$s4,$zero\n" -"addiu $a1,$sp,48\n" -"addiu $a2,$sp,16\n" -"addiu $s4,$s4,40\n" -"addiu $t1,$t1,40\n" -"sh $s3,62($sp)\n" -"lhu $v0,24($s5)\n" -"subu $v1,$s0,$t3\n" -"subu $v1,$v1,$v0\n" -"sh $v1,66($sp)\n" -"lhu $v0,4($a3)\n" -"addiu $s2,$s2,40\n" -"sw $t0,152($sp)\n" -"sw $t1,156($sp)\n" -"sw $t2,160($sp)\n" -"sw $t3,164($sp)\n" -"sw $t4,168($sp)\n" -"sw $t5,172($sp)\n" -"sw $t6,176($sp)\n" -"sw $t7,180($sp)\n" -"jal _mk_spr_packet\n" -"sh $v0,70($sp)\n" -"lw $t7,180($sp)\n" -"lw $t6,176($sp)\n" -"lw $t5,172($sp)\n" -"lw $t4,168($sp)\n" -"lw $t3,164($sp)\n" -"lw $t2,160($sp)\n" -"lw $t1,156($sp)\n" -"lw $t0,152($sp)\n" -"slt $v0,$s0,$t6\n" -".L80050F24:\n" -".word 0x1440ff92\n" -"addiu $s1,$s1,1\n" -"addiu $s1,$s1,-1\n" -".L80050F30:\n" -"lw $t8,136($sp)\n" -"andi $v0,$s7,65535\n" -"addu $t8,$t8,$v0\n" -"sw $t8,136($sp)\n" -"lw $t8,144($sp)\n" -"addu $s6,$s6,$v0\n" -"subu $s7,$t8,$s6\n" -"andi $v0,$s7,65535\n" -"sltu $v0,$fp,$v0\n" -"beqz $v0,.L80050F60\n" -"nop\n" -"addu $s7,$fp,$zero\n" -".L80050F60:\n" -"lw $t8,136($sp)\n" -"lhu $v1,26($s5)\n" -"sh $s7,64($sp)\n" -"subu $v0,$t8,$s6\n" -"addu $v0,$v0,$t7\n" -"sh $v0,60($sp)\n" -"subu $v0,$s6,$t7\n" -"lw $t8,144($sp)\n" -"subu $v0,$v0,$v1\n" -"sh $v0,68($sp)\n" -"slt $v0,$s6,$t8\n" -".word 0x1440fed7\n" -"addu $t2,$zero,$zero\n" -"lw $t8,80($sp)\n" -"nop\n" -"lw $v1,8($t8)\n" -"lhu $v0,88($sp)\n" -"nop\n" -"addu $a0,$v0,$v1\n" -"bgez $a0,.L80050FB8\n" -"nop\n" -"addu $a0,$zero,$zero\n" -".L80050FB8:\n" -"lui $v0,%hi(D_800A5E60)\n" -"lw $v0,%lo(D_800A5E60)($v0)\n" -"nop\n" -"beq $s2,$v0,.L80051008\n" -"sll $v0,$a0,2\n" -"lw $t8,80($sp)\n" -"nop\n" -"lw $v1,4($t8)\n" -"nop\n" -"addu $v1,$v1,$v0\n" -"lw $v0,0($v1)\n" -"addiu $s2,$s2,-40\n" -"sw $v0,0($s2)\n" -"addiu $v0,$zero,9\n" -"sb $v0,3($s2)\n" -"lui $v0,%hi(D_800A5E60)\n" -"lw $v0,%lo(D_800A5E60)($v0)\n" -"addiu $s2,$s2,40\n" -"sw $v0,0($v1)\n" -"sb $zero,3($v1)\n" -".L80051008:\n" -"lui $at,%hi(D_800A5E60)\n" -"sw $s2,%lo(D_800A5E60)($at)\n" -".L80051010:\n" -"lw $ra,220($sp)\n" -"lw $fp,216($sp)\n" -"lw $s7,212($sp)\n" -"lw $s6,208($sp)\n" -"lw $s5,204($sp)\n" -"lw $s4,200($sp)\n" -"lw $s3,196($sp)\n" -"lw $s2,192($sp)\n" -"lw $s1,188($sp)\n" -"lw $s0,184($sp)\n" -"addiu $sp,$sp,224\n" -"jr $ra\n" -"nop\n" -".set\treorder\n" -".end\tgfx2D_BG0_OBJ_698\n" -); - -/* GsSortFastBg (asm/nonmatchings/800b_7/GsSortFastBg.s, 0x648 = 402 ins). - * - * Cookbook SS179-C + its P31-S60 ADDENDUM. This chunk has NO epilogue: it is - * fragment 1 of one larger routine whose shared tail lives in the next symbol, - * gfx2D_BG1_OBJ_648 (0x8005168C, already banked in this TU). Every exit is a raw - * "bnez $v0, gfx2D_BG1_OBJ_648" / "j gfx2D_BG1_OBJ_648" with $t0-$t9/$s0-$s7/$fp - * live-out, and the early-out "bltz $a0, .L800517D0" branches straight into that - * sibling's frame teardown. gcc-2.7.2 has no sibcall/tail-merge pass and - * expand_function_end unconditionally appends "jr $ra; nop" to anything cc1 - * compiles, so no C spelling can express this -- it must be file-scope basic asm. - * - * Transcription rules that are load-bearing (SS179-B): - * - literal tab-formed ".ent\t"/".end\t"/".set\t" text (glabel is an as macro - * maspsx never sees, and a space-formed ".set noreorder" leaves maspsx in - * reorder mode, where it appends a nop after every branch); - * - every load/store displacement and addiu immediate in DECIMAL (maspsx calls - * bare int() on them before its range check); - * - the hand-written load-delay nops are transcribed 1:1 and SUPPRESS maspsx's - * own insertion (its get_next_instruction only skips the literal "#nop", so a - * real "nop" reads as the next instruction and never loads from $r_dest); - * - the two div-by-zero traps are ".word" because maspsx rewrites "break N" to - * "break N>>10,N&0x3FF" (bits 6..15), giving 0x000001cd, not the target's - * 0x0007000d (bits 16..25); - * - internal targets keep their ".L" prefix (a bare label would become a symtab - * entry and truncate the objdump boundary walk); - * - ".type/.size" are required or the harness finds no function at this symbol. - * The out-of-chunk targets are written against the successor symbol - * (gfx2D_BG1_OBJ_648+324 == .L800517D0) exactly as the already-banked - * gfx2D_BG1_OBJ_648 block writes its own back-references into this one. - */ -__asm__( - ".set\tnoreorder\n" - ".set\tnoat\n" - ".section\t.text\n" - ".align\t2\n" - ".globl\tGsSortFastBg\n" - ".type\tGsSortFastBg, @function\n" - ".ent\tGsSortFastBg\n" - "GsSortFastBg:\n" - ".set\tnoreorder\n" - "addiu $sp,$sp,-168\n" - "addu $t7,$a0,$zero\n" - "sw $ra,164($sp)\n" - "sw $fp,160($sp)\n" - "sw $s7,156($sp)\n" - "sw $s6,152($sp)\n" - "sw $s5,148($sp)\n" - "sw $s4,144($sp)\n" - "sw $s3,140($sp)\n" - "sw $s2,136($sp)\n" - "sw $s1,132($sp)\n" - "sw $s0,128($sp)\n" - "sw $a1,16($sp)\n" - "lw $a0,0($t7)\n" - "nop\n" - "bltz $a0,gfx2D_BG1_OBJ_648+324\n" - "sh $a2,24($sp)\n" - "lw $t1,20($t7)\n" - "nop\n" - "lbu $s2,0($t1)\n" - "nop\n" - "bnez $s2,.L800510A8\n" - "sh $s2,64($sp)\n" - "addiu $s2,$zero,256\n" - "sh $s2,64($sp)\n" - ".L800510A8:\n" - "lbu $t3,1($t1)\n" - "nop\n" - "bnez $t3,.L800510BC\n" - "nop\n" - "addiu $t3,$zero,256\n" - ".L800510BC:\n" - "lhu $t6,2($t1)\n" - "lhu $t5,64($sp)\n" - "nop\n" - "mult $t5,$t6\n" - "srl $v1,$a0,17\n" - "andi $v1,$v1,0x180\n" - "srl $v0,$a0,23\n" - "andi $v0,$v0,0x60\n" - "or $v1,$v1,$v0\n" - "sh $v1,32($sp)\n" - "srl $v1,$a0,5\n" - "mflo $s6\n" - "lh $v0,12($t7)\n" - "sll $a2,$a0,18\n" - "div $zero,$v0,$s6\n" - "bnez $s6,.L80051104\n" - "nop\n" - ".word 0x0007000d\n" - ".L80051104:\n" - "addiu $at,$zero,-1\n" - "bne $s6,$at,.L8005111C\n" - "lui $at,0x8000\n" - "bne $v0,$at,.L8005111C\n" - "nop\n" - ".word 0x0006000d\n" - ".L8005111C:\n" - "mfhi $fp\n" - "lbu $a3,16($t7)\n" - "lbu $a0,17($t7)\n" - "lbu $a1,18($t7)\n" - "sll $a0,$a0,8\n" - "sll $a1,$a1,16\n" - "lui $v0,0x200\n" - "and $v1,$v1,$v0\n" - "lui $v0,0x100\n" - "and $a2,$a2,$v0\n" - "lui $v0,0x6400\n" - "or $v0,$a2,$v0\n" - "or $v0,$v1,$v0\n" - "or $v0,$v0,$a3\n" - "or $v0,$v0,$a0\n" - "or $v0,$v0,$a1\n" - "sw $v0,40($sp)\n" - "lui $v0,0x2C00\n" - "or $a2,$a2,$v0\n" - "or $v1,$v1,$a2\n" - "or $v1,$v1,$a3\n" - "or $v1,$v1,$a0\n" - "or $v1,$v1,$a1\n" - "lh $a0,4($t7)\n" - "lh $v0,24($t7)\n" - "lui $a1,%hi(D_800A6548)\n" - "lh $a1,%lo(D_800A6548)($a1)\n" - "sw $v1,48($sp)\n" - "lh $v1,26($t7)\n" - "subu $a0,$a0,$v0\n" - "lh $v0,6($t7)\n" - "addu $a0,$a0,$a1\n" - "sw $a0,72($sp)\n" - "lhu $a0,4($t1)\n" - "andi $t4,$t3,0xFFFF\n" - "mult $t4,$a0\n" - "lui $s0,%hi(D_800A5E60)\n" - "lw $s0,%lo(D_800A5E60)($s0)\n" - "lh $s2,8($t7)\n" - "subu $v0,$v0,$v1\n" - "lui $v1,%hi(D_800A654A)\n" - "lh $v1,%lo(D_800A654A)($v1)\n" - "sw $s2,56($sp)\n" - "lh $a0,10($t7)\n" - "mflo $s5\n" - "bgez $fp,.L800511DC\n" - "addu $a1,$v0,$v1\n" - "addu $fp,$fp,$s6\n" - ".L800511DC:\n" - "lh $v0,14($t7)\n" - "nop\n" - "div $zero,$v0,$s5\n" - "bnez $s5,.L800511F4\n" - "nop\n" - ".word 0x0007000d\n" - ".L800511F4:\n" - "addiu $at,$zero,-1\n" - "bne $s5,$at,.L8005120C\n" - "lui $at,0x8000\n" - "bne $v0,$at,.L8005120C\n" - "nop\n" - ".word 0x0006000d\n" - ".L8005120C:\n" - "mfhi $v1\n" - "nop\n" - "bgez $v1,.L80051224\n" - "addu $t8,$v1,$zero\n" - "addu $v1,$v1,$s5\n" - "addu $t8,$v1,$zero\n" - ".L80051224:\n" - "div $zero,$t8,$t4\n" - "bnez $t4,.L80051234\n" - "nop\n" - ".word 0x0007000d\n" - ".L80051234:\n" - "addiu $at,$zero,-1\n" - "bne $t4,$at,.L8005124C\n" - "lui $at,0x8000\n" - "bne $t8,$at,.L8005124C\n" - "nop\n" - ".word 0x0006000d\n" - ".L8005124C:\n" - "mfhi $s1\n" - "andi $t2,$t2,0xFFFF\n" - "sll $v0,$a1,16\n" - "or $t2,$t2,$v0\n" - "andi $t0,$t0,0xFFFF\n" - "subu $v0,$t3,$s1\n" - "sll $v0,$v0,16\n" - "or $t0,$t0,$v0\n" - "srl $v0,$t0,16\n" - "slt $v0,$a0,$v0\n" - "beqz $v0,.L80051284\n" - "sll $v0,$a0,16\n" - "andi $t0,$t0,0xFFFF\n" - "or $t0,$t0,$v0\n" - ".L80051284:\n" - "lui $t9,0xFFFF\n" - "lui $v0,0xE100\n" - "ori $v0,$v0,0x200\n" - "lhu $s2,32($sp)\n" - "addu $a0,$t8,$a0\n" - "or $s7,$s2,$v0\n" - "lw $s2,56($sp)\n" - "addu $s4,$t4,$zero\n" - "sw $a0,104($sp)\n" - "addu $s3,$fp,$s2\n" - "sll $s2,$s4,16\n" - "sw $s2,112($sp)\n" - ".L800512B4:\n" - "addu $t3,$fp,$zero\n" - "div $zero,$t3,$t5\n" - "bnez $t5,.L800512C8\n" - "nop\n" - ".word 0x0007000d\n" - ".L800512C8:\n" - "addiu $at,$zero,-1\n" - "bne $t5,$at,.L800512E0\n" - "lui $at,0x8000\n" - "bne $t3,$at,.L800512E0\n" - "nop\n" - ".word 0x0006000d\n" - ".L800512E0:\n" - "mfhi $t4\n" - "and $t2,$t2,$t9\n" - "and $t0,$t0,$t9\n" - "lhu $v0,72($sp)\n" - "lhu $s2,64($sp)\n" - "or $t2,$t2,$v0\n" - "subu $v0,$s2,$t4\n" - "andi $v0,$v0,0xFFFF\n" - "lw $s2,56($sp)\n" - "or $t0,$t0,$v0\n" - "slt $v0,$s2,$v0\n" - "beqz $v0,.L80051324\n" - "nop\n" - "and $t0,$t0,$t9\n" - "lhu $v0,56($sp)\n" - "nop\n" - "or $t0,$t0,$v0\n" - ".L80051324:\n" - "div $zero,$t8,$s5\n" - "bnez $s5,.L80051334\n" - "nop\n" - ".word 0x0007000d\n" - ".L80051334:\n" - "addiu $at,$zero,-1\n" - "bne $s5,$at,.L8005134C\n" - "lui $at,0x8000\n" - "bne $t8,$at,.L8005134C\n" - "nop\n" - ".word 0x0006000d\n" - ".L8005134C:\n" - "mfhi $v0\n" - "nop\n" - "nop\n" - "div $zero,$t3,$s6\n" - "bnez $s6,.L80051368\n" - "nop\n" - ".word 0x0007000d\n" - ".L80051368:\n" - "addiu $at,$zero,-1\n" - "bne $s6,$at,.L80051380\n" - "lui $at,0x8000\n" - "bne $t3,$at,.L80051380\n" - "nop\n" - ".word 0x0006000d\n" - ".L80051380:\n" - "mfhi $v1\n" - "nop\n" - "nop\n" - "div $zero,$v0,$s4\n" - "bnez $s4,.L8005139C\n" - "nop\n" - ".word 0x0007000d\n" - ".L8005139C:\n" - "addiu $at,$zero,-1\n" - "bne $s4,$at,.L800513B4\n" - "lui $at,0x8000\n" - "bne $v0,$at,.L800513B4\n" - "nop\n" - ".word 0x0006000d\n" - ".L800513B4:\n" - "mflo $v0\n" - "nop\n" - "nop\n" - "div $zero,$v1,$t5\n" - "bnez $t5,.L800513D0\n" - "nop\n" - ".word 0x0007000d\n" - ".L800513D0:\n" - "addiu $at,$zero,-1\n" - "bne $t5,$at,.L800513E8\n" - "lui $at,0x8000\n" - "bne $v1,$at,.L800513E8\n" - "nop\n" - ".word 0x0006000d\n" - ".L800513E8:\n" - "mflo $v1\n" - "nop\n" - "nop\n" - "mult $v0,$t6\n" - "lw $a1,20($t7)\n" - "mflo $s2\n" - "addu $t1,$v1,$s2\n" - "lw $v1,12($a1)\n" - "sll $v0,$t1,1\n" - "addu $v0,$v0,$v1\n" - "lhu $a0,0($v0)\n" - "ori $v0,$zero,0xFFFF\n" - "beq $a0,$v0,.L80051594\n" - "sll $v0,$a0,3\n" - "lw $v1,8($a1)\n" - "andi $s2,$t3,0x1\n" - "sw $s2,120($sp)\n" - "beqz $s2,.L80051514\n" - "addu $a3,$v1,$v0\n" - "addiu $a2,$s0,40\n" - "addiu $v0,$zero,9\n" - "sw $a2,0($s0)\n" - "sb $v0,3($s0)\n" - "lw $s2,48($sp)\n" - "sw $t2,8($s0)\n" - "sw $s2,4($s0)\n" - "lbu $v0,0($a3)\n" - "nop\n" - "addu $v0,$v0,$t4\n" - "sb $v0,12($s0)\n" - "lbu $v0,1($a3)\n" - "addiu $a1,$t2,1\n" - "addu $v0,$v0,$s1\n" - "sb $v0,13($s0)\n" - "lhu $v0,2($a3)\n" - "srl $a0,$t2,16\n" - "sh $a1,16($s0)\n" - "sh $a0,18($s0)\n" - "sh $v0,14($s0)\n" - "lbu $v0,0($a3)\n" - "nop\n" - "addu $v0,$v0,$t4\n" - "sb $v0,20($s0)\n" - "lbu $v0,1($a3)\n" - "srl $v1,$t0,16\n" - "addu $v0,$v0,$s1\n" - "sb $v0,21($s0)\n" - "lhu $v0,6($a3)\n" - "addu $a0,$a0,$v1\n" - "sh $t2,24($s0)\n" - "sh $a0,26($s0)\n" - "lhu $s2,32($sp)\n" - "andi $v0,$v0,0x1F\n" - "or $v0,$s2,$v0\n" - "sh $v0,22($s0)\n" - "lbu $v0,0($a3)\n" - "nop\n" - "addu $v0,$v0,$t4\n" - "sb $v0,28($s0)\n" - "lbu $v0,1($a3)\n" - "sh $a1,32($s0)\n" - "sh $a0,34($s0)\n" - "addu $v0,$v0,$s1\n" - "addu $v0,$v1,$v0\n" - "sb $v0,29($s0)\n" - "lbu $v0,0($a3)\n" - "nop\n" - "addu $v0,$v0,$t4\n" - "sb $v0,36($s0)\n" - "lbu $v0,1($a3)\n" - "nop\n" - "addu $v0,$v0,$s1\n" - "addu $v1,$v1,$v0\n" - "sb $v1,37($s0)\n" - "addu $s0,$a2,$zero\n" - ".L80051514:\n" - "andi $v0,$t0,0xFFFE\n" - "beqz $v0,.L80051594\n" - "addiu $a0,$s0,24\n" - "addiu $v0,$zero,5\n" - "sw $a0,0($s0)\n" - "sb $v0,3($s0)\n" - "lhu $v1,6($a3)\n" - "lw $s2,40($sp)\n" - "andi $v1,$v1,0x1F\n" - "sw $s2,8($s0)\n" - "lw $s2,120($sp)\n" - "or $v1,$v1,$s7\n" - "addu $v0,$t2,$s2\n" - "sh $v0,12($s0)\n" - "srl $v0,$t2,16\n" - "sh $v0,14($s0)\n" - "sw $v1,4($s0)\n" - "lbu $v0,0($a3)\n" - "addiu $s2,$zero,-2\n" - "addu $v0,$v0,$t4\n" - "addiu $v0,$v0,1\n" - "and $v0,$v0,$s2\n" - "sb $v0,16($s0)\n" - "lbu $v0,1($a3)\n" - "nop\n" - "addu $v0,$v0,$s1\n" - "sb $v0,17($s0)\n" - "lhu $v1,2($a3)\n" - "and $v0,$t0,$s2\n" - "sw $v0,20($s0)\n" - "sh $v1,18($s0)\n" - "addu $s0,$a0,$zero\n" - ".L80051594:\n" - "addiu $t1,$t1,1\n" - "div $zero,$t1,$t6\n" - "bnez $t6,.L800515A8\n" - "nop\n" - ".word 0x0007000d\n" - ".L800515A8:\n" - "addiu $at,$zero,-1\n" - "bne $t6,$at,.L800515C0\n" - "lui $at,0x8000\n" - "bne $t1,$at,.L800515C0\n" - "nop\n" - ".word 0x0006000d\n" - ".L800515C0:\n" - "mfhi $v0\n" - "nop\n" - "bnez $v0,gfx2D_BG1_OBJ_648\n" - "andi $v0,$t0,0xFFFF\n" - "j gfx2D_BG1_OBJ_648\n" - "subu $t1,$t1,$t6\n" - ".L800515D8:\n" - "ori $v0,$zero,0xFFFF\n" - "beq $a1,$v0,.L8005164C\n" - "addiu $a0,$s0,24\n" - "lw $v0,20($t7)\n" - "nop\n" - "lw $v1,8($v0)\n" - "addiu $v0,$zero,5\n" - "sw $a0,0($s0)\n" - "sb $v0,3($s0)\n" - "sll $v0,$a1,3\n" - "lw $s2,40($sp)\n" - "addu $a3,$v1,$v0\n" - "lhu $v0,6($a3)\n" - "sw $s2,8($s0)\n" - "sw $t2,12($s0)\n" - "andi $v0,$v0,0x1F\n" - "or $v0,$v0,$s7\n" - "sw $v0,4($s0)\n" - "lbu $v0,0($a3)\n" - "nop\n" - "sb $v0,16($s0)\n" - "lbu $v0,1($a3)\n" - "nop\n" - "addu $v0,$v0,$s1\n" - "sb $v0,17($s0)\n" - "lhu $v0,2($a3)\n" - "sw $t0,20($s0)\n" - "sh $v0,18($s0)\n" - "addu $s0,$a0,$zero\n" - ".L8005164C:\n" - "addiu $t1,$t1,1\n" - "div $zero,$t1,$t6\n" - "bnez $t6,.L80051660\n" - "nop\n" - ".word 0x0007000d\n" - ".L80051660:\n" - "addiu $at,$zero,-1\n" - "bne $t6,$at,.L80051678\n" - "lui $at,0x8000\n" - "bne $t1,$at,.L80051678\n" - "nop\n" - ".word 0x0006000d\n" - ".L80051678:\n" - "mfhi $v0\n" - "nop\n" - "bnez $v0,gfx2D_BG1_OBJ_648\n" - "andi $v0,$t0,0xFFFF\n" - "subu $t1,$t1,$t6\n" - ".set\treorder\n" - ".set\tat\n" - ".end\tGsSortFastBg\n" - ".size\tGsSortFastBg, .-GsSortFastBg\n" -); - -__asm__( - ".text\n" - ".align\t2\n" - ".globl\tgfx2D_BG1_OBJ_648\n" - ".ent\tgfx2D_BG1_OBJ_648\n" - "gfx2D_BG1_OBJ_648:\n" - ".set\tnoreorder\n" - "addu $t3, $t3, $v0\n" - "addu $v0, $t2, $t0\n" - "and $t2, $t2, $t9\n" - "andi $v0, $v0, 0xFFFF\n" - "or $t2, $t2, $v0\n" - "and $t0, $t0, $t9\n" - "subu $v0, $s3, $t3\n" - "andi $v0, $v0, 0xFFFF\n" - "or $t0, $t0, $v0\n" - ".word 0x01a2102b\n" - "beqz $v0, .L800516C4\n" - "nop\n" - "and $t0, $t0, $t9\n" - "or $t0, $t0, $t5\n" - ".L800516C4:\n" - "lw $v0, 20($t7)\n" - "nop\n" - "lw $v1, 12($v0)\n" - "sll $v0, $t1, 1\n" - "addu $v0, $v0, $v1\n" - "lhu $v1, 0($v0)\n" - "slt $v0, $t3, $s3\n" - "bnez $v0, gfx2D_BG1_OBJ_648-180\n" - "andi $a1, $v1, 0xFFFF\n" - "srl $v1, $t0, 16\n" - "addu $t8, $t8, $v1\n" - "srl $v0, $t2, 16\n" - "andi $t2, $t2, 0xFFFF\n" - "addu $v0, $v0, $v1\n" - "sll $v0, $v0, 16\n" - "or $t2, $t2, $v0\n" - "lw $s2, 104($sp)\n" - "andi $t0, $t0, 0xFFFF\n" - "subu $v0, $s2, $t8\n" - "sll $v0, $v0, 16\n" - "or $t0, $t0, $v0\n" - "srl $v0, $t0, 16\n" - ".word 0x0282102b\n" - "beqz $v0, .L80051740\n" - "slt $v0, $t8, $s2\n" - "lw $s2, 112($sp)\n" - "andi $t0, $t0, 0xFFFF\n" - "or $t0, $t0, $s2\n" - "lw $s2, 104($sp)\n" - "nop\n" - "slt $v0, $t8, $s2\n" - ".L80051740:\n" - "bnez $v0, gfx2D_BG1_OBJ_648-984\n" - "addu $s1, $zero, $zero\n" - "lw $s2, 16($sp)\n" - "nop\n" - "lw $v1, 8($s2)\n" - "lhu $v0, 24($sp)\n" - "nop\n" - "addu $s1, $v0, $v1\n" - "bgez $s1, .L80051778\n" - "nop\n" - "lui $a0, %hi(D_80073ACC)\n" - "addiu $a0, $a0, %lo(D_80073ACC)\n" - "jal func_8005C604\n" - "nop\n" - ".L80051778:\n" - "lui $v0, %hi(D_800A5E60)\n" - "lw $v0, %lo(D_800A5E60)($v0)\n" - "nop\n" - "beq $s0, $v0, .L800517C8\n" - "sll $v0, $s1, 2\n" - "lw $s2, 16($sp)\n" - "nop\n" - "lw $v1, 4($s2)\n" - "nop\n" - "addu $v1, $v1, $v0\n" - "lw $v0, 0($v1)\n" - "addiu $s0, $s0, -24\n" - "sw $v0, 0($s0)\n" - "addiu $v0, $zero, 5\n" - "sb $v0, 3($s0)\n" - "lui $v0, %hi(D_800A5E60)\n" - "lw $v0, %lo(D_800A5E60)($v0)\n" - "addiu $s0, $s0, 24\n" - "sw $v0, 0($v1)\n" - "sb $zero, 3($v1)\n" - ".L800517C8:\n" - "lui $at, %hi(D_800A5E60)\n" - "sw $s0, %lo(D_800A5E60)($at)\n" - ".L800517D0:\n" - "lw $ra, 164($sp)\n" - "lw $fp, 160($sp)\n" - "lw $s7, 156($sp)\n" - "lw $s6, 152($sp)\n" - "lw $s5, 148($sp)\n" - "lw $s4, 144($sp)\n" - "lw $s3, 140($sp)\n" - "lw $s2, 136($sp)\n" - "lw $s1, 132($sp)\n" - "lw $s0, 128($sp)\n" - "addiu $sp, $sp, 168\n" - "jr $ra\n" - "nop\n" - ".set\treorder\n" - ".end\tgfx2D_BG1_OBJ_648\n" -); diff --git a/src/gsgap1.c b/src/gsgap1.c deleted file mode 100644 index 9a7f848de..000000000 --- a/src/gsgap1.c +++ /dev/null @@ -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" -); diff --git a/src/gsgap2.c b/src/gsgap2.c deleted file mode 100644 index e9050aeeb..000000000 --- a/src/gsgap2.c +++ /dev/null @@ -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"); diff --git a/src/gsgap4.c b/src/gsgap4.c deleted file mode 100644 index 1396d6a34..000000000 --- a/src/gsgap4.c +++ /dev/null @@ -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" ); -} diff --git a/src/gsgap5.c b/src/gsgap5.c deleted file mode 100644 index 8dc84f5be..000000000 --- a/src/gsgap5.c +++ /dev/null @@ -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" - ); -} diff --git a/src/libcd1.c b/src/libcd1.c index edfd30723..eefb8a73d 100644 --- a/src/libcd1.c +++ b/src/libcd1.c @@ -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); diff --git a/src/libgs7.c b/src/libgs7.c new file mode 100644 index 000000000..44ed5c341 --- /dev/null +++ b/src/libgs7.c @@ -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); diff --git a/src/libgte23.c b/src/libgte23.c new file mode 100644 index 000000000..a35d0b05a --- /dev/null +++ b/src/libgte23.c @@ -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); diff --git a/src/libgte24.c b/src/libgte24.c new file mode 100644 index 000000000..13532869c --- /dev/null +++ b/src/libgte24.c @@ -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); diff --git a/src/libgte25.c b/src/libgte25.c new file mode 100644 index 000000000..7816432e4 --- /dev/null +++ b/src/libgte25.c @@ -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); diff --git a/src/libgte26.c b/src/libgte26.c new file mode 100644 index 000000000..670986b4e --- /dev/null +++ b/src/libgte26.c @@ -0,0 +1,5 @@ +#include "common.h" + +INCLUDE_ASM("asm/nonmatchings/libgte26", func_8004D16C); + +INCLUDE_ASM("asm/nonmatchings/libgte26", func_8004D1DC); diff --git a/src/libgte27.c b/src/libgte27.c new file mode 100644 index 000000000..2a73afd8c --- /dev/null +++ b/src/libgte27.c @@ -0,0 +1,3 @@ +#include "common.h" + +INCLUDE_ASM("asm/nonmatchings/libgte27", ApplyMatrix); diff --git a/src/libgte28.c b/src/libgte28.c new file mode 100644 index 000000000..2a0d336d3 --- /dev/null +++ b/src/libgte28.c @@ -0,0 +1,3 @@ +#include "common.h" + +INCLUDE_ASM("asm/nonmatchings/libgte28", func_80052430); diff --git a/src/libgte29.c b/src/libgte29.c new file mode 100644 index 000000000..fc84c8464 --- /dev/null +++ b/src/libgte29.c @@ -0,0 +1,3 @@ +#include "common.h" + +INCLUDE_ASM("asm/nonmatchings/libgte29", func_800538BC); diff --git a/src/libgte30.c b/src/libgte30.c new file mode 100644 index 000000000..c440bbeb2 --- /dev/null +++ b/src/libgte30.c @@ -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); diff --git a/src/libgte9.c b/src/libgte9.c index a3d5a4ea1..32650378c 100644 --- a/src/libgte9.c +++ b/src/libgte9.c @@ -1,3 +1,3 @@ #include "common.h" -INCLUDE_ASM("asm/nonmatchings/libgte9", func_80049600); +INCLUDE_ASM("asm/nonmatchings/libgte9", func_800495EC); diff --git a/src/sgap_7.c b/src/sgap_7.c deleted file mode 100644 index 8df0b052a..000000000 --- a/src/sgap_7.c +++ /dev/null @@ -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"); -} diff --git a/src/sgap_8.c b/src/sgap_8.c index 4519525cc..e6e390261 100644 --- a/src/sgap_8.c +++ b/src/sgap_8.c @@ -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; diff --git a/src/snd10.c b/src/snd10.c new file mode 100644 index 000000000..ff86db1b1 --- /dev/null +++ b/src/snd10.c @@ -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); diff --git a/src/snd11.c b/src/snd11.c new file mode 100644 index 000000000..405940cb2 --- /dev/null +++ b/src/snd11.c @@ -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); diff --git a/tools/make_libgs.sh b/tools/make_libgs.sh index cad3ec2b0..387abc581 100644 --- a/tools/make_libgs.sh +++ b/tools/make_libgs.sh @@ -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 diff --git a/tools/progress.py b/tools/progress.py index 98faeb88b..4bce52326 100644 --- a/tools/progress.py +++ b/tools/progress.py @@ -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, diff --git a/tools/psyq_integrate.py b/tools/psyq_integrate.py index 5ece5a05b..dafece5b7 100644 --- a/tools/psyq_integrate.py +++ b/tools/psyq_integrate.py @@ -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: