[cc65] command line args

From: carlos <carlosofcascade1gmx.net>
Date: 2004-04-27 09:13:21
Hallo Ullrich, 

this mail is a little bit old now(about one week), but it did't make it into the list for some reason(perhaps it was too long). 

Ok,

there are several problems due to lack in the operating system.
There is no way to give command line args directly after the run command
like
run par1,par2,par3 etc., because the interpreter thinks par1 is a line
number in the program, where it should be started. so the minimum is a
colon
after run. run:par1,par2,par3.
there is another problem, if you want to pass strings as argument like
run:str1, str2, str3.
then a string like "monday" will be tokenized into "m"<on"day". '"' could
be used to prevent this instead of rem. tokens have there negativ bit set.
other chars not(except PI=$ff, one could say Pi is it's token itself).
after you pressed enter on a line, the basic interpreter puts max. 88
chars
into a buffer from $0200.
so, if you use that buffer the command line args are limited (with the
run)
to 88 chars.

if someone wants to do program calls like this: fori=0to10:run:i:next, it
won't work, not because of the
routine, which gets the args, but because of the interpreter, which resets
the next pointer after each run
(leads to a next without for error).
there could be other commands in from of a run, but they can't be in a
basic
program itself, because the startup line is a basic program. so the
advantage of allowing this is very limited. there is another possibility
to
use basic and compiled c code. if you tag the startup line with a line
number say 10000, then a call from a basic program doing a gosub
10000:arg1,
arg2,... could be possible. but isn't this a way too complicate to
implement? it would then be better to use sys adr,arg1,arg2,arg3.

the conclusion is:
if you read from screen, the command line args are limited to max. 1000
chars, which is quite enough and you don't have the problem with
tokenization. if there are other basic commands in from of a run, there is
no use for. so don't allow this. the oddest thing, which may happen to
code,
which checks the args to be valid, is that it prints out an error
message.(it could be: enter run at line start)
another possibility is to search the line, until a run is found and skip
every command before. but, if there is a print"something" before, you have
a
real problem.anyway, i still don't find any use for other commands before
run.
if you want to read from the 88 chars buffer, then use " instead of rem,
to
prevent tokenization.
use the basic rom routines as long as possible in the startup process.

my opinion is, that the first comma and the rem is ugly. if you want to
test
your program with different parameters and start it very often, the rem
and
the first comma, which you alway forget, slows down the code and test
cycle
very much.

Greetings Carlos



----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Tue Apr 27 09:14:18 2004

This archive was generated by hypermail 2.1.8 : 2004-04-27 09:14:26 CEST