I\'m having trouble with this homework assignment. It is coded in ARM Assembly,
ID: 3755876 • Letter: I
Question
I'm having trouble with this homework assignment. It is coded in ARM Assembly, and I would appreciate it if you could leave comments explaining what is happening for each line of code. If not, I understand. Thank you!
An array contains 100 integers. The array is stored in the data section of the MSP432 memory. Array_ptr is a pointer that points to the first element in this array. It is defined in the .data section of MSP432. Write a snippet of code in ARM assembly that will check every element in the array, and count the total number of even integers. Store the even numbers on another stack pointed to by array_ptr2. Assume there is enough ram space available for both arrays.
Explanation / Answer
mov bx,28 ; bx indexes row 2
xor si,si ; si will index columns
mov cx,7 ; # elements in a row
clear:
mov [bx + si + A],0 ; clear A[2,j]
add si,2 ; go to next column
loop clear ; loop until done
mov si,6 &n bsp; ; si indexes column 3
xor bx,bx ; bx will index rows
mov cx,5 &n bsp; ; #elements in a column
clear:
mov [bx + si + A],0 ; clear A[i,3]
add bx,14 ; go to next row
loop clear ; loop until done
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.