Wednesday, 1 April 2020

Retrochallenge 2020/04

Running on ESP32
Hi. This is my entry for Retrochallenge April 2020. It isn't actually Eris itself, as you can see from the pictures, that's actually fairly advanced.

The R/C will be to implement some BASIC games on it, in a "Game a day" format. This is partly to check the BASIC interpreter works. It take pretty much everything I've thrown at it so far, but there's bound to be some small bugs in there. Day 1 is not going to have a game, probably, because the BASIC TILE command (which draws scrolling tilemaps) is the last thing on the TODO list.

So, what is Eris ? Well it was originally going to be called Pluto, but there's a SPARC machine called that, so ... Eris instead. Eris is also the God of Chaos and Discord, so that's ... saying something about the project.

It came out of a dissatisfaction with the Retro Computer projects that are out there. They either tended to be too complex or wildly expensive, or have other faults which appear to be plain idiocy. I also wanted to produce a learning tool - I plan to write some tutorial stuff to go with it.
Running on a PC

So the design is a bit of a compromise. The full description is on the github ; but in outline it's a 16 bit CPU which is 100% orthogonal and RISC like, that runs at about 1 MIPS on the reference (which is the ESP32 design) ; it has a 320x240x8 colour display, 2 square wave tone channels, 1 noise channel, uses appropriate backup storage. It has a 64k x 16 memory space, which is currently 16k ROM and 20k RAM (this is because of SRAM on the ESP32). It runs at present on the ESP32, emulation on PC/Linux and Raspbian. I haven't tried a Pi Zero because I don't have one. It's very easy to port. The ESP32 is built ontop of the fabgl library and the glue logic is straightforward.

It has a Kernel/OS ROM and a structured BASIC. Yes, it does have line numbers but these are used for editing (at the moment), it has named procedures, while loops, locals, parameters and so on. There is an inline assembler which is what's running in both pictures. Editing is like the Commodore machines, you can edit in situ.

To give some idea of speed I ran the old PCW benchmarks on it, and it came out at about 12 to 13 times faster than a C64

It's also cheap. The board you can see at the bottom of the picture is a TTGO VGA32 1.2 board (the 1.1 doesn't have sound but works fine), they're less than £10/$10 each, and apart from a keyboard and cables you don't need anything else. The Raspi Zero version will end up the same sort of cost. It runs fine on an old Raspi, and comfortably on PCs. I'll probably do an emscripten port when I figure it out.

It's not running BASIC in 'C'. The interpreter is actually written in the assembler of the machine, so it's a simple virtual machine. This has the advantage that porting the virtual machine is almost bulletproof - the CPU is so orthogonal it's comical - things you can see on the screen like jmp #loop3 skz r5 and clr r1 are actually syntactic sugar by the assembler - every instruction either has the form <operation> <reg>,<reg>,<short constant> or <operation> <reg>,<constant>. It also means an FPGA version would be fairly easy to do.

The other thing is that I'll probably write some variant of Chuck Moore's Color Forth for it. Which is great, even if he can't spell "colour".

No comments:

Post a comment

Breaking change

We all make mistakes. One early mistake I made was copying (partly) the old thing in Microsoft BASIC where you didn't have to declare ...