* Improved the pop params code
[fw/sdcc] / device / lib / z80 / crt0.s
1         ;; Generic crt0.s for a Z80
2         .globl  __main
3
4         .area _HEADER (ABS)
5         ;; Reset vector
6         .org    0
7         jp      init
8
9         .org    0x38
10         reti
11         
12         .org    0x150
13 init:
14         ;; Stack at the top of memory.
15         ld      sp,#0xffff        
16
17         ;; Use _main instead of main to bypass sdcc's intelligence
18         call    __main
19         jp      _exit
20
21         ;; Ordering of segments for the linker.
22         .area   _CODE
23         .area   _DATA
24
25         .area   _CODE
26 _exit::
27         ;; Exit - special code to the emulator
28         ld      a,#0
29         out     (1),a
30 1$:
31         halt
32         jr      1$