Add 100 Numbers
ORG 5 ; Origin of program is HEX 100 LDA ADS ; Load first address of operands STA PTR ; Store in pointer LDA NBR ; Load minus 100 (the count of operands) STA CTR ; Store in counter CLA ; Clear accumulator LOP, ADD PTR ; Add an operand to AC (using pointer) ISZ PTR ; Increment pointer ISZ CTR ; Increment counter BUN LOP ; Repeat loop if counter is not zero STA SUM ; Store sum in SUM HLT ; Halt
ADS, HEX 150 ; First address of operands PTR, HEX 0 ; This location reserved for a pointer NBR, DEC -100 ; Constant to initialize counter CTR, HEX 0 ; This location reserved for a counter SUM, HEX 0 ; Sum is stored here
ORG 5 ; Origin of operands is HEX 150 DEC 75 ; First operand DEC 23 ; Last operand
END ; End of symbolic program