2 ; Startup code for cc65 (Atari5200 version)
4 ; Christian Groessler (chris@groessler.org), 2014
8 .export __STARTUP__ : absolute = 1 ; Mark as startup
9 .import __RAM_START__, __RAM_SIZE__
10 .import __RESERVED_MEMORY__
12 .import initlib, donelib, callmain
13 .import zerobss, copydata
15 .include "zeropage.inc"
16 .include "atari5200.inc"
24 ; Initialize the data.
29 lda #<(__RAM_START__ + __RAM_SIZE__ - __RESERVED_MEMORY__)
30 ldx #>(__RAM_START__ + __RAM_SIZE__ - __RESERVED_MEMORY__)
32 stx sp+1 ; Set argument stack ptr
34 ; Call the module constructors.
38 ; Push the command-line arguments; and, call main().
42 ; Call the module destructors. This is also the exit() entry.
44 _exit: jsr donelib ; Run module destructors
46 ; A 5200 program isn't supposed to exit.