Difference between revisions of "Poison Marsh Routine"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
(Created page with " 0018da88: 27bdffe0 addiu r29,r29,0xffe0 0018da8c: afb10014 sw r17,0x0014(r29) 0018da90: 00808821 addu r17,r4,r0 0018da94: afbf 0018 sw r31,0x 0018(r29) 0018da98: afb00010...")
 
m
Line 1: Line 1:
  0018da88: 27bdffe0 addiu r29,r29,0xffe0
+
'''BATTLE.BIN''' :  - Poison Marsh Routine
  0018da8c: afb10014 sw r17,0x0014(r29)
+
------------------------------------------------------------------------------------------
  0018da90: 00808821 addu r17,r4,r0
+
Parameter : r4 = Pointer to unit battle data (801908cc)
  0018da94: afbf 0018 sw r31,0x 0018(r29)
+
Return : r2 = 0x01 if Poison will be inflicted
  0018da98: afb00010 sw r16,0x0010(r29)
+
          r2 = 0x00 if no status infliction
  0018da9c: 923 00182 lbu r16,0x0182(r17)    
+
------------------------------------------------------------------------------------------
  0018daa0: 0c063691 jal 0x 0018da44      Check for Crystal, Dead, Jump, Petrify, or Treasure
+
  0018da88: 27bdffe0 addiu r29,r29,-0x0020    |
  0018daa4: 00000000 nop
+
  0018da8c: afb10014 sw r17,0x0014(r29)       |
  0018daa8: 1440003b bne r2,r0,0x 0018db98     Branch if unit is afflicted with the above Status
+
  0018da90: 00808821 addu r17,r4,r0           |{{f/adr|Preserve Unit data pointer}}
  0018daac: 00001021 addu r2,r0,r0     r2 = 0x00
+
  0018da94: afbf0018 sw r31,0x0018(r29)       |
  0018dab0: 32020040 andi r2,r16,0x0040    
+
  0018da98: afb00010 sw r16,0x0010(r29)       |
  0018dab4: 14400038 bne r2,r0,0x 0018db98     Branch if being ridden.
+
  0018da9c: 92300182 lbu r16,0x0182(r17)       |{{f/load|Mount Info}}
  0018dab8: 00001021 addu r2,r0,r0     r2 = 0x00
+
  0018daa0: 0c063691 jal 0x0018da44            |{{f/jal|Check for Crystal, Dead, Jump, Petrify, or Treasure|Check for Crystal, Dead, Jump, Petrify, or Treasure}}
  0018dabc: 32020080 andi r2,r16,0x0080    
+
  0018daa4: 00000000 nop                       |
  0018dac0: 1040000d beq r2,r0,0x 0018daf8     Branch if user is riding another unit
+
  0018daa8: 1440003b bne r2,r0,0x0018db98     {{f/Cond|If unit is afflicted with the above Status : branch to}} {{f/loc|END}} {{f/std|return 0x00}}
  0018dac4: 3202001f andi r2,r16,0x001f    
+
  0018daac: 00001021 addu r2,r0,r0             |
  0018dac8: 000218c0 sll r3,r2,0x03    
+
  0018dab0: 32020040 andi r2,r16,0x0040       |
  0018dacc: 00621823 subu r3,r3,r2    
+
  0018dab4: 14400038 bne r2,r0,0x0018db98     {{f/Cond|If unit is being ridden : branch to}} {{f/loc|END}} {{f/std|return 0x00}}
  0018dad0: 00031980 sll r3,r3,0x06    
+
  0018dab8: 00001021 addu r2,r0,r0             |
  0018dad4: 3c018019 lui r1,0x8019    
+
  0018dabc: 32020080 andi r2,r16,0x0080       |
  0018dad8: 00230821 addu r1,r1,r3     Load Unit data?
+
  0018dac0: 1040000d beq r2,r0,0x0018daf8     {{f/Cond|If Unit is riding}}
  0018dadc: 90220926 lbu r2,0x0926(r1)     ?_?
