Learn to develop assembly language programs.
Translate a simple program from a higher-level language into assembly language.
Files to use
What to Hand In
Completed oddeven.asm, swap.asm
- Write a MIPS program with comments that loads a random integer from memory (use the .word assembler directive) and determines whether the number is odd or even. If the number is odd write a ‘1’ to register 15 ($t7) if the number is even write a ‘0’ to register 15.
- Write a MIPS program with comments that swaps the contents of the two consecutive memory locations with the two other consecutive locations.
Example : (2000) : 45 (3000) : 78
(2004) : 67 (3004) : 90
(2000) : 78 (3000) : 45
(2004) : 90 (3004) : 67
Use labels in your program instead of absolute addresses as below
first_loc .word 45,67
sec_loc .word 78,90
To load the addresses to registers, use the pseudo instruction la (load address) as below :
la $1, first_loc # address first_loc is loaded to register 1