Write and run an 8086 assembly language program that finds the sum of odd placed values out of 10 consecutive byte values stored in an array in the memory. For example, if 10 consecutive byte values (in hexadecimal) are - 12, AA, 13, AB, 14, AC, 15, AD, 16, AF, then this program should add only value 12, 13, 14, 15 and 16.
Answers
Answered by
5
DATA SEGMENT
ARR DB 12, 13, 14, 15, 16
LEN DW $-ARR
SUM DW ?
DATA ENDS
CODE SEGMENT
ASSUME DS:DATA CS:CODE
START:
MOV AX,DATA
MOV DS,AX
LEA SI,ARR
MOV AX,0
MOV CX,LEN
REPEAT:
MOV BL,ARR[SI]
MOV BH,0
ADD AX,BX
INC SI
LOOP REPEAT
MOV SUM,AX
MOV AH,4CH
INT 21H
CODE ENDS
END START
Similar questions