;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
		
string1
	DCB "ARM assembly language is important to learn!",0
	
	
;Your Data section
;AREA DATA
 AREA MYRAM, DATA, READWRITE

	

buf
	 space 1000
; The program
; Linker requires Reset_Handler
	AREA MYCODE, CODE, READONLY
	 ENTRY
	 EXPORT Reset_Handler


decr	proc	 
	
	ROR R4, R2, R3 
	STR R4, [R10], #4 ;
	BX LR
	
	endp
		
		
		
		 
Reset_Handler
;;;;;;;;;;User Code Start from the next line;;;;;;;;;;;;
 
	LDR R1, =string1
	mov R0, #0
	MOV R3, #2
	LDR R10, =buf
	
loop2	
	LDRB R2, [R1]
	cmp R2, R0
	BEQ STOP
	
	BL decr
	
	ADD  R1,R1, #1
	
	b loop2
	
	
 

STOP
	B STOP
	END 