Difference between revisions of "EQUIP.OUT Entrypoint"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
(Created page with "<font face='Courier New'> 001bf7e0: 3c02801d lui r2,0x801d 001bf7e4: 9042e1ca lbu r2,-0x1e36(r2) 001bf7e8: 27bdffe0 addiu r29,r29,0xffe0 001bf7ec: afb10014 sw r17,0x0014...")
 
Line 5: Line 5:
 
  001bf7e8: 27bdffe0 addiu r29,r29,0xffe0
 
  001bf7e8: 27bdffe0 addiu r29,r29,0xffe0
 
  001bf7ec: afb10014 sw r17,0x0014(r29)
 
  001bf7ec: afb10014 sw r17,0x0014(r29)
  001bf7f0: 00808821 addu r17,r4,r0
+
  001bf7f0: 00808821 addu r17,r4,r0 #r4 = input 1 (acting unit ID)
 
  001bf7f4: afb00010 sw r16,0x0010(r29)
 
  001bf7f4: afb00010 sw r16,0x0010(r29)
  001bf7f8: 00a08021 addu r16,r5,r0
+
  001bf7f8: 00a08021 addu r16,r5,r0 #r5 = input 2 (maybe a pointer?)
 
  001bf7fc: 1440000d bne r2,r0,0x001bf834
 
  001bf7fc: 1440000d bne r2,r0,0x001bf834
 
  001bf800: afbf0018 sw r31,0x0018(r29)
 
  001bf800: afbf0018 sw r31,0x0018(r29)
Line 15: Line 15:
 
  001bf810: 24a587e0 addiu r5,r5,0x87e0
 
  001bf810: 24a587e0 addiu r5,r5,0x87e0
 
  001bf814: 3c04801f lui r4,0x801f
 
  001bf814: 3c04801f lui r4,0x801f
  001bf818: 8c8492e4 lw r4,-0x6d1c(r4)
+
  001bf818: 8c8492e4 lw r4,-0x6d1c(r4) #Unit EQUIP.OUT data pointer
 
  001bf81c: 3406000a ori r6,r0,0x000a
 
  001bf81c: 3406000a ori r6,r0,0x000a
  001bf820: 0c0088b7 jal 0x000222dc
+
  001bf820: 0c0088b7 jal 0x000222dc #[[Bcopy]] - Copy 0xa bytes of data from r5 to r4 (or from r4 to r5?) - all 5 equip slots
  001bf824: 24840054 addiu r4,r4,0x0054
+
  001bf824: 24840054 addiu r4,r4,0x0054 #pointer to equipment
 
  001bf828: 34020001 ori r2,r0,0x0001
 
  001bf828: 34020001 ori r2,r0,0x0001
 
  001bf82c: 3c01801d lui r1,0x801d
 
  001bf82c: 3c01801d lui r1,0x801d
Line 24: Line 24:
 
  001bf834: 00002021 addu r4,r0,r0
 
  001bf834: 00002021 addu r4,r0,r0
 
  001bf838: 3c01801f lui r1,0x801f
 
  001bf838: 3c01801f lui r1,0x801f
  001bf83c: ac30934c sw r16,-0x6cb4(r1)
+
  001bf83c: ac30934c sw r16,-0x6cb4(r1) #store input 2
 
  001bf840: 0c0735f1 jal 0x001cd7c4
 
  001bf840: 0c0735f1 jal 0x001cd7c4
 
  001bf844: 2405ffff addiu r5,r0,0xffff
 
  001bf844: 2405ffff addiu r5,r0,0xffff
Line 31: Line 31:
 
  001bf850: 3c038016 lui r3,0x8016
 
  001bf850: 3c038016 lui r3,0x8016
 
  001bf854: 8c636028 lw r3,0x6028(r3)
 
  001bf854: 8c636028 lw r3,0x6028(r3)
  001bf858: 8c500000 lw r16,0x0000(r2)
+
  001bf858: 8c500000 lw r16,0x0000(r2) #? (a return value?)
 
  001bf85c: 10600006 beq r3,r0,0x001bf878
 
  001bf85c: 10600006 beq r3,r0,0x001bf878
 
  001bf860: 00002021 addu r4,r0,r0
 
  001bf860: 00002021 addu r4,r0,r0
