Load WEP/EFF graphics from WEP1/EFF Sheet

From Final Fantasy Hacktics Wiki
Revision as of 12:02, 22 June 2021 by Talcall (talk | contribs) (will continue tomorrow, doing my best to flesh this out)
Jump to navigation Jump to search

Load WEP graphic from WEP1 Sheet Expects r4 = pointer to miscellaneous unit data (presumably for attacker). Expects r5 = WEP1 sprite data (lies within r4 table ^^) Expects r7 = 0x01 in the case of a broadsword at equal tile height. r19 & r18 & r17 = r4, however r19 is overridden quickly by r5.

 0008526c: 27bdff98 addiu r29,r29,0xff98
 00085270: afbe0060 sw r30,0x0060(r29)
 00085274: 0080f021 addu r30,r4,r0               r30 = Points to misc. unit data data
 00085278: afb3004c sw r19,0x004c(r29)
 0008527c: 00a09821 addu r19,r5,r0              r19 = WEP sprite data
 00085280: afb7005c sw r23,0x005c(r29)
 00085284: 00e0b821 addu r23,r7,r0              r23 = value?
 00085288: afbf0064 sw r31,0x0064(r29)
 0008528c: afb60058 sw r22,0x0058(r29)
 00085290: afb50054 sw r21,0x0054(r29)
 00085294: afb40050 sw r20,0x0050(r29)
 00085298: afb20048 sw r18,0x0048(r29)
 0008529c: afb10044 sw r17,0x0044(r29)
 000852a0: afb00040 sw r16,0x0040(r29)
 000852a4: afa60028 sw r6,0x0028(r29)            r6 is preserved? (important information?)
 000852a8: 93c2013a lbu r2,0x013a(r30)            load used weapon
 000852ac: 96760004 lhu r22,0x0004(r19)            load current animation
 000852b0: 00021040 sll r2,r2,0x01               r2 = weapon ID * 2
 000852b4: 3c018009 lui r1,0x8009
 000852b8: 00220821 addu r1,r1,r2                r1 = 0x80090000 + ID * 2
 000852bc: 902243e5 lbu r2,0x43e5(r1)              load used weapon graphic ID
 000852c0: 96710006 lhu r17,0x0006(r19)            load ? (palette seems like a reasonable guess)
 000852c4: 000210c0 sll r2,r2,0x03 
 000852c8: a7a20038 sh r2,0x0038(r29)              store used weapon graphic ID*8
 000852cc: 8e75001c lw r21,0x001c(r19)            load SHP data
 000852d0: 8e740020 lw r20,0x0020(r19)            load SEQ data
 000852d4: 16e00002 bne r23,r0,0x000852e0          branch if value(?) != 0 (dodge flag?)
 000852d8: 32d0ffff andi r16,r22,0xffff            r16 = animation #
 000852dc: 2631fffe addiu r17,r17,0xfffe           palette(?) - 2
 000852e0: 2e020101 sltiu r2,r16,0x0101            set if animation < 0x101
 000852e4: 14400004 bne r2,r0,0x000852f8            #branch if so
 000852e8: 00101080 sll r2,r16,0x02                  | animation*4
 000852ec: 0c011282 jal 0x00044a08                   | 00044a08 - 00044a30
 000852f0: 34040009 ori r4,r0,0x0009                 | clears r4 and moves 0x09 to r5. for some reason.
 000852f4: 00101080 sll r2,r16,0x02                  | r2 = weapon anim*4
 000852f8: 00541021 addu r2,r2,r20                  #r2 = WP anim*4 + SEQ data location
 000852fc: 8c430000 lw r3,0x0000(r2)                load ??? from SEQ table (Make a new page for SEQ and SHP?) (Also note, this is definitely NOT an address, most of these words end in numbers that are not multiples of 4.)
 00085300: 2402ffff addiu r2,r0,0xffff              this seems to be a rather redundant check for garbage data.
 00085304: 14620005 bne r3,r2,0x0008531c            branch if ??? (from SEQ table) is not 0xffff
 00085308: 00161880 sll r3,r22,0x02                 r3 = weapon anim*4
 0008530c: 34040009 ori r4,r0,0x0009                r4 = 0x9
 00085310: 0c011282 jal 0x00044a08                  00044a08 - 00044a30 clears r4 and moves to r5
 00085314: 00000000 nop
 00085318: 00161880 sll r3,r22,0x02                r3 = weapon anim*4
 0008531c: 00741821 addu r3,r3,r20                 animation*4 + SEQ data
 00085320: 00111400 sll r2,r17,0x10                r2 = r17 * 2^16
 00085324: 8c650000 lw r5,0x0000(r3)               Load ??? from SEQ table AGAIN
 00085328: 00021403 sra r2,r2,0x10                 r2 = first halfword of r17 (even though it was already a halfword and unsigned)
 0008532c: 00a21021 addu r2,r5,r2                  r2 = r2 + r5
 00085330: 90430000 lbu r3,0x0000(r2)              load ???
 00085334: 340200ff ori r2,r0,0x00ff
 00085338: 146200f5 bne r3,r2,0x00085710            branch if ??? is not ff
 0008533c: 00111c00 sll r3,r17,0x10                r3 = r17 * 2^16 (Moves halfword to upper half)
 00085340: 26230001 addiu r3,r17,0x0001            r3 = r17 + 1
 00085344: 00031400 sll r2,r3,0x10                  
 00085348: 00021403 sra r2,r2,0x10                 a stupid long way of moving r17 to r2
 0008534c: 00a21021 addu r2,r5,r2                  r2 = r2 + r5
 00085350: 90420000 lbu r2,0x0000(r2)              Load ???
 00085354: 24710001 addiu r17,r3,0x0001            r17 = r3 + 1
 00085358: 2443ff2d addiu r3,r2,0xff2d             r3 = ??? - 0xd3
 0008535c: 2c62002d sltiu r2,r3,0x002d             set r2 = true if r3 < 0x00d2
 00085360: 104000e9 beq r2,r0,0x00085708           branch if not true
 00085364: 00031080 sll r2,r3,0x02                 r2 = r3 * 4
 00085368: 3c018007 lui r1,0x8007
 0008536c: 00220821 addu r1,r1,r2                  r1 = 0x80070000 + r2
 00085370: 8c228028 lw r2,-0x7fd8(r1)              loads a word from the table at this location, based on weapon and angle (Link a new page with the table here? for example, broadsword down-left grabs the return value 0x80090430?)
 00085374: 00000000 nop
 00085378: 00400008 jr r2                          jumps to address
 0008537c: 00000000 nop
 00085380: 96620018 lhu r2,0x0018(r19)
 00085384: 00000000 nop
 00085388: 38420002 xori r2,r2,0x0002
 0008538c: 080214c6 j 0x00085318
 00085390: a6620018 sh r2,0x0018(r19)
 00085394: 96620018 lhu r2,0x0018(r19)
 00085398: 00000000 nop
 0008539c: 38420004 xori r2,r2,0x0004
 000853a0: 080214c6 j 0x00085318
 000853a4: a6620018 sh r2,0x0018(r19)
 000853a8: a6600000 sh r0,0x0000(r19)
 000853ac: 08021679 j 0x000859e4
 000853b0: a660000a sh r0,0x000a(r19)
 000853b4: 9662000c lhu r2,0x000c(r19)
 000853b8: 00008821 addu r17,r0,r0
 000853bc: 24420001 addiu r2,r2,0x0001
 000853c0: 080214c6 j 0x00085318
 000853c4: a662000c sh r2,0x000c(r19)
 000853c8: 8e620024 lw r2,0x0024(r19)
 000853cc: 080214c6 j 0x00085318
 000853d0: a440000c sh r0,0x000c(r2)
 000853d4: 0c01a269 jal 0x000689a4
 000853d8: 03c02021 addu r4,r30,r0
 000853dc: 080214c6 j 0x00085318
 000853e0: 26310002 addiu r17,r17,0x0002
 000853e4: 96710010 lhu r17,0x0010(r19)
 000853e8: 9676000e lhu r22,0x000e(r19)
 000853ec: 080214c7 j 0x0008531c
 000853f0: 00161880 sll r3,r22,0x02
 000853f4: 00161880 sll r3,r22,0x02
 000853f8: 00741821 addu r3,r3,r20
 000853fc: 02201021 addu r2,r17,r0
 00085400: 00021400 sll r2,r2,0x10
 00085404: 8c630000 lw r3,0x0000(r3)
 00085408: 00021403 sra r2,r2,0x10
 0008540c: 00621821 addu r3,r3,r2
 00085410: 90620000 lbu r2,0x0000(r3)
 00085414: 26310001 addiu r17,r17,0x0001
 00085418: 080214c6 j 0x00085318
 0008541c: a7c20014 sh r2,0x0014(r30)
 00085420: 3c028009 lui r2,0x8009
 00085424: 8c42612c lw r2,0x612c(r2)
 00085428: 00000000 nop
 0008542c: 144000a8 bne r2,r0,0x000856d0
 00085430: 00161080 sll r2,r22,0x02
 00085434: 080214c6 j 0x00085318
 00085438: 26310001 addiu r17,r17,0x0001
 0008543c: 02201021 addu r2,r17,r0
 00085440: 26310001 addiu r17,r17,0x0001
 00085444: 00161880 sll r3,r22,0x02
 00085448: 00741821 addu r3,r3,r20
 0008544c: 00021400 sll r2,r2,0x10
 00085450: 8c630000 lw r3,0x0000(r3)
 00085454: 00021403 sra r2,r2,0x10
 00085458: 00621821 addu r3,r3,r2
 0008545c: 90650000 lbu r5,0x0000(r3)
 00085460: 0c01ae58 jal 0x0006b960
 00085464: 03c02021 addu r4,r30,r0
 00085468: 080214c7 j 0x0008531c
 0008546c: 00161880 sll r3,r22,0x02
 00085470: 00161880 sll r3,r22,0x02
 00085474: 00741821 addu r3,r3,r20
 00085478: 02201021 addu r2,r17,r0
 0008547c: 00021400 sll r2,r2,0x10
 00085480: 8c630000 lw r3,0x0000(r3)
 00085484: 00021403 sra r2,r2,0x10
 00085488: 00621821 addu r3,r3,r2
 0008548c: 90620000 lbu r2,0x0000(r3)
 00085490: 26310001 addiu r17,r17,0x0001
 00085494: 00021600 sll r2,r2,0x18
 00085498: 00021603 sra r2,r2,0x18
 0008549c: 080214c6 j 0x00085318
 000854a0: a6620012 sh r2,0x0012(r19)
 000854a4: 00161880 sll r3,r22,0x02
 000854a8: 00741821 addu r3,r3,r20
 000854ac: 02201021 addu r2,r17,r0
 000854b0: 00021400 sll r2,r2,0x10
 000854b4: 8c630000 lw r3,0x0000(r3)
 000854b8: 00021403 sra r2,r2,0x10
 000854bc: 00621821 addu r3,r3,r2
 000854c0: 90620000 lbu r2,0x0000(r3)
 000854c4: 26310001 addiu r17,r17,0x0001
 000854c8: 00021600 sll r2,r2,0x18
 000854cc: 00021603 sra r2,r2,0x18
 000854d0: 080214c6 j 0x00085318
 000854d4: a6620014 sh r2,0x0014(r19)
 000854d8: 00161080 sll r2,r22,0x02
 000854dc: 00541021 addu r2,r2,r20
 000854e0: 02201821 addu r3,r17,r0
 000854e4: 00031c00 sll r3,r3,0x10
 000854e8: a676000e sh r22,0x000e(r19)
 000854ec: 8c420000 lw r2,0x0000(r2)
 000854f0: 00031c03 sra r3,r3,0x10
 000854f4: 00431021 addu r2,r2,r3
 000854f8: 90560000 lbu r22,0x0000(r2)
 000854fc: 26310001 addiu r17,r17,0x0001
 00085500: a6710010 sh r17,0x0010(r19)
 00085504: 080214c6 j 0x00085318
 00085508: 00008821 addu r17,r0,r0
 0008550c: 00162080 sll r4,r22,0x02
 00085510: 00942021 addu r4,r4,r20
 00085514: 00111400 sll r2,r17,0x10
 00085518: 00021403 sra r2,r2,0x10
 0008551c: 26250001 addiu r5,r17,0x0001
 00085520: 8c830000 lw r3,0x0000(r4)
 00085524: 24b10001 addiu r17,r5,0x0001
 00085528: 00621821 addu r3,r3,r2
 0008552c: 90620000 lbu r2,0x0000(r3)
 00085530: 97c30058 lhu r3,0x0058(r30)
 00085534: 00021600 sll r2,r2,0x18
 00085538: 00021603 sra r2,r2,0x18
 0008553c: 00431021 addu r2,r2,r3
 00085540: a7c20058 sh r2,0x0058(r30)
 00085544: 00051400 sll r2,r5,0x10
 00085548: 8c830000 lw r3,0x0000(r4)
 0008554c: 00021403 sra r2,r2,0x10
 00085550: 00621821 addu r3,r3,r2
 00085554: 90620000 lbu r2,0x0000(r3)
 00085558: 97c3005a lhu r3,0x005a(r30)
 0008555c: 00021600 sll r2,r2,0x18
 00085560: 00021603 sra r2,r2,0x18
 00085564: 00431021 addu r2,r2,r3
 00085568: 080214c6 j 0x00085318
 0008556c: a7c2005a sh r2,0x005a(r30)
 00085570: 26260001 addiu r6,r17,0x0001
 00085574: 00112400 sll r4,r17,0x10
 00085578: 24d10001 addiu r17,r6,0x0001
 0008557c: 00161080 sll r2,r22,0x02
 00085580: 00541021 addu r2,r2,r20
 00085584: 00042403 sra r4,r4,0x10
 00085588: 8c430000 lw r3,0x0000(r2)
 0008558c: 00061400 sll r2,r6,0x10
 00085590: 00021403 sra r2,r2,0x10
 00085594: 00642021 addu r4,r3,r4
 00085598: 00621821 addu r3,r3,r2
 0008559c: 90820000 lbu r2,0x0000(r4)
 000855a0: 90640000 lbu r4,0x0000(r3)
 000855a4: 96630016 lhu r3,0x0016(r19)
 000855a8: 00021600 sll r2,r2,0x18
 000855ac: 1060000b beq r3,r0,0x000855dc
 000855b0: 00022e03 sra r5,r2,0x18
 000855b4: 96620016 lhu r2,0x0016(r19)
 000855b8: 00000000 nop
 000855bc: 2442ffff addiu r2,r2,0xffff
 000855c0: a6620016 sh r2,0x0016(r19)
 000855c4: 3042ffff andi r2,r2,0xffff
 000855c8: 1040ff54 beq r2,r0,0x0008531c
 000855cc: 00161880 sll r3,r22,0x02
 000855d0: 24c2fffd addiu r2,r6,0xfffd
 000855d4: 080214c7 j 0x0008531c
 000855d8: 00a28821 addu r17,r5,r2
 000855dc: 24c2fffd addiu r2,r6,0xfffd
 000855e0: 00a28821 addu r17,r5,r2
 000855e4: 080214c6 j 0x00085318
 000855e8: a6640016 sh r4,0x0016(r19)
 000855ec: 26230001 addiu r3,r17,0x0001
 000855f0: 00112400 sll r4,r17,0x10
 000855f4: 24710001 addiu r17,r3,0x0001
 000855f8: 00161080 sll r2,r22,0x02
 000855fc: 00541021 addu r2,r2,r20
 00085600: 00042403 sra r4,r4,0x10
 00085604: 00031c00 sll r3,r3,0x10
 00085608: 8c420000 lw r2,0x0000(r2)
 0008560c: 00031c03 sra r3,r3,0x10
 00085610: 00442021 addu r4,r2,r4
 00085614: 00431021 addu r2,r2,r3
 00085618: 90900000 lbu r16,0x0000(r4)
 0008561c: 90520000 lbu r18,0x0000(r2)
 00085620: 16000004 bne r16,r0,0x00085634
 00085624: 00101040 sll r2,r16,0x01
 00085628: 0c011282 jal 0x00044a08
 0008562c: 3404000d ori r4,r0,0x000d
 00085630: 00101040 sll r2,r16,0x01
 00085634: 00501021 addu r2,r2,r16
 00085638: 00021100 sll r2,r2,0x04
 0008563c: 244201d8 addiu r2,r2,0x01d8
 00085640: 03c21021 addu r2,r30,r2
 00085644: 34030001 ori r3,r0,0x0001
 00085648: a4520004 sh r18,0x0004(r2)
 0008564c: a4400006 sh r0,0x0006(r2)
 00085650: a443000a sh r3,0x000a(r2)
 00085654: a4400012 sh r0,0x0012(r2)
 00085658: a4400014 sh r0,0x0014(r2)
 0008565c: a4400016 sh r0,0x0016(r2)
 00085660: 080214c6 j 0x00085318
 00085664: a4430000 sh r3,0x0000(r2)
 00085668: 26230001 addiu r3,r17,0x0001
 0008566c: 00112400 sll r4,r17,0x10
 00085670: 24710001 addiu r17,r3,0x0001
 00085674: 00161080 sll r2,r22,0x02
 00085678: 00541021 addu r2,r2,r20
 0008567c: 00042403 sra r4,r4,0x10
 00085680: 00031c00 sll r3,r3,0x10
 00085684: 8c420000 lw r2,0x0000(r2)
 00085688: 00031c03 sra r3,r3,0x10
 0008568c: 00442021 addu r4,r2,r4
 00085690: 00431021 addu r2,r2,r3
 00085694: 90420000 lbu r2,0x0000(r2)
 00085698: 90840000 lbu r4,0x0000(r4)
 0008569c: 8e630024 lw r3,0x0024(r19)
 000856a0: 00021200 sll r2,r2,0x08
 000856a4: 00822025 or r4,r4,r2
 000856a8: 080214c6 j 0x00085318
 000856ac: a464000c sh r4,0x000c(r3)
 000856b0: 080214c6 j 0x00085318
 000856b4: 26310003 addiu r17,r17,0x0003
 000856b8: 3c038009 lui r3,0x8009
 000856bc: 8c63612c lw r3,0x612c(r3)
 000856c0: 34020001 ori r2,r0,0x0001
 000856c4: 1462000e bne r3,r2,0x00085700
 000856c8: 00000000 nop
 000856cc: 00161080 sll r2,r22,0x02
 000856d0: 00541021 addu r2,r2,r20
 000856d4: 00111c00 sll r3,r17,0x10
 000856d8: 8c420000 lw r2,0x0000(r2)
 000856dc: 00031c03 sra r3,r3,0x10
 000856e0: 00431021 addu r2,r2,r3
 000856e4: 90420000 lbu r2,0x0000(r2)
 000856e8: 00000000 nop
 000856ec: 00021600 sll r2,r2,0x18
 000856f0: 00022e03 sra r5,r2,0x18
 000856f4: 2622fffe addiu r2,r17,0xfffe
 000856f8: 080214c6 j 0x00085318
 000856fc: 00a28821 addu r17,r5,r2
 00085700: 080214c6 j 0x00085318
 00085704: 26310001 addiu r17,r17,0x0001
 00085708: 080214c4 j 0x00085310
 0008570c: 3404000d ori r4,r0,0x000d
 
 00085710: 00031c03 sra r3,r3,0x10                  queue stupid method of moving r17 to r3
 00085714: 00a31821 addu r3,r5,r3                   r3 = r5 + r3
 00085718: 93c2013b lbu r2,0x013b(r30)              load hi/low/mid mod
 0008571c: 90630000 lbu r3,0x0000(r3)               load ??? again
 00085720: 00021040 sll r2,r2,0x01                   mod*2
 00085724: 00551021 addu r2,r2,r21                  mod*2 + SHP data
 00085728: 94420000 lhu r2,0x0000(r2)               load frame
 0008572c: 96640014 lhu r4,0x0014(r19)              load ??
 00085730: 00621821 addu r3,r3,r2                   frame + ???
 00085734: 00832021 addu r4,r4,r3                   r4 = frame + ?? + ???
 00085738: a7a40030 sh r4,0x0030(r29)               store frame?????
 0008573c: 12e0000a beq r23,r0,0x00085768          branch if pv = 0?
 00085740: 26240001 addiu r4,r17,0x0001             increment animation counter? animation loading counter?
 00085744: 00041400 sll r2,r4,0x10
 00085748: 00021403 sra r2,r2,0x10                  queue further stupidity moving register values
 0008574c: 00a21021 addu r2,r5,r2                   SHP + increment?
 00085750: 90420000 lbu r2,0x0000(r2)               load ???
 00085754: 96630012 lhu r3,0x0012(r19)              load ??
 00085758: 24910001 addiu r17,r4,0x0001             increment again?
 0008575c: 00431021 addu r2,r2,r3                   r2 = ?? + ???
 00085760: 080215db j 0x0008576c                    jump ahead
 00085764: a662000a sh r2,0x000a(r19)               store 0x0a in WEp data
 00085768: 24910001 addiu r17,r4,0x0001             increments r17 if skipped
 0008576c: 97a30030 lhu r3,0x0030(r29)              Load frame?????
 00085770: 00000000 nop
 00085774: 00031080 sll r2,r3,0x02                  r2 = Frame?????*4
 00085778: 00551021 addu r2,r2,r21                  SHP data to do with frame and attacking angle?
 0008577c: 2c630201 sltiu r3,r3,0x0201              Set r3 = true if frame????? is less than 0x201
 00085780: 8c550040 lw r21,0x0040(r2)               Loads another pointer from the pointer above
 00085784: 14600004 bne r3,r0,0x00085798            branch if frame????? is less than 0x201
 00085788: 2402ffff addiu r2,r0,0xffff              r2 = 0xffffffff
 0008578c: 0c011282 jal 0x00044a08
 00085790: 34040008 ori r4,r0,0x0008
 00085794: 2402ffff addiu r2,r0,0xffff
 00085798: 16a20003 bne r21,r2,0x000857a8
 0008579c: 00000000 nop
 000857a0: 0c011282 jal 0x00044a08
 000857a4: 34040008 ori r4,r0,0x0008
 
 000857a8: 92a20000 lbu r2,0x0000(r21)              load something from WEP1 SHP specific data?
 000857ac: 8e720024 lw r18,0x0024(r19)              load ? Display (3 bytes of data + 1 byte padding)
 000857b0: 30420007 andi r2,r2,0x0007               filters out 0x4, 0x2, and 0x1 bit flags?
 000857b4: 24420001 addiu r2,r2,0x0001              r2 = r2 + 1
 000857b8: a2420003 sb r2,0x0003(r18)               save r2 to ? display
 000857bc: 92a30000 lbu r3,0x0000(r21)              load something from WEP1 SHP specific data?
 000857c0: 00000000 nop
 000857c4: 000318c2 srl r3,r3,0x03                  r3 = r3/8
 000857c8: 00031840 sll r3,r3,0x01                  r3 = r3*2
 000857cc: 3c018009 lui r1,0x8009
 000857d0: 00230821 addu r1,r1,r3
 000857d4: 94244508 lhu r4,0x4508(r1)                load spin on Y axis? (???)
 000857d8: 00000000 nop
 000857dc: a644000c sh r4,0x000c(r18)                store spin on Y axis? (???? stores something in WEP1 Sprite?)
 000857e0: 97c30012 lhu r3,0x0012(r30)               load action halfword? (transparent checks, and moving/acting?)
 000857e4: 00000000 nop
 000857e8: 30630002 andi r3,r3,0x0002                checks for moving/acting?
 000857ec: 10600003 beq r3,r0,0x000857fc             branch if not animated? acting?
 000857f0: 305400ff andi r20,r2,0x00ff               move r2 to r20
 000857f4: 00041023 subu r2,r0,r4
 000857f8: a642000c sh r2,0x000c(r18)                store ??
 000857fc: 2e820004 sltiu r2,r20,0x0004              set r2 = true if r20 < 0x4
 00085800: 14400002 bne r2,r0,0x0008580c             branch if so
 00085804: 34020001 ori r2,r0,0x0001                 r2 = 1
 00085808: 34140003 ori r20,r0,0x0003
 0008580c: 96630002 lhu r3,0x0002(r19)               (Talcall's note, getting late, will continue here tomorrow as I step by step 1 instruction at a time in my debugger)
 00085810: 92b70001 lbu r23,0x0001(r21)
 00085814: 10620005 beq r3,r2,0x0008582c
 00085818: 34020002 ori r2,r0,0x0002
 0008581c: 1062003a beq r3,r2,0x00085908
 00085820: 32e20060 andi r2,r23,0x0060
 00085824: 08021675 j 0x000859d4
 00085828: a6710006 sh r17,0x0006(r19)
 0008582c: 32e20060 andi r2,r23,0x0060
 00085830: 34420009 ori r2,r2,0x0009                 r2 + 9
 00085834: 00008021 addu r16,r0,r0
 00085838: a6420004 sh r2,0x0004(r18)                store VRAM spritesheet ID
 0008583c: 8fac0028 lw r12,0x0028(r29)
 00085840: 97c20010 lhu r2,0x0010(r30)               load VRAM Palette ID
 00085844: 000c1980 sll r3,r12,0x06                  
 00085848: 00431021 addu r2,r2,r3
 0008584c: 24420080 addiu r2,r2,0x0080
 00085850: 1280005f beq r20,r0,0x000859d0
 00085854: a6420006 sh r2,0x0006(r18)                store VRAM palette ID
 00085858: 3205ffff andi r5,r16,0xffff
 0008585c: 00051080 sll r2,r5,0x02
 00085860: 24420002 addiu r2,r2,0x0002
 00085864: 02a21021 addu r2,r21,r2                    WEP1 SHP + ??
 00085868: 02402021 addu r4,r18,r0
 0008586c: 26100001 addiu r16,r16,0x0001
 00085870: 944b0002 lhu r11,0x0002(r2)               load ??
 00085874: 80460000 lb r6,0x0000(r2)                 load ??
 00085878: 80470001 lb r7,0x0001(r2)                  load ??
 0008587c: 97ac0038 lhu r12,0x0038(r29)              load weapon graphic ID*8 (in battle sprite from WEP1)
 00085880: 31633c00 andi r3,r11,0x3c00              r3 = size
 00085884: 000319c2 srl r3,r3,0x07
 00085888: 316203ff andi r2,r11,0x03ff              r2 = Y Tile offset
 0008588c: 3048001f andi r8,r2,0x001f               r8 = X tile offset
 00085890: 000840c0 sll r8,r8,0x03                  X offset*8
 00085894: 00021142 srl r2,r2,0x05
 00085898: 000210c0 sll r2,r2,0x03                  Y offset*8
 0008589c: 01821021 addu r2,r12,r2                  weapon graphic ID*8 + Y offset*8
 000858a0: 3c018009 lui r1,0x8009
 000858a4: 00230821 addu r1,r1,r3
 000858a8: 8c2946c8 lw r9,0x46c8(r1)
 000858ac: 3c018009 lui r1,0x8009
 000858b0: 00230821 addu r1,r1,r3
 000858b4: 8c2a46cc lw r10,0x46cc(r1)
 000858b8: 32e30061 andi r3,r23,0x0061
 000858bc: afa20014 sw r2,0x0014(r29)               store Y offset on WEP sheet to load from
 000858c0: 3162c000 andi r2,r11,0xc000               r2 = X/Y reverse
 000858c4: 00021342 srl r2,r2,0x0d 
 000858c8: 00621825 or r3,r3,r2
 000858cc: afa80010 sw r8,0x0010(r29)               store X tile offset
 000858d0: afa30020 sw r3,0x0020(r29)               store reversal bytes
 000858d4: 00094cc0 sll r9,r9,0x13
 000858d8: 00094c03 sra r9,r9,0x10
 000858dc: 000a54c0 sll r10,r10,0x13
 000858e0: 000a5403 sra r10,r10,0x10
 000858e4: afa90018 sw r9,0x0018(r29)
 000858e8: 0c01ed3b jal 0x0007b4ec
 000858ec: afaa001c sw r10,0x001c(r29)
 
 000858f0: 3202ffff andi r2,r16,0xffff
 000858f4: 0054102b sltu r2,r2,r20
 000858f8: 1440ffd8 bne r2,r0,0x0008585c
 000858fc: 3205ffff andi r5,r16,0xffff
 00085900: 08021675 j 0x000859d4
 00085904: a6710006 sh r17,0x0006(r19)
 00085908: 34420008 ori r2,r2,0x0008
 0008590c: 00008021 addu r16,r0,r0
 00085910: a6420004 sh r2,0x0004(r18)
 00085914: 8fac0028 lw r12,0x0028(r29)
 00085918: 97c20010 lhu r2,0x0010(r30)
 0008591c: 000c1980 sll r3,r12,0x06
 00085920: 00431021 addu r2,r2,r3
 00085924: 24420080 addiu r2,r2,0x0080
 00085928: 12800029 beq r20,r0,0x000859d0
 0008592c: a6420006 sh r2,0x0006(r18)
 00085930: 3205ffff andi r5,r16,0xffff
 00085934: 00051080 sll r2,r5,0x02
 00085938: 24420002 addiu r2,r2,0x0002
 0008593c: 02a21021 addu r2,r21,r2
 00085940: 02402021 addu r4,r18,r0
 00085944: 26100001 addiu r16,r16,0x0001
 00085948: 944b0002 lhu r11,0x0002(r2)
 0008594c: 80460000 lb r6,0x0000(r2)
 00085950: 80470001 lb r7,0x0001(r2)
 00085954: 31633c00 andi r3,r11,0x3c00
 00085958: 000319c2 srl r3,r3,0x07
 0008595c: 316203ff andi r2,r11,0x03ff
 00085960: 3048001f andi r8,r2,0x001f
 00085964: 000840c0 sll r8,r8,0x03
 00085968: 00021142 srl r2,r2,0x05
 0008596c: 000210c0 sll r2,r2,0x03
 00085970: 3c018009 lui r1,0x8009
 00085974: 00230821 addu r1,r1,r3
 00085978: 8c2946c8 lw r9,0x46c8(r1)
 0008597c: 3c018009 lui r1,0x8009
 00085980: 00230821 addu r1,r1,r3
 00085984: 8c2a46cc lw r10,0x46cc(r1)
 00085988: 32e30061 andi r3,r23,0x0061
 0008598c: afa20014 sw r2,0x0014(r29)
 00085990: 3162c000 andi r2,r11,0xc000
 00085994: 00021342 srl r2,r2,0x0d
 00085998: 00621825 or r3,r3,r2
 0008599c: afa80010 sw r8,0x0010(r29)
 000859a0: afa30020 sw r3,0x0020(r29)
 000859a4: 00094cc0 sll r9,r9,0x13
 000859a8: 00094c03 sra r9,r9,0x10
 000859ac: 000a54c0 sll r10,r10,0x13
 000859b0: 000a5403 sra r10,r10,0x10
 000859b4: afa90018 sw r9,0x0018(r29)
 000859b8: 0c01ed3b jal 0x0007b4ec
 000859bc: afaa001c sw r10,0x001c(r29)
 000859c0: 3202ffff andi r2,r16,0xffff
 000859c4: 0054102b sltu r2,r2,r20
 000859c8: 1440ffda bne r2,r0,0x00085934
 000859cc: 3205ffff andi r5,r16,0xffff
 000859d0: a6710006 sh r17,0x0006(r19)
 000859d4: 97ac0030 lhu r12,0x0030(r29)
 000859d8: 00000000 nop
 000859dc: a66c0008 sh r12,0x0008(r19)
 000859e0: a6760004 sh r22,0x0004(r19)
 000859e4: 8fbf0064 lw r31,0x0064(r29)
 000859e8: 8fbe0060 lw r30,0x0060(r29)
 000859ec: 8fb7005c lw r23,0x005c(r29)
 000859f0: 8fb60058 lw r22,0x0058(r29)
 000859f4: 8fb50054 lw r21,0x0054(r29)
 000859f8: 8fb40050 lw r20,0x0050(r29)
 000859fc: 8fb3004c lw r19,0x004c(r29)
 00085a00: 8fb20048 lw r18,0x0048(r29)
 00085a04: 8fb10044 lw r17,0x0044(r29)
 00085a08: 8fb00040 lw r16,0x0040(r29)
 00085a0c: 27bd0068 addiu r29,r29,0x0068
 00085a10: 03e00008 jr r31
 00085a14: 00000000 nop



 Return locations:(?)
 r31 = 0x0008654c (this location has a jal, but more than 2 words prior)