1
0
mirror of https://github.com/cc65/cc65.git synced 2024-11-04 02:05:13 +00:00
cc65/libsrc/geos-common/system/crt0.s
ol.sc ffc06fcea3 Apple GEOS reserves beside the main app area at $4000-$C000 a secondary app area at $0C00-$2000. While it was an elegant idea to use that secondary area for overlays at the end of the day those 5 kB are just too small. So now overlays go at the end of the main area (as with GEOS 64/128).
However the stack (usually 1 kB) can be securely placed in the secondary area without effort from the side of the developer. The rest of the secondary area (usually 4 kB) is made available to the developer as (uninitialized) 'EXTBSS'.

git-svn-id: svn://svn.cc65.org/cc65/trunk@5696 b7a2c559-68d2-44c3-8de9-860c34a00d81
2012-06-08 21:46:51 +00:00

68 lines
1.5 KiB
ArmAsm

;
; Startup code for geos
;
; Maciej 'YTM/Elysium' Witkowiak
; 26.10.99, 10.3.2000, 15.8.2001, 23.12.2002
.export _exit
.export __STARTUP__ : absolute = 1 ; Mark as startup
.import __STACKADDR__, __STACKSIZE__ ; Linker generated
.import __BACKBUFSIZE__ ; Linker generated
.import initlib, donelib
.import callmain
.import zerobss
.importzp sp
.include "jumptab.inc"
.include "geossym.inc"
.include "const.inc"
; ------------------------------------------------------------------------
; Place the startup code in a special segment.
.segment "STARTUP"
; GEOS 64/128 initializes the screen before starting an application while
; Apple GEOS does not. In order to provide identical startup conditions
; we initialize the screen here on Apple GEOS. For the same reason we set
; the pattern and dispBufferOn even on GEOS 64/128 although we don't use
; them here.
lda #2 ; Checkerboard pattern
jsr SetPattern
lda #<(ST_WR_FORE | .MIN (ST_WR_BACK, __BACKBUFSIZE__))
sta dispBufferOn
.ifdef __GEOS_APPLE__
jsr i_Rectangle
.byte 0
.byte SC_PIX_HEIGHT-1
.word 0
.word SC_PIX_WIDTH-1
.endif
; Clear the BSS data.
jsr zerobss
; Setup stack.
lda #<(__STACKADDR__ + __STACKSIZE__)
ldx #>(__STACKADDR__ + __STACKSIZE__)
sta sp
stx sp+1
; Call module constructors.
jsr initlib
; Push arguments and call main().
cli
jsr callmain
; Call module destructors.
_exit: jsr donelib
jmp EnterDeskTop ; Return control to the system