Difference between revisions of "Set r5 as New Variable Value"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
<font face='Courier New'>
+
Parameters : r4 = Variable ID
 +
              r5 = New Variable Value
 
   
 
   
  0013b644: 27bdffe0 addiu r29,r29,0xffe0
+
This routine will first clear Variable r4 value and then store r5 as new Variable value     
  0013b648: afb00010 sw r16,0x0010(r29)
+
----------------------------------------------------------------------------------------------
  0013b64c: 00808021 addu r16,r4,r0 // input command byte
+
  0013b644: 27bdffe0 addiu r29,r29,-0x0020    |
  0013b650: afb10014 sw r17,0x0014(r29)
+
  0013b648: afb00010 sw r16,0x0010(r29)       |
  0013b654: 3c028016 lui r2,0x8016
+
  0013b64c: 00808021 addu r16,r4,r0           |{{f/std|<nowiki>r16 = Variable ID</nowiki>}}
  0013b658: 8c425f9c lw r2,0x5f9c(r2) // pointer to map data(?)
+
  0013b650: afb10014 sw r17,0x0014(r29)       |
  0013b65c: 3403002c ori r3,r0,0x002c // r3 = 0x2c
+
  0013b654: 3c028016 lui r2,0x8016           |
  0013b660: afbf001c sw r31,0x001c(r29)
+
  0013b658: 8c425f9c lw r2,0x5f9c(r2)         |{{f/adr|<nowiki>r2 = Variable 0x00 data pointer</nowiki>}}
  0013b664: afb20018 sw r18,0x0018(r29)
+
  0013b65c: 3403002c ori r3,r0,0x002c         |{{f/std|<nowiki>r3 = 0x2c</nowiki>}}
  0013b668: 8c520000 lw r18,0x0000(r2)
+
  0013b660: afbf001c sw r31,0x001c(r29)       |
  0013b66c: 16030008 bne r16,r3,0x0013b690 // branch if input command is not 0x2c
+
  0013b664: afb20018 sw r18,0x0018(r29)       |
  0013b670: 00a08821 addu r17,r5,r0 // r17 = secondary input
+
  0013b668: 8c520000 lw r18,0x0000(r2)       |{{f/load|<nowiki>r18 = Variable 0x00 value</nowiki>}}
  0013b674: 3c0205f5 lui r2,0x05f5
+
  0013b66c: 16030008 bne r16,r3,0x0013b690   {{f/Cond|If Variable ID is war funds}}
  0013b678: 3442e0ff ori r2,r2,0xe0ff
+
  0013b670: 00a08821 addu r17,r5,r0           |{{f/std|<nowiki>r17 = Input Value</nowiki>}}
  0013b67c: 0051102a slt r2,r2,r17 // r2 = true if secondary < 0x05f5e0ff (... what)
+
  0013b674: 3c0205f5 lui r2,0x05f5               |
  0013b680: 10400004 beq r2,r0,0x0013b694 // branch if false
+
  0013b678: 3442e0ff ori r2,r2,0xe0ff             |{{f/std|<nowiki>r2 = 0x05f5e0ff</nowiki>}} {{f/std|99 999 999}}
  0013b684: 340400be ori r4,r0,0x00be // r4 = 0xbe
+
  0013b67c: 0051102a slt r2,r2,r17               |{{f/std|<nowiki>r2 = 0x01 if 99 999 999 < War funds</nowiki>}}
  0013b688: 3c1105f5 lui r17,0x05f5
+
  0013b680: 10400004 beq r2,r0,0x0013b694         {{f/Cond|If War funds > 99 999 999 gils}}
  0013b68c: 3631e0ff ori r17,r17,0xe0ff // r17 = 0x05f5e0ff
+
  0013b684: 340400be ori r4,r0,0x00be             |{{f/std|<nowiki>r4 = 0xbe</nowiki>}}
  0013b690: 340400be ori r4,r0,0x00be // r4 = 0xbe again
+
  0013b688: 3c1105f5 lui r17,0x05f5                   |{{f/std| }}
  0013b694: 02002821 addu r5,r16,r0 // r5 = input command byte
+
  0013b68c: 3631e0ff ori r17,r17,0xe0ff               |{{f/std|<nowiki>r17 = 0x05f5e0ff</nowiki>}} {{f/std|(max warfunds is 99 999 999 gils)}}
  0013b698: 00003021 addu r6,r0,r0 // r6 = 0
+
  0013b690: 340400be ori r4,r0,0x00be                 |{{f/std|<nowiki>r4 = 0xbe </nowiki>}}
  0013b69c: 0c052806 jal 0x0014a018 [[Calculate party inventory?]]
