Speed-O-Meter; TTs Only [mdmwii]
#1
Speed-O-Meter; TTs Only [mdmwii]

NOTE: Outdated by Speed-O-Meter code in main codes forum, the one in main forum works everywhere

For Time Trials Mode only. Only works for Solo Racing.

This code will tell you your speed of your vehicle in the milliseconds section of the timer. Only works in TT mode (solo race only). Works for all character/vehicle combos. Reverse speed also works. All speed measurements are rounded to their nearest whole number shown on the timer. This will get rid of the '96/97' issue with Funky Kong/Flame runner (codes that don't fix this issue will show 96 for both Daisy/Mach and Funky/Flame runner at max wheelie speed).

NTSC-U
C25743CB 00000002
3D808000 D00C1660
D01D0020 00000000
0653108C 00000010
3D808000 C00C1660
FC000210 FC00001C

PAL
C257AC2C 00000002
3D808000 D00C1660
D01D0020 00000000
06535BD4 00000010
3D808000 C00C1660
FC000210 FC00001C

NTSC-J
C257A5AC 00000002
3D808000 D00C1660
D01D0020 00000000
06535554 00000010
3D808000 C00C1660
FC000210 FC00001C

NTSC-K
C2568C84 00000002
3D808000 D00C1660
D01D0020 00000000
06523C2C 00000010
3D808000 C00C1660
FC000210 FC00001C



List of Sources:

Source for ASM
lis r12, 0x8000 #Load 0x8000 into upper 16 bits of r12, lower 16 bits are cleared
stfs f0, 0x1660(r12) #Store the float (single precision) to address 0x80001660
stfs f0, 0x0020 (r29) #Default ASM; Store the float (single precision) to address of r29 plus offset 0x0020

Source for Gecko String Write
3D808000 (lis r12, 0x8000) #Load 0x8000 into upper 16 bits of r12, lower 16 bits are cleared
C00C1660 (lfs f0, 0x1660 (r12)) #Load the float (single precision) from 0x80001660 into FPR 0
FC000210 (fabs f0, f0) #The value of FPR 0 is converted to its absolute value, stored back into FPR 0; this resolves the reverse issue
FC00001C (fctiw f0, f0) #The value in FPR 0 is converted to the integer, but it is NOT rounded to zero; this resolves the funky kong 96/97 issue

#After the string write is done, the default instructions ahead will store the float (double precision) to the stack, then load the integer from the lower 32 bits that was in f0 into r5. r5 contains integer value of converted float which will be used to display in the milliseconds#



Code creator: mdmwii
Code credits: Vega (improvements to source, fixed rounding, enabled correct reverse speed output)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)