Menu
JAQForum Ver 19.10.27

Forum Index : Microcontroller and PC projects : PicoMite V6.02.00 release candidates - Structured types

   Page 6 of 9    
Posted: 04:11pm
09 Jan 2026
Copy link to clipboard
JanVolk
Guru

I can get the problem with Flappy to occur.
If I load "flappy.bas" and quit the program with Ctrl+C, and then play an .mp3 file with "file.mp3," the record spins at 33 rpm instead of 45 rpm.
I want to try it with the original file because I might have made some changes in the past.
I've now transferred all the files to filename A: and am starting from filename A:
I think the original Flappy file came from Volhout?
Flappy works with an sll3sfx2.mod file from 119908.

Kind regards,

Jan.
 
Posted: 04:16pm
09 Jan 2026
Copy link to clipboard
matherp
Guru

What is the music file in flappy? If you just play it direct and then ctrl-c and play an mp3 do you get the same?.
 
Posted: 04:39pm
09 Jan 2026
Copy link to clipboard
JanVolk
Guru

I found a flappyVGA folder from 2024-10-02, which may be the original, and it has the same sound problem.
This folder contains 34 files.

First, I perform a hard reset on the Raspberry Pi.
I play the file sll3sfx2.mod from A: with minifm_RC2, quit the program with Esc, and then start the MP3 file with F5, which then plays slowly.
The same thing happens with Ctrl+C.

Kind regards,

Jan.
 
Posted: 04:39pm
09 Jan 2026
Copy link to clipboard
matherp
Guru

Jan

Please try this - should fix both bugs


PicoMite.zip
 
Posted: 04:40pm
09 Jan 2026
Copy link to clipboard
lizby
Guru

Is there a reason why REDIM PRESERVE of an array of structures doesn't work? I know that ",4" after STRUCT SORT fixes some of the problems of an array which has more elements than data, but REDIM PRESERVE might also provide a clean path (I don't, of course, know the effort required).

This works
Type test
 ii As integer
 aa As string length 15
End Type

Dim aray(20) As test
Dim integer i,j,k,l,m,n
Dim string a,b,c,d,e
Dim string animal(5)=("Dog","Cat","Squirrel","Ape","Giraffe","Hippo")
For i=0 To 9
aray(i).ii=i
aray(i).aa=animal(Int(Rnd*6))
Next i

'ReDim Preserve aray(i) As test
'Struct sort aray().aa ' could use ,4

Struct sort aray().aa,4

For i=0 To 9
 Print aray(i).ii;" "+aray(i).aa
Next i

> run
0 Ape
7 Ape
1 Cat
5 Dog
4 Dog
6 Dog
9 Giraffe
3 Squirrel
8 Squirrel
2 Squirrel

This, with REDIM PRESERVE doesn't:
Type test
 ii As integer
 aa As string length 15
End Type

Dim aray(20) As test
Dim integer i,j,k,l,m,n
Dim string a,b,c,d,e
Dim string animal(5)=("Dog","Cat","Squirrel","Ape","Giraffe","Hippo")
For i=0 To 9
aray(i).ii=i
aray(i).aa=animal(Int(Rnd*6))
Next i

ReDim PRESERVE aray(i) As test
Struct sort aray().aa

'Struct sort aray().aa,4

For i=0 To 9
 Print aray(i).ii;" "+aray(i).aa
Next i

> run
[15] ReDim PRESERVE aray(i) As test
Error : Only the last array index can be changed

(Or am I doing something wrong?)

~
Edited 2026-01-10 02:42 by lizby
 
Posted: 05:01pm
09 Jan 2026
Copy link to clipboard
matherp
Guru

Is this what you would expect as output?
0
6 Ape
2 Ape
8 Ape
4 Cat
5 Cat
7 Cat
9 Dog
3 Giraffe
1 Hippo
 
Posted: 05:22pm
09 Jan 2026
Copy link to clipboard
JanVolk
Guru

Did a quick test.
The sound problem seems to be resolved. I've done various tests and haven't seen any issues yet.
Edit: Tested the problem. It's now resolved for MODE 2 through 5. So, only MODE 1 isn't working correctly with OPTION DEFAULT MODE 2.
Thanks in advance.

Even if I don't use TeraTerm, the buffer still overflows, which I've noticed in the last few versions. Has anything changed with com1, GP0, or GP1, or should I look for the problem in TeraTerm or my cables?

Kind regards,

Jan.
 
Posted: 05:35pm
09 Jan 2026
Copy link to clipboard
matherp
Guru

  Quote  Even if I don't use TeraTerm, the buffer still overflows,

What buffer? When?
 
Posted: 05:59pm
09 Jan 2026
Copy link to clipboard
JanVolk
Guru

Peter,

I understand that the information is sent to two consoles: the HDMI port and the COM1 port, which then sends it back to Tera Term.
That information has to stay somewhere, and when I open Tera Term with my port, my screen sometimes fills with data from the PicoMite.
Should I configure something in Tera Term to prevent this from happening?

