Menu
JAQForum Ver 19.10.27

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

   Page 5 of 9    
Posted: 02:35pm
08 Jan 2026
Copy link to clipboard
Volhout
Guru

 
Posted: 02:45pm
08 Jan 2026
Copy link to clipboard
Volhout
Guru

deleted
Edited 2026-01-09 00:46 by Volhout
 
Posted: 03:01pm
08 Jan 2026
Copy link to clipboard
lizby
Guru

Considering this program which uses STRUCT SORT and STRUCT(FIND ...), it appears that STRUCT(FIND ...) will return the first instance of the found value. Is that the case? Is a binary search used and then backing up to find the first instance?
Type indx
 Recnum As string length 4
 KeyVal As string length 2
End Type

Dim KeyRec(15) As indx

Dim integer i,j,k,l,m,n
Dim string States(4)=("PA","VA","MA","CA","WA")

For i=0 To 9
 KeyRec(i).Recnum=Format$(i,"%4g")
 KeyRec(i).KeyVal=States(Int(Math(RAND)*5))
Next i

Struct sort KeyRec.KeyVal,4

For i=0 To 9
 Print Str$(i+1)+" "+KeyRec(i).Recnum+" "+KeyRec(i).KeyVal
Next i

Print ""
i=Struct(find KeyRec().KeyVal,"PA")

If i<>-1 Then
 Do While KeyRec(i).KeyVal="PA"
   Print KeyRec(i).Recnum+" "+KeyRec(i).KeyVal
   i=i+1
 Loop
EndIf

> RUN
1    8 CA
2    4 CA
3    2 MA
4    6 MA
5    1 PA
6    3 PA
7    5 PA
8    0 PA
9    9 VA
10    7 WA

  1 PA
  3 PA
  5 PA
  0 PA
> RUN
1    0 CA
2    9 CA
3    6 CA
4    5 CA
5    4 MA
6    7 MA
7    8 PA
8    2 VA
9    3 WA
10    1 WA

  8 PA
> RUN
1    6 CA
2    5 CA
3    7 CA
4    0 MA
5    4 MA
6    8 MA
7    3 PA
8    2 PA
9    1 WA
10    9 WA

  3 PA
  2 PA
>
 
Posted: 03:18pm
08 Jan 2026
Copy link to clipboard
matherp
Guru

Linear search but remember find has an optional start parameter that allows you to iterate through the matches. Doesn't require sorting
Type indx
Recnum As string length 4
KeyVal As string length 2
End Type

Dim KeyRec(15) As indx

Dim integer i,j,k,l,m,n
Dim string States(4)=("PA","VA","MA","CA","WA")

For i=0 To 9
KeyRec(i).Recnum=Format$(i,"%4g")
KeyRec(i).KeyVal=States(Int(Math(RAND)*5))
Next i

'Struct sort KeyRec.KeyVal,4

For i=0 To 9
Print Str$(i+1)+" "+KeyRec(i).Recnum+" "+KeyRec(i).KeyVal
Next i

Print ""
i=0
Do
 i=Struct(find KeyRec().KeyVal,"PA",i)
 If (i<>-1) Then
   Print KeyRec(i).Recnum+" "+KeyRec(i).KeyVal
   Inc i
 EndIf
Loop Until i=-1

Edited 2026-01-09 01:50 by matherp
 
Posted: 03:49pm
08 Jan 2026
Copy link to clipboard
lizby
Guru

Ok, thanks. With my version, including sort, .69ms with 4 "PA" instances. Your version, .68ms with 4 "PA" instances (.32ms with only one).

I wonder how they will compare with larger arrays, e.g., 500 records.

This is a terrific new feature, very fully implemented. Thanks for all you do.

