Difference between revisions of "C51 Malloc"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
(Created page with "<font face='Courier New'> 00044414: 27bdfff8 addiu r29,r29,0xfff8 00044418: 00002821 addu r5,r0,r0 0004441c: 000432c2 srl r6,r4,0x0b 00044420: 308407ff andi r4,r4,0x07ff...")
 
Line 1: Line 1:
 
<font face='Courier New'>
 
<font face='Courier New'>
 +
 +
Judges the size of something? loops in a really odd fashion until 0x8004e9d4 + r4 != 0
 +
grabs something from very close to the beginning of scus, which seems to point to the stack?
 
   
 
   
 
  00044414: 27bdfff8 addiu r29,r29,0xfff8
 
  00044414: 27bdfff8 addiu r29,r29,0xfff8
  00044418: 00002821 addu r5,r0,r0
+
  00044418: 00002821 addu r5,r0,r0 #r5 = 0
  0004441c: 000432c2 srl r6,r4,0x0b
+
  0004441c: 000432c2 srl r6,r4,0x0b #r6 = input >> 0xb (0x800 to 0x1)
  00044420: 308407ff andi r4,r4,0x07ff
+
  00044420: 308407ff andi r4,r4,0x07ff #
  00044424: 10800002 beq r4,r0,0x00044430
+
  00044424: 10800002 beq r4,r0,0x00044430 #branch if input && 0x07ff is 0
  00044428: 34070001 ori r7,r0,0x0001
+
  00044428: 34070001 ori r7,r0,0x0001 #r7 = 1
  0004442c: 24c60001 addiu r6,r6,0x0001
+
  0004442c: 24c60001 addiu r6,r6,0x0001 #r6 = Ceil(input>>0xb)
  00044430: 00002021 addu r4,r0,r0
+
  00044430: 00002021 addu r4,r0,r0 #r4 = 0
 
  00044434: 3c018005 lui r1,0x8005
 
  00044434: 3c018005 lui r1,0x8005
 
  00044438: 00240821 addu r1,r1,r4
 
  00044438: 00240821 addu r1,r1,r4
  0004443c: 9023e9d4 lbu r3,-0x162c(r1)
+
  0004443c: 9023e9d4 lbu r3,-0x162c(r1) #loads byte from 0x8004e9d4 + r4
 
  00044440: 00000000 nop
 
  00044440: 00000000 nop
  00044444: 1460000a bne r3,r0,0x00044470
+
  00044444: 1460000a bne r3,r0,0x00044470 #branch if not 0
  00044448: 0067102b sltu r2,r3,r7
+
  00044448: 0067102b sltu r2,r3,r7 #true if r3 > 1
 
  0004444c: 14a00002 bne r5,r0,0x00044458
 
  0004444c: 14a00002 bne r5,r0,0x00044458
 
  00044450: 00000000 nop
 
  00044450: 00000000 nop
  00044454: 00804021 addu r8,r4,r0
+
  00044454: 00804021 addu r8,r4,r0 #r8 = r4
  00044458: 24a50001 addiu r5,r5,0x0001
+
  00044458: 24a50001 addiu r5,r5,0x0001 #r5 + 1
  0004445c: 00a6102b sltu r2,r5,r6
+
  0004445c: 00a6102b sltu r2,r5,r6 #set true if r5 < Ceil(input>>0xb)
  00044460: 1040000c beq r2,r0,0x00044494
+
  00044460: 1040000c beq r2,r0,0x00044494 #branch until true
 
  00044464: 00000000 nop
 
  00044464: 00000000 nop
 
  00044468: 08011120 j 0x00044480
 
  00044468: 08011120 j 0x00044480
  0004446c: 24840001 addiu r4,r4,0x0001
+
  0004446c: 24840001 addiu r4,r4,0x0001 #r4 + 1
  00044470: 14400002 bne r2,r0,0x0004447c
+
  00044470: 14400002 bne r2,r0,0x0004447c #branch if r2 != 0
  00044474: 00002821 addu r5,r0,r0