> nnected on channel 2
> nnected on channel 2
> nnected on channel 2
> nnected on channel 2
> nnected on channel 2
> nnected on channel 2
> nnected on channel 2
> nnected on channel 2
> nnected on channel 2
> nnected on channel 2
> nnected on channel 2
> nnected on channel 2

This is the kind of data I mean.

Kind regards,

Jan.
 
Posted: 06:09pm
09 Jan 2026
Copy link to clipboard
matherp
Guru

V6.02.00RC4

PicoMiteV6.02.00RC4.zip

MMBasic_Structures_Manual.pdf

Fixes bug in playing mp3 after mod file
Fixes bug in editor showing the bottom magenta line in white
Enables REDIM to work with arrays of a structure
Adds regular expression support to STRUCT(FIND function - see manual attached
Reduces memory requirement for filled polygons
For VGA and HDMI versions mm.info(LCDPANEL) will now return the current mode
 
Posted: 07:24pm
09 Jan 2026
Copy link to clipboard
lizby
Guru

  matherp said  Is this what you would expect as output?
0
6 Ape
2 Ape
8 Ape
4 Cat
5 Cat
7 Cat
9 Dog
3 Giraffe
1 Hippo


Yes, except I should have REDIMed to i-1 rather than i (so the first "0" isn't there).

New version flashed, tested, and working.

Where else, I ask, can one make a suggestion and have it implemented in a release 1 hour and 8 minutes later? Thank you so much.
 
Posted: 08:18pm
09 Jan 2026
Copy link to clipboard
JanVolk
Guru

MODE 1 with EDIT has now also been resolved with V6.02.00RC4.

Thanks for quickly resolving all the issues.

Have a nice weekend.
 
Posted: 08:11pm
10 Jan 2026
Copy link to clipboard
homa
Guru


Again a question about PIO and interrupts.
Here is the code:

'PIO TEST piopin BSP4
Option explicit
Dim pio_0_FSTAT% = &h50200000 + &h4 'PIO0 Register Offset + Register FSTAT
Dim integer fifoR(3), fifoW(3)
Dim integer ffR, ffW, tmp
Dim string i$
Array Set 0,fifoR()
Array Set 0,fifoW()
ffW=0
'
PIO clear 0
PIO ASSEMBLE 0,".program bsp1"
PIO ASSEMBLE 0,".wrap target"
PIO ASSEMBLE 0, "pull block"
PIO ASSEMBLE 0, "mov isr, osr"
PIO ASSEMBLE 0, "push block"
PIO ASSEMBLE 0,".wrap"
PIO ASSEMBLE 0,".end program list"
'
PIO CONFIGURE 0,0,20000,,,,,,,,,,,,,Pio(.wrap target),Pio(.wrap),,,,,,,1,1
PIO interrupt 0,0,pRX,pTX
PIO START 0,0
'
Do
 i$=""
 Do While i$=""
   i$=Inkey$
 Loop
 Print "PIN OUT ..."
 PIO write 0,0,4,&h1,&h2,&h3,&h4
Loop

Sub pRX
 'Print "LEVEL TX:";Pio(FLEVEL 0 ,0, TX)
 'Print "LEVEL RX:";Pio(FLEVEL 0 ,0, RX)
 'Print "FSTAT: ";Bin$(Peek(word pio_0_FSTAT%),32)
 'Print "FSTAT: ";Bin$(Pio(fstat 0),32)
 'Print "Flevel:";Pio(FLEVEL 0)
 Local integer r
 Print "Pio FiFo RX "
 Array Set 0,fifoR()
 r=Pio(FLEVEL 0 ,0, RX)
 Print "LEVEL RX:";r
 PIO READ 0,0,r,fifoR()
 Math V_PRINT fifoR(), hex
 Print "Pio Fifo RX - END"
End Sub

Sub pTX
 Print "Pio FiFo TX / TX - End - E E E M M M P P P T T T Y Y Y :-)"
End Sub


Here is the output (several key presses by me):

> run
0: 80A0
1: A0C7
2: 8020
PIN OUT ...
Pio FiFo TX / TX - End - E E E M M M P P P T T T Y Y Y :-)
Pio FiFo RX
LEVEL RX: 4
1, 2, 3, 4
Pio Fifo RX - END
PIN OUT ...
Pio FiFo TX / TX - End - E E E M M M P P P T T T Y Y Y :-)
Pio FiFo RX
LEVEL RX: 4
1, 2, 3, 4
Pio Fifo RX - END
PIN OUT ...
Pio FiFo TX / TX - End - E E E M M M P P P T T T Y Y Y :-)
Pio FiFo RX
LEVEL RX: 4
1, 2, 3, 4
Pio Fifo RX - END
PIN OUT ...
Pio FiFo TX / TX - End - E E E M M M P P P T T T Y Y Y :-)
Pio FiFo RX
LEVEL RX: 4
1, 2, 3, 4
Pio Fifo RX - END
PIN OUT ...
Pio FiFo TX / TX - End - E E E M M M P P P T T T Y Y Y :-)
Pio FiFo RX
LEVEL RX: 4
1, 2, 3, 4
Pio Fifo RX - END
PIN OUT ...
Pio FiFo RX
LEVEL RX: 3
1, 2, 3, 0
Pio Fifo RX - END
Pio FiFo RX
LEVEL RX: 1
4, 0, 0, 0
Pio Fifo RX - END
PIN OUT ...
Pio FiFo RX
LEVEL RX: 3
1, 2, 3, 0
Pio Fifo RX - END
Pio FiFo RX
LEVEL RX: 1
4, 0, 0, 0
Pio Fifo RX - END
PIN OUT ...
Pio FiFo TX / TX - End - E E E M M M P P P T T T Y Y Y :-)
Pio FiFo RX
LEVEL RX: 4
1, 2, 3, 4
Pio Fifo RX - END
> option list
PicoMite MMBasic RP2040 V6.02.00RC4
OPTION COLOURCODE ON
OPTION CONTINUATION LINES ON
OPTION CPUSPEED (KHz) 200000
OPTION DISPLAY 40, 80


