]> git.sur5r.net Git - cc65/blob - libsrc/geos/devel/crt0.s
Adjust geos startup code to new compiler handling. Introduce __STARTUP__
[cc65] / libsrc / geos / devel / crt0.s
1 ;
2 ; Startup code for geos
3 ;
4 ; Maciej 'YTM/Elysium' Witkowiak
5 ; 26.10.99, 10.3.2000, 15.8.2001, 23.12.2002
6
7         .export         _exit
8         .export         __STARTUP__ : absolute = 1      ; Mark as startup
9
10         .import         __RAM_START__, __RAM_SIZE__     ; Linker generated
11         .import         initlib, donelib
12         .import         callmain
13         .import         zerobss
14         .importzp       sp
15         .include        "../inc/jumptab.inc"
16
17 ; ------------------------------------------------------------------------
18 ; Place the startup code in a special segment.
19
20 .segment        "STARTUP"
21
22 ; Clear the BSS data
23
24         jsr     zerobss
25
26 ; Setup stack
27
28         lda     #<(__RAM_START__ + __RAM_SIZE__)
29         sta     sp
30         lda     #>(__RAM_START__ + __RAM_SIZE__)
31         sta     sp+1            ; Set argument stack ptr
32
33 ; Call module constructors
34
35         jsr     initlib
36
37 ; Push arguments and call main()
38
39         cli
40         jsr     callmain
41
42 ; Call module destructors.
43
44 _exit:  jsr     donelib         ; Run module destructors
45
46         jmp     EnterDeskTop    ; return control to the system