+
  00044474: 00002821 addu r5,r0,r0 #r5 = 0
  00044478: 24670001 addiu r7,r3,0x0001
+
  00044478: 24670001 addiu r7,r3,0x0001 #r7 = byte + 1
  0004447c: 24840001 addiu r4,r4,0x0001
+
  0004447c: 24840001 addiu r4,r4,0x0001 #r4 + 1
  00044480: 2c820040 sltiu r2,r4,0x0040
+
  00044480: 2c820040 sltiu r2,r4,0x0040 #set true if r4 < 0x40
  00044484: 1440ffeb bne r2,r0,0x00044434
+
  00044484: 1440ffeb bne r2,r0,0x00044434 #loop if untrue
  00044488: 00a6102b sltu r2,r5,r6
+
  00044488: 00a6102b sltu r2,r5,r6 #set true if r5 < Ceil(input>>0xb)
  0004448c: 14400010 bne r2,r0,0x000444d0
+
  0004448c: 14400010 bne r2,r0,0x000444d0 #branch if so
  00044490: 00001021 addu r2,r0,r0
+
  00044490: 00001021 addu r2,r0,r0 #r2 = 0
  00044494: 10a0000a beq r5,r0,0x000444c0
+
  00044494: 10a0000a beq r5,r0,0x000444c0 #branch if r5 = 0
  00044498: 00002021 addu r4,r0,r0
+
  00044498: 00002021 addu r4,r0,r0 #r4 = 0
 
  0004449c: 3c038005 lui r3,0x8005
 
  0004449c: 3c038005 lui r3,0x8005
  000444a0: 2463e9d4 addiu r3,r3,0xe9d4
+
  000444a0: 2463e9d4 addiu r3,r3,-0x162c #r3 = 0x8004e9d4
  000444a4: 01041021 addu r2,r8,r4
+
  000444a4: 01041021 addu r2,r8,r4 #r2 = r8 + r4
  000444a8: 00431021 addu r2,r2,r3
+
  000444a8: 00431021 addu r2,r2,r3 #r2 = 0x8004e9d4 + r8 + r4
  000444ac: a0470000 sb r7,0x0000(r2)
+
  000444ac: a0470000 sb r7,0x0000(r2) #save r7
  000444b0: 24840001 addiu r4,r4,0x0001
+
  000444b0: 24840001 addiu r4,r4,0x0001 #r4 + 1
  000444b4: 0085102b sltu r2,r4,r5
+
  000444b4: 0085102b sltu r2,r4,r5 #set true if r5 counter < r4 counter
  000444b8: 1440fffa bne r2,r0,0x000444a4
+
  000444b8: 1440fffa bne r2,r0,0x000444a4 #loop above until r4 => r5 (?)
 
  000444bc: 00000000 nop
 
  000444bc: 00000000 nop
 
  000444c0: 3c038001 lui r3,0x8001
 
  000444c0: 3c038001 lui r3,0x8001
  000444c4: 8c630010 lw r3,0x0010(r3)
+
  000444c4: 8c630010 lw r3,0x0010(r3) #loads either a very large number, or a stack pointer. (0x801df000?)
  000444c8: 000812c0 sll r2,r8,0x0b
+
  000444c8: 000812c0 sll r2,r8,0x0b #r2 = r8 << 0xb
  000444cc: 00431021 addu r2,r2,r3
+
  000444cc: 00431021 addu r2,r2,r3 #r2 + 801df000?
 
  000444d0: 27bd0008 addiu r29,r29,0x0008
 
  000444d0: 27bd0008 addiu r29,r29,0x0008
 
  000444d4: 03e00008 jr r31
 
  000444d4: 03e00008 jr r31
 
  000444d8: 00000000 nop
 
  000444d8: 00000000 nop
 
</font>
 
</font>

Revision as of 08:11, 14 January 2022

