Difference between revisions of "Store movement stuff into scratch pad"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
m
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<font face='Courier New'>
+
'''BATTLE.BIN''' - Store movement stuff into scratch pad
 +
-----------------------------------------------------------------
 +
Parameters : nothing
 
   
 
   
  00174430: 27bdffb0 addiu r29,r29,0xffb0
+
  Returns : nothing
  00174434: afbe0048 sw r30,0x0048(r29)
+
   
  00174438: 0080f021 addu r30,r4,r0 acting unit
+
  Set a lot of data in different scratchpad
  0017443c: afb30034 sw r19,0x0034(r29)
+
  [[1f800000|<span style=color:blue>0x1f800000</span>]] - Acting Unit data
  00174440: 3c138019 lui r19,0x8019
+
  [[1f800080|<span style=color:blue>0x1f800080</span>]] - Other Units data
  00174444: 8e73f4e0 lw r19,-0x0b20(r19) load scratch pad address
+
  [[1f800100|<span style=color:blue>0x1f800100</span>]] - Movement modifiers
  00174448: 27a40018 addiu r4,r29,0x0018
+
  ------------------------------------------------------------------
0017444c: afb40038 sw r20,0x0038(r29)
+
00174430: 27bdffb0 addiu r29,r29,-0x0050    |
00174450: 3c148019 lui r20,0x8019
+
  00174434: afbe0048 sw r30,0x0048(r29)       |
00174454: 8e94f4e8 lw r20,-0x0b18(r20) 0x1f800000
+
  00174438: 0080f021 addu r30,r4,r0          |{{f/std|Acting Unit ID (if Riding - ID of his mount)}}
00174458: 03c02821 addu r5,r30,r0
+
  0017443c: afb30034 sw r19,0x0034(r29)       |
0017445c: afbf004c sw r31,0x004c(r29)
+
  00174440: 3c138019 lui r19,0x8019          |
00174460: afb70044 sw r23,0x0044(r29)
+
  00174444: 8e73f4e0 lw r19,-0x0b20(r19)      |{{f/adr|Pointer to scratch pad at 0x1f800000 - refered as S-Pad 0x00}} {{f/std|from 8018f4e0 - Used to store data on acting unit}}
  00174464: afb60040 sw r22,0x0040(r29)
+
00174448: 27a40018 addiu r4,r29,0x0018      |
  00174468: afb5003c sw r21,0x003c(r29)
+
  0017444c: afb40038 sw r20,0x0038(r29)       |
  0017446c: afb20030 sw r18,0x0030(r29)
+
  00174450: 3c148019 lui r20,0x8019          |
  00174470: afb1002c sw r17,0x002c(r29)
+
  00174454: 8e94f4e8 lw r20,-0x0b18(r20)      |{{f/adr|Pointer to scratch pad at 0x1f800080 - refered as S-Pad 0x80}} {{f/std| from 8018f4e8 - Used to store All unit data}}
  00174474: 0c05f056 jal 0x0017c158 Calculate height data
+
  00174458: 03c02821 addu r5,r30,r0          |
  00174478: afb00028 sw r16,0x0028(r29)
+
  0017445c: afbf004c sw r31,0x004c(r29)      |
  0017447c: 001e10c0 sll r2,r30,0x03
+
  00174460: afb70044 sw r23,0x0044(r29)      |
  00174480: 005e1023 subu r2,r2,r30
+
  00174464: afb60040 sw r22,0x0040(r29)      |
  00174484: 00021180 sll r2,r2,0x06
+
  00174468: afb5003c sw r21,0x003c(r29)      |
  00174488: 3c038019 lui r3,0x8019
+
  0017446c: afb20030 sw r18,0x0030(r29)      |
  0017448c: 246308cc addiu r3,r3,0x08cc
+
  00174470: afb1002c sw r17,0x002c(r29)      |
  00174490: 00438821 addu r17,r2,r3 r17 = unit data
+
  00174474: 0c05f056 jal 0x0017c158          |{{f/jal|Calculate_Height_Data|Calculate_Height_Data}} {{f/std|Returns some coordinates on stack (r4)}}
  00174494: 00009021 addu r18,r0,r0
+
  00174478: afb00028 sw r16,0x0028(r29)       |
  00174498: 27a30010 addiu r3,r29,0x0010
+
  0017447c: 001e10c0 sll r2,r30,0x03          |
  0017449c: 02321021 addu r2,r17,r18
+
  00174480: 005e1023 subu r2,r2,r30          |
  001744a0: 90420093 lbu r2,0x0093(r2) load active movement R/S/M
+
  00174484: 00021180 sll r2,r2,0x06          |
  001744a4: 26520001 addiu r18,r18,0x0001 counter++
+
  00174488: 3c038019 lui r3,0x8019            |
001744a8: a0620000 sb r2,0x0000(r3) store active Movement R/S/M
+
  0017448c: 246308cc addiu r3,r3,0x08cc      |{{f/std|Start of Unit Battle data}}
  001744ac: 2a420003 slti r2,r18,0x0003
+
  00174490: 00438821 addu r17,r2,r3          |{{f/adr|Acting Unit Battle data pointer}}
  001744b0: 1440fffa bne r2,r0,0x0017449c
+
  00174494: 00009021 addu r18,r0,r0          |
  001744b4: 24630001 addiu r3,r3,0x0001
+
  00174498: 27a30010 addiu r3,r29,0x0010      |{{f/adr|Stack 0x10}}
  001744b8: a27e000d sb r30,0x000d(r19) store active unit ID
+
                                            {{f/bloop|LOOP though Acting Unit active movement skills}}
  001744bc: 92220047 lbu r2,0x0047(r17) load X coordinate
+
  0017449c: 02321021 addu r2,r17,r18          |{{f/adr|Unit Battle data pointer + loop offset}}
  001744c0: 00000000 nop
+
  001744a0: 90420093 lbu r2,0x0093(r2)           |{{f/load|Load This iteration movement }}
001744c4: a2620007 sb r2,0x0007(r19)
+
  001744a4: 26520001 addiu r18,r18,0x0001        |{{f/std|Counter + 1}}
  001744c8: 92220048 lbu r2,0x0048(r17) load Y
+
  001744a8: a0620000 sb r2,0x0000(r3)             |{{f/store|Store Movement on Stack}}
  001744cc: 00000000 nop
+
  001744ac: 2a420003 slti r2,r18,0x0003          |
  001744d0: a2620008 sb r2,0x0008(r19)
+
  001744b0: 1440fffa bne r2,r0,0x0017449c    {{f/eloop|Loop 3 times}}
  001744d4: 96220048 lhu r2,0x0048(r17) load Map Level
+
  001744b4: 24630001 addiu r3,r3,0x0001          |{{f/std|Stack Offset (+1)}}
  001744d8: 00000000 nop
+
  001744b8: a27e000d sb r30,0x000d(r19)       |{{f/store|store active unit ID}}
001744dc: 000213c2 srl r2,r2,0x0f
+
  001744bc: 92220047 lbu r2,0x0047(r17)       |{{f/load|load X coordinate}}
  001744e0: a2620009 sb r2,0x0009(r19) store map level
+
  001744c0: 00000000 nop                      |
  001744e4: 3c02800e lui r2,0x800e
+
  001744c4: a2620007 sb r2,0x0007(r19)       |{{f/store|Store X}}
  001744e8: 90424e9c lbu r2,0x4e9c(r2) load max
+
  001744c8: 92220048 lbu r2,0x0048(r17)       |{{f/load|load Y coord}}
  001744ec: 00000000 nop
+
  001744cc: 00000000 nop                      |
  001744f0: a2620018 sb r2,0x0018(r19) store
+
  001744d0: a2620008 sb r2,0x0008(r19)       |{{f/store|Store Y}}
  001744f4: 3c02800e lui r2,0x800e
+
  001744d4: 96220048 lhu r2,0x0048(r17)       |{{f/load|load Elevation}}
001744f8: 90424ea0 lbu r2,0x4ea0(r2) load max yy
+
  001744d8: 00000000 nop                     |
  001744fc: 34030001 ori r3,r0,0x0001
+
  001744dc: 000213c2 srl r2,r2,0x0f          |
  00174500: a2600011 sb r0,0x0011(r19)
+
  001744e0: a2620009 sb r2,0x0009(r19)        |{{f/store|Store Elevation}}
  00174504: a2600014 sb r0,0x0014(r19)
+
  001744e4: 3c02800e lui r2,0x800e            |
  00174508: a2630012 sb r3,0x0012(r19)
+
  001744e8: 90424e9c lbu r2,0x4e9c(r2)       |{{f/load|Map Max X}}
  0017450c: a2630013 sb r3,0x0013(r19)
+
  001744ec: 00000000 nop                     |
00174510: a260001d sb r0,0x001d(r19)
+
  001744f0: a2620018 sb r2,0x0018(r19)        |{{f/store|Store Max X}}
00174514: a2620019 sb r2,0x0019(r19) store max y
+
  001744f4: 3c02800e lui r2,0x800e            |
  00174518: 96220048 lhu r2,0x0048(r17)
+
  001744f8: 90424ea0 lbu r2,0x4ea0(r2)        |{{f/load|Map Max Y}}
  0017451c: 00000000 nop
+
  001744fc: 34030001 ori r3,r0,0x0001        |
  00174520: 00021382 srl r2,r2,0x0e
+
  00174500: a2600011 sb r0,0x0011(r19)       |{{f/store|Initialize Cannot enter water flag}}
  00174524: 30420001 andi r2,r2,0x0001 load map level
+
  00174504: a2600014 sb r0,0x0014(r19)       |{{f/store|Initialize Cannot Stay on water flag}}
  00174528: a2620022 sb r2,0x0022(r19) store
+
00174508: a2630012 sb r3,0x0012(r19)       |{{f/store|Enable Will drown flag}}
  0017452c: 93a20012 lbu r2,0x0012(r29)                 Load RSM 5
+
  0017450c: a2630013 sb r3,0x0013(r19)        |{{f/store|Enable Will sink flag}}
  00174530: 00000000 nop
+
  00174510: a260001d sb r0,0x001d(r19)        |{{f/store|Initialize Fly/Teleport flag}}
  00174534: 30420028 andi r2,r2,0x0028                  Float, Move on Lava
+
  00174514: a2620019 sb r2,0x0019(r19)        |{{f/store|Store Max Y}}
  00174538: 10400003 beq r2,r0,0x00174548                Branch if unit doesn't have Float or Move on Lava
+
  00174518: 96220048 lhu r2,0x0048(r17)      |{{f/load|Load Acting Unit Height + Elevation}}
  0017453c: 00000000 nop
+
  0017451c: 00000000 nop                      |
  00174540: 0805d153 j 0x0017454c
+
  00174520: 00021382 srl r2,r2,0x0e          |{{f/std|Shift}}
  00174544: a2630025 sb r3,0x0025(r19)
+
  00174524: 30420001 andi r2,r2,0x0001        |{{f/std|Check Stepping Stone}}
  00174548: a2600025 sb r0,0x0025(r19)
+
  00174528: a2620022 sb r2,0x0022(r19)       |{{f/store|Store Acting Unit Stepping stone flag}}
0017454c: 9230005a lbu r16,0x005a(r17) load status
+
  0017452c: 93a20012 lbu r2,0x0012(r29)       |{{f/load|Load 3rd set of Movement}}
  00174550: 00000000 nop
+
  00174530: 00000000 nop                      |
  00174554: 32020006 andi r2,r16,0x0006
+
00174534: 30420028 andi r2,r2,0x0028        |
  00174558: 10400008 beq r2,r0,0x0017457c branch if not chicken or frog
+
  00174538: 10400003 beq r2,r0,0x00174548    {{f/Cond|If Acting Unit uses [Float] or [Move on Lava]}}
  0017455c: 34020006 ori r2,r0,0x0006
+
  0017453c: 00000000 nop                         |
00174560: 93a20011 lbu r2,0x0011(r29)
+
  00174540: 0805d153 j 0x0017454c                {{f/jump|Skip flag nullification}}
  00174564: 93a30012 lbu r3,0x0012(r29)
+
  00174544: a2630025 sb r3,0x0025(r19)            |{{f/store|Store can Pass Lava flag}}
  00174568: 304200f3 andi r2,r2,0x00f3 remove flag
+
                                            '''Else : Acting Unit do not use Float nor Move on Lava'''
  0017456c: 306300fb andi r3,r3,0x00fb remove flag
+
00174548: a2600025 sb r0,0x0025(r19)            |{{f/store|Nullify scratch pad 0x25}}
  00174570: a3a20011 sb r2,0x0011(r29)
+
0017454c: 9230005a lbu r16,0x005a(r17)     |{{f/load|Load 3rd set of current status}}
  00174574: 34020004 ori r2,r0,0x0004
+
  00174550: 00000000 nop                     |
00174578: a3a30012 sb r3,0x0012(r29)
+
  00174554: 32020006 andi r2,r16,0x0006      |
  0017457c: a262001b sb r2,0x001b(r19) 0x02 is the frog/chicken flag
+
  00174558: 10400008 beq r2,r0,0x0017457c    {{f/Cond|If Unit has Frog or Chicken}}
  00174580: 93a20012 lbu r2,0x0012(r29)                  Load RSM 5
+
  0017455c: 34020006 ori r2,r0,0x0006        |{{f/std|Default Unit size is 0x6}}
  00174584: 00000000 nop
+
  00174560: 93a20011 lbu r2,0x0011(r29)           |{{f/load|Load 2nd set of Movement}}
  00174588: 30420088 andi r2,r2,0x0088                  Walk on water/Float
+
  00174564: 93a30012 lbu r3,0x0012(r29)           |{{f/load|Load 3rd set of Movement}}
  0017458c: 14400007 bne r2,r0,0x001745ac
+
  00174568: 304200f3 andi r2,r2,0x00f3            |{{f/std|Remove Teleport and Teleport 2}}
00174590: 00000000 nop
+
  0017456c: 306300fb andi r3,r3,0x00fb            |{{f/std|Remove Fly}}
00174594: 93a20011 lbu r2,0x0011(r29)                   load RSM
+
00174570: a3a20011 sb r2,0x0011(r29)            |{{f/store|Set Teleport and Teleport2 flags  OFF (on stack)}}
  00174598: 00000000 nop
+
  00174574: 34020004 ori r2,r0,0x0004            |{{f/std|Frog and Chicken Size is 0x4}}
  0017459c: 30420010 andi r2,r2,0x0010
