Repository navigation
feat(functional): port C for hand-written assembly, checked against retail in an EE emulator - #104
Merged
Merged
Conversation
func_001F9968 (bit length via plzcw), func_001F9A98 (quadword copy), func_001F9938 (countdown timer tick), func_001F9DC0 and func_001F9E10 (set a 3D/2D vector's length, VU0 rsqrt). Each was checked against the retail code run in an EE emulator. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Lynder063 <krystofmalinda@protonmail.com>
Fill/clear loops (func_001F99B0, func_001F99D8), the DMA reset (func_0020C268) and the record-table fill (func_00212508), checked against retail in an EE emulator; DI/EI (func_0011D960, func_0011D9A8) with a host-side enable flag, the four interrupt-guarded syscall wrappers, the fatal trap and the busy-wait delay, written from the asm. The two vector-length helpers now use __builtin_sqrtf so they build on the host without math.h. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Lynder063 <krystofmalinda@protonmail.com>
Both checked against retail in an EE emulator. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Lynder063 <krystofmalinda@protonmail.com>
Written from the asm: walks the job chain through the port's func_0020EF30 and func_001EE9F8, then waits for fromSPR DMA to idle. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Lynder063 <krystofmalinda@protonmail.com>
Matrix rotation about Z, X and Y (func_001253F8, func_001254A0, func_00125548), the screen test func_001FA8F0, the sky vertex transform and tile visibility (func_0022D2AC, func_0022D7E0) and the tfrag texture usage pass (func_00235EF0). Each agrees with retail on every test case in the EE emulator. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Lynder063 <krystofmalinda@protonmail.com>
…transform update Both agree with retail on every test case in the EE emulator. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Lynder063 <krystofmalinda@protonmail.com>
Draw/quad (func_001F7C60, func_001F91B8), moby joint pose (func_00211808), shadow volumes (func_00228D20, func_00229098, func_002291E8, func_00229838, func_002298B0), sky sprites and tiles (func_0022CEB8, func_0022D520), tfrag and tie lighting (func_002362B0, func_00238688) and three level routines (func_L00_001F34F0, func_L00_002963D8, func_L02_00250A58). Every one agrees with retail on all its test cases in the EE emulator. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Lynder063 <krystofmalinda@protonmail.com>
Lynder063
marked this pull request as ready for review
October 19, 2026 16:04
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Hand-written assembly counts as finished for matching, but the native port still needs C for it. This adds behaviour-equivalent C for 45 hand-written functions that had none. The files are in
nonmatching/functional/, each with a row innonmatching/functional.tsv.Checked against retail (35):
func_001F9968); quadword copy and clear, and word fill (func_001F9A98,func_001F99D8,func_001F99B0); countdown timer tick (func_001F9938); set vector length in 3D and 2D (func_001F9DC0,func_001F9E10).func_0020C268); record-table fill (func_00212508); VIF1 interrupt handler (func_00235118).func_001253F8,func_001254A0,func_00125548).func_001FA8F0,func_001F7C60,func_001F91B8,func_001F8B6C.func_0022D3F8,func_0022D2AC,func_0022D7E0,func_0022CEB8,func_0022D520).func_00235EF0,func_002362B0,func_00238688).func_00211808).func_00228D20,func_00229098,func_002291E8,func_00229838,func_002298B0.func_L00_001F34F0,func_L00_002963D8,func_L02_00250A58.Written from the asm (10): these read COP0 or drive VU0 microcode, so they were not run.
func_0011D960,func_0011D9A8), sharing a host-side enable flag.func_00119328,func_00119390,func_001193F8,func_00119460).func_001F9978) and a busy-wait delay (func_001F9988).func_00212578).How the checks were done
Retail and the C ran side by side in a MIPS64 emulator (unicorn). A small instruction model emulates the R5900-only instructions: MMI, lq/sq, VU0 macro mode, the EE COP1 extras and ei/di. The C was compiled with the real SN compiler and loaded next to retail, with its references resolved to retail addresses; level functions run with their overlay dump loaded.
Each test case starts both runs from the same RAM. It then compares the return values, all of RAM outside the stack, the scratchpad, and the DMA/GS/VIF register pages. Each file's header gives its case count, and any float tolerance used for VU0-versus-FPU rounding (at most 1e-5). All files also build with host gcc, using the same short type names the existing port files use. The harness is not part of this PR.
Not included
li $3, n; syscallget no C, because the port supplies the kernel.func_0020FC38,func_00228A58,func_L00_001F2BE8,func_L00_00252D20,func_L00_002539C8, and the remaining large VU0/MMI routines.🤖 Generated with Claude Code
https://claude.ai/code/session_017Lr3jLwpQ8QBWgz9eA4WNx