Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 13:42 23 Dec 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 : How about this for a Christmas surprise?

     Page 2 of 2    
Author Message
karlelch

Senior Member

Joined: 30/10/2014
Location: Germany
Posts: 287
Posted: 03:59pm 22 Dec 2025
Copy link to clipboard 
Print this post

  matherp said  I know the issue. You can't have errors in the pre-processor as each time it calls it it hits the same error and loops. I'm afraid that the fix will be the same as other pre-processor errors which is to delete the program

With your new version, the issue seems to be gone (see above). I was only surprised that nothing helped, not even nuking, except writing an other firmware version. Maybe I don't have the latest nuke? I am using a RP2350B w/ 6MB PSRAM.
 
karlelch

Senior Member

Joined: 30/10/2014
Location: Germany
Posts: 287
Posted: 04:01pm 22 Dec 2025
Copy link to clipboard 
Print this post

  thwill said  
  NPHighview said  * Function (pointers) as struct elements - very useful for callback operations .

You don't actually need that explicitly, or you've already got it depending on your point of view. The pre-existing CALL command and CALL() function already allow you to call a SUB/FUNCTION given its name as a string.Tom

Soon, MMBasic will be fully OO ...  
Edited 2025-12-23 02:01 by karlelch
 
karlelch

Senior Member

Joined: 30/10/2014
Location: Germany
Posts: 287
Posted: 04:27pm 22 Dec 2025
Copy link to clipboard 
Print this post

This looks like a small issue:
> list
Option Base 0
Option Explicit

Type TMotor
 vel As Float
 velStep As Float
 newVel As Float
End Type

Type TRobot
 motor(1) As TMotor
 nSteps As Integer
End Type

Dim self As TRobot
Struct Clear self
self.nSteps = 0

Struct print self
self.nSteps = self.nSteps +1
Struct print self
Inc self.nSteps, 1
>

Produces a syntax error:
TROBOT:
 .MOTOR = TMOTOR:
   .VEL = 0
   .VELSTEP = 0
   .NEWVEL = 0
 .NSTEPS = 0
TROBOT:
 .MOTOR = TMOTOR:
   .VEL = 0
   .VELSTEP = 0
   .NEWVEL = 0
 .NSTEPS = 1
[23] Inc self.nSteps, 1
Error : Invalid syntax
>
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 5544
Posted: 04:35pm 22 Dec 2025
Copy link to clipboard 
Print this post

Slowly but  unaviodable all languages merge.

Volhout
PicomiteVGA PETSCII ROBOTS
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10736
Posted: 05:32pm 22 Dec 2025
Copy link to clipboard 
Print this post

Attached is a complete set of the RP2350 firmware with structures implemented. This also fixes the "INC" bug and a number of similar issues. Also it makes changes to avoid pre-processor errors looping without clearing the program.

PicoMiteRP2350V6.01.00EXP.zip


NB: structures will not be implemented for the RP2040 - too much code.
Edited 2025-12-23 03:32 by matherp
 
toml_12953
Guru

Joined: 13/02/2015
Location: United States
Posts: 512
Posted: 05:32pm 22 Dec 2025
Copy link to clipboard 
Print this post

Wow! Thanks, Santa! (Peter)
 
ville56
Guru

Joined: 08/06/2022
Location: Austria
Posts: 357
Posted: 05:59pm 22 Dec 2025
Copy link to clipboard 
Print this post

Peter,

there seems to be a strange memory leak.

Just after rebooting the pico the heap seems to get smaller and smaller without any program have been running. PSRAM or not does not make any difference, the heap shrinks.

Example:
--------------------
PicoMiteHDMI MMBasic RP2350B Edition V6.01.00EXP
Copyright 2011-2025 Geoff Graham
Copyright 2016-2025 Peter Mather

Total of 6 Mbytes PSRAM available
> print mm.info(heap)
6446336
> print mm.info(heap)
6434048
> print mm.info(heap)
6421760
> print mm.info(heap)
6409472
> print mm.info(heap)
6397184
> print mm.info(heap)
6384896
> print mm.info(heap)
6372608
> print mm.info(heap)
6351360
> print mm.info(heap)
6339072
> print mm.info(heap)
6326784
>

Edit:
when using no PSRAM I relatively fast get into the following state, looping with

Error : Not enough Heap memory
[15] Type Point
Error : Not enough Heap memory
[15] Type Point
Error : Not enough Heap memory
[15] Type Point
Error : Not enough Heap memory
[15] Type Point
Error : Not enough Heap memory
[15] Type Point
Error : Not enough Heap memory
[15] Type Point
Error : Not enough Heap memory
[15] Type Point
Error : Not enough Heap memory
[15] Type Point
Error : Not enough Heap memory
[15] Type Point

only reset clears that

Edit2: the test program has to be loaded, but no need to run it once. Same behaviour after power cycling.

Gerald
Edited 2025-12-23 04:08 by ville56
                                                                 
73 de OE1HGA, Gerald
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10736
Posted: 06:09pm 22 Dec 2025
Copy link to clipboard 
Print this post

UPDATE
I understand the issue, the leak only happens if you execute multiple commands at the command prompt. If you run the program and then type mm.info(heap) afterwards you will always get the same value as RUN clear memory whereas commands at the prompt don't. I'll put some code in not to re-allocate memory if at the command prompt

