Mega Mushroom Timer (Online only) [Vega]
#1
Mega Mushroom Timer (Online only) [Vega]

NOTE: Outdated by JoshuaMK's Item Timer Code

Works Online only!

This code will keep track (via Milliseconds in timer) of how long you have left before your Mega runs out. Whenever you are not using a Mega, the timer will function normally.

NTSC-U
C2658828 00000003
3D808053 3D6080A1
616B0024 916C10A0
9903001F 00000000
C2572D90 00000006
3803FFFF 3D808053
2C000000 41820010
3D6038A0 7D6B0214
4800000C 3D6080A1
616B0024 916C10A0
60000000 00000000

PAL
C2660764 00000003
3D808053 3D6080A1
616B0024 916C5BE8
9903001F 00000000
C25795F4 00000006
3803FFFF 3D808053
2C000000 41820010
3D6038A0 7D6B0214
4800000C 3D6080A1
616B0024 916C5BE8
60000000 00000000

NTSC-J
C265FDD0 00000003
3D808053 3D6080A1
616B0024 916C5568
9903001F 00000000
C2578F74 00000006
3803FFFF 3D808053
2C000000 41820010
3D6038A0 7D6B0214
4800000C 3D6080A1
616B0024 916C5568
60000000 00000000

NTSC-K
C264EA7C 00000003
3D808052 3D6080A1
616B0024 916C3C40
9903001F 00000000
C256764C 00000006
3803FFFF 3D808052
2C000000 41820010
3D6038A0 7D6B0214
4800000C 3D6080A1
616B0024 916C3C40
60000000 00000000

Source for Timer Reset In Between Races:
#Values per Region

.set region, '' #Must set region value, or else source will not compile

.if (region == 'E' || region == 'e') # RMCE
    .set _1sthalf, 0x8053
    .set _2ndhalf, 0x10A0
.elseif (region == 'P' || region == 'p') # RMCP
    .set _1sthalf, 0x8053
    .set _2ndhalf, 0x5BE8
.elseif (region == 'J' || region == 'j') # RMCJ
    .set _1sthalf, 0x8053
    .set _2ndhalf, 0x5568
.elseif (region == 'K' || region == 'k') # RMCK
    .set _1sthalf, 0x8052
    .set _2ndhalf, 0x3C40
.else # Invalid Region
    .abort
.endif

lis r12, _1sthalf
lis r11, 0x80A1 #Default Word Value (instruction) at Millisecond Display Code Address
ori r11, r11, 0x0024
stw r11, _2ndhalf (r12)

stb r8, 0x001F (r3) #Default Instruction


=====

Source for Mega Mushroom Timer (NTSC-K):
subi r0, r3, 1 #Default ASM, r0 holds mega time limit value

lis r12, 0x8052 #Set 1st half address for Millisecond Code

cmpwi r0, 0x0 #Compare mega time limit value to zero
beq- fix_timer #If equal, we need to fix the timer, let's fix it, jump to fix_timer label

lis r11, 0x38A0 #Set 1st half word value to write
add r11, r11, r0 #Add r11 and r0 together to get finalized word value to write

b the_end #No need to fix the timer ofc, jump to the_end

fix_timer:
lis r11, 0x80A1 #Set 1st half default word value
ori r11, r11, 0x0024 #Set 2nd half default word value

the_end:
stw r11, 0x3C40 (r12) #Store word of r11 to 0x80523C40

Code creator: Vega
Code credits: Bully (Millisecond Display Modifier & Address founder for Mega ASM)
Reply


Messages In This Thread
Mega Mushroom Timer (Online only) [Vega] - by Vega - 11-18-2018, 07:28 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)