Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 00:54 03 May 2025 Privacy Policy
Jump to

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.

Forum Index : Microcontroller and PC projects : PicoMite V6.00.02 release candidates - all versions

     Page 32 of 36    
Author Message
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7470
Posted: 06:29am 22 Apr 2025
Copy link to clipboard 
Print this post

*Always* keep the BAS file. Even if you get the Library file back into a programmable version you will have lost all non-essential spaces and all comments. I'm afraid there's no way round that as the Library is stored tokenized for speed and efficiency.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
javavi

Guru

Joined: 01/10/2023
Location: Ukraine
Posts: 436
Posted: 06:25pm 23 Apr 2025
Copy link to clipboard 
Print this post

Hello Peter, Geoff and everyone who is in the know,
I'm just an amateur, maybe this is a stupid question but it's better to ask, so I'll ask here!
In my practice of programming in MMBASIC, in some cases I encountered the need to have Aliases for Variables.
For example, when I want to select one of the variables for subsequent typical processing in the algorithm.
1) ALIAS NAMES for VARIABLES
DIM A% = 123
DIM B% = 456
...
IF condition THEN ALIAS C = A% else ALIAC C = B%
...
...

To pass a value by reference to the C alias, just as it currently works when calling subroutines and functions.

2) ALIAS NAMES for ARRAYS with variable dimensions
DIM Arr2D%(100,1)
ALIAS Arr1%(100) = Arr2D%(100,0)
ALIAS Arr2%(100) = Arr2D%(100,1)
...
SORT Arr1%()

An array alias that can be assigned by reference to one of the fields of a multidimensional array, for example for processing with the SORT command.
For large volumes of processed arrays, we would like to avoid copying them for such processing, and work with an alias by reference.
Such aliases exist in other programming languages,
Is it possible to implement this in MMBASIC in the near future, of course?
Edited 2025-04-24 04:28 by javavi
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10006
Posted: 09:43pm 23 Apr 2025
Copy link to clipboard 
Print this post

There will be no changes to core MMbasic functionality now, or probably ever. ALIAS NAMES for ARRAYS would  massively complex. Have a look at the C code for MATH SLICE and then tell me how to do that interactively at a command level for all uses of an "aliased" array. Complete non-starter
 
twofingers
Guru

Joined: 02/06/2014
Location: Germany
Posts: 1520
Posted: 10:06pm 23 Apr 2025
Copy link to clipboard 
Print this post

  matherp said  There will be no changes to core MMbasic functionality now, or probably ever....

Hi Peter,
That was to be expected, and it's the right decision, especially considering the latest version is almost complete.

But perhaps you have an idea for a later version about how to pass parts of arrays to subroutines. That could help solve some problems more elegantly.
Kind regards
Michael
causality ≠ correlation ≠ coincidence
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7470
Posted: 06:52am 24 Apr 2025
Copy link to clipboard 
Print this post

The core of MMBasic has been has been extensively debugged over a period of years, which is why MMBasic is fundamentally so reliable. I wouldn't expect any changes whatsoever to ever be made in that part of the firmware now unless it's because of a day 1 bug that's been hiding away.

Remember that you are writing in BASIC too, not C or Python. There are some things that you simply won't be able to do or that work in an entirely different manner. Trying to program around the limitations is half the fun. :)
.
Edited 2025-04-24 16:53 by Mixtel90
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
Bleep
Guru

Joined: 09/01/2022
Location: United Kingdom
Posts: 570
Posted: 08:25am 24 Apr 2025
Copy link to clipboard 
Print this post

Use
Math Add in(),0,out()  or even,
Math Slice source(),[d1],[d2],[d3],[d4],[d5],dest()  or even,
Memory Pack  and  Memory Unpack  to copy Arrays around, they are *extremly* fast, almost unnoticable at the speed of a Basic interpreter.
 
electricat

Senior Member

Joined: 30/11/2020
Location: Lithuania
Posts: 288
Posted: 09:08am 24 Apr 2025
Copy link to clipboard 
Print this post

@Peter

I made help files folowing help.txt format you arranged (posted in this thread)

I feel it would be nice to add two small improvements to HELP cmd
1) horizontal separators while listing (better accessibility or just easier to read)
2) some key like '-f' or something so then without key would be only listed first line by default for example in case if found in ~ ADC START
----------------------------------------------------
ADC START array1!() [,array2!()] [,array3!()] [,array4!()] [,Chan4arr!()] [,C1min] [,C1max] [,C2min] [,C2max] [,C3min] [,C3max] [,C4min] [,C4max]  
----------------------------------------------------

