Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 05:27 21 Sep 2026 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 V6.03.02 betas

     Page 4 of 6    
Author Message
terekgabor
Senior Member

Joined: 02/01/2026
Location: Hungary
Posts: 129
Posted: 06:53pm 13 Sep 2026
Copy link to clipboard 
Print this post

One more idea:
Maybe LIBRARY DELETE can be run from a program.
To make flash slot free at the end of the program.

G@bor
 
terekgabor
Senior Member

Joined: 02/01/2026
Location: Hungary
Posts: 129
Posted: 07:33pm 13 Sep 2026
Copy link to clipboard 
Print this post

Hello Peter again!

I tried KEYDOWN on Picocalc.
I got value 0 back all the time in any cases.
Maybe I missed something?

G@bor
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 11882
Posted: 09:21pm 13 Sep 2026
Copy link to clipboard 
Print this post

What version keyboard firmware are you running? Try the chuckie egg program - works for me. Make sure you use the latest PICORP2350 firmware from the github
 
terekgabor
Senior Member

Joined: 02/01/2026
Location: Hungary
Posts: 129
Posted: 04:49am 14 Sep 2026
Copy link to clipboard 
Print this post

I had the ”old” b5 version - missed the update.
Now updated and it is ok.
Also thanks for the repair of Library with Definefont!

G@bor
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 11882
Posted: 12:12pm 14 Sep 2026
Copy link to clipboard 
Print this post

Now available V6.03.02b6 on https://github.com/UKTailwind/PicoMite/releases/tag/PicoMite-V6.03.02b6

This version adds a new sound sub-system - perfect for sound effects. Try the attached. Full details in the manual or lookup the BBC manual. Available in all builds.

Both engines feed the same audio output, so the difference is entirely in how the sound is described. PLAY SOUND is a bank of free-running oscillators that your program drives directly. PLAY BBC is a sequencer with a fixed synthesiser behind it, and the firmware does the timing.

PLAY SOUND, the oscillator bank

Pros:

Rich timbres. Sine, square, triangle, sawtooth, periodic and white noise, plus a user waveform of 4096 points via PLAY LOAD SOUND. Sine is the only clean tone in MMBasic, and only this engine has it.
True stereo. Each of the four sounds can go left, right or both, with separate volumes per side, so up to eight oscillators in total.
Continuous pitch. Any frequency from 1 Hz to 20 kHz as a float, so smooth sweeps, detuning and exact tuning are all possible.
Immediate. A new PLAY SOUND replaces a running sound at once. Volume changes are ramped over about a millisecond to hide clicks.
Cons:

No timing, no shape. There are no durations, queues or envelopes. Every note-on, note-off and fade is your program's job with PAUSE, SETTICK or a timer interrupt, so a tune is a lot of BASIC and competes with the game loop.
Costly. Phase accumulators are floats stepped per sample per oscillator. The manual's own figure is about 23% of the CPU with four sounds on both sides, and the RP2040 has no FPU.
Holds the output. Once started, every other PLAY command is blocked until an explicit PLAY STOP.
Aliasing on RP2040. The polyBLEP that cleans square and sawtooth edges is RP2350 only. RP2040 keeps the naive edges because the RAM-resident code would not fit.


PLAY BBC, the sequencer

Pros:

Timing is built in. Durations in twentieths of a second, an 8-note queue per channel, sync groups for chords and a flush bit for effects. A tune is a run of statements and the program carries on.
Envelopes. Sixteen definable envelopes give ADSR volume and a three-section repeating pitch envelope, stepped at 100 Hz. Lasers, sirens, vibrato and explosions are one line each.
Cheap. Integer arithmetic only, band-limited squares on every chip including RP2040. The state is about 470 bytes of heap taken on first use and nothing before that.
Releases the output itself. When all queues drain it stops like PLAY TONE, so a following PLAY WAV needs no PLAY STOP.
Direct ports. BBC Micro sound code runs with only the PLAY BBC prefix added, which is why Elite and Chuckie Egg now sound like the originals.
Cons:

Fixed palette. Three square voices and one noise channel, mono, no sine or user waveforms.
Coarse pitch. Quarter-semitone steps over roughly 122 Hz to 4.8 kHz. Bass below 122 Hz and smooth sub-quarter-tone sweeps are not available.
Coarse time. 50 ms note granularity and 10 ms envelope steps.
Blocking on a full queue. The command waits for a slot, and MMBasic interrupts are deferred while it waits. Tick-driven programs must keep queues short or use flush.
Higher latency. Its swing buffers are larger, so a note starts a little later after the command.

