Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

**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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Management Databases And Organizations

Authors: Richard T. Watson

6th Edition

1943153035, 978-1943153039

More Books

Students also viewed these Databases questions

Question

Understand developments in knowledge creation and management

Answered: 1 week ago

Question

Explain key ideas of workplace learning

Answered: 1 week ago

Question

Explain how HRD may be implemented

Answered: 1 week ago