MKWii.org
Automated Friend Code Display Cycler; DBZ BT3 - Printable Version

+- MKWii.org (https://mkwii.org)
+-- Forum: Non MKWii Codes (https://mkwii.org/forumdisplay.php?fid=37)
+--- Forum: DBZ BT3 (https://mkwii.org/forumdisplay.php?fid=38)
+--- Thread: Automated Friend Code Display Cycler; DBZ BT3 (/showthread.php?tid=1100)



Automated Friend Code Display Cycler; DBZ BT3 - zak - 03-14-2019

DBZ BT3 Automated Friend Code Display Cycler

This code will auto increment your Friend Code Displayed Value in the Check Friend Code menu. It will increment all the way up to 9999-9999-9999 then reset to 0 and repeat forever. Everything is automated.

Note: This code makes use of memory addresses: 0x80001650, 0x80001654 thru 0x8000165B. Make sure no other codes in your GCT/Cheat-Manager are using those memory addresses!

NTSC-U
C21EC9B0 0000000E
3CC08000 8B661650
2C1B0000 40A2000C
3B600001 9B661650
83461654 83261658
3B390001 3EA0D4A5
62B50FFF 7C19A840
40A20018 2C1A00E8
41A00010 3B200000
7F3ACB78 4800001C
3B000000 3B18FFFF
7C19C040 41A0000C
3B200000 3B5A0001
93461654 93261658
60000000 00000000




Source:

#~~~~~~~~~~~~~~~~#
# START ASSEMBLY #
#~~~~~~~~~~~~~~~~#

#

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Registers safe for use.... #
# r6, r11, r12, r21 thru r30 #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#                Load Status Byte & Check                 #
# We must wait one cycle of this address execution before #
#     executing this code or else the game will crash     #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

lis r6, 0x8000
lbz r27, 0x1650 (r6)
cmpwi r27, 0x0
bne+ loop_start

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Update Status Byte & Store #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

li r27, 0x1
stb r27, 0x1650 (r6)

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#    Load FC word Values, since values lie in   #
# the crash handler, they always start as zeros #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

loop_start:
lwz r26, 0x1654 (r6) #Game uses r26 for 1st half of FC
lwz r25, 0x1658 (r6) #Game uses r25 for 2nd half of FC

#~~~~~~~~~~~~~~~~~~~~~~~~#
# Updated 2nd Half of FC #
#~~~~~~~~~~~~~~~~~~~~~~~~#

addi r25, r25, 1

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Load 2nd Word of Max FC Hex Value for Checks #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

lis r21, 0xD4A5 #This is the exact 2nd word of 9999-9999-9999 decimal FC
ori r21, r21, 0x0FFF

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#   See if r25 is this exact value   #
# If so, check the 1st Half FC Value #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

cmplw r25, r21 #Compare logically, we don't want signed values being used aka negative values
bne+ _sub

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#        See if 1st Half FC Value matchs 0xE8           #
# If not less than, we need to reset the entire FC Loop #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

cmpwi r26, 0xE8 #E8 is byte value in 9999 9999 9999 decimal FC
blt+ _sub

#~~~~~~~~~~~~~~~~~~~~~~#
# Reset Entire FC Loop #
#~~~~~~~~~~~~~~~~~~~~~~#

li r25, 0x0
mr r26, r25
b the_end #Finished, jump to the_end

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# _sub label; Load Max 2nd FC Word Value; All F's #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

_sub:
li r24, 0x0 
addi r24, r24, -0x1 #r24 is now 0xFFFFFFFF

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# See if 2nd half word of current FC value is maxed out #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

cmplw r25, r24  #Compare Logically, we don't want signed values to be used aka negative values
blt+ the_end #If less than, proceed to end, if not less than. we need to clear out 2nd word and increase byte value on first word

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Reset 2nd Word Value of FC Loop, Update 1st Word Value of FC Loop #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

li r25, 0x0
addi r26, r26, 0x1

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# the_end; store updated FC values to crash handler #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

the_end: #Default Instruction not needed; meant to be replaced
stw r26, 0x1654 (r6)
stw r25, 0x1658 (r6)

#

#~~~~~~~~~~~~~~#
# END ASSEMBLY #
#~~~~~~~~~~~~~~#



Code creator: zak