Force an import of the special symbol __STARTUP__ in the C compiler when
main() is encountered. Define this symbol in the startup code. This will automatically force linking of the startup code which can then reside inside the standard library as any other object file. git-svn-id: svn://svn.cc65.org/cc65/trunk@3988 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
;
|
||||
; Startup code for cc65 (Apple2 version)
|
||||
;
|
||||
; This must be the *first* file on the linker command line
|
||||
;
|
||||
|
||||
.export _exit
|
||||
.export __STARTUP__ : absolute = 1 ; Mark as startup
|
||||
.import zerobss
|
||||
.import initlib, donelib
|
||||
.import callmain, callirq
|
||||
@@ -40,13 +39,13 @@
|
||||
; Switch in LC bank 2 for W/O
|
||||
bit $C081
|
||||
bit $C081
|
||||
|
||||
|
||||
; Set source start address
|
||||
lda #<(__ZPSAVE_RUN__ + __INIT_SIZE__)
|
||||
ldy #>(__ZPSAVE_RUN__ + __INIT_SIZE__)
|
||||
sta $9B
|
||||
sty $9C
|
||||
|
||||
|
||||
; Set source last address
|
||||
lda #<(__ZPSAVE_RUN__ + __INIT_SIZE__ + __LC_LAST__ - __LC_START__)
|
||||
ldy #>(__ZPSAVE_RUN__ + __INIT_SIZE__ + __LC_LAST__ - __LC_START__)
|
||||
@@ -68,7 +67,7 @@
|
||||
ldy #>__ZPSAVE_RUN__
|
||||
sta $9B
|
||||
sty $9C
|
||||
|
||||
|
||||
; Set source last address
|
||||
lda #<(__ZPSAVE_RUN__ + __INIT_SIZE__)
|
||||
ldy #>(__ZPSAVE_RUN__ + __INIT_SIZE__)
|
||||
@@ -92,7 +91,7 @@
|
||||
_exit: ldx #<exit
|
||||
lda #>exit
|
||||
jsr reset ; Setup RESET vector
|
||||
|
||||
|
||||
; Switch in ROM in case it wasn't already switched in by a RESET
|
||||
bit $C082
|
||||
|
||||
@@ -159,7 +158,7 @@ init: ldx #zpspace-1
|
||||
ldx #<_exit
|
||||
lda #>_exit
|
||||
jsr reset ; Setup RESET vector
|
||||
|
||||
|
||||
; Setup the stack
|
||||
lda HIMEM
|
||||
sta sp
|
||||
|
||||
Reference in New Issue
Block a user