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"
18 ; ---------------------------------------------------------------------------
19 ; Place the startup code in a special segment
23 ; ---------------------------------------------------------------------------
24 ; A little light 6502 housekeeping
26 _init: ldx #$FF ; Initialize stack pointer to $01FF
28 cld ; Clear decimal mode
30 ; ---------------------------------------------------------------------------
31 ; Initialize screen width
32 ; TODO: Can initialization be done in a more idiomatic way?
33 ; TODO: Create function for changing screen width
37 ; ---------------------------------------------------------------------------
38 ; Set cc65 argument stack pointer
40 lda #<(__RAM_START__ + __RAM_SIZE__)
42 lda #>(__RAM_START__ + __RAM_SIZE__)
45 ; ---------------------------------------------------------------------------
46 ; Initialize memory storage
47 ; copydata seems to be only necessary for special systems
49 jsr zerobss ; Clear BSS segment
50 ; jsr copydata ; Initialize DATA segment
51 jsr initlib ; Run constructors
53 ; ---------------------------------------------------------------------------
58 ; ---------------------------------------------------------------------------
59 ; Back from main (this is also the _exit entry): force a software break
61 _exit: jsr donelib ; Run destructors