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
14 .import zerobss, initlib, donelib
16 .include "zeropage.inc"
20 ; ---------------------------------------------------------------------------
21 ; Place the startup code in a special segment
25 ; ---------------------------------------------------------------------------
26 ; A little light 6502 housekeeping
28 _init: ldx #$FF ; Initialize stack pointer to $01FF
30 cld ; Clear decimal mode
32 ; ---------------------------------------------------------------------------
33 ; Set cc65 argument stack pointer
35 lda #<(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__)
37 lda #>(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__)
40 ; ---------------------------------------------------------------------------
41 ; Initialize memory storage
43 jsr zerobss ; Clear BSS segment
44 jsr initlib ; Run constructors
46 ; ---------------------------------------------------------------------------
51 ; ---------------------------------------------------------------------------
52 ; Back from main (this is also the _exit entry):
54 _exit: jsr donelib ; Run destructors
55 jmp RESET ; Display boot menu after program exit