Fps display [Mew]
#4
Here's a more optimized source. It is untested. Nice code btw.

The GPR used for setting the framerate address is r28 instead of r12 as it's actually safer than r12 due to r28's value being replaced no matter what at the end. The converted float is stored to the negative stack space so the exception vector area won't be used. This should be safe since your code contains no function calls.

Code:
#Address Ports
#807ED9F8 = NTSC-U
#807F84F8 = PAL
#807F7B64 = NTSC-J
#807E68B8 = NTSC-K

.set region, '' #Fill in E, P, J, or K within the quotes for your region when Compiling! Lowercase letters can also be used.

.if    (region == 'E' || region == 'e') # RMCE
    .set framerate, 0x804250F0
.elseif (region == 'P' || region == 'p') # RMCP
    .set framerate, 0x80419470
.elseif (region == 'J' || region == 'j') # RMCJ
    .set framerate, 0x80418DF0
.elseif (region == 'K' || region == 'k') # RMCK
    .set framerate, 0x80417490
.else # Invalid Region
    .err
.endif

lis r28, framerate@ha #Adjust for any 16-bit signed issues for offset values exceeding 0x7FFF
lfs f13, framerate@l (r28) #Load framerate float into f13
fctiw f13, f13 #Convert float, word value is in second word of float
stfd f13, -0x8 (sp) #Store converted float to negative stack space
lwz r28, -0x4 (sp) #Place word value into r28; no need for the default instruction
Reply


Messages In This Thread
Fps display [Mew] - by Mewmaster99 - 09-01-2020, 09:46 PM
RE: Fps display [Mew] - by Jeffy/Wrath - 09-13-2020, 02:59 AM
RE: Fps display [Mew] - by Mewmaster99 - 09-13-2020, 03:00 AM
RE: Fps display [Mew] - by Vega - 09-13-2020, 12:59 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)