Difference between revisions of "Display Menu Text (WORLD.BIN)"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
 
Line 381: Line 381:
 
  800fed1c: 10430014 beq r2,r3,0x800fed70
 
  800fed1c: 10430014 beq r2,r3,0x800fed70
 
  800fed20: ae220010 sw r2,0x0010(r17)                #              *0x1f800210 = result_0xe41fc
 
  800fed20: ae220010 sw r2,0x0010(r17)                #              *0x1f800210 = result_0xe41fc
                                                     #              if (*0x1f800224 != -1) {
+
                                                     #              if (result_0xe41fc != -1) {
 
  800fed24: 8e230000 lw r3,0x0000(r17)                #                  *0x1f800200
 
  800fed24: 8e230000 lw r3,0x0000(r17)                #                  *0x1f800200
 
  800fed28: 26420001 addiu r2,r18,0x0001              #                  value_s2 + 1
 
  800fed28: 26420001 addiu r2,r18,0x0001              #                  value_s2 + 1

Latest revision as of 14:48, 10 September 2022

#   ROUTINE: DISPLAY MENU TEXT (WORLD.BIN)
#       Displays menu text.
#       Similar routine to Display Menu Text in BATTLE.BIN.
#       Parameters:
#           r4 = (combinedTextIndex) for text lookup
#               16-bit value:
#                   (Upper 5 bits):     Text Section
#                   (Lower 11 bits):    Inner text index within Section
#           r5 = (p2) Pointer; Used as Parameter 2 in Routine 0x800ff284
#                Sometimes varies by menu, sometimes is the same
#           r6 = (p3) Menu data pointer?
#               0x00 = X coordinate (from center)?
#               0x02 = Y coordinate (from center)?
#           r7 = (specificTextPtr) Specific display text pointer
#                Uses this instead of [Combined Text Index] if populated, but does lookup based on [Combined Text Index] when this value is either 0 or 1

800fe818: 27bdffb8 addiu r29,r29,-0x0048
800fe81c: afb10024 sw r17,0x0024(r29)
800fe820: 00808821 addu r17,r4,r0                   #   combinedTextIndex
800fe824: afbe0040 sw r30,0x0040(r29)
800fe828: 00a0f021 addu r30,r5,r0                   #   p2
800fe82c: 00002021 addu r4,r0,r0                    #   0
800fe830: afbf0044 sw r31,0x0044(r29)
800fe834: afb7003c sw r23,0x003c(r29)
800fe838: afb60038 sw r22,0x0038(r29)
800fe83c: afb50034 sw r21,0x0034(r29)
800fe840: afb40030 sw r20,0x0030(r29)
800fe844: afb3002c sw r19,0x002c(r29)
800fe848: afb20028 sw r18,0x0028(r29)
800fe84c: afb00020 sw r16,0x0020(r29)
800fe850: afa60010 sw r6,0x0010(r29)                #   p3
800fe854: 0c0166bc jal 0x80059af0                   #   partyRamza = Get Party Data Pointer (0);                    // Ramza.  Returns 0x80057f74
800fe858: afa70018 sw r7,0x0018(r29)                #   specificTextPtr
800fe85c: 00402021 addu r4,r2,r0                    #   partyRamza
800fe860: 340300fe ori r3,r0,0x00fe                 #   0xfe
800fe864: 34100013 ori r16,r0,0x0013                #   count = 19
800fe868: 3c02801a lui r2,0x801a
800fe86c: 2442246b addiu r2,r2,0x246b               #   ptr = 0x801a246b
                                                    #   do {
800fe870: a0430000 sb r3,0x0000(r2)                 #       *ptr = 0xfe
800fe874: 2610ffff addiu r16,r16,-0x0001            #       count = count - 1
800fe878: 0601fffd bgez r16,0x800fe870
800fe87c: 2442ffff addiu r2,r2,-0x0001              #       ptr = ptr - 1
                                                    #   } while (count >= 0);
800fe880: 00008021 addu r16,r0,r0                   #   count = 0
                                                    #   do {
800fe884: 00901021 addu r2,r4,r16                   #       partyRamza + count
800fe888: 904200be lbu r2,0x00be(r2)                #       *(partyRamza + count + 0xbe)                                // Unit name
800fe88c: 3c01801a lui r1,0x801a
800fe890: 00300821 addu r1,r1,r16
800fe894: a0222458 sb r2,0x2458(r1)                 #       *(0x801a2458 + count) = *(partyRamza + count + 0xbe)        // Copies Ramza's unit name to *0x801a2458
800fe898: 26100001 addiu r16,r16,0x0001             #       count = count + 1
800fe89c: 2a020010 slti r2,r16,0x0010
800fe8a0: 1440fff8 bne r2,r0,0x800fe884
800fe8a4: 00000000 nop                              #   } while (count < 16);
800fe8a8: 8fa80018 lw r8,0x0018(r29)                #   specificTextPtr
800fe8ac: 00000000 nop
800fe8b0: 11000003 beq r8,r0,0x800fe8c0             #   if ((specificTextPtr == 0)
800fe8b4: 34020001 ori r2,r0,0x0001                 
800fe8b8: 15020005 bne r8,r2,0x800fe8d0             #      or (specificTextPtr == 1))
800fe8bc: 00000000 nop                              #   {
800fe8c0: 0c039bb7 jal 0x800e6edc                   #       textEntry = Find Text Entry (WORLD.BIN) (combinedTextIndex);
800fe8c4: 02202021 addu r4,r17,r0
800fe8c8: 0803fa35 j 0x800fe8d4
800fe8cc: 00409021 addu r18,r2,r0                   #       value_s2 = textEntry
                                                    #   } else {
