Acorn Atom Emulator As it was on 10/5/2003.
I am the proud owner of a working
Acorn Atom, a micro-computer build around a 6502
It is a fairly unknown machine made by the British Acorn company, which
had a very nice dialect of Basic, that was designed rather
orthogonal. I was introduced to it
while I was studying on the University, and used it, for example,
for counting Hamilton paths.
For this purpose I wrote the programs:
(In January 2003, I managed to recover
some more program from two tapes:
tape 1 and
tape 4 side a).
Since I heard about emulators for various other machines like the Acorn
Atom, I have been thinking about writing an emulator, after I discovered
that none was available. I knew that the Acorn Atom was a relatively simple
machine to emulate. It does not have an interrupt based keyboard,
the video is straightforward memory mapped, and there are no
special custom made chips (e.g. no sound chip).
(On Monday, October 17, 1997, I was told by W. Ras, that he
has written an Acorn Atom emulator for MS-DOS. This emulator seems to be much
better than the one described here.)
At first I looked at the Xbeeb BBC Emulator.
I also found a very compact >specification of the 65C02 cpu.
For the software related to the tape interface I looked at
Ian's ZX Spectrum page The Spec-Cave.
Finally, the sources for the Atari 800 emulator by David Firth, proved to
me most use full. I took the sources for this emulator as a starting
point for the Acorn Atom emulator.
The Acorn Atom had a very simple design, which makes emulation simple.
The most complicated part is the CPU emulation, which was already
available. The Acorn Atom only has three memory mapped I/O-ports
for the communication with the hardware.
One of my design philosophies was to make the emulator work with
unmodified ROM images of the original machine.
The Acorn Atom has a simple one-to-one memory mapped video interface
(using the MC6847 video chip),
which means that a fixed part of the memory is displayed on the screen
line by line. There are only a limited number of video modes, one text
mode (with no blinking cursor), and a number of graphical modes. The
basic ROM's provide black and white graphics. An extension ROM allows
graphic modes with two additional colours.
See http://www.byte.com/art/9603/sec5/art4.htm Blast from the Past / 15 years Ago in BYTE for a description of
another home computer using this http://www.byte.com/art/9603/img/0381e2.htm chip.
The graphic mode is selected through one of the I/O-ports. All graphic
modes use the same screen resolution of 256 by 192 pixels. The text-mode
is emulated by putting bit-images of the characters (which are hard
coded in the source) on the screen.
The Acorn Atom scans the keyboard matrix through two of the I/O-ports.
One ports determines the row to be selected, and the other port
tells which keys have been pressed. The shift and control key have
a dedicated line on this port. The `Break' key causes the Acorn Atom
to be reset. This is the only way to reset the CPU. There is no
reset on power-on. All other keys are in the scanning matrix.
As I did not want to change they ROM's, I decided to keep a matrix
of the status of all the keys. The problems is that the key layout of
the Acorn Atom differs from those found on current computers, so
some remapping had to be done. The design choice was to have the correct
mapping if only a single key is pressed, as this is the usual way of
working, but to ignore shift-conflicts if more than one key is
pressed. (A shift-conflict occurs when two keys on a normal
keyboard, are found on shifted and non-shifted positions on the
Acorn Atom keyboard.)
Tape interface design
Two gates on the I/O-ports are connected to the cassette tape interface.
Appearently, the timing needed for the tape interface is based on
counting CPU-cycles. As this would be rather hard to implement, and
the because this interface is rather primitive, I have decided to
extend the monitor with some additional commands that emulate
the load and save operations provided in the Tape-OS.
The ROM's still are the biggest problem. I own an Acorn Atom, so I
do own all the ROM's. But the question is how to read them out. One
possibility is to get them out of the Atom, and read them with some
dedicated hardware. Although, I do not have such hardware, I think
it must be easy to find it here at the university. Another problems
is that the Atom has been modified by the original owner, and that
I am afraid that in my attempt to take out the ROM's might cause
to break the machine.
Another approach could be to save the ROM's to a cassette tape with
the tape interface, and use a special program for reading them
in on a PC, simply by analyzing the recorded signal.
http://home.nvg.org/~rsc/" Robert Schmidt,
maintainer of "The BBC lives!" page, has written such a
program for the Acorn BBC machine, the successor of the Acorn Atom,
which seems to use the same signal, if we compare the specifications.
Luckily, René de Vries provided me with the ROM's on a floppy.
I wrote the initial version of the sources during our
stay in Urumqi, China,
based on some information which I had collected on for hand like the working
of the keyboard and the character representation on the screen.
After coming home,
I spend some time in making the sources compilable.
It then turned out that the X-events generated for key-presses worked
differently then I had expected, and that I needed to reprogram the
keyboard module. The problem is that you do not get correct pairs of
key-pressed and key-released sequences if the shift-key has been pressed
or released in the mean-time. E.g. you can get a 'a'-pressed, (shift)-pressed,
'A'-released, (shift)-released sequence.
September 20, 1996
I tested the character generation in the screen module, and removed some
small bugs in the character encoding.
September 25, 1996
René de Vries brought a unexpected visit to my office, and
handed me a floppy, containing the contents of the three ROM's that I
needed. I tried the ROM's at home, but it did not work. After some
experimentations, I decided to get the Atom out of the box and hook it
to the TV. After some pooking around, I discovered that some parts
of the ROM's in the Atom did not match the ROM images on the floppy.
October 8, 1996
Today, I got the correct ROM images from René de Vries, and tried
them. It ran fine until it started to wait for the 60 Hertz signal
on the high bit of 0xb002, which was not there. This means I have to
find some way for generating a 60 Hertz signal, and make it available.
I also suspected some other bugs.
I read somewhere (on the WWW) that Acorn does not allow you to use
the ROM images for emulators. For this reason, I have been thinking
about decompiling the ROM images and included them as C code in the emulator.
October 11-13, 1996
I decided to produce a 60 Hertz signal, by counting executed instructions.
I did not do check whether this signal is anywhere close to 60 Hertz.
After some debugging, I got the
`ACORN ATOM' message on the screen with
But I needed some more work to get a bit further. Most
of the problems are related to the keyboard interface. I also
decided not to refresh the screen after each update, but to do this
only at regular interval, and only if the screen was updated.
This works nice. I might change it later, because I feel that
direct updating is more realistic.
I can run a small program now. Many keys are not operational yet.
I have sent an announcement to
October 15, 1996
I fixed most of the bugs with the keyboard. All keys seems to work
now, except the Escape-key. The F1-keys takes the function of the
break-key, and the Alt-keys take the function of the repeat-key.
October 16, 1996
The Escape-key is working now.
October 18, 1996
Made the B/W graphic modes working. It looks like the emulator does run
at about the correct speed.
Released version 1.0.
October 19, 1996
Added missing single quote (right quote) to the keyboard emulation.
(Still haven't checked the copy-key.) Added save and load functions
to the monitor program.
October 21, 1996
Released version 0.2.
December 28, 1996
Today, I received an email from Roland Leurs, who told me that he
has been developing a Acorn Atom plug-in card for the PC. He claims
to have it operations for 95%, and that is does support sound and
a cassette interface. I haven't been able to load the games in
my emulator, because they are in a different format.
He also told me that Dick Bronsdijk has written an Acorn Atom emulator
which runs under MS DOS.
January 7, 1997
I received some games and the MS DOS Acorn Atom emulator from Ronald
Leurs. He also send an assembler listing containing the routines for
emulating the MC6847 video chip on PC hardware.
(Around this date:) I also downloaded a 65xx disassembler, and did have a short look at it. I am still thinking
about decompiling the Acorn Roms.
February 9, 1997
I extended the load functionality to deal with two additional file
formats. If you give it a file name with extenstion `.bin',
the file will be read as a binary image starting from the current
basic location. If the file name has extension `.html' it
reads the program from an HTML file, where the code should be
of the following format:
<!--at address -->
February 10, 1997
I made some small changes in the screen handling code. Instead of
putting the whole image on the screen at certain intervals, the
code now updates only the area that has changed. This caused a
significant speed up (on fast machines). It seems you can also
type faster now. Before, each keystroke would cause the whole
screen to be updated when the key was echoed to the screen.
I also fixed a small bug in the keyboard code. The status of the
alt-keys was only seen during keyboard scan.
February 11, 1997
Added support for colour graphics modes. The colour used are
probably incorrect. I am now using black, white, red and green.
I think it is time for a new release. That will be version 0.3.
The current status is:
- Keyboard emulations seems fine for now. Some out-of-sequence key pressings
cause problems, like for example: press-Shift, press-A, release-Shift,
release-A, will not release the A-key. (This seems to be no problem
if your are typing slowly, which is needed anyway.)
- There might be no replacement for the copy-key. (Have to check this.)
- 60 Hertz signal probably not very accurate. (Have to check this.)
- B/W graphic modes implemented.
- Colour graphic modes implemented.
- Monitor functions for saving and loading images to/from files
have been implemented.
Wednesday, February 3, 1999
I received an email from Toby Thain in which he tells that he wrote a working emulator for the BBC Micro
(the succesor of the Acorn Atom), to run on
Macintosh, in 1987. But tragedy struck and he lost the source code,
one of his lasting regrets. He thinks it would have been one of the
first emulators written for Macintosh.
Tuesday, February 1, 2000
Today, I recieved an email from Julian Skidmore, inwhich he informed
me that he is working on an Acorn Atom emulator for the Mac, which
is based on the one described here.
See his mirrored home page
for the details.
The sources are distributed under the GNU
General Public License.
The following source distribution is available as gzipped tar file:
The sources can be compiled with gcc under Linux and SunOS 4.1,
and make use of the elementary X library functions. Below a
description is given of the files in the distribution.
The following files contain slightly adapted versions of the Atari 800
The other sources are:
- main.c contains the main function.
- system.h contains some elementary type definitions.
- cpu.h and cpu.c contains the 6502 emulation
code, the heart of the emulator.
- monitor.h and monitor.c contain the monitor
program, which can be used for debugging and such.
- atom.h and atom.c contain some specific
Acorn Atom functions, which are used in cpu.c.
- keyboard.h and keyboard.c contain the
- screen.h and screen.c contain the
code for the emulation of the video chip.
- file.h and file.c contain the code for
loading and saving files.
- Makefile (which needs to be customized).
Installations and instructions
Modify the Makefile according to local settings. You might have
to set INCLUDE and LDLIBS depending on your installation of the X window
First run make depend, followed by make. The compiler
can still generate a number of warning messages, but should not generate
any error messages.
The executable is placed in the current directory. The directory from
which the emulator is executed, should contain the files akernel.rom,
abasic.rom, and (optional) afloat.rom containing the
images of the ROM's. If the emulator program is executed from an X-terminal
(like xterm) it will create a new window which represents the
screen of the Acorn Atom. The X-terminal window will be used for printing
messages, and giving monitor commands. The monitor is entered when ^C
is pressed in the X-terminal monitor. Typing `help' on the monitor
prompt will display possible commands.
loading and saving
To load a file, the emulator has to be stopped by pressing ^C in the
terminal window. This will bring the monitor prompt up. To load a file
the command load followed by a file name can be used. (For
other monitor commands, type help.) Three kinds of
file formats are supported:
- Binary format. This format compares to the format in which
the BASIC programs are stored in memory. Files with the extention
.bin are regarded to be in this format.
- The HTML format. The program is stored as embedded code in
a HTML file. The code should be enclosed between <PRE>
and </PRE> tags, and information about where the code
starts, and ends are given in comments in the following manner:
<!--at address -->
Each line of the program should have a line number, followed by
the contents. The special charaters `<', `>', and `&'
should be encoded with `<', `>', and `&'.
An examples of this format can be found in
Ha_beest.html. Save as source.
- The text format.
To be explained
My hacker page