.ORIG x3000 ;start the program at location x3000 AND R1, R1, #0 ;clear R1, to be used for the running sum AND R4, R4, #0 ;clear R4, to be used as a counter ADD R4, R4, #4 ; initialize R4 with #4, the number of times to add LEA R2, place ; load starting address of array of numbers loop LDR R3, R2, #0 ; load next number to be added ADD R2, R2, #1 ; increment pointer ADD R1, R1, R3 ; number to running sum ADD R4, R4, #-1 ; decrement counter BRp loop ; repeat if counter is not yet zero ADD R0, R1, #0; move sum to R0 HALT place .FILL x0002 .FILL x0004 .FILL x0008 .FILL x000F .END