+
  0013b694: 02002821 addu r5,r16,r0           |{{f/std|<nowiki>r5 = Variable ID</nowiki>}}
  0013b6a0: 00003821 addu r7,r0,r0 // r7 = 0
+
  0013b698: 00003021 addu r6,r0,r0           |{{f/std|<nowiki>r6 = 0x00</nowiki>}}
  0013b6a4: 340400b0 ori r4,r0,0x00b0 // r4 = 0xb0
+
  0013b69c: 0c052806 jal 0x0014a018           |{{f/jal|Run_Script_Variable_Command|Run_Script_Variable_Command}}  Nullify Variable (r5)
  0013b6a8: 02002821 addu r5,r16,r0 // r5 = input command byte
+
  0013b6a0: 00003821 addu r7,r0,r0           |{{f/std|<nowiki>r7 = 0x00</nowiki>}}
  0013b6ac: 02203021 addu r6,r17,r0 // r6 = secondary input
+
  0013b6a4: 340400b0 ori r4,r0,0x00b0         |{{f/std|<nowiki>r4 = 0xb0</nowiki>}}
  0013b6b0: 0c052806 jal 0x0014a018 [[Calculate party inventory?]]
+
  0013b6a8: 02002821 addu r5,r16,r0           |{{f/std|<nowiki>r5 = Variable ID</nowiki>}}
  0013b6b4: 00003821 addu r7,r0,r0 // r7 = 0
+
  0013b6ac: 02203021 addu r6,r17,r0           |{{f/std|<nowiki>r6 = Input Value (or Max War Funds)</nowiki>}}
  0013b6b8: 3c028016 lui r2,0x8016
+
  0013b6b0: 0c052806 jal 0x0014a018           |{{f/jal|Run_Script_Variable_Command|Run_Script_Variable_Command}}  Add Input Value (r6) to Variable (r5)
  0013b6bc: 8c425f9c lw r2,0x5f9c(r2)
+
  0013b6b4: 00003821 addu r7,r0,r0           |{{f/std|<nowiki>r7 = 0x00</nowiki>}}
  0013b6c0: 00000000 nop
+
  0013b6b8: 3c028016 lui r2,0x8016           |
  0013b6c4: ac520000 sw r18,0x0000(r2) // preserve old map data value (above can't change weather?)
+
  0013b6bc: 8c425f9c lw r2,0x5f9c(r2)         |{{f/adr|<nowiki>r2 = Variable 0x00 data pointer</nowiki>}}
  0013b6c8: 8fbf001c lw r31,0x001c(r29)
+
  0013b6c0: 00000000 nop                     |
  0013b6cc: 8fb20018 lw r18,0x0018(r29)
+
  0013b6c4: ac520000 sw r18,0x0000(r2)       |{{f/store|Restore Variable 0x00 Value}}
  0013b6d0: 8fb10014 lw r17,0x0014(r29)
+
  0013b6c8: 8fbf001c lw r31,0x001c(r29)      
  0013b6d4: 8fb00010 lw r16,0x0010(r29)
+
  0013b6cc: 8fb20018 lw r18,0x0018(r29)      
  0013b6d8: 27bd0020 addiu r29,r29,0x0020
+
  0013b6d0: 8fb10014 lw r17,0x0014(r29)      
  0013b6dc: 03e00008 jr r31
+
  0013b6d4: 8fb00010 lw r16,0x0010(r29)      
 +
  0013b6d8: 27bd0020 addiu r29,r29,0x0020    
 +
  0013b6dc: 03e00008 jr r31                  
 
  0013b6e0: 00000000 nop
 
  0013b6e0: 00000000 nop
 
+
=== Return locations ===
</font>
+
'''SCUS_942.21'''
 +
0004eeb8:
 +
00031330:
 +
0003133c:
 +
 +
'''Battle.bin'''
 +
00070d84:
 +
00070db0:
 +
0008ea14:
 +
0008ea50:
 +
0012fad4:
 +
00130900:
 +
00132280:
 +
00132314:
 +
00132334:
 +
00134238:
 +
0013b5ec:
 +
0013cd98:
 +
0013e994:
 +
0013e9ac:
 +
00141c80:
 +
00141d2c:
 +
00141d98:
 +
00141dec:
 +
001422e8:
 +
00142b2c:
 +
00142bf4:
 +
00142c00:
 +
00142c14:
 +
00142e8c:
 +
00142edc:
 +
00142f30:
 +
00142f3c:
 +
00142fb0:
 +
001432f8:
 +
00143748:
 +
00143cc4:
 +
00143cd0:
 +
00143cdc:
 +
00143eac:
 +
00143eb8:
 +
00143ef0:
 +
00143fc4:
 +
00143fdc:
 +
00144330:
 +
001443a0:
 +
00144b40:
 +
00145e90:
 +
0014621c:
 +
0014b53c:
 +