PLAY SOUND PLAY BBC
Voices 4 per side, 8 total 3 tone + 1 noise
Output stereo mono
Waveforms 7 + user table square, LFSR noise
Pitch 1 to 20000 Hz, float 0 to 255, quarter-semitones
Buffer per swing 704 bytes, about 4 ms 2048 bytes, about 11.6 ms
The two cannot run at the same time, so a program picks one. Use PLAY SOUND when the sound itself is the point: sine tones, stereo placement, a sampled waveform, or a frequency you compute. Use PLAY BBC when the sound must run alongside a game loop with no attention from the program, or when porting BBC code.

' Play each of Elite's ten sounds in turn, named, so they can be judged by
' ear.  Standalone: it carries its own copy of the SFX table from
' 45_sound.bas and of the four envelopes from the cassette loader's E%.
'
' Nothing here is approximated.  Each effect is the four bytes the 6502
' source holds it as, handed straight to PLAY BBC SOUND, and the envelopes
' are the loader's own numbers.
'
' Needs firmware 6.03.02b6 or above.  The explosion's noise is pitch 7,
' which is clocked by channel 1 rather than at a fixed rate, and earlier
' firmware has no tuned noise setting to clock it with - it would come out
' as a flat hiss instead of a crash.
'
'   RUN, and press a key between each.  ESC stops.

OPTION EXPLICIT
OPTION DEFAULT NONE

CONST TXN = 10
DIM INTEGER txCh(TXN-1), txAmp(TXN-1), txPit(TXN-1), txDur(TXN-1)
DIM txNm$(TXN-1) LENGTH 44
DIM INTEGER txI

' envelope, T, three pitch steps, three section lengths, ADSR, two levels
PLAY BBC ENVELOPE 1, 1,  0, 111, -8,  4,  1,   8,  8, -2, 0,   -1, 112,  44
PLAY BBC ENVELOPE 2, 1, 14, -18, -1, 44, 32,  50,  6,  1, 0,   -2, 120, 126
PLAY BBC ENVELOPE 3, 1,  1,  -1, -3, 17, 32, 128,  1,  0, 0,   -1,   1,   1
PLAY BBC ENVELOPE 4, 1,  4,  -8, 44,  4,  6,   8, 22,  0, 0, -127, 126,   0

RESTORE dat_tx
FOR txI = 0 TO TXN - 1
 READ txNm$(txI), txCh(txI), txAmp(txI), txPit(txI), txDur(txI)
NEXT txI

CLS
PRINT "Elite's sounds - a key plays the next, ESC stops"
PRINT
FOR txI = 0 TO TXN - 1
 PRINT txI; "  "; txNm$(txI)
 PLAY BBC SOUND txCh(txI), txAmp(txI), txPit(txI), txDur(txI)
 IF TxKey() = 27 THEN PLAY STOP : END
NEXT txI

' The two halves of a kill are fired together by the game, and they belong
' together: the tone on channel 1 sweeps down under envelope 3 and the noise
' is clocked by it.  Heard apart, neither is the sound.
PRINT
PRINT "and the two halves of an explosion together, as the game plays them"
PLAY BBC SOUND txCh(3), txAmp(3), txPit(3), txDur(3)
PLAY BBC SOUND txCh(2), txAmp(2), txPit(2), txDur(2)
IF TxKey() = 27 THEN PLAY STOP : END
PLAY STOP
PRINT "done"
END

FUNCTION TxKey() AS INTEGER
 LOCAL k$ LENGTH 2
 DO
   k$ = INKEY$
 LOOP UNTIL k$ <> ""
 TxKey = ASC(k$)
END FUNCTION

dat_tx:
'      name                              channel  amp  pitch  duration
DATA "our lasers",                            18,    1,     0,  16
DATA "being hit by lasers",                   18,    2,    44,   8
DATA "explosion, the noise half",             16,  -15,     7,  26
DATA "explosion, the tone that sweeps it",    17,    3,   240,  24
DATA "short, high beep",                       3,  -15,   188,   1
DATA "long, low beep",                        19,  -12,    12,   8
DATA "missile away, or our own launch",       16,  -15,     6,  12
DATA "hyperspace drive",                      16,    2,    96,  16
DATA "E.C.M. on, until it is flushed",        19,    4,   194, 255
DATA "E.C.M. off, which is that flush",       19,    0,     0,   0

Edited 2026-09-14 23:13 by matherp
 
terekgabor
Senior Member

Joined: 02/01/2026
Location: Hungary
Posts: 129
Posted: 01:18pm 14 Sep 2026
Copy link to clipboard 
Print this post

Wow!

SOUNDS fantastic! Thanks Peter!

Anyway I have some thousands hours in Elite game, my favourite space sim.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 11882
Posted: 01:42pm 14 Sep 2026
Copy link to clipboard 
Print this post

  Quote  Anyway I have some thousands hours in Elite game, my favourite space sim


Perfect, you can find all the bugs for me    
 
terekgabor
Senior Member

Joined: 02/01/2026
Location: Hungary
Posts: 129
Posted: 01:49pm 14 Sep 2026
Copy link to clipboard 
Print this post

Yeah, there are some bugs in ED, but not so many as in SC(Star Citizen).
ED nowadays is a very playable simulator I think.
Last surface mining update for example is a very good idea was from Frontier Dev.
 
terekgabor
Senior Member

Joined: 02/01/2026
Location: Hungary
Posts: 129
Posted: 04:21pm 14 Sep 2026
Copy link to clipboard 
Print this post

PLAY BBC SOUND is working very good.
It remains me when I was young and we are playing and programming Enterprise 128k computer.
I will test it whole night  
 
homa

Guru

Joined: 05/11/2021
Location: Germany
Posts: 693
Posted: 04:31pm 14 Sep 2026
Copy link to clipboard 
Print this post

> option list
PicoMiteHDMI MMBasic RP2350B Edition V6.03.02b6
OPTION SYSTEM I2C GP20,GP21
OPTION FLASH SIZE 16777216
OPTION COLOURCODE ON
OPTION KEYBOARD GR
OPTION PICO OFF
OPTION RESOLUTION 640x480 @ 315000KHz
OPTION HDMI PINS  1, 3, 5, 7
OPTION SDCARD GP33, GP30, GP31, GP28
OPTION AUDIO I2S GP10,GP22', ON PWM CHANNEL 11
OPTION RTC AUTO ENABLE
OPTION COUNT GP34,GP35,GP36,GP37
OPTION MODBUFF ENABLE  512
OPTION PLATFORM PICO COMPUTER 3
OPTION PSRAM PIN GP47
>

How do I replace?
OPTION KEYBOARD GR, 0, 1, 200, 75

According to the manual:

> OPTION KEYBOARD GR
Total of 6 Mbytes PSRAM available
> OPTION KEYBOARD REPEAT 200, 75
Error : Invalid syntax
> OPTION KEYBOARD REPEAT 200,75
Error : Invalid syntax
> OPTION REPEAT 200,75
Error : Invalid Option
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 11882
Posted: 04:38pm 14 Sep 2026
Copy link to clipboard 
Print this post

Check the manual for a ps2 keyboard

  Quote  OPTION KEYBOARD nn
[,capslock] [,numlock]
[,repeatstart] [,repeatrate]

  Quote  PS2 KEYBOARD VERSIONS ONLY Configure a PS2 keyboard. This
can be used for console input and any characters typed will be available
via any commands that read from the console. ‘nn’ is a two character
code defining the keyboard layout: US for the standard layout used in the
USA, Australia and New Zealand, UK for the United Kingdom, FR for
France, GR for Germany, IT for Italy, ES for Spain, BE for Belgium and
BR for Brazil. The optional parameters ‘capslock’ and ‘numlock’ are
true/false integers that set the initial state of the keyboard (default is 0 and
1). The optional parameters ‘repeatstart’ and ‘repeatrate’ set the time
before a held key first repeats and the rate of subsequent repeats:
‘repeatstart’ is 0 to 3 indicating 250mSec, 500mSec, 750mSec and
1000mSec (default is 1) and ‘repeatrate’ is 0 to 31 indicating 33mSec to
500mSec as per the PS2 keyboard specification (default is 12 or
100mSec). This command must be entered at the command line and will
cause a reboot. The setting can be removed with OPTION KEYBOARD
DISABLE.

Edited 2026-09-15 02:40 by matherp
 
homa

Guru

Joined: 05/11/2021
Location: Germany
Posts: 693
Posted: 05:43pm 14 Sep 2026
Copy link to clipboard 
Print this post

  matherp said  Check the manual for a ps2 keyboard


My mistake – I ended up with the wrong firmware for the PC3
I was actually referring to the USB keyboard.
 
homa

Guru

Joined: 05/11/2021
Location: Germany
Posts: 693
Posted: 08:20pm 14 Sep 2026
Copy link to clipboard 
Print this post

Hi Peter,
With the Wi-Fi firmware and the “TELNET CONSOLE ON” option, is there actually a way to check whether the console is in use via Telnet—in other words, whether an active connection exists?
Matthias
 
homa

Guru

Joined: 05/11/2021
Location: Germany
Posts: 693
Posted: 04:16pm 15 Sep 2026
Copy link to clipboard 
Print this post

Hi Peter,

I'm experimenting with `PLAY BBC SOUND` for background music in a game.

I understand that each BBC sound channel has an 8-entry queue, but I can't find a way to query how many queue entries are currently free.

How do you handle refilling the BBC sound queue in your games without blocking the main game loop?