Why does the interrupt for TX empty not occur from time to time? Shouldn't it always occur? Even when I change the PIO frequency, this problem gets worse.
What have I overlooked?
 
Posted: 09:59pm
10 Jan 2026
Copy link to clipboard
homa
Guru


Further questions about PIO and

PIO CONFIGURE pio, sm,
clock [,startaddress]
[,sidesetbase] [,sidesetno]
[,sidesetout]
[,setbase] [,setno] [,setout]
[,outbase] [,outno] [,outout]
[,inbase]
[,jmppin] [,wraptarget] [,wrap]
[,sideenable] [,sidepindir]
[,pushthreshold]
[,pullthreshold] [,autopush]
[,autopull] [,inshiftdir]
[,outshiftdir]
[,joinrxfifo] [,jointxfifo]
[,joinrxfifoget] [,joinrxfifoput]


At [,pushthreshold] [,pullthreshold] the interpreter says "Error : 32 is invalid (valid is 0 to 31)"

But how do I specify that the entire OSR (32-bit) should always be filled from the FiFo and not just 31 bits?
 
Posted: 10:33pm
10 Jan 2026
Copy link to clipboard
homa
Guru


 
Posted: 02:15am
11 Jan 2026
Copy link to clipboard
phil99
Guru


  Quote  At [,pushthreshold] [,pullthreshold] the interpreter says "Error : 32 is invalid (valid is 0 to 31)"
But how do I specify that the entire OSR (32-bit) should always be filled from the FiFo and not just 31 bits?

Looking at the PIO examples in the manual it all appears to be Base 0, so 1 to 32 = 0 to 31.
So I assume you will get 32 bits (base 1) if you specify 31 (base 0).

Similar to Dim A%(31) giving you room for 32 integers.
Edited 2026-01-11 17:20 by phil99
 
Posted: 07:38am
11 Jan 2026
Copy link to clipboard
AlbertR
Senior Member

That's a bit of MMBasic-logic.
If a parameter of a function is not specified, i.e., is “0,” the default value is used, which is 32-bit for thresholds. However, I have only used this with “PULL” so far.
I have not observed any offset due to Base.

Albert
 
Posted: 07:46am
11 Jan 2026
Copy link to clipboard
phil99
Guru


As far as I can see PIO are always Base 0 regardless of what OPTION BASE has been set for arrays.
 
Posted: 08:18am
11 Jan 2026
Copy link to clipboard
matherp
Guru

  Quote  So I assume you will get 32 bits (base 1) if you specify 31 (base 0).

These are coded values as per the RP datasheet 0=32, 1-1 etc.

I can't help with the program as it is completely uncommented as to what it is trying to do, what the configuration is trying to set up, and how it is being run.

The Raspberry Pi datasheet and/or sdk are essential reading to understand PIO usage. It isn't possible to give more than an overview in the MMbasic documentation
Edited 2026-01-11 18:23 by matherp
 
Posted: 08:45am
11 Jan 2026
Copy link to clipboard
homa
Guru


  matherp said  
  Quote  So I assume you will get 32 bits (base 1) if you specify 31 (base 0).

These are coded values as per the RP datasheet 0=32, 1-1 etc.


So an 8 must be entered for 8 bits. Thank you for the explanation.

  Quote  
I can't help with the program as it is completely uncommented as to what it is trying to do, what the configuration is trying to set up, and how it is being run.


Actually, the PIO Prog does nothing other than push the TX FIFO directly into the RX FIFO via the ISR/OSR.

Each time the button is pressed, the values are written from mmbasic to the PIO. I had simply expected the interrupt for TX-Fifo to be empty on a regular basis. But it is not deterministic?!

  Quote  
The Raspberry Pi datasheet and/or sdk are essential reading to understand PIO usage. It isn't possible to give more than an overview in the MMbasic documentation


I realise that too, and I am trying to do so.
 
   Page 6 of 9    
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2026