+
  00174578: a3a30012 sb r3,0x0012(r29)            |{{f/store|Set Fly flag OFF (on Stack)}}
  001745a0: 10400002 beq r2,r0,0x001745ac                  branch if not cannot enter water
+
  0017457c: a262001b sb r2,0x001b(r19)       |{{f/store|Store Unit size in Scratch Pad}}
  001745a4: 34020001 ori r2,r0,0x0001
+
  00174580: 93a20012 lbu r2,0x0012(r29)       |{{f/load|Load 3rd set of Movement}}
  001745a8: a2620014 sb r2,0x0014(r19)
+
  00174584: 00000000 nop                     |
  001745ac: 93a30012 lbu r3,0x0012(r29)                 Load RSM 5
+
  00174588: 30420088 andi r2,r2,0x0088        |{{f/std|Check [Float]and [Walk on water]}}
  001745b0: 00000000 nop
+
  0017458c: 14400007 bne r2,r0,0x001745ac    {{f/Cond|If Unit will not be above water}}
  001745b4: 30620008 andi r2,r3,0x0008                  Float (ability)
+
  00174590: 00000000 nop                          |
  001745b8: 1040000a beq r2,r0,0x001745e4              Branch if not float
+
  00174594: 93a20011 lbu r2,0x0011(r29)          |{{f/load|Load 2nd set of Movement}}
  001745bc: 00000000 nop
+
  00174598: 00000000 nop                         |
  001745c0: 9262001b lbu r2,0x001b(r19)
+
  0017459c: 30420010 andi r2,r2,0x0010            |{{f/std|Check [Can not enter water]}}
  001745c4: 00000000 nop
+
  001745a0: 10400002 beq r2,r0,0x001745ac        {{f/Cond|If Unit cannot enter water}}
001745c8: 24420002 addiu r2,r2,0x0002
+
001745a4: 34020001 ori r2,r0,0x0001                |
001745cc: a262001b sb r2,0x001b(r19)
+
  001745a8: a2620014 sb r2,0x0014(r19)               |{{f/store|store cannot Stay on water flag}}
001745d0: 93a20012 lbu r2,0x0012(r29)               Load RSM 5
+
  001745ac: 93a30012 lbu r3,0x0012(r29)       |{{f/load|Load 3rd set of Movement}}
  001745d4: 00000000 nop
+
  001745b0: 00000000 nop                     |
  001745d8: 34420080 ori r2,r2,0x0080       
+
  001745b4: 30620008 andi r2,r3,0x0008        |{{f/std|Check [Float]}}
001745dc: 0805d17a j 0x001745e8
+
  001745b8: 1040000a beq r2,r0,0x001745e4    {{f/Cond|If Unit uses Float}}
  001745e0: a262001c sb r2,0x001c(r19)
+
  001745bc: 00000000 nop                         |
  001745e4: a263001c sb r3,0x001c(r19)
+
  001745c0: 9262001b lbu r2,0x001b(r19)           |{{f/load|Load Unit Size}}
  001745e8: 32020040 andi r2,r16,0x0040
+
  001745c4: 00000000 nop                         |
  001745ec: 10400005 beq r2,r0,0x00174604
+
  001745c8: 24420002 addiu r2,r2,0x0002          |
001745f0: 00000000 nop
+
001745cc: a262001b sb r2,0x001b(r19)            |{{f/store|Size + 2 if Floating}}
  001745f4: 93a20012 lbu r2,0x0012(r29)                Load RSM 5
+
  001745d0: 93a20012 lbu r2,0x0012(r29)           |{{f/load|Load 3rd set of Movement}}
  001745f8: 00000000 nop
+
  001745d4: 00000000 nop                          |
001745fc: 34420008 ori r2,r2,0x0008
+
  001745d8: 34420080 ori r2,r2,0x0080            |{{f/std|Enable [Move on Water]}}
  00174600: a3a20012 sb r2,0x0012(r29)
+
  001745dc: 0805d17a j 0x001745e8                {{f/jump|Avoid Not Floating section}}
  00174604: 93a20011 lbu r2,0x0011(r29)               load RSM 4
+
  001745e0: a262001c sb r2,0x001c(r19)            |{{f/store|Store 3rd Set of active movement + Move on Water in scratchpad}}
  00174608: 00000000 nop
+
                                            '''Else : No Float'''
  0017460c: 30420010 andi r2,r2,0x0010
+
  001745e4: a263001c sb r3,0x001c(r19)            |{{f/store|Store 3rd Set of active movement  in scratchpad}}
  00174610: 10400005 beq r2,r0,0x00174628              branch if not cannot enter water
+
  001745e8: 32020040 andi r2,r16,0x0040      |{{f/std|Check [Float] in current status}}
  00174614: 00000000 nop
+
  001745ec: 10400005 beq r2,r0,0x00174604    {{f/Cond|If Unit has Float}}
  00174618: 93a20012 lbu r2,0x0012(r29)                 load RSM 5?
+
001745f0: 00000000 nop                          |
  0017461c: 00000000 nop
+
  001745f4: 93a20012 lbu r2,0x0012(r29)           |{{f/load|Load 3rd set of Movement}}
  00174620: 304200af andi r2,r2,0x00af                  everything except move underwater, move in water
+
  001745f8: 00000000 nop                          |
  00174624: a3a20012 sb r2,0x0012(r29)
+
  001745fc: 34420008 ori r2,r2,0x0008            |{{f/std|Enable [Float] in movement}}
  00174628: 0c05d0dc jal 0x00174370 ??? next to chocobo check
+
  00174600: a3a20012 sb r2,0x0012(r29)           |{{f/store|If float status, you get the float ability for free. (on stack)}}
  0017462c: 00000000 nop
+
00174604: 93a20011 lbu r2,0x0011(r29)      |{{f/load|Load 2nd set of Movement}}
  00174630: 93a30012 lbu r3,0x0012(r29)
+
  00174608: 00000000 nop                     |
  00174634: 00403021 addu r6,r2,r0
+
  0017460c: 30420010 andi r2,r2,0x0010        |{{f/std|check [Can not Enter Water]}}
  00174638: 30620004 andi r2,r3,0x0004                  fly check?
