Skip to content

Fuzix for the Pico Computer - v0.5

Choose a tag to compare

@UKTailwind UKTailwind released this 02 Aug 18:15

Artefacts: fuzix.uf2 (kernel), pc3-sd-cc.img.gz (SD card),
FUZIX-PC3-MANUAL.pdf. BOTH the kernel and the card are needed.

MMBasic draws
MODE, COLOUR, PIXEL, LINE, CIRCLE and RGB() translate and run on the
HDMI display. MODE 1 is 640x480 mono, MODE 2 is 320x240 in MMBasic's
RGB121 palette, matching the VGA builds and the first two HDMI modes.
A whole shape crosses into the kernel in one call - a 640 point line
is 71us against 433us for the naive version. The primitives are
static functions in mmb_gfx.h and cc discards the ones a program
never calls, so a program that does not draw circles does not carry
the circle code.

SAVE IMAGE, LOAD IMAGE and SYSTEM
SYSTEM runs a program and waits for it, each argument passed
separately so no shell quoting is involved. SAVE IMAGE and LOAD
IMAGE are built on it, so a program that touches no image pays
nothing for them. The decoder is MMBasic's: 1/4/8/16/24/32-bit BMPs,
BI_BITFIELDS, RLE4/RLE8, and dithering only when asked for.

mmedit
MMBasic's full-screen editor, ported. BASIC is now written,
translated, compiled and run without leaving the machine.

TIMER and RND
TIMER is a float off a 64-bit microsecond clock. RND returns 53 bits
from splitmix64 rather than 15 from the C library.

THE FILESYSTEM CORRUPTION IS FIXED
Repeatedly rewriting a large file destroyed the card. f_trunc_blocks
had two tests of opposite sense: it freed a file's double indirect
block, root included, and then left i_addr[19] still pointing at it.
The next write reused a freed block as the double indirect root - by
then reallocated, often as data of the same file - so bmap read
picture data as block pointers. It bit any file over 273 blocks,
which is why it survived upstream on machines with small discs.
Verified with a 640x480 BMP: 1800 blocks, about 1526 double indirect
entries over six level-2 blocks, allocated and truncated ten times,
fsck clean.

Panics now reach the serial port
plt_monitor allowed sleep_ms(1) for an interrupt-driven UART to
drain - about eleven characters at 115200, against panic lines of
well over a hundred. A panic naming the fault was indistinguishable
from a silent hang. It now drains by polling.

The SD root is built from source
It had no build recipe: the Makefile's diskimage rule was empty and
the root was an artefact nobody could reproduce. mksdimage.sh builds
it from the tree at 64000 blocks rather than the 65535 that sits on
blkno_t's ceiling, where the "no such block" sentinel also lives.
Building it exposed two gaps the old artefact had been hiding: no
/usr/bin, so the compiler was installed into the wrong directory by
a cd that failed silently, and no /dev/hdc, so swapon failed and the
8MB of swap was never enabled.

Manual
New chapters on mmedit and on moving files over the serial port with
uue/uud in both directions, with the tools to use on Windows and
Linux and the flow-control trap that catches everyone. Graphics,
SAVE/LOAD IMAGE and the image commands documented; Appendix C
updated.