blob: 1eba17b134bdc6f0adef96caa94928955196bad3 (
plain)
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
54
55
56
57
58
59
60
61
|
; "main" routine for assembly source debugging test
; Eventually this code needs to be made more machine independent
; (with the actual code coming from macros in some header file)
; so that the same driver will work for several architectures.
.macro exit0
ldi r4, 1
ldi r0, 0
trap 15
.endm
.macro several_nops
nop
nop
nop
nop
.endm
; FIXME: For now we include crt0.
; For a portable testcase we should use the standard one.
.globl _start
_start:
; set up the stack
ldi sp, 0x8000
mvtc sp, psw ; psw <- SW
ldi sp, 0x7ffe ; 0x7ffe is a magic number known to gdb: "top of stack"
; Call main, then exit.
bl main
bl exit
; Program begins here.
.global main
main:
st r13,@-sp
; Call a macro that consists of several lines of assembler code.
several_nops
; Call a subroutine in another file.
bl foo2
; All done.
exit0
; A routine for foo2 to call.
.global foo3
foo3:
st r13,@-sp
ld r13,@sp+
jmp r13
.global exit
exit:
exit0
|