JOBSTTS.OUT 001e4ed0 - 001e4f78

From Final Fantasy Hacktics Wiki
Revision as of 07:17, 21 May 2024 by Sardek (talk | contribs)
Jump to navigation Jump to search
beq r4,r0,end
addu r2,r0,r0        #clear r2
lui r2,0x801f
lbu r2,0x0044(r2)    #r2 = byte at 0x801f0044
nop
beq r2,r0,forward    #jump forward if r2 is empty
addu r7,r0,r0        #clear r7
ori r2,r0,0x0007     #r2 = 7
lui r1,0x801f
sw r2,0x0048(r1)     #store 7 in 0x801f0048
lui r1,0x801f
sb r0,0x0044(r1)     #clear 0x801f0044
forward:             #0x801f0044 is always empty at this point
addiu r4,r4,-0x0001  #r4--
addiu r2,r0,-0x0001  #r2 = -1
beq r4,r2,end        #end routine if r4 is -1
addu r2,r7,r0        #r7 is return value
ori r10,r0,0x0001    #r10 is 1
ori r9,r0,0x0007     #r9 is 7
addiu r8,r0,-0x0001  #r8 is -1
backwards:
lui r6,0x8020
lw r6,-0x58ec(r6)    #r6 = word at 0x801fa714
lui r3,0x801f
lw r3,0x0048(r3)     #r3 = word at 0x801f0048 (could be 7?)
lbu r2,0x0000(r6)    #r2 = value pointed at from 0x801fa714 pointer
addiu r5,r3,-0x0001  #r5 = r3 - 1
lui r1,0x801f
sw r5,0x0048(r1)     #store r5 at 0x801f0048
srav r2,r2,r3        #rightshift r2 by r3 bytes (could be 7?)
andi r2,r2,0x0001    #r2 = far right byte
beq r2,r0,skip       #skip if r2 is odd
sllv r2,r10,r4       #r2 = r10 leftshifted r4
or r7,r7,r2          #r7 = r7 U r2
skip:
bgez r5,skip2        #skip this if r5 is positive
addiu r4,r4,-0x0001  #r4--
addiu r2,r6,0x0001   #r2 is r6 + 1
lui r1,0x801f
sw r9,0x0048(r1)     #store r9 in 0x801f0048
lui r1,0x8020
sw r2,-0x58ec(r1)    #store r2 in 0x801fa714
skip2:
bne r4,r8,backwards  #loop if r4 and r8 aren't equal
addu r2,r7,r0        #return value is r7
end:
jr r31               #finally over
nop