/ This program adds the contents of the array located at label A. / We assume that ALENGTH is greater than zero. (The loop does not / handle the ALENGTH=0 case correctly.) / / Jeff Ondich, 15 Sep 2006 *0200 / Initialize variables. START, CLA CLL DCA TOTAL TAD AADDR DCA PTR TAD ALENGTH CMA IAC DCA COUNTER / Compute the sum of the array elements. LOOP, TAD TOTAL TAD I PTR DCA TOTAL CLA IAC TAD PTR DCA PTR ISZ COUNTER JMP LOOP / Put the answer in the AC and halt. TAD TOTAL HLT TOTAL, 0000 PTR, 0000 COUNTER, 0000 *0300 / The array's address and size. AADDR, A ALENGTH, 0004 / The array. A, 0002 0003 0002 0005