Question

Modify your asm code further so that you can copy the entire array of numbers (1 to 100) to a different location in the memory (starting from 0x0000_0200h location, i.e. offset of 200h). Lab6.s (MIPS assemblv code .data tmpval: .word 5 globl main .text main # above codes are mandat ry (entry to main function) #

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Please find the code below:::

.data
source : .word 1 2 3 4 5 6
destination : .space 24
N : .word 6 #size is 100
.globl main
.text
main:
la $s0,source #get source address
la $s1,destination #get destination address
lw $s2,N #get size
li $t0,0 #int i = 0;
loop:
bge $t0,$s2,exit #if i is not < N exit
mul $t1,$t0,4 #get address of i
add $t2,$t1,$s0 #get base address of source[i]
add $t3,$t1,$s1 #get base address of destination[i]
lw $t2,($t2) #get source[i] value
sw $t2,($t3) #store value to destination[i]


add $t0,$t0,1 # i++
j loop
exit:


li $v0,10
syscall

Edit Execute copy array from one location to another.asm 1 .data 2 source : .word 1 23 4 5 6 3 destination : .space 24 4 N :

Add a comment
Know the answer?
Add Answer to:
Modify your asm code further so that you can copy the entire array of numbers (1...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • This assignment is designed to introduce you to using memory, input/output syscalls and if statements a....

    This assignment is designed to introduce you to using memory, input/output syscalls and if statements a. Open the text editor and type in the following. Then save your work as “assign3.asm”. Note that there are 3 words of memory indicated that start at the address 0x10010000. Do not use labels in the data segment. .data .word 0 .word 0 .word 0 .globl main .text main: b. Add the following zero terminated ascii strings (.asciiz) to the data segment right above...

  • Please comment the MIPS code to help me understand. Here is what the code accomplishes. Here...

    Please comment the MIPS code to help me understand. Here is what the code accomplishes. Here is the code, partially commented. .data Matrix: .word 41,45,5, 34,8, 15,16,23,44,48,12,32,18,47,22,8,22 .word 46,40,42,33,13,38,27,6, 29,25,18,40,47,22,26,14,3 .word 7, 48,35,9, 43,38,9, 49,28,25,42,5, 44,10,5, 38,14 .word 46,33,16,6, 13,20,31,1, 8, 17,1, 47,28,46,14,28,7 .word 32,2, 48,25,41,29,14,39,43,46,3, 39,32,49,41,28,46 .word 5, 43,2, 48,13,4, 33,41,32,19,9, 25,30,22,2, 9, 40 .word 14,47,22,18,47,3, 35,44,18,6, 33,22,11,6, 47,50,4 .word 28,34,20,30,18,27,38,5, 26,40,37,23,16,13,37,8,7 .word 48,38,39,12,10,39,23,20,21,20,33,16,24,21,25,3,46 .word 49,38,40,38,13,47,5, 13,4, 13,23,26,12,30,29,29, 3 .word 8, 20,10,13,31,7, 12,41,12,21,28,26,43,14,35,10,19 .word 49,33,25,26,24,29,46,22,7, 5, 15,41,10,31,19,41,27 .word 48,9,...

  • There is an example below Now that everything is working you can try the following exercises. To complete them you wi...

    There is an example below Now that everything is working you can try the following exercises. To complete them you will need to refer to the documentation in Appendix A The MiteASM Assembler and Appendix B The MiteFPGA Processor. Write an assembly language program for an over counter for a cricket umpire. This should 1. display a count on the 7-segment display. The count should increase by 1 when button 0 is pressed. It should reset to 0 when button...

  • 5 Exercises Now that everything is working you can try the following exercises. To complete them you will need to refer...

    5 Exercises Now that everything is working you can try the following exercises. To complete them you will need to refer to the documentation in Appendix A- The MiteASM Assembler and Appendix B - The MiteFPGA Processor. Write an assembly language program for an over counter for a cricket umpire. This should display a count on the 7-segment display. The count should increase by 1 when button 0 is 1. pressed. It should reset to 0 when button 1 is...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT