Skip to content

Fuzix for the Pico Computer 3 - v0.8

Choose a tag to compare

@UKTailwind UKTailwind released this 06 Aug 08:07
· 0 commits to master since this release

This release gives the machine music, pins, and MMBasic's own text — and fixes a C library constant that was wrong for every program on the card.

Flash the kernel and write the card together. The card's programs are statically linked, so a new kernel with an old card runs the old C library — and this release rebuilt every one of them.

Sound

  • MP3 playback. PLAY MP3 f$ plays a file while your program carries on running. The decoder is a separate process feeding a 1.5-second buffer in the kernel, and the sound hardware empties that buffer by DMA, so playback needs nothing from the program once it has started — MMBasic has to refill its audio from the interpreter's idle loop, and there is no idle loop here to do it in. A translated benchmark measured 89% of its full speed with a track playing, and the decoder runs at about six times real time.
  • PLAY VOLUME n (0–100, logarithmic, remembered between statements) and PLAY STOP. PLAY STOP asks the kernel which process holds the sound output rather than remembering what it started, so it also stops a player left running by a program that was interrupted — which is the case it is most often wanted for.
  • One player at a time, enforced by the kernel. Two decoders writing into the same buffer interleave their samples and it sounds exactly like that. A second PLAY MP3 gives sound output in use; a second playmp3 from the shell names the pid that has it. A player that is killed strands nothing: the kernel hands the sound output back when its owner is gone.
  • playmp3 is an ordinary program too — playmp3 track.mp3 40 & from the shell.
  • The RP2350's FPU is enabled for the decoder. Soft float decodes at 0.59× real time, which stutters; the FPU reaches 6.14×.

BASIC

  • SETPIN and PIN across all 48 GPIOs of the RP2350B, not the 28 an RP2040 has — which is why the PC3's real-time-clock alarm on GP32 was previously out of reach. SETPIN n, DIN|DOUT, PIN(n) = v, and the PIN(n) function. The number is the GPIO number, not MMBasic's connector-pin numbering.
  • TEXT and FONT, with all nine of MMBasic's built-in fonts held in flash for zero RAM.
  • MAP, statement and function, and CLS [colour]. The sixteen colours can be remapped exactly as in MMBasic, and the defaults are now MMBasic's own HDMI values rather than an approximation.
  • PAUSE gives the CPU up instead of spinning, so a waiting program no longer holds the machine. The part it cannot sleep is bounded at 99 ms however long the pause.
  • Programs are much smaller. MMBasic's scratch memory is sized per program rather than fixed: a translated program's static data went from 61,904 bytes to 12,748.

Speed

  • Maths runs on the DCP. SIN, COS, EXP and the rest are shared out of kernel flash and use the RP2350's double-precision co-processor — about 2.7× faster than the soft-float copy that used to be linked into every program, and it costs no program memory. There is no MMU, so a program calls them directly at their flash addresses.

Fixes

  • <limits.h> declared INT_MAX as 32767 on a machine whose int is 32 bits. Any program that compared against it, or sized something with it, was working from a number two thousand times too small — it is what made a valid MP3 file report as invalid. Every binary on the card has been rebuilt.
  • The display no longer flecks under load. A decoder working out of PSRAM saturated the memory controller that the flash the kernel executes from shares; moving its working set into process memory fixed the picture and made it twice as fast at the same time.
  • mmedit was still colouring Play, Pin( and SetPin as keywords the translator does not know.

Documentation

Both manuals are updated: PLAY and SETPIN/PIN sections, the note that the synthesiser and MP3 playback share one piece of hardware, and Appendix C regenerated from the translator's own tables. The C manual gains the PCM streaming interface, SNDIOC_PCMOWNER, the shared maths library, and the floating-point rule — soft float for everything except the audio player, because no FP register state is saved across a context switch.

Assets

  • fuzix.uf2 — the kernel. Hold BOOT, click RESET, release BOOT, and copy it to the drive that appears.
  • pc3-sd-cc.img.gz — the SD card, with the compiler, mmbc, mmedit and the sample programs. Write it to a card of 128 MB or more.
  • FUZIX-PC3-MANUAL.pdf, PC3-C-MANUAL.pdf — the user manual and the C programmer's manual.