I need help please (In assembly language) I dont know how to do this task very much, this is my code so far:   .data myarray: void 0,0,0,0,0,0,0,0,0,0 str1: .asciiz "Program Description:    A program that reverses values in an array\n" str2: .asciiz "Author:    Student \n" str3: .asciiz "Date:  02/16/23\n" str4: .asciiz "Enter a number between 1-10 for the array" str5: .asciiz "Enter" str6: .asciiz " number\t" str7: .asciiz " raised to the power of " error1message: .asciiz "Array limit cannot exceed 10, try again:\n"  error2message: .asciiz "Array is not between 1-12, Try Again:\n"  output: .asciiz "Reverse array is: " newline: .asciiz "\n" .text li $v0, 4 la $a0, str1 syscall li $v0, 4 la $a0, str2 syscall li $v0, 4 la $a0, str3 syscall li $s3, 0 li $s4, 12 la $s1, myarray li $s0, la arraylimit:         li $v0, 4     la $a0, str4     syscall     li $v0, 4     la $a0, newline     syscall     li $v0, 5     syscall     add $s1, $v0, $0 #storing into $s1 the array limit value     ble $s1, $s3, error1     bge $s1, $s4, error1      arrayvalue:         li $v0, 4     la $a0, str5  # "Enter "     syscall     li $v0, 4     la $a0, str6   #"number"     syscall     li $v0, 5     syscall         add $s2, $v0, $0 #storing into $s2 thearray value     ble $s2, $s3, error2     bge $s2, $s4, error2     li $s5, 0     addi $s6, $0, 1 inloop:         li $v0, 4     la $a0, newline     syscall          beq, $s0, $0, next     li $v0, 5     syscall     sw, $v0     addi $s1, $s1, 4     addi $s0, $s1, -1     li $v0, 4     la $a0, newline     syscall         j inloop error1:    li $v0, 4         la $a0, newline         syscall     li $v0, 4     la $a0, error1message     syscall     j arraylimit error2:     li $v0, 4     la $a0, newline     syscall     li $v0, 4     la $a0, error2message     syscall     j arrayvalue exit:    add $a0, $s1, $0     li $v0, 1      syscall         li $v0, 4         la $a0, str7         syscall         add $a0, $s2, $0     li $v0, 1      syscall     li $v0, 4     la $a0, output     syscall     add $a0, $s6, $0     li $v0, 1

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

I need help please (In assembly language) I dont know how to do this task very much, this is my code so far:

 

.data
myarray: void 0,0,0,0,0,0,0,0,0,0
str1: .asciiz "Program Description:    A program that reverses values in an array\n"
str2: .asciiz "Author:    Student \n"
str3: .asciiz "Date:  02/16/23\n"
str4: .asciiz "Enter a number between 1-10 for the array"
str5: .asciiz "Enter"
str6: .asciiz " number\t"
str7: .asciiz " raised to the power of "
error1message: .asciiz "Array limit cannot exceed 10, try again:\n" 
error2message: .asciiz "Array is not between 1-12, Try Again:\n" 
output: .asciiz "Reverse array is: "
newline: .asciiz "\n"
.text

li $v0, 4
la $a0, str1
syscall

li $v0, 4
la $a0, str2
syscall

li $v0, 4
la $a0, str3
syscall

li $s3, 0
li $s4, 12

la $s1, myarray
li $s0, la
arraylimit:    
    li $v0, 4
    la $a0, str4
    syscall
    li $v0, 4
    la $a0, newline
    syscall
    li $v0, 5
    syscall
    add $s1, $v0, $0 #storing into $s1 the array limit value
    ble $s1, $s3, error1
    bge $s1, $s4, error1
    
arrayvalue:    
    li $v0, 4
    la $a0, str5  # "Enter "
    syscall
    li $v0, 4
    la $a0, str6   #"number"
    syscall
    li $v0, 5
    syscall
        add $s2, $v0, $0 #storing into $s2 thearray value
    ble $s2, $s3, error2
    bge $s2, $s4, error2
    li $s5, 0
    addi $s6, $0, 1

inloop:    
    li $v0, 4
    la $a0, newline
    syscall
    
    beq, $s0, $0, next
    li $v0, 5
    syscall
    sw, $v0
    addi $s1, $s1, 4
    addi $s0, $s1, -1
    li $v0, 4
    la $a0, newline
    syscall
        j inloop


error1:    li $v0, 4
        la $a0, newline
        syscall
    li $v0, 4
    la $a0, error1message
    syscall
    j arraylimit

error2:
    li $v0, 4
    la $a0, newline
    syscall
    li $v0, 4
    la $a0, error2message
    syscall
    j arrayvalue


exit:    add $a0, $s1, $0
    li $v0, 1 
    syscall
        li $v0, 4
        la $a0, str7
        syscall
        add $a0, $s2, $0
    li $v0, 1 
    syscall
    li $v0, 4
    la $a0, output
    syscall
    add $a0, $s6, $0
    li $v0, 1 
    syscall
    li $v0, 10
    syscall


next: 
    li, $s0, 10 #update loop counter
    la, $s0, myarray
outloop:beq $s0, $0, done
    la $a0, 0($s1)
    li $v0, 1
    syscall
    addi $s1, $s1, 4
    addi $s0, $s0, -1
    j outloop

1. Write a MIPS program to ask user to input the number of elements of array. The user input
should be a positive number less than or equal to 10. Then your program ask the user to fill
up the array and then print the content of array in reverse order. An Example of sample input
and output would be:
Enter the number of elements:
12
Error array can't have more than 10 elements, try again!!
10
Enter number 1:
Enter number 2:
Enter number 3:
Enter number 4:
Enter number 5:
Enter number 6:
Enter number 7:
Enter number 8:
Enter number 9:
Enter number 10:
10
21
32
34
45
56
67
78
89
91
The content of array in reverse order is:
91
89
Transcribed Image Text:1. Write a MIPS program to ask user to input the number of elements of array. The user input should be a positive number less than or equal to 10. Then your program ask the user to fill up the array and then print the content of array in reverse order. An Example of sample input and output would be: Enter the number of elements: 12 Error array can't have more than 10 elements, try again!! 10 Enter number 1: Enter number 2: Enter number 3: Enter number 4: Enter number 5: Enter number 6: Enter number 7: Enter number 8: Enter number 9: Enter number 10: 10 21 32 34 45 56 67 78 89 91 The content of array in reverse order is: 91 89
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY