diff options
author | B. Watson <yalhcru@gmail.com> | 2016-02-18 05:16:36 -0500 |
---|---|---|
committer | B. Watson <yalhcru@gmail.com> | 2016-02-18 05:16:36 -0500 |
commit | 7759a52eb0ee980efd8a1d9faa1c84af1db1368c (patch) | |
tree | 880a63869f1df7e57a0e7a882bcf2fe1eb44e092 /crt0_cart.s | |
parent | 98cb3f46a7ea12279d99af60fcb136c0aa8b0b37 (diff) | |
download | taipan-7759a52eb0ee980efd8a1d9faa1c84af1db1368c.tar.gz |
use custom stripped-down crt0 for cartridge, save 65 bytes
Diffstat (limited to 'crt0_cart.s')
-rw-r--r-- | crt0_cart.s | 72 |
1 files changed, 72 insertions, 0 deletions
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 + +; ------------------------------------------------------------------------ |