Advertisement
N3rdsWithGame

n64 registers as explained by mzx

Aug 23rd, 2016
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. r0 his hardwired 0, always 0. at is a compiler reserved register, but otherwise can be thought of as being a temporary register. v0-v1 are value returning registers. If v0/v1 is set to a value before a jr ra, and the code following it uses the v0/v1 registers without setting them to a new value, they are being used as return values
  2.  
  3. a0-a3 are function parameter registers, or occasionally used as temporary registers. For example, a function like Add(1,4); would be compiled to where a0 = 1, a1 = 4, then a JAL instruction will take you to the "Add" function
  4.  
  5. t0-t9 are temporary registers. Any time you encounter a JAL/JALR/JR instruction, the state of these registers no longer matter
  6. s0-s8 registers are saved registers. the state of these registers are suppose to remain unchanged when returning from a JAL/JALR/JR(edited)
  7.  
  8. k0-k1 are kernel registers. These are only used within code that performs exception handling stuff
  9. gp register idk, I've never seen it used in the Zelda64 engine at all
  10.  
  11. ra = return address. This register is set whenever a JAL/JALR instruction is hit. used to be able to return back to execution after those calls
  12.  
  13. sp = stack pointer. higher addresses = lower on the stack
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement