aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile4
-rw-r--r--crt0_cart.s72
2 files changed, 74 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 8bac370..74ec7a5 100644
--- a/Makefile
+++ b/Makefile
@@ -314,8 +314,8 @@ mkcart: mkcart.c
# tail -c+2 taimain.xex > romable_taimain.raw
# rm -f taimain.xex
-romable_taimain.raw: $(TAIMAIN_C_SRC) $(TAIMAIN_ASM_SRC) $(TAIMAIN_HDRS) $(BIGNUM_SRC) $(BIGNUM_HDRS) $(TAIMAIN_LIBS)
- cl65 --config cartbank3.cfg -m taipan.map -t atari -T -I. -L. -DFONT_ADDR=0x9c00 --start-addr 0x3ff -Wl -D__STACKSIZE__=0x200 -O -Wl -D__SYSTEM_CHECK__=1 -Wl -D__AUTOSTART__=1 -Wl -D__EXEHDR__=1 -DCART_TARGET=1 --asm-define CART_TARGET=1 -DBIGNUM=BIGFLOAT -o romable_taimain.raw.in $(TAIMAIN_C_SRC) $(TAIMAIN_ASM_SRC) $(BIGNUM_SRC) $(TAIMAIN_LIBS)
+romable_taimain.raw: $(TAIMAIN_C_SRC) $(TAIMAIN_ASM_SRC) $(TAIMAIN_HDRS) $(BIGNUM_SRC) $(BIGNUM_HDRS) $(TAIMAIN_LIBS) crt0_cart.s
+ cl65 --config cartbank3.cfg -m taipan.map -t atari -T -I. -L. -DFONT_ADDR=0x9c00 --start-addr 0x3ff -Wl -D__STACKSIZE__=0x200 -O -Wl -D__SYSTEM_CHECK__=1 -Wl -D__AUTOSTART__=1 -Wl -D__EXEHDR__=1 -DCART_TARGET=1 --asm-define CART_TARGET=1 -DBIGNUM=BIGFLOAT -o romable_taimain.raw.in $(TAIMAIN_C_SRC) $(TAIMAIN_ASM_SRC) $(BIGNUM_SRC) $(TAIMAIN_LIBS) crt0_cart.s
tail -c+2 romable_taimain.raw.in > romable_taimain.raw
rm -f romable_taimain.raw.in
diff --git a/crt0_cart.s b/crt0_cart.s
new file mode 100644
index 0000000..ec3e423
--- /dev/null
+++ b/crt0_cart.s
@@ -0,0 +1,72 @@
+;
+; Startup code for cc65 (ATARI version)
+;
+; Contributing authors:
+; Mark Keates
+; Freddy Offenga
+; Christian Groessler
+; Stefan Haubenthal
+;
+
+ .export __STARTUP__ : absolute = 1 ; Mark as startup
+ .export _exit, start
+
+ .import initlib, donelib
+ .import callmain, zerobss
+ .import __RESERVED_MEMORY__
+ .import __RAM_START__, __RAM_SIZE__
+ .include "zeropage.inc"
+ .include "atari.inc"
+
+; ------------------------------------------------------------------------
+
+.segment "STARTUP"
+
+ rts ; fix for SpartaDOS / OS/A+
+ ; They first call the entry point from AUTOSTRT; and
+ ; then, the load address (this rts here).
+ ; We point AUTOSTRT directly after the rts.
+
+; Real entry point:
+
+start:
+
+; Clear the BSS data.
+
+ jsr zerobss
+
+; Setup arg stack
+ lda MEMTOP
+ sta sp
+ lda MEMTOP+1
+ sta sp+1
+
+; Call the module constructors.
+
+ jsr initlib
+
+; Set the left margin to 0.
+
+ ldy #0
+ sty LMARGN
+
+; Set the keyboard to upper-/lower-case mode.
+
+ ldx SHFLOK
+ sty SHFLOK
+
+; Push the command-line arguments; and, call main().
+
+ jsr callmain
+
+; Call the module destructors. This is also the exit() entry.
+
+_exit: jsr donelib ; Run module destructors
+
+; Back to DOS.
+
+ rts
+
+; *** end of main startup code
+
+; ------------------------------------------------------------------------