800fe8d0: 8fb20018 lw r18,0x0018(r29)               #       value_s2 = specificTextPtr
                                                    #   }
800fe8d4: 3c111f80 lui r17,0x1f80
800fe8d8: 36310200 ori r17,r17,0x0200               #   0x1f800200
800fe8dc: 34170018 ori r23,r0,0x0018                #   value_s7 = 0x18 = 24
800fe8e0: 8fa80010 lw r8,0x0010(r29)                #   p3
800fe8e4: 2402ffff addiu r2,r0,-0x0001              #   -1
800fe8e8: 3c011f80 lui r1,0x1f80
800fe8ec: ac22021c sw r2,0x021c(r1)                 #   *(0x1f80021c) = -1
800fe8f0: 3c028015 lui r2,0x8015
800fe8f4: 244231d8 addiu r2,r2,0x31d8               #   0x801531d8
800fe8f8: 3c011f80 lui r1,0x1f80
800fe8fc: ac220224 sw r2,0x0224(r1)                 #   *0x1f800224 = 0x801531d8
800fe900: 3402ffff ori r2,r0,0xffff                 #   -1
800fe904: 3c011f80 lui r1,0x1f80
800fe908: ac220228 sw r2,0x0228(r1)                 #   *0x1f800228 = -1
800fe90c: 3c02801a lui r2,0x801a
800fe910: 2442a22c addiu r2,r2,-0x5dd4              #   0x8019a22c
800fe914: 3c011f80 lui r1,0x1f80
800fe918: ac200218 sw r0,0x0218(r1)                 #   *0x1f800218 = 0
800fe91c: 3c011f80 lui r1,0x1f80
800fe920: ac200204 sw r0,0x0204(r1)                 #   *0x1f800204 = 0
800fe924: 3c011f80 lui r1,0x1f80
800fe928: ac200208 sw r0,0x0208(r1)                 #   *0x1f800208 = 0
800fe92c: 3c011f80 lui r1,0x1f80
800fe930: ac20020c sw r0,0x020c(r1)                 #   *0x1f80020c = 0
800fe934: 95030000 lhu r3,0x0000(r8)                #   *p3
800fe938: 0040b021 addu r22,r2,r0                   #   0x8019a22c
800fe93c: a6c30000 sh r3,0x0000(r22)                #   *0x8019a22c = *p3
800fe940: 95020002 lhu r2,0x0002(r8)                #   *(p3 + 2)
800fe944: 0000a821 addu r21,r0,r0                   #   value_s5 = 0
800fe948: 3c018015 lui r1,0x8015
800fe94c: ac203274 sw r0,0x3274(r1)                 #   *0x80153274 = 0
800fe950: 3c01801a lui r1,0x801a
800fe954: a422a22e sh r2,-0x5dd2(r1)                #   *0x8019a22e = *(p3 + 2)
800fe958: 8d030008 lw r3,0x0008(r8)                 #   *(p3 + 8)
800fe95c: 34020010 ori r2,r0,0x0010                 #   16
800fe960: 3c018015 lui r1,0x8015
800fe964: ac223278 sw r2,0x3278(r1)                 #   *0x80153278 = 16
800fe968: 3c01801a lui r1,0x801a
800fe96c: ac23a234 sw r3,-0x5dcc(r1)                #   *0x8019a234 = *(p3 + 8)
                                                    #   do {
800fe970: 92440000 lbu r4,0x0000(r18)               #       *value_s2       // Current text character?
800fe974: 00000000 nop
800fe978: 288200d0 slti r2,r4,0x00d0
800fe97c: 1440012e bne r2,r0,0x800fee38
800fe980: ae240000 sw r4,0x0000(r17)                #       *0x1f800200 = *value_s2
                                                    #       if (value_s2 < 0xd0) {
800fe984: 308300f0 andi r3,r4,0x00f0                #           *value_s2 & 0xf0
800fe988: 340200d0 ori r2,r0,0x00d0
800fe98c: 14620013 bne r3,r2,0x800fe9dc
800fe990: 340200e2 ori r2,r0,0x00e2
                                                    #           if ((*value_s2 & 0xf0) == 0xd0) {
