]> git.sur5r.net Git - cc65/blobdiff - libsrc/atari/crt0.s
Normalized style.
[cc65] / libsrc / atari / crt0.s
index de72c1eb81b55e6d209292c07e054113ad4108c1..f1c7b864e8ffd1d10bd189863eed957650c032dd 100644 (file)
@@ -8,12 +8,11 @@
 ;       Stefan Haubenthal
 ;
 
-        .export         _exit
         .export         __STARTUP__ : absolute = 1      ; Mark as startup
+        .export         _exit, start
 
         .import         initlib, donelib
         .import         callmain, zerobss
-        .import         __STARTUP_LOAD__, __BSS_LOAD__
         .import         __RESERVED_MEMORY__
         .import         __RAM_START__, __RAM_SIZE__
 .ifdef __ATARIXL__
@@ -21,6 +20,7 @@
         .import         sram_init
         .import         scrdev
         .import         findfreeiocb
+        .forceimport    sramprep                        ; force inclusion of the "shadow RAM preparation" load chunk
         .include        "save_area.inc"
 .endif
 
         .include        "atari.inc"
 
 ; ------------------------------------------------------------------------
-; EXE header
-
-.segment        "EXEHDR"
-
-        .word   $FFFF
-
-.segment        "MAINHDR"
-
-        .word   __STARTUP_LOAD__
-        .word   __BSS_LOAD__ - 1
-
-; ------------------------------------------------------------------------
-; Actual code
 
 .segment        "STARTUP"
 
@@ -66,7 +53,14 @@ start:
         tsx
         stx     SP_save
 
-.ifndef __ATARIXL__
+.ifdef __ATARIXL__
+
+        lda     #<(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__)
+        sta     sp
+        lda     #>(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__)
+        sta     sp+1
+
+.else
 
 ; Report memory usage
 
@@ -85,13 +79,6 @@ start:
         sta     APPMHI+1
         sta     sp+1                    ; setup runtime stack part 2
 
-.else
-
-        lda     #<(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__)
-        sta     sp
-        lda     #>(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__)
-        sta     sp+1
-
 .endif
 
 ; Call module constructors
@@ -113,8 +100,8 @@ start:
 
 ; Initialize conio stuff
 
-        dey                             ; Set X to $FF
-        sty     CH
+        dey                     ; Set Y to $FF
+        sty     CH              ; remove keypress which might be in the input buffer
 
 ; Push arguments and call main
 
@@ -212,9 +199,3 @@ LMARGN_save:    .res    1
 .ifndef __ATARIXL__
 APPMHI_save:    .res    2
 .endif
-
-
-.segment "AUTOSTRT"
-        .word   RUNAD                   ; defined in atari.inc
-        .word   RUNAD+1
-        .word   start