Welcome to Data Crystal's new home! Data Crystal is now part of the TCRF family (sort of).
The wiki has recently moved; please report any issues in Discord. Pardon the dust.

User talk:Zowayix

From Data Crystal
Jump to navigation Jump to search

Re: Stadium critical hit calculation?

I'm still a beginner at N64 MISP, but the formula given at the beginning is 100% correct, even if my comments are lackluster at the moment to say the least. Also please forgive my bad English =P

What happens is:

  • Base Speed is loaded to V1
  • It adds 76 to it
  • It >> 2 to it
  • It jumps to 0x35C56C
  • It loads Focus Energy in T1
  • If Focus Energy is active, value << 2
  • If Focus Energy is active, value + 160
  • If Focus Energy is not active, value << 1
  • It loads Move ID in A0
  • It jumps to 0x35A614
  • It checks if the Move is a High Critical Hit Rate move. It compares the Move ID with the array at 0x37570C
  • It jumps to 0x35C5A4
  • It loads the CH Ratio to V1
  • If the move is a High Critical Hit Rate move, << 2 to it
  • If the move is not a High Critical Hit Rate move, >> 1 to it

I didn't check what happens just after this. I used access breakpoints and register breakpoints to find the routines that I wanted to explore.

  • It jumps to 0x35C5FC
  • If the CH Ratio is ≥ 256, it sets the CH Ratio to 255

I didn't check what happens just after this once again.

  • It jumps to 0x35C648
  • It loads the CH Ratio in V1
  • It copies a 1-byte Pseudo-Random Number to T5
  • If PRN < CH Ratio, it sets the Critical Hit flag to 1
  • It jumps to 0x35A9C0, which is the start of the Damage Calculation
No Focus Energy: (Base Speed + 76) >> 2
W/ Focus Energy: (Base Speed + 76) >> 2 << 2 + 160 >> 1

Once again I apologize for the lack of clarity in the disassembly, as I'm copy pasting what I find on the go. I hope I didn't miss a shift operation while writing this!
On your question about the Branch On Equal instruction, it executes the instruction following it without delay. So the SRA V1, V1, $2 at function 0x35C4D8 is executed.
Also, feel free to edit the ROM map to make it more easy to understand, I'm far from being the best at assembly :q
--Mantidactyle (talk) 18:36, 8 January 2015 (EST)