Can someone tell me what this code is doing

Programming related discussions related to game research
theclub456
Posts: 10
Joined: Tue Jan 27, 2015 11:32 pm

Can someone tell me what this code is doing

Post by theclub456 »

sub_140810:

var_20= -0x20
var_10= -0x10

addiu $sp, -0x20 # Add Immediate Unsigned
sd $ra, 0x20+var_10($sp) # Store Doubleword
sq $s0, 0x20+var_20($sp) # Store Quadword
daddu $s0, $a0, $0 # Doubleword Add Unsigned
bnez $a1, loc_140858 # Branch on Not Zero
nop




lw $v0, 0x10($s0) # Load Word
addiu $v0, 0xFFFF # Add Immediate Unsigned
sll $v0, 3 # Shift Left Logical
addiu $a0, $v0, 0x10 # Add Immediate Unsigned
daddu $a1, $0, $0 # Doubleword Add Unsigned
la $a2, aAmobject_c # "amObject.c"
li $a3, 0x77 # Load Immediate
jal sub_13BC50 # Jump And Link
nop
daddu $a1, $v0, $0 # Doubleword Add Unsigned
nop





loc_140858: # Store Word
sw $s0, 0($a1)
lw $v0, 0x10($s0) # Load Word
sw $v0, 4($a1) # Store Word
addiu $v1, $a1, 8 # Add Immediate Unsigned
daddu $a0, $0, $0 # Doubleword Add Unsigned
b loc_140888 # Branch Always
nop




loc_140888: # Load Word
lw $v0, 4($a1)
slt $v0, $a0, $v0 # Set on Less Than
bnez $v0, loc_140878 # Branch on Not Zero
nop





loc_140878: # Store Word
sw $0, 0($v1)
sw $0, 4($v1) # Store Word
addiu $a0, 1 # Add Immediate Unsigned
addiu $v1, 8 # Add Immediate Unsigned






daddu $v0, $a1, $0 # Doubleword Add Unsigned
ld $ra, 0x20+var_10($sp) # Load Doubleword
lq $s0, 0x20+var_20($sp) # Load Quadword
addiu $sp, 0x20 # Add Immediate Unsigned
jr $ra # Jump Register
nop
# End of function sub_140810
puggsoy
Posts: 161
Joined: Sat Dec 13, 2014 1:01 am

Re: Can someone tell me what this code is doing

Post by puggsoy »

Please put it in code tags, that makes it much much easier to read.