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 zerobss, initlib, donelib
15 .include "zeropage.inc"
19 ; ---------------------------------------------------------------------------
20 ; Place the startup code in a special segment
24 ; ---------------------------------------------------------------------------
25 ; A little light 6502 housekeeping
27 _init: ldx #$FF ; Initialize stack pointer to $01FF
29 cld ; Clear decimal mode
31 ; ---------------------------------------------------------------------------
32 ; Set cc65 argument stack pointer
34 lda #<(__RAM_START__ + __RAM_SIZE__)
36 lda #>(__RAM_START__ + __RAM_SIZE__)
39 ; ---------------------------------------------------------------------------
40 ; Initialize memory storage
42 jsr zerobss ; Clear BSS 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
54 jmp RESET ; Display boot menu after program exit