social.tchncs.de is one of the many independent Mastodon servers you can use to participate in the fediverse.
A friendly server from Germany – which tends to attract techy people, but welcomes everybody. This is one of the oldest Mastodon instances.

Administered by:

Server stats:

3.9K
active users

#spectrum

7 posts7 participants0 posts today

Oh look, a rainbow! Exploring the Visible Spectrum with Python Part 1
In this article I write Python code to calculate the frequencies, wavelengths, energies and RGB values of light across the visible spectrum. (Next week in Part 2 I plot the data using Matplotlib.)
#python #pythonprogramming #physics #numpy #matplotlib #light #spectrum
codedrome.substack.com/p/visib

CodeDrome · Exploring the Visible Spectrum with Python Part 1By Chris Webb

Oh by the way, all my latest stuff is under the Apache 2.0 licence, which means it is both Free and Open Source Software (according to the most reputable non-beer definitions)

Among them the zxa assembler
github.com/ha1tch/zxa

The incipient ual programming language (very much in construction)
github.com/ha1tch/ual

zxvdu
A software-based display server for the Zx Spectrum
github.com/ha1tch/zxvdu

zxtex
Converts between pngs and bitmap textures for the ZX Spectrum and zxvdu (back and forth)
github.com/ha1tch/zxtex

Among other things...

The exception to the rule is uxngo, an implementation of the uxn virtual machine, which is under the MIT licence, mostly for perfect compatibility and reciprocity with the Hundred Rabbits work.
github.com/ha1tch/unxgo

GitHubGitHub - ha1tch/zxa: A simple Z80 assembler for the ZX Spectrum written in GoA simple Z80 assembler for the ZX Spectrum written in Go - ha1tch/zxa

*** Regarding the consider construct in #ual ***

The semantics of consider really convey a sense of deliberate evaluation. It implies that you're not just executing a branch of code, but you're consciously weighing both outcomes—success and error—in a single, cohesive construct. Instead of passively matching on a value, consider encourages you to actively decide how to handle each scenario. This semantic choice highlights the importance of addressing all possible outcomes explicitly, which can lead to more robust and readable code.

consider communicates both the action (evaluating the result) and the mindset (being thoughtful about handling success versus error) behind this pattern.

Thus, while ual's error handling is Rust-inspired, I believe it also offers something more that's very idiosyncratically ual's own contribution.

Of course, dear Spidey, that with great power comes great responsibility, creating too many stacks can be overkill for some resource-constrained systems. But this is becoming less of a problem with new multi-core MCUs running at hundreds of Mhz, and with several megabytes of RAM.

What #ual says is: if your machine is not very powerful, we may be able to make it less painful to program highly optimised code for it. If your target machine is powerful, we may help to speed up your development cycles, and you may construct more nuanced, sophisticated, and reliable software with less effort.

Continued thread

New #ual programmers can start coding following most ideas they would assume to work using Lua, and progressively adopt the ual-specific stacked mode when it makes sense. For example, in resource-constrained systems where an algorithm using a Forth-like stack can be more efficient for certain tasks.

The > operator indicates a line that operates on the stack system, using a vocabulary for the most part similar to Forth's.

The @stackname > expression allows the programmer to select on which stack the operations are executed. The system comes with a data stack (@dstack) and a return stack (@rstack) built-in, but you can instantiate new ones, since stacks are first class objects in ual.

Take for example this implementation of Dijkstra's shortest path algorithm, uses its own separate stack to perform its computation.
github.com/ha1tch/ual/blob/mai

Hope you like it!

Continued thread

Other ideas in the works:

  • Adding the zxa assembler as one additional backend, to produce Z80 binaries.
    github.com/ha1tch/zxa
    in the future this could allow ual programs to target the ZX Spectrum and the RC2014.

  • Adding a uxntal backend to produce uxn roms.

Introducing the concept of transmutation

  • Write ual, or Z80 assembler, then send uxn or Z80 binaries to an ESP32 system, and have the binaries transmuted into Xtensa or RISC-V binaries as sort of shaders that run in-mcu.
GitHubGitHub - ha1tch/zxa: A simple Z80 assembler for the ZX Spectrum written in GoA simple Z80 assembler for the ZX Spectrum written in Go - ha1tch/zxa