Millisecond Display Cycler [Dea] - Printable Version +- Mario Kart Wii Gecko Codes, Cheats, & Hacks (https://mariokartwii.com) +-- Forum: Cheat Codes (https://mariokartwii.com/forumdisplay.php?fid=51) +--- Forum: Visual & Sound Effects (https://mariokartwii.com/forumdisplay.php?fid=56) +--- Thread: Millisecond Display Cycler [Dea] (/showthread.php?tid=1001) |
Millisecond Display Cycler [Dea] - Vega - 12-25-2018 Millisecond Display Cycler [Dea] This code is used as a supplementation to another code to display a specific value at a desired memory address (designated by the XXXXXXXX value). Simply configure your other ASM to store your desired halfword or word value to the desired memory address. This code will display that value in decimal form cycling thru the entire value and repeating nonstop. There will be two seconds of '000' shown after your read halfword/word to help you identify the beginning of the read value if there are duplicate numbers shown. Please note this code makes use of the following addresses: 0x81450000 thru 0x81450004 Your Memory address of XXXXXXXX thru XXXXXXXX + 6. Z Values (for making the code show two seconds of '000' after your display halfword/word): 4 = For Halfwords (2 bytes/2-seconds of display data) 6 = For Words (4 bytes/4-seconds of displayed data) XXXX XXXX = Memory address for timer to read from Example Z/X values: You have a word value and want it stored at 0x800015A0. Z would equal 6. XXXX XXXX would equal 8000 15A0 Final note: This code makes use to mem81. If you are displaying data on the Timer in TT mode, restarting the TT doesn't clear mem81, thus the code won't function properly after a TT restart. You must go to something like the character select screen to clear mem81. Just an FYI. NTSC-U C25310A0 00000008 3CA08145 81650000 89850004 7C1C5800 4182000C 93850000 398C0001 2C0C000Z 40A20008 39800000 99850004 3D60XXXX 398CXXXX 7CAC58AE 60000000 00000000 PAL C2535BE8 00000008 3CA08145 81650000 89850004 7C1C5800 4182000C 93850000 398C0001 2C0C000Z 40A20008 39800000 99850004 3D60XXXX 398CXXXX 7CAC58AE 60000000 00000000 NTSC-J C2535568 00000008 3CA08145 81650000 89850004 7C1C5800 4182000C 93850000 398C0001 2C0C000Z 40A20008 39800000 99850004 3D60XXXX 398CXXXX 7CAC58AE 60000000 00000000 NTSC-K C2523C40 00000008 3CA08145 81650000 89850004 7C1C5800 4182000C 93850000 398C0001 2C0C000Z 40A20008 39800000 99850004 3D60XXXX 398CXXXX 7CAC58AE 60000000 00000000 Source (Using 0x6 for Z value for reading a word of data with 2 bytes/seconds of zeros afterwards, using 0x800015A0 for X values): #~~~~~~~~~~~~~~~~# # START ASSEMBLY # #~~~~~~~~~~~~~~~~# # #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# # r5 = Real Milliseconds Value # # r28 = Seconds Value # #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# # 0x800015A0 thru 0x800015A3 = Where Byte/Halfword/Word Resides At For Displaying On Timer # # 0x81450000 = Seconds Tracker # # 0x81450004 = Offset Value for final instruciton (Byte) # #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# # First Notes: # # 0x81450000 thru 0x81450004 are in Dynamic Memory, it gets reseted after every race/restart/event. # # Therefore, we don't need to set the values to 0 at the beginning of the code nor do any sort... # # ..of checks to see if we set the initial values already # #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# # Load Seconds Tracker Value and Offset Value # #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# lis r5, 0x8145 #Set upper 16 bits of r5 to 0x8145, lower 16 bits are cleared lwz r11, 0x0 (r5) #Load word (seconds tracker) from 0x81450000; always zero at start of race before code address is executed lbz r12, 0x0004 (r5) #Load byte (offset value) from 0x81450004; always zero at start of race before code address is executed #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# # Check If One Second Has Elapsed In Game # #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# cmpw r28, r11 #Compare value in r28 (updated seconds) to value in r11 (stored seconds; seconds tracker) beq- checkfor_rescroll #If equal, we don't need to update the seconds tracker, jump to checkfor_rescroll label #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# # Store New Seconds Value to 0x81450000 # #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# stw r28, 0x0 (r5) #If not equal, we need to update the seconds tracker, store new updated seconds value to 0x81450000 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# # Calculate (Update) New Offset Value # #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# addi r12, r12, 1 #Since one second (difference occurred) has elapsed since last offset update, we need to increase the offset value by 1. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# # checkfor_rescroll Label # # NOTE: Once the timer reads the value from mem address 0x800015A6 # # We want it to re-scroll beginning at initial address 0x800015A0 # #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# checkfor_rescroll: cmpwi r12, 0x6 #Compare calculated/updated offset value to 0x6 bne+ no_rescroll #If not equal to 0x6, we know to not rescroll yet (reset offset to 0), jump to no_rescroll label #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# # Re-Scroll the Millisecond Display; Reset Offset Value # #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# li r12, 0x0 #If equal to 6, then we need to reset the offset value. Offset value of 0x6 is too high as we only want two bytes of zero to scroll after the word of data. Reset Offset Value. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# # no_rescroll Label; set r5 to finalized value; restore r6's original value # # NOTE: No need for the exact Default ASM. We are overwriting what is being loaded into r5 # #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# no_rescroll: stb r12, 0x0004 (r5) #Store byte of r12 (finalized offset value) to 0x81450004 lis r11, 0x8000 #Set 1st half address for desired read data addi r12, r12, 0x15A0 #Add 15A0 to r12, final result is offset value used for middle register in lbzx lbzx r5, r12, r11 #Load desired read value (can be anywhere from 0x800015A0 thru 0x800015A6 depending on r12's result from the addi instruction one step earlier) # #~~~~~~~~~~~~~~# # END ASSEMBLY # #~~~~~~~~~~~~~~# Code creator: Dea Code credits: Vega (completely overhauled plus shortened entire source); Mdmwii (address founder) |