Exercise 1: Add two numbers (i)
Write MIPS assembler that behaves like
int x = 3;
void main(void)
{
printf("%d\n", x+5);
}
|
Hints:
- the number stored in $v0 determines what kind of system call it is
- syscall 1 prints the number located in register $a0
- syscall 4 prints a string, whose address is located in $a0
-
.word allocates 4 bytes in memory and initialises it
- you will need to load one value into a register to do the addition
|