Originally posted by Yoshimaster96
I have a very complex question, so I gave it its own thread. Here it is:
I want to implement gravity towards a point (planetary gravity), but in order to do that, I would need to know where the code to implement gravity is (so I can edit it). If anyone knows where the code is, please let me know.
First off, are you familiar with N64's Assembler (MIPS R4300i) and know in general how SM64 works, how code is even processed, etc.?
It's not like in Super Mario World, the ASM Syntax is different (for some it's even harder to learn) and the way how the code is processed is also different.
There are also no tools or anything similar which automatically hijacks gravity and replaces it.
I give an example with loading and saving to accumulator in SNES:
Loading a value into the accumulator, then saving it to an example address:
LDA #$01 ; Loads the value $01 into the accumulator.
STA $7E0019 ; Stores the value $01 from accumulator into Address 7E:0019 which basically is the power-up for Mario in SMW.
And in MIPS:
LUI T0, $8132
LUI T1, $0001
LUI T2, $0002
ADD T2, T1, T2 ; T2 := T1 + T2 -> $0003
SUB T2, T2, T1 ; T2 := T2 - T1 -> $0003 - $0001 = $0002
SW T2, $DC89(T0) ; This stores the result($0002) into register T2 to memory location of T0, which is $8132DC89.
LUI loads $81320000 into T0, then our two values $0001 and $0002 are loaded in T1 and the other one in T2. Then we add T1 + T2 ($0001 + $0002 = $0003) and store the result in T2. Then we subtract T2 - T1 and store it again in T2. Result is $0002. Then the result $0002 is stored into register T2 in the memory location of T0 ($8132DC89)
As you see, it's quite different and maybe more complicated. To make a more comfortable example:
LUI T0, $8132 ; Load upper address $81320000
LUI T2, $0002 ; Load value $00020000
SW T2, $2000(t0) ; Store $00030000 into T2, in memory location of T0($81322000)
This is basically the same like the SNES ASM code up there, just that it doesn't allow direct addressing and all this stuff, so you load the "upper" address part and later store it together with the lower address part in SW(Store Word). MIPS doesn't have that luxury as far as I know, unfortunately.