Load Game
Jump to navigation
Jump to search
# ROUTINE: Load Game # Loads game data. # Parameters: # r4 = (p1) (Sometimes 0) # If 0, runs checksum and loads timer values (otherwise doesn't). # Returns: # r2 = 1 if load successful, 0 otherwise (wrong format, failed checksum) 80130338: 27bdffd8 addiu r29,r29,-0x0028 8013033c: afb40020 sw r20,0x0020(r29) 80130340: 0080a021 addu r20,r4,r0 # p1 80130344: 3c04801d lui r4,0x801d 80130348: 8c84d1ec lw r4,-0x2e14(r4) # baseLoadedDataPtr = *0x801cd1ec (=0x801df000) 8013034c: afbf0024 sw r31,0x0024(r29) 80130350: afb3001c sw r19,0x001c(r29) 80130354: afb20018 sw r18,0x0018(r29) 80130358: afb10014 sw r17,0x0014(r29) 8013035c: afb00010 sw r16,0x0010(r29) 80130360: 90830100 lbu r3,0x0100(r4) # baseLoadedDataPtr.0x100 80130364: 340200ff ori r2,r0,0x00ff 80130368: 10620005 beq r3,r2,0x80130380 8013036c: 34020004 ori r2,r0,0x0004 # if ((baseLoadedDataPtr.0x100 == 0xff) 80130370: 90830117 lbu r3,0x0117(r4) 80130374: 00000000 nop 80130378: 10620003 beq r3,r2,0x80130388 # || (baseLoadedDataPtr.0x117 != 4)) 8013037c: 00000000 nop # { 80130380: 0804c21d j 0x80130874 # return 0; 80130384: 00001021 addu r2,r0,r0 # } 80130388: 16800020 bne r20,r0,0x8013040c 8013038c: 00009021 addu r18,r0,r0 # index = 0 # if (p1 == 0) { // Checksum section 80130390: 0c04ac6d jal 0x8012b1b4 # *0x8018e47c = 1; *0x801ca6f0 = (baseLoadedDataPtr + 0x118); 80130394: 24840118 addiu r4,r4,0x0118 80130398: 34040003 ori r4,r0,0x0003 8013039c: 3c02801d lui r2,0x801d 801303a0: 8c42d1ec lw r2,-0x2e14(r2) # baseLoadedDataPtr 801303a4: 34120003 ori r18,r0,0x0003 # index = 3 801303a8: 0c04ac7b jal 0x8012b1ec # 0x12b1ec (3); 801303ac: 24530180 addiu r19,r2,0x0180 # blockPtr = baseLoadedDataPtr + 0x0180 // Start at fourth block (index 3) # do { 801303b0: 00008021 addu r16,r0,r0 # innerSum = 0 801303b4: 0c04ac74 jal 0x8012b1d0 # *0x8018e47d = 1; *0x801ca6f4 = blockPtr 801303b8: 02602021 addu r4,r19,r0 801303bc: 00008821 addu r17,r0,r0 # innerCount = 0 # do { 801303c0: 0c04acd5 jal 0x8012b354 # innerResult = 0x12b354 (1); 801303c4: 34040001 ori r4,r0,0x0001 801303c8: 02021821 addu r3,r16,r2 # innerResult + innerSum 801303cc: 26310001 addiu r17,r17,0x0001 # innerCount++ 801303d0: 2a220400 slti r2,r17,0x0400 801303d4: 1440fffa bne r2,r0,0x801303c0 801303d8: 00608021 addu r16,r3,r0 # innerSum = innerResult + innerSum # } while (innerCount < 0x400); 801303dc: 26730080 addiu r19,r19,0x0080 # blockPtr = blockPtr + 0x80 // Go to next block 801303e0: 30700001 andi r16,r3,0x0001 # innerSum % 2 801303e4: 0c04ac7b jal 0x8012b1ec # outerResult = 0x12b1ec (1); 801303e8: 34040001 ori r4,r0,0x0001 801303ec: 320300ff andi r3,r16,0x00ff # (innerSum % 2) & 0xff 801303f0: 304200ff andi r2,r2,0x00ff # outerResult & 0xff 801303f4: 1462ffe2 bne r3,r2,0x80130380 # if (((innerSum % 2) & 0xff) != (outerResult & 0xff)) return 0; 801303f8: 26520001 addiu r18,r18,0x0001 # index++ 801303fc: 2e42003c sltiu r2,r18,0x003c 80130400: 1440ffeb bne r2,r0,0x801303b0 80130404: 00000000 nop # } while (index < 60); # } 80130408: 00009021 addu r18,r0,r0 # index = 0 8013040c: 3c118005 lui r17,0x8005 80130410: 26317f74 addiu r17,r17,0x7f74 # partyUnit = partyUnits[0] 80130414: 34100484 ori r16,r0,0x0484 # 0x0484 = 1156 (party unit offset in save data) # do { 80130418: 02202821 addu r5,r17,r0 # oldPartyUnit = partyUnit 8013041c: 340600e0 ori r6,r0,0x00e0 80130420: 26310100 addiu r17,r17,0x0100 # partyUnit = partyUnits[index + 1] 80130424: 3c04801d lui r4,0x801d 80130428: 8c84d1ec lw r4,-0x2e14(r4) 8013042c: 26520001 addiu r18,r18,0x0001 # index++ 80130430: 0c0088b7 jal 0x800222dc # bcopy (0x484 + baseLoadedDataPtr, oldPartyUnit, 0xe0); 80130434: 02042021 addu r4,r16,r4 80130438: 2a420014 slti r2,r18,0x0014 8013043c: 1440fff6 bne r2,r0,0x80130418 80130440: 261000e0 addiu r16,r16,0x00e0 # } while (index < 20); 80130444: 3c058006 lui r5,0x8006 80130448: 24a596e0 addiu r5,r5,-0x6920 # 0x800596e0 8013044c: 34060100 ori r6,r0,0x0100 80130450: 3c04801d lui r4,0x801d 80130454: 8c84d1ec lw r4,-0x2e14(r4) # baseLoadedDataPtr 80130458: 00009021 addu r18,r0,r0 # count = 0 8013045c: 0c0088b7 jal 0x800222dc # bcopy (baseLoadedDataPtr + 0x1604, 0x800596e0, 0x0100); // Inventory 80130460: 24841604 addiu r4,r4,0x1604 80130464: 3c058006 lui r5,0x8006 80130468: 24a59494 addiu r5,r5,-0x6b6c 8013046c: 3c04801d lui r4,0x801d 80130470: 8c84d1ec lw r4,-0x2e14(r4) 80130474: 34060100 ori r6,r0,0x0100 80130478: 0c0088b7 jal 0x800222dc # bcopy (baseLoadedDataPtr + 0x1704, 0x80059494, 0x0100); // Fur Shop 8013047c: 24841704 addiu r4,r4,0x1704 80130480: 3c058006 lui r5,0x8006 80130484: 24a59414 addiu r5,r5,-0x6bec 80130488: 3c04801d lui r4,0x801d 8013048c: 8c84d1ec lw r4,-0x2e14(r4) 80130490: 34060080 ori r6,r0,0x0080 80130494: 0c0088b7 jal 0x800222dc # bcopy (baseLoadedDataPtr + 0x1804, 0x80059414, 0x80); // Variables 0x600 - 0x9FF (Move-Find Items and Unknown section) 80130498: 24841804 addiu r4,r4,0x1804 8013049c: 3c058005 lui r5,0x8005 801304a0: 24a5771c addiu r5,r5,0x771c 801304a4: 3c04801d lui r4,0x801d 801304a8: 8c84d1ec lw r4,-0x2e14(r4) 801304ac: 34060400 ori r6,r0,0x0400 801304b0: 90821c88 lbu r2,0x1c88(r4) 801304b4: 3c018005 lui r1,0x8005 801304b8: a0227b1c sb r2,0x7b1c(r1) # *0x80057b1c = *(baseLoadedDataPtr + 0x1c88) 801304bc: 0c0088b7 jal 0x800222dc # bcopy (baseLoadedDataPtr + 0x1884, 0x8005771c, 0x0400); // Variables 0 - 0x3FF, Variables 0xA00 - 0xAA8 (Free halfwords) 801304c0: 24841884 addiu r4,r4,0x1884 801304c4: 3c108004 lui r16,0x8004 801304c8: 261073ac addiu r16,r16,0x73ac # 0x800473ac 801304cc: 02002821 addu r5,r16,r0 801304d0: 3c04801d lui r4,0x801d 801304d4: 8c84d1ec lw r4,-0x2e14(r4) 801304d8: 34060004 ori r6,r0,0x0004 801304dc: 0c0088b7 jal 0x800222dc # bcopy (baseLoadedDataPtr + 0x1c84, 0x800473ac, 4); // Customized Options 801304e0: 24841c84 addiu r4,r4,0x1c84 801304e4: 8e040000 lw r4,0x0000(r16) # *0x800473ac 801304e8: 00008821 addu r17,r0,r0 # found11 = 0 801304ec: 00042542 srl r4,r4,0x15 # *0x800473ac >> 21 801304f0: 0c005fdb jal 0x80017f6c # 0x17f6c ((*0x800473ac >> 21) & 0x03); // Handle customized options? 801304f4: 30840003 andi r4,r4,0x0003 801304f8: 3404000b ori r4,r0,0x000b # 11 801304fc: 3c03801d lui r3,0x801d 80130500: 8c63d1ec lw r3,-0x2e14(r3) # baseLoadedDataPtr # do { 80130504: 00000000 nop 80130508: 00721021 addu r2,r3,r18 # baseLoadedDataPtr + count 8013050c: 80421c89 lb r2,0x1c89(r2) # value = *(baseLoadedDataPtr + count + 0x1c89) 80130510: 00000000 nop 80130514: 14440002 bne r2,r4,0x80130520 80130518: 26520001 addiu r18,r18,0x0001 # count++ # if (value == 11) { 8013051c: 34110001 ori r17,r0,0x0001 # found11 = 1 # } 80130520: 2a42000b slti r2,r18,0x000b 80130524: 1440fff7 bne r2,r0,0x80130504 80130528: 00000000 nop # } while (count < 11); 8013052c: 16200008 bne r17,r0,0x80130550 80130530: 00009021 addu r18,r0,r0 # count = 0 # if (!found11) { 80130534: 3c058005 lui r5,0x8005 80130538: 24a57b20 addiu r5,r5,0x7b20 8013053c: 3c04801d lui r4,0x801d 80130540: 8c84d1ec lw r4,-0x2e14(r4) 80130544: 3406000c ori r6,r0,0x000c 80130548: 0c0088b7 jal 0x800222dc # bcopy (baseLoadedDataPtr + 0x1c89, 0x80057b20, 12); // ? 8013054c: 24841c89 addiu r4,r4,0x1c89 # } 80130550: 00008821 addu r17,r0,r0 # found11 = 0 80130554: 3404000b ori r4,r0,0x000b # 11 80130558: 3c03801d lui r3,0x801d 8013055c: 8c63d1ec lw r3,-0x2e14(r3) # baseLoadedDataPtr 80130560: 2402ffff addiu r2,r0,-0x0001 # -1 80130564: 3c018005 lui r1,0x8005 80130568: a0227b2b sb r2,0x7b2b(r1) # *0x80057b2b = -1 # do { 8013056c: 00721021 addu r2,r3,r18 # baseLoadedDataPtr + count 80130570: 80421c96 lb r2,0x1c96(r2) # value = *(baseLoadedDataPtr + count + 0x1c89) 80130574: 00000000 nop 80130578: 14440002 bne r2,r4,0x80130584 8013057c: 26520001 addiu r18,r18,0x0001 # count++ # if (value == 11) { 80130580: 34110001 ori r17,r0,0x0001 # found11 = 1 # } 80130584: 2a420007 slti r2,r18,0x0007 80130588: 1440fff8 bne r2,r0,0x8013056c 8013058c: 00000000 nop # } while (count < 7); 80130590: 16200007 bne r17,r0,0x801305b0 80130594: 34060008 ori r6,r0,0x0008 # if (!found11) { 80130598: 3c058005 lui r5,0x8005 8013059c: 24a57b2c addiu r5,r5,0x7b2c 801305a0: 3c04801d lui r4,0x801d 801305a4: 8c84d1ec lw r4,-0x2e14(r4) 801305a8: 0c0088b7 jal 0x800222dc # bcopy (baseLoadedDataPtr + 0x1c96, 0x80057b2c, 8); // ? 801305ac: 24841c96 addiu r4,r4,0x1c96 # } 801305b0: 3c058005 lui r5,0x8005 801305b4: 24a57b34 addiu r5,r5,0x7b34 801305b8: 34060007 ori r6,r0,0x0007 801305bc: 3c04801d lui r4,0x801d 801305c0: 8c84d1ec lw r4,-0x2e14(r4) 801305c4: 2402ffff addiu r2,r0,-0x0001 801305c8: 3c018005 lui r1,0x8005 801305cc: a0227b33 sb r2,0x7b33(r1) # *0x80057b33 = -1 801305d0: 0c0088b7 jal 0x800222dc # bcopy (baseLoadedDataPtr + 0x1c9f, 0x80057b34, 7); // ? 801305d4: 24841c9f addiu r4,r4,0x1c9f 801305d8: 3c058005 lui r5,0x8005 801305dc: 24a57b3c addiu r5,r5,0x7b3c 801305e0: 3c04801d lui r4,0x801d 801305e4: 8c84d1ec lw r4,-0x2e14(r4) 801305e8: 34060005 ori r6,r0,0x0005 801305ec: 0c0088b7 jal 0x800222dc # bcopy (baseLoadedDataPtr + 0x1ca6, 0x80057b3c, 5); // ? 801305f0: 24841ca6 addiu r4,r4,0x1ca6 801305f4: 3c058005 lui r5,0x8005 801305f8: 24a57b44 addiu r5,r5,0x7b44 801305fc: 3c04801d lui r4,0x801d 80130600: 8c84d1ec lw r4,-0x2e14(r4) 80130604: 34060005 ori r6,r0,0x0005 80130608: 0c0088b7 jal 0x800222dc # bcopy (baseLoadedDataPtr + 0x1cab, 0x80057b44, 5); // ? 8013060c: 24841cab addiu r4,r4,0x1cab 80130610: 3c058005 lui r5,0x8005 80130614: 24a57b4c addiu r5,r5,0x7b4c 80130618: 3c04801d lui r4,0x801d 8013061c: 8c84d1ec lw r4,-0x2e14(r4) 80130620: 34060007 ori r6,r0,0x0007 80130624: 0c0088b7 jal 0x800222dc # bcopy (baseLoadedDataPtr + 0x1cb0, 0x80057b4c, 7); // ? 80130628: 24841cb0 addiu r4,r4,0x1cb0 8013062c: 3c058005 lui r5,0x8005 80130630: 24a57b54 addiu r5,r5,0x7b54 80130634: 3c04801d lui r4,0x801d 80130638: 8c84d1ec lw r4,-0x2e14(r4) 8013063c: 34060005 ori r6,r0,0x0005 80130640: 0c0088b7 jal 0x800222dc # bcopy (baseLoadedDataPtr + 0x1cb7, 0x80057b54, 5); // ? 80130644: 24841cb7 addiu r4,r4,0x1cb7 80130648: 3c058005 lui r5,0x8005 8013064c: 24a57b5c addiu r5,r5,0x7b5c 80130650: 3c04801d lui r4,0x801d 80130654: 8c84d1ec lw r4,-0x2e14(r4) 80130658: 3406008a ori r6,r0,0x008a 8013065c: 0c0088b7 jal 0x800222dc # bcopy (baseLoadedDataPtr + 0x1cbc, 0x80057b5c, 0x8a); // Weapon Page Order 80130660: 24841cbc addiu r4,r4,0x1cbc 80130664: 3c058005 lui r5,0x8005 80130668: 24a57be8 addiu r5,r5,0x7be8 8013066c: 3c04801d lui r4,0x801d 80130670: 8c84d1ec lw r4,-0x2e14(r4) 80130674: 3406001d ori r6,r0,0x001d 80130678: 0c0088b7 jal 0x800222dc # bcopy (baseLoadedDataPtr + 0x1d46, 0x80057be8, 0x1d); // Helmet Page Order 8013067c: 24841d46 addiu r4,r4,0x1d46 80130680: 3c058005 lui r5,0x8005 80130684: 24a57c08 addiu r5,r5,0x7c08 80130688: 3c04801d lui r4,0x801d 8013068c: 8c84d1ec lw r4,-0x2e14(r4) 80130690: 34060025 ori r6,r0,0x0025 80130694: 0c0088b7 jal 0x800222dc # bcopy (baseLoadedDataPtr + 0x1d63, 0x80057c08, 0x25); // Armor Page Order 80130698: 24841d63 addiu r4,r4,0x1d63 8013069c: 3c058005 lui r5,0x8005 801306a0: 24a57c30 addiu r5,r5,0x7c30 801306a4: 3c04801d lui r4,0x801d 801306a8: 8c84d1ec lw r4,-0x2e14(r4) 801306ac: 34060021 ori r6,r0,0x0021 801306b0: 0c0088b7 jal 0x800222dc # bcopy (baseLoadedDataPtr + 0x1d88, 0x80057c30, 0x21); // Accessory Page Order 801306b4: 24841d88 addiu r4,r4,0x1d88 801306b8: 3c058005 lui r5,0x8005 801306bc: 24a57c54 addiu r5,r5,0x7c54 801306c0: 3c04801d lui r4,0x801d 801306c4: 8c84d1ec lw r4,-0x2e14(r4) 801306c8: 34060015 ori r6,r0,0x0015 801306cc: 0c0088b7 jal 0x800222dc # bcopy (baseLoadedDataPtr + 0x1da9, 0x80057c54, 0x15); // Item Page Order 801306d0: 24841da9 addiu r4,r4,0x1da9 801306d4: 3c058005 lui r5,0x8005 801306d8: 24a57cec addiu r5,r5,0x7cec 801306dc: 3c04801d lui r4,0x801d 801306e0: 8c84d1ec lw r4,-0x2e14(r4) 801306e4: 34060035 ori r6,r0,0x0035 801306e8: 0c0088b7 jal 0x800222dc # bcopy (baseLoadedDataPtr + 0x124, 0x80057cec, 0x35); // ? 801306ec: 24840124 addiu r4,r4,0x0124 801306f0: 3c058006 lui r5,0x8006 801306f4: 24a596ac addiu r5,r5,-0x6954 801306f8: 3c04801d lui r4,0x801d 801306fc: 8c84d1ec lw r4,-0x2e14(r4) 80130700: 34060012 ori r6,r0,0x0012 80130704: 0c0088b7 jal 0x800222dc # bcopy (baseLoadedDataPtr + 0x159, 0x800596ac, 18); // ? 80130708: 24840159 addiu r4,r4,0x0159 8013070c: 3c058005 lui r5,0x8005 80130710: 24a57c7c addiu r5,r5,0x7c7c 80130714: 3c04801d lui r4,0x801d 80130718: 8c84d1ec lw r4,-0x2e14(r4) 8013071c: 3406006c ori r6,r0,0x006c 80130720: 0c0088b7 jal 0x800222dc # bcopy (baseLoadedDataPtr + 0x16b, 0x80057c7c, 0x6c); // ? 80130724: 2484016b addiu r4,r4,0x016b 80130728: 3c058005 lui r5,0x8005 8013072c: 24a57d24 addiu r5,r5,0x7d24 80130730: 3c04801d lui r4,0x801d 80130734: 8c84d1ec lw r4,-0x2e14(r4) 80130738: 34060060 ori r6,r0,0x0060 8013073c: 0c0088b7 jal 0x800222dc # bcopy (baseLoadedDataPtr + 0x1d7, 0x80057d24, 96); // ? 80130740: 248401d7 addiu r4,r4,0x01d7 80130744: 3c058006 lui r5,0x8006 80130748: 24a59594 addiu r5,r5,-0x6a6c 8013074c: 3c04801d lui r4,0x801d 80130750: 8c84d1ec lw r4,-0x2e14(r4) 80130754: 34060118 ori r6,r0,0x0118 80130758: 0c0088b7 jal 0x800222dc # bcopy (baseLoadedDataPtr + 0x238, 0x80059594, 0x118); // ? 8013075c: 24840238 addiu r4,r4,0x0238 80130760: 3c058006 lui r5,0x8006 80130764: 24a59374 addiu r5,r5,-0x6c8c 80130768: 3c04801d lui r4,0x801d 8013076c: 8c84d1ec lw r4,-0x2e14(r4) 80130770: 340600a0 ori r6,r0,0x00a0 80130774: 0c0088b7 jal 0x800222dc # bcopy (baseLoadedDataPtr + 0x350, 0x80059374, 0xa0); // ? 80130778: 24840350 addiu r4,r4,0x0350 8013077c: 3c058006 lui r5,0x8006 80130780: 24a59810 addiu r5,r5,-0x67f0 80130784: 3c04801d lui r4,0x801d 80130788: 8c84d1ec lw r4,-0x2e14(r4) 8013078c: 34060008 ori r6,r0,0x0008 80130790: 0c0088b7 jal 0x800222dc # bcopy (baseLoadedDataPtr + 0x3f0, 0x80059810, 8); // ? 80130794: 248403f0 addiu r4,r4,0x03f0 80130798: 3c058005 lui r5,0x8005 8013079c: 24a57f34 addiu r5,r5,0x7f34 801307a0: 3c04801d lui r4,0x801d 801307a4: 8c84d1ec lw r4,-0x2e14(r4) 801307a8: 34060040 ori r6,r0,0x0040 801307ac: 0c0088b7 jal 0x800222dc # bcopy (baseLoadedDataPtr + 0x3f8, 0x80057f34, 64); // ? 801307b0: 248403f8 addiu r4,r4,0x03f8 801307b4: 3c058005 lui r5,0x8005 801307b8: 24a57eec addiu r5,r5,0x7eec 801307bc: 3c04801d lui r4,0x801d 801307c0: 8c84d1ec lw r4,-0x2e14(r4) # baseLoadedDataPtr 801307c4: 34060048 ori r6,r0,0x0048 801307c8: 90820438 lbu r2,0x0438(r4) # *(baseLoadedDataPtr + 0x438) 801307cc: 3c018005 lui r1,0x8005 801307d0: a0227ce8 sb r2,0x7ce8(r1) # *0x80057ce8 = *(baseLoadedDataPtr + 0x438) 801307d4: 0c0088b7 jal 0x800222dc # bcopy (baseLoadedDataPtr + 0x439, 0x80057eec, 72); // Current Proposition data 801307d8: 24840439 addiu r4,r4,0x0439 801307dc: 16800025 bne r20,r0,0x80130874 # if (p1 != 0) return 1; 801307e0: 34020001 ori r2,r0,0x0001 801307e4: 3c02801d lui r2,0x801d 801307e8: 8c42d1ec lw r2,-0x2e14(r2) # baseLoadedDataPtr 801307ec: 3c0391a2 lui r3,0x91a2 801307f0: 8c520120 lw r18,0x0120(r2) # totalSeconds = *(baseLoadedDataPtr + 0x120) 801307f4: 3463b3c5 ori r3,r3,0xb3c5 # 0x91a2b3c5 (0.5688888889) = (2048 / 3600) (treated as negative value (-1552 / 3600) because MULT instead of MULTU will be used) 801307f8: 02430018 mult r18,r3 # totalSeconds * (-1552 / 3600) 801307fc: 3c048888 lui r4,0x8888 80130800: 34848889 ori r4,r4,0x8889 # 0x88888889 (0.533333333) = (32 / 60) (treated as negative value (-28 / 60) because MULT instead of MULTU will be used) 80130804: 001217c3 sra r2,r18,0x1f 80130808: 00001810 mfhi r3 # totalSeconds * (-1552 / 3600) 8013080c: 00721821 addu r3,r3,r18 # totalSeconds * (2048 / 3600) (get the correct positive value. not necessary if using MULTU) 80130810: 00031ac3 sra r3,r3,0x0b # totalSeconds * (2048 / 3600) / 2048 = (totalSeconds / 3600) 80130814: 00621823 subu r3,r3,r2 # hours = (totalSeconds / 3600) (integer division) 80130818: 000310c0 sll r2,r3,0x03 # hours * 8 8013081c: 00431023 subu r2,r2,r3 # hours * 7 80130820: 00021140 sll r2,r2,0x05 # hours * 224 80130824: 00431021 addu r2,r2,r3 # hours * 225 80130828: 00021100 sll r2,r2,0x04 # hours * 3600 8013082c: 02429023 subu r18,r18,r2 # remainingSeconds = totalSeconds - (hours * 3600) 80130830: 02440018 mult r18,r4 # remainingSeconds * (-28 / 60) 80130834: 001217c3 sra r2,r18,0x1f 80130838: 3c018004 lui r1,0x8004 8013083c: ac2359c4 sw r3,0x59c4(r1) # timer.hours = hours 80130840: 00001810 mfhi r3 # remainingSeconds * (-28 / 60) 80130844: 00721821 addu r3,r3,r18 # remainingSeconds * (32 / 60) (get the correct positive value. not necessary if using MULTU) 80130848: 00031943 sra r3,r3,0x05 # remainingSeconds * (32 / 60) / 32 = (remainingSeconds / 60) 8013084c: 00621823 subu r3,r3,r2 # minutes = (remainingSeconds / 60) (integer division) 80130850: 00031100 sll r2,r3,0x04 # minutes * 16 80130854: 00431023 subu r2,r2,r3 # minutes * 15 80130858: 00021080 sll r2,r2,0x02 # minutes * 60 8013085c: 02429023 subu r18,r18,r2 # totalSeconds - (hours * 3600) - (minutes * 60) 80130860: 3c018004 lui r1,0x8004 80130864: ac2359c0 sw r3,0x59c0(r1) # timer.minutes = minutes 80130868: 3c018004 lui r1,0x8004 8013086c: ac3259bc sw r18,0x59bc(r1) # timer.seconds = totalSeconds - (hours * 3600) - (minutes * 60) 80130870: 34020001 ori r2,r0,0x0001 # return 1; 80130874: 8fbf0024 lw r31,0x0024(r29) 80130878: 8fb40020 lw r20,0x0020(r29) 8013087c: 8fb3001c lw r19,0x001c(r29) 80130880: 8fb20018 lw r18,0x0018(r29) 80130884: 8fb10014 lw r17,0x0014(r29) 80130888: 8fb00010 lw r16,0x0010(r29) 8013088c: 27bd0028 addiu r29,r29,0x0028 80130890: 03e00008 jr r31 80130894: 00000000 nop