]> git.sur5r.net Git - cc65/blob - libsrc/geos-common/system/crt0.s
Normalized coding style.
[cc65] / libsrc / geos-common / system / 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             .import __VLIR0_START__, __VLIR0_SIZE__     ; Linker generated
10             .import __STACKSIZE__                       ; Linker generated
11             .import initlib, donelib
12             .import callmain
13             .import zerobss
14             .importzp sp
15
16             .include "jumptab.inc"
17
18 ; ------------------------------------------------------------------------
19 ; Place the startup code in a special segment.
20
21 .segment        "STARTUP"
22
23 ; Clear the BSS data
24
25         jsr zerobss
26
27 ; Setup stack
28
29         lda #<(__VLIR0_START__ + __VLIR0_SIZE__ + __STACKSIZE__)
30         sta sp
31         lda #>(__VLIR0_START__ + __VLIR0_SIZE__ + __STACKSIZE__)
32         sta sp+1                ; Set argument stack ptr
33
34 ; Call module constructors
35
36         jsr initlib
37
38 ; Push arguments and call main()
39
40         cli
41         jsr callmain
42
43 ; Call module destructors.
44
45 _exit:  jsr donelib             ; Run module destructors
46
47         jmp EnterDeskTop        ; return control to the system