Menu
JAQForum Ver 19.10.27

Forum Index : Microcontroller and PC projects : PicoMite V6.01.00 betas

   Page 10 of 12    
Posted: 08:57pm
29 Aug 2025
Copy link to clipboard
stanleyella
Guru


why does MM.INFO(USB 1) say unknown command?
I dug out an old keyboard with 2 usb sockets, plugged a wireless mouse in and it's detected but not the the controllers, are these generic?


Edit my bad it's print mm.info(usb 1). returns 1. sorry
Edited 2025-08-30 07:01 by stanleyella
 
Posted: 08:20am
30 Aug 2025
Copy link to clipboard
twofingers
Guru


  Amnesie said  Hi,

It definitly makes problems, because I learned this the hard way. I was searching for two whole days the problem in my program. I had a variable set to 1 to trigger an subroutine and open a file to preview it. I got an error, that this file doesn't exists. I checked a million times via PRINT debugging the state of all variables and everything was fine. I was about to ask about a bug in this forum and then it HIT me like a stone ... There is a 63 char limitation! Damn!    Now everything became clear, problem fixed.

So the answer is, it does make problems.

Greetings

Thanks, Daniel,
for the confirmation. I would have expected too what you describe. But my question to Peter goes a bit further. I'm still trying to figure out how the strange effects like the spooky "Static" problem (above) came about. These effects are all difficult to prove/reproduce – just like spooks. It would also be interesting to clarify whether the effects are limited to RAM or can destroy data on the drive, even after the files with overly long names have been deleted.

From Peter, I would have hoped for an answer along the lines of: "Yes, no, maybe, 'Not in this universe', 'I don't care.'"
Regards
Michael
Edited 2025-08-30 18:22 by twofingers
 
Posted: 09:55am
30 Aug 2025
Copy link to clipboard
Mixtel90
Guru


It's possible that you are asking in the wrong place. :)

Neither of the filesystems used were written for MMBasic by Geoff or Peter so they come with their own limitations, which may not be fully understood. Flash storage uses LittleFS by Christopher Haster and SD card uses FatFs by ChaN. It's quite possible that they have been tweaked for MMBasic but I don't know. They certainly don't work in the same way even if MMBasic makes them look similar.
 
Posted: 11:51am
30 Aug 2025
Copy link to clipboard
twofingers
Guru


HI Mick,
I'm completely relaxed about it. If Peter thinks it's important, he'll take care of it.
Michael
 
Posted: 11:54am
30 Aug 2025
Copy link to clipboard
Mixtel90
Guru


This is true. :)
 
Posted: 10:01am
01 Sep 2025
Copy link to clipboard
twofingers
Guru