Line 75: Line 75:
 
  001bf900: 8c22e1d0 lw r2,-0x1e30(r1)
 
  001bf900: 8c22e1d0 lw r2,-0x1e30(r1)
 
  001bf904: 00000000 nop
 
  001bf904: 00000000 nop
  001bf908: 0040f809 jalr r2,r31
+
  001bf908: 0040f809 jalr r2,r31 #go to routine as called by above.
 
  001bf90c: 00000000 nop
 
  001bf90c: 00000000 nop
 
  001bf910: 3c02801d lui r2,0x801d
 
  001bf910: 3c02801d lui r2,0x801d
Line 90: Line 90:
 
  001bf93c: 00000000 nop
 
  001bf93c: 00000000 nop
 
  001bf940: 3c018016 lui r1,0x8016
 
  001bf940: 3c018016 lui r1,0x8016
  001bf944: ac225fb4 sw r2,0x5fb4(r1)
+
  001bf944: ac225fb4 sw r2,0x5fb4(r1) #store r2 to move/panel selected? (tf?)
 
  001bf948: 3c03801d lui r3,0x801d
 
  001bf948: 3c03801d lui r3,0x801d
  001bf94c: 9063e1ca lbu r3,-0x1e36(r3)
+
  001bf94c: 9063e1ca lbu r3,-0x1e36(r3) #?
 
  001bf950: 340200ff ori r2,r0,0x00ff
 
  001bf950: 340200ff ori r2,r0,0x00ff
 
  001bf954: 3c01801d lui r1,0x801d
 
  001bf954: 3c01801d lui r1,0x801d
 
  001bf958: a020e1c8 sb r0,-0x1e38(r1)
 
  001bf958: a020e1c8 sb r0,-0x1e38(r1)
  001bf95c: 14620028 bne r3,r2,0x001bfa00
+
  001bf95c: 14620028 bne r3,r2,0x001bfa00 #branch if invalid...?
  001bf960: 02001021 addu r2,r16,r0
+
  001bf960: 02001021 addu r2,r16,r0 #return r16 counter
  001bf964: 00008021 addu r16,r0,r0
+
  001bf964: 00008021 addu r16,r0,r0 #set counter to 0
 
  001bf968: 3c05801e lui r5,0x801e
 
  001bf968: 3c05801e lui r5,0x801e
  001bf96c: 24a587e0 addiu r5,r5,0x87e0
+
  001bf96c: 24a587e0 addiu r5,r5,0x87e0 #temporary unit data pointer (related to world.bin's extra 'unit' for test/display when changing equips?)
 
  001bf970: 3c04801f lui r4,0x801f
 
  001bf970: 3c04801f lui r4,0x801f
  001bf974: 8c8492e4 lw r4,-0x6d1c(r4)
+
  001bf974: 8c8492e4 lw r4,-0x6d1c(r4) #unit data pointer?
 
  001bf978: 00000000 nop
 
  001bf978: 00000000 nop
  001bf97c: 94830054 lhu r3,0x0054(r4)
+
  001bf97c: 94830054 lhu r3,0x0054(r4) #equipment? (seems to be related to WORLD.BIN's formation data; 0x54 is the first equip slot there as well.)
  001bf980: 84a20000 lh r2,0x0000(r5)
+
  001bf980: 84a20000 lh r2,0x0000(r5)
 
  001bf984: 00000000 nop
 
  001bf984: 00000000 nop
  001bf988: 14620005 bne r3,r2,0x001bf9a0
+
  001bf988: 14620005 bne r3,r2,0x001bf9a0 #branch if new equipment is different to old equipment (which is which though?)
 
  001bf98c: 24a50002 addiu r5,r5,0x0002
 
  001bf98c: 24a50002 addiu r5,r5,0x0002
  001bf990: 26100001 addiu r16,r16,0x0001
+
  001bf990: 26100001 addiu r16,r16,0x0001 #increase number of equips that aren't new by 1
 
  001bf994: 2a020005 slti r2,r16,0x0005
 
  001bf994: 2a020005 slti r2,r16,0x0005
  001bf998: 1440fff7 bne r2,r0,0x001bf978
+
  001bf998: 1440fff7 bne r2,r0,0x001bf978 #loop if r16 is still less than 5 (number of equips not changed...?)
 
  001bf99c: 24840002 addiu r4,r4,0x0002
 
  001bf99c: 24840002 addiu r4,r4,0x0002
  001bf9a0: 0c0602bf jal 0x00180afc
