mirror of
https://github.com/cc65/cc65.git
synced 2025-03-12 08:32:54 +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:
parent
a08222048a
commit
9d7edad0cc
@ -28,7 +28,7 @@
|
|||||||
.byte $00 ; $2AF
|
.byte $00 ; $2AF
|
||||||
.byte $80 ; $2AE Machine code flag
|
.byte $80 ; $2AE Machine code flag
|
||||||
.byte $C7 ; $2AD Autoload flag
|
.byte $C7 ; $2AD Autoload flag
|
||||||
.dbyt __ZPSAVE_LOAD__ ; $2AB
|
.dbyt __ZPSAVE_LOAD__ - 1 ; $2AB
|
||||||
.dbyt __RAM_START__ ; $2A9
|
.dbyt __RAM_START__ ; $2A9
|
||||||
.byte $00 ; $2A8
|
.byte $00 ; $2A8
|
||||||
.byte ((.VERSION >> 8) & $0F) + '0'
|
.byte ((.VERSION >> 8) & $0F) + '0'
|
||||||
|
@ -11,8 +11,9 @@
|
|||||||
|
|
||||||
MAXARGS = 10 ; Maximum number of arguments allowed
|
MAXARGS = 10 ; Maximum number of arguments allowed
|
||||||
REM = $9d ; BASIC token-code
|
REM = $9d ; BASIC token-code
|
||||||
NAME_LEN = 0 ; maximum length of command-name
|
NAME_LEN = 16 ; maximum length of command-name
|
||||||
BASIC_BUF = $35
|
BASIC_BUF = $35
|
||||||
|
FNAM = $293
|
||||||
|
|
||||||
|
|
||||||
;---------------------------------------------------------------------------
|
;---------------------------------------------------------------------------
|
||||||
@ -23,6 +24,16 @@ BASIC_BUF = $35
|
|||||||
|
|
||||||
.proc initmainargs
|
.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
|
inc __argc ; argc always is equal to, at least, 1
|
||||||
|
|
||||||
; Find the "rem" token.
|
; Find the "rem" token.
|
||||||
@ -55,15 +66,12 @@ found: cmp #'"' ; Is the argument quoted?
|
|||||||
setterm:sta term ; Set end of argument marker
|
setterm:sta term ; Set end of argument marker
|
||||||
|
|
||||||
; Now store a pointer to the argument into the next slot. Since the BASIC
|
; 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
|
; input buffer is located at the zero page, no calculations are necessary.
|
||||||
; necessary.
|
|
||||||
|
|
||||||
txa ; Get low byte
|
txa ; Get low byte
|
||||||
add #<BASIC_BUF ; Not at page boundary
|
add #<BASIC_BUF ; Not at page boundary
|
||||||
sta argv,y ; argv[y]= &arg
|
sta argv,y ; argv[y]= &arg
|
||||||
iny
|
iny
|
||||||
;; lda #>BASIC_BUF
|
|
||||||
;; sta argv,y
|
|
||||||
iny
|
iny
|
||||||
inc __argc ; Found another arg
|
inc __argc ; Found another arg
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user