Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write an ARM assembly program that calculates the sum and average of a table of

ID: 3767167 • Letter: W

Question

Write an ARM assembly program that calculates the sum and average of a table of 64-bit integers.    Use the table provided below in your program.  Store the 64-bit sum at location 0x40000000 and the 64-bit average at location 0x40000008.  The DCQ directive allocates one or more eight-byte blocks of memory, aligned on four-byte boundaries, and define the initial runtime contents of the memory.  You will need to use the ADC (add with carry) instruction.  See section 7.4.3 on page 133.

Submit your .s file (that is the file containing your source code) through Blackboard. Be sure to follow the programming guidelines.

tableSize       EQU 16

sum                EQU 0x40000000

average          EQU 0x40000008

table   DCQ   0x0200200AD00236DD

            DCQ   0x00003401AAC4D097

            DCQ   0x000001102ACFF200

            DCQ   0x00010AA0AD3C66DF

            DCQ   0x0000FC3D76400CCB

            DCQ   0x000090045ACDD097

            DCQ   0x00000FF000004551

            DCQ   0x00000000003C66DF

            DCQ   0x1000200AD00236DD

            DCQ   0x00003401AAC4D097

            DCQ   0x000001102ACFF200

            DCQ   0x00010AA0AD3C66DF

            DCQ   0x1000FC3D76400CCB

            DCQ   0x000090045ACDD097

            DCQ   0x00000FF000004551

            DCQ   0x00000000003C66DF

Explanation / Answer

.MODEL SMALL .DATA VAL1 DB ? NL1 DB 0AH,0DH,'ENTER HOW MANY NO U WANT:','$' NL2 DB 0AH,0DH,'ENTER NO:','$' NL3 DB 0AH,0DH,'AVEARGE:','$' .CODE MAIN PROC MOV AX,@DATA MOV DS,AX LEA DX,NL1 MOV AH,09H INT 21H MOV AH,01H INT 21H SUB AL,30H MOV CL,AL MOV BL,AL MOV AL,00 MOV VAL1,AL LBL1: LEA DX,NL2 MOV AH,09H INT 21H MOV AH,01H INT 21H SUB AL,30H ADD AL,VAL1 MOV VAL1,AL LOOP LBL1 LBL2: LEA DX,NL3 MOV AH,09H INT 21H MOV AX,00 MOV AL,VAL1 DIV BL ADD AX,3030H MOV DX,AX MOV AH,02H INT 21H MOV AH,4CH INT 21H MAIN ENDP END MAIN

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote