Atom-in-PC Software

Contents:

The Atom System

Running BBC Basic

The terminal program


This page gives an impression of the software for the Atom-in-PC board. Further details can be found in the Atom-in-PC EPOS/3 User Manual. This manual is written in the Dutch language. If this is a problem for you, please contact me.

The software for the Atom-in-PC board runs on any R6502 compatible processor. Although the R65C02 and R65802 have been tested on this board, the operating system EPOS/3 uses only native R6502 instructions. Other applications may use the additional instructions of the R65C02 and R65802 microprocessors.







The Atom System

The Atom software consists of three parts:

  1. The Machine Operating System

  2. The Atom Basic Interpreter

  3. Expansion Roms

The Machine Operating System ROM is located at #F000 - #FFFF. I have made a lot of modifications in order to make it work with the Atom-in-PC board. The are new operating system vectors for reading your joystick port, reading and sending bytes to the PC and a BBC-like OSBYTE vector has been implemented. I also changed the reset routine and some of the graphical routines. This costs valuable Atom ROM memory so I had to remove most of the Atom Cassette Operating System. You can read all the details in the Dutch manual: chapter 8.

If you like to write your own machine operating system, go ahead! By default, the Atom-in-PC boots from an 16 kB EPROM but it is possible to load your own operating system into shadow RAM at the address space #C000 - #FFFF. One example of another operating system is BBC Basic, which is explaned later.

The Atom Basic Interpreter, still located from #C000 - #CFFF, has been patched on serveral addresses. Most of these patches involve the execution-address in the SAVE"file" statement. The original Atom filepointer is 24 bits; with todays large disks we might run into problems with such a small pointer. So I enlarged the filepointer to 32 bits. This allows the Atom to use files up to 2 GB. I also fixed a small bug which causes the Atom to hang if you type "OLD" and there is no or a malformed Basic program in memory. The Basic Interpreter now searches the TOP of the program. If it cannot find TOP (two bytes: #0D #FF) it displays a "Bad program" message and performs a NEW statement.

The Atom has room for some expansion ROMS. Who doesn't remember socket21 for additional Floating Point support and socket24 for the "Program Powers Toolbox"? Well, the Atom-in-PC supports Floating Point calculations in Basic and up to eight utility roms. Besides that, there is also a Disk Operating System.
The table below gives an overview of expansion ROMS in the Atom-in-PC system:

Memory Map

Expansion ROM

Discription

#E000 - #EFFF

PC-DOS

Disk Operating System

#D000 - #DFFF

Floating Point ROM

Floating Point calculations in Atom Basic

#A000 - #AFFF

Utility ROM

Up to 8 additional Basic extensions

#1000 - #1FFF

Branquar

BBC - alike shadow rom os extension

PC-DOS is the new Disk Operating System for the Atom-in-PC. The most frequently used MS-DOS and Atom-DOS commands are available as *-commands, eg:

*CAT

Displays a catalog of files

*LOAD

Loads a file into Atom memory

*SAVE

Writes a block of memory to (hard)disk

*INFO

Displays file properties

*(UN)LOCK

Disable/enable write access to file

*CD

Change current directory

*MD

Make a new directory

*DELETE

Deletes one or more files

These are only a few commands. Read more about PC-DOS in the manual in chapter 6.

The Atom-in-PC doesn't emulate the Atom disk controller or work with disk images. All files are native MS-DOS files. Only a header of 16 bytes is added to the data. So the first 16 bytes tell the Atom all about the file. I have written a DOS and OS/2 tool to convert files between native MS-DOS file format, Atom-in-PC format and Wouter's Atom Disk Image format. You can find it in the download section.

The original Floating Point ROM works fine in the Atom-in-PC. The standard ROM has been modified by the Dutch Atom User Group in order to implement further expansion of utility ROMS. A few patches have been implemented which make it possible to expand at #1xxx memory block. Read more about it in a second...

Another interesting Floating Point ROM is written by Leendert Bijnagte. This ROM uses the 80387 mathematic coprocessor in your PC to do Atom floating point calculations. Whenever a floating point routine is called, this floating point rom collects all necessary data and passes them to the terminal program. The results are passed on to the calling floating point function. This makes floating point calculations on the Atom very fast. Wouter Ras uses the same ROM in his Atom emulator if you enable 80387 support.

There are plenty of utility ROMS for the Atom. So we invented a ROM switch board. Most designs have room for six 2732 or 2532 EPROMS and two blocks of 4 kB RAM each. These ROMS share the memory address space between #A000 - #AFFF. Some very nice expansion ROMS are:

P-Charme

Adds procedures and functions to Atom Basic.

GAGS

Graphics And Game Support, with software sprites for the Atom.

SALFAA

A symbolic assembler, uses real labels instead of Atom's array elements.

Atomic Windows

Provides a nice graphical user interface, has nothing to do with Microsoft so this is really fast.

At last, an additional block of 4 kB memory is reserved for Switchboard Operating System. Branquar SOS is the most used piece of software for this task. The SOS makes the seperate utility ROMS work together nicely. You can mix statements of all ROMS and it looks and feels like you have one big EPROM. Need another utility: just load it and use it! No reboot required :-)

Branquar SOS has been written by Theo den Exter; some other people added some addition features to it. You might compare this with the shadow ROMS in a BBC micro.

Back to the index


Running BBC Basic

