Learn from Crystal
Jump to navigation
Jump to search
ROUTINE : LEARN FROM CRYSTAL ?
PARAMETERS: r4 = [In-battle unit pointer] r5 = ?
RETURNS: r2 = 0?
SECTION 1 : CHECKS AND SET UP
00180904: 27bdffe0 addiu r29,r29,0xffe0 00180908: afb00010 sw r16,0x0010(r29) 0018090c: 00808021 addu r16,r4,r0 # r16 = r4 00180910: afb10014 sw r17,0x0014(r29) 00180914: 00a08821 addu r17,r5,r0 # r17 = r5 00180918: afbf 0018 sw r31,0x 0018(r29) 0018091c: 0c062f5d jal 0x 0018bd74 # Routine: clear some temp in-battle unit data? 00180920: 2604018c addiu r4,r16,0x018c 00180924: 34020008 ori r2,r0,0x0008 # Temp in-battle data offsets : read/write 00180928: a202018e sb r2,0x018e(r16) 0018092c: 32220004 andi r2,r17,0x0004 # r2 = (r17 bit 0x04 check) 00180930: 10400007 beq r2,r0,0x 00180950 # IF (r2 != 0) 00180934: a20 0018c sb r0,0x018c(r16) # { 00180938: 3c058006 lui r5,0x8006 0018093c: 90a5628e lbu r5,0x628e(r5) # r5 = MEM[0x8006628e] 00180940: 0c063a7a jal 0x 0018e9e8 # Routine: ? (r4=[In-battle unit pointer]) 00180944: 02002021 addu r4,r16,r0 00180948: 0806027c j 0x 001809f0 # RETURN r2 0018094c: 00000000 nop # } 00180950: 32220002 andi r2,r17,0x0002 # r2 = (r17 bit 0x02 check) 00180954: 1040000d beq r2,r0,0x 0018098c # IF (r2 != 0) 00180958: 34020001 ori r2,r0,0x0001 # { 0018095c: a202018c sb r2,0x018c(r16) # (Mess with temp data) 00180960: 34020050 ori r2,r0,0x0050 00180964: a20201b1 sb r2,0x01b1(r16) 00180968: 9602002a lhu r2,0x002a(r16) 0018096c: 96040028 lhu r4,0x0028(r16) 00180970: 9603002e lhu r3,0x002e(r16) 00180974: 9605002c lhu r5,0x002c(r16) 00180978: a20 0018e sb r0,0x018e(r16) 0018097c: 00441023 subu r2,r2,r4 00180980: 00651823 subu r3,r3,r5 00180984: a6020192 sh r2,0x0192(r16) 00180988: a6030196 sh r3,0x0196(r16) # } 0018098c: 32220001 andi r2,r17,0x0001 # r2 = (r17 bit 0x01 check) 00180990: 10400017 beq r2,r0,0x 001809f0 # IF (r2 == 0), RETURN 0 00180994: 00001021 addu r2,r0,r0 # r2 = 0 00180998: 00004821 addu r9,r0,r0 # r9 = 0 0018099c: 3c088006 lui r8,0x8006 001809a0: 25086254 addiu r8,r8,0x6254 # r8 = MEM[0x80066254] 001809a4: 02002021 addu r4,r16,r0 # r4 = [Unit]
- SECTION 2 : BEGIN OUTER LOOP
001809a8: 24850099 addiu r5,r4,0x0099 # DO 001809ac: 01003021 addu r6,r8,r0 # { 001809b0: 2487009c addiu r7,r4,0x009c # r6 = r8
- SECTION 3 : BEGIN INNER LOOP
001809b4: 90a20000 lbu r2,0x0000(r5) # DO { 001809b8: 90c30000 lbu r3,0x0000(r6) # r2 = [Unit Action abilities] (r5th) 001809bc: 00000000 nop # r3 = [Crystal action abilities] (r6th) 001809c0: 00431025 or r2,r2,r3 001809c4: a0a20000 sb r2,0x0000(r5) # [Unit action abilities] = (Combination of r2 and r3) NOTE : r2 | r3 001809c8: 24a50001 addiu r5,r5,0x0001 # r5++ 001809cc: 00a7102a slt r2,r5,r7 # r6++ 001809d0: 1440fff8 bne r2,r0,0x 001809b4 # } WHILE (r5 < r7) 001809d4: 24c60001 addiu r6,r6,0x0001 # 001809d8: 25080003 addiu r8,r8,0x0003 # r8++ 001809dc: 25290001 addiu r9,r9,0x0001 # r9++ 001809e0: 29220013 slti r2,r9,0x0013 # r4 += 3 001809e4: 1440fff0 bne r2,r0,0x 001809a8 # } WHILE (r9 < 0x13) 001809e8: 24840003 addiu r4,r4,0x0003
- SECTION 4 : RETURN
001809ec: 00001021 addu r2,r0,r0 # RETURN 0 001809f0: 8fbf 0018 lw r31,0x 0018(r29) 001809f4: 8fb10014 lw r17,0x0014(r29) 001809f8: 8fb00010 lw r16,0x0010(r29) 001809fc: 27bd0020 addiu r29,r29,0x0020 00180a00: 03e00008 jr r31 00180a04: 00000000 nop
Return Locations
00072008: 000720a0: 00076708: 00076750: