2013-01-26 · in Media Archiving · 1383 words

Acorn Archimedes A310

This is an Acorn Archimedes A310, serial number 27-AKB15-1014889. The A300 series were the first commercially-available machines with an ARM CPU: extremely fast, with 256-colour bitmap graphics, and a decent OS with an excellent GUI. (The file manager I use under X is a clone of the RiscOS one.)

About this machine

Acorn Archimedes A310 inside

This A310 has the standard ARM2 CPU, 1MB RAM and RiscOS 2.00 ROMs, along with various upgrades:

There's lots of software on the hard disk, including various programs I wrote — and because it's an ST-506 disk, I can't connect it to a different machine to image, so I needed to find a way of reading a disk image using the A310 itself. Which sounded like a good excuse to do some ARM programming...

The machine originally belonged to Sevenoaks School's electronics department; I was given it in 1994 when it was replaced with a PC. The Home Accounts data files on the hard disk show that the machine was ordered on 18th January 1989 for £1192.95. Looking at contemporary adverts, that would have just been the stock A310 with an AKF11 colour monitor — Acorn's branded version of the ubiquitous Philips CM8833, like the Commodore 1084S I'm using. (I had the AKF11 too, but used it to complete a Domesday setup a few years ago.) In Amiga terms, that's about the same as an A2000 and 1084S would have cost you at the same time, or three times as much as an A500.

Imaging the hard disk

I only had a few Archimedes floppy disks, mostly from magazines; these were no trouble to read using the Amiga and Disk-Utilities. I got most of the manuals and software boxes with the machine, but nearly no disks — which made imaging the hard disk even more important. I copied as much of my data as I could find to floppy as insurance in case the disk died on me — but I'm glad I didn't have to rely on this, since it turned out there some data I didn't find initially...

