Electric Adventures

Bringing you back to the 80's

Electric Adventures

Bringing you back to the 80's

Lets Make a Retro Game: Ep 3: Editor/Assembler

In this episode we are going to cover setting up a free text editor and Z80 assembler with Syntax Highlighting and an execute key that will compile our code and assist in seeing any errors.

I have included templates for Colecovision, original Spectravideo and MSX systems that will give you something to look at, compile and run in the emulator.

The video for this episode is available here.

Next episode we will be taking a closer look at Z80 assembler code, breaking down these templates and covering what they do.

For this episode you will need to download the following items:

ConTEXT Text Editor

http://www.contexteditor.org/

Z80 Syntax Markup file for ConTEXT (WLA-Z80 Assembler)

 http://www.electricadventures.net/Content/LMARG/EP3/WLADXZ80Assembler.zip

TNIAsm (version 0.45)

http://www.tni.nl/products/tniasm.html

MSX , Spectravideo and Colecovision Assembler Templates

- Colecovision

- MSX

- Spectravideo

Step 1 – Setting up the text editor

Download and Install

Download ConTEXT and then install using the default settings.

Setting up Z80 Syntax Highlighting

Next, to make our Z80 assembly code more readable, we need to add a highlighter file that will colour the different parts of our assembly code.  This makes it much easier to read and see what is going on in our code.

Download the “WLA DX Z80 Assembler.chl” file and put it in the following directory:

C:\Program Files (x86)\ConTEXT\Highlighters

This directory will be the following if you have a 32-bit version of Windows:

C:\Program Files\ConTEXT\Highlighters


Step 2 – Setup the Z80 Assembler

Next we need to setup the Z80 Assembler.

Download the freely available version of the Z80 Assembler by TNI and unzip it to the following directory:

C:\tniasm045

Inside the directory you should see the following files:

·         - tniasm.exe

·         - tniasm.txt

It is a great free Z80 assembler with lots of features, there is a 1.0 version that will be released at some stage, so show your interest by sending an email to the current developers.

Step 3 – Add an execute key to ConTEXT for the Assembler

To make things easier while editing and debugging our Z80 code using ConTEXT you can add an ‘Execute Key’ to compile the currently open file using the TNI Assembler, and most importantly showing an errors from the compile, which you can then use to jump to the error line.

Open an assembler source file e.g. Template.asm in either the MSX or Coleco templates.

Go to Options from the top menu and select ‘Environment Options’

Click on the ‘Execute Keys’ tab and you should see the following screen:

Then click on the ‘Add’ button and you should see the following screen:

Enter ‘asm,z80’ (don’t type the quotes) and press [OK]

On the left you should now see:

Click on the function key you want to use e.g. F9 and then on the right fill in the fields as follows:

Field

Value to Enter

Execute

c:\tniasm045\tniasm.exe

Start in

%p

Parameters

%n

Window

Normal

Hint

Compile

Save

Current file before execution

Use short DOS names

Not ticked

Capture console output

Ticked

Compiler output parser rule

*line %l(%n)*

Scroll console to the last line

Ticked

Afterwards your screen should look like the following:

Once you press [OK] you should be able to press the key you selected and the current file will be compiled and the output shown in a window at the bottom of the program.

The Templates

To get things started I have included three templates with this episode, all three achieve the same output, but are for the MSX and Spectravideo computers and the Colecovision console.