krimtonz

MM Postman

Jun 30th, 2019
952
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. About the MM JP Postman
  2.  
  3. Some terminology used in this explanation:
  4. N64 Counter: The COUNT register is the n64's COP0, this is incremented every other instruction the CPU executes 46875000/sec
  5. Wii Timebase: Similar to the N64 Counter, this is System Bus / 4, Or CPU Speed / 12 729000000 / 12 = 60750000
  6.  
  7. For a bit more information on how the postman calculates the time, see https://pastebin.com/WDhtFM3K
  8.  
  9. Wii VC will emulate the N64's counter register as close as it can based off it's own timebase.
  10.  
  11. The way VC emulates the N64's counter is:
  12. int64 previousTimebase
  13. int64 timebaseNow = __builtin_ppc_get_timebase();
  14. int64 numTimbebaseTicks = previousTimebase - timebaseNow + numTimbebaseTicks
  15. int64 n64Counter = numTimbebaseTicks * 77 / 100
  16. previousTimebase = timebaseNow
  17.  
  18. This effectively makes The N64 Count Clock 60750000 * 77 / 100 = 46777500. This is close the the real n64 cpu count clock of 46875000, but it is not exact.
  19.  
  20. Taken from DeathBasket's pastebin, the calculation to get the postman's timer is
  21.  
  22. postman_timer = (((time_now - start_time)*64)/3000)/10000 = (time_now - start_time)/468750
  23.  
  24. Because the n64 and the wii are running at the same input frame rate, but not the same counter clocks, the integer division (time_now - start_time) and 468750 will cause VC to provide unintentional results.
  25.  
  26. On n64 the difference between time_now and start_time should be pretty close to 468750000 (600 * 46875000), it will most likely not be this, but close enough that the postman_timer will always be 1000.
  27. On VC because of the slower emulated clock rate, 601.26 input frames are needed to get to 468750000
Advertisement
Add Comment
Please, Sign In to add comment