Coming soon: RISCYFORTH


When I was much younger FORTH fascinated me as an alternative interpreted language for the Z80 eight-bit processor machines I was typically using.

Compared to BASIC – the language that the Sinclair ZX80, ZX81 and Spectrum came with – FORTH was reputedly lightening fast and very powerful.

My brother and I even obtained a tape copy of somebody’s FORTH for the ZX80 and we ran it – and it certainly was fast. But it also lacked the simplicity of BASIC and the tape was soon handed back.

But I’m back on the case again, inspired by this (long out of print but widely available on the web) book – Threaded Interpretive Languages – and by the prospect of a single board RISC-V computer – the BeagleV – coming out this year.

Currently I am targeting the PK proxy kernel on the Spike Risc-V emulator for RISCYFORTH but if and when I get a real BeagleV I’ll immediately switch to that (I applied to be an early user but have heard nothing so while the signs are that the project itself is making good progress it looks like I’ll have to wait to get my hands on one.)

I struggled with getting the mechanics of RISCYFORTH right for a long time but in the last week I’ve finally started to make serious progress and it actually does things (only in immediate mode for now). The picture shows my very first success with a multi-token command line from a couple of evenings ago and it’s come on a fair bit since then.

It’s nowhere near a releasable state but it’s rapidly improving.

Why bother? Well I think it’s important that RISC-V succeeds as a disruptor of what is starting to look like an ARM monopoly and so contributing to the ecosystem of the first single board seriously affordable RISC-V device matters. And, of course, because it’s there.

Always yield to the hands-on imperative (from this classic).

Update: My brother actually thinks we borrowed somebody’s Jupiter Ace which was a Z80-based FORTH computer of a very similar size to a ZX81 – and I think he might be right.

What did happen to Comp Shop


Nine years after asking “Whatever happened to Comp Shop?”, I now have the answer.

CompShop advert page 2

For those who don’t know, Comp Shop was the ground-breaking computer shop, first in New Barnet and then later also on Tottenham Court Road, that played a major part in the early days of UK microcomputing through its production and sale of the “UK 101” – which was probably the most popular hobbyist computer in Britain before Sinclair came along with the ZX80 and ZX81.

My brother and I used to spend a lot (too much) after school time in the New Barnet shop where William (Bill) Wood, the ever-present chief engineer was seemingly happy to let us look at – and even use – the Apple IIs, Commodores and other machines that were much more powerful than our own ZX80. (We did occasionally buy stuff too, but very much at the book and cassette end of the market.)

Comp Shop was a retailer run by people who knew about computers – the difference between it and some subsequent retailers is enormous, but it seemed to disappear just as the market was going into overdrive.

William has now been in touch to say that he and Chris Cary – who had founded the business but more recently left the day-to-day running (successfully) in William’s hands (Cary had his fingers in many pies and as ‘Spangles Muldoon’ remains a legendary figure in radio) – had a catastrophic falling out (repaired in later years) that saw the business closed more or less immediately.

(Advert taken from here)

BINSIC – Sinclair BASIC emulator – is back


BINSIC was my 2012 project to emulate Sinclair ZX80/81 BASIC on a modern computer.

It is a series of Groovy classes that provide a mixture of interpretation and ‘domain specific language’ (i.e. executing BASIC as native Groovy).

Over the years bitrot seems to have set in and the code in the GitHub repo wouldn’t work and the BINSIC jar that would allow Java users to execute some BASIC without a Groovy install disappeared.

I have fixed all that now. You can see the Groovy at the GitHub BINSIC repo – and use that to explore or edit the code.

If you just want to cut to the chase then have a look here: http://n4decameron.org.uk/~adrian/

There you’ll find a jar and test.bas – an implementation of Conway’s Game of Life.

To run the code download both and execute:

java -jar binsic.jar test.bas

When the code starts specify filled cells with a character like ‘*’ and empty cells with a space. (You don’t have to fill in a whole line, but a blank line needs at least a single space.

When you have filled in the initial grid type ‘DONE’ and hit enter and the code should start – to advance through the generations hit enter.

Feel free to experiment with your own BASIC programs – I have copied a few from the classic BASIC Computer Games and they generally work – but I’ve not tried anything very long. All contributed programs would be gratefully accepted – happy to consider pull requests at the repo.

BASIC is out of fashion these days – but you can read about the motivation behind the project here.

What computer output is supposed to look like


Image of conv net learning to classify images of chess pieces
Conv net attempting to classify chess pieces

This month is the 41st anniversary of me coming face-to-face with a “micro-computer” for the first time – in WH Smith’s in Brent Cross. I am not truly sure how I knew what I was looking at (beyond I suppose the shop’s own signage) – because at that time not even “The Mighty Micro” – ITV’s groundbreaking (and exceptionally far-sighted) TV series had yet been broadcast, but I was instantly smitten.

If you remember the time, then you’ll recall computers were very basic and only ran BASIC (but you could still do a lot with that). Black and white (or green and white) graphics were the standard (unless you were a rich kid and owned an Apple II).

But that didn’t stop us – my brother and I got a Sinclair ZX80 in 1980 (even if you ordered early the wait was long) and started writing code straight away (there wasn’t much choice if you wanted to get some use from the device).

The best code was mathematical and computationally intensive (as far as 1KB of RAM on a board with an 8 bit 3.25MHz CPU would allow that is) yet managed to combine that with rapid screen updates – something that was difficult on a ZX80 because computation blanked the screen (a ROM update and an interrupt driver – we copied the machine code bytes into every program – later fixed that.)

So 41 years later the code I am now running – shown above – perfectly fits the bill for “proper computing”. It is a computationally intensive – essentially multiple matrix multiplications – convolutional neural network that is attempting to classify images of chess pieces of the sort commonly seen with published chess puzzles. But what I love most of all is the fast flickering digits (the nine classes) and small images (the output of the first two layers of the 50 filters that are at the heart of the network).

This is the second time I’ve had a go at this personal project and I’ve made some progress – but it’s been hard going. Most conv net users seem to have long moved on from C++ (which I am using) to Python libraries like Tensor Flow – so it’s not even that I feel I am part of a strong community here.

Lots of subtle (that’s my story and I’m sticking to it) programming traps – like the fact that the STL Maps class reorders the objects added to reflect the order of the key (sounds obvious when you say it like that – why would it not have such a lexical order?) – I had simply assuming that the entries kept the order they were added in. (This was today’s discovery).

But if it was easy to write these things then it would be no fun.

A little plug for BINSIC


Thirty-three years ago my brother and I got a new cassette player for Christmas.

That allowed us to write and save games for our ZX80 computer (like many ZX80 owners we found that an older cassette player just didn’t work) and in 1981 I wrote a Z80 machine code version of Conway’s Game of Life – still my proudest programming achievement.

Last year I sought to complete the circle by writing an interpreter/DSL that mimiced ZX80 BASIC and called it BINSIC as “BINSIC Is Not Sinclair Instruction Code” and then wrote a BASIC version of the Game of Life (see the screenshot below).

Game of Life in BINSICSo, if you are from that generation computer users, or even if you are not, why not give it a try – more details here: BINSIC