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

Create a WORD size array of atleast 10 elements. Use a loop to get the sum of al

ID: 3734377 • Letter: C

Question

Create a WORD size array of atleast 10 elements. Use a loop to get the sum of all of the elements in the array. Use EDI register for OFFSET of the array:

------Template to use:------------

TITLE

; Insert comment of what program will do here

INCLUDE Irvine32.inc

.data ; enter DATA below

.code ; enter CODE below

main PROC

CALL DumpRegs ;

CALL DumpMem ;

exit

main ENDP

END main

-----------------------------------

*The code needs to be in Assembly language* In our class we use MASM6.15

PLEASE DONT COPY AND PASTE AN ANSWER IN HERE. Please answer it with comments so I can follow.

Explanation / Answer

.stack

.data // data segment is the starting point of the data in the program

v1 db // db- define bytes

1,2,3,4,5,6,7,8,9,10

s db 0

.code

start : // used to lable the starting point of the code

mov ax,@data // mov is used to move ax to the data element

mov ds,ax

sum1:

mov dx,offset v1

add s, [dx]

inc dx // will increment the address value present in dx register

loop sum1 // this is the end of the loop

cmp dx ,10 // compare

jne sum1 // jump if not equal usually after cmp.

mov dl,s

mov al,2

mov ah,40h

mov bx,1

mov cx,1

move dx,offset s // offset is some absolute value beyond the base address , loads dx with the address of s

mov ah,4ch

end start // end point of the segment in the program