This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
super_mario_64:weird_asm_code [2016/02/16 04:57] 127.0.0.1 external edit |
super_mario_64:weird_asm_code [2017/06/23 10:22] (current) shygoo ↷ Page moved from sm64:weird_asm_code to super_mario_64:weird_asm_code |
||
---|---|---|---|
Line 26: | Line 26: | ||
.L70: | .L70: | ||
lw $ra, 0x1c($sp)</code> | lw $ra, 0x1c($sp)</code> | ||
+ | |||
+ | ===== Unnecessary String Copy ===== | ||
+ | Instead of referencing the string directly, a copy is made on the stack. Additionally, instead of calling memcpy or strcpy, a raw set of lw/sw, lb/sb are used inline to copy the data to the stack. | ||
+ | <code mipsasm># From FileConfirmations starting at 80175284/225744 | ||
+ | lui $t5, 0x801a | ||
+ | addiu $t5, $t5, 0x7e98 | ||
+ | lw $at, ($t5) | ||
+ | addiu $t4, $sp, 0x44 | ||
+ | lw $t6, 4($t5) | ||
+ | sw $at, ($t4) | ||
+ | lw $at, 8($t5) | ||
+ | sw $t6, 4($t4) | ||
+ | lw $t6, 0xc($t5) | ||
+ | sw $at, 8($t4) | ||
+ | lw $at, 0x10($t5) | ||
+ | sw $t6, 0xc($t4) | ||
+ | sw $at, 0x10($t4) | ||
+ | lbu $at, 0x14($t5) | ||
+ | sb $at, 0x14($t4)</code> |