1 ; ---------------------------------------------------------------------------
3 ; ---------------------------------------------------------------------------
5 ; Startup code for Ohio Scientific Challenger 1P
10 .export __STARTUP__ : absolute = 1 ; Mark as startup
11 .import __RAM_START__, __RAM_SIZE__ ; Linker generated
13 .import copydata, zerobss, initlib, donelib
15 .include "zeropage.inc"
17 ; ---------------------------------------------------------------------------
18 ; Place the startup code in a special segment
22 ; ---------------------------------------------------------------------------
23 ; A little light 6502 housekeeping
25 _init: LDX #$FF ; Initialize stack pointer to $01FF
27 CLD ; Clear decimal mode
29 ; ---------------------------------------------------------------------------
30 ; Set cc65 argument stack pointer
32 LDA #<(__RAM_START__ + __RAM_SIZE__)
34 LDA #>(__RAM_START__ + __RAM_SIZE__)
37 ; ---------------------------------------------------------------------------
38 ; Initialize memory storage
39 ; copydata seems to be only necessary for special systems
41 JSR zerobss ; Clear BSS segment
42 ; JSR copydata ; Initialize DATA segment
43 JSR initlib ; Run constructors
45 ; ---------------------------------------------------------------------------
50 ; ---------------------------------------------------------------------------
51 ; Back from main (this is also the _exit entry): force a software break
53 _exit: JSR donelib ; Run destructors