Judges the size of something? loops in a really odd fashion until 0x8004e9d4 + r4 != 0
grabs something from very close to the beginning of scus, which seems to point to the stack?

00044414: 27bdfff8 addiu r29,r29,0xfff8
00044418: 00002821 addu r5,r0,r0			#r5 = 0
0004441c: 000432c2 srl r6,r4,0x0b			#r6 = input >> 0xb (0x800 to 0x1)
00044420: 308407ff andi r4,r4,0x07ff			#
00044424: 10800002 beq r4,r0,0x00044430		#branch if input && 0x07ff is 0
00044428: 34070001 ori r7,r0,0x0001			#r7 = 1
0004442c: 24c60001 addiu r6,r6,0x0001			#r6 = Ceil(input>>0xb)
00044430: 00002021 addu r4,r0,r0			#r4 = 0
00044434: 3c018005 lui r1,0x8005
00044438: 00240821 addu r1,r1,r4
0004443c: 9023e9d4 lbu r3,-0x162c(r1)			#loads byte from 0x8004e9d4 + r4
00044440: 00000000 nop
00044444: 1460000a bne r3,r0,0x00044470		#branch if not 0
00044448: 0067102b sltu r2,r3,r7			#true if r3 > 1
0004444c: 14a00002 bne r5,r0,0x00044458
00044450: 00000000 nop
00044454: 00804021 addu r8,r4,r0			#r8 = r4
00044458: 24a50001 addiu r5,r5,0x0001			#r5 + 1
0004445c: 00a6102b sltu r2,r5,r6			#set true if r5 < Ceil(input>>0xb)
00044460: 1040000c beq r2,r0,0x00044494		#branch until true
00044464: 00000000 nop
00044468: 08011120 j 0x00044480
0004446c: 24840001 addiu r4,r4,0x0001			#r4 + 1
00044470: 14400002 bne r2,r0,0x0004447c		#branch if r2 != 0
00044474: 00002821 addu r5,r0,r0			#r5 = 0
00044478: 24670001 addiu r7,r3,0x0001			#r7 = byte + 1
0004447c: 24840001 addiu r4,r4,0x0001			#r4 + 1
00044480: 2c820040 sltiu r2,r4,0x0040			#set true if r4 < 0x40
00044484: 1440ffeb bne r2,r0,0x00044434		#loop if untrue
00044488: 00a6102b sltu r2,r5,r6			#set true if r5 < Ceil(input>>0xb)
0004448c: 14400010 bne r2,r0,0x000444d0		#branch if so
00044490: 00001021 addu r2,r0,r0			#r2 = 0
00044494: 10a0000a beq r5,r0,0x000444c0		#branch if r5 = 0
00044498: 00002021 addu r4,r0,r0			#r4 = 0
0004449c: 3c038005 lui r3,0x8005
000444a0: 2463e9d4 addiu r3,r3,-0x162c			#r3 = 0x8004e9d4
000444a4: 01041021 addu r2,r8,r4			#r2 = r8 + r4
000444a8: 00431021 addu r2,r2,r3			#r2 = 0x8004e9d4 + r8 + r4 
000444ac: a0470000 sb r7,0x0000(r2)			#save r7
000444b0: 24840001 addiu r4,r4,0x0001			#r4 + 1
000444b4: 0085102b sltu r2,r4,r5			#set true if r5 counter < r4 counter
000444b8: 1440fffa bne r2,r0,0x000444a4		#loop above until r4 => r5 (?)
000444bc: 00000000 nop
000444c0: 3c038001 lui r3,0x8001
000444c4: 8c630010 lw r3,0x0010(r3)			#loads either a very large number, or a stack pointer. (0x801df000?)
000444c8: 000812c0 sll r2,r8,0x0b			#r2 = r8 << 0xb
000444cc: 00431021 addu r2,r2,r3			#r2 + 801df000?
000444d0: 27bd0008 addiu r29,r29,0x0008
000444d4: 03e00008 jr r31
000444d8: 00000000 nop