Assembly language program for sum of data in Array

; ADDING DATA IN ARRAY
; IN SIMPLE TERMS SUM OF ARRAY
; STORING ARRAY IN ROM
ORG 300H        ;
DB 1,4,5,6,7    ;
; ARRAY OF 5
ORG 0000H       ;
; INITIALIZE DATA POINTER
MOV DPTR, #0300H;
; FIRST COUNTER
MOV R7, #05H    ;
; RESETING A
MOV A, #00H     ;
; COUNTER REGISTER FOR ROM ACCESS
MOV R0, #00H    ;
; SUM VARIABLE
MOV R6,#00H     ;
LOOP:
MOV A, R0       ;
MOVC A,@A+DPTR  ;
ADD A, R6       ;
MOV R6,A        ;
INC R0          ;
DJNZ R7, LOOP   ;
END

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s