]> git.sur5r.net Git - cc65/blob - libsrc/c1p/crt0.s
Suppress call to copydata routine, which seems to
[cc65] / libsrc / c1p / crt0.s
1 ; ---------------------------------------------------------------------------
2 ; crt0.s
3 ; ---------------------------------------------------------------------------
4 ;
5 ; Startup code for Ohio Scientific Challenger 1P
6
7 .export   _init, _exit
8 .import   _main
9
10 .export   __STARTUP__ : absolute = 1        ; Mark as startup
11 .import   __RAM_START__, __RAM_SIZE__       ; Linker generated
12
13 .import    copydata, zerobss, initlib, donelib
14
15 .include  "zeropage.inc"
16
17 ; ---------------------------------------------------------------------------
18 ; Place the startup code in a special segment
19
20 .segment  "STARTUP"
21
22 ; ---------------------------------------------------------------------------
23 ; A little light 6502 housekeeping
24
25 _init:    LDX     #$FF                 ; Initialize stack pointer to $01FF
26           TXS
27           CLD                          ; Clear decimal mode
28
29 ; ---------------------------------------------------------------------------
30 ; Set cc65 argument stack pointer
31
32           LDA     #<(__RAM_START__ + __RAM_SIZE__)
33           STA     sp
34           LDA     #>(__RAM_START__ + __RAM_SIZE__)
35           STA     sp+1
36
37 ; ---------------------------------------------------------------------------
38 ; Initialize memory storage
39 ; copydata seems to be only necessary for special systems
40
41           JSR     zerobss              ; Clear BSS segment
42           ; JSR     copydata           ; Initialize DATA segment
43           JSR     initlib              ; Run constructors
44
45 ; ---------------------------------------------------------------------------
46 ; Call main()
47
48           JSR     _main
49
50 ; ---------------------------------------------------------------------------
51 ; Back from main (this is also the _exit entry):  force a software break
52
53 _exit:    JSR     donelib              ; Run destructors
54           BRK
55