Check for something in the library etc. nuke the flash. Doesn't do if for me. List all options too so I can see if I can replicate
Edited 2025-12-23 04:23 by matherp
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10736
Posted: 06:37pm 22 Dec 2025
Copy link to clipboard 
Print this post

Ignore
Edited 2025-12-23 04:39 by matherp
 
ville56
Guru

Joined: 08/06/2022
Location: Austria
Posts: 357
Posted: 06:53pm 22 Dec 2025
Copy link to clipboard 
Print this post

what I've done:

- nuked flash, loaded V6.01.00EXP, mm.info(heap) is stable
- loaded your test program, ran it once, mm.Info(heap) decreases
- resetting pico, prog loaded but not run, mm.Info(heap) decreases
-typed NEW, mm.info(heap) is stable but a few seconds later entered a boot-loop. After abt 5 reboot in the loop the > prompt came up and heap is stable again.
- copying test program to A: drive via MMCC, LOAD test-program, heap shrinks.


> option list
PicoMite MMBasic RP2350B V6.01.00EXP
OPTION FLASH SIZE 16777216
OPTION COLOURCODE ON
OPTION PICO OFF
OPTION CPUSPEED (KHz) 200000

heap with prog just loaded:
-----------------------------------------------
PicoMite MMBasic RP2350B V6.01.00EXP
Copyright 2011-2025 Geoff Graham
Copyright 2016-2025 Peter Mather

> print mm.info(heap)
302336
> print mm.info(heap)
290048
> print mm.info(heap)
277760
> print mm.info(heap)
265472
> print mm.info(heap)
253184
>

Edit:
Just loading this short program already shows the heap issue.

Option Explicit
Option Default None

Type Point
x As INTEGER
y As INTEGER
End Type

edit2:

after NEW writing in the editor

type point
end type

saving with F1


is sufficient to start shrinking the heap
Edited 2025-12-23 05:29 by ville56
                                                                 
73 de OE1HGA, Gerald
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10736
Posted: 07:39pm 22 Dec 2025
Copy link to clipboard 
Print this post

types/structs use heap for their data structures so you will see heap usage even if you define a type but don't use it. This is better than a static allocation because, for a user who doesn't use TYPE, no memory is lost.
The bug was that it re-allocated that memory every time a command was run at the command prompt (not in a program). This should be fixed in the attached.

PicoMiteRP2350V6.01.00EXP.zip
Edited 2025-12-23 05:40 by matherp
 
ville56
Guru

Joined: 08/06/2022
Location: Austria
Posts: 357
Posted: 07:45pm 22 Dec 2025
Copy link to clipboard 
Print this post

Thank you Peter, heap is now stable.
                                                                 
73 de OE1HGA, Gerald
 
hhtg1968
Senior Member

Joined: 25/05/2023
Location: Germany
Posts: 166
Posted: 09:12pm 22 Dec 2025
Copy link to clipboard 
Print this post

very cool. i must hurry up to get my picomite computer from jlcp...
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6399
Posted: 10:13pm 22 Dec 2025
Copy link to clipboard 
Print this post

It hasn't broken any of the programs I have tested with so that is good.

Most of my deployed 'mites will not benefit but structures are something I have wished for many times.

There are a few challenges with highlighting in MMEdit but indenting and code folding works nicely with minor modification.

Good work Santa!
VK7JH
MMedit
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4334
Posted: 10:44pm 22 Dec 2025
Copy link to clipboard 
Print this post

  TassyJim said  Good work Santa!


Santa Claude & Zwarte Piet ?
MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
Amnesie
Guru

Joined: 30/06/2020
Location: Germany
Posts: 736
Posted: 11:49pm 22 Dec 2025
Copy link to clipboard 
Print this post

Hello Peter,

There is a bug with play mp3 again (in latest version and offical release). When executed it does a reboot + strange behavior.

HDMI /ps2 Version tested from:

PicoMiteRP2350V6.01.00EXP.zip
Edited 2025-12-23 05:40 by matherp

EDIT: There is ALSO a problem in the latest offical release, please see the attached video, since the problem with play mp3 isn't constant!

DROPBOX link:


play mp3 problem video

I can confirm that everything works with version:

V6.01.00RC25
PicobMiteV6.01.00RC25.zip

Greetings
Daniel
Edited 2025-12-23 10:23 by Amnesie
 
TimD
Newbie

Joined: 23/02/2021
Location: United Kingdom
Posts: 32
Posted: 12:39am 23 Dec 2025
Copy link to clipboard 
Print this post

Oh my days, this is excellent - thank you!  Any chance it can eventually be ported to the CMM2?

Kind regards and Merry Christmas,
Tim.
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2474
Posted: 01:55am 23 Dec 2025
Copy link to clipboard 
Print this post

hi Peter,
   all very PASCAL like    

have just scanned through the thread, it looks like you haven't yet implemented anything like the pascal WITH statement:

Type Person
  age As INTEGER
  height As FLOAT
  name As STRING
End Type

Dim person1 As Person

WITH person1 DO
  age = 42
  height = 1.85
  name = "John"
END WITH


(the use of DO in the context of mmbasic is probably superfluous)

the use of WITH saves on a great deal of duplicated typing and hence consumed flash program space.


cheers,
rob   :-)
 
     Page 2 of 2    
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025