[Coco] (D)ECB and command-line arguments

Arthur Flexser flexser at fiu.edu
Thu Jun 19 14:03:54 EDT 2014


A technique I've used is this:  You put a dummy DATA statement at the end
of your program, like "DATA 1"  and have the program read that single data
value.  This causes a data pointer value at $33-34 to be set by Basic to
point to the byte after the last-read DATA value.  Then you call your ML
routine and have it look at the value in $33-34. Your arguments (data)
go right after the DATA 1 statement, on a line that begins with a quote
mark (to avoid the line being tokenized).  The ML routine has to add 6
bytes to the value in $33-34 to get past the end-of-statement terminator,
the following line pointer, and the quote mark in order to point to your
data.  I've stored whole compressed PMODE 4 graphics screens as pseudo-DATA
statements this way.

Art


On Thu, Jun 19, 2014 at 9:07 AM, Mark McDougall <msmcdoug at iinet.net.au>
wrote:

> Hi again gurus,
>
> I was thinking about ways of passing arguments to Coco binary executables
> from (D)ECB.
>
> The obvious way is to use USR1() but that requires DEFUSR and knowing the
> EXEC address, or at least PEEKing the values from RAM. You are also
> restricted to a single integer parameter.
>
> I had the idea of using something like:
>
> EXEC :arg1, arg2, ...
>
> where the ML program would then parse the BASIC line input buffer to
> extract the arguments. Would've been nice, but it seems EXEC doesn't accept
> the colon as a trailing statement separator.
>
> I guess you could do something like this:
>
> ARG$="arg1, arg2, ..."
> EXEC
>
> and then have the ML search the BASIC string table (assuming it hasn't
> been trashed). Would that be doable?
>
> Anyone else got any ideas?
>
> Regards,
>
> --
> |              Mark McDougall                | "Electrical Engineers do it
> |  <http://members.iinet.net.au/~msmcdoug>   |   with less resistance!"
>
> --
> Coco mailing list
> Coco at maltedmedia.com
> http://five.pairlist.net/mailman/listinfo/coco
>


More information about the Coco mailing list