+
  001bf9a0: 0c0602bf jal 0x00180afc #Get unit data pointer (0x1c0) matching r4 ID?
 
  001bf9a4: 02202021 addu r4,r17,r0
 
  001bf9a4: 02202021 addu r4,r17,r0
 
  001bf9a8: 00402021 addu r4,r2,r0
 
  001bf9a8: 00402021 addu r4,r2,r0
  001bf9ac: 9482002a lhu r2,0x002a(r4)
+
  001bf9ac: 9482002a lhu r2,0x002a(r4) #load max HP
  001bf9b0: 94830028 lhu r3,0x0028(r4)
+
  001bf9b0: 94830028 lhu r3,0x0028(r4) #load current HP
 
  001bf9b4: 00000000 nop
 
  001bf9b4: 00000000 nop
 
  001bf9b8: 0043102b sltu r2,r2,r3
 
  001bf9b8: 0043102b sltu r2,r2,r3
  001bf9bc: 10400004 beq r2,r0,0x001bf9d0
+
  001bf9bc: 10400004 beq r2,r0,0x001bf9d0 #do not change current HP if current is already less than max
 
  001bf9c0: 00000000 nop
 
  001bf9c0: 00000000 nop
 
  001bf9c4: 9482002a lhu r2,0x002a(r4)
 
  001bf9c4: 9482002a lhu r2,0x002a(r4)
 
  001bf9c8: 00000000 nop
 
  001bf9c8: 00000000 nop
  001bf9cc: a4820028 sh r2,0x0028(r4)
+
  001bf9cc: a4820028 sh r2,0x0028(r4) #cap current HP at maximum HP
  001bf9d0: 9482002e lhu r2,0x002e(r4)
+
  001bf9d0: 9482002e lhu r2,0x002e(r4) #load max MP
  001bf9d4: 9483002c lhu r3,0x002c(r4)
+
  001bf9d4: 9483002c lhu r3,0x002c(r4) #load current mp
 
  001bf9d8: 00000000 nop
 
  001bf9d8: 00000000 nop
  001bf9dc: 0043102b sltu r2,r2,r3
+
  001bf9dc: 0043102b sltu r2,r2,r3 #r2 = true if max MP is less than current
  001bf9e0: 10400004 beq r2,r0,0x001bf9f4
+
  001bf9e0: 10400004 beq r2,r0,0x001bf9f4 #do not change current MP if mp is already less than max
 
  001bf9e4: 00000000 nop
 
  001bf9e4: 00000000 nop
  001bf9e8: 9482002e lhu r2,0x002e(r4)
+
  001bf9e8: 9482002e lhu r2,0x002e(r4) #load max MP
 
  001bf9ec: 00000000 nop
 
  001bf9ec: 00000000 nop
  001bf9f0: a482002c sh r2,0x002c(r4)
+
  001bf9f0: a482002c sh r2,0x002c(r4) #Store new MP as max MP
  001bf9f4: 0c017578 jal 0x0005d5e0 status setting + equip R/S/M stat setting
+
  001bf9f4: 0c017578 jal 0x0005d5e0 #status setting + equip R/S/M stat setting
 
  001bf9f8: 00000000 nop
 
  001bf9f8: 00000000 nop
  001bf9fc: 2a020005 slti r2,r16,0x0005 #set disable act
+
  001bf9fc: 2a020005 slti r2,r16,0x0005 #return disable act if number of equips not changed is <= 4
 
  001bfa00: 8fbf0018 lw r31,0x0018(r29)
 
  001bfa00: 8fbf0018 lw r31,0x0018(r29)
 
  001bfa04: 8fb10014 lw r17,0x0014(r29)
 
  001bfa04: 8fb10014 lw r17,0x0014(r29)

Revision as of 06:09, 20 May 2022

