From: uz Date: Sun, 3 Jul 2011 13:23:07 +0000 (+0000) Subject: Fixes for program arguments and TAP header by Stefan Haubenthal. X-Git-Tag: V2.13.3~390 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=9d7edad0cca25a0e095d41cb31d1468c9b787f26;p=cc65 Fixes for program arguments and TAP header by Stefan Haubenthal. git-svn-id: svn://svn.cc65.org/cc65/trunk@5071 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/libsrc/atmos/crt0.s b/libsrc/atmos/crt0.s index 5a5d0852a..15aa9509a 100644 --- a/libsrc/atmos/crt0.s +++ b/libsrc/atmos/crt0.s @@ -28,7 +28,7 @@ .byte $00 ; $2AF .byte $80 ; $2AE Machine code flag .byte $C7 ; $2AD Autoload flag - .dbyt __ZPSAVE_LOAD__ ; $2AB + .dbyt __ZPSAVE_LOAD__ - 1 ; $2AB .dbyt __RAM_START__ ; $2A9 .byte $00 ; $2A8 .byte ((.VERSION >> 8) & $0F) + '0' diff --git a/libsrc/atmos/mainargs.s b/libsrc/atmos/mainargs.s index d06cec3ef..54fdb61e9 100644 --- a/libsrc/atmos/mainargs.s +++ b/libsrc/atmos/mainargs.s @@ -11,8 +11,9 @@ MAXARGS = 10 ; Maximum number of arguments allowed REM = $9d ; BASIC token-code -NAME_LEN = 0 ; maximum length of command-name +NAME_LEN = 16 ; maximum length of command-name BASIC_BUF = $35 +FNAM = $293 ;--------------------------------------------------------------------------- @@ -23,6 +24,16 @@ BASIC_BUF = $35 .proc initmainargs +; Assume that the program was loaded, a moment ago, by the traditional LOAD +; statement. Save the "most-recent filename" as argument #0. +; Because the buffer, that we're copying into, was zeroed out, +; we don't need to add a NUL character. +; + ldy #NAME_LEN - 1 ; limit the length +L0: lda FNAM,y + sta name,y + dey + bpl L0 inc __argc ; argc always is equal to, at least, 1 ; Find the "rem" token. @@ -55,15 +66,12 @@ found: cmp #'"' ; Is the argument quoted? setterm:sta term ; Set end of argument marker ; Now store a pointer to the argument into the next slot. Since the BASIC -; input buffer is located at the start of a RAM page, no calculations are -; necessary. +; input buffer is located at the zero page, no calculations are necessary. txa ; Get low byte add #BASIC_BUF -;; sta argv,y iny inc __argc ; Found another arg