and with key

----------------------------------------------------
ADC START array1!() [,array2!()] [,array3!()] [,array4!()] [,Chan4arr!()] [,C1min] [,C1max] [,C2min] [,C2max] [,C3min] [,C3max] [,C4min] [,C4max]
This starts conversion into the specified arrays. The arrays must be floating point and the same size. The size of the arrays defines the number of conversions.
Start can be called repeatedly once the ADC is OPEN 'Cxmin' and 'Cxmax' will scale ..............
----------------------------------------------------

This way user will need only one file if he does not care about A: space.
Means more comfort.
Edited 2025-04-24 19:10 by electricat
My MMBasic 'sand box'
 
twofingers
Guru

Joined: 02/06/2014
Location: Germany
Posts: 1520
Posted: 10:13am 24 Apr 2025
Copy link to clipboard 
Print this post

  Bleep said  Use
Math Add in(),0,out()  or even,
Math Slice source(),[d1],[d2],[d3],[d4],[d5],dest()  or even,
Memory Pack ...
´
@Bleep
All correct!
But I think Vadim (Javavi) (+me!) didn't quite explain it correctly. This is about the partial handling of multidimensional STRING arrays.
We have very good options for handling numeric arrays, but very few for multidimensional string arrays.
IMHO, we should have the ability to quickly copy, fill, and delete string arrays. In addition to a mechanism for passing partial string arrays to subs. I use ERASE+(Re)DIM for deleting. But that doesn't seem very elegant to me.

It would also be possible to solve the problem with CSubs, but that wouldn't necessarily always be compatible.

To Mick: I think it's our job to make suggestions for improvements and needs. Peter (and Geoff?) then decides whether this makes sense and is possible. Most users are probably aware that Peter has a very heavy workload and is under a lot of stress. Furthermore, I think MMBasic has reached a high level of complexity, which hasn't diminished with the many versions for Picos.

