Difference between revisions of "Identify Cross Sections Routine (Clone)"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
(Created page with "<pre> Cross Section Identification 2 0017a64c: 00003021 addu r6,r0,r0 r6 = 0 0017a650: 00002821 addu r5,r0,r0 r5 = Loop Counter 0017a654: 3407003f ori r7,r0,0x003f ...")
 
 
Line 1: Line 1:
<pre>
+
'''BATTLE.BIN''' :  - Cross Section Identification 2
Cross Section Identification 2
+
------------------------------------------------------------------------------------------
 
+
Parameter : Nothing
0017a64c: 00003021 addu r6,r0,r0 r6 = 0
+
Return : r2 = Nb of Targeted Tiles (some tiles might be disabled here)
0017a650: 00002821 addu r5,r0,r0 r5 = Loop Counter
+
------------------------------------------------------------------------------------------
0017a654: 3407003f ori r7,r0,0x003f r7 = If Cross Section
+
0017a64c: 00003021 addu r6,r0,r0             |{{f/std|Intialize Valid Tile counter}}
0017a658: 3c038019 lui r3,0x8019
+
0017a650: 00002821 addu r5,r0,r0             |{{f/std|Initialize Tile Counter}}
0017a65c: 2463f8cc addiu r3,r3,-0x0734 r3 = Tile Data (18f8cc)
+
0017a654: 3407003f ori r7,r0,0x003f         |{{f/std|Cross Section Value}}
0017a660: 3c048019 lui r4,0x8019
+
0017a658: 3c038019 lui r3,0x8019             |
0017a664: 24842dd8 addiu r4,r4,0x2dd8 r4 = Tile Grid Data (192dd8)
+
0017a65c: 2463f8cc addiu r3,r3,-0x0734       |{{f/adr|Prepare dynamic pointer to Tile data : 0x8018f8cc}}
0017a668: 90820001 lbu r2,0x0001(r4) r2 = Load Tile Targeted
+
0017a660: 3c048019 lui r4,0x8019             |
0017a66c: 00000000 nop
+
0017a664: 24842dd8 addiu r4,r4,0x2dd8       |{{f/adr|Prepare dynamic pointer to Targetable Grid : 0x80192dd8}}
0017a670: 1040000f beq r2,r0,0x0017a6b0 Branch if not targeted
+
                                            {{f/bloop|LOOP  - All tiles}}
