File: test_cntr.asm

package info (click to toggle)
simulavr 0.1.2.2-6.1
  • links: PTS
  • area: main
  • in suites: lenny, squeeze
  • size: 2,756 kB
  • ctags: 3,179
  • sloc: ansic: 19,987; sh: 3,623; python: 3,528; makefile: 406; asm: 308; yacc: 145; lex: 48
file content (53 lines) | stat: -rw-r--r-- 1,229 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
;
; $Id: test_cntr.asm,v 1.1 2001/11/21 22:04:45 troth Exp $
;
; Use simple opcodes to test the instruction decoder.
;
;;; .device         AT90S8515

.include        "8515def.inc"

;;; .cseg
        rjmp    MAIN            ; reset
        nop                     ; int0
        nop                     ; int1
        nop                     ; timer1 capt
        nop                     ; timer1 compa
        nop                     ; timer1 compb
        nop                     ; timer1 ovf
        nop                     ; timer0 ovf
        nop                     ; spi, stc
        nop                     ; uart, rx
        nop                     ; uart, udre
        nop                     ; uart, tx
        nop                     ; ana_comp

MAIN:
	;; init stack pointer to 0x025f (the last byte of int sram)
		ldi		r16, 0x5f		; low byte of end of int sram
		out		SPL, r16
		ldi		r16, 0x02		; high byte of end of int sram
		out		SPH, r16

		ldi		r16, 0xff		; initialize outer loop counter

LOOP1:
		cpi		r16, 0x00
		breq	DONE
		dec		r16
		rcall	INNER
		rjmp	LOOP1

INNER:
		ldi		r17, 0xff		; initialize inner loop counter

LOOP2:
		cpi		r17, 0x00
		breq	REPEAT
		dec		r17
		rjmp	LOOP2
REPEAT:
		ret
	
DONE:	
		nop