• How do I use a variable in a command

    From Thomas@3:770/3 to All on Wed Mar 21 14:54:09 2018
    On the C64 I have an ML Routine that displays a directory.
    The format for the command is SYS850,"$:*"
    I need to insert a variable into the $ string. So that in a program I
    can display filenames that start with a letter.

    For example, I want to display all file names that start with I. so

    10 A$="I":sys850,"$:"+A$+"*"

    will not work.
    Does anyone know a way to do this?

    TIA

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Anssi Saari@3:770/3 to Thomas on Fri Mar 23 09:49:48 2018
    Thomas <thomas.Xfggtf@m.invalid> writes:

    On the C64 I have an ML Routine that displays a directory.
    The format for the command is SYS850,"$:*"
    I need to insert a variable into the $ string. So that in a program I
    can display filenames that start with a letter.

    For example, I want to display all file names that start with I. so

    10 A$="I":sys850,"$:"+A$+"*"

    will not work.
    Does anyone know a way to do this?

    What about putting the whole argument into A$, does that work? So
    for example just

    10 A$="$:I*":sys850,A$

    But really, in stock C64 basic SYS doesn't take parameters so
    I suppose you have something non-stock running? So maybe you can look
    into how that works to figure out how to do what you want?

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Herr Doktor@3:770/3 to All on Mon Mar 26 14:00:52 2018
    It's been a long time. I'm assuming that this is your ML routine or
    at least not a system routine. Does the routine know how to parse such
    a command?

    On Wed, 21 Mar 2018 14:54:09 -0700, Thomas <thomas.Xfggtf@m.invalid>
    wrote:

    On the C64 I have an ML Routine that displays a directory.
    The format for the command is SYS850,"$:*"
    I need to insert a variable into the $ string. So that in a program I
    can display filenames that start with a letter.

    For example, I want to display all file names that start with I. so

    10 A$="I":sys850,"$:"+A$+"*"

    will not work.
    Does anyone know a way to do this?

    TIA

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Pekka Takala@3:770/3 to Anssi Saari on Mon Apr 9 11:32:43 2018
    On 23.03.2018 09:49, Anssi Saari wrote:
    Thomas <thomas.Xfggtf@m.invalid> writes:

    On the C64 I have an ML Routine that displays a directory.
    The format for the command is SYS850,"$:*"
    I need to insert a variable into the $ string. So that in a program I
    can display filenames that start with a letter.

    For example, I want to display all file names that start with I. so

    10 A$="I":sys850,"$:"+A$+"*"

    will not work.
    Does anyone know a way to do this?

    What about putting the whole argument into A$, does that work? So
    for example just

    10 A$="$:I*":sys850,A$

    But really, in stock C64 basic SYS doesn't take parameters so
    I suppose you have something non-stock running? So maybe you can look
    into how that works to figure out how to do what you want?


    If I needed something like this, I would just check how Print reads its parameters. The comma is easily gone over, but string reading is hard.

    Another way to accomplish this is that you have the routine, and use a
    for loop to decode the string.

    Like this:

    10 a$="I":b$="$:"+a$+"*"
    20 r=len(b$):poke679,r:forl=1tor:poke679+l,asc(mid$(b$,l,1)):next
    30 sys850

    Assuming that your routine knows that your string length is at 679 and
    actual string is from 680. The restriction for area is the length of the
    area. Of course your string can reside under rom memory or wherever
    else, if you turn off the roms temporarily before reading the string.

    This is only a example, there is millions of other ways to accomplish this.

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)