Yes, it is possible to run programs written in BBC Basic but still there are some limitations:

But there is also a positive approach:

The original BBC Basic Interpreter resides in the memory address space #8000 - #BFFF. How unpleasant for an Atom system. That's where video memory, utility ROM and I/O space live. On the BBC Basic Board for the real Atom, Acorn made a nasty thing: they switched the processor address lines A13 and A12. So the memory space #8000 - #BFFF in Atom mode were physically moved to #4000 - #7FFF and visa versa. Acorn added some memory on top of the block zero memory (so we had RAM from #0000 - #07FF) and that's it. Of course, on the BBC Basic Board was an 16 kB EPROM with BASIC and an 4 kB EPROM with a machine operating system.

The most interesting part of this BBC Basic implementation is that Acorn used exactly the same Basic Interpreter as in the BBC Micro and Acorn Electron. I compared every bit of them and they are equal! So, all differences are in the machine operating system ROM. That makes it possible to run BBC Basic on the Atom-in-PC.

As I didn't want to make hardware modifications on the printed circuit board, I had to think about another solution to implement BBC Basic. So I relocated the BBC Basic Interpreter to another address space. Take a look at the following table:

Address space in hex

Atom mode

BBC mode

0000 - 0FFF

Zero page & OS workspace

Zero page & OS workspace

1000 - 1FFF

Branquar SOS

Machine Operating System ROM

2000 - 9FFF

User program & video RAM

User program memory (40 kB!)

B000 - BFFF

I/O space

I/O space

A000 - AFFF

Utility ROMS

Machine Operating Extensions

C000 - FFFF

Machine Operating System & Basic

BBC Basic Interpreter

The relocating of the BBC Basic Interpreter was a hell of a job which costed me a lot of time. But I did it! I found all the addresses in absolute JMP en JSR instructions and worse, all those tables and the most worst: loading registers for indexed addressing like this:

LDA #&B0
STA &70
LDA #&85
STA &71
LDA (&70),Y

In the mean time I needed a good debugger for my Atom-in-PC. There wasn't one available so I had to write that also. But after all, it's working. BBC Basic runs on my Atom-in-PC board. But what's more interesting: I know which addresses have to be changed if I want to use it in another 6502-based processor board. By means of a simple program I can relocate the entire BBC Basic Interpreter within a few minutes to any memoryspace of the 6502 microprocessor.

The only thing which has to written is a good Machine Operating System which followes the rules of the BBC Micro. There is a beta-version available on my download page. This ROM supports the basic I/O functions like keyboard entry, writing a character to the display and even some simple graphics (MOVE, DRAW and a subset of the PLOT statement).

One of the Machine Operating Extensions at &Axxx provide a full featured PC-DFS. It gives access to the MS-DOS file system from BBC Basic. You may compare this PC-DFS to PC-DOS in the Atom-mode. PC-DFS provides file system services to BBC Basic through the Operating System vectors at page &2xx. The main difference with e.g. (A)DFS is the usage of characters like $ and / (in MS-DOS these are represented by \ resp .)

Some of this software is available on the download section, some software not yet. I'm still developing many pieces of software for this project. If you want to use some pieces of software which aren't available yet, please contact me by e-mail.

Back to the index



The Terminal Program
The Atom-in-PC board needs to communicate with the PC. The Atom uses the 6522 system VIA for this purpose. On the PC-side there is a i8255 PPI. Together they build two uni-directional 8-bit datapaths with hardware handshake. Within the Atom the Machine Operating System takes care of communications. On the PC-side runs a program which provides terminal functionallity (and more).

The main terminal program is written in 80x86 assembly as a MS-DOS program. When this program is started it resets the Atom-in-PC board by pulling the R65C02 reset pin to a low voltage level. And make it high again otherwise the Atom goes for a long sleep. After the reset it just waits for bytes....

These bytes may be commands or characters. If the terminal program receives a non-zero byte from the Atom, it assumes that is a character and displays the byte on the monitor. If the received byte is a zero, the terminal programs knows that there is at least one other byte comming over. The second byte is the command number. After that, a whole bunch of bytes is transmitted in both directions, according to the protocol of that particular command. For example:

#41 Write a byte to an opened random access file
Inpunt: handle (1 byte)
data (1 byte)
Return: result (1 byte)
The data will be written to the file with the given file handle. The resultcode is the number
of bytes written to the file. On success, this should be '1'. A '0' value indicates that no
data could be written to the disk => the disk is full.

There are more than 100 commands (and some of them use subcommands) to make the Atom use every piece of hardware and software in your PC. Take a look at this list:

The most recent version of the terminal program is 4.23. A complete discription of all commands is given in the Dutch user manual: chapter 5.

In version 4.25, which is currently under construction, I started to separate the hardware communication routines and the commands at the source code level. I want to use this approach for more flexibility. If these two parts are separated I can use the terminal program for communicating with a real Atom, or a BBC Micro or whatever computer system. The only thing I have to write are the communication routines. This might also be interesting for anyone who wants to develop his or her own microprocessor base circuit. By adding a simple communication device like a RS232 port you can control your board from any PC. This version will be released somewhere in the last quarter of 1999.

Back to the Index



If you think that any of this software may be of good use for your own projects, please contact me if it's not available at the download page. As stated in the preface of this website, all software is restricted to the GNU License Agreement.


Last update: december 12, 1999