]> git.sur5r.net Git - cc65/blob - libsrc/geos-common/system/crt0.s
Refined the comments in the target start-up files.
[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 __STACKADDR__, __STACKSIZE__        ; Linker generated
10             .import __BACKBUFSIZE__                     ; Linker generated
11             .import initlib, donelib
12             .import callmain
13             .import zerobss
14             .importzp sp
15
16             .include "jumptab.inc"
17             .include "geossym.inc"
18             .include "const.inc"
19
20 ; ------------------------------------------------------------------------
21 ; Place the startup code in a special segment.
22
23 .segment        "STARTUP"
24
25 ; GEOS 64/128 initializes the screen before starting an application while
26 ; Apple GEOS does not. In order to provide identical startup conditions,
27 ; we initialize the screen here, on Apple GEOS. For the same reason, we set
28 ; the pattern and dispBufferOn, even on GEOS 64/128, although we don't use
29 ; them here.
30
31         lda #2                  ; Checkerboard pattern
32         jsr SetPattern
33         lda #<(ST_WR_FORE | .MIN (ST_WR_BACK, __BACKBUFSIZE__))
34         sta dispBufferOn
35 .ifdef __GEOS_APPLE__
36         jsr i_Rectangle
37         .byte 0
38         .byte SC_PIX_HEIGHT-1
39         .word 0
40         .word SC_PIX_WIDTH-1
41 .endif
42
43 ; Clear the BSS data.
44
45         jsr zerobss
46
47 ; Set up the stack.
48
49         lda #<(__STACKADDR__ + __STACKSIZE__)
50         ldx #>(__STACKADDR__ + __STACKSIZE__)
51         sta sp
52         stx sp+1
53
54 ; Call the module constructors.
55
56         jsr initlib
57
58 ; Push the command-line arguments; and, call main().
59
60         cli
61         jsr callmain
62
63 ; Call the module destructors.
64
65 _exit:  jsr donelib
66
67         jmp EnterDeskTop        ; Return control to the system