Magic Defense Up routine
Jump to navigation
Jump to search
0018631c: 3c028019 lui r2,0x8019 00186320: 8c422d98 lw r2,0x2d98(r2) Load Defender's Stats 00186324: 00000000 nop 00186328: 90420090 lbu r2,0x0090(r2) Defender's 2nd set of Supports 0018632c: 00000000 nop 00186330: 30420002 andi r2,r2,0x0002 00186334: 1040000b beq r2,r0,0x00186364 Branch if the Defender doesn't have Defense Up 00186338: 3c025555 lui r2,0x5555 0018633c: 3c048019 lui r4,0x8019 00186340: 248438ce addiu r4,r4,0x38ce Load XA 00186344: 84830000 lh r3,0x0000(r4) 00186348: 34425556 ori r2,r2,0x5556 R2 = 55555556 or 1/3 when used in multiplication 0018634c: 00031840 sll r3,r3,0x01 XA * 2 00186350: 00620018 mult r3,r2 XA * 2 / 3 00186354: 00031fc3 sra r3,r3,0x1f 00186358: 00001010 mfhi r2 Move "Remainder" to r2 0018635c: 00431023 subu r2,r2,r3 00186360: a4820000 sh r2,0x0000(r4) Store new XA 00186364: 03e00008 jr r31 00186368: 00000000 nop