/ To illustrate simple looping in the PAL language, this program / program adds the contents of the array located at label A. At / the start of the program, AADDR contains the address of the / first item in the array, and ALENGTH contains the number of / words in the array. / / Jeff Ondich, 15 Sep 2006 *0200 / Initialize variables. START, CLA CLL DCA TOTAL TAD AADDR DCA PTR TAD ALENGTH SNA JMP END 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. END, 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