Back to the start... Back to the index

How Arnold met Joyce

Amstrad CPC, PCW and NC emulation uncovered by Simon N Goodwin

There are half a dozen Linux-compatible emulators for Amstrad eight bit computers. This article compares them and explains how to get the best out of them - and in to them.

Amstrad logo

Alan Sugar's Amstrad (Alan Michael Sugar TRADing) company got into the home computer business late - about the time many American manufacturers were trying to find a way out. Nonetheless they did well with all-in-one bundles of keyboard, computer and drives when most home micros required an external TV and cassette deck.

Fruity Frank in lores mode

Playing to his well-deserved barrow-boy image, Sugar called these products 'a mug's eyeful', yet by the standards of the time they were well-designed and programmed, and efficiently manufactured in the Far East to much higher standards than previous Amstrad products - or most Occidental micros, for that matter.

The main eight bit Amstrad computer ranges were the CPC and PCW series. Each went through several re-designs, advancing mainly in storage capacity while retaining the Z80A processor at around 4 MHz - capable of one MIP with luck and a following wind, and a few hundred thousand instructions per second in more typical situations.


Amstrad's original CPC-464

CPC story

The Amstrad CPC range was born in 1983, when Alan Sugar's bargain electronics company woke up to the home computer bonanza. The first machine, code named Arnold, was cobbled together in a few weeks, cased and working, after a fashion, but when Amstrad cast around for software they were told that the hardware was rubbish.

So they kept the original box and switched the CPU from a 6502 to a Z80, revamped the graphics Thus was born the Amstrad CPC, with BASIC from Z80 experts Locomotive Software, Digital Research CP/M 'Control Program for Microcomputers' and new hardware from MEJ Electronics, otherwise known as Mark-Eric Jones. The same hardware and software contractors went on to develop the PCW - Personal Computer Word-processor - range and most of the other Amstrad computers.

Gas Board

By April 1984 the revamped system was available in quantity, with a custom chip finished a couple of months earlier. In the meantime 50 handmade prototypes had gone out to software houses, with a big piggy-back PCB known as the GAS (Gate Array Simulator) board in place of the custom chip, so there were dozens of programs available right from the launch.

4 colour isometric Batman

The CPC had three pixel-mapped screen modes, all 200 pixels high to suit TV displays and bundled cut-down-TV monitors. The highest resolution was 640 pixels wide in mono, for CP/M 80x25 character text, with a typical home-computer medium resolution of 320 pixels per line in four colours, and a chunky but colourful LowRes mode with 160 pixels and 16 colours.

Mixed modes are possible by dividing the screen into up to five slices. Colours were chosen from a palette of 27 hues, mixed from three levels of Red, Green and Blue. CPCs have three channel square-wave sound like Oric, BBC, MSX and later Spectrum systems, but in simple stereo.

Despite the lack of raw power or much in the way of CPU assistance, the simple, familiar environment - with a Z80, plenty of pixels and memory, and optional CP/M - attracted a lot of home programmers sick of flaky first-generation micro hardware. The CPC sold more than two million units in its first five years.

Variations

The Z80 processor can only access 64K of memory at a time, and the 464 combined 64K RAM with 32K ROM by switching 16K sections. Emulators also have to manage this. In practice they may allow for expansion beyond the limits of the original hardware.

Amdrive 3 inch disk system

The 664 replaced the original cassette with a three inch Hitachi floppy drive, with forty single-sided tracks. The disks were 'flippy' - you could use both sides, but had to turn them over manually to access the 180K on the obverse.

Soon came the CPC6128, with twice the RAM, and add-ons allowed further expansion. Linux CPC emulators support RAM and ROM paging, so you can install and use up to seven extra ROM image files, and CPC4X can emulate a system with 576K RAM, though BASIC remains limited to 44K.

Amstrad re-branded the CPC for sale by firms like Schneider in Germany, so the emulators offer choices that mimic manufacturing options. If obscurity is your aim, your soft CPC can also claim to be an Awa, Isp, Orion, Saisho, Solavox or Triumph. Slight ROM changes accomodate national variations such as messages and key placement.

CPC BASIC MODE 1

The range was even cloned by East German firm RFT; their slightly improved model was called the KC Compact. Briefly the pride of the GDR, the fall of the wall soon made that project obsolete.

The success of the Spectrum had prompted Amstrad's move from LowFi into computing. Sugar's son had a Spectrum, not a CPC, so Amstrad jumped at the chance to take over Sinclair's range in 1986. This did not mean the end of the PCW or CPC range, but propelled them slightly up-market as Amstrad exploited the Spectrum's gaming pre-eminence.

In 1989 Amstrad revamped the CPC with better graphics and a cut-down ROM-based cartridge version, the GX4000, but the world was not eager for another Z80 computer, even with sprites and 4096 colours, and the CPC+ did not match the success of the original. But the partnership of Amstrad, Zilog and Locomotive sold and soldiered on, well into the nineties, thanks to the PCW model.

