|★ APPLICATIONS ★ UTILITAIRES RSX/LIGNE DE COMMANDE ★ XCOL ★|
|RSX Xcol|Computing With the Amstrad)||Applications Utilitaires Rsx/ligne De Commande|
XCOL is a program that allows you to display more than the legal number of colours on the screen in any mode on the CPC series.
Impossible? Not quite. Perhaps you've seen the mode switching trick used in Sorcery that sets the upper part of the display to Mode 0 and the lower part to Mode 1? Well this program does a similar thing with palette switching so that the values of the inks may be varied on different parts of the screen. It doesn't change mode to do it.
Type in Program I which is the Basic loader for the machine code. Save it before trying to run it because it will erase itself from memory once debugged.
You will now find three extra commands added to Basic - |XCOL, |XDIS and |SETHT,n where n is a parameter. |XCOL enables the new facility, |XDIS disables it and |SETHT allows some control over the position of the switching.
Having typed |XCOL you will find that the normal INK and BORDER commands act in a slightly different way. Normally issuing an instruction such as BORDER 0,1 would set the border flashing between colours 0 and 1 - black and blue.
With XCOL enabled the same command would set the top part of the border to the first colour and the bottom part to the second. INK 1,22,26 will produce a similar result with anything written with PEN 1, and so on.
|SETHT expects one parameter of value 0, 1 or 2 which will vary the level of the split to either 1/3 ,1/2 or 2/3 of the way down the screen.
|XDIS will disable XCOL and restore all inks as they were before XCOL was used. Further use of XCOL will resume use of the ink values employed the last time XCOL was in operation. Therefore if you are writing a program that runs with XCOL disabled for part of the time you will need to define the inks twice - once in the usual fashion and again after |XCOL has been executed.
There are a few points to note before using XCOL in your own programs:
Program II gives the source code. It works using a fast ticker interrupt, which occurs every 1/300 of a second. A frame flyback happens every 1/50 second, so that during one frame cycle there are six fast ticker interrupts.
Fast tickers are synchronised with frame flyback so it is possible to set up an interrupt to change the values of the inks while the cathode ray beam is only part-way down the tube. When the beam reaches the bottom of the screen - at frame flyback - the interrupt routine changes the values back, ready to refresh the top part of the display.
The values of the inks and border are stored in the operating system workspace in the form of two lists known as vectors. Two vectors are required because each ink can be set to two colours when flashing. XCOL takes its ink values from the same two lists but uses the second one for inks to be displayed on the lower part of the screen.
When enabling or disabling XCOL the contents of the vectors are swapped with those in a buffer so that you can work with two different sets of inks depending on whether or not XCOL is being used. The address of the vectors depends on which model of CPC you are using, but the program sorts that out for itself.
The machine operating system has its own arrangements for refreshing the screen display and some of the routines involved compete with XCOL to produce unsightly effects. You can't alter the guilty sections of program because they thumb their noses at you from the safety of ROM.
This mainly causes problems when changing mode, or would do if I hadn't substituted a screen clearing routine that favours XCOL. This is the bit that Maxam - and who knows what else - doesn't get on with, so be careful.
An example of how XCOL could be used would be with a graphic text adventure where the text could be printed in two or three colours in one part of the screen and the picture could employ three different foreground colours in the other part. This would help to avoid the monotony of four colours using Mode 1 as you could effectively display seven colours.
Another possible use would be in a screen or sprite designer where, by using Mode 0, it would be possible to display all 27 colours for comparison when making an initial pallette selection. Program III is an example of displaying all 27 colours at one time. I hope you find this utility as useful as I have.