Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Answer in MIPS ##################################################################### ## PROBLEM 3 ## ## Given a zero-terminated list of 4 byte integers ranging from 1-100 ## (inclusive), count the number

Answer in MIPS

#####################################################################

## PROBLEM 3

##

## Given a zero-terminated list of 4 byte integers ranging from 1-100

## (inclusive), count the number of elements in the list.

## - The terminating zero should not be included in the count.

## - If a value outside of legal range (1 >= x <= 100) is found

## indicate an error by returning -1.

## - Function takes one argument, a pointer to the start of the list

#####################################################################

length:

##Your Code Here

########################################

## TEST PROBLEM 3 ## Do Not Modify

########################################

li $a0, 3

jal print_problem_header

la $a0, vec1

jal length # length = 3

move $a0, $v0

jal print_int

jal print_space

la $a0, vec2

jal length # length = -1

move $a0, $v0

jal print_int

jal print_space

la $a0, vec3

jal length # length = -1

move $a0, $v0

jal print_int

jal print_space

la $a0, vec4

jal length # length = 0

move $a0, $v0

jal print_int

jal print_newline

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_2

Step: 3

blur-text-image_3

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

Visual Basic 4 Ole Database And Controls Superbible

Authors: Michael Hatmaker, C. Woody Butler, Ibrahim Malluf, Bill Potter

1st Edition

1571690077, 978-1571690074

More Books

Students also viewed these Databases questions

Question

13-1 How does building new systems produce organizational change?

Answered: 1 week ago