Declare four words of input data in the same section


Problem

Convert the following code in arm assembly to take its inputs from memory and store its sums to memory instead of registers. Declare four words of input data in the same section as your code; they will form an array of four words starting at variable black. You may use pre-indexed or post-indexed addressing. Store your final sums into memory in the read-write data section into two words starting at variable red.

Code:

ENTRY

LDR R1,=0x12345678 ; Load the values to R1-R4
LDR R2,=0xD042CA9E
LDR R3,=0x00334400
LDR R4,=0x00AABB00

LDR R7,=0xFFFF ; Load 0x0000FFFF in R7
LDR R8,=0xFFFF0000 ; Load 0xFFFF0000 in R8

AND R9,R1,R7 ; Extract lower 16 bits of R1 in R9
AND R10,R2,R8 ; Extract higher 16 bits of R2 in R10
LSR R10,R10,#16 ; Right shift R10 by 16 bits, so higher 16 bits of R2 is in lower 16 bits of R10
ADD R5,R9,R10 ; Add R9 with R10 and result in R5

AND R9,R3,R7 ; Extract lower 16 bits of R3 in R9
AND R10,R4,R8 ; Extract higher 16 bits of R4 in R10
LSR R10,R10,#16 ; Right shift R10 by 16 bits, so higher 16 bits of R4 is in lower 16 bits of R10
ADD R6,R9,R10 ; Add R9 with R10 and result in R6

stop B stop ; Stop program

END

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Declare four words of input data in the same section
Reference No:- TGS03232978

Expected delivery within 24 Hours