800fe994: 02202021 addu r4,r17,r0                   #               0x1f800200
800fe998: 92430000 lbu r3,0x0000(r18)               #               *value_s2
800fe99c: 02402821 addu r5,r18,r0                   #               value_s2
800fe9a0: 3063000f andi r3,r3,0x000f                #               *value_s2 & 0x0f
800fe9a4: 00031040 sll r2,r3,0x01                   #               (*value_s2 & 0x0f) * 2
800fe9a8: 00431021 addu r2,r2,r3                    #               (*value_s2 & 0x0f) * 3
800fe9ac: 00021080 sll r2,r2,0x02                   #               (*value_s2 & 0x0f) * 12           
800fe9b0: 00431021 addu r2,r2,r3                    #               (*value_s2 & 0x0f) * 13
800fe9b4: 00021100 sll r2,r2,0x04                   #               (*value_s2 & 0x0f) * 208
800fe9b8: 0c03fbcd jal 0x800fef34                   #               result_0xfef34 = ? 0xfef34 (0x1f800200, value_s2);
800fe9bc: ae220000 sw r2,0x0000(r17)                #               *0x1f800200 = (*value_s2 & 0x0f) * 208
800fe9c0: 00409021 addu r18,r2,r0                   #               value_s2 = result_0xfef34
800fe9c4: 92420000 lbu r2,0x0000(r18)               #               *result_0xfef34
800fe9c8: 8e230000 lw r3,0x0000(r17)                #               *0x1f800200
800fe9cc: 00000000 nop
800fe9d0: 00431021 addu r2,r2,r3                    #               *result_0xfef34 + *0x1f800200
800fe9d4: 0803fb8e j 0x800fee38
800fe9d8: ae220000 sw r2,0x0000(r17)                #               *0x1f800200 = *result_0xfef34 + *0x1f800200
                                                    #           } else {
800fe9dc: 14820006 bne r4,r2,0x800fe9f8             #               if (*value_s2 == 0xe2) {
800fe9e0: 340200ec ori r2,r0,0x00ec
800fe9e4: 02202021 addu r4,r17,r0                   #                   0x1f800200
800fe9e8: 0c03fbcd jal 0x800fef34                   #                   result_0xfef34 = ? 0xfef34 (0x1f800200, value_s2);
800fe9ec: 02402821 addu r5,r18,r0                   #                   value_s2
800fe9f0: 0803fb41 j 0x800fed04
800fe9f4: 00409021 addu r18,r2,r0                   #                   value_s2 = result_0xfef34
                                                    #               } else if (*value_s2 == 0xec) {
800fe9f8: 1482000a bne r4,r2,0x800fea24
800fe9fc: 340200f5 ori r2,r0,0x00f5
800fea00: 02202021 addu r4,r17,r0                   #                   0x1f800200
800fea04: 0c03fbcd jal 0x800fef34                   #                   result_0xfef34 = ? 0xfef34 (0x1f800200, value_s2);
800fea08: 02402821 addu r5,r18,r0                   #                   value_s2
800fea0c: 00409021 addu r18,r2,r0                   #                   value_s2 = result_0xfef34
800fea10: 92450000 lbu r5,0x0000(r18)               #                   *value_s2
800fea14: 0c03bc97 jal 0x800ef25c                   #                   ? 0xef25c (0x5a, *value_s2);
800fea18: 3404005a ori r4,r0,0x005a
800fea1c: 0803fb41 j 0x800fed04
800fea20: 00000000 nop
                                                    #               } else if (*value_s2 == 0xf5) {
800fea24: 14820008 bne r4,r2,0x800fea48
800fea28: 340200f6 ori r2,r0,0x00f6
800fea2c: 02202021 addu r4,r17,r0                   #                   0x1f800200
800fea30: 0c03fbcd jal 0x800fef34                   #                   result_0xfef34 = ? 0xfef34 (0x1f800200, value_s2);
800fea34: 02402821 addu r5,r18,r0                   #                   value_s2
800fea38: 00409021 addu r18,r2,r0                   #                   value_s2 = result_0xfef34
800fea3c: 92570000 lbu r23,0x0000(r18)              #                   value_s7 = *value_s2
800fea40: 0803fb41 j 0x800fed04
800fea44: 00000000 nop
                                                    #               } else if (*value_s2 == 0xf6) {
800fea48: 14820019 bne r4,r2,0x800feab0
800fea4c: 340200e3 ori r2,r0,0x00e3
800fea50: 02202021 addu r4,r17,r0                   #                   0x1f800200
800fea54: 0c03fbcd jal 0x800fef34                   #                   result_0xfef34 = ? 0xfef34 (0x1f800200, value_s2);
800fea58: 02402821 addu r5,r18,r0                   #                   value_s2
800fea5c: 00409021 addu r18,r2,r0                   #                   value_s2 = result_0xfef34
800fea60: 0c03bc6a jal 0x800ef1a8                   #                   scriptVar = Get Script Variable (WORLD.BIN) (0x66);
800fea64: 34040066 ori r4,r0,0x0066                 #                   0x66    // (Variable 0x66)
800fea68: 00408021 addu r16,r2,r0                   #                   scriptVar
800fea6c: 1200000b beq r16,r0,0x800fea9c            #                   if (scriptVar != 0) {
800fea70: 00102080 sll r4,r16,0x02                  #                       scriptVar * 4
800fea74: 92450000 lbu r5,0x0000(r18)               #                       *value_s2
800fea78: 00902021 addu r4,r4,r16                   #                       scriptVar * 5
800fea7c: 00042040 sll r4,r4,0x01                   #                       scriptVar * 10
800fea80: 0c03bc97 jal 0x800ef25c                   #                       Set Script Variable (value_s7 + (scriptVar * 10), *value_s2);
800fea84: 02e42021 addu r4,r23,r4                   #                       value_s7 + (scriptVar * 10)
800fea88: 34040066 ori r4,r0,0x0066
800fea8c: 0c03bc97 jal 0x800ef25c                   #                       Set Script Variable (0x66, 0);
800fea90: 00002821 addu r5,r0,r0
800fea94: 0803fb41 j 0x800fed04
800fea98: 00000000 nop                              #                   } else {                                 
800fea9c: 92450000 lbu r5,0x0000(r18)               #                       *value_s2 
800feaa0: 0c03bc97 jal 0x800ef25c                   #                       Set Script Variable (value_s7, *value_s2);
800feaa4: 02e02021 addu r4,r23,r0                   #                       value_s7
800feaa8: 0803fb41 j 0x800fed04
800feaac: 00000000 nop                              #                   }
                                                    #               } else if (*value_s2 == 0xe3) {
