;PROADD_5_2--G13_14_2

;**********************************************************
;	source module 2

public	proadd

;**********************************************************
data	segment	common
  ary		dw	1,2,3,4,5,6,7,8,9,10
  count		dw	10
  sum		dw	?
data	ends
;**********************************************************
code2	segment
  
proadd	proc	far		;define subprocedure

	assume	cs:code2,ds:data

	mov	ax,data
	mov	ds,ax
;
	push	ax		;save the registers
	push	cx
	push	si
	lea	si,ary		;put addr of ary in si
	mov	cx,count	;put count in cx
	xor	ax,ax		;clear ax
next:	add	ax,[si]		;add the elements of the
	add	si,2		;  array to AX
	loop	next		    
	mov	sum,ax		;store the result in sum
	pop	si		;restore the registers
	pop	cx
	pop	ax
	ret			;return
proadd	endp			;end subprocedure
;----------------------------------------------------------
code2   ends			;end of code segment
;**********************************************************
	end			;end assembly