Glass typewriter

The PCW, fondly called the 'glass typewriter' by its trailing-edge adherents, became the mainstay of newsletters and parish magazines. Many are still in use today, because they work well enough to be treated as appliances rather than fashion items. An Amstrad PCW is seldom confused with the later, but it looks and works enough like a 'real computer' to satisfy many people, at least till the advent of the web.

Glass typewriter?

Internally the PCW is extremely simple - little more than the Z80, RAM, and one big custom chip. Eschewing standard interfaces, driving the printer mechanism directly, the original 8256 model doesn't even have a discrete ROM, but bootstraps from less than a page of code masked into an interface chip.

PCWs were bundled with a 100 character, 36 line mono screen and printers ranging from a dotty matrix printer, through a slow and noisy daisywheel, and later an inkjet capable of results belying their source.

Later models had double sided 80 track disks, still in three inch format, and eventually graduated to a standard 3.5" mechanism when PCW demand outlasted the supply of eccentric drives. The PcW10 was the last backward-compatible model. A PcW16, codenamed Anne, brought the brand into the new millennium, but with a new CPU and software which cannot yet be emulated.

The bundled word-processing program was Locoscript, a capable if rather menu-heavy package from Locomotive, who wrote the CPC's BASIC interpreter. Locoscript 1 monopolised the hardware, loading direct from disk and working without any host operating system, but the eight bit standard CP/M+ was also bundled as an alternative environment, along with Digital Research Logo, an educational language implemented on a whim by DR boss Gary Kildall. CP/M gave access to many other programs, mostly elderly business and programming titles, and text games like adventures.

Even desktop publishing was possible, thanks to the bit-mapped screen and substantial memory. The original 8256 model had 256K, later boosted to 512K. Further models improved the printer, software, drives and display, but did not augment RAM or CPU speed.

In fact the Z80 CPU addressing limit made it hard for the software to use more than 64K. The extra space in the 8512 was all devoted to the RAM disk. Arguably the hack of the decade was Flipper, a tiny program that turned one PCW 8512 into two 8256s, so you could context-switch CP/M or alternate Locoscript 1 and CP/M without rebooting. Flipper is a classic example of the fact that the value of a program bears no relation to its size.

Fashion victims

