Ansi-terminal for Amstrad CPC

The very first "real" program that I wrote (started in 1989, and last updated in 1991: see history.txt for details) was a terminal emulator program for an Amstrad CPC (an 8-bit computer built in 1985) with a serial port (the serial port was an optional add on unit). At the time that I wrote it there were no terminal emulator programs that emulated an ANSI or VT100 terminal, and I wanted to access a public unix system which required such emulation as well as several BBSes that benefited from it.

In addition all of the existing terminal emulation programs available were too slow to keep up with a 2400bps modem streaming display information to the screen, for one reason or another; and I had recently bought a 2400bps modem.

So I wrote my own terminal emulator, in z80 assembly language, taking advantage of all the optimisations that I could find, as well as using things like page-aligned ring buffers for input and output (using a timer driven interrupt routine to do all the input and output.

In April 1991 I released a copy of the program, including the source code as what would now be called an open source program - copyright but with the source available - sent to another Amstrad user in the UK, and also given to a fellow Amstrad user in New Zealand (who used parts of it as the basis for a fancier communication program including dialing directory, file transfer and so on).

In September 2000 I rediscovered the program on the Internet, in a collection of Amstrad CPC "public domain" software, in the form of a disk image for an Amstrad CPC emulator (most emulators don't include serial support, but they do allow reading the disk image). (In theory I still have the disks with the software on, in practice it is dubious whether those disks are still readable.)

So without further comment, here is the oldest "real" program that I wrote, complete with all its embarassing quirks and documentation, and a licence before I discovered the GPL, BSD licence and friends -- rediscovered after nearly a decade. Sometimes releasing the source code really does pay off.


readme (1232 bytes)
Program description and file manifest.
manual.txt (12031 bytes)
Documentation for terminal program.
history.txt (5175 bytes)
Revision history of the program, from the beginning to the end.

Source Code

ansiterm.22b (19520 bytes)
Z80 assembler source to ANSI/VT100 interpretation code, including code to manipulate screen view.
charset.asm (9210 bytes)
Source for the character sets, in the form of ASM byte definition statements.
data.22b (13610 bytes)
Z80 assembler source for various helper routines, as well as the static string definitions.
mainline.22b (12688 bytes)
Z80 assembler source for the main terminal program.
screen.22b (15522 bytes)
Z80 assembler source for screen manipulation routines.
setp.22b (9112 bytes)
Z80 assembler source for setup routines, and ring buffer management routines.
term22b (2706 bytes)
Top level Z80 assembler source with call routine definitions.

Object Code

disc.bas (1152 bytes)
Bootstrap for program (Amstrad CPC tokenised Basic). The plain text retyped version is probably easier to read, but may be less accurate. (It was retyped in by reading the source in a CPC emulator on one screen, and typing it again on another screen.)
chars.bin (2176 bytes)
Binary image of plain and bold character sets, laid out for ease of transfer to the Amstrad CPC screen (page aligned).
term22b.bin (4864 bytes)
Z80 binary code image of terminal emulator.

Disk Image

termema.dsk (194816 bytes)
Extended Amstrad CPC disk image containing the software. The disk image is in CPC data format, with a sector skew of 2
termemb.dsk (194816 bytes)
Extended Amstrad CPC disk image containing some other Amstrad CPC communication programs including one based on the ansiterm software here.

Ewen McNeill -- October 2000.