With 500 records, my version 11.704, your version 12.245ms (may depend on how many instance of "PA" there were in each run.

~
Edited 2026-01-09 01:55 by lizby
 
Posted: 03:54pm
08 Jan 2026
Copy link to clipboard
matherp
Guru

The final release will also have the option to use a regular expression as the search term same as instr. This will, in the same way, use an extra parameter "size" to indicate the term is a regular expression.

i=Struct(find KeyRec().KeyVal,"^[Pp].$",i,size)

Edited 2026-01-09 01:56 by matherp
 
Posted: 04:16pm
08 Jan 2026
Copy link to clipboard
lizby
Guru

While continuing work on structures; any idea why this might be and how fixed?
> xmodem s
Error : Not enough Heap memory
> memory
Program:
  7K ( 2%) Program (265 lines)
309K (98%) Free

Saved Variables:
 16K (100%) Free

RAM:
  0K ( 0%) 0 Variables
  3K ( 0%) General
360K (100%) Free
>


I reloaded the program and XMODEM S worked.

~
Edited 2026-01-09 02:18 by lizby
 
Posted: 04:19pm
08 Jan 2026
Copy link to clipboard
matherp
Guru

What version? This should be fixed in the later RC
 
Posted: 04:54pm
08 Jan 2026
Copy link to clipboard
lizby
Guru

  matherp said  What version? This should be fixed in the later RC


Ah, PicoMite MMBasic RP2350A V6.02.00RC0. I've got to catch up.
 
Posted: 10:05pm
08 Jan 2026
Copy link to clipboard
JanVolk
Guru

Test PicoMiteHDMI MMBasic USB RP2350A Edition V6.02.00RC3
When I first go to EDIT, the color scheme on the bottom two lines is incorrect on the HDMI output.
It is correct with TeraTerm. Pressing PgDn once resets it to the correct color scheme on the HDMI output.
Another small observation: after playing a game like BLOCKS, the audio tape speed is sometimes incorrect (too slow) and returns to normal after a hard reset.
I need to investigate further why this occurs. It's certainly the case with the PicoMiteHDMI MMBasic USB RP2350A Edition V6.02.00RC0. Perhaps this has happened to one of you as well?

> option list
PicoMiteHDMI MMBasic USB RP2350A Edition V6.02.00RC0
OPTION SERIAL CONSOLE COM1,GP0,GP1
OPTION SYSTEM I2C GP20,GP21
OPTION FLASH SIZE 4194304
OPTION COLOURCODE ON
OPTION DEFAULT COLOURS GREEN, BLACK
OPTION MOUSE SENSITIVITY     1.0000
OPTION KEYBOARD US
OPTION HEARTBEAT OFF
OPTION RESOLUTION 640x480 @ 252000KHz
OPTION DEFAULT MODE 2
OPTION DISPLAY 30, 53
OPTION HDMI PINS  1, 3, 7, 5
OPTION SDCARD GP22, GP6, GP7, GP4
OPTION AUDIO I2S GP2,GP5', ON PWM CHANNEL 11
OPTION RTC AUTO ENABLE
OPTION MODBUFF ENABLE  192
OPTION F5 PLAY MP3"b:/mp3-bestand/"
OPTION F6 PLAY NEXT
OPTION F7 PLAY STOP
OPTION F8 FLASH RUN 1
OPTION PLATFORM Olimex HDMI USB I2S
OPTION DEFAULT FONT 7, 1

Kind regards,

Jan.
 
Posted: 08:32am
09 Jan 2026
Copy link to clipboard
matherp
Guru

  Quote  When I first go to EDIT, the color scheme on the bottom two lines is incorrect on the HDMI output.

What resolution and what mode are you in when you type EDIT
  Quote  Another small observation: after playing a game like BLOCKS, the audio tape speed is sometimes incorrect (too slow) and returns to normal after a hard reset.

Yes, I know about this one but had forgotten about it and haven't tracked down what causes it. When you play audio with a lower sample rate it sometimes doesn't reset. If you can let me have the audio track from blocks I can use it to test. What are you doing after blocks that runs slow?
Edited 2026-01-09 18:51 by matherp
 
Posted: 11:11am
09 Jan 2026
Copy link to clipboard
JanVolk
Guru

Peter,

I tested the EDIT issue using my options list above, using MODE 1 through MODE 5. Only MODE 3 works correctly the first time after EDIT on both screens. If any key is pressed after EDIT in mode 1, 2, 4, or 5 via the serial connection or on the Raspberry Pi Pico USB keyboard, the colors of the actual purple line and the colors of the editor control keys on the bottom line of the HDMI connection on the Raspberry Pi Pico screen are restored to the correct colors.
The problems do not occur on the serial console with Tera Term.

I noticed the other problem, the sound that occurs randomly, after playing a game or an audio file. When I then press F5 in my configuration, the MP3 sometimes plays at 33 rpm instead of 45 rpm.
I use F8 to start minifm_RC2.bas, which also allows me to play audio files directly.
The BLOCKS.bas game is by Geoff Graham, and I don't know the audio file. I just tested it, but unfortunately, it works fine now.
I use F5 to start the MP3, F7 to stop it, and F2 to start the game, which I first loaded with > b: and then with load "blocks." As I mentioned, there are no speed errors. So, more testing is needed to clarify the problem. If there's a pattern that can be replicated, I'll report it here.

Kind regards,

Jan.
 
Posted: 11:53am
09 Jan 2026
Copy link to clipboard
matherp
Guru

I can't replicate the editor problem. What size is the file you are editing? Bigger than one screen or less?
 
Posted: 12:03pm
09 Jan 2026
Copy link to clipboard
Volhout
Guru

Jan,

The original BLOCKS game did not have music. There are 2 versions, one that plays WAV, with associated "tet16cut.wav" file, and one that plays FLAC audio, with associated "tet16cut.flac" file. Both are sampled at 16kHz (hence "16").

Please look what file is in your blocks folder.

Volhout
 
Posted: 12:49pm
09 Jan 2026
Copy link to clipboard
JanVolk
Guru

Peter,

I've now run a flah_nuke and loaded option disk load "xxxxxxxxxx.opt" without the default mode 2 option, and it works fine for all modes (modes 1-5). However, when I enter the default mode 2 option, the problem occurs.

Kind regards,

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

Fixed the editor one. I still need the sequence of play commands that causes the slow playback in order to fix it. Can anyone point me to TET16CUT.FLAC?
Edited 2026-01-10 00:14 by matherp
 
Posted: 02:50pm
09 Jan 2026
Copy link to clipboard
Volhout
Guru

@Peter,

Please find attached ZIP.

blocks.zip

Volhout
 
Posted: 02:58pm
09 Jan 2026
Copy link to clipboard
matherp
Guru

Thanks - I can't get the problem though
 
Posted: 03:09pm
09 Jan 2026
Copy link to clipboard
JanVolk
Guru

Peter,

Thanks in advance for solving the editing problem.

I'm also puzzled as to why this is happening. There are suspicions, such as the audio file not closing properly or the game being hard-paused. The problem is that it's happening in the background.
But fortunately, so far it can be fixed with a hard reset. I hope more people have experienced this so we can get a better picture.
I don't have any FLAC files on my SD card. Blocks.bas works with tet16cut.wav and is 2432192 in size.
Perhaps Harm can help you with a FLAC file?

Kind regards,

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

What file is running at slow speed? What do you play after stopping blocks? wav, flac,mp3?
 
   Page 5 of 9    
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2026