# CSC230 Sp19 Midterm Asm; Name:
View the step-by-step solution to:

Question

# CSC230 Sp19 Midterm Asm; Name: XXXXXXXXXXXXXXXXXXXXXX


# //Write the assembly for the

following loop


# //Use either indexed or pointer array access


# int A[16], B[3*16];


# for (int i=0; i < 16; i+=2) {


# A[i] = A[i] + B[2*i];


# }


.data # DO NOT CHANGE THIS TEST DATA


A: .word 0, 1, 2, 3, 4, 5, 6, 7,


.word 8, 9, 10, 11, 12, 13, 14, 15


endA:


B: .word 0, 0, 0, 10, 10, 10, 20, 20, 20, 30, 30, 30,


.word 40, 40, 40, 50, 50, 50, 60, 60, 60, 70, 70, 70,


.word 80, 80, 80, 90, 90, 90, 100,100,100, 110,110,110,


.word 120,120,120, 130,130,130, 140,140,140, 150,150,150


aSize: .word 16


.text


.globl main


main:


li $t0, 0 # Starting index of t0=i


lw $s7, aSize # Loop bound


la $s0, A # &A


la $s6, endA # &endA


la $s1, B # &B


loop:


#TODO: Write the loop code


exit:


li $v0, 10


syscall

Recently Asked Questions

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Ask Expert Tutors You can ask 0 bonus questions You can ask 0 questions (0 expire soon) You can ask 0 questions (will expire )
Answers in as fast as 15 minutes