Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

WRITE THE FOLLOWING CODE IN FLOATING POINT NUMBERS IN ASSEMBLY LANGUAGE USING MIPS IN MARS .data prompt: .asciiz Maximum number is : prompt1:

WRITE THE FOLLOWING CODE IN FLOATING POINT NUMBERS

IN ASSEMBLY LANGUAGE USING MIPS IN MARS

.data prompt: .asciiz " Maximum number is : " prompt1: .asciiz " Minimum number is : " prompt2: .asciiz " Range of the array is : " size: .word 10

#load array array: .word 23, -12, 45, -32, 52, -72, 8, 13,22,876

.text #load address of array and size la $s4,array #load address of A lw $t0,size #load i to t0

jal getArrayRange

li $v0, 4 la $a0, prompt2 #prompt for string syscall

li $v0, 1 move $a0, $s2 #prompt for string syscall

li $v0, 10 #terminate syscall

getArrayRange: li $s1,9999 li $s0,0 li $s2,0

loop:

mul $t1,$s2,4 #get index of first element by multiplying it by 4 add $t1,$t1,$s4 #add index to base address of array lw $s3,0($t1) #load base address to s0

#check for minimum bge $s0,$s3,skip move $s0,$s3 skip:

#check for maximum ble $s1,$s3,skip1 move $s1,$s3 skip1:

addi $s2,$s2,1 #increase i by one blt $s2,$t0,loop # loop until size

li $v0, 4 la $a0, prompt #prompt for string syscall

li $v0, 1 move $a0, $s0 #prompt for string syscall

li $v0, 4 la $a0, prompt1 #prompt for string syscall

li $v0, 1 move $a0, $s1 #prompt for string syscall

sub $s2,$s0,$s1 jr $ra

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

More Books

Students also viewed these Databases questions

Question

If I called your former employers, what would they say about you?

Answered: 1 week ago

Question

What are the functions of top management?

Answered: 1 week ago

Question

Bring out the limitations of planning.

Answered: 1 week ago

Question

Why should a business be socially responsible?

Answered: 1 week ago

Question

Discuss the general principles of management given by Henri Fayol

Answered: 1 week ago

Question

How autonomous should the target be left after the merger deal?

Answered: 1 week ago