u/tabemann

▲ 7 r/Forth

USB Mass Storage Device support for zeptoforth

A zeptoforth user has been working on USB Mass Storage Device support for zeptoforth on the RP2040 and RP2350, which I am considering adopting as part of the zeptoforth tree. It currently is in a functional state but is in a separate repository. This will enable accessing block devices in on-board 'blocks' storage, on SD cards, or as a PSRAM RAM disk (on the Pico Plus 2(W)) from the comfort of one's PC.

I would like the USB Mass Storage Device support to be accessible even in builds where there is no USB CDC console, for the reason that I would like the user to be able to access on-board blocks storage or SD cards as a USB Mass Storage Device on the PicoCalc, which by default does not use the USB CDC console.

Yet at the time same, I do not know if anyone is independently using USB whose code may be broken by this who I am not aware of at the present. Consequently, I would like anyone who is independently using USB under zeptoforth to speak up, as this would affect whether I would choose to make separate true-no-USB builds for the RP2040 and RP2350 as opposed to USB-Mass-Storage-Device-but-no-USB-CDC-console builds.

reddit.com
u/tabemann — 5 days ago
▲ 3 r/Forth

A glob tool for zeptoforth

I have created a glob tool for zeptoforth, which enables passing paths matching a pattern with * and ? wildcards relative to the current directory in the current filesystem (or the root directory of the current filesystem, if the pattern begins with /) to a specified xt.

This tool is currently at extra/common/glob.fs in the devel branch, and will be merged into the master branch once I do a bit more testing (e.g. making sure it compiles on the RP2040).

The glob tool can be invoked with fat32-tools::glob ( c-addr u xt -- ) where xt is ( c-addr u -- ).

This tool is an optional loadable extra, but is installed by the versions of the PicoCalc installers in the devel branch except if the platform is set to rp2040 due to lack of flash dictionary space with that platform.

This tool does not match . or .. if a pattern element contains a wildcard, to avoid unintended matches that may give unexpected results.

If a pattern ends with /, the leaves of the match will only be directories. (Note that this / will be included in the paths passed to the xt.) Similarly, if the last element of a pattern contains . and is not . or .. as a whole, the leaves of the match will only be files.

Note that as this tool uses the RAM dictionary of the current task as scratchpad space, xt must not seek to permanently write to the RAM dictionary (aside from setting existing variables, values, buffer:s, etc.); temporarily writing to the RAM dictionary is okay. As a result, this tool cannot be used with included.

There is a limit of 256 bytes for the total path matched by this tool; paths that are longer than this are ignored. (Since directory names are limited to 8 characters and file names are limited to 12 characters, this probably should not be much of a problem in practice.)

An example of this tool in use is, assuming that the current directory contains the subdirectories FOO/, BAR/, and BAZ/, which each contain the files FOO.FS, BAR.FS, BAZ.FS, FOO.TXT, BAR.TXT, and BAZ.TXT:

fat32-tools import  ok
: print ( c-addr u -- ) cr type space ;  ok
s" B*/B??.F*" ' print glob  ok
BAR/BAR.FS 
BAR/BAZ.FS 
BAZ/BAR.FS 
BAZ/BAZ.FS  ok
u/tabemann — 15 days ago
▲ 12 r/Forth

A Lindenmayer system DSL for zeptoforth

Today I created a Lindenmayer system DSL for zeptoforth which drastically simplifies the writing of Lindenmayer systems versus directly using turtle graphics by hand.

The source code to the Lindenmayer system DSL is at https://github.com/tabemann/zeptoforth/blob/master/extra/common/lindenmayer.fs .

Note that this uses turtle graphics with the new turtle::fgetxy and turtle::fsetxy words, which are not in a release yet.

A simple Lindenmayer system can be found at https://github.com/tabemann/zeptoforth/blob/master/test/common/lindenmayer_zerol.fs .

Here is a screenshot of this code:

A simple Lindenmayer system

Here is a source code listing:

\ Copyright (c) 2026 Travis Bemann
\
\ Permission is hereby granted, free of charge, to any person obtaining a copy
\ of this software and associated documentation files (the "Software"), to deal
\ in the Software without restriction, including without limitation the rights
\ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
\ copies of the Software, and to permit persons to whom the Software is
\ furnished to do so, subject to the following conditions:
\
\ The above copyright notice and this permission notice shall be included in
\ all copies or substantial portions of the Software.
\
\ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
\ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
\ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
\ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
\ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
\ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
\ SOFTWARE.