The RS423 serial port seemed like the best bet for reading out the data from the hard disk, although I did consider some alternatives: I could have dumped it to PC floppy 720KB at a time (tedious, but it's how I'd read floppy/ROM images from it in the past), or hooked a microcontroller up to the printer port or user port (speed wasn't really that much of a concern given the size of the disk).

The usual strategy for software development on Acorn machines was to write as much as you could using the surprisingly quick BBC BASIC interpreter, and optimise the slow bits using inline ARM assembler — so that's exactly what I did. The aim was to produce an image file containing the disk sectors in ADFS's logical sector order — this being what emulators such as ArcEm expect.

Getting the serial port working was the first step. Some web searching turned up the serial API documentation for RiscOS 2, and Acorn's App Note 234 which describes the Archimedes serial interface's unusual handshaking requirements. I wrote a quick test program to send A repeatedly to the serial port, and tell me whether the buffer was filling up:

   10 SYS"OS_Byte",2,0
   20 SYS"OS_SerialOp",0,6,0
   30 SYS"OS_SerialOp",1,0
   35 r%=7
   40 SYS"OS_SerialOp",5,r%
   50 SYS"OS_SerialOp",6,r%
   60 SYS"OS_Byte",2,2
   80 PRINT "SEND "
   90 SYS"OS_SerialOp",3,65 TO ;F%
  100 IF (F% AND 2) = 0 THEN PRINT "OK"

(As AN234 notes, OS_SerialOp 0 is ignored by the A310, but would be needed on other machines.)

I already had a long serial cable in place connected to my Amiga 1200. To adapt it to the A310's 9-pin RS423 port I built an adapter and dug out a serial breakout box:

25-pin to 9-pin serial adapter Serial breakout box

I didn't need to do any patching in the end, but the lights on the breakout box made it easier to see what was going on! With this hooked up, I could communicate successfully with a terminal program on the PC — like the BBC, the Archimedes can be configured with *FX2,1, *FX 3,1 to provide a shell on its serial port.

The next job was to read the sector data from the disk. adfssector had sample code for reading disc parameters and raw data on RiscOS 3, which I adapted to use RiscOS 2's ADFS_SectorOp based on a note in the c.s.a FAQ. The Toshiba MK134FA hard disk has 733 cylinders and 7 heads; it's formatted for RiscOS with 32 256-byte sectors per track, giving a total of 164192 sectors, and 42033152 bytes of data. Running the serial port at 19200 baud, that should take upwards of six hours to send.

I didn't entirely trust the serial link not to drop or corrupt the odd byte, so the final piece of the jigsaw was J. G. Harston's ARM implementation of the Zip CRC32, to compute a checksum on each block sent.

I made the program talk a simple protocol to a Python script running on my PC — called Psiren, for reasons that'll be obvious to Red Dwarf fans.

Once I'd worked the initial bugs out, it started copying 256-byte sectors correctly but very slowly — 250 B/sec. I made an educated guess that sending the serial data would be the slowest part, and rewrote the send loop in ARM assembler — 1450 B/sec. Batching sectors together so that it checksummed and sent 8 KiB at once brought the speed up to 1650 B/sec, which was reasonably close to the theoretical maximum and meant it'd finish overnight. So I left it running and went to bed...

A310 sending its hard disk

Emulating the A310

To emulate this machine, I used ArcEm. I wasn't sure whether this would work because ArcEm emulates the Acorn hard disk podule while I've got a Computerware one, but they appear to be close enough not to matter — I just had to put the right disk geometry into ~/.arcemrc:

MFM disc
1 733 7 32 256

(ArcEm will also complain if the disk image isn't writable.)

Then with the right ROM image and a bit of CMOS configuration...

*configure MonitorType 0
*configure WimpMode 12
*configure Drive 4
*configure Boot

... *DESKTOP brings up exactly the same environment:

RiscOS 2.0 desktop

Most of the programs on the A310's hard disk run fine in ArcEm. I'd written quite a lot of BBC BASIC code, including various visualisations of the Lorenz attractor:

BBC BASIC Lorenz attractor

Archimedes applications circa 1989 didn't tend to make much use of the GUI. ARC-PCB doesn't use it at all; First Word Plus (which I used for homework for a while when my A1200's power supply blew up) has a strange setup where it uses the normal RiscOS widgets but on a separate screen:

ARC-PCB First Word Plus

Every Arc owner had the !Lander demo, by David Braben of Elite fame, which later got expanded into Zarch/Virus — but I always thought Hamsters (now available for free from Acorn Arcade!) was more fun to play:

!Lander !Hamsters

The fast CPU and 256-colour high-res display made for some nice graphics demos. I found a slideshow demo made by a friend-of-a-friend that I'd written the music for — amazingly, it's still available, as are some of my modules, since Arcade BBS, which we all used back in the early 90s, is now on the Internet...

!2DWaves Slippery

ArcEm's graphics emulation is a bit primitive, so games that try to do non-trivial scrolling (e.g. James Pond) don't work very well.

Even the PC and BBC emulators work:

Acorn PC emulator !65Host BBC emulator

Extracting the data

The ADFS filesystem is surprisingly complex; I couldn't get Linux's adfs filesystem to mount my RiscOS 2 filesystem, and I didn't have a tool to hand that'd extract it. (ADFSlib only works for floppies.)

To extract the files from the hard disk, I booted up ArcEm with a RiscOS 3.1 ROM and ArcEm's hostfs extension. I then just selected all the files, and dragged them to HostFS to copy them back to a directory on the host filesystem:

Copying files using ArcEm

The Acorn PC Emulator's hard disk file is a complete hard disk image, so mtools can read it given the right partition offset:

fdisk -l a310-hd/PC/Drive_C,ffd
mcopy -spm -i a310-hd/PC/Drive_C,ffd@@8704 :: a310-pc-hd

This included some electronics software, and a few of my files:

LINTRACK running in DOSBox MicroForth running in DOSBox