]> git.sur5r.net Git - cc65/commitdiff
Added crt0 to none.lib
authorbauen1 <j2468h@gmail.com>
Thu, 4 Jan 2018 11:07:35 +0000 (12:07 +0100)
committerbauen1 <j2468h@gmail.com>
Thu, 4 Jan 2018 11:07:35 +0000 (12:07 +0100)
cfg/none.cfg
libsrc/none/crt0.s [new file with mode: 0644]

index 6742da7c8d93c06c9c0ff986a1e6f735c92e01c6..44bbcdfec2256b6eac855394e9843e01112b0cba 100644 (file)
@@ -7,6 +7,7 @@ MEMORY {
 }
 SEGMENTS {
     ZEROPAGE: load = ZP,   type = zp;
+    STARTUP:  load = MAIN, type = ro,  optional = yes;
     LOWCODE:  load = MAIN, type = ro,  optional = yes;
     ONCE:     load = MAIN, type = ro,  optional = yes;
     CODE:     load = MAIN, type = rw;
diff --git a/libsrc/none/crt0.s b/libsrc/none/crt0.s
new file mode 100644 (file)
index 0000000..fb26fb2
--- /dev/null
@@ -0,0 +1,25 @@
+       .export         _exit
+       .export         __STARTUP__ : absolute = 1      ; Mark as startup
+       .import         zerobss, _main
+       .import         initlib, donelib
+       .import         __MAIN_START__, __MAIN_SIZE__   ; Linker generated
+       .import         __STACKSIZE__                   ; Linker generated
+
+       .include "zeropage.inc"
+
+       .segment "STARTUP"
+
+       cld
+       ldx #$FF
+       txs
+       lda #<(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__)
+       ldx #<(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__)
+       sta sp
+       stx sp+1
+       jsr zerobss
+       jsr initlib
+       jsr _main
+_exit: pha
+       jsr donelib
+       pla
+       brk