Question: **MIPS ASSEMBLY PROGRAM** Write a program that swaps any two records, and then prints the entire array. The program must ask the user to enter
**MIPS ASSEMBLY PROGRAM**
Write a program that swaps any two records, and then prints the entire array. The program must ask the user to enter the record numbers. Assume the record are numbered from 1 to 10. For example, if the user enters 4 and 7, then the program swaps the record 4 and the record 7.
#The following reads two records Emp1 and Emp2, each record consists of two attributes, name and of type string of up to 40 characters and salary of type integer, and then prints both records
.data
Emp: .space 88
newline: .asciiz" "
.text
#read and store the name of the first record.
la $a0, Emp
li $a1, 40
li $v0, 8
syscall
#reads and store the salary of the first record.
li $v0, 5
syscall
sw $v0, 40($a0)
#read and store the name of the second record.
addi $a0, 44
li $a1, 40
li $v0, 8
syscall
#read and store the salary of the second record.
li $v0, 5
syscall
sw $v0, 40($a0)
# print the name of first record.
li $v0,4
la $a0, Emp
syscall
#print the salay of the first record.
move $t1, $a0
li $v0, 1
lw $a0, 40($t1)
syscall
# start a new line
li $v0,4
la $a0, newline
syscall
#print the name of the second record.
addi $a0,$a0, 44
syscall
#print the salary of the second record.
li $v0, 1
lw $a0, 84($t1)
syscall
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
