[Coco] Returning a string to basic ?
Arthur Flexser
flexser at fiu.edu
Tue Sep 20 17:43:21 EDT 2011
I'm going from hazy memory on this...
I'm assuming the string is at a known address and has a known length.
What you need to do is this:
Define a dummy string in the Basic program with some statement like S$="A".
Then use the Basic VARPTR function to find the address of Basic's
pointer to the string: ST=VARPTR(S$).
At the address now contained in ST is a 5-byte string specifier. The
first (I think) byte is the string length, and the 3rd and 4th (?)
contain the address of the string data.
(The other 2 bytes of the 5-byte identifier are unused.)
Using POKEs, you can modify these 3 bytes to insert the length and
address of the string you want Basic to know about, which will then be
referenced by S$.
Hope that does the trick for you!
Art
On Tue, Sep 20, 2011 at 5:08 PM, Phill Harvey-Smith
<afra at aurigae.demon.co.uk> wrote:
> Hi all,
>
> I'm developing a SD/MMC interface for the Dragon and CoCo, and need a method
> of returning a string to basic so that I can add a function to (for example)
> return the current working directory on the card.
>
> How would I go about this ?
>
> Cheers.
>
> Phill.
>
> --
> Phill Harvey-Smith, Programmer, Hardware hacker, and general eccentric !
>
> "You can twist perceptions, but reality won't budge" -- Rush.
>
> --
> Coco mailing list
> Coco at maltedmedia.com
> http://five.pairlist.net/mailman/listinfo/coco
>
More information about the Coco
mailing list