July 2010

These days, if an enthusiast builds their own computer, more than likely, they choose a screamingly fast x86 32- or 64-bit mainboard, appropriate memory, drives, etc., put it in a fancy case with perspex sides, coloured lights, install Windows 7, et viola, job done.

Been there – although in the interests of reducing RF noise into an Amateur Radio environment, no way would I ever use a perspex case. Also, no Windows 7, and the clock speeds are decidedly vintage 2004.

This is all quite reasonable. I’ve been building Intel-based computers like this since probably 1992 (didn’t keep that one) or 1996. For the most part, this has been one continual upgrade of one part or another, since 1996. I’m still using the same floppy drive I had back then – everything else has changed. Several times. It’s totally boring. Something essential has been lost over the years. Modern hobbyist computing has become somewhat jaded; innovation stifled under a smothering of bland conformity.

This was most definitely not the case back in the golden days of the microcomputer revolution in the UK.

(By the way, one reason for this post is so I can recollect all the stuff that follows. I’m 41 now, and it’s been hard trying to sequence all of it. If any friends remember any additional things, or can correct me, please let me know!)

Thanks to Jim Walwyn and Pete Wood, maths and computer studies teachers at Sir Thomas Boughey High School, I first used a computer at around age 11, way back in 1981.

This was a teletype connected via acoustic coupler to – I believe – the Manchester Computing Centre. I remember being fascinated by the game of Nim it played (I always lost; these days I understand it’s all about Sprague-Grundy theory….). The school also had an Apple ][, which sparked a life-long appreciation of Apple hardware; at one stage, I was collecting, renovating and selling second-hand Apple ][ and /// hardware – possibly a topic for another blog post; there’s a motherlode in there.

The school soon took charge of several other computers of the day: ZX81s. My neighbour had a ZX80, so I had an idea of what to expect.

It may have been Christmas 1981 or 1982, that I pursuaded my parents that a ZX81 would be the perfect Christmas present. Of course, it would be useful for computer studies and maths at school, so can I have one, please, please please? (And it would also be jolly good for games.) My parents relented, and although expensive, they bought me one.

I learned ZX81 BASIC of course, and quickly went on to Z80 assembler, typing in listings (as hex dumps) from the computer magazines of the day, and writing my own games. I really did use it for educational purposes as well, honestly! I very much doubt I would be doing what I do today if I hadn’t had a home computer – and had one at that time. There was a critical mass of children getting computers and mastering them at that time. It would be very interesting to research the mastery level of children exposed to computers at that age, over the years. My cynical hypothesis is that as the interface to computers has made them less intimidating, and has hidden their programmability, mastery will have decreased. People are tool users these days, not tool makers. Or game players, not game writers, if you will.

Anyway, I digress.

After the ZX81, I upgraded to a Vic 20 (later with 8k ‘STACK’ expansion pack’), then ZX Spectrum, Atari 800XL and 1050 disk drive. I think it was while I was going through my Atari phase that I started work. I later upgraded to an Amiga 500, Amiga 2000. Around this time, I left home, had a brief dalliance with a 386, but it was fairly boring. Upgrade to an Amiga 1200. Around this time I was at university, towards the end of which, I bought my first ‘real’ PC, installed Beta-Tamu Linux, then Yggdrasil Linux on it, and the rest is history…. I’m going to leave the PC trail here, because as I stated above, they’re incredibly boring.

All the above computers came with BASIC available as their main programming language, although I usually preferred their native assembly languages, Z80, 6502, 80×86 and 680×0. If I wasn’t coding in assembler, I’d be writing in FORTH. I started using FORTH on the Spectrum with an implementation called White Lightning by Oasis Software. I never bought a Jupiter ACE. I should have. FORTH is a very simple, yet powerful language. Chuck Moore, its creator, is clearly a genius. There are many good articles on FORTH: Mike Vanier’s post is particularly good. FORTH is having something of a renaissance, or at least, it has inspired new languages like the Factor programming language.

Throughout this time, I was also interested in electronics and amateur radio – I still am, although it’s taken a distinct back seat since university.

So to actually get to the point, although I’ve assembled PCs, I’ve never actually built my own computer; although I’ve used FORTH implementations written by others on all the above computers, I’ve never finished an implemention of it myself (see Psion Forth for the furthest I got, the last time I tried).

For the past 30 years (crikey!) I’ve been a tool user, not a tool maker.

So, to remedy this, and revitalise those parts of my memory where the Z80 opcodes live, I plan to build a small single-board Z80-based microcomputer, and implement FORTH on it. Nothing earth-shattering, just the CPU, ROM, RAM, serial I/O to a terminal (will have to get an RS232-to-USB serial converter for the Mac!), and possibly a CompactFlash disk.

I am fortunate enough to have a box of Z80 and Z80-SIO chips; I have EPROMs, and a programmer (not sure if it still works), but no UV eraser. No RAM yet, but there’s always eBay. No MAX232 line drivers, but RS still sell them.

I have books: Rodnay Zaks’ Programming the Z80, and the masterpiece of FORTH wisdom that is R. G. Loeliger’s Threaded Interpretive Languages (a copy of which was always tempting me, on the bookshelves at Keele University; now I have my own copy).

Don’t need any fancy PCB design, layout, etching kit – it’s possible to build something with just matrix board: take a look at this: Homebrew Z80 Computer. It’s a work of greatness.

I’m doing it in three parts.

First, get a Z80 + hardware simulator running on the Mac, with a simple serial bootloader. I started that part in August 2006, but put it down – for four years.

Second, implement FORTH for it.

Third, build the hardware.

Watch this space…

I’ve been using CryptoPad for many years, on my Handspring Visor. “CryptoPad is a MemoPad replacement that uses the Blowfish encryption algorithm to allow for encryption of arbitrary length data with a password of up to 448 bits.”

Cool, uses Blowfish… by Bruce Schnieier… must be secure.

And it’s Open Source too! This’ll fox those pesky NSA spooks.

At least, this was an assumption – proved wrong when I came to transfer my encrypted data over to the iPod. This is a two stage process:

1. Extract the encrypted data from the synced CryptoPad database, and decrypt it on the PC. (How hard can this be?!!)
2. Import it into some new, as yet undiscovered program on the PC, that syncs with the iPod, allowing me to encrypt it.

The first part is going amazingly well – and has proven that even a good algorithm can be useless (or reduced in security) by an implementation flaw.

The problem is that the password you encrypt your memo with is encrypted with itself, and the ciphertext of this stored in the memo. When attempting to open a memo, you enter a password. The password-stored-as-ciphertext is then decrypted with the entered password, and if this yields the password you entered, then you have the correct password, and the ciphertext of the memo is decrypted with it.

The length of the password is also stored in the memo record. It’s trivial to mount a brute force attack against all possible n-character passwords, especially since you could restrict the keyspace to that allowed by the Grafitti alphabet.

I don’t actually have to do the brute force attack, as I know all the passwords I use, so can get the plaintext of all my memos easily.

But this serves as a warning to check the source code of any crypto system you’re intending to use. Unfortunately, crypto systems are often complex. Sometimes – as in this case – this complexity is deployed with a chink in the armour that can be detected even by those without strong crypto-fu.

The next stage of this project is to find an iPod app that allows import of memo data on the PC. I’m thinking of mSecure, but if there’s no source code, I’m not buying.