;  add array  terminate with 0
;  show how to access array
;  all cores do the same

;  i = 0; s = 0;
;  while ax[i] != 0
;     s = s + ax[i]
;     i++


; r1 s, r2 i, r3 ax[i], r5 &ax

  clr 2		; i = 0
  clr 1		; s = 0
  clr 5	
  addi 5 5 #100 ; base &ax
:loop
  ldx 0	5 2	; get ax[i] to all cores
  ldx 1 5 2
  ldx 2 5 2
  ldx 3 5 2
  ldr 3		; to r3
  jz 3 @exit	; ax[i] == 0 ?
  add 1 1 3	; s += ax[i]
  inc 2		; i++
  jmp @loop
:exit
  sys 4
.end

@100		; ax[.]
1 2 3 4 5 0
.end