001bf7e0: 3c02801d lui r2,0x801d
001bf7e4: 9042e1ca lbu r2,-0x1e36(r2)
001bf7e8: 27bdffe0 addiu r29,r29,0xffe0
001bf7ec: afb10014 sw r17,0x0014(r29)
001bf7f0: 00808821 addu r17,r4,r0				#r4 = input 1 (acting unit ID)
001bf7f4: afb00010 sw r16,0x0010(r29)
001bf7f8: 00a08021 addu r16,r5,r0				#r5 = input 2 (maybe a pointer?)
001bf7fc: 1440000d bne r2,r0,0x001bf834
001bf800: afbf0018 sw r31,0x0018(r29)
001bf804: 0c06fc76 jal 0x001bf1d8
001bf808: 00000000 nop
001bf80c: 3c05801e lui r5,0x801e
001bf810: 24a587e0 addiu r5,r5,0x87e0
001bf814: 3c04801f lui r4,0x801f
001bf818: 8c8492e4 lw r4,-0x6d1c(r4)				#Unit EQUIP.OUT data pointer
001bf81c: 3406000a ori r6,r0,0x000a
001bf820: 0c0088b7 jal 0x000222dc				#Bcopy - Copy 0xa bytes of data from r5 to r4 (or from r4 to r5?) - all 5 equip slots
001bf824: 24840054 addiu r4,r4,0x0054				#pointer to equipment
001bf828: 34020001 ori r2,r0,0x0001
001bf82c: 3c01801d lui r1,0x801d
001bf830: a022e1ca sb r2,-0x1e36(r1)
001bf834: 00002021 addu r4,r0,r0
001bf838: 3c01801f lui r1,0x801f
001bf83c: ac30934c sw r16,-0x6cb4(r1)				#store input 2
001bf840: 0c0735f1 jal 0x001cd7c4
001bf844: 2405ffff addiu r5,r0,0xffff
001bf848: 3c02801f lui r2,0x801f
001bf84c: 8c42923c lw r2,-0x6dc4(r2)
001bf850: 3c038016 lui r3,0x8016
001bf854: 8c636028 lw r3,0x6028(r3)
001bf858: 8c500000 lw r16,0x0000(r2)				#? (a return value?)
001bf85c: 10600006 beq r3,r0,0x001bf878
001bf860: 00002021 addu r4,r0,r0
001bf864: 3c02801d lui r2,0x801d
001bf868: 8442fbb8 lh r2,-0x0448(r2)
001bf86c: 00000000 nop
001bf870: 2c420001 sltiu r2,r2,0x0001
001bf874: 00402021 addu r4,r2,r0
001bf878: 3c01801e lui r1,0x801e
001bf87c: a02487dc sb r4,-0x7824(r1)
001bf880: 0c07252d jal 0x001c94b4
001bf884: 00000000 nop
001bf888: 3c02801f lui r2,0x801f
001bf88c: 8c429240 lw r2,-0x6dc0(r2)
001bf890: 00000000 nop
001bf894: 30420100 andi r2,r2,0x0100
001bf898: 10400003 beq r2,r0,0x001bf8a8
001bf89c: 00000000 nop
001bf8a0: 0c07243a jal 0x001c90e8
001bf8a4: 34040003 ori r4,r0,0x0003
001bf8a8: 3c02801e lui r2,0x801e
001bf8ac: 904287dc lbu r2,-0x7824(r2)
001bf8b0: 00000000 nop
001bf8b4: 10400008 beq r2,r0,0x001bf8d8
001bf8b8: 00000000 nop
001bf8bc: 3c028016 lui r2,0x8016
001bf8c0: 8c426028 lw r2,0x6028(r2)
001bf8c4: 00000000 nop
001bf8c8: 14400003 bne r2,r0,0x001bf8d8
001bf8cc: 00000000 nop
001bf8d0: 0c04d01d jal 0x00134074
001bf8d4: 00000000 nop
001bf8d8: 3c048016 lui r4,0x8016
001bf8dc: 8c846028 lw r4,0x6028(r4)
001bf8e0: 0c0734bc jal 0x001cd2f0
001bf8e4: 00000000 nop
001bf8e8: 3c02801d lui r2,0x801d
001bf8ec: 9042e1ca lbu r2,-0x1e36(r2)
001bf8f0: 00000000 nop
001bf8f4: 00021080 sll r2,r2,0x02
001bf8f8: 3c01801d lui r1,0x801d
001bf8fc: 00220821 addu r1,r1,r2
001bf900: 8c22e1d0 lw r2,-0x1e30(r1)
001bf904: 00000000 nop
001bf908: 0040f809 jalr r2,r31				#go to routine as called by above. 
001bf90c: 00000000 nop
001bf910: 3c02801d lui r2,0x801d
001bf914: 9042e1c9 lbu r2,-0x1e37(r2)
001bf918: 00000000 nop
001bf91c: 10400003 beq r2,r0,0x001bf92c
001bf920: 00000000 nop
001bf924: 3c01801d lui r1,0x801d
001bf928: a020e1c8 sb r0,-0x1e38(r1)
001bf92c: 3c02801d lui r2,0x801d
001bf930: 9042e1c8 lbu r2,-0x1e38(r2)
001bf934: 00000000 nop
001bf938: 10400003 beq r2,r0,0x001bf948
001bf93c: 00000000 nop
001bf940: 3c018016 lui r1,0x8016
001bf944: ac225fb4 sw r2,0x5fb4(r1)				#store r2 to move/panel selected? (tf?)
001bf948: 3c03801d lui r3,0x801d
001bf94c: 9063e1ca lbu r3,-0x1e36(r3)				#?
001bf950: 340200ff ori r2,r0,0x00ff
001bf954: 3c01801d lui r1,0x801d
001bf958: a020e1c8 sb r0,-0x1e38(r1)
001bf95c: 14620028 bne r3,r2,0x001bfa00			#branch if invalid...?
001bf960: 02001021 addu r2,r16,r0				#return r16 counter
001bf964: 00008021 addu r16,r0,r0				#set counter to 0
001bf968: 3c05801e lui r5,0x801e
001bf96c: 24a587e0 addiu r5,r5,0x87e0				#temporary unit data pointer (related to world.bin's extra 'unit' for test/display when changing equips?)
001bf970: 3c04801f lui r4,0x801f
001bf974: 8c8492e4 lw r4,-0x6d1c(r4)				#unit data pointer?
001bf978: 00000000 nop
001bf97c: 94830054 lhu r3,0x0054(r4)				#equipment? (seems to be related to WORLD.BIN's formation data; 0x54 is the first equip slot there as well.)
001bf980: 84a20000 lh r2,0x0000(r5)				
001bf984: 00000000 nop
001bf988: 14620005 bne r3,r2,0x001bf9a0			#branch if new equipment is different to old equipment (which is which though?)
001bf98c: 24a50002 addiu r5,r5,0x0002
001bf990: 26100001 addiu r16,r16,0x0001			#increase number of equips that aren't new by 1
001bf994: 2a020005 slti r2,r16,0x0005
001bf998: 1440fff7 bne r2,r0,0x001bf978			#loop if r16 is still less than 5 (number of equips not changed...?)
001bf99c: 24840002 addiu r4,r4,0x0002
001bf9a0: 0c0602bf jal 0x00180afc				#Get unit data pointer (0x1c0) matching r4 ID?
001bf9a4: 02202021 addu r4,r17,r0
001bf9a8: 00402021 addu r4,r2,r0
001bf9ac: 9482002a lhu r2,0x002a(r4)				#load max HP
001bf9b0: 94830028 lhu r3,0x0028(r4)				#load current HP
001bf9b4: 00000000 nop
001bf9b8: 0043102b sltu r2,r2,r3
001bf9bc: 10400004 beq r2,r0,0x001bf9d0			#do not change current HP if current is already less than max
001bf9c0: 00000000 nop
001bf9c4: 9482002a lhu r2,0x002a(r4)
001bf9c8: 00000000 nop
001bf9cc: a4820028 sh r2,0x0028(r4)				#cap current HP at maximum HP
001bf9d0: 9482002e lhu r2,0x002e(r4)				#load max MP
001bf9d4: 9483002c lhu r3,0x002c(r4)				#load current mp
001bf9d8: 00000000 nop
001bf9dc: 0043102b sltu r2,r2,r3				#r2 = true if max MP is less than current
001bf9e0: 10400004 beq r2,r0,0x001bf9f4			#do not change current MP if mp is already less than max
001bf9e4: 00000000 nop
001bf9e8: 9482002e lhu r2,0x002e(r4)				#load max MP
001bf9ec: 00000000 nop
001bf9f0: a482002c sh r2,0x002c(r4)				#Store new MP as max MP
001bf9f4: 0c017578 jal 0x0005d5e0				#status setting + equip R/S/M stat setting
001bf9f8: 00000000 nop
001bf9fc: 2a020005 slti r2,r16,0x0005			#return disable act if number of equips not changed is <= 4
001bfa00: 8fbf0018 lw r31,0x0018(r29)
001bfa04: 8fb10014 lw r17,0x0014(r29)
001bfa08: 8fb00010 lw r16,0x0010(r29)
001bfa0c: 27bd0020 addiu r29,r29,0x0020
001bfa10: 03e00008 jr r31
001bfa14: 00000000 nop