Fps display [Mew]
#1
Fps display by Mew

This code will display your current fps (frames per second) to theĀ milliseconds of the timer
Uses vector of 80001660. Make sure no other codes use that vector.

NTSC U:
C27ED9F8 00000005
3D408042 614A50F0
C12A0000 3D808000
39601660 FDA0481C
7DAC5FAE 838C1660
60000000 00000000

PAL:
C27F84F8 00000005
3D408042 614A9470
C12A0000 3D808000
39601660 FDA0481C
7DAC5FAE 838C1660
60000000 00000000

NTSC J:
C27F7B64 00000005
3D408042 614A8DF0
C12A0000 3D808000
39601660 FDA0481C
7DAC5FAE 838C1660
60000000 00000000

NTSC K:
C27E68B8 00000005
3D408041 614A7490
C12A0000 3D808000
39601660 FDA0481C
7DAC5FAE 838C1660
60000000 00000000


Code credits:
Seeky for helping me through making thisĀ 
JoshuaMK for the timer address
and the public symbol map for having the framerate address

Source Ntsc U:
insert address: 807ED9F8

.set framerate, 0x804250f0
lis r10, framerate@ha
lfs f9, framerate@l (r10)
lis r12, 0x8000
li r11, 0x1660
fctiw f13, f9
stfiwx f13, r12, r11
lwz r28, 0x1660 (r12)
[Image: Annotation_2020-08-08_202837.png]
Reply
#2
tested NTSC-K and NTSC-J works great Smile
Reply
#3
Epic, thanks
[Image: Annotation_2020-08-08_202837.png]
Reply
#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


Forum Jump:


Users browsing this thread: 1 Guest(s)