the question revolves around the MIPS assembly.
Let's says in the start of the program the value of the register $sp (stack pointer) is $sp = 0x1000.
Then I write the command: addi $sp, $sp, -12
What will be the value of $sp now?
Will it be 0xFF4? (since 12 in hexadecimal is C and we subtract it from 1000)
Or do i need to multiply 12 by 4 (since 4 byte is the size of word = 32 bit) and then subtract?
0xff4
. You can easily check this in a debugger/simulator. Technically$sp
is just another general purpose register (it's$29
after all) so it's nothing special. If you writeadd -12
, then that's what is going to happen. – Jester