Volume 1 · Number 4 · December 1981

Page 11 of 33


by David Elliot

For all you Nascom buffs with Xtal Basic 2.2, here follows a series of articles which show you how to get the best out of this Basic’s ‘expandability’ – it facility for the addition of extra machine code routines. By the time you have added a few custom-built commands, your Microsoft pals will be green with envy. Just to whet your appetite, here are some of the additional commands used with Xtal Basic on my own system, which is a 32K Nascom 1 to which I have added 256 programmable characters (which can be used as high-res graphics):


Many of these commands are designed to work with the programmable graphics board, and make games programming much simpler.

Loader Program

The Xtal Basic handbook explains how to insert the additional command name into the command table, and the vector to the machine code routine into the vector table, but just to make things even easier, here is a machine code loader program which executes from 4E00H.

Xtal Basic is first read in, and then the loader program itself is loaded and executed. It first asks for the name of the command; if no name is entered the loader accepts the following machine code as a subroutine, rather than as an extra command. When a name is entered it is it is automatically added to the end of the command table and the vector is set to beginning of the machine code routine.

When the machine code is being entered the loader automatically prints the address at the beginning of the line and then waits for the code to be typed in. To allow for code relocation, the loader has a command ‘+’, which takes the following 16-bit number and adds the start of the command to it before placing it in memory.

There is limited amount of error-checking to test the numbers entered for the correct number of digits. If an error is detected, the cursor is positioned at the error, which can then be changed, using the Nas-Sys screen editing.

Page 11 of 33