Difference between revisions of "Update Sprite display data"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
(Created page with "<font face='Courier New'> 00083f18: 27bdffc8 addiu r29,r29,0xffc8 00083f1c: afb3001c sw r19,0x001c(r29) 00083f20: 00809821 addu r19,r4,r0 misc data 00083f24: afb10014 ...")
 
(still incomplete notation)
Line 1: Line 1:
 
<font face='Courier New'>
 
<font face='Courier New'>
 
   
 
   
  00083f18: 27bdffc8 addiu r29,r29,0xffc8
+
  00083f18: 27bdffc8 addiu r29,r29,0xffc8 stack pointer -0x38. This is important.
 
  00083f1c: afb3001c sw r19,0x001c(r29)
 
  00083f1c: afb3001c sw r19,0x001c(r29)
  00083f20: 00809821 addu r19,r4,r0 misc data
+
  00083f20: 00809821 addu r19,r4,r0 unit misc data
 
  00083f24: afb10014 sw r17,0x0014(r29)
 
  00083f24: afb10014 sw r17,0x0014(r29)
  00083f28: 00a08821 addu r17,r5,r0 0x1d8 in misc data (animation data
+
  00083f28: 00a08821 addu r17,r5,r0 unit sprite data
 
  00083f2c: 3c089249 lui r8,0x9249
 
  00083f2c: 3c089249 lui r8,0x9249
 
  00083f30: afbf0030 sw r31,0x0030(r29)
 
  00083f30: afbf0030 sw r31,0x0030(r29)
Line 14: Line 14:
 
  00083f44: afb20018 sw r18,0x0018(r29)
 
  00083f44: afb20018 sw r18,0x0018(r29)
 
  00083f48: afb00010 sw r16,0x0010(r29)
 
  00083f48: afb00010 sw r16,0x0010(r29)
  00083f4c: 96620040 lhu r2,0x0040(r19) load ?? x
+
  00083f4c: 96620040 lhu r2,0x0040(r19) load X mod (raw X location on screen)
  00083f50: 35082493 ori r8,r8,0x2493
+
  00083f50: 35082493 ori r8,r8,0x2493 r8 = 4/7 (effectively)
  00083f54: 00021400 sll r2,r2,0x10
+
  00083f54: 00021400 sll r2,r2,0x10 r2 = raw X mod << 0x10 (filters out upper halfword)
  00083f58: 00022c03 sra r5,r2,0x10
+
  00083f58: 00022c03 sra r5,r2,0x10 r5 = x(?)
  00083f5c: 00a80018 mult r5,r8 multiply
+
  00083f5c: 00a80018 mult r5,r8 X * 4/7
  00083f60: 00c0a021 addu r20,r6,r0
+
  00083f60: 00c0a021 addu r20,r6,r0 r20 = command byte + speed
  00083f64: 96630044 lhu r3,0x0044(r19) load ?? Y?
+
  00083f64: 96630044 lhu r3,0x0044(r19) load Y mod (raw Y location on screen)
  00083f68: 00002010 mfhi r4
+
  00083f68: 00002010 mfhi r4 r4 = Raw X mod * 4/7
 
  00083f6c: 00031c00 sll r3,r3,0x10
 
  00083f6c: 00031c00 sll r3,r3,0x10
 
  00083f70: 00034c03 sra r9,r3,0x10
 
  00083f70: 00034c03 sra r9,r3,0x10
  00083f74: 01280018 mult r9,r8
+
  00083f74: 01280018 mult r9,r8 raw Y mod * 4/7
  00083f78: 00e0a821 addu r21,r7,r0
+
  00083f78: 00e0a821 addu r21,r7,r0 r21 = animation
  00083f7c: 8fb70048 lw r23,0x0048(r29)
+
  00083f7c: 8fb70048 lw r23,0x0048(r29) load from 0x10 offset of a previous routine (not saved to by parent routine, maybe a previous routine in parent's master routine?)
  00083f80: 9266007e lbu r6,0x007e(r19)
+
  00083f80: 9266007e lbu r6,0x007e(r19) load unit's map level
  00083f84: 8fb6004c lw r22,0x004c(r29)
+
  00083f84: 8fb6004c lw r22,0x004c(r29) load from 0x14 offset of a previous routine
  00083f88: 000217c3 sra r2,r2,0x1f
+
  00083f88: 000217c3 sra r2,r2,0x1f r2 = raw X mod/2^15
  00083f8c: 00031fc3 sra r3,r3,0x1f
+
  00083f8c: 00031fc3 sra r3,r3,0x1f r3 = raw Y mod/2^15
  00083f90: 00852021 addu r4,r4,r5
+
  00083f90: 00852021 addu r4,r4,r5 r4 = Raw X mod * 11/7
  00083f94: 00042103 sra r4,r4,0x04
+
  00083f94: 00042103 sra r4,r4,0x04 r4 = Raw X mod * 11/112
  00083f98: 00822023 subu r4,r4,r2
+
  00083f98: 00822023 subu r4,r4,r2 r4 = Raw X mod * 22521/229376 (bro what the literal fuck lmao - but it's approximately 1/10)
 
  00083f9c: 00042400 sll r4,r4,0x10
 
  00083f9c: 00042400 sll r4,r4,0x10
 
  00083fa0: 00042403 sra r4,r4,0x10
 
  00083fa0: 00042403 sra r4,r4,0x10
  00083fa4: 00002810 mfhi r5
+
  00083fa4: 00002810 mfhi r5 r5 = Raw Y mod * 4/7
  00083fa8: 00a92821 addu r5,r5,r9
+
  00083fa8: 00a92821 addu r5,r5,r9 Y * 11/7
  00083fac: 00052903 sra r5,r5,0x04
+
  00083fac: 00052903 sra r5,r5,0x04 Y * 11/112
  00083fb0: 00a32823 subu r5,r5,r3
+
  00083fb0: 00a32823 subu r5,r5,r3 Y * 22521/229376 (~1/10)
 
  00083fb4: 00052c00 sll r5,r5,0x10
 
  00083fb4: 00052c00 sll r5,r5,0x10
 
  00083fb8: 0c060fed jal 0x00183fb4 get tiles data pointer
 
  00083fb8: 0c060fed jal 0x00183fb4 get tiles data pointer
 
  00083fbc: 00052c03 sra r5,r5,0x10
 
  00083fbc: 00052c03 sra r5,r5,0x10
  00083fc0: 00408021 addu r16,r2,r0
+
  00083fc0: 00408021 addu r16,r2,r0 r16 = tile data pointer
  00083fc4: 3292ffff andi r18,r20,0xffff
+
  00083fc4: 3292ffff andi r18,r20,0xffff r18 = command byte + speed
  00083fc8: 2e4200d2 sltiu r2,r18,0x00d2
+
  00083fc8: 2e4200d2 sltiu r2,r18,0x00d2 set r2 = true if less than 0xd2
  00083fcc: 10400071 beq r2,r0,0x00084194
+
  00083fcc: 10400071 beq r2,r0,0x00084194 #branch if not less than that
  00083fd0: 34020001 ori r2,r0,0x0001
+
  00083fd0: 34020001 ori r2,r0,0x0001 |r2 = 1
  00083fd4: 92630130 lbu r3,0x0130(r19) load mount byte
+
  00083fd4: 92630130 lbu r3,0x0130(r19) |load mount byte
  00083fd8: 8e31001c lw r17,0x001c(r17)
+
  00083fd8: 8e31001c lw r17,0x001c(r17) |load SHP data pointer
  00083fdc: 14620008 bne r3,r2,0x00084000 branch if not riding something
+
  00083fdc: 14620008 bne r3,r2,0x00084000 $branch if not riding something
  00083fe0: 00000000 nop
+
  00083fe0: 00000000 nop |
if riding something
+
  00083fe4: 8e620144 lw r2,0x0144(r19) |load status flags 5, 6, ? and ?
  00083fe4: 8e620144 lw r2,0x0144(r19) load status flags
+
  00083fe8: 00000000 nop |
  00083fe8: 00000000 nop
+
  00083fec: 30420240 andi r2,r2,0x0240 |seperate Jumping and ?? bytes
  00083fec: 30420240 andi r2,r2,0x0240
+
  00083ff0: 14400064 bne r2,r0,0x00084184 %branch if jumping or ??
  00083ff0: 14400064 bne r2,r0,0x00084184 branch if ??
+
  00083ff4: 00121080 sll r2,r18,0x02 |r2 = 4 * (command byte + speed)
  00083ff4: 00121080 sll r2,r18,0x02
+
  00083ff8: 0802105d j 0x00084174 @jump ahead
  00083ff8: 0802105d j 0x00084174
+
  00083ffc: 00511021 addu r2,r2,r17 |r2 = SHP data pointer + above
  00083ffc: 00511021 addu r2,r2,r17
+
  00084000: 92020003 lbu r2,0x0003(r16) $load tile depth
  00084000: 92020003 lbu r2,0x0003(r16) load tile depth
+
  00084004: 00000000 nop |
  00084004: 00000000 nop
+
  00084008: 304200e0 andi r2,r2,0x00e0 |seperate depth flags
  00084008: 304200e0 andi r2,r2,0x00e0
+
  0008400c: 1040005c beq r2,r0,0x00084180 $branch if no depth
  0008400c: 1040005c beq r2,r0,0x00084180 branch if no depth
+
  00084010: 00000000 nop |
  00084010: 00000000 nop
+
  00084014: 8e640134 lw r4,0x0134(r19) |load pointer to unit data
  00084014: 8e640134 lw r4,0x0134(r19) load unit data
+
  00084018: 00000000 nop |
  00084018: 00000000 nop
+
  0008401c: 10800040 beq r4,r0,0x00084120 &branch if null pointer
  0008401c: 10800040 beq r4,r0,0x00084120 branch if none found
+
  00084020: 00000000 nop |
  00084020: 00000000 nop
+
  00084024: 0c05fc08 jal 0x0017f020 |[[Float/Float/Fly movements]]
  00084024: 0c05fc08 jal 0x0017f020 float/fly movements
+
  00084028: 00000000 nop |
  00084028: 00000000 nop
+
  0008402c: 8e630144 lw r3,0x0144(r19) |load status flags 5, 6, ? and ?
  0008402c: 8e630144 lw r3,0x0144(r19)
+
  00084030: 00000000 nop |
  00084030: 00000000 nop
+
  00084034: 30630020 andi r3,r3,0x0020 |seperate float status
  00084034: 30630020 andi r3,r3,0x0020
+
  00084038: 14600051 bne r3,r0,0x00084180 $branch if float status?
  00084038: 14600051 bne r3,r0,0x00084180 branch if float status?
+
  0008403c: 00402021 addu r4,r2,r0 |r4 = depth flags
  0008403c: 00402021 addu r4,r2,r0
 
 
  00084040: 30820020 andi r2,r4,0x0020
 
  00084040: 30820020 andi r2,r4,0x0020
 
  00084044: 1440004f bne r2,r0,0x00084184 branch if ??
 
  00084044: 1440004f bne r2,r0,0x00084184 branch if ??
Line 164: Line 163:
 
  00084194: 3c11800b lui r17,0x800b
 
  00084194: 3c11800b lui r17,0x800b
 
  00084198: 2631f244 addiu r17,r17,0xf244
 
  00084198: 2631f244 addiu r17,r17,0xf244
  0008419c: 32a2ffff andi r2,r21,0xffff
+
  0008419c: 32a2ffff andi r2,r21,0xffff #
 
  000841a0: 2c420258 sltiu r2,r2,0x0258
 
  000841a0: 2c420258 sltiu r2,r2,0x0258
 
  000841a4: 10400002 beq r2,r0,0x000841b0
 
  000841a4: 10400002 beq r2,r0,0x000841b0

Revision as of 07:31, 28 July 2021

00083f18: 27bdffc8 addiu r29,r29,0xffc8		stack pointer -0x38. This is important.
00083f1c: afb3001c sw r19,0x001c(r29)
00083f20: 00809821 addu r19,r4,r0			unit misc data
00083f24: afb10014 sw r17,0x0014(r29)
00083f28: 00a08821 addu r17,r5,r0			unit sprite data
00083f2c: 3c089249 lui r8,0x9249
00083f30: afbf0030 sw r31,0x0030(r29)
00083f34: afb7002c sw r23,0x002c(r29)
00083f38: afb60028 sw r22,0x0028(r29)
00083f3c: afb50024 sw r21,0x0024(r29)
00083f40: afb40020 sw r20,0x0020(r29)
00083f44: afb20018 sw r18,0x0018(r29)
00083f48: afb00010 sw r16,0x0010(r29)
00083f4c: 96620040 lhu r2,0x0040(r19)			load X mod (raw X location on screen)
00083f50: 35082493 ori r8,r8,0x2493			r8 = 4/7 (effectively)
00083f54: 00021400 sll r2,r2,0x10			r2 = raw X mod << 0x10 (filters out upper halfword)
00083f58: 00022c03 sra r5,r2,0x10			r5 = x(?)
00083f5c: 00a80018 mult r5,r8				X * 4/7
00083f60: 00c0a021 addu r20,r6,r0			r20 = command byte + speed
00083f64: 96630044 lhu r3,0x0044(r19)			load Y mod (raw Y location on screen)
00083f68: 00002010 mfhi r4				r4 = Raw X mod * 4/7
00083f6c: 00031c00 sll r3,r3,0x10
00083f70: 00034c03 sra r9,r3,0x10
00083f74: 01280018 mult r9,r8				raw Y mod * 4/7
00083f78: 00e0a821 addu r21,r7,r0			r21 = animation
00083f7c: 8fb70048 lw r23,0x0048(r29)			load from 0x10 offset of a previous routine (not saved to by parent routine, maybe a previous routine in parent's master routine?)
00083f80: 9266007e lbu r6,0x007e(r19)			load unit's map level
00083f84: 8fb6004c lw r22,0x004c(r29)			load from 0x14 offset of a previous routine
00083f88: 000217c3 sra r2,r2,0x1f			r2 = raw X mod/2^15
00083f8c: 00031fc3 sra r3,r3,0x1f			r3 = raw Y mod/2^15
00083f90: 00852021 addu r4,r4,r5			r4 = Raw X mod * 11/7
00083f94: 00042103 sra r4,r4,0x04			r4 = Raw X mod * 11/112
00083f98: 00822023 subu r4,r4,r2			r4 = Raw X mod * 22521/229376 (bro what the literal fuck lmao - but it's approximately 1/10)
00083f9c: 00042400 sll r4,r4,0x10
00083fa0: 00042403 sra r4,r4,0x10
00083fa4: 00002810 mfhi r5				r5 = Raw Y mod * 4/7
00083fa8: 00a92821 addu r5,r5,r9			Y * 11/7
00083fac: 00052903 sra r5,r5,0x04			Y * 11/112
00083fb0: 00a32823 subu r5,r5,r3			Y * 22521/229376 (~1/10)
00083fb4: 00052c00 sll r5,r5,0x10
00083fb8: 0c060fed jal 0x00183fb4			get tiles data pointer
00083fbc: 00052c03 sra r5,r5,0x10
00083fc0: 00408021 addu r16,r2,r0			r16 = tile data pointer
00083fc4: 3292ffff andi r18,r20,0xffff			r18 = command byte + speed
00083fc8: 2e4200d2 sltiu r2,r18,0x00d2			set r2 = true if less than 0xd2
00083fcc: 10400071 beq r2,r0,0x00084194		#branch if not less than that
00083fd0: 34020001 ori r2,r0,0x0001				|r2 = 1
00083fd4: 92630130 lbu r3,0x0130(r19)				|load mount byte
00083fd8: 8e31001c lw r17,0x001c(r17)				|load SHP data pointer
00083fdc: 14620008 bne r3,r2,0x00084000			$branch if not riding something
00083fe0: 00000000 nop							|
00083fe4: 8e620144 lw r2,0x0144(r19)					|load status flags 5, 6, ? and ?
00083fe8: 00000000 nop							|
00083fec: 30420240 andi r2,r2,0x0240					|seperate Jumping and ?? bytes
00083ff0: 14400064 bne r2,r0,0x00084184				%branch if jumping or ??
00083ff4: 00121080 sll r2,r18,0x02						|r2 = 4 * (command byte + speed)
00083ff8: 0802105d j 0x00084174						@jump ahead
00083ffc: 00511021 addu r2,r2,r17						|r2 = SHP data pointer + above
00084000: 92020003 lbu r2,0x0003(r16)					$load tile depth
00084004: 00000000 nop							|
00084008: 304200e0 andi r2,r2,0x00e0					|seperate depth flags
0008400c: 1040005c beq r2,r0,0x00084180				$branch if no depth
00084010: 00000000 nop								|
00084014: 8e640134 lw r4,0x0134(r19)						|load pointer to unit data
00084018: 00000000 nop								|
0008401c: 10800040 beq r4,r0,0x00084120					&branch if null pointer
00084020: 00000000 nop									|
00084024: 0c05fc08 jal 0x0017f020							|Float/Float/Fly movements
00084028: 00000000 nop									|
0008402c: 8e630144 lw r3,0x0144(r19)							|load status flags 5, 6, ? and ?
00084030: 00000000 nop									|
00084034: 30630020 andi r3,r3,0x0020							|seperate float status
00084038: 14600051 bne r3,r0,0x00084180						$branch if float status?
0008403c: 00402021 addu r4,r2,r0								|r4 = depth flags
00084040: 30820020 andi r2,r4,0x0020
00084044: 1440004f bne r2,r0,0x00084184			branch if ??
00084048: 00121080 sll r2,r18,0x02
0008404c: 30820040 andi r2,r4,0x0040
00084050: 1440004c bne r2,r0,0x00084184			branch if ??
00084054: 00121080 sll r2,r18,0x02
00084058: 92630006 lbu r3,0x0006(r19)			load spritesheet
0008405c: 3402009b ori r2,r0,0x009b
00084060: 10620047 beq r3,r2,0x00084180			branch if WEP2?
00084064: 3402009e ori r2,r0,0x009e
00084068: 10620046 beq r3,r2,0x00084184			branch if ??
0008406c: 00121080 sll r2,r18,0x02
00084070: 92620006 lbu r2,0x0006(r19)			load spritesheet
00084074: 00000000 nop
00084078: 24420064 addiu r2,r2,0x0064
0008407c: 304200ff andi r2,r2,0x00ff
00084080: 2c420002 sltiu r2,r2,0x0002
00084084: 10400010 beq r2,r0,0x000840c8			branch if ???
00084088: 00000000 nop
0008408c: 92020003 lbu r2,0x0003(r16)			load height/depth
00084090: 92030002 lbu r3,0x0002(r16)			load height?
00084094: 00021142 srl r2,r2,0x05
00084098: 00621821 addu r3,r3,r2
0008409c: 00031040 sll r2,r3,0x01
000840a0: 00431021 addu r2,r2,r3
000840a4: 86630042 lh r3,0x0042(r19)			load height mod
000840a8: 00021080 sll r2,r2,0x02
000840ac: 00031823 subu r3,r0,r3
000840b0: 24630004 addiu r3,r3,0x0004
000840b4: 0043102a slt r2,r2,r3
000840b8: 1040002c beq r2,r0,0x0008416c
000840bc: 3282ffff andi r2,r20,0xffff
000840c0: 08021061 j 0x00084184
000840c4: 00021080 sll r2,r2,0x02
000840c8: 92020003 lbu r2,0x0003(r16)
000840cc: 92030002 lbu r3,0x0002(r16)
000840d0: 00021142 srl r2,r2,0x05
000840d4: 00621821 addu r3,r3,r2
000840d8: 00031040 sll r2,r3,0x01
000840dc: 00431021 addu r2,r2,r3
000840e0: 86630042 lh r3,0x0042(r19)
000840e4: 00022080 sll r4,r2,0x02
000840e8: 00031823 subu r3,r0,r3
000840ec: 24620024 addiu r2,r3,0x0024
000840f0: 0082102a slt r2,r4,r2
000840f4: 10400017 beq r2,r0,0x00084154
000840f8: 2462000c addiu r2,r3,0x000c
000840fc: 0082102a slt r2,r4,r2
00084100: 14400004 bne r2,r0,0x00084114
00084104: 00000000 nop
00084108: 3282ffff andi r2,r20,0xffff
0008410c: 0802105c j 0x00084170
00084110: 00021080 sll r2,r2,0x02
00084114: 3282ffff andi r2,r20,0xffff
00084118: 08021061 j 0x00084184
0008411c: 00021080 sll r2,r2,0x02
00084120: 92020003 lbu r2,0x0003(r16)
00084124: 92030002 lbu r3,0x0002(r16)
00084128: 00021142 srl r2,r2,0x05
0008412c: 00621821 addu r3,r3,r2
00084130: 00031040 sll r2,r3,0x01
00084134: 00431021 addu r2,r2,r3
00084138: 86630042 lh r3,0x0042(r19)
0008413c: 00022080 sll r4,r2,0x02
00084140: 00031823 subu r3,r0,r3
00084144: 24620024 addiu r2,r3,0x0024
00084148: 0082102a slt r2,r4,r2
0008414c: 14400004 bne r2,r0,0x00084160
00084150: 2462000c addiu r2,r3,0x000c
00084154: 8e220348 lw r2,0x0348(r17)
00084158: 08021078 j 0x000841e0
0008415c: aef10000 sw r17,0x0000(r23)
00084160: 0082102a slt r2,r4,r2
00084164: 14400007 bne r2,r0,0x00084184
00084168: 00121080 sll r2,r18,0x02
0008416c: 00121080 sll r2,r18,0x02
00084170: 00511021 addu r2,r2,r17
00084174: 8c420348 lw r2,0x0348(r2)
00084178: 08021078 j 0x000841e0
0008417c: aef10000 sw r17,0x0000(r23)
if no depth set
00084180: 00121080 sll r2,r18,0x02
00084184: 00511021 addu r2,r2,r17
00084188: 8c420008 lw r2,0x0008(r2)
0008418c: 08021078 j 0x000841e0
00084190: aef10000 sw r17,0x0000(r23)
00084194: 3c11800b lui r17,0x800b
00084198: 2631f244 addiu r17,r17,0xf244
0008419c: 32a2ffff andi r2,r21,0xffff			#
000841a0: 2c420258 sltiu r2,r2,0x0258
000841a4: 10400002 beq r2,r0,0x000841b0
000841a8: 00000000 nop
000841ac: 26318a9c addiu r17,r17,0x8a9c
000841b0: 92020003 lbu r2,0x0003(r16)
000841b4: 00000000 nop
000841b8: 304200e0 andi r2,r2,0x00e0
000841bc: 10400005 beq r2,r0,0x000841d4
000841c0: 00121080 sll r2,r18,0x02
000841c4: 02221021 addu r2,r17,r2
000841c8: 8c420000 lw r2,0x0000(r2)
000841cc: 08021078 j 0x000841e0
000841d0: aef10000 sw r17,0x0000(r23)
000841d4: 02221021 addu r2,r17,r2
000841d8: 8c42fcc0 lw r2,-0x0340(r2)
000841dc: aef10000 sw r17,0x0000(r23)			store
000841e0: aec20000 sw r2,0x0000(r22)			store
000841e4: 8fbf0030 lw r31,0x0030(r29)
000841e8: 8fb7002c lw r23,0x002c(r29)
000841ec: 8fb60028 lw r22,0x0028(r29)
000841f0: 8fb50024 lw r21,0x0024(r29)
000841f4: 8fb40020 lw r20,0x0020(r29)
000841f8: 8fb3001c lw r19,0x001c(r29)
000841fc: 8fb20018 lw r18,0x0018(r29)
00084200: 8fb10014 lw r17,0x0014(r29)
00084204: 8fb00010 lw r16,0x0010(r29)
00084208: 27bd0038 addiu r29,r29,0x0038
0008420c: 03e00008 jr r31
00084210: 00000000 nop