Save Coordinates to Temp Unit

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
# ROUTINE: SAVE COORDINATES TO TEMP UNIT                                                           DUPLICATED : Store_units_coordinates
#    Parameters: r4 = Integer byte array: [X Coordinate, Higher Elevation bit, Y Coordinate]
0019f258: 3c03801a lui r3,0x801a
0019f25c: 8c630bbc lw r3,0x0bbc(r3)             #   [Temp unit] = RAM_WORD[0x801a0bbc]
0019f260: 90820000 lbu r2,0x0000(r4)            #   ParameterArray[0]
0019f264: 00000000 nop
0019f268: a0620047 sb r2,0x0047(r3)             #   [Temp unit X coordinate] = ParameterArray[0]
0019f26c: 3c03801a lui r3,0x801a
0019f270: 8c630bbc lw r3,0x0bbc(r3)             #   [Temp unit] = RAM_WORD[0x801a0bbc]
0019f274: 90820002 lbu r2,0x0002(r4)            #   ParameterArray[2]
0019f278: 00000000 nop
0019f27c: a0620048 sb r2,0x0048(r3)             #   [Temp unit Y coordinate] = ParameterArray[2]
0019f280: 3c05801a lui r5,0x801a
0019f284: 8ca50bbc lw r5,0x0bbc(r5)             #   [Temp unit] = RAM_WORD[0x801a0bbc]
0019f288: 90830001 lbu r3,0x0001(r4)            #   ParameterArray[1]
0019f28c: 94a20048 lhu r2,0x0048(r5)            #   [Temp unit halfword: High byte = [0x49 flags], Low byte = [Y coordinate]]
0019f290: 00031bc0 sll r3,r3,0x0f               #   ParameterArray[1] << 15 (left shift)
0019f294: 30427fff andi r2,r2,0x7fff            #   [Temp unit halfword Higher Elevation bit cut off]
0019f298: 00431025 or r2,r2,r3                  #   Set temp unit halfword Higher Elevation bit = ParameterArray[1] << 15
0019f29c: 03e00008 jr r31                       #   Return...
0019f2a0: a4a20048 sh r2,0x0048(r5)             #   ...after the halfword is saved back