Later Amstrad produced PC-compatible systems - some more compatible than others - but this was nowhere near as easy or profitable as flogging systems to their own specification. Again following Sinclair (and Japan's Epson and Kyocera) they developed Z80-powered notebook computers, the NC100, 150 and 200. These had with small LCD screens, full keyboards and substantial PDA-style software in ROM.

If you bought one of those, piled high in stores like Dixons in the 1990s, you may be glad to hear you can emulate it on Linux - though until the promised Linux PDAs arrive you may have trouble getting it in your briefcase. Genuine NC laptops still surface at small computer fairs and Radio Rallies.

Amstrad is a shadow of its former self, but emulators are thriving - thanks to the efforts of former employee Cliff Lawson, who obtained permission for emulator authors to freely use ROMs developed at Amstrad's expense, including those for the CPC and ZX Spectrum, which Amstrad bought from Sinclair in 1986. Meanwhile Kevin Thacker amassed a vast collection of CPC techno-trivia online. Kevin has not written an emulator for Linux, but his efforts on behalf of other platforms have boosted those that others have written.

text box divider

The emulators

CPC4X

CPC4X is in many ways the nicest Amstrad emulator on Linux. It's easy to get going, even from source, with neat documentation. It has sound and supports all three graphics modes. The GUI windows use TCL/Tk 8.2 if available, or basic shell facilities otherwise. Unlike the Frodo one, the GUI works well and is recommended.

CPC4X BASIC

Special functions use function keys, which did not appear on the original Amstrad keyboard - in other respects the key mapping resembles the original system. F1 yields information, including online help from a 50K HTML file. F3 and F4 allow images - in the common .DSK format - to be inserted into virtual floppy drives A: and B:.

F5 toggles sound, F6 snapshots the screen as an X pixel map, and F7 allows configuration options. You can chose emulation in German or English, the make and model of the emulated CPC, disk image paths and ROM and RAM configuration. These can also be set from the command line when you launch the emulator, or in the file ~/.cpc4xrc.

Printing is directed to a Linux file, with optional filtering of control characters. F9 closes this file and submits it for spooling, as does a form feed character from the CPC. Other buttons let you reset, quit, or call up a machine code monitor in a terminal window.

CPC4X is great for CP/M, BASIC programs and those that do not stretch the CPC hardware, but some demo and game graphics get scrambled as the emulation is at a fairly high level and does not respond well to metal-banging capability - disk drive and graphics quirks are not well emulated.

CPC++

CPC++ is more capable than CPC4X but the download is more limited as it is distributed as a shareware compiled binary for X86 processors only, with 10K of text. I got it to work on Corel Linux (LXF CD7), but Red Hat 6.2 just got stuck, with no display and no message. When it works it can run things that CPC4X cannot, including snapshots and GZIPed CPC files, bug bugs and the lack of an integrated GUI make it frustrating.

CPC+ logo

Pressing function keys with the emulator window selected gives prompts in the original terminal window. It's tiresome to keep having to switch input focus from the emulator to the console and back again, and not to be able to use arrow keys or history in the console.

Function keys permit audio fading and disk and snapshot selection; a program database allows files to be selected, loaded and run with one shorthand command. There's no integrated preference editor, but a key re-reads the preference file ~/.cpcpp (not ~/.cshrc, as the text states!)

There are nasty bugs which might be easy to fix with source, but not on binary-only shareware. Quitting with F10 gives a segment violation message in the launch shell. Sometimes the disk and snapshot file names are rejected, without explanation. Other times CPC++ keeps trying to decompress files that are not compressed, and failing. This stopped me using them at all.

With menus and fixes CPC++ could be a lot more usable on Linux, and would have a better chance of attracting registrations, which cost $25 or 100 French Francs (about a tenner). The registered version skips a ten second start up delay and a 15 minute runtime limit, and allows saving as well as loading of snapshots and disk images.

Author Brice Rive concurred, "I agree with you that the Linux version is pretty poor. It is lagging way behind the main version for MacOS and even then, I did not spend much time on it.

"However, when I released it [two years ago] it was mostly functional on my RedHat system. I don't even have a Linux machine at the moment, so I don't think that I can do much better in the short term. However, I really enjoyed using Linux in the past, so I would like to have a go at releasing a better version of CPC++ for it some day."

CPC Ghosts

Usenet FAQs claim that Wayne Gratton, formerly of Sun UK, has a CPC emulator in the works, but this is not true. We tracked him down and found that he asked a question about CPC emulation some five years ago, and has been listed as an emulator author ever since.

Rainbird's CPC synth

The rumours of an emulator under development at Leeds University are more factual. Local LUG stalwart Mark Conmy has indeed written a CPC emulator, but it has not yet surfaced. XCPC already runs snapshots and disk images, but lacks sound. Work continues, albeit slowly, and he does plan to release something, one day. If you're curious, especially if you'd like to help, contact Mark at mpc@scs.leeds.ac.uk.

If CP/M is your thang, there are a couple of dedicated emulators for the first portable microcomputer operating system. 'yaze' offers precise emulation of CP/M v2.2, and should be portable to any Linux system, though it will need tweaks for changes in more recent ones.

The eponymous 'cpm' is older still and dependent on x86 foibles. It's potentially faster but less portable and less compatible. It supports the full 8080 instruction set used in the CP/M core, but only some of the instructions Zilog added later, used by some Z80-optimised programs.

text box divider

Joyce

Joyce was the development codename for Amstrad's PCW 8256 Word Processor; the CPC was known as Arnold, and the 8512 with extra memory was dubbed 'fat Joyce'. The same name is used for the PCW emulator, which runs on Linux and MSDOS. Unfortunately the file transfer utilities are only supplied as MSDOS binaries.

Joyce emulates a PCW with two drives, either 180K or 720K floppy images or larger emulated hard disks, which require relatively late versions of CP/M or Locoscript. F9 or the othwise useless Windows key calls up a menu for debugging and disk changes. Emulated drives can be write-protected, and printing can be redirected to Linux, although not from the original version of Locoscript.

Joyce Z80 monitor

Software that expect an AMX or Kempston mouse add-on can use the Linux pointer. A disk image contains extensions that run from the CP/M side, for file transfer, synchronisation, and support for 800 by 600 pixel graphics in Logo. There is a prototype colour driver for GSX, the Digital Research graphics system, but this does not work under Linux.

The program is actually quite nicely written. By default it emulates a PCW82048 - a two megabyte Joyce! - and if you can find or buy the late-version system, on 3.5 inch disks, it's pretty well state of the art by PCW standards. Locomotive Software still sell an upgraded Locoscript, on Linux-compatible disks, at £20, so you are unlikely to find 'free' copies on the net.

Joyce uses the same portable Z80 emulation engine as CPC4X. It also relies upon SDL, the Simple Direct Media Layer, to mediate between the emulation and host hardware. Simple this may be from a programmer's perspective, but installing it is hardly trivial on most Linux systems because it has many dependencies.

You need the right version of half a dozen other packages just to get SDL installed, and they're not all standard fare. We've put Joyce source, executables and related files on the LXF CD, but you may need to download others, depending on the size and version of your own distro. The binaries expect SDL 1.1 but the source should work with 1.0 or 1.2.

Joyce key mapping

Joyce may work well on MSDOS and MacOS, but it's not easy to get up and running on Linux, even with the recommended late-version PCW system disks. As author John Elliot puts it, "It is guaranteed to compile on my setup and I make no guarantees about any other. Put it down to my incompetence, if you like." The Unix port needs more work before it can be recommended to the sort of users that the PCW was aimed at.

text box divider

NC100/200

NC100EM emulates the Amstrad NC Notebook Computers - the original NC100 and the follow-up NC200. You need a real one to run the original software - BBC BASIC and typical PDA programs - but you can run a souped-up CP/M, with graphics and sound, written by the author of the emulator without needing any commercial code.

These machines had decent keyboards and short, wide LCD screens, faithfully emulated in Linux with a flyspec font. A PCMCIA card allowed backing storage. It will take you a while to transfer the 256K ROM from an NC100 over the slow serial link, but a small ROM image is enough to get the alternative OS, ZCN, up and running.

ZCN Space Invaders

A single Linux program is used to access files inside a simulated memory card. The program does different things depending on the name by which it is invoked, so you have set up links to this under various names to make it useful. For instance:

ln zcntools zcnls

links up a variant of the 'ls' command which lists files in the default ZCN ROM image. Similar operations mimic rm, df, ren and so on, as shown in the terminal log.

ZCN Space Invaders

The GTK version of NC100EM can be resized, but the generic X version mimics the original LCD dot for dot, as the illustrations show. NC100EM is not limited to text, unless you use the terminal-only version, aimed at ZCN programmers. There's even a VGA-hogging SVGAlib version, as well as plain X and GTK variants.

ZCN graphics demos include versions of Tetris, a tiny Space Invaders, a miniscule paint program, and a clock which is actually quite readable as it devotes most of the emulated screen to half a dozen digits. There's even a miniature mono Mandelbrot fractal generator - which still takes minutes to run, as the emulator is limited to the speed of the original eight bit system.

ZCN and NC100EM are obviously a labour of love. The instructions for the emulator and installation are frugal but you can work them out without much knowledge of Linux or the NC100. Once you get inside the emulator ZCN has plenty of excellent documentation. The main zcn.txt manual runs to almost six thousand interesting lines, and the other documentation amounts to more than twice as much again.

The appeal of this is likely to be confined to NC owners and devotees of CP/M. They may be few in number, but they have a treat in store. The rest of us can only marvel at the dedication of Russell Marks in putting all this together.

text box divider

Connections

The Usenet forum for discussion of Amstrad CPC, PCW and NC systems is 'comp.sys.amstrad.8bit'. It's the best place to ask questions about Z80-powered systems and their emulation, but stay off the subject of PC-compatibles (also made by Amstrad) or you'll get rightly roasted.

If you'd prefer media over modems, Epic have a CD compilation to offer. The cover of CPC Classix promises 'over 1,000 classic Amstrad CPC games, ready to use'. Most of them are uncompressed 190K DSK image files, with a smattering of 64K snapshot images which CPC++ may load but CPC4X cannot handle.

These padded files occupy 330M, peculiarly stored in a directory labelled 'ROMS', even though CPC programs generally shipped on cassette or three inch disks. Organisation is limited to the use of subdirectories for each initial letter of the alphabet. You get the impression that the compiler did not know or care much about the information shovelled onto the CD.

76 real Amstrad ROM images include undocumented hardware toolkits, DOSes and official system ROMs. MSDOS and Amiga emulators are present, but nothing related to Linux or Unix, nor any of the background information about the CPC range which is scattered across the net. CPC Classix is a quick way to obtain many games and some system ROMs, but otherwise not particularly well compiled or presented.

Drive issues

Shifting from an Amstrad to an emulation is a lot easier if you've got a standard 3.5" drive on your old machine. There are utilities for Linux and more for MSDOS to read raw CPC and PCW disk images, but first you need to get them into your machine.

Amstrad used Panasonic or Hitachi three inch drives, literally driven by a rubber band. These are electrically compatible with the SA400 standard that other micros follow, but experiments suggest that Linux PCs do not readily support the drive geometry and timing.

The connector is a 34 way card edge, like a 5.25 inch drive, rather than the modern double row of pins. An old PC floppy cable will permit connection, and drive selection, but after than you need to fiddle with 'setfdprm' and 'floppycontrol' to tune your drive and interface combination. I found it easier to read the sectors on a machine of similar vintage, like a QL, SAM, +3 or Spectrum with an MGT interface.

Net links

Amstrad 8 bit file archive

Cliff Lawson

CPC++ news

CPC4X home

Epic Direct (CPC CD)

Joyce PCW homepage

NCEmu home

NC Users' website

PCW FTP downloads

TCP/IP for Amstrads

ZCN OS for NCs

Amstrad CP/M software



Back to the start... Back to the index