Using the Array Sum example below. How do I Modify this example for an Array of
ID: 3811474 • Letter: U
Question
Using the Array Sum example below. How do I Modify this example for an Array of doublewords? Array Sum Example Indirect operands are ideal for traversing an array Note that the register in brackets must be incremented by a value that matches the array type data array W WORD 1000h,2000h,3000h. code mov esi,OFFSET arrayW Or add esi, TYPE arrayW mov ax, [esi] add esi,2 add ax, [esi] AX sum of the array add esi, 2 add ax, [esi] ToDo: Modify this example for an array of doublewords. 59 Irvine, Kip R. Assembly Language for x86 Processors6e, 2010.Explanation / Answer
Modified Program:-
.data
arrayW WORD 1000h,2000h,3000h
.code
mov esi,OFFSET arrayW
mov ax,[esi]
add esi,4
add ax,[esi]
add esi,4
add ax,[esi]
Explanation :-each element in array of doublewords occupies just double of the space occupied by the elements in array of words. So, we need to increase the amount of offset to next element to twice of the number. In array of words =4 ,therefore in array of doublewords it's 8
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.