]> git.sur5r.net Git - cc65/blob - libsrc/geos/devel/crt0.s
fixed comments, removed unneeded imports
[cc65] / libsrc / geos / devel / crt0.s
1 ;
2 ; This must be the *second* file on the linker command line
3 ; (.cvt header must be the *first* one)
4
5 ; Maciej 'YTM/Elysium' Witkowiak
6 ; 26.10.99, 10.3.2000, 15.8.2001, 23.12.2002
7
8         .import         __RAM_START__, __RAM_SIZE__     ; Linker generated
9         .import         initlib, donelib
10         .import         callmain
11         .import         _EnterDeskTop
12         .import         zerobss
13         .importzp       sp
14         .export         _exit
15
16 ; ------------------------------------------------------------------------
17 ; Create an empty LOWCODE segment to avoid linker warnings
18
19 .segment        "LOWCODE"
20
21 ; ------------------------------------------------------------------------
22 ; Place the startup code in a special segment.
23
24 .segment        "STARTUP"
25
26 ; Clear the BSS data
27
28         jsr     zerobss
29
30 ; Setup stack
31
32         lda     #<(__RAM_START__ + __RAM_SIZE__)
33         sta     sp
34         lda     #>(__RAM_START__ + __RAM_SIZE__)
35         sta     sp+1            ; Set argument stack ptr
36
37 ; Call module constructors
38
39         jsr     initlib
40
41 ; Push arguments and call main()
42
43         cli
44         jsr     callmain
45
46 ; Call module destructors.
47
48 _exit:  jsr     donelib         ; Run module destructors
49
50         jmp     _EnterDeskTop   ; return control to the system