Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 07:12 21 Jul 2024 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 : PicoMite V5.07.08 betas

     Page 1 of 11    
Author Message
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8674
Posted: 11:13am 17 Jun 2023
Copy link to clipboard 
Print this post

V5.07.08b5

https://geoffg.net/Downloads/picomite/PicoMite_Beta.zip

Changes to WebMite as per this thread

Other new functionality.

The MID$ command can now insert a string that is a different length than the selected section

Full, optional implementation of regular expressions in INSTR and LINSTR

INSTR([start],text$, search$ [,size])
LINSTR(text%(),search$ [,start] [,size]


In both cases specifying the size parameter causes the firmware to interpret the search string as a regular expression. The size parameter is a floating point variable that is used by the firmware to return the size of a matching string. If the variable doesn't exist it is created.

e.g.





Other changes:

Fixed bug in MM.INFO(OPTION ANGLE) returns an incorrect value
Fixed minor bugs in CALL and MM.CMDLINE$.
LOAD SPRITE no longer requires exact spacing of the width,number,height fields.
Fixed issue where changing volume when PLAY TONE is playing the same on both channels causes one channel to disappear.
Fixed bug where EXECUTE command does not work at the command prompt
Fixed bug where CLS after NEW when a framebuffer is active can crash system.
Fixed bug where using EXECUTE in a program that has been AUTORUN crashes the system.

 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 3784
Posted: 08:03pm 17 Jun 2023
Copy link to clipboard 
Print this post

Thanks Peter !!
PicomiteVGA PETSCII ROBOTS
 
Plasmamac

Guru

Joined: 31/01/2019
Location: Germany
Posts: 505
Posted: 03:56pm 18 Jun 2023
Copy link to clipboard 
Print this post

Thx a lot
Plasma
 
disco4now

Guru

Joined: 18/12/2014
Location: Australia
Posts: 864
Posted: 12:01am 20 Jun 2023
Copy link to clipboard 
Print this post

I am seeing some issues with the new regex version of the INSTR function. I have tried a clean and reload of the b5 firmware but can still get the same results. There are a number of ways it manifests.

This shows it working as expected after power restart,
but relies of the INSTR function nominating the START position to be
run first.

PicoMite MMBasic Version 5.07.08b5
Copyright 2011-2023 Geoff Graham
Copyright 2016-2023 Peter Mather
> ? instr(1,"123xyz789","x.z",a)
4
>
> ? instr("123xyz789","x.z",a)
4
>



This shows what happens for me after a power restart if the first INSTR
does not nominate the START postion.

PicoMite MMBasic Version 5.07.08b5
Copyright 2011-2023 Geoff Graham
Copyright 2016-2023 Peter Mather

> ? instr("123xyz789","x.z",a)
Error: Invalid address - resetting
PicoMite MMBasic Version 5.07.08b5
Copyright 2011-2023 Geoff Graham
Copyright 2016-2023 Peter Mather



Running this program results in a *** PANIC *** after 46 iterations


> list
s$="123xyz456"
For x=1 To 50
Print x, Instr(1,s$,"x.z",a),a
Next x
>
>

e.g.
44      4       3
45      4       3
46
*** PANIC ***

PicoMite MMBasic Version 5.07.08b5
Copyright 2011-2023 Geoff Graham
Copyright 2016-2023 Peter Mather



This error with Variable name can also manifest for a command that should work.
You can cause it by erasing the variable, but you need to attempt to erase it a second time and get the error Cannot find A
It does appear with erasing the variable but no sure on the exact sequence to cause it.

> erase a
Error : Cannot find A
>
> ? INSTR("123xyz789","x.z",a)
Error : Variable name
>



Can anyone else see this or is it something just for me.

Gerry
Latest F4 Latest H7
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8674
Posted: 08:21am 20 Jun 2023
Copy link to clipboard 
Print this post

Gerry

Thanks for the reports. Should be fixed in b6

V5.07.08b6

https://geoffg.net/Downloads/picomite/PicoMite_Beta.zip
 
electricat

Regular Member

Joined: 30/11/2020
Location: Lithuania
Posts: 78
Posted: 07:56am 21 Jun 2023
Copy link to clipboard 
Print this post

Peter,

I was able compile/build PicomiteVGA only after adding "regex.c" to CMakeLists.txt ;)

