Retro Computer Build Part 4 – Initial Firmware

At this stage we have the main control signals of the Micro setup. The address decoder is also setup and I have some thoughts already on changing this. The first ROM is now connected as is the console port via the MAX222.

Now we need some code to load into the ROM to see if the computer is actually running. For this, we are going to use assembly language, which is the closest we can get to the bare metal of the CPU. We could go down to machine code level programming but this project is meant to be fun not torture!

We can see from the above screen shot that Assembly Language is easier to read than Machine Code. Yes, in the early days of computers, programs were developed in machine code, then assembly, then more higher level languages such as C and C++.

Today there are many different high level programming languages for computers, such as Python, Ruby and C# to name just a few. These high level languages are used to make programming easier and quicker for us humans, but the computer still needs machine code to run. So when a programmer is finished writing their program, they will compile the program  to produce code that will eventually run as machine code. This is a simplified version of what happens on your PC or Mac, but the end result is the same.

So we’re going to program in Assembly and for this  we will need a Cross Assembler. A Cross Assembler is a program that operates on one type of computer and produces code that will run on a different type of computer. I’m going to use the ASxxxx Cross Assembler program by Alan R. Baldwin, which can be found in the links below. This tool supports a wide range of CPU including the Z80 and 6502.

Another program that will be needed is a Text Editor. We can’t use programs such as Word, Pages or other modern word processor programs, as these add formatting data to the files that the ASxxxx Cross Assembler does not understand. So the best choice is to use just a plain text edit or a program such as Atom (link provided below).

Atom is a great little text editor as it allows us to edit all the files in the project folder. We can look at the errors produced when compiling our program beside the Assembly code, which makes it much easier to debug. Atom has a great plugin that will highlight the assembly code in different colours, to make it easier to read. So we can quickly identify what are instructions and what is data?

To help make life easier, I have created a batch file called Make.BAT. The purpose of the file is to compile the assembly program and produce an output file than can be programmed into the ROM of the computer.

As you can see this Make file is very simple. In the first line we just call the as6801 assembler program and pass in a few switch parameters (-xlos), as well as the assembly source file name retro.asm.

The second line of the Make file calls the linker program, where we pass in the output of the assembler program to produce the file we can load into our ROM. We also pass in the name of the linker file which contains the commands for the linker program.

The retro.lnk file just contains the switch parameters for the linker, the name of the input file, the name of the output file and then the end command for the linker.

When we run the MAKE.BAT command, we get a file called retro.s19, which contains the code that the programer will use to program the ROM with this software.

There are a few steps in the process as you can see, but having this MAKE.BAT makes its very simple to produce the file that the programmer can use from the assembly source code.

Below you will find ZIP file which contains the first draft version of the source code (untested), if you want to have a look. This code was pulled from projects that I had developed back in the late 80’s and early 90’s for this Micro.

ASxxxx Cross Assembler

Atom Text Editor

Version_0_1

Leave a Reply

Your email address will not be published. Required fields are marked *