summaryrefslogtreecommitdiffstats
path: root/Bachelor/Mikroprozessorsysteme2/ARM202U/EXAMPLES/BASICASM/GCD1.S
blob: fec499f6b475cbcab23b41a61ac261d66ce69593 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
	AREA 	gcd1, CODE, READONLY	; name this block of code
	ENTRY							; mark first instruction
									; to execute
start
	MOV		r0, #1					; Set up parameters
	MOV		r1, #2
	BL		gcd						; Call subroutine
	SWI		0x11					; terminate

gcd	
	CMP 	r0, r1
	BEQ 	end
	BLT 	less
	SUB 	r0, r0, r1
	BAL 	gcd
less
	SUB 	r1, r1, r0
	BAL 	gcd
end	MOV		pc,lr

	END								; mark end of file