Functions are normally called using JAL instructions. Input registers typically are $a0, $a1, $a2, and $a3 and then the stack. Output registers are typically $v0 and $v1.
Functions are normally called using JAL instructions. Input registers typically are $a0, $a1, $a2, and $a3 and then the stack. Output registers are typically $v0 and $v1.
Player spawning/initialization (called by spawning functions below) (credit: triclon)ROM: 0x39FC0RAM: 0x800393C0 Inputs:$A0 - Pointer to player structure, usually loaded from a table at 0x800DC4E0, structures start at 0x800F990 and are seperated by 0xD88 each. There are 8 total, 1 for each player.$A1 - Player ID (0-7)$A2 - coordinate x?$A3 - coordinate z?$SP 0x0024 - Character ID (0-7)$SP 0x0028 - Not sure, looks like rotation angle?This function looks quite large. One of the main inputs is the game mode (GP, time trial, VS, or battle stored at 0x800DC53C) which then branches to various parts of this function. DeadHamster confirmed this function can be called independently to spawn players but the number of players are limited to the current mode (no more than 4 players will not display in VS or Battle mode).2P battle mode player spawning (credit: triclon)ROM: 0x3BC90RAM: 0x8003B098Inputs:$s0 = x coordinate pointer?$s1 = z coordinate pointer?Looks like a gaint case/if ladder which calls the player spawning function above.3P battle mode player spawning (credit: triclon)ROM: 0x3C19CRAM: 0x8003B59CInputs:$s0 = x coordinate pointer?$s1 = z coordinate pointer?Looks like a gaint case/if ladder which calls the player spawning function above.4P battle mode player spawning (credit: triclon)ROM: 0x3C724RAM: 0x8003BB24Inputs:$s0 = x coordinate pointer?$s1 = z coordinate pointer?Looks like a gaint case/if ladder which calls the player spawning function above.Get a random item (credit: abitalive)ROM: 0x7B9A8RAM: 0x8007ADA8Inputs:$a0 = Place$a1 = PlayerType (00 = Human, 01 = CPUOutputs:v0 = RandomItemRtnRuns when you hit an item box. See abitalive’s notes (https://github.com/abitalive/MarioKart64/blob/master/Notes/item_rng.txt).Call RNG to return a 16 bit random int (credit: ???)ROM: ???RAM: 0x802B7D94Outputs:v0 = 16 bit random intCall RNG to return a 16 bit random int between 0 and N-1 (credit: ???)ROM: ???RAM: 0x802B7E34Inputs:$a0 = NOutputs:$v0 = random int between 0 to N-1