Menu
JAQForum Ver 19.10.27

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

   Page 32 of 37    
Posted: 06:29am
22 Apr 2025
Copy link to clipboard
Mixtel90
Guru


*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.
 
Posted: 06:25pm
23 Apr 2025
Copy link to clipboard
javavi
Guru


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
 
Posted: 09:43pm
23 Apr 2025
Copy link to clipboard
matherp
Guru

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
 
Posted: 10:06pm
23 Apr 2025
Copy link to clipboard
twofingers
Guru

  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
 
Posted: 06:52am
24 Apr 2025
Copy link to clipboard
Mixtel90
Guru


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
 
Posted: 08:25am
24 Apr 2025
Copy link to clipboard
Bleep
Guru

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.
 
Posted: 09:08am
24 Apr 2025
Copy link to clipboard
electricat
Senior Member


@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
 
Posted: 10:13am
24 Apr 2025
Copy link to clipboard
twofingers
Guru

  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
 
Posted: 10:38am
24 Apr 2025
Copy link to clipboard
matherp
Guru

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


For the avoidance of doubt - this will never happen
 
Posted: 10:40am
24 Apr 2025
Copy link to clipboard
twofingers
Guru

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

Thanks!
 
Posted: 01:46pm
24 Apr 2025
Copy link to clipboard
matherp
Guru

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.
 
Posted: 02:06pm
24 Apr 2025
Copy link to clipboard
twofingers
Guru

@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!
 
Posted: 02:34pm
24 Apr 2025
Copy link to clipboard
matherp
Guru

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.
 
Posted: 02:45pm
24 Apr 2025
Copy link to clipboard
twofingers
Guru

  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.
 
Posted: 02:55pm
24 Apr 2025
Copy link to clipboard
ville56
Senior Member

@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
 
Posted: 03:03pm
24 Apr 2025
Copy link to clipboard
matherp
Guru

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
 
Posted: 03:13pm
24 Apr 2025
Copy link to clipboard
twofingers
Guru

  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.
 
Posted: 04:03pm
24 Apr 2025
Copy link to clipboard
electricat
Senior Member


  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.
 
Posted: 04:28pm
24 Apr 2025
Copy link to clipboard
twofingers
Guru

  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
 
Posted: 04:30pm
24 Apr 2025
Copy link to clipboard
matherp
Guru

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


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