Difference between revisions of "Stat Increment/Decrement"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
(Created page with " Stats increment/decrement r5 = unit data + 32 0018d570: 90a80000 lbu r8,0x0000(r5) load original stat 0018d574: 30c300ff andi r3,r6,0x00ff r3 = stat cap 0018d578: 340200...")
 
Line 1: Line 1:
  Stats increment/decrement r5 = unit data + 32
+
  Stats increment/decrement r5 = unit data + 30
 
  0018d570: 90a80000 lbu r8,0x0000(r5) load original stat
 
  0018d570: 90a80000 lbu r8,0x0000(r5) load original stat
 
  0018d574: 30c300ff andi r3,r6,0x00ff r3 = stat cap
 
  0018d574: 30c300ff andi r3,r6,0x00ff r3 = stat cap
 
  0018d578: 340200ff ori r2,r0,0x00ff
 
  0018d578: 340200ff ori r2,r0,0x00ff
  0018d57c: 14620005 bne r3,r2,0x 0018d594 jump if stat cap != ff?
+
  0018d57c: 14620005 bne r3,r2,0x 0018d594 jump if stat cap != ff?
  0018d580: 3089007f andi r9,r4,0x007f r4 = + stat change
+
  0018d580: 3089007f andi r9,r4,0x007f r9 = + stat change
 
  0018d584: 3402007f ori r2,r0,0x007f
 
  0018d584: 3402007f ori r2,r0,0x007f
  0018d588: 15220003 bne r9,r2,0x 0018d598 jump if stat change !=
+
  0018d588: 15220003 bne r9,r2,0x 0018d598 jump if stat change !=
 
  +127?
 
  +127?
 
  0018d58c: 30820080 andi r2,r4,0x0080 r4 = - stat change
 
  0018d58c: 30820080 andi r2,r4,0x0080 r4 = - stat change
 
  0018d590: 340900ff ori r9,r0,0x00ff
 
  0018d590: 340900ff ori r9,r0,0x00ff
 
  0018d594: 30820080 andi r2,r4,0x0080
 
  0018d594: 30820080 andi r2,r4,0x0080
  0018d598: 10400003 beq r2,r0,0x 0018d5a8 jump if stat change not
+
  0018d598: 10400003 beq r2,r0,0x 0018d5a8 jump if stat change not
 
  negative
 
  negative
 
  0018d59c: 00000000 nop
 
  0018d59c: 00000000 nop
Line 17: Line 17:
 
  0018d5a4: 01094021 addu r8,r8,r9 stat - stat change?
 
  0018d5a4: 01094021 addu r8,r8,r9 stat - stat change?
 
  0018d5a8: 01094023 subu r8,r8,r9 stat + stat change?
 
  0018d5a8: 01094023 subu r8,r8,r9 stat + stat change?
  0018d5ac: 30e700ff andi r7,r7,0x00ff r7 = 01?
+
  0018d5ac: 30e700ff andi r7,r7,0x00ff r7 = masked bits
 
  0018d5b0: 0107102a slt r2,r8,r7 set if changed stat < 1
 
  0018d5b0: 0107102a slt r2,r8,r7 set if changed stat < 1
 
  0018d5b4: 10400002 beq r2,r0,0x 0018d5c0 else branch
 
  0018d5b4: 10400002 beq r2,r0,0x 0018d5c0 else branch
Line 38: Line 38:
 
  0018d5f4: 90a30003 lbu r3,0x0003(r5) load bonus stat
 
  0018d5f4: 90a30003 lbu r3,0x0003(r5) load bonus stat
 
  0018d5f8: 00000000 nop
 
  0018d5f8: 00000000 nop
  0018d5fc: 00434021 addu r8,r2,r3 add stats?
+
  0018d5fc: 00434021 addu r8,r2,r3 add stats
  0018d600: 00c8102a slt r2,r6,r8 set if r6 < first stat +
+
  0018d600: 00c8102a slt r2,r6,r8 cap check
second stat?
+
  0018d604: 10400002 beq r2,r0,0x 0018d610 branch if not  
  0018d604: 10400002 beq r2,r0,0x 0018d610 branch if not
 
 
  0018d608: 00000000 nop
 
  0018d608: 00000000 nop
  0018d60c: 00c04021 addu r8,r6,r0 r8 = r6
