Instructions: You will upload your .pepl file for this assignment. 1. Complete the following code shell so that the array arr3 will contain the element-by- element sum of arrays arr1 and arr2 that would be equivalent to the code: for j in range(len(arr1)): arr3.append(arr1[j]+arr2[j]) ;PEP9 Program: add 2 arrays ;================================ br main ;================================= ;global variables maxv: .EQUATE 12 ;arrays will have 12 bytes arr1: .WORD 5 ;******declare and initialize array .WORD 4 ; arr1[ ] = {5,4,6,7,8,2} ********* .WORD 6 .WORD 7 .WORD 8 .WORD 2 arr2: .WORD 1 ;******declare and initialize array .WORD 1 ; arr2[ ] = {1,1,5,0,-2,-3} ********* .WORD 5 .WORD 0 .WORD -2 .WORD -3 arr3: .BLOCK 12 ;******declare: 'arr3' will have 6 elements ********* ;==================================== ;******main starts here ... main: LDWX 0,i ;initialize X as the array offset lp1: ;insert PEP9 code to implement arr3[x] = arr1[x] + arr2[x] ;using indexed addressing ADDX 2,i CPWX maxv,i BRLT lp1 ;loop to output to resulting array with some formatting ... STRO ostr,d ;output a message starting at 'ostr' LDWX 0,i ;initialize the offset LP2: DECO arr3,x ;output array element arr3t[x] to screen STRO endl,d ;output 'endl' ADDX 2,i ;check the loop counter CPWX maxv,i BRLT LP2 STOP ;define string array data (NOTE: each string array MUST end with "\x00") ... ostr: .ASCII "Array addition \n\x00" ;string array construction using .ASCII endl: .ASCII " \n\x00" ;'endl' = end line using .ASCII

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

Instructions: You will upload your .pepl file for this assignment.

1. Complete the following code shell so that the array arr3 will contain the element-by-
element sum of arrays arr1 and arr2 that would be equivalent to the code:
for j in range(len(arr1)):
arr3.append(arr1[j]+arr2[j])

;PEP9 Program: add 2 arrays
;================================
br main
;=================================
;global variables
maxv: .EQUATE 12 ;arrays will have 12 bytes
arr1: .WORD 5 ;******declare and initialize array
.WORD 4 ; arr1[ ] = {5,4,6,7,8,2} *********
.WORD 6
.WORD 7
.WORD 8
.WORD 2
arr2: .WORD 1 ;******declare and initialize array
.WORD 1 ; arr2[ ] = {1,1,5,0,-2,-3} *********
.WORD 5
.WORD 0
.WORD -2
.WORD -3
arr3: .BLOCK 12 ;******declare: 'arr3' will have 6 elements *********
;====================================
;******main starts here ...
main: LDWX 0,i ;initialize X as the array offset
lp1:
;insert PEP9 code to implement arr3[x] = arr1[x] + arr2[x]
;using indexed addressing

ADDX 2,i
CPWX maxv,i
BRLT lp1

;loop to output to resulting array with some formatting ...
STRO ostr,d ;output a message starting at 'ostr'
LDWX 0,i ;initialize the offset
LP2: DECO arr3,x ;output array element arr3t[x] to screen
STRO endl,d ;output 'endl'

ADDX 2,i ;check the loop counter

CPWX maxv,i
BRLT LP2
STOP

;define string array data (NOTE: each string array MUST end with "\x00") ...
ostr: .ASCII "Array addition \n\x00" ;string array construction using .ASCII
endl: .ASCII " \n\x00" ;'endl' = end line using .ASCII

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 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