From f4e14569bdbd32437e7a092fdb464f4a857b6a59 Mon Sep 17 00:00:00 2001 From: Christopher Williams Date: Thu, 24 Sep 2026 11:13:40 -0400 Subject: [PATCH] =?UTF-8?q?phase11:=20merge=2053=20=E2=80=94=20worker=20E'?= =?UTF-8?q?s=200x800B0E64=20->=20589=20bodies=20/=20598=20regions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/regions.tsv | 1 + src/func_80026274.c | 23 ++++++++++++++++++++ src/func_800B0E64.c | 53 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 77 insertions(+) create mode 100644 src/func_80026274.c create mode 100644 src/func_800B0E64.c diff --git a/config/regions.tsv b/config/regions.tsv index b0f2469..ed34bb8 100644 --- a/config/regions.tsv +++ b/config/regions.tsv @@ -447,6 +447,7 @@ 0x800AFDBC 0x800AFEB4 src/func_800AFDBC.c 0x800AFFB8 0x800AFFE4 src/func_800AFFB8.c 0x800B0E30 0x800B0E64 src/func_800B0E30.c +0x800B0E64 0x800B0ECC src/func_800B0E64.c 0x800B107C 0x800B1114 src/func_800B107C.c 0x800B1D5C 0x800B1DD0 src/func_800B1D5C.c 0x800B24EC 0x800B2534 src/func_800B24EC.c diff --git a/src/func_80026274.c b/src/func_80026274.c new file mode 100644 index 0000000..abab3de --- /dev/null +++ b/src/func_80026274.c @@ -0,0 +1,23 @@ +extern int D_80121B18; +extern void func_800F6F00(); + +int func_80026274(int a0) { + int neg = 1; + int x = a0; + int d; + + if (x < 0) { + neg = 0; + x = -x; + } + d = D_80121B18 - x; + if (x == 0) { + return 0; + } + d = d - (d & 3); + D_80121B18 = d; + if (neg & 0xff) { + func_800F6F00(d, 0); + } + return d; +} diff --git a/src/func_800B0E64.c b/src/func_800B0E64.c new file mode 100644 index 0000000..00951ef --- /dev/null +++ b/src/func_800B0E64.c @@ -0,0 +1,53 @@ +/* + * func_800B0E64 — 104 bytes at 0x800B0E64..0x800B0ECC + * + * Four zero-fills of fixed-size regions, then one gp-resident word cleared. First spelling. + * + * addiu sp,sp,-0x18 / sw ra,16(sp) frame 24: ra at 0x10, no other saved register, so + * nothing is live across the four calls. + * lui a0,0x8014 / addiu a0,a0,-14884 0x8013C5DC, materialised as a SYMBOL (addiu, not + * ori -- cookbook 89). The first a0 is built BEFORE + * the ra save; the later ones after each call returns. + * move a1,zero the fill value is 0 ... + * jal 0x800266A8 / li a2,6864 ... and the size is the call's delay slot. + * ... x3 with 176 and 8624 bytes at 0x8013E0AC and 0x8013E15C + * addiu a0,gp,3568 the FOURTH target is `gp`+-relative -- one + * instruction, not a lui/addiu pair. gp is 0x80121938, + * so this is 0x80122728, an already-registered gp symbol. + * jal 0x800266A8 / li a2,4 + * sw zero,1768(gp) the tail clears the gp-resident word at 0x80122020. + * + * The four calls differ only in destination and size, and the sizes (6864 / 176 / 8624 / 4) are + * taken straight from the `li` immediates. All four go to the same callee, so the argument shape + * is paid once: (destination, 0, size) with the size in the jump delay slot every time. + * + * The address forms are the one byte-bearing choice here, and they are NOT uniform: + * * the first three are ABSOLUTE (`lui 0x8014` + `addiu`), so their symbols carry no gp marker; + * * the fourth is `gp`+-relative (`addiu a0,gp,3568`), which needs the symbol to be gp-marked + * in the registry -- an `&symbol` whose marker is absent silently resolves absolutely and + * costs the extra `lui` (cookbook 30's name-keyed-gp trap, cookbook 46). + * + * LIMITS: func_800266A8 is a cross-reference by address only; the (dest, value, size) reading is + * from the emitted argument registers and the delay-slot `li`, not from a recovered prototype. + * `D_8013C5DC` / `D_8013E0AC` / `D_8013E15C` are address symbols (name == address, so they need + * no registry row) declared as `char[]` to make them pass as addresses; the true object types and + * sizes are not recovered -- only the three sizes the source passes. `D_80122728` and + * `D_80122020` are the already-registered gp-marked globals at gp+3568 and gp+1768. + */ + +extern void func_800266A8(char *a0, int a1, int a2); +extern char D_8013C5DC[]; +extern char D_8013E0AC[]; +extern char D_8013E15C[]; +extern int D_80122728; +extern int D_80122020; + +void func_800B0E64(void) +{ + func_800266A8(D_8013C5DC, 0, 6864); + func_800266A8(D_8013E0AC, 0, 176); + func_800266A8(D_8013E15C, 0, 8624); + func_800266A8((char *)&D_80122728, 0, 4); + + D_80122020 = 0; +}