800feab0: 1482000a bne r4,r2,0x800feadc
800feab4: 340200fb ori r2,r0,0x00fb
800feab8: 02202021 addu r4,r17,r0                   #                   0x1f800200
800feabc: 0c03fbcd jal 0x800fef34                   #                   result_0xfef34 = ? 0xfef34 (0x1f800200, value_s2);
800feac0: 02402821 addu r5,r18,r0                   #                   value_s2
800feac4: 00409021 addu r18,r2,r0                   #                   value_s2 = result_0xfef34
800feac8: 92420000 lbu r2,0x0000(r18)               #                   *value_s2
800feacc: 3c018015 lui r1,0x8015
800fead0: ac223270 sw r2,0x3270(r1)                 #                   *0x80153270 = *value_s2
800fead4: 0803fb41 j 0x800fed04
800fead8: 00000000 nop
                                                    #               } else if (*value_s2 == 0xfb) {
800feadc: 14820007 bne r4,r2,0x800feafc
800feae0: 340200fa ori r2,r0,0x00fa
800feae4: 8fa80018 lw r8,0x0018(r29)                #                   specificTextPtr
800feae8: 34020001 ori r2,r0,0x0001                 #                   1
800feaec: 150200fe bne r8,r2,0x800feee8             #                   if (specificTextPtr != 1) break;
800feaf0: 340200ff ori r2,r0,0x00ff
800feaf4: 0803fb41 j 0x800fed04
800feaf8: 00000000 nop
                                                    #               } else if (*value_s2 == 0xfa) {
800feafc: 14820006 bne r4,r2,0x800feb18
800feb00: 340200f8 ori r2,r0,0x00f8
800feb04: 96c20000 lhu r2,0x0000(r22)               #                   *0x8019a22c    
800feb08: 00000000 nop
800feb0c: 24420004 addiu r2,r2,0x0004               #                   *0x8019a22c + 4
800feb10: 0803fb41 j 0x800fed04
800feb14: a6c20000 sh r2,0x0000(r22)                #                   *0x8019a22c = *0x8019a22c + 4
                                                    #               } else if (*value_s2 == 0xf8) {
800feb18: 1482000f bne r4,r2,0x800feb58
800feb1c: 340200e8 ori r2,r0,0x00e8
800feb20: 8fa80010 lw r8,0x0010(r29)                #                   p3
800feb24: 3c028015 lui r2,0x8015
800feb28: 8c423304 lw r2,0x3304(r2)                 #                   *0x80153304
800feb2c: 95030000 lhu r3,0x0000(r8)                #                   *p3
800feb30: 02a2102a slt r2,r21,r2                
800feb34: 14400006 bne r2,r0,0x800feb50
800feb38: a6c30000 sh r3,0x0000(r22)                #                   *0x8019a22c = *p3
                                                    #                   if (value_s5 >= *0x80153304) {
800feb3c: 96c20002 lhu r2,0x0002(r22)               #                       *0x8019a22e
800feb40: 3c018015 lui r1,0x8015
800feb44: ac203274 sw r0,0x3274(r1)                 #                       *0x80153274 = 0
800feb48: 24420010 addiu r2,r2,0x0010               #                       *0x8019a22e + 16
800feb4c: a6c20002 sh r2,0x0002(r22)                #                       *0x8019a22e = *0x8019a22e + 16
                                                    #                   }
800feb50: 0803fb41 j 0x800fed04
800feb54: 26b50001 addiu r21,r21,0x0001             #                   value_s5 = value_s5 + 1
                                                    #               } else if (*value_s2 == 0xe8) {
800feb58: 14820008 bne r4,r2,0x800feb7c
800feb5c: 340200e4 ori r2,r0,0x00e4
800feb60: 02202021 addu r4,r17,r0                   #                   0x1f800200 
800feb64: 0c03fbcd jal 0x800fef34                   #                   result_0xfef34 = ? 0xfef34 (0x1f800200, value_s2);
800feb68: 02402821 addu r5,r18,r0                   #                   value_s2
800feb6c: 00409021 addu r18,r2,r0                   #                   value_s2 = result_0xfef34
800feb70: 92420000 lbu r2,0x0000(r18)               #                   *value_s2
800feb74: 0803fb41 j 0x800fed04
800feb78: ae220028 sw r2,0x0028(r17)                #                   *0x1f800228 = *value_s2
                                                    #               } else
800feb7c: 8e230000 lw r3,0x0000(r17)
800feb80: 00000000 nop
800feb84: 10620005 beq r3,r2,0x800feb9c             #               if ((*0x1f800200 == 0xe4)
800feb88: 340200e6 ori r2,r0,0x00e6
800feb8c: 1462005d bne r3,r2,0x800fed04
800feb90: 02202021 addu r4,r17,r0                   #               
                                                    #                   or (*0x1f800200 == 0xe6)) 
                                                    #               {
800feb94: 0803faed j 0x800febb4                     #                   if ((*0x1f800200 == 0xe4) 
800feb98: 00000000 nop                              #                   {
                                                    
