Exercise 2: Add two numbers (ii)
Modify the program so it behaves like:
int x = 3;
int y = 4;
void main(void)
{
printf("%d\n", x+y);
}
|
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 two values into registers to do the addition
|