Something for Geoff (I'm not sure if this has been mentioned yet),
Manual (Ver 6.00.03) page 85 says:

MM.INFO(EXISTS FILE fname$)

Returns 1 if the specified file exists, returns -1 if fname$ is a directory, otherwise returns 0.

That's incorrect. The correct description would be that directories return 0 (for V6.01.00b5).

Note: It would be desirable/easier if it worked as described. This means the code, not the manual, should be changed. IMHO.

Kind regards
Michael
Edited 2025-09-01 20:02 by twofingers
 
Posted: 01:46pm
01 Sep 2025
Copy link to clipboard
matherp
Guru

V6.01.00b11

PicoMiteV6.01.00b11.zip

FRAMEBUFFER SYNC will now work with FRAMEBUFFER COPY. In addition if used before a copy or merge is issued it will time out and return after 100mSec with no error.

MM.INFO(EXISTS FILE fname$) now conforms to manual

Max filename/pathname increased to 127 characters for RP2350 versions except WEBMITE.
Additional error checking included so that file/pathnames > than the maximum should give a standard MMbasic error rather than crashing.
 
Posted: 02:28pm
01 Sep 2025
Copy link to clipboard
twofingers
Guru


Wow, Peter, that's fantastic!
Thank you so much!

The downside is that I now have to rewrite everything!  
Kind regards
Michael
 
Posted: 06:51pm
01 Sep 2025
Copy link to clipboard
Bleep
Guru

Hi Peter,
Thanks very much for getting the Sync working for Copy to screen the same as Merge,  also the time out, so it can't get stuck (for more then 100mS anyway)  :-)
Regards, Kevin.
 
Posted: 08:56pm
01 Sep 2025
Copy link to clipboard
stanleyella
Guru


Is it for hdmi or lcd?

 
Posted: 06:43am
02 Sep 2025
Copy link to clipboard
Mixtel90
Guru


LCD only, I think. It prevents image tearing.
 
Posted: 08:15am
02 Sep 2025
Copy link to clipboard
Volhout
Guru

Stan,

On VGA and HDMI the screen memory (FRAMEBUFFER N) is inside the pico. And also the FRAMEBUFFER LAYER memory is inside the pico. The VGA/HDMI shows L overlayed on N automatically (assuming you have FRAMEBUFFER L enabled). The overlaying is part of the video driver, and happens real time when generating the video data that is put on the HDMI/VGA cable.

On an LCD screen the FRAMEBUFFER N is actually inside the LCD itself, so overlaying L is very slow (via SPI get pixel data from the LCD, combine it with data in L, and SPI write it back to screen). The trick that is used is to create a "virtual" framebuffer in memory (FRAMEBUFFER F) and the same overlay FRAMEBUFFER L. The FRAMEBUFFER MERGE command (for LCD's only) merges the RAM values in F and L, and blasts that at maximum speed to the LCD. So the LCD is not read, it is only used as an output device when this happens. This is much faster, and allows to use the LCD for video games.

Volhout
 
Posted: 08:46am
02 Sep 2025
Copy link to clipboard
Volhout
Guru

@Peter, Geoff,

Thanks for you creation/contribution of MMBasic. Every time I am surprized how complete it is. I just discovered UPGRADE FIRMWARE.. wauw..

I can't count the number of times I opened up a Game*Mite to press the small button, or disassembled the PLC (a real nightmare) to get access to that same button.
Now.. I USB connect the terminal, type UPDATE FIRMWARE, and drag a file. So easy.

Just wanted to thank you. I am curious what more gems I will find in MMBasic. It is like a box of chocolats.

Volhout
 
Posted: 02:58pm
02 Sep 2025
Copy link to clipboard
stanleyella
Guru


Thanks. MMbasic is so dynamic it's hard to keep up  
I tried a test prog, 16 "sprites" 16x16 pixel bouncing around the screen.
Actually blits. I tried box erase each sprite then blit in new position then tried frame F and cls and no box erase just blit 16 "sprites" and copy F,N.
interesting to compare. stan


OPTION BASE 0        ' 0 based arrays
option DEFAULT INTEGER
OPTION EXPLICIT
mode 2
dim dx(15),dy(15),spx(15),spy(15)
dim cannon(119),missile(15),oldspx(15),oldspy(15)
dim ptr,hiscore,spw,spht,temp,frame,frame_count,spdata,sp1
hiscore=0

'colour shortcuts
const WH =RGB(255,  255,  255) 'WHITE
const YE =RGB(255,  255,    0) 'YELLOW
const LI =RGB(255,  128,  255) 'LILAC
const BR =RGB(255,  128,    0) 'BROWN
const FU =RGB(255,  64,   255) 'FUCHSIA
const RU =RGB(255,  64,     0) 'RUST
const MA =RGB(255,  0,    255) 'MAGENTA
const RE =RGB(255,  0,      0) 'RED
const CY =RGB(0,    255,  255) 'CYAN
const GR =RGB(0,    255,    0) 'GREEN
const CE =RGB(0,    128,  255) 'CERULEAN
const MI =RGB(0,    128,    0) 'MIDGREEN
const CO =RGB(0,    64,   255) 'COBALT
const MY =RGB(0,    64,     0) 'MYRTLE
const BL =RGB(0,    0,    255) 'BLUE
const Bk =RGB(0,    0,      0) 'BLACK
const Gy =RGB(128,  128,  128) 'GREY
const Lg =RGB(210,  210,  210) 'LITEGREY
const Og =RGB(255,  165,    0) 'ORANGE
const PK =RGB(255,  160,  171) 'PINK
const Gd =RGB(255,  215,    0) 'GOLD
const SA =RGB(250,  128,  114) 'SALMON
const BE =RGB(245,  245,  220) 'BEIGE
'
restore

cls
udg1 'draws sprite1 on screen at 10,10
blit READ 1,10,10,16,16 'reads sprite1 from screen to blit buffer1
udg1 'draws sprite2 on screen at 10,10
blit read 2,10,10,16,16 'reads sprite2 from screen to blit buffer2
cls
blit read 3,10,10,16,16 'reads 16x16 background to blit buffer3
'
for temp=0 to 15 'set up start sprite positions and directions
do
 dx(temp)=(int(rnd*4)+1)-(int(rnd*8)+1)
loop until dx(temp)<>0
do
 dy(temp)=(int(rnd*4)+1)-(int(rnd*8)+1)
loop until dy(temp)<>0
 spx(temp)=104+((rnd*64)+1)
 spy(temp)=144+((rnd*64)+1)    
next temp
'
FRAMEBUFFER CREATE F
FRAMEBUFFER WRITE f

do 'demo moving sprite
cls
   for temp=0 to 15
'        if sprite_status(temp)=1 then 'is sprite active
           if spx(temp)> 300 then 'check right edge
             dx(temp)= 0-dx(temp)
           elseif spx(temp)<8 then 'check left edge
             dx(temp)= 0-dx(temp)
           end if
           if spy(temp)>220 then 'check bottom edge
             dy(temp)= 0-dy(temp)
           elseif spy(temp)<8 then 'check top edge
             dy(temp)= 0-dy(temp)
           end if
     '
           'oldspx(temp)=spx(temp):oldspy(temp)=spy(temp) 'get last position for erase
           spx(temp)=spx(temp)+dx(temp):spy(temp)=spy(temp)+dy(temp) 'get new position for draw
     '
     
               if frame=0 then'which sprite to draw
                 'box oldspx(temp),oldspy(temp),16,16,0,bk,1 'erase sprite at last position
                 'BLIT WRITE 3,oldspx(temp),oldspy(temp), 16, 16 'erase sprite at last position
                 blit WRITE 1,spx(temp),spy(temp) 'draw sprite1 at new position
               else
'box oldspx(temp),oldspy(temp),16,16,0,bk,1 'erase sprite at last position
                 'BLIT WRITE 3,oldspx(temp),oldspy(temp), 16, 16 'erase sprite at last position
                 blit WRITE 2,spx(temp),spy(temp) 'draw sprite2 at new position
               end if
   next temp
 '
FRAMEBUFFER COPY f,N
   frame_count=frame_count+1 'when to change sprite
   if frame_count=10 then
     frame=not frame
     frame_count=0
   end if
   pause 20
loop
'
sub udg1 'draws 16x16 data for blit to copy
 for spht=0 to 15
   for spw=0 to 15
     read sp1
     pixel spw+10,spht+10,sp1
   next spw
 next spht
end sub
'
'sprite1
data wh,bl,bl,bl,bl,bk,bk,bk,bk,bk,bk,bl,bl,bl,bl,wh
data bk,bl,re,re,re,bl,bl,bk,bk,bl,bl,re,re,re,bl,bk
data bk,bk,bk,bl,re,wh,bl,bk,bk,bl,wh,re,bl,bk,bk,bk
data bk,bk,bk,bl,re,wh,bl,bk,bk,bl,wh,re,bl,bk,bk,bk
data bk,bk,bk,bk,bl,wh,bl,bk,bk,bl,wh,bl,bk,bk,bk,bk
data bk,bk,bk,bk,bk,bl,bl,bk,bk,bl,bl,bk,bk,bk,bk,bk
data bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk
data bk,bk,bk,bk,ye,ye,ye,bk,bk,ye,ye,ye,bk,bk,bk,bk
data bk,bk,bk,ye,bk,bk,bk,bk,bk,bk,bk,bk,ye,bk,bk,bk
data bk,ye,ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye,ye,bk
data bk,ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye,bk
data ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bl,ye
data ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye
data ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye
data bk,ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye,bk
data bk,bk,ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye,bk,bk
'sprite2
data bl,bl,bl,bl,bl,bk,bk,bk,bk,bk,bk,bl,bl,bl,bl,bl
data bk,bl,re,re,re,bl,bl,bk,bk,bl,bl,re,re,re,bl,bk
data bk,bk,bl,wh,wh,re,bl,bk,bk,bl,re,wh,wh,bl,bk,bk
data bk,bk,bk,bl,re,wh,bl,bk,bk,bl,wh,re,bl,bk,bk,bk
data bk,bk,bk,bk,bl,wh,bl,bk,bk,bl,wh,bl,bk,bk,bk,bk
data bk,bk,bk,bk,bk,bl,bl,bk,bk,bl,bl,bk,bk,bk,bk,bk
data bk,bk,bk,bk,bk,bk,bk,ye,ye,bk,bk,bk,bk,bk,bk,bk
data bk,bk,bk,bk,bk,ye,ye,bk,bk,ye,ye,bk,bk,bk,bk,bk
data bk,bk,bk,bk,ye,ye,bk,bk,bk,bk,ye,ye,bk,bk,bk,bk
data bk,bk,bk,bk,ye,bk,bk,bk,bk,bk,bk,ye,bk,bk,bk,bk
data bk,bk,bk,ye,bk,bk,bk,bk,bk,bk,bk,bk,ye,bk,bk,bk
data bk,bk,ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye,bk,bk
data bk,bk,bk,ye,ye,bk,bk,bk,bk,bk,bk,ye,ye,bk,bk,bk
data bk,bk,bk,bk,ye,ye,bk,bk,bk,bk,ye,ye,bk,bk,bk,bk
data bk,bk,bk,bk,bk,ye,bk,bk,bk,bk,ye,bk,bk,bk,bk,bk
data bk,bk,bk,bk,bk,bk,ye,bk,bk,ye,bk,bk,bk,bk,bk,bk

 
Posted: 07:52pm
05 Sep 2025
Copy link to clipboard
Volhout
Guru

Hi Peter,

On the 6.01.00b11 for 2040 VGA:

1/



mm.info(lcdpanel) gives a "SYNTAX ERROR".
Not a big issue, but would have expected and empty string returned.

2/

If I connect a WII nunchuck (working system i2c) and do a WII CLASSIC OPEN it passes.
If I connect a WII classic and WII NUNCHUCK OPEN it passes.

Why are there 2 different WII xxx OPEN commands if you cannot use them to distinguish between the 2 devices. A

Not a big issue, I will work around it, but it puzzled me. I wanted to use the WII xxx OPEN to distinguish between the 2 devices, so I would know what DEVICE(xxx ) to use. But apparently it does not work that way. When there is no WII device the WII xxx OPEN generates an error, and with ON ERROR SKIP I thought I could use this to distinguish. I will issue an I2C read now, and read the type from the device, and then open the correct device immediately.

Volhout
Edited 2025-09-06 06:33 by Volhout
 
Posted: 11:27pm
05 Sep 2025
Copy link to clipboard
lizby
Guru

Works for me if the "$" is included (or if not included) -- but on standard, not VGA version.

PicoMite MMBasic RP2350A V6.01.00b11
Copyright 2011-2025 Geoff Graham
Copyright 2016-2025 Peter Mather

> ? mm.info$(lcdpanel)
ILI9488
>


~
Edited 2025-09-06 09:29 by lizby
 
Posted: 06:51am
06 Sep 2025
Copy link to clipboard
Mixtel90
Guru


Nunchuck controllers are a pain. They might be I2C but they are all the same address as normally they are connected to the bluetooth link, not the WII. I read somewhere that black and white controllers have different addresses but I don't know if that's true.The controller sockets on the WII are all separate I2C ports.

I seem to remember that the Classic can/does connect directly to the WII so follows different rules. I think the ID pin on the plug is used to identify what sort of device is being connected.

Although we used to have a WII I never used it (I've very rarely used any game console!) and I don't have access to any WII stuff now.
 
Posted: 06:56am
06 Sep 2025
Copy link to clipboard
Volhout
Guru

Hi Lizby,

I did not expect a syntax error on any version of picomite, but a blank string when no lcd.
Same with the WII. The behaviour is not as I expected, reading the user manual.
Both these items I use for the first time.

Volhout
 
Posted: 12:12pm
06 Sep 2025
Copy link to clipboard
Amnesie
Guru

  matherp said  V6.01.00b11

...

Max filename/pathname increased to 127 characters for RP2350 versions except WEBMITE.
Additional error checking included so that file/pathnames > than the maximum should give a standard MMbasic error rather than crashing.


Hi Peter,

just a quick thank you for increasing the filename/pathname char length! This helps a lot, and I don't need to re-program a program I am currently working on.

 

Greetings
Daniel
 
Posted: 06:22pm
08 Sep 2025
Copy link to clipboard
Volhout
Guru

@Peter,

I have tried to use the WII support commands as good as I can, but I am stumbling upon a behaviour I think is a bug.

When using a WII OPEN command, and there is no WII classic connected, it errors.
And when doing a WII CLOSE, the message is that there is no WII channel open. So the error closes the WII support in MMBasic.

Also when there is a WII NUNCHUCK connected, the WII OPEN command errors.
And when doing a WII CLOSE the message is that there is no WII channel open. Reading the ERRMESG$, the driver has detected a NUNCHUCK, but the channel is closed.
In this case I can WII NUNCHUCK OPEN, to enable support for the NUNCHUCK.

Up to here it all works. However....

The WII NUNCHUCK channel is not opened.
When I do a DEVICE(WII NUNCHUCK T) to read the type the error presented is:
Print "type =";Hex$(DEVICE(wii nunchuck T))
Error : Not open


I have tried adding delays, to make sure there is sufficient time between closing the WII and opening the WII NUNCHUCK, but that does not help.

Please find attached a minimal demo program.

connect a nunchuck to system i2c
'opens classic wii
on error skip 1
WII OPEN
? MM.ERRMSG$

'no classic, then open
WII NUNCHUCK OPEN

? hex$(DEVICE(WII NUNCHUCK T))


The strange thing is, that when you do the reverse (connect a classic, open a nunchuck channel first) it does work as planned.

connect a classic wii controller
'opens nunchuck wii
on error skip 1
WII NUNCHUCK OPEN
? MM.ERRMSG$

'no nunchuck, then open a classic
WII OPEN

? hex$(DEVICE(WII T))


Please comment if I am doing something wrong, or if this is a bug.
Note that I cannot use method 2 (that works) due to the error message. When opening a nunchuck with classic attached, the error message is "this is not a nunchuck", but it does not say that it is a classic (negative message, it is not xxx, but what is it ?). When opening a classic with nunchuck attached the error message is "a nunchuck is attached", this is the positive message, so I can immediately open the right thing.

Volhout
Edited 2025-09-09 18:01 by Volhout
 
   Page 10 of 12    
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025