Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Convert the given code to Floating point numbers in MARS assembly language: .data prompt: .asciiz Maximum number is : prompt1: .asciiz Minimum number

Convert the given code to Floating point numbers in

MARS assembly language:

image text in transcribedimage text in transcribedimage text in transcribed

.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 $54,array #load address of A lw $to,size #load i to to jal getArray Range 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 $81,9999 li $81,9999 li $50,0 li $82,0 loop: mul $t1,$S2,4 #get index of first element by multiplying it by 4 add $t1,$t1,$54 #add index to base address of array lw $53,0($t1) #load base address to so #check for minimum bge $50,$s3,skip move $50,$s3 skip: #check for maximum ble $51,$s3, skip1 move $51,$s3 skip1: addi $82,$s2,1 #increase i by one blt $52,$t0, loop # loop until size li $v0,4 la $a0, prompt #prompt for string syscall #check for maximum ble $51,$s3, skip1 move $51,$s3 skip1: addi $82,$s2,1 #increase i by one blt $s2,$to, loop # loop until size li $v0,4 la $a0, prompt #prompt for string syscall li $v0,1 move $a0, $50 #prompt for string syscall li $v0, 4 la $a0, prompti #prompt for string syscall li $v0, 1 move $a0,$s1 #prompt for string syscall sub $52,$50,$s1 jr Sra .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 $54,array #load address of A lw $to,size #load i to to jal getArray Range 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 $81,9999 li $81,9999 li $50,0 li $82,0 loop: mul $t1,$S2,4 #get index of first element by multiplying it by 4 add $t1,$t1,$54 #add index to base address of array lw $53,0($t1) #load base address to so #check for minimum bge $50,$s3,skip move $50,$s3 skip: #check for maximum ble $51,$s3, skip1 move $51,$s3 skip1: addi $82,$s2,1 #increase i by one blt $52,$t0, loop # loop until size li $v0,4 la $a0, prompt #prompt for string syscall #check for maximum ble $51,$s3, skip1 move $51,$s3 skip1: addi $82,$s2,1 #increase i by one blt $s2,$to, loop # loop until size li $v0,4 la $a0, prompt #prompt for string syscall li $v0,1 move $a0, $50 #prompt for string syscall li $v0, 4 la $a0, prompti #prompt for string syscall li $v0, 1 move $a0,$s1 #prompt for string syscall sub $52,$50,$s1 jr Sra

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

Case Studies In Business Data Bases

Authors: James Bradley

1st Edition

0030141346, 978-0030141348

More Books

Students also viewed these Databases questions