; Example 1 -- Compute the sum of 12 integers ; This file contains the instructions (in assembly format) ; The file containing the data is ex1_data.asm .ORIG x3000 ; Start program at x3000 LD R1, ADDR ; R1 <- x3100 AND R3, R3, x0 ; R3 <- 0 AND R2, R2, x0 ; R2 <- 0 ADD R2, R2, xC ; R2 <- 12 LOOP BRz DONE ; If Z, goto x300A (PC+5) LDR R4, R1, x0 ; Load next value to R4 ADD R3, R3, R4 ; Add to R4 ADD R1, R1, x1 ; Increment R1 ADD R2, R2, -1 ; Decrement R2 BRnzp LOOP ; Goto x3004 DONE HALT ; HALT ADDR .FILL x3100 .END