0017a674: 00000000 nop
+
0017a668: 90820001 lbu r2,0x0001(r4)             |{{f/load|Green Flag}} {{f/std|80192dd8 + 0x01}}
0017a678: 90620006 lbu r2,0x0006(r3) Load Tile Unselectable
+
0017a66c: 00000000 nop                           |
0017a67c: 00000000 nop
+
0017a670: 1040000f beq r2,r0,0x0017a6b0         {{f/Cond|If This Tile is targeted}}
0017a680: 30420001 andi r2,r2,0x0001 If Tile is Unselectable
+
0017a674: 00000000 nop                               |
0017a684: 1440000a bne r2,r0,0x0017a6b0 Branch if True
+
0017a678: 90620006 lbu r2,0x0006(r3)                 |{{f/load|Load Tile Byte 0x06}}
0017a688: 00000000 nop
+
0017a67c: 00000000 nop                               |
0017a68c: 90620000 lbu r2,0x0000(r3) Load Tile Geomancy
+
0017a680: 30420001 andi r2,r2,0x0001                 |{{f/std|If Tile is Unselectable}}
0017a690: 00000000 nop
+
0017a684: 1440000a bne r2,r0,0x0017a6b0             {{f/Cond|If Tile is NOT Unselectable}}
0017a694: 3042003f andi r2,r2,0x003f If Tile = Cross Section
+
0017a688: 00000000 nop                                   |
0017a698: 10470005 beq r2,r7,0x0017a6b0 Branch if not Cross Section
+
0017a68c: 90620000 lbu r2,0x0000(r3)                     |{{f/load|Load Tile Terrain type}}
0017a69c: 00000000 nop
+
0017a690: 00000000 nop                                   |
0017a6a0: 90620005 lbu r2,0x0005(r3) Load ?
+
0017a694: 3042003f andi r2,r2,0x003f                     |
0017a6a4: 24c60001 addiu r6,r6,0x0001 r6++
+
0017a698: 10470005 beq r2,r7,0x0017a6b0                 {{f/Cond|If This tile is NOT a cross section }}
0017a6a8: 0805e9af j 0x0017a6bc
+
0017a69c: 00000000 nop                                       |
0017a6ac: 34420040 ori r2,r2,0x0040 5th byte = 0x0040
+
0017a6a0: 90620005 lbu r2,0x0005(r3)                         |{{f/load|Load Tile's byte 0x05}}
0017a6b0: 90620005 lbu r2,0x0005(r3) Load ?
+
0017a6a4: 24c60001 addiu r6,r6,0x0001                       |{{f/std|Valid Tile counter +1}}
0017a6b4: 00000000 nop
+
0017a6a8: 0805e9af j 0x0017a6bc                             {{f/jump|Avoid 0x40 disabling}}
0017a6b8: 304200bf andi r2,r2,0x00bf 5th byte = 0x00bf
+
0017a6ac: 34420040 ori r2,r2,0x0040                         |{{f/std|Enable 0x40}}
0017a6bc: a0620005 sb r2,0x0005(r3) Save 0x0040 or 0x00bf to 5th byte
+
                                                  '''Else : Untargeted / Unselectable / Cross section'''
0017a6c0: 24630008 addiu r3,r3,0x0008 Next Tile
+
0017a6b0: 90620005 lbu r2,0x0005(r3)                 |{{f/load|Load Tile's byte 0x05}}
0017a6c4: 24a50001 addiu r5,r5,0x0001 Loop Counter++
+
0017a6b4: 00000000 nop                               |
0017a6c8: 28a20200 slti r2,r5,0x0200 If Loop Counter < 0x0200
+
0017a6b8: 304200bf andi r2,r2,0x00bf                 |{{f/std|Disable 0x40}}
0017a6cc: 1440ffe6 bne r2,r0,0x0017a668 Branch Back if True
+
0017a6bc: a0620005 sb r2,0x0005(r3)             |{{f/store|Update Tile Byte 0x05 (with flag 0x40 if Targetable)}}
0017a6d0: 24840005 addiu r4,r4,0x0005 Next Tile
+
0017a6c0: 24630008 addiu r3,r3,0x0008           |{{f/std|Tile Data offset}}
0017a6d4: 03e00008 jr r31
+
0017a6c4: 24a50001 addiu r5,r5,0x0001           |{{f/std|Loop Counter++}}
0017a6d8: 00c01021 addu r2,r6,r0 r2 = Number of loops
+
0017a6c8: 28a20200 slti r2,r5,0x0200             |{{f/std|If Loop Counter < 0x0200}}
</pre>
+
0017a6cc: 1440ffe6 bne r2,r0,0x0017a668     {{f/eloop|Loop 0x200 Times}}
 
+
0017a6d0: 24840005 addiu r4,r4,0x0005           |{{f/std|Targetable grid offset}}
This is a clone of [[Identify Cross Sections Routine|0x0017a5bc]]
+
0017a6d4: 03e00008 jr r31                       |
 +
0017a6d8: 00c01021 addu r2,r6,r0                 |{{f/Returns|Returns Nb of Valid Tiles}}
 +
===Return locations===
 +
'''BATTLE.BIN'''
 +
  0017a4e4: [[Set_panels_affected_by_ability%3F]]

Latest revision as of 20:04, 16 May 2024

BATTLE.BIN :  - Cross Section Identification 2
------------------------------------------------------------------------------------------
Parameter : Nothing
Return : r2 = Nb of Targeted Tiles (some tiles might be disabled here) 
------------------------------------------------------------------------------------------
0017a64c: 00003021 addu r6,r0,r0             |Intialize Valid Tile counter
0017a650: 00002821 addu r5,r0,r0             |Initialize Tile Counter
0017a654: 3407003f ori r7,r0,0x003f          |Cross Section Value
0017a658: 3c038019 lui r3,0x8019             |
0017a65c: 2463f8cc addiu r3,r3,-0x0734       |Prepare dynamic pointer to Tile data : 0x8018f8cc
0017a660: 3c048019 lui r4,0x8019             |
0017a664: 24842dd8 addiu r4,r4,0x2dd8        |Prepare dynamic pointer to Targetable Grid : 0x80192dd8
                                            @LOOP  - All tiles
0017a668: 90820001 lbu r2,0x0001(r4)             |Green Flag 80192dd8 + 0x01
0017a66c: 00000000 nop                           |
0017a670: 1040000f beq r2,r0,0x0017a6b0          #If This Tile is targeted
0017a674: 00000000 nop                               |
0017a678: 90620006 lbu r2,0x0006(r3)                 |Load Tile Byte 0x06
0017a67c: 00000000 nop                               |
0017a680: 30420001 andi r2,r2,0x0001                 |If Tile is Unselectable
0017a684: 1440000a bne r2,r0,0x0017a6b0              #If Tile is NOT Unselectable
0017a688: 00000000 nop                                   |
0017a68c: 90620000 lbu r2,0x0000(r3)                     |Load Tile Terrain type
0017a690: 00000000 nop                                   |
0017a694: 3042003f andi r2,r2,0x003f                     |
0017a698: 10470005 beq r2,r7,0x0017a6b0                  #If This tile is NOT a cross section 
0017a69c: 00000000 nop                                       |
0017a6a0: 90620005 lbu r2,0x0005(r3)                         |Load Tile's byte 0x05
0017a6a4: 24c60001 addiu r6,r6,0x0001                        |Valid Tile counter +1
0017a6a8: 0805e9af j 0x0017a6bc                              >>Avoid 0x40 disabling
0017a6ac: 34420040 ori r2,r2,0x0040                          |Enable 0x40
                                                 Else : Untargeted / Unselectable / Cross section
0017a6b0: 90620005 lbu r2,0x0005(r3)                 |Load Tile's byte 0x05
0017a6b4: 00000000 nop                               |
0017a6b8: 304200bf andi r2,r2,0x00bf                 |Disable 0x40
0017a6bc: a0620005 sb r2,0x0005(r3)              |Update Tile Byte 0x05 (with flag 0x40 if Targetable)
0017a6c0: 24630008 addiu r3,r3,0x0008            |Tile Data offset
0017a6c4: 24a50001 addiu r5,r5,0x0001            |Loop Counter++
0017a6c8: 28a20200 slti r2,r5,0x0200             |If Loop Counter < 0x0200
0017a6cc: 1440ffe6 bne r2,r0,0x0017a668      Λ Loop 0x200 Times
0017a6d0: 24840005 addiu r4,r4,0x0005            |Targetable grid offset
0017a6d4: 03e00008 jr r31                        |
0017a6d8: 00c01021 addu r2,r6,r0                 |Returns Nb of Valid Tiles

Return locations

BATTLE.BIN
 0017a4e4: Set_panels_affected_by_ability?