|
Forum Index : Microcontroller and PC projects : MMBasic for macOS (MMB4M)
| Author | Message | ||||
| thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4405 |
It's a question of time/opportunity but I'd like to avoid MMB4L and MMB4M from diverging unnecessarily ... for the moment that means I will keep an eye on your work and pull it in as I can. That said, if you go "all Peter" on me and launch into the development stratosphere I'm not making any promises .Best wishes, Tom Edited 2026-09-29 22:07 by thwill MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
| hhtg1968 Senior Member Joined: 25/05/2023 Location: GermanyPosts: 232 |
hello. I am the guy who asked for more than 32767 array elements... I read the further comments. Now I think the compatibility to the picos is more important than my attends to calculate a mass of primes as bench mark for other program languages on my mac... therefore i changed my algorithm. earlier I used an array of Integers to mark non-primes. 1 bit information in one 64-bit integer! how silly! now i use 64 bit in one integer for 64 infos... For n=2 To ll e=n\64+1 b=n-((e-1)*64) If Bit(z(e),b)=0 Then ' here I am testing the n-th bit in the array z(), not the n-th array-element For p=n*n To l Step n e=p\64+1 b=p-((e-1)*64) Bit(z(e),b)=1 Next EndIf Next all remaining 0-bits in the array represent a prime. complete programm (in german): prim3.bas.zip because of my programming on 8-bit systems with 64k memory I use short names for the variables, sorry. this is the "sieve of Eratosthenes". in this changed algorithm I use every bit. so I can check the primes until 32767*64=2.097.088. that is enough. and... the roadmap is fine. |
||||
| thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4405 |
Don't quote me on this but I think the PicoMite might allow more than 32767 array elements. MMB4L started as a fork of the MicroMite / MMBasic for DOS code (not CMM2 or PicoMite) and still has some (probably unnecessarily) limits inherited from that. Tom MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
| hhtg1968 Senior Member Joined: 25/05/2023 Location: GermanyPosts: 232 |
that is right. meanwhile i tried my programm on my pico computer 3. dim a(781250) is no problem. the memory is filled at 96%. perhaps it depends on the memory? mmb4m shows not so much memory. or it depends on the DOS fork... image1 pico computer 3 (6mb psram) ![]() image2 mmb4m |
||||
| hhtg1968 Senior Member Joined: 25/05/2023 Location: GermanyPosts: 232 |
now I read the post from Peter. he wrote 2 bytes for the rp2040 and 4 bytes for the rp2350. my 781250 fits into 4 byte (4 billion). |
||||
| TomSchimana Newbie Joined: 27/08/2023 Location: GermanyPosts: 15 |
I'm currently researching the respective limits, but I can't say for certain whether they are accurate. As Thomas mentioned, MMB4L, and therefore MMB4M, is based on MicroMite / MMBasic for DOS code, which is why those limits apply. My current plan is to use the limits of the Windows version. What's still open is whether the simulate parameter should also use the limits of the respective hardware. I need to check how much effort that would take. It would require an extension so that RP2040 and PSRAM can be distinguished there as well. The advantage is that the limits would be "comparable". Since the internal structures in MMB4x differ, though, this would only be an approximation. This also shows once again that all platforms except the RP2040 (probably because of its tight RAM) are 32-bit, with the exception of Linux and Mac. Device Array bound Var memory Largest float Program Globals per dimension array ------------------- ------------- -------------- ------------- --------- ------- PicoMite RP2040 32767 88-128 KB ~16,000 88-120 KB 240 PicoMite RP2350 2,147,483,647 144-300 KB ~38,000 144-300 KB 480-512 RP2350 + PSRAM (PC3) 2,147,483,647 +~6 MB PSRAM ~780,000 144-300 KB 480-512 CMM2 G1 (8 MB) 2,147,483,647 ~5 MB ~650,000 512 KB 1024 CMM2 G2 (32 MB) 2,147,483,647 ~24 MB ~3 million 512 KB 1024 MMBasic for Windows 2,147,483,647 128 MB ~16 million 1 MB 2048 MMB4L / MMB4M 0.1.3 32767 1 MB 32767 512 KB 1024 A float or integer element takes 8 bytes. RP2040 and MMB4L/MMB4M store the bound in 2 bytes, the others in 4. Edited 2026-09-30 16:17 by TomSchimana MMBasic for Mac |
||||
| Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 6151 |
Hi Tom, Thanks for your overview Looks like the RP2040 is the odd fish (probably similar to CMM1/MM), and MMB4L was made compatible. So you might loose some backward compatibility to 2040. Not a big deal. IF you design a program that requires such large arrays it will (memory wise) never run on a 2040. Also since MMBasic never supported PSRAM on 2040. Volhout PicomiteVGA PETSCII ROBOTS |
||||
| matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 11934 |
MMbasic historically had always used 16 bits for the dimensions and on the PIC32 (MM2) the memory available made it impossible to define an array bigger than even 10000 let alone 32767. This all changed with the CMM2 where the available memory made arrays much bigger than 32767 available so I changed the dimension array from 16 to 32-bits. Doing this makes bigger arrays available but also uses more memory for the table that holds the variable definitions. The RP2040 is memory constrained so it made sense to revert back to 16-bits to reduce the size of the variable definition table since the biggest array on the rp2040 PICO possible would be around 16000 even if you used every bit of memory. The RP2350 with PSRAM changed the equation again allowing much bigger arrays again. There is no MMBasic code compatibility issue. All this is completely transparent to the Basic user. The only issue comes if the user needs a very big array in which case their code could never run on a rp2040 or MM2 under any circumstances. |
||||
| TomSchimana Newbie Joined: 27/08/2023 Location: GermanyPosts: 15 |
MMB4M 0.2.0 is out. Changelog and download You can also update with brew upgrade mmbasic. This version adds many commands from PicoMite V6.04, including BIT() and BYTE(), DO UNTIL, TRIM$, commands that work on whole arrays, AES encryption, and Base64. Most limits now match or exceed those of MMBasic for Windows: 128 MB for variables, arrays, and strings, a 1 MB program size, and arrays can have more than 32767 elements per dimension. @hhtg1968, that settles both of your recent questions: BIT() is now available, and DIM a(781250) runs. MID$ as a command, TIMER, END, and BOUND now behave as they do on PicoMite. You'll find more in the changelog. Please test it and let me know if something doesn't work that the changelog says should. MMBasic for Mac |
||||
| hhtg1968 Senior Member Joined: 25/05/2023 Location: GermanyPosts: 232 |
very cool. many thanks. |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2026 |