r/Forth

▲ 7 r/Forth

Big Int Math for SIGNED Values?

Okay, so I know about BigIntANSForth.fs, which is indeed very fine.

Alas however, for it handling only unsigned integers, as that rules out doing the Extended Euclidean Algorithm.

Unless, that is, someone knows of an elegant workaround for arbitrary precision signed values?

Actually, I do have a system, but it's VERY inelegant. To such a degree that I might very gladly abandon it, were there something tidier. Also faster, as mine is dead slow.

How inelegant, you ask? Seek out the file math.fs in the directory below...

https://starling.us/forth

reddit.com
▲ 25 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 — 3 days 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 — 3 days ago
▲ 6 r/Forth

is there any forth that could run wasm in JIT mode, and beat wasm micro runtime in speed

is there any forth that could run wasm in JIT mode, and beat wasm micro runtime in speed?

i am using AI for implement a kaios like OS, which also based on the low level interface of android hal, but remove all the java ecosystem, and use wasm instead, so i need a wasm runtime and the hal adapter layer, i had choose wasm micro runtime, which works great, but the performance is not ideal for it do not support JIT on my testing device which is arm32

but my goal is to support such devices like postmarketos does, so i need a better wasm runtime, my ai told me that wasm micro runtime's fastintr mode use the same tech like forth,which remind me to post here for help

reddit.com
u/jyf — 9 days ago
▲ 9 r/Forth

Help on standard words

Hi! I'm new to Forth. (Actually I am revisiting it from yeeeeeears ago.) From other REPL languages I am used to some terse documentation on built-in commands I can call upon:

  • In Bash e.g. help echo
  • In Python e.g. help(dict)

I am using gForth, but couldn't find something like this. see gives the definition, but this might be VM(?) assembler: Try see dup.

Also I would like to read the stack comment of teh word and a short overview description what the word does. E.g. for over (from the simple forth tutorial):

OVER  ( x1 x2 -- x1 x2 x1 ) Copy x1 to top of stack

Is there possibly somewhere a library file I could load in for this?

reddit.com
u/jan_aloleo — 11 days ago
▲ 50 r/Forth

Zeptoforth Rocks!

I accidentally bought a Pico 2 W instead of a Zero, so I tried Zeptoforth and it worked great. I was able to quickly get it running and even displaying on my tiny screen.

u/ripter — 12 days ago
▲ 12 r/Forth

Two Displays! Pico 2 W

I got a second display running! This one gave me a lot of issues. It was a lot harder to setup and get working than the smaller OLED display.

The ST7789V driver has no preset for the non-standard 76×284 resolution, so I had to manually discover the correct axis swap (MADCTL), buffer initialization, and col/row offset math.

u/ripter — 10 days ago