]> git.sur5r.net Git - cc65/blobdiff - libsrc/apple2/mainargs.s
Fixed gcc compiler warning (#867)
[cc65] / libsrc / apple2 / mainargs.s
index 6b0df4dedb23f483f79f88d79b2e05ba8faa68cd..de2f385f15d428fda3197f7b24a4d5eb78bcc563 100644 (file)
 MAXARGS = 10
 
 ; ProDOS stores the filename in the second half of BASIC's input buffer, so
-; there are 128 characters left. At least 7 characters are necessary for the
-; CALLxxxx:REM so 121 characters may be used before overwriting the ProDOS
-; filename. As we don't want to put further restrictions on the command-line
-; length we reserve those 121 characters terminated by a zero.
+; there are 128 characters left. At least 1 character is necessary for the
+; REM so 127 characters (including the terminating zero) may be used before
+; overwriting the ProDOS filename. As we don't want to further restrict the
+; command-line length we reserve those 127 characters.
 
-BUF_LEN = 122
+BUF_LEN = 127
 
 BASIC_BUF = $200
 FNAM_LEN  = $280
 FNAM      = $281
 REM       = $B2                 ; BASIC token-code
 
-; Get possible command-line arguments. Goes into the special INIT segment,
+; Get possible command-line arguments. Goes into the special ONCE segment,
 ; which may be reused after the startup code is run.
 
-        .segment        "INIT"
+        .segment        "ONCE"
 
 initmainargs:
 
@@ -83,6 +83,7 @@ initmainargs:
 ; destroyed.
 
         ldy     #$00
+        sty     buffer + BUF_LEN - 1
 :       lda     BASIC_BUF,x
         sta     buffer,y
         inx
@@ -166,14 +167,13 @@ done:   lda     #<argv
         stx     __argv+1
         rts
 
-; This array is zeroed before initmainargs is called.
-; char* argv[MAXARGS+1] = {FNAM};
-
         .data
 
+; char* argv[MAXARGS+1] = {FNAM};
+
 argv:   .addr   FNAM
         .res    MAXARGS * 2
 
-        .bss
+        .segment        "INIT"
 
-buffer: .res    BUF_LEN
\ No newline at end of file
+buffer: .res    BUF_LEN