summaryrefslogtreecommitdiffstats
path: root/Bachelor/Mikroprozessorsysteme2/ARM202U/EXAMPLES/BASICASM/GCD2.S
blob: 8fbc660363113c59e7fca83d068b7d7a34f7838c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
	AREA 	gcd2, 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
	SUBGT 	r0, r0, r1
	SUBLT 	r1, r1, r0
	BNE 	gcd
	MOV		pc,lr

	END								; mark end of file