1
0
mirror of https://github.com/cc65/cc65.git synced 2025-03-11 17:36:33 +00:00

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
This commit is contained in:
uz 2011-07-03 13:23:07 +00:00
parent a08222048a
commit 9d7edad0cc
2 changed files with 14 additions and 6 deletions

View File

@ -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'

View File

@ -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 ; Not at page boundary
sta argv,y ; argv[y]= &arg
iny
;; lda #>BASIC_BUF
;; sta argv,y
iny
inc __argc ; Found another arg