How to sum up values of an array in assembly?
- by Pablo Fallas
I have been trying to create a program which can sum up all the values of an "array" in assembly, I have done the following:
ORG 1000H
TABLE DB DUP(2,4,6,8,10,12,14,16,18,20)
FIN DB ?
TOTAL DB ?
MAX DB 13
ORG 2000H
MOV AL, 0
MOV CL, OFFSET FIN-OFFSET TABLE
MOV BX, OFFSET TABLE
LOOP: ADD AL, [BX]
INC BX
DEC CL
JNZ LOOP
HLT
END
BTW I am using msx88 to compile this code. But I get an error saying that the code 0 has not been recognized.
Any advise?