;The semicolon is used to lead an inline documentation
;When you write your program, you could have your info at the top document block
;For Example: Your Name, Student Number, what the program is for, and what it does 

;
; See if you can figure out what this program does
;
;;; Directives
	PRESERVE8
	THUMB 
; Vector Table Mapped to Address 0 at Reset
; Linker requires __Vectors to be exported
	AREA RESET, DATA, READONLY
	EXPORT __Vectors
__Vectors 
	DCD 0x20001000 ; stack pointer value when stack is empty
	DCD Reset_Handler ; reset vector
 
	ALIGN
 
;Your Data section
;AREA DATA
; AREA MYRAM, DATA, READWRITE

	
SUM DCD 0
SUMP DCD SUM
N DCD 7
NUM1 DCD 3, -7, 2, -2, 10, 20, 30



; The program
; Linker requires Reset_Handler
	AREA MYCODE, CODE, READONLY
	 ENTRY
	 EXPORT Reset_Handler
Reset_Handler
;;;;;;;;;;User Code Start from the next line;;;;;;;;;;;;
 
	MOV R0, #7
	MOV R3, #0
	LDR R1, =NUM1
	
LOOP
	
	LDR R2, [R1], #4
	
	CMP R2, #5
	BLE SKIP
	ADD R3, R3, R2
	
SKIP	
	SUB R0, R0, #1
	
	CMP R0, #0
	BNE LOOP
	



STOP
	B STOP
	END 