* device/include/malloc.h: Added z80 and gbz80 support.
[fw/sdcc] / device / lib / gbz80 / crt0.s
1         ;; Generic crt0.s for a GBZ80
2         .globl  _main
3
4         .area _HEADER (ABS)
5         ;; Reset vector
6         .org    0
7         jp      init
8
9         .org    0x08
10         reti
11         .org    0x10
12         reti
13         .org    0x18
14         reti
15         .org    0x20
16         reti
17         .org    0x28
18         reti
19         .org    0x30
20         reti
21         .org    0x38
22         reti
23
24         .org    0x100
25         jp      0x150
26                 
27         .org    0x150
28 init:
29         di
30         ;; Stack at the top of memory.
31         ld      sp,#0xdfff        
32
33         ;; Setup global data
34         call    gsinit
35         
36         ;; Use _main instead of main to bypass sdcc's intelligence
37         call    _main
38         jp      _exit
39
40         ;; Ordering of segments for the linker.
41         .area   _CODE
42         .area   _GSINIT
43         .area   _GSFINAL
44         
45         .area   _DATA
46         .area   _BSS
47         .area   _HEAP
48
49         .area   _CODE
50 __clock::
51         ld      a,#2
52         rst     0x08
53         ret
54         
55 _exit::
56         ;; Exit - special code to the emulator
57         ld      a,#0
58         rst     0x08
59 1$:
60         halt
61         jr      1$
62
63         .area   _GSINIT
64 gsinit::        
65
66         .area   _GSFINAL
67         ret