Imported Upstream version 2.9.0
[debian/cc1111] / device / lib / z80 / crt0.s
1         ;; Generic crt0.s for a Z80
2         .module crt0
3         .globl  _main
4
5         .area   _HEADER (ABS)
6         ;; Reset vector
7         .org    0
8         jp      init
9
10         .org    0x08
11         reti
12         .org    0x10
13         reti
14         .org    0x18
15         reti
16         .org    0x20
17         reti
18         .org    0x28
19         reti
20         .org    0x30
21         reti
22         .org    0x38
23         reti
24
25         .org    0x100
26 init:
27         ;; Stack at the top of memory.
28         ld      sp,#0xffff
29
30         ;; Initialise global variables
31         call    gsinit
32         call    _main
33         jp      _exit
34
35         ;; Ordering of segments for the linker.
36         .area   _HOME
37         .area   _CODE
38         .area   _GSINIT
39         .area   _GSFINAL
40
41         .area   _DATA
42         .area   _BSS
43         .area   _HEAP
44
45         .area   _CODE
46 __clock::
47         ld      a,#2
48         rst     0x08
49         ret
50
51 _exit::
52         ;; Exit - special code to the emulator
53         ld      a,#0
54         rst     0x08
55 1$:
56         halt
57         jr      1$
58
59         .area   _GSINIT
60 gsinit::
61
62         .area   _GSFINAL
63         ret