Commit graph

1733 commits

Author SHA1 Message Date
Paul Holden
d34022a376 Improve microcode detection. 2023-09-23 22:17:54 +01:00
Paul Holden
df2b4dee0f Disable noisy mempack logging. 2023-09-23 22:17:54 +01:00
Paul Holden
227b5632ce Improve boot constants.
This is based on https://github.com/PeterLemon/N64/tree/master/CPUTest/CP0/COP0Register.
2023-09-23 22:17:54 +01:00
Paul Holden
77e581e2f7 Don't render anything if the origin is not set. 2023-09-23 22:17:54 +01:00
Paul Holden
9d38ffd9f1 Fix y-res scaling hack.
I'm not 100% sure about this but it seems more likely to be based on whether the screen is interlaced than the screen width.
2023-09-23 22:17:54 +01:00
Paul Holden
7f4f516457 Add a dump() helper. 2023-09-23 22:17:54 +01:00
Paul Holden
85485a626f Remove the y scaling hack. 2023-09-23 22:17:54 +01:00
Paul Holden
90ae076501 Fix SM64 (E). 2023-09-23 22:17:54 +01:00
Paul Holden
2ec1d9ca61 Tidy vi width/height calculation and use for raw framebuffer code.
There are still a number of TODOs, like figuring out why the hacky 240/237 constant is needed.
2023-09-23 22:17:54 +01:00
Paul Holden
a126e29dc4 Tidy setViScales a little. 2023-09-23 22:17:54 +01:00
Paul Holden
ab15a711ee Calc viHeight using constant of 80/79 and truncate to int. 2023-09-23 22:17:54 +01:00
Paul Holden
98484742cc Clear the CAUSE_IP3 bit when the MI interrupt mask is cleared.
This gets https://github.com/PeterLemon/N64/blob/master/CPUTest/Exceptions/VIIntr/ExceptionVIIntrDisabled.asm passing.
2023-09-23 22:17:54 +01:00
Paul Holden
d58ac6d68a Call presentBackBuffer on every vertical blank.
Suppress the 2d rendering as soon as the first display list is rendered.
2023-09-23 22:17:54 +01:00
Paul Holden
d427064e76 Make presentBackBuffer work with 32bit framebuffers. 2023-09-23 22:17:54 +01:00
Paul Holden
e89635ef9e Overhaul VI interrupts.
* Increment CURRENT based on number of executed instructions
* Set interrupt based on cart country / tv type
* Handle interlaced modes

This fixes a bunch of roms (boot issues and timing issues).
2023-09-23 22:17:54 +01:00
Paul Holden
09373a21b4 Init rominfo earlier so devices can reference it. 2023-09-23 22:17:54 +01:00
Paul Holden
252e50afb3 Fix copyToRDRAM (assigning to const variable). 2023-09-23 22:17:54 +01:00
Paul Holden
6a43357252 Store tv type in rominfo. 2023-09-23 22:17:54 +01:00
Paul Holden
4279f3553c vI changes break Wetrix. 2023-09-23 22:17:54 +01:00
Paul Holden
4f0dc956f4 Convert load_s64_as_double to use BigInt. 2023-09-23 22:17:54 +01:00
Paul Holden
4fdb7f7ee7 Fix store_float_as_long. 2023-09-23 22:17:54 +01:00
Paul Holden
5c2507c225 Add a TODO for VI_CURRENT_REG. 2023-09-23 22:17:54 +01:00
Paul Holden
02e1013189 Rewrite store_float_as_long using BigInt. 2023-09-23 22:17:54 +01:00
Paul Holden
fcbebc235c k1Shift32 is unused. 2023-09-23 22:17:54 +01:00
Paul Holden
cda71b2c32 Rewrite DADD/DSUB etc using BigInt. 2023-09-23 22:17:54 +01:00
Paul Holden
8b363d0d11 Remove getGPR_u64 (now unused) 2023-09-23 22:17:54 +01:00
Paul Holden
e50ba7b643 Fix DIV and DIVU with negative numbers.
Math.floor does the wrong thing (should round to zero). `>> 0` has the correct behaviour.
2023-09-23 22:17:54 +01:00
Paul Holden
fc5d8e9b65 Rewrite DDIV and DDIVU to use BigInt.
This is probably slower than doing 64+32 bit paths, but it's not a common operator and on modern computers should be negligible. It's also much more likely to be correct.
2023-09-23 22:17:54 +01:00
Paul Holden
9c3b498e36 Remove getHi32 as it's no longer used. 2023-09-23 22:17:54 +01:00
Paul Holden
435abe42f4 Use warn() rather than halt() for "Invalid Operation".
Doesn't seem to be needed: 07303fb263/Source/Core/R4300.cpp (L94).
2023-09-23 22:17:54 +01:00
Paul Holden
2f21b3075a Tidy 2023-09-23 22:17:54 +01:00
Paul Holden
4effd2747b Fix precision errors in multiplication instructions.
For large 32 bit values this can overflow precision of a Number.

This fixes Mario getting stuck on the stairs in the castle.
2023-09-23 22:17:54 +01:00
Paul Holden
9bd03eb6f9 Use bool constants. 2023-09-23 22:17:54 +01:00
Paul Holden
5975dded8e Fix logging when before initialise.
Echo everything to console.log.
2023-09-23 22:17:54 +01:00
Paul Holden
98e62d6843 Fix pageMaskName arg name. 2023-09-23 22:17:54 +01:00
Paul Holden
a7dae94f89 Fix kDebugDynarec - assert to dynarec. 2023-09-23 22:17:54 +01:00
Paul Holden
d55da29c49 Use template literals for codegen. 2023-09-23 22:17:54 +01:00
Paul Holden
f432f36215 Handle empty code blocks (e.g. NOP). 2023-09-23 22:17:54 +01:00
Paul Holden
853df4b347 Dedent the code first, to allow template literals to be formatted better. 2023-09-23 22:17:54 +01:00
Paul Holden
664364e6af Add the disassembly as a comment before each instruction.
Wrap each block in parens so temporaries can be scoped.
2023-09-23 22:17:54 +01:00
Paul Holden
94fcaf8e0b Template strings. 2023-09-23 22:17:54 +01:00
Paul Holden
dbdf7fc9c3 var -> {const,let} 2023-09-23 22:17:54 +01:00
Paul Holden
050d34d63e camelCase vars. 2023-09-23 22:17:54 +01:00
Paul Holden
765bb684f6 Rename to FragmentMap. 2023-09-23 22:17:54 +01:00
Paul Holden
3ded97f3a3 Use for..of and Map for FragmentMapWho entries. 2023-09-23 22:17:54 +01:00
Paul Holden
afeaa5ef64 Tidy FragmentMapWho. 2023-09-23 22:17:54 +01:00
Paul Holden
708ad2bd08 Make FragmentMapWho a class. 2023-09-23 22:17:54 +01:00
Paul Holden
727f412543 Format (less vertically aligned tables and constants, for now). 2023-09-23 22:17:54 +01:00
Paul Holden
2f89a0a7a1 Tidy 2023-09-23 22:17:53 +01:00
Paul Holden
08b9ab8141 Prevent writes to non-writable bits of control Index and EntryLo registers. 2023-09-23 22:17:53 +01:00