In: Computer Science
Write a general-purpose program with loop and indexed addressing
that adds 12h to 0th, 3rd , 7th , 11th ,15th ,19th , ... elements
of a DWORD array. For example, in array:
Array1 DWORD 12h, 13h, 14h,15h, 16h, 17h, 18h, 19h, 1ah, 1bh, 1ch,
1dh, 1eh, 1fh becomes:
Array1 : 24h, 13h, 14h, 27h,16h,17h,18h, 2bh, 1ah, 1bh, 1ch, 2f,
1eh, 1fh
Greetings!!
Code:
Please note that each data take 4 bytes of space in memory since it is declared as double word
.DATA
ARRAY1 DD
12H,13H,14H,15H,16H,17H,18H,19H,1AH,1BH,1CH,1DH,1EH,1FH
.CODE
LEA SI,ARRAY1
MOV CX,4
MOV AX,0
ADD [SI],12H
ADD SI,0CH
ADD [SI],12H
;repetation with indexed addressing mode
RPT:
ADD SI,10H
ADD [SI],12H
LOOP RPT
HLT
Screenshot:

Hope this helps