0014b5a8:
 +
0014b5b4:
 +
0014b5c8:
 +
0018eb38: [[Add_price_of_item_/_4_to_total_gil]]

Latest revision as of 20:35, 15 March 2022

Parameters : r4 = Variable ID
             r5 = New Variable Value

This routine will first clear Variable r4 value and then store r5 as new Variable value      
----------------------------------------------------------------------------------------------
0013b644: 27bdffe0 addiu r29,r29,-0x0020    |
0013b648: afb00010 sw r16,0x0010(r29)       |
0013b64c: 00808021 addu r16,r4,r0           |r16 = Variable ID
0013b650: afb10014 sw r17,0x0014(r29)       |
0013b654: 3c028016 lui r2,0x8016            |
0013b658: 8c425f9c lw r2,0x5f9c(r2)         |r2 = Variable 0x00 data pointer
0013b65c: 3403002c ori r3,r0,0x002c         |r3 = 0x2c
0013b660: afbf001c sw r31,0x001c(r29)       |
0013b664: afb20018 sw r18,0x0018(r29)       |
0013b668: 8c520000 lw r18,0x0000(r2)        |r18 = Variable 0x00 value
0013b66c: 16030008 bne r16,r3,0x0013b690    #If Variable ID is war funds
0013b670: 00a08821 addu r17,r5,r0           |r17 = Input Value
0013b674: 3c0205f5 lui r2,0x05f5                |
0013b678: 3442e0ff ori r2,r2,0xe0ff             |r2 = 0x05f5e0ff 99 999 999
0013b67c: 0051102a slt r2,r2,r17                |r2 = 0x01 if 99 999 999 < War funds
0013b680: 10400004 beq r2,r0,0x0013b694         #If War funds > 99 999 999 gils
0013b684: 340400be ori r4,r0,0x00be             |r4 = 0xbe
0013b688: 3c1105f5 lui r17,0x05f5                   | 
0013b68c: 3631e0ff ori r17,r17,0xe0ff               |r17 = 0x05f5e0ff (max warfunds is 99 999 999 gils)
0013b690: 340400be ori r4,r0,0x00be                 |r4 = 0xbe 
0013b694: 02002821 addu r5,r16,r0           |r5 = Variable ID
0013b698: 00003021 addu r6,r0,r0            |r6 = 0x00
0013b69c: 0c052806 jal 0x0014a018           |-->Run_Script_Variable_Command  Nullify Variable (r5)
0013b6a0: 00003821 addu r7,r0,r0            |r7 = 0x00
0013b6a4: 340400b0 ori r4,r0,0x00b0         |r4 = 0xb0
0013b6a8: 02002821 addu r5,r16,r0           |r5 = Variable ID
0013b6ac: 02203021 addu r6,r17,r0           |r6 = Input Value (or Max War Funds)
0013b6b0: 0c052806 jal 0x0014a018           |-->Run_Script_Variable_Command  Add Input Value (r6) to Variable (r5)
0013b6b4: 00003821 addu r7,r0,r0            |r7 = 0x00
0013b6b8: 3c028016 lui r2,0x8016            |
0013b6bc: 8c425f9c lw r2,0x5f9c(r2)         |r2 = Variable 0x00 data pointer
0013b6c0: 00000000 nop                      |
0013b6c4: ac520000 sw r18,0x0000(r2)        |Restore Variable 0x00 Value
0013b6c8: 8fbf001c lw r31,0x001c(r29)       
0013b6cc: 8fb20018 lw r18,0x0018(r29)       
0013b6d0: 8fb10014 lw r17,0x0014(r29)       
0013b6d4: 8fb00010 lw r16,0x0010(r29)       
0013b6d8: 27bd0020 addiu r29,r29,0x0020     
0013b6dc: 03e00008 jr r31                   
0013b6e0: 00000000 nop

Return locations

SCUS_942.21
0004eeb8:
00031330:
0003133c:

Battle.bin
00070d84:
00070db0:
0008ea14:
0008ea50:
0012fad4:
00130900:
00132280:
00132314:
00132334:
00134238:
0013b5ec:
0013cd98:
0013e994:
0013e9ac:
00141c80:
00141d2c:
00141d98:
00141dec:
001422e8:
00142b2c:
00142bf4:
00142c00:
00142c14:
00142e8c:
00142edc:
00142f30:
00142f3c:
00142fb0:
001432f8:
00143748:
00143cc4:
00143cd0:
00143cdc:
00143eac:
00143eb8:
00143ef0:
00143fc4:
00143fdc:
00144330:
001443a0:
00144b40:
00145e90:
0014621c:
0014b53c:
0014b5a8:
0014b5b4:
0014b5c8:
0018eb38: Add_price_of_item_/_4_to_total_gil