Get Inner Text (WORLD.BIN)
Jump to navigation
Jump to search
# ROUTINE: GET INNER TEXT (WORLD.BIN) # 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. # This is the same as the Get Inner Text routine in BATTLE.BIN. # Parameters: # r4 = (inputText) Input text # r5 = (innerTextIndex) Index of inner text # Returns: # r2 = Text character pointer to inner text with specified index 80100348: 20090000 addi r9,r0,0x0000 # count = 0 8010034c: 200a00fe addi r10,r0,0x00fe # 0xfe # ptr = inputText # do { 80100350: 90880000 lbu r8,0x0000(r4) # value = *ptr 80100354: 10a90008 beq r5,r9,0x80100378 # if (innerTextIndex == count) 80100358: 00000000 nop # break; 8010035c: 310800fe andi r8,r8,0x00fe # value & 0xfe 80100360: 150a0002 bne r8,r10,0x8010036c # if ((value & 0xfe) == 0xfe) { // Sentinel value 80100364: 00000000 nop 80100368: 21290001 addi r9,r9,0x0001 # count = count + 1 # } 8010036c: 20840001 addi r4,r4,0x0001 # ptr = ptr + 1 80100370: 0401fff7 bgez r0,0x80100350 # } while (0 >= 0); // Loop condition always true. Must break out (innerTextIndex == count) to exit loop. 80100374: 00000000 nop 80100378: 00041020 add r2,r0,r4 # return ptr; 8010037c: 03e00008 jr r31 80100380: 00000000 nop