Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
EDNEDN Senior Member Joined: 18/02/2023 Location: United StatesPosts: 300
Posted: 02:44pm 23 Jul 2026
Copy link to clipboard
Print this post
I think I might have stumbled onto a LongString bug in PicoMite V6.03.00 Release.
Depending on how 'Option Base' is set, lgetbyte() returns different values. With 'Option Base 0' the position information given by linstr() does not align with the information returned by lgetbyte().
I understand this could be argued either way. But it would seem to me that lgetbyte() should be consistent with the offsets returned by linstr() and used by lgetstr$().
If you flip the 'Option Base' to 1 you get different results than with it at 0.
If the answer is this is not a bug, this deviant behavior of lgetbyte() should be documented as dependent on 'Option Base'. And so far I can't find any documentation that it is dependent on 'Option Base'. Below is a program that demonstrates the inconsistency:
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 11668
Posted: 03:08pm 23 Jul 2026
Copy link to clipboard
Print this post
The difference is deliberate. lgetbyte is intended to treat the longstring as a byte array which you would therefore expect to honour Option Base. It's not safe to change this behaviour as this would almost certainly break existing programs I'll add additional clarification to the user manual to make this clear. Edited 2026-07-24 01:10 by matherp
toml_12953 Guru Joined: 13/02/2015 Location: United StatesPosts: 688
Posted: 07:39am 25 Jul 2026
Copy link to clipboard
Print this post
Update: I fixed the following by disabling the PSRAM and reenabling it.
When I try to run the program below, I get Not enough PSRAM memory in line 21 (DIM c AS POINT). It doesn't seem like it should take very much, though.
' ' "Center.zen" solves for the center and radius ' of a circle ' ' Sample program for the Zeno Interpreter by: ' ' Stephen R. Schmitt ' 962 Depot Road ' Boxborough, MA 01719 ' OPTION base 1
but no complaints about DIM c AS POINT .... 73 de OE1HGA, Gerald
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 11668
Posted: 08:12am 25 Jul 2026
Copy link to clipboard
Print this post
There is no function DET or array DET so like ville56, unable to test further
toml_12953 Guru Joined: 13/02/2015 Location: United StatesPosts: 688
Posted: 09:03am 25 Jul 2026
Copy link to clipboard
Print this post
Oops! I defined DET(n() in the library as
FUNCTION DET(n()) DET=MATH(m_determinant n()) END FUNCTION
to help writing more standard BASIC code. I just wish MMBasic could have a function return an array. Then I could write even more MAT functions to match standard BASIC. Something like this:
a()=INV(b()) ' Like MAT A = INV(B) in standard BASIC c()=TRN(r()) ' Like MAT C = TRN(R) in standard BASIC
FUNCTION INV(n()) LOCAL m(BOUND(n(),1), BOUND(n(),2)) MATH M_INVERSE n(), m() INV=m() END FUNCTION
FUNCTION TRN(n()) LOCAL m(BOUND(n(),1), BOUND(n(),2)) MATH M_TRANSPOSE n(), m() TRN=m() END FUNCTION
Edited 2026-07-25 19:21 by toml_12953
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 11668