add_executable(PicoMite
   regex.c

https://github.com/UKTailwind/PicoMite-VGA-Edition/blob/main/CMakeLists.txt
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8674
Posted: 11:41am 30 Jun 2023
Copy link to clipboard 
Print this post

V5.07.08b7

https://geoffg.net/Downloads/picomite/PicoMite_Beta.zip

Fixes bug in FRAMEBUFFER COPY to N.
Fixes bug in FRAMEBUFFER CLOSE.
PIO DMA TX now accepts 0 for the number of conversions when using a ringbuffer for continuous output. NB: completion interrupt can not be specified when continuous operation is enabled
PIO DMA RX now accepts 0 for the number of conversions when using a ringbuffer for continuous input. NB: completion interrupt can not be specified when continuous operation is enabled
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 3924
Posted: 11:47am 30 Jun 2023
Copy link to clipboard 
Print this post

Thank you Peter.
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8674
Posted: 12:01pm 30 Jun 2023
Copy link to clipboard 
Print this post

Note for Volhout

I've just updated the download (11:57 UTC). Now when you specify continuous operation the array no longer needs to be aligned (no need for DMA MAKE RING BUFFER command). Just specify a standard array of the required size
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 3784
Posted: 01:34pm 30 Jun 2023
Copy link to clipboard 
Print this post

Just tested without MAKE RING BUFFER, that works fine for the sine wave generator.

Volhout
PicomiteVGA PETSCII ROBOTS
 
disco4now

Guru

Joined: 18/12/2014
Location: Australia
Posts: 864
Posted: 11:23am 03 Jul 2023
Copy link to clipboard 
Print this post

Here are some notes for using the new Regular Expression options.



MMBasic Regex Syntax used in INSTR and LINSTR functions.

The alternate forms of the INSTR() and LINSTR() functions can take a regular expression as the search pattern in the Picomites from V5.07.08b6.
The alternate form of the commands are:

 INSTR([start],text$, search$ [,size])
 LINSTR(text%(),search$ [,start] [,size]

In both cases specifying the size parameter causes the firmware to interpret the search string as a regular expression. The size parameter is a floatingpoint variable that is used by the firmware to return the size of a matching string. If the variable doesn't exist it is created. As implemented in MMBasic you need to apply the returned start and size values to the MID$ function to extract the matched string. e.g.
IF start THEN match$=MID$(text$,start,size) ELSE match$=”” ENDIF

The library used for the regular expressions “implements POSIX draft P1003.2/D11.2, except for some of the internationalization features”. See See  http://mirror.math.princeton.edu/pub/oldlinux/Linux.old/Ref-docs/POSIX/all.pdf section 2.8 for details of constructing Regular Expressions or other online tutorials if you are not familiar with them.

The syntax of regular expressions can vary slightly with the various implementations. This document is a summary of the syntax and supported operations used in the MMBasic implementation.

Anchors
^    Start of string
$    End of string
\b  Word Boundary
\B  Not a word boundary
\<  Start of word
\>  End of  word

Qualifiers
*          0 or more (not escaped)
\+         1 or more
\?          0 or 1
\{3\}     Exactly 3
\{3,\}   3 or more
\{3,5\} 3,4 or 5

Groups and Ranges
(a\|b)      a or b
\(…\)     group
[abc]      Range (a or b or c)
[^abc]    Not (a or b or c]
[a-q]       lower case letters a to q
[A-Q]    upper case letters A to Q
[0-7]      Digits from 0 to 7

Escapes Required to Match Normal Characters
\^     to match ^   (caret)
\.      to match .   (dot)
\*     to match *  (asterix)
\$     to match $   (dollar)
\[      to match  [   (left bracket)
\\      to match \   (backslash)

Escapes with Special Functions
\+  See Quantifiers
\?  See Quantifiers
\{  See Quantifiers
\}  See Quantifiers
\|   See Groups and Ranges
\(   See Groups and Ranges
\)   See Groups and Ranges
\w  See Character Classes

Character Classes
\w              digits,letters and _                                              
[:word:]     digits,letters and _                                              
[:upper:]    Upper case letters_                                              
[:lower:]    Lower case letters_                                              
[:alpha:]    All  letters                                            
[:alnum:]   Digits and  letters                                            
[:digit:]      Digits
[:xdigit:]    Hexidecimal digits
[:punct:]    Puntuation
[:blank:]    Space and tab
[:space:]    Blank charaters
[:cntrl:]      Control charaters
[:graph:]    Printed characters
[:print:]      Printed chars and spaces

Example expression to match an IP Address which is contained within a word boundary.
    "\<[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\>"
Latest F4 Latest H7
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8674
Posted: 11:55am 03 Jul 2023
Copy link to clipboard 
Print this post

Thanks for the documentation. We will include it in the next manual.

Another good use is to substitute sub-strings in strings using the new flexibility in the MID$ command

e.g.


 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 3924
Posted: 06:24pm 03 Jul 2023
Copy link to clipboard 
Print this post

I believe this to be a bug:

> option list
PicoMite MMBasic Version 5.07.08b7
OPTION SYSTEM SPI GP6,GP3,GP4
OPTION AUTORUN 1
OPTION CPUSPEED (KHz) 252000
OPTION LCDPANEL ILI9341, RLANDSCAPE,GP2,GP1,GP0
OPTION GUI CONTROLS 2
OPTION TOUCH GP5,GP7
GUI CALIBRATE 0, 4034, 2040, -2600000, -64285
OPTION SDCARD GP22
OPTION AUDIO GP20,GP21, ON PWM CHANNEL 2

> list
Do
 f% = Int(Rnd() * 500) + 100
 Play Tone f%, f%, Int(3 * Rnd())
Loop

> run
[3] Play Tone f%, f%, Int(3 * Rnd())
Error : Sound output in use  <---- after some random time


Obviously this example is contrived for ease of reproducing the bug, but my understanding is that whilst consecutive PLAY TONE commands (without a sufficient PAUSE) will override each other rather than play consecutively they are still permitted without an ERROR.

Best wishes,

Tom
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8674
Posted: 10:04pm 03 Jul 2023
Copy link to clipboard 
Print this post

You are calling play tone with no pause of any sort. It is likely that in the limit you are changing the tone before even one H/W interrupt has fired on the first call. This seems a completely unrealistic use-case and could well cause unexpected behaviour. If you can demonstrate the problem with a 1mSec pause between calls then I will look at otherwise not.
 
Frank N. Furter
Guru

Joined: 28/05/2012
Location: Germany
Posts: 818
Posted: 06:37am 04 Jul 2023
Copy link to clipboard 
Print this post

@thwill:

Hi Tom,

I had a similar problem with WAV playback. You should try my interrupt routine from HERE...

Frank
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 3924
Posted: 06:43am 04 Jul 2023
Copy link to clipboard 
Print this post

  matherp said  You are calling play tone with no pause of any sort. It is likely that in the limit you are changing the tone before even one H/W interrupt has fired on the first call. This seems a completely unrealistic use-case and could well cause unexpected behaviour. If you can demonstrate the problem with a 1mSec pause between calls then I will look at otherwise not.


You don't want real code, and you don't want contrived examples, you've a difficult man  .

Try this:

> list
Dim noise%(200)
Do
 For i% = 1 To 200 : noise%(i%) = Int(Rnd * 1000) : Next
 Do
   For i% = 1 To 200
     Play Tone noise%(i%), noise%(i%), 2
     Pause 1
   Next
 Loop
Loop
> run
[6] Play Tone noise%(i%), noise%(i%), 2
Error : Sound output in use


The ERROR occurs after a random time. Sometimes instead of throwing the ERROR it will keep going but become silent.

I know there are other ways of making noise, but PLAY SOUND is quiet unless you use all channels, and the approach above is the one that @Martin H used in the PicoVaders game that I am porting to Bintendo.

Best wishes,

Tom
Edited 2023-07-04 16:50 by thwill
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 3784
Posted: 06:58am 04 Jul 2023
Copy link to clipboard 
Print this post

Hi Tom,

Is it depending on CPUSPEED ? I recall you run the Bintendo at 252MHz.

Volhout

P.S. ran a trial with minimum frequency=1 (not 0), but the same observed. CPU=126MHz
P.P.S. you can do without the outer DO:LOOP
Edited 2023-07-04 17:07 by Volhout
PicomiteVGA PETSCII ROBOTS
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8674
Posted: 07:30am 04 Jul 2023
Copy link to clipboard 
Print this post

Tom

Explain this one

NB: CurrentlyPlaying is defined volatile

Old code which gives the problem
       if(!(CurrentlyPlaying == P_NOTHING || CurrentlyPlaying == P_TONE || CurrentlyPlaying == P_PAUSE_TONE)) error("Sound output in use");


First diagnostic change
if(!(CurrentlyPlaying == P_NOTHING || CurrentlyPlaying == P_TONE || CurrentlyPlaying == P_PAUSE_TONE)) error("Sound output in use %",CurrentlyPlaying);


Prints "Error: Sound output in use 2"
WTF: 2 is the code for P_TONE!!!!!!


New code which is currently testing without error
       if(!(CurrentlyPlaying == P_NOTHING || CurrentlyPlaying == P_TONE || CurrentlyPlaying == P_PAUSE_TONE)) {
if(CurrentlyPlaying != P_TONE)error("Sound output in use %",CurrentlyPlaying);
}

NB: the RP2040 does not have a data cache
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 3784
Posted: 08:28am 04 Jul 2023
Copy link to clipboard 
Print this post

Hi,

During execution of this code, there happens a sound interrupt, and the status changes.

Volhout
Edited 2023-07-04 19:14 by Volhout
PicomiteVGA PETSCII ROBOTS
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 3924
Posted: 09:18am 04 Jul 2023
Copy link to clipboard 
Print this post

  matherp said  Explain this one


I wish I could. It looks like (excluding something crapping on the memory) it would require a thread/interrupt to change CurrentlyPlaying from an "invalid" value to P_TONE between the check and displaying the error ... and I can find no code that does that.

You might try something like:
e_CurrentlyPlaying tmp = CurrentlyPlaying;
if (!(tmp == P_NOTHING || tmp == P_TONE || tmp == P_PAUSE_TONE))
   error("Sound output in use %", tmp);


But that is at best random hacking.

Also no explanation for why sometimes the sound just stops completely .

Best wishes,

Tom
Edited 2023-07-04 19:19 by thwill
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
     Page 1 of 11    
Print this page
© JAQ Software 2024