begin-module zerol

lindenmayer import

-90 turn t+
90 turn t-
step F
0,1 16,0 f/ 2 :rcolor-forward-step F
F t+ F t- F t- F F t+ F t+ F t- F
;step

3 0,0 255 255 255 -80,0 -80,0 0 :axiom FFFF F t+ F t+ F t+ F ;axiom

end-module

reddit.com
u/tabemann — 1 month ago
▲ 27 r/Forth

A simple HTTP file server for zeptoforth

On top of my extensible HTTP server for zeptoforth, I have now created a simple HTTP file server for zeptoforth which serves files and directories from FAT32 filesystems, whether from 'blocks' storage, SD cards, or PSRAM RAM disks.

Note that it is read-only, which is important because it has no security (as the HTTP server is strictly HTTP, not HTTPS) beyond limiting access to a given base path on a given filesystem and rejecting HTTP requests crafted to include . or ...

The source code is at https://github.com/tabemann/zeptoforth/blob/master/extra/rp_common/net_tools/http_server_files.fs.

u/tabemann — 2 months ago
▲ 36 r/Forth

An extensible, user-friendly HTTP server for zeptoforth

I implemented an extensible, user-friendly HTTP server for zeptoforth along with a simple demo which shows its features. These are compatible with both zeptoIPv4 and zeptoIPv6 without needing any duplication of code to support both.

One simply registers fixed and prefix URI handlers which access the HTTP request via key and emit, enabling normal Forth console I/O words to be used to serve HTTP requests. Additionally, handlers have access to the URI being served and the HTTP method in question. The HTTP server does the rest. Note that the HTTP server is multithreaded, with each request getting its own task.

The source code for the HTTP server is at https://github.com/tabemann/zeptoforth/blob/master/extra/rp_common/net_tools/http_server.fs.

The source code for the demo is at https://github.com/tabemann/zeptoforth/blob/master/test/rp_common/http_server_demo.fs.

u/tabemann — 2 months ago

Familiarity with some dialectal English forms

I was wondering how much English-speakers, both non-native and native, from outside the Upper Midwest are familiar with a variety of forms which I am used to readily using in everyday English which I have not really seen discussed in discussions of dialectal English.

These are very much part of my home English, and I will use them with people in stores and like, but I avoid them at work, particularly since I work with many non-native English-speakers.

Particularly I am wondering whether I am correct in thinking that these sorts of forms are likely to confuse non-native English-speakers who may be less familiar with dialectal English.

The phonemes I give are cross-dialectal English phonemes, while the phones I give are the specific ones I actually use. Note that some of the phonemes given are counterintuitive because they are required to explain the surface forms seen (e.g. with regard to vowel length) but do not directly map to surface forms in an obvious fashion.

  • /ˈaɪˌoʊntnoʊ/ [ˈaːˌõ̞no̞(ː)] "I don't know"
  • /ˈaɪˌoʊnt/ [ˈaːˌõ̞ʔ(t)], [ˈaːˌõ̞n] "I don't"
  • /ˈwaɪˌoʊnt/ [ˈwaːˌõ̞ʔ(t)], [ˈwaːˌõ̞n] "why don't"
  • /ˈhiːˌʌzənt/ [ˈçiːˌʌːzɘ̃ʔ(t)], [ˈçiːˌʌːzɘ̃n] "he doesn't"
  • /ˈʃiːˌʌzənt/ [ˈʃiːˌʌːzɘ̃ʔ(t)], [ˈʃiːˌʌːzɘ̃n] "she doesn't"
  • /ˈaɪwəz/ [ˈaːɵːs] "I was"
  • /ˈjuːwər/ [ˈjuːʁ̩ˤʷ(ː)] "you were"
  • /ˈhiːwəz/ [ˈçiːɵːs] "he was"
  • /ˈʃiːwəz/ [ˈʃiːɵːs] "she was"
  • /ˈwiːwər/ [ˈwiːʁ̩ˤʷ(ː)] "we were"
  • /ˈðeɪwər/ [ˈte̞ːʁ̩ˤʷ(ː)] "they were"
  • /æt/ [ɛʔ(t)] "that"
  • /jɑː/ [ja(ː)] "yes"
  • /ˈoʊər/ [o̞ːːʁˤ] "over"
  • /ˈaʊtə/ [ˈɑ̆ɔ̯̆ə(ː)], [ɑː] "out of"
  • /ˈɛniː/ [ɜ̃ːj] "any"
  • /ˈmɛniː/ [mɜ̃ːj] "many"
  • /ˈmeɪiː/ [me̞ːj] "maybe"
  • /ˈprɑːliː/ [ˈpʰʁ̥ˤɑːɯ̯i(ː)], [ˈpʰʁ̥ˤɑːj] "probably"
  • /ˈprɑːbm/ [ˈpʰʁ̥ˤɑːmː] "problem"
  • /ˈlɪtərliː/ [ˈʟ̞ɪːʁˤɰi(ː)] "literally"