+
  00174610: 10400005 beq r2,r0,0x00174628    {{f/Cond|If Unit can't enter Water}}
  0017463c: 10400005 beq r2,r0,0x00174654
+
  00174614: 00000000 nop                          |
  00174640: 34020001 ori r2,r0,0x0001
+
  00174618: 93a20012 lbu r2,0x0012(r29)           |{{f/load|Load 3rd set of Movement}}
  00174644: a262000f sb r2,0x000f(r19)
+
  0017461c: 00000000 nop                          |
  00174648: a260000e sb r0,0x000e(r19)
+
00174620: 304200af andi r2,r2,0x00af            |{{f/std|everything except move underwater, move in water}}
  0017464c: 0805d1c0 j 0x00174700
+
  00174624: a3a20012 sb r2,0x0012(r29)           |{{f/store|Disable [Move underwater] and [Move in water]}}
00174650: a262001d sb r2,0x001d(r19)
+
  00174628: 0c05d0dc jal 0x00174370          |{{f/jal|00174370-001743c4  |00174370-001743c4 }} {{f/std|returns weather severity (1, 2, or 3)}}
  00174654: 93a20011 lbu r2,0x0011(r29)                 load RSM 4
+
0017462c: 00000000 nop                      |
  00174658: 00000000 nop
+
  00174630: 93a30012 lbu r3,0x0012(r29)      |{{f/load|Load 3rd set of Movement}}
  0017465c: 3042000c andi r2,r2,0x000c                  teleport checks
+
  00174634: 00403021 addu r6,r2,r0            |{{f/std|<nowiki>r6 = difficulty to move through weather affected tiles</nowiki>}}
  00174660: 10400007 beq r2,r0,0x00174680
+
00174638: 30620004 andi r2,r3,0x0004        |{{f/std|check [Fly]}}
00174664: 34020001 ori r2,r0,0x0001
+
0017463c: 10400005 beq r2,r0,0x00174654    {{f/Cond|If the Unit uses Fly}}
  00174668: a262000f sb r2,0x000f(r19)
+
  00174640: 34020001 ori r2,r0,0x0001            |
  0017466c: 93a30011 lbu r3,0x0011(r29)                 load RSM 4
+
  00174644: a262000f sb r2,0x000f(r19)           |{{f/store|Store Unhindered movement in scratchpad}}
  00174670: a262000e sb r2,0x000e(r19)
+
  00174648: a260000e sb r0,0x000e(r19)            |{{f/store|Store Move Type is Fly (0)}}
  00174674: a262001d sb r2,0x001d(r19)
+
  0017464c: 0805d1c0 j 0x00174700                {{f/jump|Jump After Check move type section}}
  00174678: 0805d1c0 j 0x00174700
+
  00174650: a262001d sb r2,0x001d(r19)           |{{f/store|Fly/Teleport Flag}}
  0017467c: a2630024 sb r3,0x0024(r19)
+
                                            '''Else : Unit is not Flying'''
  00174680: 30620008 andi r2,r3,0x0008                             
+
  00174654: 93a20011 lbu r2,0x0011(r29)          |{{f/load|Load 2nd set of Movement}}
  00174684: 10400003 beq r2,r0,0x00174694
+
  00174658: 00000000 nop                          |
  00174688: 34020002 ori r2,r0,0x0002
+
0017465c: 3042000c andi r2,r2,0x000c            |{{f/std|Check Teleport and Teleport2}}
  0017468c: 0805d1bf j 0x001746fc
+
  00174660: 10400007 beq r2,r0,0x00174680        {{f/Cond|If Unit uses Teleport}}
00174690: a262000f sb r2,0x000f(r19)
+
  00174664: 34020001 ori r2,r0,0x0001                |
  00174694: 30620020 andi r2,r3,0x0020
+
  00174668: a262000f sb r2,0x000f(r19)               |{{f/store|Store unhindered movement in scratchpad}}
00174698: 10400004 beq r2,r0,0x001746ac
+
  0017466c: 93a30011 lbu r3,0x0011(r29)              |{{f/load|Load 2nd set of Movement}}
  0017469c: 34020005 ori r2,r0,0x0005
+
  00174670: a262000e sb r2,0x000e(r19)                |{{f/store|Store Move Type is Teleport (1)}}
  001746a0: a262000f sb r2,0x000f(r19)
+
  00174674: a262001d sb r2,0x001d(r19)                |{{f/store|Fly/Teleport Flag}}
001746a4: 0805d1bf j 0x001746fc
+
  00174678: 0805d1c0 j 0x00174700                    {{f/jump|Jump After Check move type section}}
  001746a8: 34020003 ori r2,r0,0x0003
+
  0017467c: a2630024 sb r3,0x0024(r19)               |{{f/store|Store 2nd set of movement}}
  001746ac: 30620080 andi r2,r3,0x0080
+
                                                '''Else : No Teleport'''
  001746b0: 10400004 beq r2,r0,0x001746c4
+
  00174680: 30620008 andi r2,r3,0x0008                |{{f/std|Check [Float]}}
  001746b4: 34020003 ori r2,r0,0x0003
+
  00174684: 10400003 beq r2,r0,0x00174694            {{f/Cond|If Unit uses Float}}
  001746b8: a262000f sb r2,0x000f(r19)
+
  00174688: 34020002 ori r2,r0,0x0002                    |
  001746bc: 0805d1bf j 0x001746fc
+
  0017468c: 0805d1bf j 0x001746fc                        {{f/jump|Jump to Store move type (0x2)}}
  001746c0: 34020004 ori r2,r0,0x0004
+
00174690: a262000f sb r2,0x000f(r19)                   |{{f/store|Float in Move Mod}}
  001746c4: 30620040 andi r2,r3,0x0040
+
                                                    '''Else : No Float'''
  001746c8: 10400004 beq r2,r0,0x001746dc
+
  00174694: 30620020 andi r2,r3,0x0020                    |{{f/std|Check [Move on Lava]}}
  001746cc: 34020003 ori r2,r0,0x0003
+
  00174698: 10400004 beq r2,r0,0x001746ac                {{f/Cond|If Unit uses Move on Lava}}
001746d0: a262000f sb r2,0x000f(r19)
+
  0017469c: 34020005 ori r2,r0,0x0005                        |
001746d4: 0805d1bf j 0x001746fc
+
  001746a0: a262000f sb r2,0x000f(r19)                       |{{f/store|Move on Lava in Move mod}}
  001746d8: 34020005 ori r2,r0,0x0005
+
  001746a4: 0805d1bf j 0x001746fc                            {{f/jump|Jump to Store move type (0x3)}}
001746dc: 30620010 andi r2,r3,0x0010
+
  001746a8: 34020003 ori r2,r0,0x0003                        |
  001746e0: 10400004 beq r2,r0,0x001746f4
+
                                                        '''Else : not moving on lava'''
  001746e4: 34020004 ori r2,r0,0x0004
+
  001746ac: 30620080 andi r2,r3,0x0080                        |
  001746e8: a262000f sb r2,0x000f(r19)
+
  001746b0: 10400004 beq r2,r0,0x001746c4                    {{f/Cond|If Unit uses Walk on Water}}
001746ec: 0805d1bf j 0x001746fc
+
  001746b4: 34020003 ori r2,r0,0x0003                            |
  001746f0: 34020006 ori r2,r0,0x0006
+
  001746b8: a262000f sb r2,0x000f(r19)                           |{{f/store|Walk on Water in move mod}}
  001746f4: 34020007 ori r2,r0,0x0007
+
  001746bc: 0805d1bf j 0x001746fc                                {{f/jump|Jump to Store move type (0x4)}}
  001746f8: a260000f sb r0,0x000f(r19)
+
  001746c0: 34020004 ori r2,r0,0x0004                            |
  001746fc: a262000e sb r2,0x000e(r19)
+
   
  00174700: 9262001c lbu r2,0x001c(r19)
+
001746c4: 30620040 andi r2,r3,0x0040                            |
  00174704: 00000000 nop
+
001746c8: 10400004 beq r2,r0,0x001746dc                        {{f/Cond|If Unit moves in water}}
  00174708: 304200c0 andi r2,r2,0x00c0
+
  001746cc: 34020003 ori r2,r0,0x0003                                |
  0017470c: 10400002 beq r2,r0,0x00174718
+
  001746d0: a262000f sb r2,0x000f(r19)                               |{{f/store|Move in water in Move mod}}
  00174710: 00000000 nop
+
  001746d4: 0805d1bf j 0x001746fc                                    {{f/jump|Jump to Store move type (0x5)}}
00174714: a2600013 sb r0,0x0013(r19)
+
  001746d8: 34020005 ori r2,r0,0x0005                                |
  00174718: 9262001c lbu r2,0x001c(r19)
+
  0017471c: 00000000 nop
+
  001746dc: 30620010 andi r2,r3,0x0010                                |
  00174720: 304200d0 andi r2,r2,0x00d0
+
  001746e0: 10400004 beq r2,r0,0x001746f4                            {{f/Cond|If Unit Move under water}}
  00174724: 10400002 beq r2,r0,0x00174730
+
  001746e4: 34020004 ori r2,r0,0x0004                                    |
  00174728: 00000000 nop
+
  001746e8: a262000f sb r2,0x000f(r19)                                   |{{f/store|Move underWater in move mod}}
  0017472c: a2600012 sb r0,0x0012(r19)
+
  001746ec: 0805d1bf j 0x001746fc                                        {{f/jump|Jump to Store move type (0x6)}}
  00174730: 93a20012 lbu r2,0x0012(r29)                 Load RSM 5
+
  001746f0: 34020006 ori r2,r0,0x0006                                    |{{f/std|I just wanna know why these are counting up}}
  00174734: 00000000 nop
+
   
  00174738: 3042008c andi r2,r2,0x008c                  Walk on water, Float, Fly       
+
  001746f4: 34020007 ori r2,r0,0x0007                                    |{{f/std|<nowiki>r2 = 0x07</nowiki>}}
  0017473c: 14400007 bne r2,r0,0x0017475c              Branch if unit has one of the above^
+
  001746f8: a260000f sb r0,0x000f(r19)                                    |{{f/store|No Move mod}}
  00174740: 00000000 nop
+
001746fc: a262000e sb r2,0x000e(r19)               |{{f/store|Store move Type}}
  00174744: 93a20011 lbu r2,0x0011(r29)                 Load RSM4
+
  00174700: 9262001c lbu r2,0x001c(r19)      |{{f/load|Load 3rd Set of movement (scratchpad)}}
  00174748: 00000000 nop
+
  00174704: 00000000 nop                     |
  0017474c: 30420010 andi r2,r2,0x0010                  Cannot enter water
+
  00174708: 304200c0 andi r2,r2,0x00c0        |{{f/std|Check [Walk on Water] and [Move in water]}}
  00174750: 10400002 beq r2,r0,0x0017475c
+
  0017470c: 10400002 beq r2,r0,0x00174718    {{f/Cond|If Acting unit uses [Walk on Water] or [Move in water]}} {{f/std| Walk on water is ON if unit is Floating}}
  00174754: 34020001 ori r2,r0,0x0001
+
  00174710: 00000000 nop                          |
  00174758: a2620011 sb r2,0x0011(r19)
+
  00174714: a2600013 sb r0,0x0013(r19)            |{{f/store|Nullify Will Sink flag}}
  0017475c: 93a20012 lbu r2,0x0012(r29)
+
  00174718: 9262001c lbu r2,0x001c(r19)       |{{f/load|Load 3rd Set of movement (scratchpad)}}
  00174760: 00000000 nop
+
0017471c: 00000000 nop                      |
  00174764: a2620010 sb r2,0x0010(r19)
+
  00174720: 304200d0 andi r2,r2,0x00d0        |{{f/std|Check [Walk on Water] [Move in water] and [Move underwater]}}
  00174768: 93a30011 lbu r3,0x0011(r29)                  load RSM4
+
  00174724: 10400002 beq r2,r0,0x00174730    {{f/Cond|If Acting unit uses [Walk on Water] [Move in water] or [Move underwater]}}
0017476c: 00000000 nop
+
  00174728: 00000000 nop                          |
00174770: 30620002 andi r2,r3,0x0002
+
  0017472c: a2600012 sb r0,0x0012(r19)           |{{f/store|Nullify Will drawn flag}}
00174774: 10400002 beq r2,r0,0x00174780                any weather check
+
00174730: 93a20012 lbu r2,0x0012(r29)      |{{f/load|Load 3rd set of Movement (stack)}}
  00174778: 30650001 andi r5,r3,0x0001                  r5 = any ground check
+
  00174734: 00000000 nop                     |
  0017477c: 34060001 ori r6,r0,0x0001
+
  00174738: 3042008c andi r2,r2,0x008c        |{{f/std|Walk on water, Float, Fly}}
  00174780: 00009021 addu r18,r0,r0
+
  0017473c: 14400007 bne r2,r0,0x0017475c    {{f/Cond|If Unit don't uses [Walk on water] [Float] nor [Fly]}}
00174784: 340700ff ori r7,r0,0x00ff
+
  00174740: 00000000 nop                         |
00174788: 9262000f lbu r2,0x000f(r19)
+
  00174744: 93a20011 lbu r2,0x0011(r29)          |{{f/load|Load 2nd set of Movement}}
  0017478c: 3c038006 lui r3,0x8006
+
  00174748: 00000000 nop                          |
00174790: 2463ea50 addiu r3,r3,0xea50 default movement cost table
+
0017474c: 30420010 andi r2,r2,0x0010            |
  00174794: 00021180 sll r2,r2,0x06
+
  00174750: 10400002 beq r2,r0,0x0017475c        {{f/Cond|If Unit can't enter Water}}
  00174798: 00432021 addu r4,r2,r3
+
  00174754: 34020001 ori r2,r0,0x0001                |
  <Store movement cost for all tiles>
+
  00174758: a2620011 sb r2,0x0011(r19)                |{{f/store|Enable Cannot enter  Water flag}}
  0017479c: 90830000 lbu r3,0x0000(r4) load cost
+
0017475c: 93a20012 lbu r2,0x0012(r29)      |{{f/load|Load 3rd set of Movement (stack)}}
  001747a0: 00000000 nop
+
  00174760: 00000000 nop                     |
  001747a4: 306200ff andi r2,r3,0x00ff
+
  00174764: a2620010 sb r2,0x0010(r19)        |{{f/store|Store 3rd set of movement}}
  001747a8: 14400003 bne r2,r0,0x001747b8 branch if there is a cost
+
  00174768: 93a30011 lbu r3,0x0011(r29)       |{{f/load|Load 2nd set of Movement (stack)}}
  001747ac: 00000000 nop
+
  0017476c: 00000000 nop                     |
  001747b0: 0805d1f3 j 0x001747cc
+
  00174770: 30620002 andi r2,r3,0x0002        |
  001747b4: 00c01821 addu r3,r6,r0 return 1 if no cost
+
  00174774: 10400002 beq r2,r0,0x00174780    {{f/Cond|If Unit uses [Any Weather]}}
  001747b8: 10a00004 beq r5,r0,0x001747cc branch if not any ground
+
  00174778: 30650001 andi r5,r3,0x0001        |{{f/std|<nowiki>r5 = any ground check (used in next loop)</nowiki>}}
  001747bc: 00000000 nop
+
  0017477c: 34060001 ori r6,r0,0x0001            |{{f/std|<nowiki>if any weather, set cost to move through watery terrain = 1, even if heavy or extreme weather.</nowiki>}}
  001747c0: 10470002 beq r2,r7,0x001747cc branch if ??
+
  00174780: 00009021 addu r18,r0,r0          |{{f/std|Initialize loop counter}}
  001747c4: 00000000 nop
+
  00174784: 340700ff ori r7,r0,0x00ff        |
  001747c8: 34030001 ori r3,r0,0x0001
+
  00174788: 9262000f lbu r2,0x000f(r19)       |{{f/load|Load Move mod flag}}
  001747cc: 3c028019 lui r2,0x8019
+
  0017478c: 3c038006 lui r3,0x8006            |
001747d0: 8c42f4ec lw r2,-0x0b14(r2) load 0x1f800100
+
  00174790: 2463ea50 addiu r3,r3,-0x15b0      |{{f/adr|Default movement cost table pointer}} [[Movement_modifiers_Table|Movement modifiers Table]] at 8005ea50
  001747d4: 00000000 nop
+
  00174794: 00021180 sll r2,r2,0x06          |{{f/std|movement ignorance type * 0x40}}
  001747d8: 00521021 addu r2,r2,r18
+
  00174798: 00432021 addu r4,r2,r3            |{{f/adr|This Unit Movement Cost Table}}
  001747dc: 26520001 addiu r18,r18,0x0001
+
                                            {{f/bloop|LOOP - All entries of Movement cost Table}}
  001747e0: a0430000 sb r3,0x0000(r2) store movement cost in scratch pad
+
  0017479c: 90830000 lbu r3,0x0000(r4)            |{{f/load|Load this iteration movement cost}}
  001747e4: 2a420040 slti r2,r18,0x0040
+
001747a0: 00000000 nop                          |
  001747e8: 1440ffec bne r2,r0,0x0017479c
+
  001747a4: 306200ff andi r2,r3,0x00ff           |
  001747ec: 24840001 addiu r4,r4,0x0001
+
  001747a8: 14400003 bne r2,r0,0x001747b8        {{f/Cond|<nowiki>If Movement cost = 0x00</nowiki>}}
  001747f0: 9230003b lbu r16,0x003b(r17) load units jump
+
  001747ac: 00000000 nop                              |
  001747f4: 00000000 nop
+
  001747b0: 0805d1f3 j 0x001747cc                    {{f/jump|Jump to next iteration}} {{f/loc|Returns weather impact}}
  001747f8: 2e020008 sltiu r2,r16,0x0008
+
  001747b4: 00c01821 addu r3,r6,r0                    |{{f/std|Weather Impact}}
  001747fc: 14400003 bne r2,r0,0x0017480c branch if < 8
+
                                                '''Else movement cost <> 0x00'''
  00174800: 320200ff andi r2,r16,0x00ff
+
001747b8: 10a00004 beq r5,r0,0x001747cc            {{f/Cond|If Unit uses [Any Ground] / }} Else {{f/loc| Returns Movement cost}}
  00174804: 34100007 ori r16,r0,0x0007 hardcode to 7
+
  001747bc: 00000000 nop                                 |
  00174808: 320200ff andi r2,r16,0x00ff
+
  001747c0: 10470002 beq r2,r7,0x001747cc                {{f/Cond|If Movement cost <> 0xff /}} Else {{f/loc| returns Movement cost}}
  0017480c: 9263000e lbu r3,0x000e(r19) load ??
+
001747c4: 00000000 nop                                      |
00174810: 00021042 srl r2,r2,0x01 jump / 2
+
  001747c8: 34030001 ori r3,r0,0x0001                        |{{f/std|if any ground, set terrain move cost to 1}}
  00174814: 10600006 beq r3,r0,0x00174830 ??
+
  001747cc: 3c028019 lui r2,0x8019                |
  00174818: a2620005 sb r2,0x0005(r19) store jump/2?
+
  001747d0: 8c42f4ec lw r2,-0x0b14(r2)            |{{f/adr|Pointer to scratch pad at 0x1f800100 - refered as S-Pad 0x100}} {{f/std| from 8018f4ec}}
  0017481c: 93a20010 lbu r2,0x0010(r29) Load RSM3
+
  001747d4: 00000000 nop                          |
  00174820: 00000000 nop
+
  001747d8: 00521021 addu r2,r2,r18              |{{f/adr|S-Pad 0x100 + Iteration offset}}
  00174824: 30420002 andi r2,r2,0x0002                  Ignore Height check
+
  001747dc: 26520001 addiu r18,r18,0x0001        |{{f/std|Counter + 1}}
  00174828: 10400003 beq r2,r0,0x00174838                Branch if not ignore height
+
  001747e0: a0430000 sb r3,0x0000(r2)             |{{f/store|Store Movement cost in scratch 0x100}}
  0017482c: 02202021 addu r4,r17,r0
+
  001747e4: 2a420040 slti r2,r18,0x0040          |
  00174830: 3410001f ori r16,r0,0x001f
+
  001747e8: 1440ffec bne r2,r0,0x0017479c    {{f/eloop|Loop 0x40 Times}}
  00174834: 02202021 addu r4,r17,r0
+
  001747ec: 24840001 addiu r4,r4,0x0001           |{{f/adr|Movement cost table offset}}
  00174838: 320200ff andi r2,r16,0x00ff
+
  001747f0: 9230003b lbu r16,0x003b(r17)     |{{f/load|Load units jump}}
  0017483c: 00021040 sll r2,r2,0x01
+
  001747f4: 00000000 nop                     |
  00174840: a2620002 sb r2,0x0002(r19)
+
  001747f8: 2e020008 sltiu r2,r16,0x0008      |
  00174844: 0c05d0f2 jal 0x001743c8 chocobo check
+
  001747fc: 14400003 bne r2,r0,0x0017480c    {{f/Cond|If Unit Jump > 7}}
00174848: a2700004 sb r16,0x0004(r19)
+
  00174800: 320200ff andi r2,r16,0x00ff          |
  0017484c: 10400003 beq r2,r0,0x0017485c branch if not chocobo
+
  00174804: 34100007 ori r16,r0,0x0007            |{{f/std|Cap Jump at 0x7}}
  00174850: 34020001 ori r2,r0,0x0001
+
  00174808: 320200ff andi r2,r16,0x00ff          |
  00174854: 0805d218 j 0x00174860
+
0017480c: 9263000e lbu r3,0x000e(r19)       |{{f/load|Load Move Type}}
00174858: a2620015 sb r2,0x0015(r19) chocobo/move in water?
+
  00174810: 00021042 srl r2,r2,0x01          |{{f/std|jump / 2}}
0017485c: a2600015 sb r0,0x0015(r19)
+
  00174814: 10600006 beq r3,r0,0x00174830    {{f/Cond|If Move Type <> 0x00 (not flying)}}
00174860: 9230003a lbu r16,0x003a(r17) load move
+
00174818: a2620005 sb r2,0x0005(r19)        |{{f/store|Store jump/2 (S-Pad 0x00)}}
  00174864: 00000000 nop
+
  0017481c: 93a20010 lbu r2,0x0010(r29)           |{{f/load|Load 1st set of Movement (stack)}}
  00174868: 2e02007d sltiu r2,r16,0x007d set if less than 7d
+
  00174820: 00000000 nop                         |
  0017486c: 14400002 bne r2,r0,0x00174878 branch if so
+
  00174824: 30420002 andi r2,r2,0x0002            |{{f/std|Ignore Height check}}
  00174870: 00000000 nop
+
  00174828: 10400003 beq r2,r0,0x00174838        {{f/Cond|If Unit uses [Ignore Height]}}
  00174874: 3410007c ori r16,r0,0x007c hardcode to 7c
+
  0017482c: 02202021 addu r4,r17,r0                  |
  00174878: a2700006 sb r16,0x0006(r19) store move
+
                                                    {{f/sec|Fly or Ignore height}}
0017487c: 92220006 lbu r2,0x0006(r17) load gender
+
  00174830: 3410001f ori r16,r0,0x001f        {{f/Cond|E}}      |{{f/std|Forces unit height to 31 (Fly or ignore height)}}
  00174880: 00000000 nop
+
  00174834: 02202021 addu r4,r17,r0          |{{f/adr|Acting Unit pointer to battle data (for Jal)}}
00174884: 304200c0 andi r2,r2,0x00c0
+
  00174838: 320200ff andi r2,r16,0x00ff      |
  00174888: 1040000d beq r2,r0,0x001748c0 branch if not human
+
  0017483c: 00021040 sll r2,r2,0x01          |
  0017488c: 00000000 nop
+
  00174840: a2620002 sb r2,0x0002(r19)       |{{f/store|Store Jump*2 in S-Pad 0x00}}
  00174890: 9222005a lbu r2,0x005a(r17) load 5a status
+
  00174844: 0c05d0f2 jal 0x001743c8          |{{f/jal|Chocobo_Check|Chocobo_Check}} {{f/std|returns r2 (Unmountable / montable / Already ridden)}}
  00174894: 00000000 nop
+
00174848: a2700004 sb r16,0x0004(r19)       |{{f/store|Store Jump in S-Pad 0x00}}
  00174898: 30420006 andi r2,r2,0x0006
+
  0017484c: 10400003 beq r2,r0,0x0017485c    {{f/Cond|If Unit is a mountable Chocobo (ridden or not)}}
  0017489c: 14400008 bne r2,r0,0x001748c0 branch if frog or chicken
+
  00174850: 34020001 ori r2,r0,0x0001            |
  001748a0: 00000000 nop
+
  00174854: 0805d218 j 0x00174860                {{f/jump|Avoid not chocobo}}
  001748a4: 9222005c lbu r2,0x005c(r17) charm
+
  00174858: a2620015 sb r2,0x0015(r19)            |{{f/store|Chocobo flag (S-Pad 0x00)}}
  001748a8: 00000000 nop
+
                                            '''Else : not a chocobo (or not mountable by statuses)'''
  001748ac: 30420020 andi r2,r2,0x0020
+
  0017485c: a2600015 sb r0,0x0015(r19)           |{{f/store|No chocobo flag}}
  001748b0: 14400003 bne r2,r0,0x001748c0 branch if charm
+
  00174860: 9230003a lbu r16,0x003a(r17)     |{{f/load|Load Unit move}}
  001748b4: 34020001 ori r2,r0,0x0001
+
  00174864: 00000000 nop                      |
001748b8: 0805d231 j 0x001748c4
+
  00174868: 2e02007d sltiu r2,r16,0x007d      |
001748bc: a2620016 sb r2,0x0016(r19) store charm?
+
  0017486c: 14400002 bne r2,r0,0x00174878    {{f/Cond|If Move > 0x7c}}
  001748c0: a2600016 sb r0,0x0016(r19)
+
  00174870: 00000000 nop                          |
  001748c4: 340400ff ori r4,r0,0x00ff
+
  00174874: 3410007c ori r16,r0,0x007c            |{{f/std|Cap move at 0x7c}}
  001748c8: 3412000f ori r18,r0,0x000f
+
  00174878: a2700006 sb r16,0x0006(r19)      |{{f/store|Store unit move in S-Pad 0x00}}
  001748cc: 923101ba lbu r17,0x01ba(r17) load modified ENTD
+
  0017487c: 92220006 lbu r2,0x0006(r17)      |{{f/load|Load Unit Gender}}
  001748d0: 3c028019 lui r2,0x8019
+
  00174880: 00000000 nop                      |
001748d4: 9042f4fc lbu r2,-0x0b04(r2) load scratch pad
+
  00174884: 304200c0 andi r2,r2,0x00c0        |
001748d8: 26830069 addiu r3,r20,0x0069
+
  00174888: 1040000d beq r2,r0,0x001748c0    {{f/Cond|If Unit is not a monster}}
  001748dc: a3b10020 sb r17,0x0020(r29) store modified ENTD
+
  0017488c: 00000000 nop                         |
  001748e0: a262001a sb r2,0x001a(r19)
+
  00174890: 9222005a lbu r2,0x005a(r17)          |{{f/load|Load Unit Current Status 3}}
  <initialize panel data = FF> - 16 panels
+
00174894: 00000000 nop                          |
  001748e4: a0640003 sb r4,0x0003(r3)
+
  00174898: 30420006 andi r2,r2,0x0006            |
  001748e8: 2652ffff addiu r18,r18,0xffff
+
  0017489c: 14400008 bne r2,r0,0x001748c0        {{f/Cond|If Unit is not a Frog nor a Chicken}}
  001748ec: 0641fffd bgez r18,0x001748e4
+
  001748a0: 00000000 nop                              |
  001748f0: 2463fff9 addiu r3,r3,0xfff9
+
001748a4: 9222005c lbu r2,0x005c(r17)               |{{f/load|Load Unit Current Status 5}}
  001748f4: 0000b821 addu r23,r0,r0
+
  001748a8: 00000000 nop                              |
  001748f8: 00009021 addu r18,r0,r0
+
  001748ac: 30420020 andi r2,r2,0x0020                |
  001748fc: 0000b021 addu r22,r0,r0
+
  001748b0: 14400003 bne r2,r0,0x001748c0            {{f/Cond|If unit is not Charmed}}
  00174900: 2ae20010 slti r2,r23,0x0010 do 20 times
+
  001748b4: 34020001 ori r2,r0,0x0001                    |
  00174904: 10400094 beq r2,r0,0x00174b58
+
  001748b8: 0805d231 j 0x001748c4                        {{f/jump|Avoid Normal section}}
  00174908: 00000000 nop
+
  001748bc: a2620016 sb r2,0x0016(r19)                    |{{f/store|Enable Can Ride Flag}}
  0017490c: 3c028019 lui r2,0x8019
+
                                            '''Else : Monster or Forg/Chicken/Charm'''
  00174910: 244208cc addiu r2,r2,0x08cc
+
  001748c0: a2600016 sb r0,0x0016(r19)           |{{f/store|Disable Can Ride flag}}
  00174914: 02c28821 addu r17,r22,r2 get unit data
+
  001748c4: 340400ff ori r4,r0,0x00ff        |
  00174918: 92230001 lbu r3,0x0001(r17)
+
  001748c8: 3412000f ori r18,r0,0x000f        |{{f/std|Initialize Counter}}
  0017491c: 340200ff ori r2,r0,0x00ff
+
  001748cc: 923101ba lbu r17,0x01ba(r17)      |{{f/load|Load Unit modified ENTD}}
  00174920: 10620089 beq r3,r2,0x00174b48 branch if unit doesn't exist
+
  001748d0: 3c028019 lui r2,0x8019            |
  00174924: 00000000 nop
+
  001748d4: 9042f4fc lbu r2,-0x0b04(r2)      |{{f/load|Load ??}} {{f/std|8018f4fc}}
  00174928: 92220058 lbu r2,0x0058(r17)
+
  001748d8: 26830069 addiu r3,r20,0x0069      |{{f/adr|Scratch Pad 3 0x69}}
  0017492c: 00000000 nop
+
  001748dc: a3b10020 sb r17,0x0020(r29)       |{{f/store|Store modified ENTD}}
  00174930: 30420064 andi r2,r2,0x0064
+
  001748e0: a262001a sb r2,0x001a(r19)        |{{f/store|Store [8018f4fc] on scratch pad}}
00174934: 14400084 bne r2,r0,0x00174b48 branch if dead/crystal/jump
+
                                            {{f/bloop|LOOP - Set all Units 0x03 Entry to 0xff}}
  00174938: 00000000 nop
+
  001748e4: a0640003 sb r4,0x0003(r3)            |{{f/store|Store 0xff on scratch pad}}
0017493c: 92220059 lbu r2,0x0059(r17)
+
  001748e8: 2652ffff addiu r18,r18,-0x0001        |{{f/std|Counter - 1}}
  00174940: 00000000 nop
+
  001748ec: 0641fffd bgez r18,0x001748e4      {{f/eloop|Loop 16 times}}
  00174944: 30420001 andi r2,r2,0x0001
+
  001748f0: 2463fff9 addiu r3,r3,0xfff9          |{{f/adr|Scratch Pad offet - 0x07}}
  00174948: 1440007f bne r2,r0,0x00174b48 branch if treasure
+
  001748f4: 0000b821 addu r23,r0,r0          |{{f/std|Initialize Stored data counter}}
  0017494c: 00000000 nop
+
  001748f8: 00009021 addu r18,r0,r0           |{{f/std|Loop counter (Used as Unit offset of battle data)}}
  00174950: 125e007d beq r18,r30,0x00174b48 branch if active unit
+
  001748fc: 0000b021 addu r22,r0,r0          |{{f/std|Unit Offset (+0x1c0 each iteration)}}
  00174954: 00000000 nop
+
                                            {{f/bloop|LOOP - Other units data (0x15 times, but room for only 0x10 units)}}
  00174958: 92240182 lbu r4,0x0182(r17)
+
00174900: 2ae20010 slti r2,r23,0x0010          |{{f/std|Check Size of Stored data}}
  0017495c: 00000000 nop
+
  00174904: 10400094 beq r2,r0,0x00174b58        {{f/Cond|If this loop has stored more than 0x10 Units :}} {{f/loc| Exit routine}}
  00174960: 30820080 andi r2,r4,0x0080
+
  00174908: 00000000 nop                              |
  00174964: 1040000a beq r2,r0,0x00174990 branch if not riding a unit
+
  0017490c: 3c028019 lui r2,0x8019                    |
  00174968: 3082001f andi r2,r4,0x001f
+
  00174910: 244208cc addiu r2,r2,0x08cc              |
  0017496c: 9263000d lbu r3,0x000d(r19)
+
  00174914: 02c28821 addu r17,r22,r2              |{{f/adr|This iteration Unit Battle data pointer}}
  00174970: 00000000 nop
+
  00174918: 92230001 lbu r3,0x0001(r17)          |{{f/load|Load Unit Battle ID}}
00174974: 14430007 bne r2,r3,0x00174994
+
0017491c: 340200ff ori r2,r0,0x00ff            |
  00174978: 02408021 addu r16,r18,r0
+
  00174920: 10620089 beq r3,r2,0x00174b48        {{f/Cond|If Unit do not Exist : branch to }} {{f/loc| Next Unit iteration}}
  0017497c: 9262001b lbu r2,0x001b(r19)
+
  00174924: 00000000 nop                             |
00174980: 00000000 nop
+
  00174928: 92220058 lbu r2,0x0058(r17)           |{{f/load|Load This Unit current status 1}}
  00174984: 24420002 addiu r2,r2,0x0002
+
  0017492c: 00000000 nop                          |
  00174988: 0805d2d2 j 0x00174b48
+
  00174930: 30420064 andi r2,r2,0x0064            |
  0017498c: a262001b sb r2,0x001b(r19)
+
  00174934: 14400084 bne r2,r0,0x00174b48        {{f/Cond|If Unit is Dead or Crystal : branch to}} {{f/loc| Next Unit iteration}}
  00174990: 02408021 addu r16,r18,r0
+
  00174938: 00000000 nop                             |
  00174994: 0c05d0f2 jal 0x001743c8 [[Chocobo Check]]
+
  0017493c: 92220059 lbu r2,0x0059(r17)           |{{f/load|Load This Unit current status 2}}
00174998: 02202021 addu r4,r17,r0
+
  00174940: 00000000 nop                          |
  0017499c: 34030001 ori r3,r0,0x0001
+
  00174944: 30420001 andi r2,r2,0x0001            |
  001749a0: 10430007 beq r2,r3,0x001749c0 branch if chocobo?
+
  00174948: 1440007f bne r2,r0,0x00174b48        {{f/Cond|If Unit is a Treasure : branch to}} {{f/loc| Next Unit iteration}}
  001749a4: 00000000 nop
+
  0017494c: 00000000 nop                              |
  001749a8: 9262000d lbu r2,0x000d(r19) load active unit ID
+
00174950: 125e007d beq r18,r30,0x00174b48      {{f/Cond|If This Unit is the active Unit : branch to}} {{f/loc| Next Unit iteration}}
  001749ac: 92230182 lbu r3,0x0182(r17)
+
  00174954: 00000000 nop                              |
  001749b0: 34420040 ori r2,r2,0x0040
+
  00174958: 92240182 lbu r4,0x0182(r17)           |{{f/load|Load This unit Mount info}}
  001749b4: 10620002 beq r3,r2,0x001749c0 branch if being ridden by active unit?
+
  0017495c: 00000000 nop                          |
  001749b8: 00000000 nop
+
  00174960: 30820080 andi r2,r4,0x0080            |
  001749bc: 36500020 ori r16,r18,0x0020 add 20 flag
+
  00174964: 1040000a beq r2,r0,0x00174990        {{f/Cond|If This Unit is Riding}}
001749c0: 92230005 lbu r3,0x0005(r17) load team flags
+
  00174968: 3082001f andi r2,r4,0x001f                |{{f/std|Ridden Unit ID}}
  001749c4: 93a80020 lbu r8,0x0020(r29) load team flags
+
  0017496c: 9263000d lbu r3,0x000d(r19)              |{{f/load|Load Active Unit ID (Parameter of the routine)}}
  001749c8: 00000000 nop
+
  00174970: 00000000 nop                              |
001749cc: 01031026 xor r2,r8,r3
+
  00174974: 14430007 bne r2,r3,0x00174994            {{f/Cond|If This Unit is the rider of Active unit}}
001749d0: 30420030 andi r2,r2,0x0030
+
  00174978: 02408021 addu r16,r18,r0                      |
  001749d4: 10400002 beq r2,r0,0x001749e0 branch if on same team
+
  0017497c: 9262001b lbu r2,0x001b(r19)                   |{{f/load|Load Scratch pad 0x1b (Chicken Frog Float)}}
  001749d8: 0280a821 addu r21,r20,r0
+
  00174980: 00000000 nop                                  |
001749dc: 36100040 ori r16,r16,0x0040 add unwalkable flag
+
  00174984: 24420002 addiu r2,r2,0x0002                  |{{f/std|Active Unit Height + 2}}
  001749e0: a2900003 sb r16,0x0003(r20) store walkability
+
  00174988: 0805d2d2 j 0x00174b48                        {{f/jump|Jump to }} {{f/loc| Next Unit iteration}}
  001749e4: 92220047 lbu r2,0x0047(r17) load x
+
  0017498c: a262001b sb r2,0x001b(r19)                   |{{f/store|Store Updated Height}}
  001749e8: 92830002 lbu r3,0x0002(r20) load ?
+
  00174990: 02408021 addu r16,r18,r0              |{{f/std|Add Unit ID (will be stored)}}
  001749ec: a2820000 sb r2,0x0000(r20)
+
  00174994: 0c05d0f2 jal 0x001743c8              |{{f/jal|Chocobo Check|Chocobo Check}} {{f/std|Check This unit mount status}}
  001749f0: 92220048 lbu r2,0x0048(r17) load Y
+
  00174998: 02202021 addu r4,r17,r0               |{{f/adr|This iteration Unit Data pointer (for Jal)}}
  001749f4: 00000000 nop
+
  0017499c: 34030001 ori r3,r0,0x0001            |
  001749f8: a2820001 sb r2,0x0001(r20) store Y
+
  001749a0: 10430007 beq r2,r3,0x001749c0        {{f/Cond|If This Unit is not mountable (or already ridden)}}
  001749fc: 96220048 lhu r2,0x0048(r17)
+
001749a4: 00000000 nop                              |
  00174a00: 30630080 andi r3,r3,0x0080
+
  001749a8: 9262000d lbu r2,0x000d(r19)               |{{f/load|Load Active unit ID}}
  00174a04: 000213c2 srl r2,r2,0x0f
+
  001749ac: 92230182 lbu r3,0x0182(r17)              |{{f/load|Load this Unit mount info}}
  00174a08: 00621825 or r3,r3,r2
+
  001749b0: 34420040 ori r2,r2,0x0040                |{{f/std|Unit ID + 0x40 (so it will match r3)}}
00174a0c: a2830002 sb r3,0x0002(r20) store map level/Y?
+
  001749b4: 10620002 beq r3,r2,0x001749c0            {{f/Cond|If This unit is not ridden by active Unit}}
00174a10: 96220048 lhu r2,0x0048(r17)
+
  001749b8: 00000000 nop                                  |
  00174a14: 3063007f andi r3,r3,0x007f
+
001749bc: 36500020 ori r16,r18,0x0020                  |{{f/std|Update with not Mountable flag}}
  00174a18: 000211c2 srl r2,r2,0x07
+
  001749c0: 92230005 lbu r3,0x0005(r17)           |{{f/load|Load This Unit Team}}
  00174a1c: 30420080 andi r2,r2,0x0080
+
  001749c4: 93a80020 lbu r8,0x0020(r29)          |{{f/load|Load active unit modified ENTD}}
  00174a20: 00621825 or r3,r3,r2
+
001749c8: 00000000 nop                         |
00174a24: a2830002 sb r3,0x0002(r20) store map level?
+
001749cc: 01031026 xor r2,r8,r3                |{{f/std|Keep Only the difference}}
  00174a28: 9230005a lbu r16,0x005a(r17)
+
  001749d0: 30420030 andi r2,r2,0x0030            |{{f/std|Focus on team difference}}
  00174a2c: 00000000 nop
+
  001749d4: 10400002 beq r2,r0,0x001749e0        {{f/Cond|If This unit is an enemy of Active Unit}}
  00174a30: 32020006 andi r2,r16,0x0006
+
  001749d8: 0280a821 addu r21,r20,r0              |{{f/adr|S-Pad 0x80}}
00174a34: 10400006 beq r2,r0,0x00174a50 branch if not chicken/frog?
+
  001749dc: 36100040 ori r16,r16,0x0040              |{{f/std|Add Enemy Flag}}
  00174a38: 34020004 ori r2,r0,0x0004
+
  001749e0: a2900003 sb r16,0x0003(r20)          |{{f/store|Store r16 in S-Pad 0x80 (Unit ID/ 20 if Unmountable / 40 if enemy)}}
  00174a3c: 92830002 lbu r3,0x0002(r20)
+
  001749e4: 92220047 lbu r2,0x0047(r17)          |{{f/load|This unit X}}
  00174a40: a2820004 sb r2,0x0004(r20) store ??
+
  001749e8: 92830002 lbu r3,0x0002(r20)          |{{f/load|Load this Unit 0x02 (dynamic scratch Pad)}}
  00174a44: 3063007f andi r3,r3,0x007f remove 80 flag
+
  001749ec: a2820000 sb r2,0x0000(r20)           |{{f/store|store X on S-Pad 0x80}}
  00174a48: 0805d296 j 0x00174a58
+
  001749f0: 92220048 lbu r2,0x0048(r17)           |{{f/load|This Unit Y}}
00174a4c: a2830002 sb r3,0x0002(r20)
+
  001749f4: 00000000 nop                          |
  00174a50: 34020006 ori r2,r0,0x0006
+
  001749f8: a2820001 sb r2,0x0001(r20)            |{{f/store|store Y on S-Pad 0x80}}
  00174a54: a2820004 sb r2,0x0004(r20)
+
  001749fc: 96220048 lhu r2,0x0048(r17)          |{{f/load|Load Y + Elevation}}
  00174a58: 92300182 lbu r16,0x0182(r17)         Mount info byte 
+
  00174a00: 30630080 andi r3,r3,0x0080            |
  00174a5c: 00000000 nop
+
  00174a04: 000213c2 srl r2,r2,0x0f              |{{f/std|1 if higher elevation}}
  00174a60: 32020040 andi r2,r16,0x0040
+
  00174a08: 00621825 or r3,r3,r2                 |
  00174a64: 10400009 beq r2,r0,0x00174a8c        Branch if unit is not being ridden
+
  00174a0c: a2830002 sb r3,0x0002(r20)           |{{f/store|Enable (or not) high elvation flag (S-Pad 0x80)}}
  00174a68: 3202001f andi r2,r16,0x001f
+
  00174a10: 96220048 lhu r2,0x0048(r17)           |{{f/load|Load Y + Elevation}}
  00174a6c: 9263000d lbu r3,0x000d(r19)
+
  00174a14: 3063007f andi r3,r3,0x007f            |{{f/std|Disable 0x80}}
  00174a70: 00000000 nop
+
  00174a18: 000211c2 srl r2,r2,0x07              |
  00174a74: 10430005 beq r2,r3,0x00174a8c
+
  00174a1c: 30420080 andi r2,r2,0x0080            |{{f/std|check [Stepping stone]}}
  00174a78: 00000000 nop
+
  00174a20: 00621825 or r3,r3,r2                 |{{f/std|Enable 0x80 if stepping stone}}
00174a7c: 92a20004 lbu r2,0x0004(r21)
+
  00174a24: a2830002 sb r3,0x0002(r20)            |{{f/store|Store back 0x80 if stepping stone}}
  00174a80: 00000000 nop
+
  00174a28: 9230005a lbu r16,0x005a(r17)         |{{f/load|This Unit Current Status 3}}
00174a84: 24420002 addiu r2,r2,0x0002
+
  00174a2c: 00000000 nop                         |
00174a88: a2a20004 sb r2,0x0004(r21)
+
  00174a30: 32020006 andi r2,r16,0x0006          |
  00174a8c: 92300095 lbu r16,0x0095(r17)
+
  00174a34: 10400006 beq r2,r0,0x00174a50        {{f/Cond|If Unit has Frog or Chicken}}
  00174a90: 0c060428 jal 0x001810a0              [[Map Location Calculation]]
+
  00174a38: 34020004 ori r2,r0,0x0004                |
  00174a94: 02202021 addu r4,r17,r0
+
  00174a3c: 92830002 lbu r3,0x0002(r20)              |
  00174a98: 000210c0 sll r2,r2,0x03
+
  00174a40: a2820004 sb r2,0x0004(r20)                |{{f/store|Store 0x04 (height)}}
  00174a9c: 3c038019 lui r3,0x8019
+
  00174a44: 3063007f andi r3,r3,0x007f                |{{f/std|remove 80 flag}}
00174aa0: 2463f8cc addiu r3,r3,0xf8cc
+
  00174a48: 0805d296 j 0x00174a58                    {{f/jump|Avoid Anti section}}
  00174aa4: 00431021 addu r2,r2,r3
+
  00174a4c: a2830002 sb r3,0x0002(r20)                |{{f/store|Disable stepping stone}}
  00174aa8: 90440002 lbu r4,0x0002(r2) load height
+
                                                '''Else : if Unit hasn't Frog nor Chicken'''
  00174aac: 90430003 lbu r3,0x0003(r2) load halves/depth
+
  00174a50: 34020006 ori r2,r0,0x0006                |
  00174ab0: 90420003 lbu r2,0x0003(r2) load halves/depth
+
  00174a54: a2820004 sb r2,0x0004(r20)                |{{f/store|<nowiki>Store height = 0x06</nowiki>}}
  00174ab4: 00042040 sll r4,r4,0x01 height*2
+
00174a58: 92300182 lbu r16,0x0182(r17)          |{{f/load|Mount info byte}}
  00174ab8: 3063001f andi r3,r3,0x001f r3 = height (halves)
+
00174a5c: 00000000 nop                          |
  00174abc: 00832021 addu r4,r4,r3 height*2 + halves
+
00174a60: 32020040 andi r2,r16,0x0040           |
  00174ac0: 00022942 srl r5,r2,0x05 depth
+
  00174a64: 10400009 beq r2,r0,0x00174a8c        {{f/Cond|If Unit is ridden}}
  00174ac4: 10a00014 beq r5,r0,0x00174b18 branch if depth = 0
+
  00174a68: 3202001f andi r2,r16,0x001f              |{{f/std|Rider ID}}
  00174ac8: 00801821 addu r3,r4,r0 r3 = total height
+
  00174a6c: 9263000d lbu r3,0x000d(r19)              |{{f/load|Load Active Unit ID}}
00174acc: 9222005a lbu r2,0x005a(r17)
+
  00174a70: 00000000 nop                              |
  00174ad0: 00000000 nop
+
  00174a74: 10430005 beq r2,r3,0x00174a8c            {{f/Cond|If This unit is not the active unit mount}}
  00174ad4: 30420040 andi r2,r2,0x0040 load float flag
+
00174a78: 00000000 nop                                  |
  00174ad8: 10400004 beq r2,r0,0x00174aec
+
  00174a7c: 92a20004 lbu r2,0x0004(r21)                   |{{f/load|Load Unit Size}}
  00174adc: 00051040 sll r2,r5,0x01 depth*2
+
  00174a80: 00000000 nop                                 |
  00174ae0: 24420002 addiu r2,r2,0x0002 depth*2+2
+
  00174a84: 24420002 addiu r2,r2,0x0002                  |
  00174ae4: 0805d2cc j 0x00174b30
+
  00174a88: a2a20004 sb r2,0x0004(r21)                    |{{f/store|Size + 2 (rider height)}}
  00174ae8: 00821821 addu r3,r4,r2 r3 = total height + depth*2 + 2
+
  00174a8c: 92300095 lbu r16,0x0095(r17)          |{{f/load|This unit Movement 3}}
  00174aec: 32020080 andi r2,r16,0x0080 riding check
+
  00174a90: 0c060428 jal 0x001810a0              |{{f/jal|Map Location Calculation|Map Location Calculation}} {{f/std|<nowiki>returns r2 = This unit Tile ID</nowiki>}}
  00174af0: 10400003 beq r2,r0,0x00174b00 branch if not riding
+
00174a94: 02202021 addu r4,r17,r0              |{{f/std|This unit data pointer}}
  00174af4: 00051040 sll r2,r5,0x01
+
00174a98: 000210c0 sll r2,r2,0x03              |{{f/std|Tile ID *8}}
  00174af8: 0805d2cc j 0x00174b30
+
00174a9c: 3c038019 lui r3,0x8019                |
00174afc: 00821821 addu r3,r4,r2
+
00174aa0: 2463f8cc addiu r3,r3,0xf8cc          |
00174b00: 32020040 andi r2,r16,0x0040
+
00174aa4: 00431021 addu r2,r2,r3                |{{f/adr|This unit Tile's data pointer}}
  00174b04: 1040000a beq r2,r0,0x00174b30 branch if not being ridden
+
00174aa8: 90440002 lbu r4,0x0002(r2)            |{{f/load|load height}}
  00174b08: 00051040 sll r2,r5,0x01
+
00174aac: 90430003 lbu r3,0x0003(r2)            |{{f/load|load halves/depth}}
  00174b0c: 2442fffe addiu r2,r2,0xfffe
+
00174ab0: 90420003 lbu r2,0x0003(r2)            |{{f/load|load halves/depth}}
  00174b10: 0805d2cc j 0x00174b30
+
00174ab4: 00042040 sll r4,r4,0x01              |{{f/std|height*2}}
  00174b14: 00821821 addu r3,r4,r2
+
00174ab8: 3063001f andi r3,r3,0x001f            |{{f/std|<nowiki>r3 = height (halves)</nowiki>}}
  00174b18: 9222005a lbu r2,0x005a(r17)
+
00174abc: 00832021 addu r4,r4,r3                |{{f/std|height*2 + halves}}
  00174b1c: 00000000 nop
+
00174ac0: 00022942 srl r5,r2,0x05              |{{f/std|Tile depth}}
  00174b20: 30420040 andi r2,r2,0x0040
+
00174ac4: 10a00014 beq r5,r0,0x00174b18        {{f/Cond|If Depht <> 0x00}}
  00174b24: 10400002 beq r2,r0,0x00174b30 branch if not floating
+
00174ac8: 00801821 addu r3,r4,r0                |{{f/std|<nowiki>r3 = Total Height (Height*2) + Halves</nowiki>}}
  00174b28: 00000000 nop
+
00174acc: 9222005a lbu r2,0x005a(r17)              |{{f/load|This unit Current Status 3}}
00174b2c: 24830002 addiu r3,r4,0x0002 total height + 2
+
00174ad0: 00000000 nop                              |
  00174b30: 26940007 addiu r20,r20,0x0007 go to next panel
+
00174ad4: 30420040 andi r2,r2,0x0040                |{{f/std|load float flag}}
00174b34: 92a20004 lbu r2,0x0004(r21) load ?? movement cost?
+
00174ad8: 10400004 beq r2,r0,0x00174aec            {{f/Cond|If this Unit has [Float]}}
00174b38: 26f70001 addiu r23,r23,0x0001
+
00174adc: 00051040 sll r2,r5,0x01                      |{{f/std|depth*2}}
00174b3c: a2a30005 sb r3,0x0005(r21) store height
+
00174ae0: 24420002 addiu r2,r2,0x0002                  |{{f/std|depth*2+2}}
00174b40: 00621021 addu r2,r3,r2 ?? + height
+
00174ae4: 0805d2cc j 0x00174b30                        {{f/jump|Jump to next iteration}}
  00174b44: a2a20006 sb r2,0x0006(r21) store ?? + height
+
00174ae8: 00821821 addu r3,r4,r2                        |{{f/std|<nowiki>r3 = total height + depth*2 + 2</nowiki>}}
  00174b48: 26520001 addiu r18,r18,0x0001
+
                                                    '''Else : This unit isn't Floating'''
  00174b4c: 2a420015 slti r2,r18,0x0015
+
00174aec: 32020080 andi r2,r16,0x0080                  |
  00174b50: 1440ff6b bne r2,r0,0x00174900 do 21 times (for each unit)
+
00174af0: 10400003 beq r2,r0,0x00174b00                {{f/Cond|If Unit Walk on water}}
  00174b54: 26d601c0 addiu r22,r22,0x01c0
+
00174af4: 00051040 sll r2,r5,0x01                          |{{f/std|depht * 2}}
  00174b58: 8fbf004c lw r31,0x004c(r29)
+
00174af8: 0805d2cc j 0x00174b30                            {{f/jump|Jump to next iteration}}
 +
00174afc: 00821821 addu r3,r4,r2                            |{{f/std|<nowiki>r3 = total height + depth*2 </nowiki>}}
 +
                                                        '''Else : not walking on water'''
 +
00174b00: 32020040 andi r2,r16,0x0040                      |
 +
00174b04: 1040000a beq r2,r0,0x00174b30                    {{f/Cond|If Unit Walk in water}}
 +
00174b08: 00051040 sll r2,r5,0x01                              |{{f/std|depht * 2}}
 +
00174b0c: 2442fffe addiu r2,r2,-0x0002                          |{{f/std|depht * 2 -2}}
 +
00174b10: 0805d2cc j 0x00174b30                                {{f/jump|Jump to next iteration}}
 +
00174b14: 00821821 addu r3,r4,r2                                |{{f/std|Total Height + depht*2 - 2}}
 +
                                                '''Else : Depht  = 0x00'''
 +
00174b18: 9222005a lbu r2,0x005a(r17)              |{{f/load|This unit Current Status 3}}
 +
00174b1c: 00000000 nop                              |
 +
00174b20: 30420040 andi r2,r2,0x0040                |
 +
00174b24: 10400002 beq r2,r0,0x00174b30            {{f/Cond|If This unit is Floating}}
 +
00174b28: 00000000 nop                                  |
 +
00174b2c: 24830002 addiu r3,r4,0x0002                  |{{f/std|Total height + 2}}
 +
00174b30: 26940007 addiu r20,r20,0x0007        |{{f/adr|Next Unit Offset in scratch pad}}
 +
00174b34: 92a20004 lbu r2,0x0004(r21)          |{{f/load|Load Unit Height}}
 +
00174b38: 26f70001 addiu r23,r23,0x0001        |{{f/std|Data stored counter}}
 +
00174b3c: a2a30005 sb r3,0x0005(r21)            |{{f/store|Store Total Height on S-Pad 0x80}}
 +
00174b40: 00621021 addu r2,r3,r2               |{{f/std|Unit Size + Map height}}
 +
  00174b44: a2a20006 sb r2,0x0006(r21)           |{{f/store|Store Size + Height }}
 +
  00174b48: 26520001 addiu r18,r18,0x0001         |{{f/std|Unit Counter + 1}}
 +
  00174b4c: 2a420015 slti r2,r18,0x0015           |{{f/std|Check unit limit}}
 +
  00174b50: 1440ff6b bne r2,r0,0x00174900     {{f/eloop|Loop 21 times (for each unit)}}
 +
  00174b54: 26d601c0 addiu r22,r22,0x01c0         |{{f/adr|Offset for Battle data}}
 +
  00174b58: 8fbf004c lw r31,0x004c(r29)       END
 
  00174b5c: 8fbe0048 lw r30,0x0048(r29)
 
  00174b5c: 8fbe0048 lw r30,0x0048(r29)
 
  00174b60: 8fb70044 lw r23,0x0044(r29)
 
  00174b60: 8fb70044 lw r23,0x0044(r29)
Line 474: Line 502:
 
  00174b84: 03e00008 jr r31
 
  00174b84: 03e00008 jr r31
 
  00174b88: 00000000 nop
 
  00174b88: 00000000 nop
</font>
+
=== Return Location ===
 +
'''BATTLE.BIN'''
 +
00174be8: [[00174b8c_-_00174df4]]
 +
00176744: [[001766b4_-_00176c0c]]
 +
00178d44: [[Find_Tiles_for_the_AI_to_move_to_(00178ca4)]]

Latest revision as of 14:14, 2 June 2023

BATTLE.BIN - Store movement stuff into scratch pad
-----------------------------------------------------------------
Parameters : nothing 

Returns : nothing

Set a lot of data in different scratchpad
0x1f800000 - Acting Unit data
0x1f800080 - Other Units data
0x1f800100 - Movement modifiers 
------------------------------------------------------------------
00174430: 27bdffb0 addiu r29,r29,-0x0050    |
00174434: afbe0048 sw r30,0x0048(r29)       |
00174438: 0080f021 addu r30,r4,r0           |Acting Unit ID (if Riding - ID of his mount)
0017443c: afb30034 sw r19,0x0034(r29)       |
00174440: 3c138019 lui r19,0x8019           |
00174444: 8e73f4e0 lw r19,-0x0b20(r19)      |Pointer to scratch pad at 0x1f800000 - refered as S-Pad 0x00 from 8018f4e0 - Used to store data on acting unit
00174448: 27a40018 addiu r4,r29,0x0018      |
0017444c: afb40038 sw r20,0x0038(r29)       |
00174450: 3c148019 lui r20,0x8019           |
00174454: 8e94f4e8 lw r20,-0x0b18(r20)      |Pointer to scratch pad at 0x1f800080 - refered as S-Pad 0x80  from 8018f4e8 - Used to store All unit data 
00174458: 03c02821 addu r5,r30,r0           |
0017445c: afbf004c sw r31,0x004c(r29)       |
00174460: afb70044 sw r23,0x0044(r29)       |
00174464: afb60040 sw r22,0x0040(r29)       |
00174468: afb5003c sw r21,0x003c(r29)       |
0017446c: afb20030 sw r18,0x0030(r29)       |
00174470: afb1002c sw r17,0x002c(r29)       |
00174474: 0c05f056 jal 0x0017c158           |-->Calculate_Height_Data Returns some coordinates on stack (r4)
00174478: afb00028 sw r16,0x0028(r29)       |
0017447c: 001e10c0 sll r2,r30,0x03          |
00174480: 005e1023 subu r2,r2,r30           |
00174484: 00021180 sll r2,r2,0x06           |
00174488: 3c038019 lui r3,0x8019            |
0017448c: 246308cc addiu r3,r3,0x08cc       |Start of Unit Battle data
00174490: 00438821 addu r17,r2,r3           |Acting Unit Battle data pointer
00174494: 00009021 addu r18,r0,r0           |
00174498: 27a30010 addiu r3,r29,0x0010      |Stack 0x10
                                            @LOOP though Acting Unit active movement skills
0017449c: 02321021 addu r2,r17,r18          |Unit Battle data pointer + loop offset
001744a0: 90420093 lbu r2,0x0093(r2)            |Load This iteration movement 
001744a4: 26520001 addiu r18,r18,0x0001         |Counter + 1
001744a8: a0620000 sb r2,0x0000(r3)             |Store Movement on Stack
001744ac: 2a420003 slti r2,r18,0x0003           |
001744b0: 1440fffa bne r2,r0,0x0017449c     Λ Loop 3 times
001744b4: 24630001 addiu r3,r3,0x0001           |Stack Offset (+1)
001744b8: a27e000d sb r30,0x000d(r19)       |store active unit ID
001744bc: 92220047 lbu r2,0x0047(r17)       |load X coordinate
001744c0: 00000000 nop                      |
001744c4: a2620007 sb r2,0x0007(r19)        |Store X
001744c8: 92220048 lbu r2,0x0048(r17)       |load Y coord
001744cc: 00000000 nop                      |
001744d0: a2620008 sb r2,0x0008(r19)        |Store Y
001744d4: 96220048 lhu r2,0x0048(r17)       |load Elevation
001744d8: 00000000 nop                      |
001744dc: 000213c2 srl r2,r2,0x0f           |
001744e0: a2620009 sb r2,0x0009(r19)        |Store Elevation
001744e4: 3c02800e lui r2,0x800e            |
001744e8: 90424e9c lbu r2,0x4e9c(r2)        |Map Max X
001744ec: 00000000 nop                      |
001744f0: a2620018 sb r2,0x0018(r19)        |Store Max X
001744f4: 3c02800e lui r2,0x800e            |
001744f8: 90424ea0 lbu r2,0x4ea0(r2)        |Map Max Y
001744fc: 34030001 ori r3,r0,0x0001         |
00174500: a2600011 sb r0,0x0011(r19)        |Initialize Cannot enter water flag
00174504: a2600014 sb r0,0x0014(r19)        |Initialize Cannot Stay on water flag
00174508: a2630012 sb r3,0x0012(r19)        |Enable Will drown flag
0017450c: a2630013 sb r3,0x0013(r19)        |Enable Will sink flag
00174510: a260001d sb r0,0x001d(r19)        |Initialize Fly/Teleport flag
00174514: a2620019 sb r2,0x0019(r19)        |Store Max Y
00174518: 96220048 lhu r2,0x0048(r17)       |Load Acting Unit Height + Elevation
0017451c: 00000000 nop                      |
00174520: 00021382 srl r2,r2,0x0e           |Shift
00174524: 30420001 andi r2,r2,0x0001        |Check Stepping Stone
00174528: a2620022 sb r2,0x0022(r19)        |Store Acting Unit Stepping stone flag
0017452c: 93a20012 lbu r2,0x0012(r29)       |Load 3rd set of Movement
00174530: 00000000 nop                      |
00174534: 30420028 andi r2,r2,0x0028        |
00174538: 10400003 beq r2,r0,0x00174548     #If Acting Unit uses [Float] or [Move on Lava]
0017453c: 00000000 nop                          |
00174540: 0805d153 j 0x0017454c                 >>Skip flag nullification
00174544: a2630025 sb r3,0x0025(r19)            |Store can Pass Lava flag
                                            Else : Acting Unit do not use Float nor Move on Lava
00174548: a2600025 sb r0,0x0025(r19)            |Nullify scratch pad 0x25
0017454c: 9230005a lbu r16,0x005a(r17)      |Load 3rd set of current status
00174550: 00000000 nop                      |
00174554: 32020006 andi r2,r16,0x0006       |
00174558: 10400008 beq r2,r0,0x0017457c     #If Unit has Frog or Chicken
0017455c: 34020006 ori r2,r0,0x0006         |Default Unit size is 0x6
00174560: 93a20011 lbu r2,0x0011(r29)           |Load 2nd set of Movement
00174564: 93a30012 lbu r3,0x0012(r29)           |Load 3rd set of Movement
00174568: 304200f3 andi r2,r2,0x00f3            |Remove Teleport and Teleport 2
0017456c: 306300fb andi r3,r3,0x00fb            |Remove Fly
00174570: a3a20011 sb r2,0x0011(r29)            |Set Teleport and Teleport2 flags  OFF (on stack)
00174574: 34020004 ori r2,r0,0x0004             |Frog and Chicken Size is 0x4
00174578: a3a30012 sb r3,0x0012(r29)            |Set Fly flag OFF (on Stack)
0017457c: a262001b sb r2,0x001b(r19)        |Store Unit size in Scratch Pad
00174580: 93a20012 lbu r2,0x0012(r29)       |Load 3rd set of Movement
00174584: 00000000 nop                      |
00174588: 30420088 andi r2,r2,0x0088        |Check [Float]and [Walk on water]
0017458c: 14400007 bne r2,r0,0x001745ac     #If Unit will not be above water
00174590: 00000000 nop                          |
00174594: 93a20011 lbu r2,0x0011(r29)           |Load 2nd set of Movement
00174598: 00000000 nop                          |
0017459c: 30420010 andi r2,r2,0x0010            |Check [Can not enter water]
001745a0: 10400002 beq r2,r0,0x001745ac         #If Unit cannot enter water
001745a4: 34020001 ori r2,r0,0x0001                 |
001745a8: a2620014 sb r2,0x0014(r19)                |store cannot Stay on water flag
001745ac: 93a30012 lbu r3,0x0012(r29)       |Load 3rd set of Movement
001745b0: 00000000 nop                      |
001745b4: 30620008 andi r2,r3,0x0008        |Check [Float]
001745b8: 1040000a beq r2,r0,0x001745e4     #If Unit uses Float
001745bc: 00000000 nop                          |
001745c0: 9262001b lbu r2,0x001b(r19)           |Load Unit Size
001745c4: 00000000 nop                          |
001745c8: 24420002 addiu r2,r2,0x0002           |
001745cc: a262001b sb r2,0x001b(r19)            |Size + 2 if Floating
001745d0: 93a20012 lbu r2,0x0012(r29)           |Load 3rd set of Movement
001745d4: 00000000 nop                          |
001745d8: 34420080 ori r2,r2,0x0080             |Enable [Move on Water]
001745dc: 0805d17a j 0x001745e8                 >>Avoid Not Floating section
001745e0: a262001c sb r2,0x001c(r19)            |Store 3rd Set of active movement + Move on Water in scratchpad
                                            Else : No Float
001745e4: a263001c sb r3,0x001c(r19)            |Store 3rd Set of active movement  in scratchpad
001745e8: 32020040 andi r2,r16,0x0040       |Check [Float] in current status
001745ec: 10400005 beq r2,r0,0x00174604     #If Unit has Float
001745f0: 00000000 nop                          |
001745f4: 93a20012 lbu r2,0x0012(r29)           |Load 3rd set of Movement
001745f8: 00000000 nop                          |
001745fc: 34420008 ori r2,r2,0x0008             |Enable [Float] in movement
00174600: a3a20012 sb r2,0x0012(r29)            |If float status, you get the float ability for free. (on stack)
00174604: 93a20011 lbu r2,0x0011(r29)       |Load 2nd set of Movement
00174608: 00000000 nop                      |
0017460c: 30420010 andi r2,r2,0x0010        |check [Can not Enter Water]
00174610: 10400005 beq r2,r0,0x00174628     #If Unit can't enter Water
00174614: 00000000 nop                          |
00174618: 93a20012 lbu r2,0x0012(r29)           |Load 3rd set of Movement
0017461c: 00000000 nop                          |
00174620: 304200af andi r2,r2,0x00af            |everything except move underwater, move in water
00174624: a3a20012 sb r2,0x0012(r29)            |Disable [Move underwater] and [Move in water]
00174628: 0c05d0dc jal 0x00174370           |-->00174370-001743c4   returns weather severity (1, 2, or 3)
0017462c: 00000000 nop                      |
00174630: 93a30012 lbu r3,0x0012(r29)       |Load 3rd set of Movement
00174634: 00403021 addu r6,r2,r0            |r6 = difficulty to move through weather affected tiles
00174638: 30620004 andi r2,r3,0x0004        |check [Fly]
0017463c: 10400005 beq r2,r0,0x00174654     #If the Unit uses Fly
00174640: 34020001 ori r2,r0,0x0001             |
00174644: a262000f sb r2,0x000f(r19)            |Store Unhindered movement in scratchpad
00174648: a260000e sb r0,0x000e(r19)            |Store Move Type is Fly (0)
0017464c: 0805d1c0 j 0x00174700                 >>Jump After Check move type section
00174650: a262001d sb r2,0x001d(r19)            |Fly/Teleport Flag
                                            Else : Unit is not Flying
00174654: 93a20011 lbu r2,0x0011(r29)           |Load 2nd set of Movement
00174658: 00000000 nop                          |
0017465c: 3042000c andi r2,r2,0x000c            |Check Teleport and Teleport2
00174660: 10400007 beq r2,r0,0x00174680         #If Unit uses Teleport
00174664: 34020001 ori r2,r0,0x0001                 |
00174668: a262000f sb r2,0x000f(r19)                |Store unhindered movement in scratchpad
0017466c: 93a30011 lbu r3,0x0011(r29)               |Load 2nd set of Movement
00174670: a262000e sb r2,0x000e(r19)                |Store Move Type is Teleport (1)
00174674: a262001d sb r2,0x001d(r19)                |Fly/Teleport Flag
00174678: 0805d1c0 j 0x00174700                     >>Jump After Check move type section
0017467c: a2630024 sb r3,0x0024(r19)                |Store 2nd set of movement
                                                Else : No Teleport
00174680: 30620008 andi r2,r3,0x0008                |Check [Float]
00174684: 10400003 beq r2,r0,0x00174694             #If Unit uses Float
00174688: 34020002 ori r2,r0,0x0002                     |
0017468c: 0805d1bf j 0x001746fc                         >>Jump to Store move type (0x2)
00174690: a262000f sb r2,0x000f(r19)                    |Float in Move Mod
                                                    Else : No Float
00174694: 30620020 andi r2,r3,0x0020                    |Check [Move on Lava]
00174698: 10400004 beq r2,r0,0x001746ac                 #If Unit uses Move on Lava
0017469c: 34020005 ori r2,r0,0x0005                         |
001746a0: a262000f sb r2,0x000f(r19)                        |Move on Lava in Move mod
001746a4: 0805d1bf j 0x001746fc                             >>Jump to Store move type (0x3)
001746a8: 34020003 ori r2,r0,0x0003                         |
                                                        Else : not moving on lava
001746ac: 30620080 andi r2,r3,0x0080                        |
001746b0: 10400004 beq r2,r0,0x001746c4                     #If Unit uses Walk on Water
001746b4: 34020003 ori r2,r0,0x0003                             |
001746b8: a262000f sb r2,0x000f(r19)                            |Walk on Water in move mod
001746bc: 0805d1bf j 0x001746fc                                 >>Jump to Store move type (0x4)
001746c0: 34020004 ori r2,r0,0x0004                             |

001746c4: 30620040 andi r2,r3,0x0040                            |
001746c8: 10400004 beq r2,r0,0x001746dc                         #If Unit moves in water
001746cc: 34020003 ori r2,r0,0x0003                                 |
001746d0: a262000f sb r2,0x000f(r19)                                |Move in water in Move mod
001746d4: 0805d1bf j 0x001746fc                                     >>Jump to Store move type (0x5)
001746d8: 34020005 ori r2,r0,0x0005                                 |

001746dc: 30620010 andi r2,r3,0x0010                                |
001746e0: 10400004 beq r2,r0,0x001746f4                             #If Unit Move under water
001746e4: 34020004 ori r2,r0,0x0004                                     |
001746e8: a262000f sb r2,0x000f(r19)                                    |Move underWater in move mod
001746ec: 0805d1bf j 0x001746fc                                         >>Jump to Store move type (0x6)
001746f0: 34020006 ori r2,r0,0x0006                                     |I just wanna know why these are counting up

001746f4: 34020007 ori r2,r0,0x0007                                     |r2 = 0x07
001746f8: a260000f sb r0,0x000f(r19)                                    |No Move mod
001746fc: a262000e sb r2,0x000e(r19)                |Store move Type
00174700: 9262001c lbu r2,0x001c(r19)       |Load 3rd Set of movement (scratchpad)
00174704: 00000000 nop                      |
00174708: 304200c0 andi r2,r2,0x00c0        |Check [Walk on Water] and [Move in water]
0017470c: 10400002 beq r2,r0,0x00174718     #If Acting unit uses [Walk on Water] or [Move in water]  Walk on water is ON if unit is Floating
00174710: 00000000 nop                          |
00174714: a2600013 sb r0,0x0013(r19)            |Nullify Will Sink flag
00174718: 9262001c lbu r2,0x001c(r19)       |Load 3rd Set of movement (scratchpad)
0017471c: 00000000 nop                      |
00174720: 304200d0 andi r2,r2,0x00d0        |Check [Walk on Water] [Move in water] and [Move underwater]
00174724: 10400002 beq r2,r0,0x00174730     #If Acting unit uses [Walk on Water]  [Move in water] or [Move underwater]
00174728: 00000000 nop                          |
0017472c: a2600012 sb r0,0x0012(r19)            |Nullify Will drawn flag
00174730: 93a20012 lbu r2,0x0012(r29)       |Load 3rd set of Movement (stack)
00174734: 00000000 nop                      |
00174738: 3042008c andi r2,r2,0x008c        |Walk on water, Float, Fly
0017473c: 14400007 bne r2,r0,0x0017475c     #If Unit don't uses [Walk on water] [Float] nor [Fly]
00174740: 00000000 nop                          |
00174744: 93a20011 lbu r2,0x0011(r29)           |Load 2nd set of Movement
00174748: 00000000 nop                          |
0017474c: 30420010 andi r2,r2,0x0010            |
00174750: 10400002 beq r2,r0,0x0017475c         #If Unit can't enter Water
00174754: 34020001 ori r2,r0,0x0001                 |
00174758: a2620011 sb r2,0x0011(r19)                |Enable Cannot enter  Water flag
0017475c: 93a20012 lbu r2,0x0012(r29)       |Load 3rd set of Movement (stack)
00174760: 00000000 nop                      |
00174764: a2620010 sb r2,0x0010(r19)        |Store 3rd set of movement
00174768: 93a30011 lbu r3,0x0011(r29)       |Load 2nd set of Movement (stack)
0017476c: 00000000 nop                      |
00174770: 30620002 andi r2,r3,0x0002        |
00174774: 10400002 beq r2,r0,0x00174780     #If Unit uses [Any Weather]
00174778: 30650001 andi r5,r3,0x0001        |r5 = any ground check (used in next loop)
0017477c: 34060001 ori r6,r0,0x0001             |if any weather, set cost to move through watery terrain = 1, even if heavy or extreme weather.
00174780: 00009021 addu r18,r0,r0           |Initialize loop counter
00174784: 340700ff ori r7,r0,0x00ff         |
00174788: 9262000f lbu r2,0x000f(r19)       |Load Move mod flag
0017478c: 3c038006 lui r3,0x8006            |
00174790: 2463ea50 addiu r3,r3,-0x15b0      |Default movement cost table pointer Movement modifiers Table at 8005ea50
00174794: 00021180 sll r2,r2,0x06           |movement ignorance type * 0x40
00174798: 00432021 addu r4,r2,r3            |This Unit Movement Cost Table
                                            @LOOP - All entries of Movement cost Table
0017479c: 90830000 lbu r3,0x0000(r4)            |Load this iteration movement cost
001747a0: 00000000 nop                          |
001747a4: 306200ff andi r2,r3,0x00ff            |
001747a8: 14400003 bne r2,r0,0x001747b8         #If Movement cost = 0x00
001747ac: 00000000 nop                              |
001747b0: 0805d1f3 j 0x001747cc                     >>Jump to next iteration Returns weather impact
001747b4: 00c01821 addu r3,r6,r0                    |Weather Impact
                                                Else movement cost <> 0x00
001747b8: 10a00004 beq r5,r0,0x001747cc             #If Unit uses [Any Ground] /  Else  Returns Movement cost
001747bc: 00000000 nop                                  |
001747c0: 10470002 beq r2,r7,0x001747cc                 #If Movement cost <> 0xff / Else  returns Movement cost
001747c4: 00000000 nop                                      |
001747c8: 34030001 ori r3,r0,0x0001                         |if any ground, set terrain move cost to 1
001747cc: 3c028019 lui r2,0x8019                |
001747d0: 8c42f4ec lw r2,-0x0b14(r2)            |Pointer to scratch pad at 0x1f800100 - refered as S-Pad 0x100  from 8018f4ec
001747d4: 00000000 nop                          |
001747d8: 00521021 addu r2,r2,r18               |S-Pad 0x100 + Iteration offset
001747dc: 26520001 addiu r18,r18,0x0001         |Counter + 1
001747e0: a0430000 sb r3,0x0000(r2)             |Store Movement cost in scratch 0x100
001747e4: 2a420040 slti r2,r18,0x0040           |
001747e8: 1440ffec bne r2,r0,0x0017479c     Λ Loop 0x40 Times
001747ec: 24840001 addiu r4,r4,0x0001           |Movement cost table offset
001747f0: 9230003b lbu r16,0x003b(r17)      |Load units jump
001747f4: 00000000 nop                      |
001747f8: 2e020008 sltiu r2,r16,0x0008      |
001747fc: 14400003 bne r2,r0,0x0017480c     #If Unit Jump > 7
00174800: 320200ff andi r2,r16,0x00ff           |
00174804: 34100007 ori r16,r0,0x0007            |Cap Jump at 0x7
00174808: 320200ff andi r2,r16,0x00ff           |
0017480c: 9263000e lbu r3,0x000e(r19)       |Load Move Type
00174810: 00021042 srl r2,r2,0x01           |jump / 2
00174814: 10600006 beq r3,r0,0x00174830     #If Move Type  <> 0x00 (not flying)
00174818: a2620005 sb r2,0x0005(r19)        |Store jump/2 (S-Pad 0x00)
0017481c: 93a20010 lbu r2,0x0010(r29)           |Load 1st set of Movement (stack)
00174820: 00000000 nop                          |
00174824: 30420002 andi r2,r2,0x0002            |Ignore Height check
00174828: 10400003 beq r2,r0,0x00174838         #If Unit uses [Ignore Height]
0017482c: 02202021 addu r4,r17,r0                   |
                                                    Fly or Ignore height
00174830: 3410001f ori r16,r0,0x001f        #E      |Forces unit height to 31 (Fly or ignore height)
00174834: 02202021 addu r4,r17,r0           |Acting Unit pointer to battle data (for Jal)
00174838: 320200ff andi r2,r16,0x00ff       |
0017483c: 00021040 sll r2,r2,0x01           |
00174840: a2620002 sb r2,0x0002(r19)        |Store Jump*2 in S-Pad 0x00
00174844: 0c05d0f2 jal 0x001743c8           |-->Chocobo_Check returns r2 (Unmountable / montable / Already ridden)
00174848: a2700004 sb r16,0x0004(r19)       |Store Jump in S-Pad 0x00
0017484c: 10400003 beq r2,r0,0x0017485c     #If Unit is a mountable Chocobo (ridden or not)
00174850: 34020001 ori r2,r0,0x0001             |
00174854: 0805d218 j 0x00174860                 >>Avoid not chocobo
00174858: a2620015 sb r2,0x0015(r19)            |Chocobo flag (S-Pad 0x00)
                                            Else : not a chocobo (or not mountable by statuses)
0017485c: a2600015 sb r0,0x0015(r19)            |No chocobo flag
00174860: 9230003a lbu r16,0x003a(r17)      |Load Unit move
00174864: 00000000 nop                      |
00174868: 2e02007d sltiu r2,r16,0x007d      |
0017486c: 14400002 bne r2,r0,0x00174878     #If Move > 0x7c
00174870: 00000000 nop                          |
00174874: 3410007c ori r16,r0,0x007c            |Cap move at 0x7c
00174878: a2700006 sb r16,0x0006(r19)       |Store unit move in S-Pad 0x00
0017487c: 92220006 lbu r2,0x0006(r17)       |Load Unit Gender
00174880: 00000000 nop                      |
00174884: 304200c0 andi r2,r2,0x00c0        |
00174888: 1040000d beq r2,r0,0x001748c0     #If Unit is not a monster
0017488c: 00000000 nop                          |
00174890: 9222005a lbu r2,0x005a(r17)           |Load Unit Current Status 3
00174894: 00000000 nop                          |
00174898: 30420006 andi r2,r2,0x0006            |
0017489c: 14400008 bne r2,r0,0x001748c0         #If Unit is not a Frog nor a Chicken
001748a0: 00000000 nop                              |
001748a4: 9222005c lbu r2,0x005c(r17)               |Load Unit Current Status 5
001748a8: 00000000 nop                              |
001748ac: 30420020 andi r2,r2,0x0020                |
001748b0: 14400003 bne r2,r0,0x001748c0             #If unit is not Charmed
001748b4: 34020001 ori r2,r0,0x0001                     |
001748b8: 0805d231 j 0x001748c4                         >>Avoid Normal section
001748bc: a2620016 sb r2,0x0016(r19)                    |Enable Can Ride Flag
                                            Else : Monster or Forg/Chicken/Charm
001748c0: a2600016 sb r0,0x0016(r19)            |Disable Can Ride flag
001748c4: 340400ff ori r4,r0,0x00ff         |
001748c8: 3412000f ori r18,r0,0x000f        |Initialize Counter
001748cc: 923101ba lbu r17,0x01ba(r17)      |Load Unit modified ENTD
001748d0: 3c028019 lui r2,0x8019            |
001748d4: 9042f4fc lbu r2,-0x0b04(r2)       |Load ?? 8018f4fc
001748d8: 26830069 addiu r3,r20,0x0069      |Scratch Pad 3 0x69
001748dc: a3b10020 sb r17,0x0020(r29)       |Store modified ENTD
001748e0: a262001a sb r2,0x001a(r19)        |Store [8018f4fc] on scratch pad
                                            @LOOP - Set all Units 0x03 Entry to 0xff
001748e4: a0640003 sb r4,0x0003(r3)             |Store 0xff on scratch pad
001748e8: 2652ffff addiu r18,r18,-0x0001        |Counter - 1
001748ec: 0641fffd bgez r18,0x001748e4      Λ Loop 16 times
001748f0: 2463fff9 addiu r3,r3,0xfff9           |Scratch Pad offet - 0x07
001748f4: 0000b821 addu r23,r0,r0           |Initialize Stored data counter
001748f8: 00009021 addu r18,r0,r0           |Loop counter (Used as Unit offset of battle data)
001748fc: 0000b021 addu r22,r0,r0           |Unit Offset (+0x1c0 each iteration)
                                            @LOOP - Other units data (0x15 times, but room for only 0x10 units)
00174900: 2ae20010 slti r2,r23,0x0010           |Check Size of Stored data
00174904: 10400094 beq r2,r0,0x00174b58         #If this loop has stored more than 0x10 Units :  Exit routine
00174908: 00000000 nop                              |
0017490c: 3c028019 lui r2,0x8019                    |
00174910: 244208cc addiu r2,r2,0x08cc               |
00174914: 02c28821 addu r17,r22,r2              |This iteration Unit Battle data pointer
00174918: 92230001 lbu r3,0x0001(r17)           |Load Unit Battle ID
0017491c: 340200ff ori r2,r0,0x00ff             |
00174920: 10620089 beq r3,r2,0x00174b48         #If Unit do not Exist : branch to   Next Unit iteration
00174924: 00000000 nop                              |
00174928: 92220058 lbu r2,0x0058(r17)           |Load This Unit current status 1
0017492c: 00000000 nop                          |
00174930: 30420064 andi r2,r2,0x0064            |
00174934: 14400084 bne r2,r0,0x00174b48         #If Unit is Dead or Crystal : branch to  Next Unit iteration
00174938: 00000000 nop                              |
0017493c: 92220059 lbu r2,0x0059(r17)           |Load This Unit current status 2
00174940: 00000000 nop                          |
00174944: 30420001 andi r2,r2,0x0001            |
00174948: 1440007f bne r2,r0,0x00174b48         #If Unit is a Treasure : branch to  Next Unit iteration
0017494c: 00000000 nop                              |
00174950: 125e007d beq r18,r30,0x00174b48       #If This Unit is the active Unit : branch to  Next Unit iteration
00174954: 00000000 nop                              |
00174958: 92240182 lbu r4,0x0182(r17)           |Load This unit Mount info
0017495c: 00000000 nop                          |
00174960: 30820080 andi r2,r4,0x0080            |
00174964: 1040000a beq r2,r0,0x00174990         #If This Unit is Riding
00174968: 3082001f andi r2,r4,0x001f                |Ridden Unit ID
0017496c: 9263000d lbu r3,0x000d(r19)               |Load Active Unit ID (Parameter of the routine)
00174970: 00000000 nop                              |
00174974: 14430007 bne r2,r3,0x00174994             #If This Unit is the rider of Active unit
00174978: 02408021 addu r16,r18,r0                      |
0017497c: 9262001b lbu r2,0x001b(r19)                   |Load Scratch pad 0x1b (Chicken Frog Float)
00174980: 00000000 nop                                  |
00174984: 24420002 addiu r2,r2,0x0002                   |Active Unit Height + 2
00174988: 0805d2d2 j 0x00174b48                         >>Jump to   Next Unit iteration
0017498c: a262001b sb r2,0x001b(r19)                    |Store Updated Height
00174990: 02408021 addu r16,r18,r0              |Add Unit ID (will be stored)
00174994: 0c05d0f2 jal 0x001743c8               |-->Chocobo Check Check This unit mount status
00174998: 02202021 addu r4,r17,r0               |This iteration Unit Data pointer (for Jal)
0017499c: 34030001 ori r3,r0,0x0001             |
001749a0: 10430007 beq r2,r3,0x001749c0         #If This Unit is not mountable (or already ridden)
001749a4: 00000000 nop                              |
001749a8: 9262000d lbu r2,0x000d(r19)               |Load Active unit ID
001749ac: 92230182 lbu r3,0x0182(r17)               |Load this Unit mount info
001749b0: 34420040 ori r2,r2,0x0040                 |Unit ID + 0x40 (so it will match r3)
001749b4: 10620002 beq r3,r2,0x001749c0             #If This unit is not ridden by active Unit
001749b8: 00000000 nop                                  |
001749bc: 36500020 ori r16,r18,0x0020                   |Update with not Mountable flag
001749c0: 92230005 lbu r3,0x0005(r17)           |Load This Unit Team
001749c4: 93a80020 lbu r8,0x0020(r29)           |Load active unit modified ENTD
001749c8: 00000000 nop                          |
001749cc: 01031026 xor r2,r8,r3                 |Keep Only the difference
001749d0: 30420030 andi r2,r2,0x0030            |Focus on team difference
001749d4: 10400002 beq r2,r0,0x001749e0         #If This unit is an enemy of Active Unit
001749d8: 0280a821 addu r21,r20,r0              |S-Pad 0x80
001749dc: 36100040 ori r16,r16,0x0040               |Add Enemy Flag
001749e0: a2900003 sb r16,0x0003(r20)           |Store r16 in S-Pad 0x80 (Unit ID/ 20 if Unmountable / 40 if enemy)
001749e4: 92220047 lbu r2,0x0047(r17)           |This unit X
001749e8: 92830002 lbu r3,0x0002(r20)           |Load this Unit 0x02 (dynamic scratch Pad)
001749ec: a2820000 sb r2,0x0000(r20)            |store X on S-Pad 0x80
001749f0: 92220048 lbu r2,0x0048(r17)           |This Unit Y
001749f4: 00000000 nop                          |
001749f8: a2820001 sb r2,0x0001(r20)            |store Y on S-Pad 0x80
001749fc: 96220048 lhu r2,0x0048(r17)           |Load Y + Elevation
00174a00: 30630080 andi r3,r3,0x0080            |
00174a04: 000213c2 srl r2,r2,0x0f               |1 if higher elevation
00174a08: 00621825 or r3,r3,r2                  |
00174a0c: a2830002 sb r3,0x0002(r20)            |Enable (or not) high elvation flag (S-Pad 0x80)
00174a10: 96220048 lhu r2,0x0048(r17)           |Load Y + Elevation
00174a14: 3063007f andi r3,r3,0x007f            |Disable 0x80
00174a18: 000211c2 srl r2,r2,0x07               |
00174a1c: 30420080 andi r2,r2,0x0080            |check [Stepping stone]
00174a20: 00621825 or r3,r3,r2                  |Enable 0x80 if stepping stone
00174a24: a2830002 sb r3,0x0002(r20)            |Store back 0x80 if stepping stone
00174a28: 9230005a lbu r16,0x005a(r17)          |This Unit Current Status 3
00174a2c: 00000000 nop                          |
00174a30: 32020006 andi r2,r16,0x0006           |
00174a34: 10400006 beq r2,r0,0x00174a50         #If Unit has Frog or Chicken
00174a38: 34020004 ori r2,r0,0x0004                 |
00174a3c: 92830002 lbu r3,0x0002(r20)               |
00174a40: a2820004 sb r2,0x0004(r20)                |Store 0x04 (height)
00174a44: 3063007f andi r3,r3,0x007f                |remove 80 flag
00174a48: 0805d296 j 0x00174a58                     >>Avoid Anti section
00174a4c: a2830002 sb r3,0x0002(r20)                |Disable stepping stone
                                                Else : if Unit hasn't Frog nor Chicken
00174a50: 34020006 ori r2,r0,0x0006                 |
00174a54: a2820004 sb r2,0x0004(r20)                |Store height = 0x06
00174a58: 92300182 lbu r16,0x0182(r17)          |Mount info byte
00174a5c: 00000000 nop                          |
00174a60: 32020040 andi r2,r16,0x0040           |
00174a64: 10400009 beq r2,r0,0x00174a8c         #If Unit is ridden
00174a68: 3202001f andi r2,r16,0x001f               |Rider ID
00174a6c: 9263000d lbu r3,0x000d(r19)               |Load Active Unit ID
00174a70: 00000000 nop                              |
00174a74: 10430005 beq r2,r3,0x00174a8c             #If This unit is not the active unit mount
00174a78: 00000000 nop                                  |
00174a7c: 92a20004 lbu r2,0x0004(r21)                   |Load Unit Size
00174a80: 00000000 nop                                  |
00174a84: 24420002 addiu r2,r2,0x0002                   |
00174a88: a2a20004 sb r2,0x0004(r21)                    |Size + 2 (rider height)
00174a8c: 92300095 lbu r16,0x0095(r17)          |This unit Movement 3
00174a90: 0c060428 jal 0x001810a0               |-->Map Location Calculation returns r2 = This unit Tile ID
00174a94: 02202021 addu r4,r17,r0               |This unit data pointer
00174a98: 000210c0 sll r2,r2,0x03               |Tile ID *8
00174a9c: 3c038019 lui r3,0x8019                |
00174aa0: 2463f8cc addiu r3,r3,0xf8cc           |
00174aa4: 00431021 addu r2,r2,r3                |This unit Tile's data pointer
00174aa8: 90440002 lbu r4,0x0002(r2)            |load height
00174aac: 90430003 lbu r3,0x0003(r2)            |load halves/depth
00174ab0: 90420003 lbu r2,0x0003(r2)            |load halves/depth
00174ab4: 00042040 sll r4,r4,0x01               |height*2
00174ab8: 3063001f andi r3,r3,0x001f            |r3 = height (halves)
00174abc: 00832021 addu r4,r4,r3                |height*2 + halves
00174ac0: 00022942 srl r5,r2,0x05               |Tile depth
00174ac4: 10a00014 beq r5,r0,0x00174b18         #If Depht <> 0x00
00174ac8: 00801821 addu r3,r4,r0                |r3 = Total Height (Height*2) + Halves
00174acc: 9222005a lbu r2,0x005a(r17)               |This unit Current Status 3
00174ad0: 00000000 nop                              |
00174ad4: 30420040 andi r2,r2,0x0040                |load float flag
00174ad8: 10400004 beq r2,r0,0x00174aec             #If this Unit has [Float]
00174adc: 00051040 sll r2,r5,0x01                       |depth*2
00174ae0: 24420002 addiu r2,r2,0x0002                   |depth*2+2
00174ae4: 0805d2cc j 0x00174b30                         >>Jump to next iteration
00174ae8: 00821821 addu r3,r4,r2                        |r3 = total height + depth*2 + 2
                                                    Else : This unit isn't Floating
00174aec: 32020080 andi r2,r16,0x0080                   |
00174af0: 10400003 beq r2,r0,0x00174b00                 #If Unit Walk on water
00174af4: 00051040 sll r2,r5,0x01                           |depht * 2
00174af8: 0805d2cc j 0x00174b30                             >>Jump to next iteration
00174afc: 00821821 addu r3,r4,r2                            |r3 = total height + depth*2 
                                                        Else : not walking on water
00174b00: 32020040 andi r2,r16,0x0040                       |
00174b04: 1040000a beq r2,r0,0x00174b30                     #If Unit Walk in water
00174b08: 00051040 sll r2,r5,0x01                               |depht * 2
00174b0c: 2442fffe addiu r2,r2,-0x0002                          |depht * 2 -2
00174b10: 0805d2cc j 0x00174b30                                 >>Jump to next iteration
00174b14: 00821821 addu r3,r4,r2                                |Total Height + depht*2 - 2
                                                Else : Depht  = 0x00
00174b18: 9222005a lbu r2,0x005a(r17)               |This unit Current Status 3
00174b1c: 00000000 nop                              |
00174b20: 30420040 andi r2,r2,0x0040                |
00174b24: 10400002 beq r2,r0,0x00174b30             #If This unit is Floating
00174b28: 00000000 nop                                  |
00174b2c: 24830002 addiu r3,r4,0x0002                   |Total height + 2
00174b30: 26940007 addiu r20,r20,0x0007         |Next Unit Offset in scratch pad
00174b34: 92a20004 lbu r2,0x0004(r21)           |Load Unit Height
00174b38: 26f70001 addiu r23,r23,0x0001         |Data stored counter
00174b3c: a2a30005 sb r3,0x0005(r21)            |Store Total Height on S-Pad 0x80
00174b40: 00621021 addu r2,r3,r2                |Unit Size + Map height
00174b44: a2a20006 sb r2,0x0006(r21)            |Store Size + Height 
00174b48: 26520001 addiu r18,r18,0x0001         |Unit Counter + 1
00174b4c: 2a420015 slti r2,r18,0x0015           |Check unit limit
00174b50: 1440ff6b bne r2,r0,0x00174900     Λ Loop 21 times (for each unit)
00174b54: 26d601c0 addiu r22,r22,0x01c0         |Offset for Battle data
00174b58: 8fbf004c lw r31,0x004c(r29)       END
00174b5c: 8fbe0048 lw r30,0x0048(r29)
00174b60: 8fb70044 lw r23,0x0044(r29)
00174b64: 8fb60040 lw r22,0x0040(r29)
00174b68: 8fb5003c lw r21,0x003c(r29)
00174b6c: 8fb40038 lw r20,0x0038(r29)
00174b70: 8fb30034 lw r19,0x0034(r29)
00174b74: 8fb20030 lw r18,0x0030(r29)
00174b78: 8fb1002c lw r17,0x002c(r29)
00174b7c: 8fb00028 lw r16,0x0028(r29)
00174b80: 27bd0050 addiu r29,r29,0x0050
00174b84: 03e00008 jr r31
00174b88: 00000000 nop

Return Location

BATTLE.BIN
00174be8: 00174b8c_-_00174df4
00176744: 001766b4_-_00176c0c
00178d44: Find_Tiles_for_the_AI_to_move_to_(00178ca4)