[Coco] SUBSTR issues :Is it me or Basic09 ?

coco at jechar.ca coco at jechar.ca
Thu Aug 29 13:00:40 EDT 2019


I ran into a problem in a program I was writing which I traced to
and incorrect value for the variable mos.

So I wrote this supper short program to test the section that assigns
mos a value.

[START  CODE]

PROCEDURE testmos
(* Demo Program *)
DIM xs$:STRING
DIM mos:INTEGER

xs$="-ip='01234567890ABCDEF'@$7"
mos=SUBSTR(xs$,"@$")

PRINT xs$
PRINT mos1

END

[END CODE]

When I run this code I get.


-ip='01234567890ABCDEF'@$7
0

What I expected was:

-ip='01234567890ABCDEF'@$7
23

So xs$ is exactly as expected but mos is not.
Have I made a mistake I just don't see or is
there a problem with Basic09's SUBSTR function ?

Unless I am missing something there is.

If the latter I am sure I can replace  it with
half a dozen lines of code using some work around
but  whoever is maintaining Basic09 should know
about it. Running on a 6309 CPU.

Charlie





More information about the Coco mailing list