• Filling MBASIC strings from ML.

    From Thom Cherryhomes@21:1/5 to All on Wed Jan 12 06:56:56 2022
    Hello everyone, Am currently trying to write a set of bindings for #FujiNet to manipulate buffers in memory to MBASIC strings (e.g. to get the received data from the network, into a string), Has anyone written any routines to do this?

    -Thom

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Martin@21:1/5 to Thom Cherryhomes on Fri Jan 14 07:12:51 2022
    Am 01/12/2022 03:56 PM, Thom Cherryhomes schrieb:
    Hello everyone, Am currently trying to write a set of bindings for #FujiNet to manipulate buffers in memory to MBASIC strings (e.g. to get the received data from the network, into a string), Has anyone written any routines to do this?

    -Thom


    I have not found any working code, but this really good
    description should provide everything you need.

    On the "CP/M CD-ROM": /CPM/MSOFT/M-SOFT.CAT


    You could precreate a string with the required maximum length,
    then use it as a fixed length IN/OUT buffer.

    You are not allowed to modify the string length, so you could
    an additional integer paramter and pass the used length there.

    Use "MID$" to R/W your data, like so...


    Initialize a buffer with the required length.

    110 X$="1234567890"
    120 L=0

    A$ holds the string you want to pass in.

    210 L=LEN(A$)
    220 MID$(X$,1,L)=A$

    [...] Your CALL here need to pass X$ and L

    B$ gets the returned string.

    300 B$=MID$(A$,1,L)


    HTH Martin

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Martin@21:1/5 to Martin on Sun Jan 16 04:36:22 2022
    Am 01/14/2022 07:12 AM, Martin schrieb:
    Am 01/12/2022 03:56 PM, Thom Cherryhomes schrieb:
    Hello everyone, Am currently trying to write a set of bindings for
    #FujiNet to manipulate buffers in memory to MBASIC strings (e.g. to
    get the received data from the network, into a string), Has anyone
    written any routines to do this?

    -Thom


    I have not found any working code, but this really good
    description should provide everything you need.

    On the "CP/M CD-ROM": /CPM/MSOFT/M-SOFT.CAT


    You could precreate a string with the required maximum length,
    then use it as a fixed length IN/OUT buffer.

    You are not allowed to modify the string length, so you could
    an additional integer paramter and pass the used length there.

    Use "MID$" to R/W your data, like so...


    Initialize a buffer with the required length.

    110 X$="1234567890"
    120 L=0

    A$ holds the string you want to pass in.

    210 L=LEN(A$)
    220 MID$(X$,1,L)=A$

    [...] Your CALL here need to pass X$ and L

    B$ gets the returned string.

    300 B$=MID$(A$,1,L)


    HTH Martin


    After actually trying out my suggestions,
    I have to make a few corrections,

    Initializing the string vith a constant assignment
    does not allocate a buffer in the string area.

    The passed string descriptor points directly to
    the string constant in line 110 and writing over
    it will change the program.

    A string variable to be used as an OUT parameter
    must get its value indirectly via a string operation.

    So the following initialization works and saves a lot
    of memory:

    110 X$=SPACE$(10)
    120 L=0

    The assignment in line 220 saved my example from becoming
    a total disaster.

    But that was not enough, a typo in line 300:

    300 B$=MID$(X$,1,L)


    Oh well, Martin

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Tom Lake@21:1/5 to Martin on Mon Jan 17 06:53:13 2022
    On Saturday, January 15, 2022 at 10:39:07 PM UTC-5, Martin wrote:
    Am 01/14/2022 07:12 AM, Martin schrieb:
    Am 01/12/2022 03:56 PM, Thom Cherryhomes schrieb:
    Hello everyone, Am currently trying to write a set of bindings for
    #FujiNet to manipulate buffers in memory to MBASIC strings (e.g. to
    get the received data from the network, into a string), Has anyone
    written any routines to do this?

    -Thom


    I have not found any working code, but this really good
    description should provide everything you need.

    On the "CP/M CD-ROM": /CPM/MSOFT/M-SOFT.CAT


    You could precreate a string with the required maximum length,
    then use it as a fixed length IN/OUT buffer.

    You are not allowed to modify the string length, so you could
    an additional integer paramter and pass the used length there.

    Use "MID$" to R/W your data, like so...


    Initialize a buffer with the required length.

    110 X$="1234567890"
    120 L=0

    A$ holds the string you want to pass in.

    210 L=LEN(A$)
    220 MID$(X$,1,L)=A$

    [...] Your CALL here need to pass X$ and L

    B$ gets the returned string.

    300 B$=MID$(A$,1,L)


    HTH Martin

    After actually trying out my suggestions,
    I have to make a few corrections,

    Initializing the string vith a constant assignment
    does not allocate a buffer in the string area.

    The passed string descriptor points directly to
    the string constant in line 110 and writing over
    it will change the program.


    You can also do this:

    110 X$="123456789"+"0"

    The concatenation will put it in the string area.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)