+
  0018dac4: 3202001f andi r2,r16,0x001f           |{{f/std|Mount ID}}
  0018dae0: 00000000 nop        
+
  0018dac8: 000218c0 sll r3,r2,0x03               |
  0018dae4: 30420040 andi r2,r2,0x0040    
+
  0018dacc: 00621823 subu r3,r3,r2                 |
  0018dae8: 10400006 beq r2,r0,0x 0018db04      Branch if bit x40 or float is active
+
  0018dad0: 00031980 sll r3,r3,0x06               |{{f/std|Mount ID * 0x1c0}}
  0018daec: 2624018c addiu r4,r17,0x018c    
+
  0018dad4: 3c018019 lui r1,0x8019                 |
  0018daf0: 080636e6 j 0x 0018db98       
+
  0018dad8: 00230821 addu r1,r1,r3                 |{{f/adr|Mout  data pointer}}
  0018daf4: 00001021 addu r2,r0,r0     r2 = 0
+
  0018dadc: 90220926 lbu r2,0x0926(r1)             |{{f/load|Typo ? 0x95 (movement float ?)}}
  0018daf8: 9222005a lbu r2,0x005a(r17)     Load Current Statuses 3
+
  0018dae0: 00000000 nop                           |
  0018dafc: 080636ba j 0x 0018dae8       
+
  0018dae4: 30420040 andi r2,r2,0x0040             |
  0018db00: 30420040 andi r2,r2,0x0040    
+
  0018dae8: 10400006 beq r2,r0,0x0018db04          {{f/Cond|Branch if bit x40 or float is active}}
  0018db04: 9222018a lbu r2,0x018a(r17)    
+
  0018daec: 2624018c addiu r4,r17,0x018c           |{{f/adr|Unit current action data pointer}}
  0018db08: 3c018019 lui r1,0x8019    
+
  0018daf0: 080636e6 j 0x0018db98                      {{f/jump|Exit routine : returns 0x00}}
  0018db0c: ac312d98 sw r17,0x2d98(r1)     Store Defender's Data
+
  0018daf4: 00001021 addu r2,r0,r0                     |{{f/std|<nowiki>r2 = 0</nowiki>}}
  0018db10: 3c018019 lui r1,0x8019    
+
                                            '''ELSE : Unit is not riding'''
  0018db14: ac242d90 sw r4,0x2d90(r1)     Store Defender's Current Action Data
+
  0018daf8: 9222005a lbu r2,0x005a(r17)           |{{f/load|Load Current Statuses 3}}
  0018db18: 3c018019 lui r1,0x8019
+
  0018dafc: 080636ba j 0x0018dae8                  {{f/jump|Jump back and check Float status}}
  0018db1c: a02238c1 sb r2,0x38c1(r1)     Store Target Unit ID