Do you simply keep track of how many notes have been queued, or is there a mechanism I'm missing to detect when the queue has room for more notes?

Thanks!

Matthias
 
javavi

Guru

Joined: 01/10/2023
Location: Ukraine
Posts: 609
Posted: 05:05pm 15 Sep 2026
Copy link to clipboard 
Print this post

The fantasy retro-computer TIC-80 features a built-in sound effects editor and a tracker music editor.
How to TIC-80 - SFX Editor
How to TIC-80 - Music Editor
I’m not hinting at anything, but perhaps someday the PicoMite will also get a similar set of tools for playing around with sound.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 11882
Posted: 05:59pm 15 Sep 2026
Copy link to clipboard 
Print this post

It can't do everything and these sound like candidates to write in Basic
 
ville56
Guru

Joined: 08/06/2022
Location: Austria
Posts: 612
Posted: 07:15pm 15 Sep 2026
Copy link to clipboard 
Print this post

Peter,

may have found an issue in FRAMEBUFFER MERGE 0,B

running your code from the FUZIX manual on a

PicoMite MMBasic RP2350A V6.03.02b6
OPTION SYSTEM SPI GP2,GP3,GP4
OPTION SYSTEM I2C GP0,GP1
OPTION FLASH SIZE 4194304
OPTION COLOURCODE ON
OPTION HEARTBEAT OFF
OPTION CPUSPEED (KHz) 200000
OPTION DISPLAY 40, 145
OPTION LCDPANEL ILI9488, LANDSCAPE,GP5,GP6,GP7,GP8,INVERT
OPTION TOUCH GP10,GP9
GUI CALIBRATE 0, 3927, 3947, -1282, -792
OPTION GUI CONTROLS 10
OPTION SDCARD GP11
OPTION PLATFORM 480x320-res


 'MODE 2
 FRAMEBUFFER CREATE
 FRAMEBUFFER LAYER
 FRAMEBUFFER WRITE F ' the background, drawn once
 CLS RGB(BLUE)
 BOX 20, 20, 120, 80, 2, RGB(WHITE), RGB(RED)
 'FRAMEBUFFER WRITE N
 DO
   FRAMEBUFFER WRITE L
   CLS 0 ' 0 is the transparent index
   CIRCLE x, 120, 30, 2, 1, RGB(YELLOW), RGB(YELLOW)
   FRAMEBUFFER WRITE N
   FRAMEBUFFER MERGE 0
   x = x + 4
 LOOP WHILE INKEY$ = ""



runs ok, but changed into
FRAMEBUFFER MERGE 0,B

results in:
[13 FRAMEBUFFER MERGE 0,B
Error : CPU2 Stack overflow


which IMHO should run as well.

Gerald
                                                                 
73 de OE1HGA, Gerald
 
terekgabor
Senior Member

Joined: 02/01/2026
Location: Hungary
Posts: 129
Posted: 06:52am 16 Sep 2026
Copy link to clipboard 
Print this post

Hello Peter!

I have a question:
I have a program where there are DATA lines in the main program (together with READ) and also there are DATA lines and READ in a function. Like this:
DIM D$(2) AS STRING LENGTH 2
DATA “ab”, “cd”, “ef”
READ D$()

….

FUNCTION MYFUNC
LOCAL E$(2) AS STRING LENGTH 2
DATA “ab”, “cd”, “ef”
READ E$()



END FUNCTION

This is working fine. But if I put the DATA lines (I tried also together with READ) from main program to a LIBRARY I got “String too long” error referred to the data line in the function.
Is something normal behavior and I am doing something wrong?

Thanks!
G@bor
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 11882
Posted: 09:46am 16 Sep 2026
Copy link to clipboard 
Print this post

framebuffer merge bug is fixed and will be in the next beta. Nobody has obviously tried it before with a screen wider than 320 pixels

As to the DATA issue......

This is really difficult to explain. DATA has no concept of being in a subroutine it is program wide. When you issue a read statement it will read from the next unread data statement wherever it is. So, if there is data in the main program it will read that and if that doesn't fit the variable in the read then BANG! which is what you are seeing.

There is a bug however, To read data from the library currently it has to be found by using RESTORE label before the read. READ will always start looking for data at the top of the main program, it doesn't currently then pass to the library when it exhausts the main program which I think it should. I think this is just a legacy hole from when the library was introduced.
 
terekgabor
Senior Member

Joined: 02/01/2026
Location: Hungary
Posts: 129
Posted: 09:56am 16 Sep 2026
Copy link to clipboard 
Print this post

Thanks Peter!

Now I modified my program, take out data lines from function and make one longer string instead locally.
All the data line in the main program moved to the library.

I will test it afternoon.

G@bor
 
     Page 4 of 6    
Print this page
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2026