reddit.com
u/tabemann — 2 months ago
▲ 19 r/Forth

A blocks game for zeptoforth on the PicoCalc

I created a blocks game for zeptoforth on the PicoCalc that will run on both the RP2350 and RP2040. It is sufficiently different from Tetris that there should be no problems with DMCA requests coming from The Tetris Company.

The game mechanics involve randomly falling blocks and a currently selected block, where the user can destroy groups of identically-colored blocks, with bonuses for the number of blocks destroyed at once (as any group of blocks is worth the number of blocks to the power of two), while trying to keep the blocks from reaching the top. To avoid the user just hammering the space bar, destroying blocks is rate-limited. The player loses when the game attempts to add a block to a column which is already full. (The user can also exit early if they get bored.)

The source code is at https://github.com/tabemann/zeptoforth/blob/master/test/rp_common/picocalc_block_game.fs.

u/tabemann — 2 months ago
▲ 16 r/Forth

zeptoforth 1.16.3 is out

You can get this release from https://github.com/tabemann/zeptoforth/releases/tag/v1.16.3.

This release:

  • adds support for 'raw keys' on the PicoCalc as a mechanism for directly exposing key press codes reported by the STM32 microcontroller.
  • adds a 'keymap' mechanism on top of 'raw keys' on the PicoCalc as a means of conveniently querying whether a given key has been pressed or released.
  • adds support for the 6x12 font to the PicoCalc installers.
reddit.com
u/tabemann — 2 months ago
▲ 12 r/Forth

A couple games for zeptoforth on the PicoCalc

A while back I implemented a couple games for zeptoforth on the PicoCalc, specifically Snake and Rocks (a Asteroids clone minus the flying saucers).

Over the weekend I revisited them to add support for a new optional 'keymap' capability built on top of an also-new 'raw' keys mechanism. It is in the master branch of zeptoforth but is not released yet, so if you want to try out these games in their latest forms I would suggest git cloning the latest zeptoforth and rebuilding zeptoforth on your PicoCalc from source (if you have done this before you would know there is an installer script for automating this process). After you do so, load extra/rp_common/picocalc_keys.fs, as this is needed for the games but is not installed by the zeptoforth-for-the-PicoCalc installer (to save space for those misguided enough to use an RP2040 in their PicoCalc).

You can get the latest incarnation of Snake from test/rp_common/picocalc_snake_keys_enhanced.fs and of Rocks from test/rp2350/picocalc_rocks_recoil.fs. Note that the latest version of Rocks introduces recoil, which previous versions lacked.

If you do not wish to reinstall zeptoforth on your PicoCalc you can get older versions of Snake from test/rp_common/picocalc_snake.fs and Rocks from test/rp2350/picocalc_rocks.fs. Note though that these versions have less precise controls, and this version of Rocks also lacks recoil.

And of course, this post would not be complete without screenshots:

Snake in action

Rocks in action

reddit.com
u/tabemann — 3 months ago
▲ 13 r/Forth

You can get this release from https://github.com/tabemann/zeptoforth/releases/tag/v1.16.2 .

This release:

  • fixes a bug in schan::schan-full? that made it incorrectly report a full condition when an schannel contained only one message.
  • adds support for setting bus priorities on the RP2040 and RP2350 with the busctrl module.
  • adds support for obtaining the number of free blocks with block::free-block-count@.
  • adds a 6x12 font.
  • adds support for ST7796S displays, including for PicoCalc emulation.
  • adds support for LCD1602 with PCF8574 interface, as opposed to AiP31068L.
u/tabemann — 4 months ago