Copy SEQ data into RAM

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search

000871f4: 27bdfff8 addiu r29,r29,0xfff8
000871f8: 00a05021 addu r10,r5,r0			ram file address to copy from
000871fc: 00003021 addu r6,r0,r0
00087200: 240bffff addiu r11,r0,0xffff
00087204: 00804021 addu r8,r4,r0			address of file to copy to (SEQ)
00087208: 24a70004 addiu r7,r5,0x0004			SEQ + 4 (start of animation addresses)
0008720c: 3c09800a lui r9,0x800a
00087210: 8d291c58 lw r9,0x1c58(r9)			animation data start address as parsed
00087214: 90a20001 lbu r2,0x0001(r5)			load animation ID of start of attacking animations
00087218: 90a30000 lbu r3,0x0000(r5)			"
0008721c: 00021200 sll r2,r2,0x08
00087220: 00621821 addu r3,r3,r2
00087224: ad030000 sw r3,0x0000(r8)			Store at SEQ address
00087228: 90a20003 lbu r2,0x0003(r5)
0008722c: 90a30002 lbu r3,0x0002(r5)
00087230: 00021200 sll r2,r2,0x08
00087234: 00621821 addu r3,r3,r2
00087238: ad030004 sw r3,0x0004(r8)			same deal but start of SP2 file animations
0008723c: 90e20001 lbu r2,0x0001(r7)
00087240: 90e40000 lbu r4,0x0000(r7)
00087244: 90e30002 lbu r3,0x0002(r7)
00087248: 00021200 sll r2,r2,0x08
0008724c: 00822021 addu r4,r4,r2
00087250: 00031c00 sll r3,r3,0x10
00087254: 90e20003 lbu r2,0x0003(r7)			index as determined by animation ID
00087258: 00832021 addu r4,r4,r3
0008725c: 00021600 sll r2,r2,0x18
00087260: 00821021 addu r2,r4,r2
00087264: 144b0002 bne r2,r11,0x00087270		branch if not invalid
00087268: 24e70004 addiu r7,r7,0x0004
0008726c: 00001021 addu r2,r0,r0			set to 0 if invalid
00087270: 00491021 addu r2,r2,r9			add to animation instruction pointer
00087274: ad020008 sw r2,0x0008(r8)			store in SEQ animation pointers
00087278: 24c60001 addiu r6,r6,0x0001
0008727c: 2cc20100 sltiu r2,r6,0x0100
00087280: 1440ffee bne r2,r0,0x0008723c		repeat 0x100 times
00087284: 25080004 addiu r8,r8,0x0004
00087288: 91420405 lbu r2,0x0405(r10)
0008728c: 91430404 lbu r3,0x0404(r10)			length of animation instructions
00087290: 00021200 sll r2,r2,0x08
00087294: 00622021 addu r4,r3,r2
00087298: 1080000b beq r4,r0,0x000872c8		branch if 0
0008729c: 00003021 addu r6,r0,r0
000872a0: 24a50406 addiu r5,r5,0x0406			points to start of animation instructions
000872a4: 3c02800a lui r2,0x800a
000872a8: 8c421c58 lw r2,0x1c58(r2)
000872ac: 90a30000 lbu r3,0x0000(r5)
000872b0: 00461021 addu r2,r2,r6
000872b4: 24c60001 addiu r6,r6,0x0001
000872b8: a0430000 sb r3,0x0000(r2)
000872bc: 00c4102b sltu r2,r6,r4
000872c0: 1440fff8 bne r2,r0,0x000872a4		loop copying every byte until reached end of file.
000872c4: 24a50001 addiu r5,r5,0x0001
000872c8: 3c02800a lui r2,0x800a
000872cc: 8c421c58 lw r2,0x1c58(r2)			load animation data start address
000872d0: 00000000 nop
000872d4: 00c21021 addu r2,r6,r2			add final length of data in RAM
000872d8: 3c01800a lui r1,0x800a
000872dc: ac221c58 sw r2,0x1c58(r1)			store end of animation data address as start of next (repeated for all but ruka/arute/kanzen; handled last anyway.)
000872e0: 27bd0008 addiu r29,r29,0x0008
000872e4: 03e00008 jr r31
000872e8: 00000000 nop