Mottek Archive 2022

At 10:28, Janus became self aware

Janus and CoreForth-0 are now finally able to compile each other - what’s up and what’s down is a bit tricky to name in meta compilation. Janus was so far more strictly speaking a cross compiler, but with the p3216 target, Janus can now generate a binary for the p3216 virtual machine which in turn can be used to compile itself. In theory, that allows the retirement of GForth as the Forth system used to run, provided that the p3216 virtual machine and the Forth binary are available.

The changes needed for Janus were pretty minimal, and the changes to CoreForth were mostly to support whatever Janus uses to produce target images, including file handling and string handling. CoreForth got a bit closer to Forth 2012 with that, but compliance is not a target so far. Rather, one of the goals was to move to the p3216 virtual machine which can be quite easily extended - it doesn’t have an FFI, but the ‘system call’ interface is simple enough to add whatever Rust supports.

2022-12-13 | At 10:28, Janus became self aware

Advent^2 of Code

Advent of Code is a nice way to get yourself to learn new programming languages. The Newton world offers an own unique challenge in the same style, quite a bit more complex though: I’ve been using the implementation of the Newton Docking Protocol as an experimentation playground. It has a number of quite interesting challenges!

Dynamic Data Structures

Data which is sent and received is stored in the Newton Streamed Object Format. The format is pretty straightforward to encode and decode, but one aspect makes it interesting: The objects are represented as a directed graph which can have cycles. This makes memory management of decoded structures a bit more complex.

Asynchronous Code

The Newton Connection Utilities (NCU) which are the traditional way to connect a Newton to a desktop computer allow not only simple tasks such as package installation or data transfer, but allow the user to also interact with the Newton while being connected. That requires handling two tasks at the same time: Dealing with the connection protocol which allows the Newton and the connected computer to initiate messages, and dealing with user interactions.

A fully featured tool to interact with the Newton needs to therefore handle multiple tasks at the same time.

Patterns

The implementation of a communications protocol is usually based on at least two more general software design patters: The protocol stack pattern for the overall structure where different protocol layers are interacting with each other, and the finite state machine pattern which structures the behavior of a single protocol layer.

Ideally, a programming language facilitates defining reusable patterns, and even better, a pattern library exists.

Cross Platform Support

Even though the Newton is an Apple product, it was always supporting Windows alongside MacOS for connectivity, and a connectivity app should likewise support at least macOS and Windows. With macOS support, Unix support is usually not far away either.

Usage and Installation

The Newton was designed as a personal digital assistant. As such, it hides technical complexities and is easy to use. A connectivity application should at least aim to be easy to use, and having a graphical user interface would be a key enabler. Additionally, installation should be as easy as possible across all platforms.

2022-05-01 | Advent^2 of Code

Peer Pressure

Another great WWNC lies behind, and as before, it’s a great motivator to get started again with hacking the Newton. I wanted to pick up where I left off with porting the btstack BlueTooth stack to the Newton. Now that Matthias has merged his changes into the main Einstein branch, I was able to make some good progress to integrate the serial driver which allows to talk to a physical port on the host side.

One of the test cases for serial connectivity is to connect to the Dock application. Unfortunately I was not able to get this to work from MacOS 8 running in BasiliskII (the serial port appears to be busy), but the RDCL came again to the rescue, and I was able to download the Names soup from Einstein via a pty connection.

Working on Einstein has been a lot of fun, and we’ve made good progress adding improvements on the implementation and development process. Another fun blast from the past in this context is that I was able to add a fix for the 2010 problem also to Einstein!

2022-01-13 | Peer Pressure