+
  0018d60c: 00c04021 addu r8,r6,r0 r8 = default to cap
  0018d610: a0a80006 sb r8,0x0006(r5) store r6 as new stat
+
  0018d610: a0a80006 sb r8,0x0006(r5) store r8 as new stat
 
  0018d614: 34020001 ori r2,r0,0x0001 r2 = 1
 
  0018d614: 34020001 ori r2,r0,0x0001 r2 = 1
 
  0018d618: 03e00008 jr r31
 
  0018d618: 03e00008 jr r31
 
  0018d61c: 00000000 nop
 
  0018d61c: 00000000 nop

Revision as of 13:56, 1 June 2014

Stats increment/decrement r5 = unit data + 30
0018d570: 90a80000 lbu r8,0x0000(r5)		load original stat
0018d574: 30c300ff andi r3,r6,0x00ff		r3 = stat cap
0018d578: 340200ff ori r2,r0,0x00ff		
0018d57c: 14620005 bne r3,r2,0x 0018d594	jump if stat cap != ff?
0018d580: 3089007f andi r9,r4,0x007f		r9 = + stat change
0018d584: 3402007f ori r2,r0,0x007f
0018d588: 15220003 bne r9,r2,0x 0018d598	jump if stat change !=
+127?		
0018d58c: 30820080 andi r2,r4,0x0080		r4 = - stat change
0018d590: 340900ff ori r9,r0,0x00ff
0018d594: 30820080 andi r2,r4,0x0080
0018d598: 10400003 beq r2,r0,0x 0018d5a8	jump if stat change not
negative
0018d59c: 00000000 nop
0018d5a0: 0806356b j 0x 0018d5ac
0018d5a4: 01094021 addu r8,r8,r9		stat - stat change?
0018d5a8: 01094023 subu r8,r8,r9		stat + stat change?
0018d5ac: 30e700ff andi r7,r7,0x00ff		r7 = masked bits
0018d5b0: 0107102a slt r2,r8,r7			set if changed stat < 1
0018d5b4: 10400002 beq r2,r0,0x 0018d5c0		else branch
0018d5b8: 30c600ff andi r6,r6,0x00ff		r6 = stat cap this is done earlier
0018d5bc: 00e04021 addu r8,r7,r0		r8 = 1
0018d5c0: 00c8102a slt r2,r6,r8			set if cap < 1
0018d5c4: 10400002 beq r2,r0,0x 0018d5d0		branch if not
0018d5c8: 00000000 nop
0018d5cc: 00c04021 addu r8,r6,r0		r8 = stat cap?
0018d5d0: 90a20000 lbu r2,0x0000(r5)		load stat?
0018d5d4: 00000000 nop
0018d5d8: 15020003 bne r8,r2,0x 0018d5e8		continue if current stat
!= stat cap?
0018d5dc: 34020001 ori r2,r0,0x0001		r2 = 1 
0018d5e0: 08063586 j 0x 0018d618			jump to end (no storing)
0018d5e4: 00001021 addu r2,r0,r0		r2 = 0
0018d5e8: 14e2000a bne r7,r2,0x 0018d614		jump to end if r2 = 1
0018d5ec: a0a80000 sb r8,0x0000(r5)		store ?? as new stat
0018d5f0: 90a20000 lbu r2,0x0000(r5)		load original stat
0018d5f4: 90a30003 lbu r3,0x0003(r5)		load bonus stat
0018d5f8: 00000000 nop
0018d5fc: 00434021 addu r8,r2,r3		add stats
0018d600: 00c8102a slt r2,r6,r8		cap check
0018d604: 10400002 beq r2,r0,0x 0018d610	branch if not 
0018d608: 00000000 nop
0018d60c: 00c04021 addu r8,r6,r0		r8 = default to cap
0018d610: a0a80006 sb r8,0x0006(r5)		store r8 as new stat
0018d614: 34020001 ori r2,r0,0x0001		r2 = 1
0018d618: 03e00008 jr r31
0018d61c: 00000000 nop