Difference between revisions of "Level Up Section"
Jump to navigation
Jump to search
m |
|||
Line 1: | Line 1: | ||
− | Level Up Section | + | '''Level Up Section''' |
− | 0005da10: 27bdffc8 addiu r29,r29, | + | Parameters : r4 = Unit data pointer |
− | 0005da14: afb3001c sw r19,0x001c(r29) | + | r5 = 0x01 if unit is leveling down, 0x00 if leveling Up |
− | 0005da18: 00809821 addu r19,r4,r0 | + | Returns nothing |
− | 0005da1c: afb60028 sw r22,0x0028(r29) | + | ------------------------------------------------------------------------------------------------------------ |
− | 0005da20: 00a0b021 addu r22,r5,r0 | + | 0005da10: 27bdffc8 addiu r29,r29,-0x0038 | |
− | 0005da24: afb50024 sw r21,0x0024(r29) | + | 0005da14: afb3001c sw r19,0x001c(r29) | |
− | 0005da28: 26750072 addiu r21,r19,0x0072 | + | 0005da18: 00809821 addu r19,r4,r0 |{{f/adr|<nowiki>r19 = Unit's Data Pointer</nowiki>}} |
− | 0005da2c: afb20018 sw r18,0x0018(r29) | + | 0005da1c: afb60028 sw r22,0x0028(r29) | |
− | 0005da30: 02a09021 addu r18,r21,r0 | + | 0005da20: 00a0b021 addu r22,r5,r0 |{{f/std|<nowiki>r22 = Level UP/Down Flag</nowiki>}} |
− | 0005da34: afb40020 sw r20,0x0020(r29) | + | 0005da24: afb50024 sw r21,0x0024(r29) | |
− | 0005da38: 26740081 addiu r20,r19,0x0081 | + | 0005da28: 26750072 addiu r21,r19,0x0072 |{{f/adr|<nowiki>r21 = Unit's Raw Stat Pointer</nowiki>}} |
− | 0005da3c: afbf0030 sw r31,0x0030(r29) | + | 0005da2c: afb20018 sw r18,0x0018(r29) | |
− | 0005da40: afb7002c sw r23,0x002c(r29) | + | 0005da30: 02a09021 addu r18,r21,r0 |{{f/adr|<nowiki>r18 = Unit's Raw Stat Pointer (increased while looping)</nowiki>}} |
− | 0005da44: afb10014 sw r17,0x0014(r29) | + | 0005da34: afb40020 sw r20,0x0020(r29) | |
− | 0005da48: afb00010 sw r16,0x0010(r29) | + | 0005da38: 26740081 addiu r20,r19,0x0081 |{{f/adr|<nowiki>r20 = Unit's Stat Growth Pointer (increased while looping)</nowiki>}} |
− | 0005da4c: 92770022 lbu r23,0x0022(r19) | + | 0005da3c: afbf0030 sw r31,0x0030(r29) | |
− | 0005da50: 92440001 lbu r4,0x0001(r18) | + | 0005da40: afb7002c sw r23,0x002c(r29) | |
− | 0005da54: 92910000 lbu r17,0x0000(r20) | + | 0005da44: afb10014 sw r17,0x0014(r29) | |
− | 0005da58: 92430000 lbu r3,0x0000(r18) | + | 0005da48: afb00010 sw r16,0x0010(r29) | |
− | 0005da5c: 92420002 lbu r2,0x0002(r18) | + | 0005da4c: 92770022 lbu r23,0x0022(r19) |{{f/load|<nowiki>r23 = Unit's Level</nowiki>}} |
− | 0005da60: 00042200 sll r4,r4,0x08 | + | 0005da50: 92440001 lbu r4,0x0001(r18) {{f/bloop|LOOP}} {{f/load|Load Second byte of Raw Stat (Raw Stat 2 -> 0xBB)}} |
− | 0005da64: 00641821 addu r3,r3,r4 | + | 0005da54: 92910000 lbu r17,0x0000(r20) |{{f/load|<nowiki>r17 = Stat Growth</nowiki>}} |
− | 0005da68: 00021400 sll r2,r2,0x10 | + | 0005da58: 92430000 lbu r3,0x0000(r18) |{{f/load|Load first byte of Raw Stat (Raw Stat 1 -> 0xAA)}} |
− | 0005da6c: 00628021 addu r16,r3,r2 | + | 0005da5c: 92420002 lbu r2,0x0002(r18) |{{f/load|Load third byte of Raw Stat (Raw Stat 3 -> 0xCC)}} |
− | 0005da70: 16200002 bne r17,r0, | + | 0005da60: 00042200 sll r4,r4,0x08 |{{f/std|<nowiki>r4 = 0xBB00</nowiki>}} |
− | 0005da74: 02201021 addu r2,r17,r0 | + | 0005da64: 00641821 addu r3,r3,r4 |{{f/std|<nowiki>r3 = 0xBBAA</nowiki>}} |
− | 0005da78: 34020001 ori r2,r0,0x0001 | + | 0005da68: 00021400 sll r2,r2,0x10 |{{f/std|<nowiki>r2 = 0xCC0000</nowiki>}} |
− | 0005da7c: 0c0088c3 jal 0x0002230c | + | 0005da6c: 00628021 addu r16,r3,r2 |{{f/std|<nowiki>r16 = 0xCCBBAA (full raw stat)</nowiki>}} |
− | 0005da80: 00578821 addu r17,r2,r23 | + | 0005da70: 16200002 bne r17,r0,0x0005da7c {{f/Cond|<nowiki>If Unit Stat growth = 0</nowiki>}} |
− | 0005da84: | + | 0005da74: 02201021 addu r2,r17,r0 |{{f/std|<nowiki>r2 = Stat Growth</nowiki>}} |
− | 0005da88: 00000000 nop | + | 0005da78: 34020001 ori r2,r0,0x0001 |{{f/std|<nowiki>r2 = 1 (Min 1 growth)</nowiki>}} |
− | 0005da8c: 0211001b divu r16,r17 | + | 0005da7c: 0c0088c3 jal 0x0002230c |{{f/jal|Random Number Generator|Random Number Generator}} Return r2 between 0 and 0x7fff |
− | 0005da90: 00001012 mflo r2 | + | 0005da80: 00578821 addu r17,r2,r23 |{{f/std|<nowiki>r17 = Stat Growth + Level</nowiki>}} |
− | 0005da94: 080176ab j | + | 0005da84: 12c00005 beq r22,r0,0x0005da9c {{f/Cond|If Unit is Leveling Down}} |
− | 0005da98: 02028023 subu r16,r16,r2 | + | 0005da88: 00000000 nop |{{f/std|}} |
− | 0005da9c: 0211001b divu r16,r17 | + | 0005da8c: 0211001b divu r16,r17 |{{f/std|}} |
− | 0005daa0: 00001012 mflo r2 | + | 0005da90: 00001012 mflo r2 |{{f/std|<nowiki>Raw Stat modification = Raw Stat / (Stat Growth + Level)</nowiki>}} |
− | 0005daa4: 00000000 nop | + | 0005da94: 080176ab j 0x0005daac {{f/jump|Jump after lv up section}} |
− | 0005daa8: 02028021 addu r16,r16,r2 | + | 0005da98: 02028023 subu r16,r16,r2 |{{f/std|<nowiki>r16 = Raw Stat - Raw Stat modification</nowiki>}} |
− | 0005daac: 3c0200ff lui r2,0x00ff | + | 0005da9c: 0211001b divu r16,r17 {{f/Cond|Else : Unit is leveling Up}} |
− | 0005dab0: 3442ffff ori r2,r2,0xffff | + | 0005daa0: 00001012 mflo r2 |{{f/std|<nowiki>Raw Stat modification = Raw Stat / (Stat Growth + Level)</nowiki>}} |
− | 0005dab4: 0050102b sltu r2,r2,r16 | + | 0005daa4: 00000000 nop | |
− | 0005dab8: 10400003 beq r2,r0, | + | 0005daa8: 02028021 addu r16,r16,r2 |{{f/std|<nowiki>r16 = Raw Stat + Raw Stat modification</nowiki>}} |
− | 0005dabc: 26940002 addiu r20,r20,0x0002 | + | 0005daac: 3c0200ff lui r2,0x00ff |{{f/std|}} |
− | 0005dac0: 3c1000ff lui r16,0x00ff | + | 0005dab0: 3442ffff ori r2,r2,0xffff |{{f/std|<nowiki>r2 = 0x00ffffff (maximum possible raw stat)</nowiki>}} |
− | 0005dac4: 3610ffff ori r16,r16,0xffff | + | 0005dab4: 0050102b sltu r2,r2,r16 |{{f/std|<nowiki>r2 = 0x01 if New raw stat > 0x00ffffff</nowiki>}} |
− | 0005dac8: 00101202 srl r2,r16,0x08 | + | 0005dab8: 10400003 beq r2,r0,0x0005dac8 {{f/Cond|If new Raw Stat is to high}} |
− | 0005dacc: a2420001 sb r2,0x0001(r18) | + | 0005dabc: 26940002 addiu r20,r20,0x0002 |{{f/adr|Unit next growth pointer}} |
− | 0005dad0: 00101402 srl r2,r16,0x10 | + | 0005dac0: 3c1000ff lui r16,0x00ff |{{f/std|}} |
− | 0005dad4: a2500000 sb r16,0x0000(r18) | + | 0005dac4: 3610ffff ori r16,r16,0xffff |{{f/std|<nowiki>r16 = 0x00ffffff</nowiki>}} |
− | 0005dad8: a2420002 sb r2,0x0002(r18) | + | 0005dac8: 00101202 srl r2,r16,0x08 |{{f/std|<nowiki>r2 = middle byte (0xBB)</nowiki>}} |
− | 0005dadc: 26520003 addiu r18,r18,0x0003 | + | 0005dacc: a2420001 sb r2,0x0001(r18) |{{f/store|Store Raw Stat 2}} |
− | 0005dae0: 26a2000f addiu r2,r21,0x000f | + | 0005dad0: 00101402 srl r2,r16,0x10 |{{f/std|<nowiki>r2 = Left Byte (0xCC)</nowiki>}} |
− | 0005dae4: 0242102a slt r2,r18,r2 | + | 0005dad4: a2500000 sb r16,0x0000(r18) |{{f/store|Store Raw Stat 1}} |
− | 0005dae8: 1440ffd9 bne r2,r0, | + | 0005dad8: a2420002 sb r2,0x0002(r18) |{{f/store|Store Raw Stat 3}} |
− | 0005daec: 00000000 nop | + | 0005dadc: 26520003 addiu r18,r18,0x0003 |{{f/adr|Unit's Next Raw Stat Pointer}} |
− | 0005daf0: 0c017578 jal | + | 0005dae0: 26a2000f addiu r2,r21,0x000f |{{f/std|<nowiki>r2 = Unit HP growth pointer (used as unit raw stat limit)</nowiki>}} |
− | 0005daf4: 02602021 addu r4,r19,r0 | + | 0005dae4: 0242102a slt r2,r18,r2 |{{f/std|<nowiki>r2 = 0x01 while limit is not reached</nowiki>}} |
− | 0005daf8: 96630028 lhu r3,0x0028(r19) | + | 0005dae8: 1440ffd9 bne r2,r0,0x0005da50 {{f/eloop|Loop while current pointer < Max}} |
− | 0005dafc: 9662002a lhu r2,0x002a(r19) | + | 0005daec: 00000000 nop | |
− | 0005db00: 00000000 nop | + | 0005daf0: 0c017578 jal 0x0005d5e0 |{{f/jal|Status Setting/Checking Prep (Not Initializing, Statuses set?)|Status Setting/Checking Prep (Not Initializing, Statuses set?)}} |
− | 0005db04: 0043102b sltu r2,r2,r3 | + | 0005daf4: 02602021 addu r4,r19,r0 |{{f/std|<nowiki>r4 = Unit's Data Pointer</nowiki>}} |
− | 0005db08: 10400004 beq r2,r0, | + | 0005daf8: 96630028 lhu r3,0x0028(r19) |{{f/load|Load Unit's HP}} |
− | 0005db0c: 00000000 nop | + | 0005dafc: 9662002a lhu r2,0x002a(r19) |{{f/load|Load Unit's Max HP}} |
− | 0005db10: 9662002a lhu r2,0x002a(r19) | + | 0005db00: 00000000 nop | |
− | 0005db14: 00000000 nop | + | 0005db04: 0043102b sltu r2,r2,r3 |{{f/std|<nowiki>r2 = 0x01 if Max HP < Current HP</nowiki>}} |
− | 0005db18: a6620028 sh r2,0x0028(r19) | + | 0005db08: 10400004 beq r2,r0,0x0005db1c {{f/Cond|If Unit Current HP > Unit Max HP}} |
− | 0005db1c: 9663002c lhu r3,0x002c(r19) | + | 0005db0c: 00000000 nop | |
− | 0005db20: 9662002e lhu r2,0x002e(r19) | + | 0005db10: 9662002a lhu r2,0x002a(r19) |{{f/load|Load Unit's Max HP}} |
− | 0005db24: 00000000 nop | + | 0005db14: 00000000 nop | |
− | 0005db28: 0043102b sltu r2,r2,r3 | + | 0005db18: a6620028 sh r2,0x0028(r19) |{{f/store|<nowiki>Store Current HP = Max HP</nowiki>}} |
− | 0005db2c: 10400004 beq r2,r0, | + | 0005db1c: 9663002c lhu r3,0x002c(r19) |{{f/load|Load Unit's MP}} |
− | 0005db30: 00000000 nop | + | 0005db20: 9662002e lhu r2,0x002e(r19) |{{f/load|Load Unit's Max MP}} |
− | 0005db34: 9662002e lhu r2,0x002e(r19) | + | 0005db24: 00000000 nop | |
− | 0005db38: 00000000 nop | + | 0005db28: 0043102b sltu r2,r2,r3 |{{f/std|<nowiki>r2 = 0x01 if Max MP < Current MP</nowiki>}} |
− | 0005db3c: a662002c sh r2,0x002c(r19) | + | 0005db2c: 10400004 beq r2,r0,0x0005db40 {{f/Cond|If Unit Current MP > Unit Max MP}} |
− | 0005db40: 8fbf0030 lw r31,0x0030(r29) | + | 0005db30: 00000000 nop | |
+ | 0005db34: 9662002e lhu r2,0x002e(r19) |{{f/load|Load Unit's Max MP}} | ||
+ | 0005db38: 00000000 nop | | ||
+ | 0005db3c: a662002c sh r2,0x002c(r19) |{{f/store|<nowiki>Store Current MP = Max MP</nowiki>}} | ||
+ | 0005db40: 8fbf0030 lw r31,0x0030(r29) END | ||
0005db44: 8fb7002c lw r23,0x002c(r29) | 0005db44: 8fb7002c lw r23,0x002c(r29) | ||
0005db48: 8fb60028 lw r22,0x0028(r29) | 0005db48: 8fb60028 lw r22,0x0028(r29) | ||
Line 88: | Line 92: | ||
0005db68: 03e00008 jr r31 | 0005db68: 03e00008 jr r31 | ||
0005db6c: 00000000 nop | 0005db6c: 00000000 nop | ||
− | + | === Return locations === | |
− | + | '''Battle.bin''' | |
− | == Return | + | 0018c90c: [[Level_up/down_ability]] |
− | + | ||
− | + | '''SCUS''' | |
− | + | 0005d8c4: [[Check_if_Unit_Leveled_UP]] | |
− | + | ||
− | + | '''DEBUGCHR.OUT''' | |
− | + | 001c4bcc: [[DEBUGCHR.OUT/001c438c_-_001c5240]] |
Revision as of 20:16, 19 November 2022
Level Up Section Parameters : r4 = Unit data pointer r5 = 0x01 if unit is leveling down, 0x00 if leveling Up Returns nothing ------------------------------------------------------------------------------------------------------------ 0005da10: 27bdffc8 addiu r29,r29,-0x0038 | 0005da14: afb3001c sw r19,0x001c(r29) | 0005da18: 00809821 addu r19,r4,r0 |r19 = Unit's Data Pointer 0005da1c: afb60028 sw r22,0x0028(r29) | 0005da20: 00a0b021 addu r22,r5,r0 |r22 = Level UP/Down Flag 0005da24: afb50024 sw r21,0x0024(r29) | 0005da28: 26750072 addiu r21,r19,0x0072 |r21 = Unit's Raw Stat Pointer 0005da2c: afb20018 sw r18,0x0018(r29) | 0005da30: 02a09021 addu r18,r21,r0 |r18 = Unit's Raw Stat Pointer (increased while looping) 0005da34: afb40020 sw r20,0x0020(r29) | 0005da38: 26740081 addiu r20,r19,0x0081 |r20 = Unit's Stat Growth Pointer (increased while looping) 0005da3c: afbf0030 sw r31,0x0030(r29) | 0005da40: afb7002c sw r23,0x002c(r29) | 0005da44: afb10014 sw r17,0x0014(r29) | 0005da48: afb00010 sw r16,0x0010(r29) | 0005da4c: 92770022 lbu r23,0x0022(r19) |r23 = Unit's Level 0005da50: 92440001 lbu r4,0x0001(r18) @LOOP Load Second byte of Raw Stat (Raw Stat 2 -> 0xBB) 0005da54: 92910000 lbu r17,0x0000(r20) |r17 = Stat Growth 0005da58: 92430000 lbu r3,0x0000(r18) |Load first byte of Raw Stat (Raw Stat 1 -> 0xAA) 0005da5c: 92420002 lbu r2,0x0002(r18) |Load third byte of Raw Stat (Raw Stat 3 -> 0xCC) 0005da60: 00042200 sll r4,r4,0x08 |r4 = 0xBB00 0005da64: 00641821 addu r3,r3,r4 |r3 = 0xBBAA 0005da68: 00021400 sll r2,r2,0x10 |r2 = 0xCC0000 0005da6c: 00628021 addu r16,r3,r2 |r16 = 0xCCBBAA (full raw stat) 0005da70: 16200002 bne r17,r0,0x0005da7c #If Unit Stat growth = 0 0005da74: 02201021 addu r2,r17,r0 |r2 = Stat Growth 0005da78: 34020001 ori r2,r0,0x0001 |r2 = 1 (Min 1 growth) 0005da7c: 0c0088c3 jal 0x0002230c |-->Random Number Generator Return r2 between 0 and 0x7fff 0005da80: 00578821 addu r17,r2,r23 |r17 = Stat Growth + Level 0005da84: 12c00005 beq r22,r0,0x0005da9c #If Unit is Leveling Down 0005da88: 00000000 nop | 0005da8c: 0211001b divu r16,r17 | 0005da90: 00001012 mflo r2 |Raw Stat modification = Raw Stat / (Stat Growth + Level) 0005da94: 080176ab j 0x0005daac >>Jump after lv up section 0005da98: 02028023 subu r16,r16,r2 |r16 = Raw Stat - Raw Stat modification 0005da9c: 0211001b divu r16,r17 #Else : Unit is leveling Up 0005daa0: 00001012 mflo r2 |Raw Stat modification = Raw Stat / (Stat Growth + Level) 0005daa4: 00000000 nop | 0005daa8: 02028021 addu r16,r16,r2 |r16 = Raw Stat + Raw Stat modification 0005daac: 3c0200ff lui r2,0x00ff | 0005dab0: 3442ffff ori r2,r2,0xffff |r2 = 0x00ffffff (maximum possible raw stat) 0005dab4: 0050102b sltu r2,r2,r16 |r2 = 0x01 if New raw stat > 0x00ffffff 0005dab8: 10400003 beq r2,r0,0x0005dac8 #If new Raw Stat is to high 0005dabc: 26940002 addiu r20,r20,0x0002 |Unit next growth pointer 0005dac0: 3c1000ff lui r16,0x00ff | 0005dac4: 3610ffff ori r16,r16,0xffff |r16 = 0x00ffffff 0005dac8: 00101202 srl r2,r16,0x08 |r2 = middle byte (0xBB) 0005dacc: a2420001 sb r2,0x0001(r18) |Store Raw Stat 2 0005dad0: 00101402 srl r2,r16,0x10 |r2 = Left Byte (0xCC) 0005dad4: a2500000 sb r16,0x0000(r18) |Store Raw Stat 1 0005dad8: a2420002 sb r2,0x0002(r18) |Store Raw Stat 3 0005dadc: 26520003 addiu r18,r18,0x0003 |Unit's Next Raw Stat Pointer 0005dae0: 26a2000f addiu r2,r21,0x000f |r2 = Unit HP growth pointer (used as unit raw stat limit) 0005dae4: 0242102a slt r2,r18,r2 |r2 = 0x01 while limit is not reached 0005dae8: 1440ffd9 bne r2,r0,0x0005da50 Λ Loop while current pointer < Max 0005daec: 00000000 nop | 0005daf0: 0c017578 jal 0x0005d5e0 |-->Status Setting/Checking Prep (Not Initializing, Statuses set?) 0005daf4: 02602021 addu r4,r19,r0 |r4 = Unit's Data Pointer 0005daf8: 96630028 lhu r3,0x0028(r19) |Load Unit's HP 0005dafc: 9662002a lhu r2,0x002a(r19) |Load Unit's Max HP 0005db00: 00000000 nop | 0005db04: 0043102b sltu r2,r2,r3 |r2 = 0x01 if Max HP < Current HP 0005db08: 10400004 beq r2,r0,0x0005db1c #If Unit Current HP > Unit Max HP 0005db0c: 00000000 nop | 0005db10: 9662002a lhu r2,0x002a(r19) |Load Unit's Max HP 0005db14: 00000000 nop | 0005db18: a6620028 sh r2,0x0028(r19) |Store Current HP = Max HP 0005db1c: 9663002c lhu r3,0x002c(r19) |Load Unit's MP 0005db20: 9662002e lhu r2,0x002e(r19) |Load Unit's Max MP 0005db24: 00000000 nop | 0005db28: 0043102b sltu r2,r2,r3 |r2 = 0x01 if Max MP < Current MP 0005db2c: 10400004 beq r2,r0,0x0005db40 #If Unit Current MP > Unit Max MP 0005db30: 00000000 nop | 0005db34: 9662002e lhu r2,0x002e(r19) |Load Unit's Max MP 0005db38: 00000000 nop | 0005db3c: a662002c sh r2,0x002c(r19) |Store Current MP = Max MP 0005db40: 8fbf0030 lw r31,0x0030(r29) END 0005db44: 8fb7002c lw r23,0x002c(r29) 0005db48: 8fb60028 lw r22,0x0028(r29) 0005db4c: 8fb50024 lw r21,0x0024(r29) 0005db50: 8fb40020 lw r20,0x0020(r29) 0005db54: 8fb3001c lw r19,0x001c(r29) 0005db58: 8fb20018 lw r18,0x0018(r29) 0005db5c: 8fb10014 lw r17,0x0014(r29) 0005db60: 8fb00010 lw r16,0x0010(r29) 0005db64: 27bd0038 addiu r29,r29,0x0038 0005db68: 03e00008 jr r31 0005db6c: 00000000 nop
Return locations
Battle.bin 0018c90c: Level_up/down_ability SCUS 0005d8c4: Check_if_Unit_Leveled_UP DEBUGCHR.OUT 001c4bcc: DEBUGCHR.OUT/001c438c_-_001c5240