#LOOP ### ############## # This exercise will count the sum between 0..10 # Data segment .data # Create words ten: .word 10 one word 1 total: .word 0 #Text segment .text main: Iw $s0, ten loop: Iw $10, one move $s1, $s0 sub $50, $50, $10 add $s1, $s0, $s1 beqz $s0, done j loop done: sw $s1, total li $v0, 10 syscall # Load word into $50 from memory[ten] #Load word into $50 from memory[one] # Copy ($s0) to $s1 # ($50)=($50)-1 # ($s1)=($s0)+($s1) # The execution branch to 'done' if ($s0)=0 # The execution jump back to 'loops' # Store ($s1) into memory[total] #syscall number 10 will exit from program # actually exit the program

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

Solve the following questions by WRITING YOUR INSTRUCTION CODE in Assembly language. 1. Modify the Lab 4 Tutorial 1 to allow USERS TO ENTER the following parameter and displaythefinal result. You are also required to store the results in the memory named ‘output’. Findthesum of the last four numbers in the array. For example, assume the value of n is 10, the sumwill
be 10+9+8+7= 34 (in decimal). Your console should display the following:
Please enter the value of n: 10
The sum of the last four numbers is 34
Thank you. Before computing the difference of the numbers in the array, your code must performachecking; if n < 3, you should display a message ‘The value of n is less than 4’, and no operationwill be performed. In this case, your console should display the following:               Please enter the value of n: 1 
The entered n is less than 3. Thank you                                                                                                                              Type the instructions into your word editor and save it as ‘Lab2Q1.s 

#LOOP
###
##############
# This exercise will count the sum between 0..10
# Data segment
.data
# Create words
ten: .word 10
one word 1
total: .word 0
#Text segment
.text
main:
Iw $s0, ten
loop:
Iw $10, one
move $s1, $s0
sub $50, $50, $10
add $s1, $s0, $s1
beqz $s0, done
j loop
done: sw $s1, total
li $v0, 10
syscall
# Load word into $50 from memory[ten]
#Load word into $50 from memory[one]
# Copy ($s0) to $s1
# ($50)=($50)-1
# ($s1)=($s0)+($s1)
# The execution branch to 'done' if ($s0)=0
# The execution jump back to 'loops'
# Store ($s1) into memory[total]
#syscall number 10 will exit from program
# actually exit the program
Transcribed Image Text:#LOOP ### ############## # This exercise will count the sum between 0..10 # Data segment .data # Create words ten: .word 10 one word 1 total: .word 0 #Text segment .text main: Iw $s0, ten loop: Iw $10, one move $s1, $s0 sub $50, $50, $10 add $s1, $s0, $s1 beqz $s0, done j loop done: sw $s1, total li $v0, 10 syscall # Load word into $50 from memory[ten] #Load word into $50 from memory[one] # Copy ($s0) to $s1 # ($50)=($50)-1 # ($s1)=($s0)+($s1) # The execution branch to 'done' if ($s0)=0 # The execution jump back to 'loops' # Store ($s1) into memory[total] #syscall number 10 will exit from program # actually exit the program
Expert Solution
steps

Step by step

Solved in 2 steps

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