In this article, I hope to shed some light on what a few people seem to be having problems with…. STOS extensions. Various questions are raised on the subject, what is an extension, what does it do, how do I install it, and how is one written. I shall attempt to answer these questions.
1> WHAT IS AN EXTENSION?
When Francios Lionet developed STOS, he decided that there could always be room for improvement. In other words, fix it so extra commands could be added. So, instead of releasing a new version of STOS with new commands he fixed it so that the new commands could be an added.
When we enter a command into STOS, it is not understood by the ST in its basic form. It first has to be translated into a language which the ST can understand, which is machine code. Suppose we type…..
plot 320,100,1
The assembly routine for this command would look like this.
move.I #1,-(a6)
move.I #100,-(a6)
move.I #320,-(a6)
jsr plot
If we look in the STOS folder, we will see a large selection of files. As STOS loads – each of these files are loaded into memory, each file contains machine code routines for each basic command entered into STOS. For example, if we entered the above ‘plot’ command, STOS would look through the BASIC.BIN file for the machine code routine for it.
STOS was written in assembly language then assembled into machine code, which is a list of binary numbers. So the SPRITE.BIN file contains the binary numbers for the SPRITE commands. So as we can see, STOS is not just one large piece of code, it’s split into different parts. If we remove the FLOAT.BIN file then we wouldn’t be able to use floating point numbers as STOS doesn’t know the machine code routine.
So, a STOS extension is just an extra file containing the command names and machine routines like the .BIN files which is first written in assembly then translated to machine code. STOS loads it into memory and when we enter one of the new commands, STOS looks in the extra file and finds the machine code routine for it, then executes it.
Sounds confusing doesn’t it. Well, to use an extension this information is not really important anyway so panic ye not.
Its likely that you’ve been using an extension without realising it, STOS already has one installed in the later versions. The COMPACT extension which gives us two extra commands PACK and UNPACK. Load STOS and enter the following routine….
10 key off : mode 10 key off : mode 0
20 reserve as screen 5 : reserve as screen 6
30 load”pic.pi1″,5
40 pack 5,6
50 unpack 6
This routine will load a degas picture into bank five and the “pack” command will compress it to a smaller size then put it into bank six. The ‘unpack’ command will expand the compressed picture from this bank and copy it to the background and physic screens. Now, save this routine to disk and exit STOS by typing “system” to go to the desktop.
Insert the STOS disk and open the STOS folder, look through the files for one called COMPACT.EXA. This is the file that holds the new commands names along with the machine code routine for each one. This is the compact extension for STOS, the interpreter version.
If we look at the three letters following the dot, we see it says EXA, this informs STOS that it is extension A. As STOS loads it reserves a slot in memory for this file and names it slot A, so when it comes across a command from this file, it looks in slot A for the command’s information and runs it.
Lets try something: rename EXA to XXX and re-load STOS. Next, load the compress routine we did earlier and list it. It now looks like this…
10 key off : mode 10 key off : mode 0
20 reserve as screen 5 : reserve as screen 6
30 load”pic.pi1″,5
40 extension #A 5,6
50 extension #A 6
Whats happened? Wheres the PACK and UNPACK commands? What’s happened is since we renamed the EXA part of the file STOS hasn’t loaded the file into memory (slot A), the routine has told STOS that the command names and routines are in the COMPACT.EXA file but as it’s not been loaded, slot A is empty. So STOS lists the PACK and UNPACK commands as it has in lines 40 and 50 telling us that extension slot A is empty. We can see this by running the program.
Type ‘run’ and the following will appear……
Extension not present in line 40
40 extension #A 5,6
So in order to get the commands back we need to rename the extension filename back to COMPACT.EXA. Reboot STOS, run the routine again and hey presto, the commands appear back in the listing. This is because the extension details are sat back in slot A waiting to be used.
2> HOW DO WE INSTALL AN EXTENSION?
Before we can use the new commands in an extension we first need to install the extension. This is very simple indeed, all we need to do is put the extension file in the STOS folder on the STOS disk. When STOS loads up, it looks inside the STOS folder and loads each file in it, so inside the STOS folder is the COMPACT.EXA file which STOS will load into memory…(SLOT A), when it comes across it. The extension file that goes in the STOS folder is called the “interpreter” version.
Some extensions, such as “Misty”, have a program supplied to install the extension for us. We just load the program, select the right install option and insert the right disk, other extensions just have the files on disk leaving us to install them ourselves.
Extensions such as “The Missing Link’ are actually cut into two or three different extension files so that means each interpreter file has to be put in the STOS folder in order for us to use all the commands. Let’s look at the COMPACT extension and see what the extension name means..
COMPACT.EXA
E= The file is a STOS extension
X= And it’s the interpreter version
A= It is loaded in slot A
If you were installing the ‘missing link’ extension then you would put these files in the STOS folder……
LINK1.EXQ
LINK2.EXR
LINK3.EXS
As you can see from this last example, each of these extension files has a different SLOT letter…Q, R, S. If you have two extensions installed which have the same SLOT letter then only one will load. STOS loads each letter in alphabetical order, so it will load extension A, ignore the next extension with the same SLOT letter and proceed onto the next extension file it finds. As far as I know, three extensions use SLOT letter S, these are STOS Tracker, Link3, and STOS 3D. We can’t change the SLOT letter as the file will only load into its original SLOT number, but we can stop it from loading by renaming the file extension, IE: the three letter name of one file to XXX.
THE STOS COMPILER
If you have a copy of the compiler then you need to know that before you can compile a routine using new commands then you need to install the compiler extension into the COMPILER folder on the COMPILER disk.
When we compile a program, the compiler looks for each basic command it finds in the routine and converts it to machine code by looking at the files in the COMPILER folder and putting the commands information into the compiled program. So in order for our new commands to be compiled we
need to put the COMPILER version of the extension in the compiler folder. Have a look in this folder and you will see this file.
COMPACT.ECA
This file tells the compiler that…….
E= The file is a STOS extension
C= And it is the COMPILER version
A= It is compiled into SLOT A
Try loading that routine we prepared earlier and compiling it. You’ll see that it works okay, but try changing COMPACT.ECA to COMPACT.XXX and try compiling the routine again. The compiler reports this message…
Extension not found in line 40
Which quite simply means that the compiler can’t compile the extension because it can’t find it on the disk, just rename COMPACT.XXX back to COMPACT.ECA and everything will work fine.
Compiler users will have the compiler’s own extension installed and will see it as COMPILER.EXC and COMPILER.ECC.
3> HOW DO I WRITE AN EXTENSION?
Extensions are written in assembly language. A full tutorial is available from the Game Makers Manual by Stephen Hill which you can Download Here along with other STOS manuals.
4> WHERE CAN I DOWNLOAD EXTENSIONS?
A complete list can be found on Exxo’s STOS Pages. Each extension loads into the slot specified by the extension but none ever use slot B as it has a bug…