Question: **MIPS ASSEMBLY PROGRAM** i. Write a program that reads and stores an array of 10 records, each record consists of name of type string of

**MIPS ASSEMBLY PROGRAM**

i. Write a program that reads and stores an array of 10 records, each record consists of name of type string of up to 40 characters, age of type integer, and salary of type integer.

ii. Write a program that prints the array of records of Part(i) in a readable format (a single line for each employee).

For some reason after the first run of the inputLoop the first part of the code that prompts the user for the name of the employee is not working

# A a program that reads and stores an array of 10 records. # Each record consists of name of type string of up to 40 characters, # age of type integer, and salary of type integer.

.data employees: .space 480 prompt1: .asciiz " Please enter the name of the employee: " prompt2: .asciiz " Please enter the age of the employee: " prompt3: .asciiz " Please enter the salary of the employee: " newline: .asciiz " " display1: .asciiz " Employee Name" display2: .asciiz " Age" display3: .asciiz " Salary"

.text .globl main main: li $t0, 5 li $t1, 0 jal employeeInfo end: li $v0, 10 syscall

employeeInfo: inputLoop: bgtz $t0,print la $a0, prompt1 li $v0, 4 syscall li $v0, 8 syscall sw $v0, employees($t1) add $t1, $t1, 40 la $a0, prompt2 li $v0, 4 syscall li $v0, 5 syscall sw $v0, employees($t1) add $t1, $t1, 4 la $a0, prompt3 li $v0, 4 syscall li $v0, 5 syscall sw $v0, employees($t1) add $t1, $t1, 4 addi $t0, $t0, -1 b inputLoop print: beqz $t0, end #counter = 0; end li $v0, 4 la $a1, Records syscall #print name li $v0, 1 lb $t1, 40($a1) move $a0, $t1 syscall #print age la $a0, newline li $v0, 4 syscall #newline li $v0, 1 lb $t1, 44($a1) move $a0, $t1 syscall #print salary la $a0, newline li $v0, 4 syscall

addi $t0, $t0, -1 #decrement addiu $a1, $a1, 12 b print

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!