800feb9c: 8e220024 lw r2,0x0024(r17)                #                       *0x1f800224
800feba0: 8e230024 lw r3,0x0024(r17)                #                       *0x1f800224
800feba4: 8c420000 lw r2,0x0000(r2)                 #                       value = *(*0x1f800224)
800feba8: 24630004 addiu r3,r3,0x0004               #                       *0x1f800224 + 4
800febac: 0803faf6 j 0x800febd8
800febb0: ae230024 sw r3,0x0024(r17)                #                       *0x1f800224 = *0x1f800224 + 4
                                                                        } else {
800febb4: 0c03fbcd jal 0x800fef34                   #                       result_0xfef34 = ? 0xfef34 (0x1f800200, value_s2);
800febb8: 02402821 addu r5,r18,r0                   #                       value_s2
800febbc: 00409021 addu r18,r2,r0                   #                       value_s2 = result_0xfef34
800febc0: 92420000 lbu r2,0x0000(r18)               #                       *value_s2
800febc4: 00000000 nop
800febc8: 00021080 sll r2,r2,0x02                   #                       *value_s2 * 4
800febcc: 3c018015 lui r1,0x8015                       
800febd0: 00220821 addu r1,r1,r2
800febd4: 8c2231d8 lw r2,0x31d8(r1)                 #                       value = *(0x801531d8 + (*value_s2 * 4))
                                                    #                   }
800febd8: 00000000 nop
800febdc: ae220010 sw r2,0x0010(r17)                #                   *0x1f800210 = value
800febe0: 8e220028 lw r2,0x0028(r17)                #                   *0x1f800228
800febe4: 3403ffff ori r3,r0,0xffff                 #                   0xffff
800febe8: 14430006 bne r2,r3,0x800fec04
800febec: 2450ffff addiu r16,r2,-0x0001             #                   value_s0 = *0x1f800228 - 1    
                                                    #                   if (*0x1f800228 == 0xffff) {
800febf0: 8e240010 lw r4,0x0010(r17)                #                       *0x1f800210
800febf4: 0c039bc5 jal 0x800e6f14                   #                       ? 0xe6f14 (*0x1f800210);            
800febf8: 0000a021 addu r20,r0,r0                   #                       value_s4 = 0
800febfc: 0803fb03 j 0x800fec0c
800fec00: 2450ffff addiu r16,r2,-0x0001             #                       value_s0 = *0x1f800228 - 1
                                                    #                   } else {
800fec04: ae230028 sw r3,0x0028(r17)                #                       *0x1f800228 = 0xffff
800fec08: 0000a021 addu r20,r0,r0                   #                       value_s4 = 0
                                                    #                   }
800fec0c: 0600003d bltz r16,0x800fed04              #                   if (value_s0 >= 0) {
800fec10: 00101080 sll r2,r16,0x02                  #                       (*0x1f800228 - 1) * 4
800fec14: 3c088015 lui r8,0x8015
800fec18: 2508338c addiu r8,r8,0x338c               #                       0x8015338c
800fec1c: 00489821 addu r19,r2,r8                   #                       value_s3 = (value_s4 * 4) + 0x8015338c
                                                    #                       do {
800fec20: 8e220010 lw r2,0x0010(r17)                #                           *0x1f800210
800fec24: 8e630000 lw r3,0x0000(r19)                #                           *value_s3
800fec28: 00000000 nop
800fec2c: 0043102b sltu r2,r2,r3                    
800fec30: 10400005 beq r2,r0,0x800fec48             #                           if ((*0x1f800210 >= *value_s3)
800fec34: 00000000 nop
800fec38: 12000003 beq r16,r0,0x800fec48            #                               or (value_s0 == 0)
800fec3c: 00000000 nop
800fec40: 1280002a beq r20,r0,0x800fecec            #                               or (value_s4 != 0))
800fec44: 00000000 nop                              #                           {
800fec48: 8e230010 lw r3,0x0010(r17)                #                               *0x1f800210
800fec4c: 8e620000 lw r2,0x0000(r19)                #                               *value_s3
800fec50: 00000000 nop
800fec54: 0062001b divu r3,r2                       #                               *0x1f800210 / *value_s3
800fec58: 14400002 bne r2,r0,0x800fec64             #                               if (*value_s3 == 0) {
800fec5c: 00000000 nop
800fec60: 0007000d break 0x01c00                    #                                   (breakpoint)
                                                    #                               }
800fec64: 00001812 mflo r3                          #                               *0x1f800210 / *value_s3
800fec68: 00000000 nop
800fec6c: ae230000 sw r3,0x0000(r17)                #                               *0x1f800200 = *0x1f800210 / *value_s3
800fec70: 8e620000 lw r2,0x0000(r19)                #                               *value_s3
800fec74: 00000000 nop
800fec78: 00620018 mult r3,r2                       #                               (*0x1f800210 / *value_s3) * (*value_s3)
800fec7c: 3c048015 lui r4,0x8015
800fec80: 8c843308 lw r4,0x3308(r4)                 #                               *0x80153308
800fec84: 34140001 ori r20,r0,0x0001                #                               value_s4 = 1
800fec88: 02a4202a slt r4,r21,r4
800fec8c: 8e230010 lw r3,0x0010(r17)                #                               *0x1f800210
800fec90: 00001012 mflo r2                          #                               (*0x1f800210 / *value_s3) * (*value_s3)                     // ??? (Should be *0x1f800210)
800fec94: 00621823 subu r3,r3,r2                    #                               *0x1f800210 - ((*0x1f800210 / *value_s3) * (*value_s3))     // ??? (Should be 0)
800fec98: 10800092 beq r4,r0,0x800feee4
800fec9c: ae230010 sw r3,0x0010(r17)                #                               *0x1f800210 = *0x1f800210 - ((*0x1f800210 / *value_s3) * (*value_s3))   // (Should be 0)
                                                    #                               if (value_s5 >= *0x80153308) {
                                                    #                                   // Break out of both loops
                                                    #                                   breakOut = true;
                                                    #                                   break;
                                                    #                               }
800feca0: 3c028015 lui r2,0x8015
800feca4: 8c423304 lw r2,0x3304(r2)                 #                               *0x80153304
800feca8: 00000000 nop
800fecac: 02a2102a slt r2,r21,r2
800fecb0: 1440000e bne r2,r0,0x800fecec
800fecb4: 03c02821 addu r5,r30,r0                   #                               p2
                                                    #                               if (value_s5 >= *0x80153304) {
800fecb8: 3c06801a lui r6,0x801a
800fecbc: 24c6a22c addiu r6,r6,-0x5dd4              #                                   0x8019a22c
800fecc0: 8e220000 lw r2,0x0000(r17)                #                                   *0x1f800200
800fecc4: 3c078015 lui r7,0x8015
800fecc8: 8ce73270 lw r7,0x3270(r7)                 #                                   *0x80153270
800feccc: 3c03801d lui r3,0x801d
800fecd0: 8c63d66c lw r3,-0x2994(r3)                #                                   *0x801cd66c
800fecd4: 000220c0 sll r4,r2,0x03                   #                                   *0x1f800200 * 8
800fecd8: 00822021 addu r4,r4,r2                    #                                   *0x1f800200 * 9
800fecdc: 00042080 sll r4,r4,0x02                   #                                   *0x1f800200 * 36
800fece0: 00822023 subu r4,r4,r2                    #                                   *0x1f800200 * 35
800fece4: 0c03fca1 jal 0x800ff284                   #                                   ? 0xff284 (((*0x1f800200 * 35) + *0x801cd66c), p2, 0x8019a22c, *0x80153270);
800fece8: 00832021 addu r4,r4,r3                    #                                   (*0x1f800200 * 35) + *0x801cd66c
                                                    #                               }
                                                    #                           }
800fecec: 2673fffc addiu r19,r19,-0x0004            #                           value_s3 = value_s3 - 4
800fecf0: 96c20000 lhu r2,0x0000(r22)               #                           *0x8019a22c      
800fecf4: 2610ffff addiu r16,r16,-0x0001            #                           value_s0 = value_s0 - 1
800fecf8: 24420006 addiu r2,r2,0x0006               #                           *0x8019a22c + 6
800fecfc: 0601ffc8 bgez r16,0x800fec20
800fed00: a6c20000 sh r2,0x0000(r22)                #                           *0x8019a22c = *0x8019a22c + 6
                                                    #                       } while (value_s0 >= 0);
                                                    #                       if (breakOut)
                                                    #                           break;
                                                    #                   }
                                                    #               }
800fed04: 8e220024 lw r2,0x0024(r17)                #               *0x1f800224
800fed08: 8e240000 lw r4,0x0000(r17)                #               *0x1f800200
800fed0c: 8c450000 lw r5,0x0000(r2)                 #               *(*0x1f800224)
800fed10: 0c03907f jal 0x800e41fc                   #               result_0xe41fc = ? 0xe41fc (*0x1f800200, *(*0x1f800224));
800fed14: 00000000 nop
800fed18: 2403ffff addiu r3,r0,-0x0001              #               -1
800fed1c: 10430014 beq r2,r3,0x800fed70
800fed20: ae220010 sw r2,0x0010(r17)                #               *0x1f800210 = result_0xe41fc
                                                    #               if (result_0xe41fc != -1) {
800fed24: 8e230000 lw r3,0x0000(r17)                #                   *0x1f800200
800fed28: 26420001 addiu r2,r18,0x0001              #                   value_s2 + 1
800fed2c: ae22001c sw r2,0x001c(r17)                #                   *0x1f80021c = value_s2 + 1
800fed30: 340200e0 ori r2,r0,0x00e0
800fed34: 14620005 bne r3,r2,0x800fed4c             #                   if (*0x1f800200 == 0xe0) { 
800fed38: 00000000 nop
800fed3c: 3c12801a lui r18,0x801a                   
800fed40: 26522458 addiu r18,r18,0x2458             #                       value_s2 = 0x801a2458
800fed44: 0803fb57 j 0x800fed5c
800fed48: 00000000 nop                              #                   } else {
800fed4c: 8e240010 lw r4,0x0010(r17)                #                       *0x1f800210
800fed50: 0c039bb7 jal 0x800e6edc                   #                       textEntry = Find Text Entry (WORLD.BIN) (*0x1f800210);
800fed54: 00000000 nop
800fed58: 00409021 addu r18,r2,r0                   #                       value_s2 = textEntry
                                                    #                   }
800fed5c: 8e220024 lw r2,0x0024(r17)                #                   *0x1f800224
800fed60: 00000000 nop
800fed64: 24420004 addiu r2,r2,0x0004               #                   *0x1f800224 + 4
800fed68: 0803fa5c j 0x800fe970
800fed6c: ae220024 sw r2,0x0024(r17)                #                   *0x1f800224 = *0x1f800224 + 4
                                                    #                   continue;
                                                    #               }
800fed70: 8e240000 lw r4,0x0000(r17)                #               *0x1f800200
800fed74: 340200f0 ori r2,r0,0x00f0                 #               0xf0
800fed78: 308300f0 andi r3,r4,0x00f0                #               *0x1f800200 & 0xf0
800fed7c: 1462001e bne r3,r2,0x800fedf8
800fed80: 3082000f andi r2,r4,0x000f                #               *0x1f800200 & 0x0f
                                                    #               if (((*0x1f800200 & 0xf0) == 0xf0) 
800fed84: 28420004 slti r2,r2,0x0004                #                   and ((*0x1f800200 & 0x0f) < 4))
800fed88: 1040001b beq r2,r0,0x800fedf8             #               {
800fed8c: 26420003 addiu r2,r18,0x0003              #                   value_s2
800fed90: ae22001c sw r2,0x001c(r17)                #                   *0x1f80021c = value_s2
800fed94: 92420000 lbu r2,0x0000(r18)               #                   *value_s2
800fed98: 00000000 nop
800fed9c: 30420003 andi r2,r2,0x0003                #                   *value_s2 & 0x03      
800feda0: 000210c0 sll r2,r2,0x03                   #                   (*value_s2 & 0x03) * 8
800feda4: ae220014 sw r2,0x0014(r17)                #                   *0x1f800214 = (*value_s2 & 0x03) * 8
800feda8: 92420001 lbu r2,0x0001(r18)               #                   *(value_s2 + 1)
800fedac: 8e230014 lw r3,0x0014(r17)                #                   *0x1f800214
800fedb0: 00021142 srl r2,r2,0x05                   #                   *(value_s2 + 1) * 32
800fedb4: ae220018 sw r2,0x0018(r17)                #                   *0x1f800218 = *(value_s2 + 1) * 32
800fedb8: 00431021 addu r2,r2,r3                    #                   (*(value_s2 + 1) * 32) + *0x1f800214
800fedbc: 24420004 addiu r2,r2,0x0004               #                   (*(value_s2 + 1) * 32) + *0x1f800214 + 4
800fedc0: ae220018 sw r2,0x0018(r17)                #                   *0x1f800218 = (*(value_s2 + 1) * 32) + *0x1f800214 + 4
800fedc4: 92420001 lbu r2,0x0001(r18)               #                   *(value_s2 + 1)
800fedc8: 00000000 nop
800fedcc: 3042000f andi r2,r2,0x000f                #                   *(value_s2 + 1) & 0x0f
800fedd0: 000219c0 sll r3,r2,0x07                   #                   (*(value_s2 + 1) & 0x0f) * 128
800fedd4: 00621823 subu r3,r3,r2                    #                   (*(value_s2 + 1) & 0x0f) * 127
800fedd8: 00031840 sll r3,r3,0x01                   #                   (*(value_s2 + 1) & 0x0f) * 254
800feddc: ae230014 sw r3,0x0014(r17)                #                   *0x1f800214 = (*(value_s2 + 1) & 0x0f) * 254
800fede0: 92420002 lbu r2,0x0002(r18)               #                   *(value_s2 + 2)
800fede4: 00000000 nop
800fede8: 00431021 addu r2,r2,r3                    #                   *(value_s2 + 2) + ((*(value_s2 + 1) & 0x0f) * 254)
800fedec: 02429023 subu r18,r18,r2                  #                   value_s2 = value_s2 - (*(value_s2 + 2) + ((*(value_s2 + 1) & 0x0f) * 254))
800fedf0: 0803fa5c j 0x800fe970
800fedf4: ae220014 sw r2,0x0014(r17)                #                   *0x1f800214 = *(value_s2 + 2) + ((*(value_s2 + 1) & 0x0f) * 254)
                                                    #                   continue;
                                                    #               }
800fedf8: 8e220000 lw r2,0x0000(r17)                #               *0x1f800200
800fedfc: 340300fe ori r3,r0,0x00fe                 #               0xfe
800fee00: 304200fe andi r2,r2,0x00fe                #               *0x1f800200 & 0xfe
800fee04: 14430008 bne r2,r3,0x800fee28
800fee08: 02202021 addu r4,r17,r0                   #               0x1f800200
                                                    #               if (*0x1f800200 & 0xfe == 0xfe) {
800fee0c: 8e22001c lw r2,0x001c(r17)                #                   *0x1f80021c
800fee10: 2403ffff addiu r3,r0,-0x0001              #                   -1
800fee14: 10430033 beq r2,r3,0x800feee4             #                   if (*0x1f80021c == -1)
800fee18: 00000000 nop                              #                       break;
800fee1c: 00409021 addu r18,r2,r0                   #                   value_s2 = *0x1f80021c
800fee20: 0803fa5c j 0x800fe970
800fee24: ae23001c sw r3,0x001c(r17)                #                   *0x1f80021c = -1
                                                    #                   continue;
                                                    #               }
800fee28: 0c03fbcd jal 0x800fef34                   #               result_0xfef34 = ? 0xfef34 (0x1f800200, value_s2);
800fee2c: 02402821 addu r5,r18,r0                   #               value_s2
800fee30: 0803fa5c j 0x800fe970
800fee34: 00409021 addu r18,r2,r0                   #               value_s2 = result_0xfef34
                                                    #           }
                                                    #       }
800fee38: 02202021 addu r4,r17,r0                   #       0x1f800200
800fee3c: 0c03fbcd jal 0x800fef34                   #       result_0xfef34 = ? 0xfef34 (0x1f800200, value_s2);
800fee40: 02402821 addu r5,r18,r0                   #       value_s2
800fee44: 3c038015 lui r3,0x8015
800fee48: 8c633308 lw r3,0x3308(r3)                 #       *0x80153308
800fee4c: 00000000 nop
800fee50: 02a3182a slt r3,r21,r3
800fee54: 10600023 beq r3,r0,0x800feee4
800fee58: 00409021 addu r18,r2,r0                   #       value_s2 = result_0xfef34
                                                    #       if (value_s5 >= *0x80153308) break;
800fee5c: 3c028015 lui r2,0x8015
800fee60: 8c423304 lw r2,0x3304(r2)                 #       *0x80153304
800fee64: 00000000 nop
800fee68: 02a2102a slt r2,r21,r2
800fee6c: 1440000e bne r2,r0,0x800feea8
800fee70: 03c02821 addu r5,r30,r0                   #       p2
                                                    #       if (value_s5 >= *0x80153304) {
800fee74: 3c06801a lui r6,0x801a
800fee78: 24c6a22c addiu r6,r6,-0x5dd4              #           0x8019a22c
800fee7c: 8e220000 lw r2,0x0000(r17)                #           *0x1f800200
800fee80: 3c078015 lui r7,0x8015
800fee84: 8ce73270 lw r7,0x3270(r7)                 #           *0x80153270
800fee88: 3c03801d lui r3,0x801d
800fee8c: 8c63d66c lw r3,-0x2994(r3)                #           *0x801cd66c
800fee90: 000220c0 sll r4,r2,0x03                   #           *0x1f800200 * 8
800fee94: 00822021 addu r4,r4,r2                    #           *0x1f800200 * 9
800fee98: 00042080 sll r4,r4,0x02                   #           *0x1f800200 * 36
800fee9c: 00822023 subu r4,r4,r2                    #           *0x1f800200 * 35
800feea0: 0c03fca1 jal 0x800ff284                   #           ? 0xff284 ((*0x1f800200 * 35) + *0x801cd66c, p2, 0x8019a22c, *0x80153270);
800feea4: 00832021 addu r4,r4,r3                    #           (*0x1f800200 * 35) + *0x801cd66c
                                                    #       }
800feea8: 8e220000 lw r2,0x0000(r17)                #       *0x1f800200
800feeac: 96c30000 lhu r3,0x0000(r22)               #       *0x8019a22c
800feeb0: 3c018015 lui r1,0x8015
800feeb4: 00220821 addu r1,r1,r2
800feeb8: 902233e0 lbu r2,0x33e0(r1)                #       *(0x801533e0 + *0x1f800200)
800feebc: 00000000 nop
800feec0: 00431021 addu r2,r2,r3                    #       *(0x801533e0 + *0x1f800200) + *0x8019a22c
800feec4: a6c20000 sh r2,0x0000(r22)                #       *0x8019a22c = *(0x801533e0 + *0x1f800200) + *0x8019a22c
800feec8: 00021400 sll r2,r2,0x10                   
800feecc: 8ec30008 lw r3,0x0008(r22)                #       *0x8019a234
800feed0: 00021403 sra r2,r2,0x10                   #       *0x8019a22c             // (New value)
800feed4: 2463fff8 addiu r3,r3,-0x0008              #       *0x8019a234 - 8
800feed8: 0043102a slt r2,r2,r3
800feedc: 1440fea4 bne r2,r0,0x800fe970
800feee0: 00000000 nop                              #   } while (*0x8019a22c < (*0x8019a234 - 8));
800feee4: 340200ff ori r2,r0,0x00ff                 
800feee8: 3c018015 lui r1,0x8015                    #   *0x80153270 = 0
800feeec: ac203270 sw r0,0x3270(r1)
800feef0: 3c018015 lui r1,0x8015
800feef4: ac203304 sw r0,0x3304(r1)                 #   *0x80153304 = 0
800feef8: 3c018015 lui r1,0x8015
800feefc: ac223308 sw r2,0x3308(r1)                 #   *0x80153308 = 0xff
800fef00: 8fbf0044 lw r31,0x0044(r29)
800fef04: 8fbe0040 lw r30,0x0040(r29)
800fef08: 8fb7003c lw r23,0x003c(r29)
800fef0c: 8fb60038 lw r22,0x0038(r29)
800fef10: 8fb50034 lw r21,0x0034(r29)
800fef14: 8fb40030 lw r20,0x0030(r29)
800fef18: 8fb3002c lw r19,0x002c(r29)
800fef1c: 8fb20028 lw r18,0x0028(r29)
800fef20: 8fb10024 lw r17,0x0024(r29)
800fef24: 8fb00020 lw r16,0x0020(r29)
800fef28: 27bd0048 addiu r29,r29,0x0048
800fef2c: 03e00008 jr r31
800fef30: 00000000 nop