I think most people can imagine that developing a programming language is a balancing act between costs (memory requirements, speed, complexity, and the programmer's available time) and the benefit to the community.

Kind regards
MIchael
causality ≠ correlation ≠ coincidence
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10006
Posted: 10:38am 24 Apr 2025
Copy link to clipboard 
Print this post

  Quote  In addition to a mechanism for passing partial string arrays to subs.


For the avoidance of doubt - this will never happen
 
twofingers
Guru

Joined: 02/06/2014
Location: Germany
Posts: 1520
Posted: 10:40am 24 Apr 2025
Copy link to clipboard 
Print this post

  matherp said  ... For the avoidance of doubt - this will never happen

Thanks!
causality ≠ correlation ≠ coincidence
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10006
Posted: 01:46pm 24 Apr 2025
Copy link to clipboard 
Print this post

There is one thing I can do. I can extend MATH SLICE and MATH INSERT to cater for strings. Since MATH makes no sense. I'll introduce two new commands ARRAY SLICE and ARRAY INSERT which will work on any data type. MATH SLICE and MATH INSERT will still work using the same code.
 
twofingers
Guru

Joined: 02/06/2014
Location: Germany
Posts: 1520
Posted: 02:06pm 24 Apr 2025
Copy link to clipboard 
Print this post

@Peter
Sounds good, and would also ensure standardization (numeric, strings). I was very surprised that the handling of strings has been so neglected. However, I don't expect any changes for the current release. Anyway, thanks for addressing this!
causality ≠ correlation ≠ coincidence
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10006
Posted: 02:34pm 24 Apr 2025
Copy link to clipboard 
Print this post

There is nothing in commands like SLICE that can't easily be done in Basic (more easily than in C). In general string handling is much less time critical than maths so there is little reason to take away your fun coding in Basic.
 
twofingers
Guru

Joined: 02/06/2014
Location: Germany
Posts: 1520
Posted: 02:45pm 24 Apr 2025
Copy link to clipboard 
Print this post

  matherp said  ... so there is little reason to take away your fun coding in Basic.

Is programming a loop really that exciting?  

But joking aside, I'm always surprised at how powerful modern Basic is on current Micros. I can do things in Basic that I used to need assembly or C for.
causality ≠ correlation ≠ coincidence
 
ville56
Senior Member

Joined: 08/06/2022
Location: Austria
Posts: 213
Posted: 02:55pm 24 Apr 2025
Copy link to clipboard 
Print this post

@electricat

  electricat said  

I made help files folowing help.txt format you arranged (posted in this thread)


I had problems with your file "long__nosep_official_help.txt" as there are lots of NUL chars in it. Had to remove them all, now it is usable. Didn't check the other files, but they may have the same problem.

firmware: PicoMiteHDMI MMBasic RP2350B Edition V6.00.02RC17
                                                                 
73 de OE1HGA, Gerald
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10006
Posted: 03:03pm 24 Apr 2025
Copy link to clipboard 
Print this post

V6.00.02RC18 is available on

https://geoffg.net/Downloads/picomite/PicoMite_Beta.zip

Fixes bugs in certain areas of multi-dimensional string handling on the RP2350
New commands ARRAY SLICE and ARRAY INSERT. These operate the same as MATH SLICE and MATH INSERT but also work on string arrays - see my test program below
NB: ARRAY SLICE and ARRAY INSERT are preferred over the MATH variants as they convert to a single token rather than having to parse the INSERT or SLICE subcommand


Dim integer i,j,k
Dim integer test(2,3,4), two(2),three(3),four(4)
Dim s$(2,3,4) length 6, twos$(2) length 6, threes$(3) length 6, fours$(4) length 6
For i=0 To 2
For j=0 To 3
For k=0 To 4
test(i,j,k)=i+(j<<4)+(k<<8)
s$(i,j,k)=Str$(test(i,j,k))
'Print k,j,i,Hex$(Val(S$(i,j,k))),Hex$(test(i,j,k))
Next k
Next j
Next i
Array Slice s$()  ,,3,4,twos$()
Array Slice test(),,3,4,two()
For i=0 To 2
Print Hex$(two(i),3), "  ";
Next i
Print ""
For i=0 To 2
Print Hex$(Val(twos$(i)),3), "  ";
Next i
Print ""

Array Slice test(),2,,4,three()
Array Slice s$(),2,,4,threes$()
For i=0 To 3
Print Hex$(three(i),3), "  ";
Next i
Print ""
For i=0 To 3
Print Hex$(Val(threes$(i)),3), "  ";
Next i
Print ""
Array Slice test(),2,3,,four()
Array Slice s$(),2,3,,fours$()
For i=0 To 4
Print Hex$(four(i),3), "  ";
Next i
Print ""
For i=0 To 4
Print Hex$(Val(fours$(i)),3), "  ";
Next i
Print ""
fours$(0)="zero"
fours$(1)="one"
fours$(2)="two"
fours$(3)="three"
fours$(4)="four"
four(0)=0
four(1)=1
four(2)=2
four(3)=3
four(4)=4
Array Insert test(),2,1,,four()
Array Insert s$(),2,1,,fours$()

For i=2 To 2
For j=1 To 1
For k=0 To 4
Print k,j,i,S$(i,j,k),Hex$(test(i,j,k))
Next k
Next j
Next i
 
twofingers
Guru

Joined: 02/06/2014
Location: Germany
Posts: 1520
Posted: 03:13pm 24 Apr 2025
Copy link to clipboard 
Print this post

  matherp said  ... so there is little reason to take away your fun coding in Basic.

Is programming a loop really that exciting?  

But joking aside, I'm always surprised at how powerful modern Basic is on current Micros. I can do things in Basic that I used to need assembly or C for.
causality ≠ correlation ≠ coincidence
 
electricat

Senior Member

Joined: 30/11/2020
Location: Lithuania
Posts: 288
Posted: 04:03pm 24 Apr 2025
Copy link to clipboard 
Print this post

  ville56 said  @electricat
I had problems with your file "long__nosep_official_help.txt" as there are lots of NUL chars in it.

Thx! Updated.
My MMBasic 'sand box'
 
twofingers
Guru

Joined: 02/06/2014
Location: Germany
Posts: 1520
Posted: 04:28pm 24 Apr 2025
Copy link to clipboard 
Print this post

  matherp said  
  Quote  Array ADD in$(), Str$ ,out$()


Why?

Because of the symmetry (for numeric and string) and because we would then have a fast string array copy and additionally perhaps be able to fill string arrays, maybe even empty them.

But that can also happen much later, your speed scares me.
Edited 2025-04-25 02:46 by twofingers
causality ≠ correlation ≠ coincidence
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10006
Posted: 04:30pm 24 Apr 2025
Copy link to clipboard 
Print this post

  Quote  Array ADD in$(), Str$ ,out$()


Why?
 
     Page 32 of 36    
Print this page
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025