Write a program in ARM assembler that will average 64 unsigned integers that are
ID: 2079363 • Letter: W
Question
Write a program in ARM assembler that will average 64 unsigned integers that are stored in an array. The unsigned integers are 32 bit wide words. Assume the base address of the array is stored in register R0. The result should be stored in register R5. The result should be an unsigned integer value. (Assume that the values in the array are small enough such that summing them all does not cause an overflow. Refer to the ARM instruction set reference card on Canvas for the full ARM instruction set)Explanation / Answer
average of 64 unsigned 32-bit words that are store:
TTL Che1
AREA Program, CODE , READONLY
ENTRY
Main
LDR R0 , =Data; load the address
EDR R1 , R1, R1;
EDR R6 , R6, R6;
LDR R2 , length;
LOOP
LDR R4 ,[R0];
ADD R1 ,R1 ,R4;
ADD R0 ,R0 ,#+4;
SUBS R2 , R , #0x1;
BNE LOOP;
STR R1,Result;
MOV R6, #64;
MOV R7 , #x0;
Subtract
SUBS R1 , R1 ,R6;
ADD R7 ,R7 ,#1;
BHI Subtract;
MOV R5 ,R7;
SWI &11;
AREA Data1 ,DATA
Table DCW &2040;
ALIGN;
DEW &1DEA;
ALIGN;
DCW &0256;
ALIGN;
TableEnd DCD 0
AREA Data2 , DATA
Length DCW (TableEnd-Table)/4;
ALIGN;
Result DCW 0
END
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.