Get Inner Text

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
#   ROUTINE: GET INNER TEXT
#       Splits the input text on a sentinel value for inner text (0xFE or 0xFF), and returns a pointer to the inner text with the specified index.
#       Parameters:
#           r4 = [Input text] (inputText)
#           r5 = [Parameter: Inner Text Index]
#       Returns:
#           r2 = [Pointer to inner text with specified index]

0014ce78: 20090000 addi r9,r0,0x0000            #   [Loop Inner text index] = 0
0014ce7c: 200a00fe addi r10,r0,0x00fe
                                                #   do {
0014ce80: 90880000 lbu r8,0x0000(r4)            #       inputText[index]
0014ce84: 10a90008 beq r5,r9,0x0014cea8         #       if ([Parameter: Inner Text Index] == [Loop Inner text index]) 
0014ce88: 00000000 nop                          #           break; // (Exit the loop)
0014ce8c: 310800fe andi r8,r8,0x00fe
0014ce90: 150a0002 bne r8,r10,0x0014ce9c        #       if (inputText[index] is a sentinel value (0xFE or 0xFF) {  
0014ce94: 00000000 nop
0014ce98: 21290001 addi r9,r9,0x0001            #           [Loop Inner text index] = [Loop Inner text index] + 1
                                                #       }
0014ce9c: 20840001 addi r4,r4,0x0001            #       index = index + 1; Load inputText[index]
0014cea0: 0401fff7 bgez r0,0x0014ce80
0014cea4: 00000000 nop
                                                #   } while (true)
0014cea8: 00041020 add r2,r0,r4                 #   Return inputText[index]  // This will be a pointer to the start of the inner text with the specified index
0014ceac: 03e00008 jr r31
0014ceb0: 00000000 nop