+
  0018db00: 30420040 andi r2,r2,0x0040             |{{f/std|Float ?}}
  0018db20: 0c062f5d jal 0x 0018bd74      Sub-routine (there's a routine to load all this...)
+
  0018db04: 9222018a lbu r2,0x018a(r17)       |{{f/load|Unit ID}}
  0018db24: 00000000 nop          
+
  0018db08: 3c018019 lui r1,0x8019             |
  0018db28: 0c060428 jal 0x 001810a0      Map Location Calculation
+
  0018db0c: ac312d98 sw r17,0x2d98(r1)         |{{f/store|Store Defender's Data Pointer}}
  0018db2c: 02202021 addu r4,r17,r0     r4 = Unit Data
+
  0018db10: 3c018019 lui r1,0x8019             |
  0018db30: 000210c0 sll r2,r2,0x03    
+
  0018db14: ac242d90 sw r4,0x2d90(r1)         |{{f/store|Store Defender's Current Action Data Pointer}}
  0018db34: 3c018019 lui r1,0x8019    
+
  0018db18: 3c018019 lui r1,0x8019             |
  0018db38: 00220821 addu r1,r1,r2    
+
  0018db1c: a02238c1 sb r2,0x38c1(r1)         |{{f/store|Store Target Unit ID}}
  0018db3c: 9022f8cc lbu r2,-0x0734(r1)     Load some RAM data
+
  0018db20: 0c062f5d jal 0x0018bd74            |{{f/jal|Current_Action_Data_Nulling|Current_Action_Data_Nulling}}
  0018db40: 00000000 nop          
+
  0018db24: 00000000 nop                       |
  0018db44: 3042003f andi r2,r2,0x003f    
+
  0018db28: 0c060428 jal 0x001810a0            |{{f/jal|Map Location Calculation|Map Location Calculation}} {{f/std|returns Unit's Tile ID}}
  0018db48: 3c018006 lui r1,0x8006    
+
  0018db2c: 02202021 addu r4,r17,r0           |{{f/std|Send Unit data pointer}}
  0018db4c: 00220821 addu r1,r1,r2    
+
  0018db30: 000210c0 sll r2,r2,0x03           |{{f/std|Tile ID*8}}
  0018db50: 9022ea10 lbu r2,-0x15f0(r1)     Load Terrain Status Infliction
+
  0018db34: 3c018019 lui r1,0x8019             |
  0018db54: 00000000 nop          
+
  0018db38: 00220821 addu r1,r1,r2             |
  0018db58: 30420080 andi r2,r2,0x0080    
+
  0018db3c: 9022f8cc lbu r2,-0x0734(r1)       |{{f/adr|Unit's Tile data pointer}}
  0018db5c: 1040000d beq r2,r0,0x 0018db94     Branch if Status is Poison
+
  0018db40: 00000000 nop                       |
  0018db60: 00002021 addu r4,r0,r0     r4 = 0
+
  0018db44: 3042003f andi r2,r2,0x003f         |{{f/std|Keep Tile's type}}
  0018db64: 3c038019 lui r3,0x8019    
+
  0018db48: 3c018006 lui r1,0x8006             |
  0018db68: 8c632d90 lw r3,0x2d90(r3)     Load Current Action Data Pointer
+
  0018db4c: 00220821 addu r1,r1,r2             |
  0018db6c: 34020080 ori r2,r0,0x0080    
+
  0018db50: 9022ea10 lbu r2,-0x15f0(r1)       |{{f/load|Load Terrain Status Infliction}} {{f/std| 8005ea10 + Terrain type}}
  0018db70: 0c0612c9 jal 0x 00184b24     
+
  0018db54: 00000000 nop                       |
  0018db74: a062001e sb r2,0x001e(r3)     Store Status Infliction as Poison
+
  0018db58: 30420080 andi r2,r2,0x0080         |
  0018db78: 10400006 beq r2,r0,0x 0018db94     
+
  0018db5c: 1040000d beq r2,r0,0x0018db94     {{f/Cond|If Terrain inflict poison}}
  0018db7c: 34020001 ori r2,r0,0x0001    
+
  0018db60: 00002021 addu r4,r0,r0                 |{{f/std|Send 0x00 in below routine}}
  0018db80: 3c048019 lui r4,0x8019    
+
  0018db64: 3c038019 lui r3,0x8019                 |
  0018db84: 8c842d90 lw r4,0x2d90(r4)    
+
  0018db68: 8c632d90 lw r3,0x2d90(r3)             |{{f/adr|Load Current Action Data Pointer}}
  0018db88: 34030008 ori r3,r0,0x0008    
+
  0018db6c: 34020080 ori r2,r0,0x0080             |
  0018db8c: 080636e6 j 0x 0018db98       
+
  0018db70: 0c0612c9 jal 0x00184b24                |{{f/jal|Validate_Status_Changes|Validate_Status_Changes}} {{f/std|returns 0x00 if poison cannot be inflicted}}
  0018db90: a0830025 sb r3,0x0025(r4)    
+
  0018db74: a062001e sb r2,0x001e(r3)             |{{f/store|Store Status Infliction as Poison}}
  0018db94: 00001021 addu r2,r0,r0    
+
  0018db78: 10400006 beq r2,r0,0x0018db94          {{f/Cond|If Poison will be inflicted}}
  0018db98: 8fbf 0018 lw r31,0x 0018(r29)    
+
  0018db7c: 34020001 ori r2,r0,0x0001                 |{{f/std|returns 0x01}}
  0018db9c: 8fb10014 lw r17,0x0014(r29)    
+
  0018db80: 3c048019 lui r4,0x8019                     |
  0018dba0: 8fb00010 lw r16,0x0010(r29)    
+
  0018db84: 8c842d90 lw r4,0x2d90(r4)                 |{{f/adr|Target Current action data pointer}}
  0018dba4: 27bd0020 addiu r29,r29,0x0020    
+
  0018db88: 34030008 ori r3,r0,0x0008                 |
  0018dba8: 03e00008 jr r31        
+
  0018db8c: 080636e6 j 0x0018db98                      {{f/jump|Exit and returns 0x01}}
 +
  0018db90: a0830025 sb r3,0x0025(r4)                 |{{f/store|Store status change as attack type}}
 +
  0018db94: 00001021 addu r2,r0,r0             |{{f/std|Returns 0x00}}
 +
  0018db98: 8fbf0018 lw r31,0x0018(r29)
 +
  0018db9c: 8fb10014 lw r17,0x0014(r29)
 +
  0018dba0: 8fb00010 lw r16,0x0010(r29)
 +
  0018dba4: 27bd0020 addiu r29,r29,0x0020
 +
  0018dba8: 03e00008 jr r31
 
  0018dbac: 00000000 nop
 
  0018dbac: 00000000 nop
 +
===Return locations===
 +
'''BATTLE.BIN'''
 +
  00182ee0: [[In_between_turn_control_routine]]

Revision as of 13:25, 15 March 2024

BATTLE.BIN :  - Poison Marsh Routine
------------------------------------------------------------------------------------------
Parameter : r4 = Pointer to unit battle data (801908cc)
Return : r2 = 0x01 if Poison will be inflicted
         r2 = 0x00 if no status infliction
------------------------------------------------------------------------------------------
0018da88: 27bdffe0 addiu r29,r29,-0x0020     |
0018da8c: afb10014 sw r17,0x0014(r29)        |
0018da90: 00808821 addu r17,r4,r0            |Preserve Unit data pointer
0018da94: afbf0018 sw r31,0x0018(r29)        |
0018da98: afb00010 sw r16,0x0010(r29)        |
0018da9c: 92300182 lbu r16,0x0182(r17)       |Mount Info
0018daa0: 0c063691 jal 0x0018da44            |-->Check for Crystal, Dead, Jump, Petrify, or Treasure
0018daa4: 00000000 nop                       |
0018daa8: 1440003b bne r2,r0,0x0018db98      #If unit is afflicted with the above Status : branch to END return 0x00
0018daac: 00001021 addu r2,r0,r0             |
0018dab0: 32020040 andi r2,r16,0x0040        |
0018dab4: 14400038 bne r2,r0,0x0018db98      #If unit is being ridden : branch to END return 0x00
0018dab8: 00001021 addu r2,r0,r0             |
0018dabc: 32020080 andi r2,r16,0x0080        |
0018dac0: 1040000d beq r2,r0,0x0018daf8      #If Unit is riding
0018dac4: 3202001f andi r2,r16,0x001f            |Mount ID
0018dac8: 000218c0 sll r3,r2,0x03                |
0018dacc: 00621823 subu r3,r3,r2                 |
0018dad0: 00031980 sll r3,r3,0x06                |Mount ID * 0x1c0
0018dad4: 3c018019 lui r1,0x8019                 |
0018dad8: 00230821 addu r1,r1,r3                 |Mout  data pointer
0018dadc: 90220926 lbu r2,0x0926(r1)             |Typo ? 0x95 (movement float ?)
0018dae0: 00000000 nop                           |
0018dae4: 30420040 andi r2,r2,0x0040             |
0018dae8: 10400006 beq r2,r0,0x0018db04          #Branch if bit x40 or float is active
0018daec: 2624018c addiu r4,r17,0x018c           |Unit current action data pointer
0018daf0: 080636e6 j 0x0018db98                      >>Exit routine : returns 0x00
0018daf4: 00001021 addu r2,r0,r0                     |r2 = 0
                                            ELSE : Unit is not riding
0018daf8: 9222005a lbu r2,0x005a(r17)            |Load Current Statuses 3
0018dafc: 080636ba j 0x0018dae8                  >>Jump back and check Float status
0018db00: 30420040 andi r2,r2,0x0040             |Float ?
0018db04: 9222018a lbu r2,0x018a(r17)        |Unit ID
0018db08: 3c018019 lui r1,0x8019             |
0018db0c: ac312d98 sw r17,0x2d98(r1)         |Store Defender's Data Pointer
0018db10: 3c018019 lui r1,0x8019             |
0018db14: ac242d90 sw r4,0x2d90(r1)          |Store Defender's Current Action Data Pointer
0018db18: 3c018019 lui r1,0x8019             |
0018db1c: a02238c1 sb r2,0x38c1(r1)          |Store Target Unit ID
0018db20: 0c062f5d jal 0x0018bd74            |-->Current_Action_Data_Nulling
0018db24: 00000000 nop                       |
0018db28: 0c060428 jal 0x001810a0            |-->Map Location Calculation returns Unit's Tile ID
0018db2c: 02202021 addu r4,r17,r0            |Send Unit data pointer
0018db30: 000210c0 sll r2,r2,0x03            |Tile ID*8
0018db34: 3c018019 lui r1,0x8019             |
0018db38: 00220821 addu r1,r1,r2             |
0018db3c: 9022f8cc lbu r2,-0x0734(r1)        |Unit's Tile data pointer
0018db40: 00000000 nop                       |
0018db44: 3042003f andi r2,r2,0x003f         |Keep Tile's type
0018db48: 3c018006 lui r1,0x8006             |
0018db4c: 00220821 addu r1,r1,r2             |
0018db50: 9022ea10 lbu r2,-0x15f0(r1)        |Load Terrain Status Infliction  8005ea10 + Terrain type
0018db54: 00000000 nop                       |
0018db58: 30420080 andi r2,r2,0x0080         |
0018db5c: 1040000d beq r2,r0,0x0018db94      #If Terrain inflict poison
0018db60: 00002021 addu r4,r0,r0                 |Send 0x00 in below routine
0018db64: 3c038019 lui r3,0x8019                 |
0018db68: 8c632d90 lw r3,0x2d90(r3)              |Load Current Action Data Pointer
0018db6c: 34020080 ori r2,r0,0x0080              |
0018db70: 0c0612c9 jal 0x00184b24                |-->Validate_Status_Changes returns 0x00 if poison cannot be inflicted
0018db74: a062001e sb r2,0x001e(r3)              |Store Status Infliction as Poison
0018db78: 10400006 beq r2,r0,0x0018db94          #If Poison will be inflicted
0018db7c: 34020001 ori r2,r0,0x0001                  |returns 0x01
0018db80: 3c048019 lui r4,0x8019                     |
0018db84: 8c842d90 lw r4,0x2d90(r4)                  |Target Current action data pointer
0018db88: 34030008 ori r3,r0,0x0008                  |
0018db8c: 080636e6 j 0x0018db98                      >>Exit and returns 0x01
0018db90: a0830025 sb r3,0x0025(r4)                  |Store status change as attack type
0018db94: 00001021 addu r2,r0,r0             |Returns 0x00
0018db98: 8fbf0018 lw r31,0x0018(r29)
0018db9c: 8fb10014 lw r17,0x0014(r29)
0018dba0: 8fb00010 lw r16,0x0010(r29)
0018dba4: 27bd0020 addiu r29,r29,0x0020
0018dba8: 03e00008 jr r31
0018dbac: 00000000 nop

Return locations

BATTLE.BIN
 00182ee0: In_between_turn_control_routine