Mix your modes
Different modes on the 464 with this machine code program by Brian Cadge
Avery powerful feature of the Amstrad computers is their ability to display different parts of the screen in different modes. Anyone who has seen Sorcery will know just what can be achieved using mixed modes. In Sorcery the top half of the screen is in Mode 0. giving 16 colours for the graphics, whilst the bottom of the screen is in Mode 1, for normal column text in four colours. Mixing modes is achieved by changing the hardware registers during an interrupt which occurs every 300th of a second. This method allows the normal screen to be split up into four separate sections, each of which can be displayed in any mode. The Operating System of the CPC handles all the different interrupts, and converts them to their software equivalents of 'Events'. An event caused by the 300th of a second interrupt is called a 'Fast Ticker Event'.
The program presented here adds three new commands to Basic to allow sophisticated mixing of modes on screen. To use the new commands you will need to type in the Basic Loader Program. As usual take care with the Data statements and save a copy before running.
The demonstration program listed is well worth typing in as well, as this will help you to understand the use of the new commands. It simply sets up a screen showing a section in Mode 2, 80 columns, another in Mode 1, 40 columns, and the rest in Mode 0 with some pretty graphics in 16 colours - all on the screen at once!
The three new commands are all RSX commands. These are commands which start with a character, obtained from the keyboard by Shiftj@. The new commands are described below:
|SETMO,section,mode - The iSetmo command is used to set up the various portions of the screen to the different modes. The top quarter of the screen is portion zero, and the bottom quarter is three. The mode number is as normal 0-2.
|Setmo can take any number of portion settings, see Line 60 of the demonstration program. For example, to set the top quarter of the screen to Mode 0, and the next quarter to Mode 2 you would type |Setmo,0,0,1,2.
The |Setmo command displays the mixed modes, but if you try printing to any portion the OS still thinks you are in the original mode. A new command |SMODE,n has been added to tell the OS what mode you want to write in. 'n' being the Mode number 0 to 2. This command does exactly the same as the normal mode command, except that the screen is not cleared. There is no point in using mode when the mixed modes aze being displayed as any new mode set up will be overwritten by the fast ticker event.
Finally, to get back to one mode and disable the fast ticker event, use the |Normal,n command. This sets the whole screen to mode 'n'.It is also useful to use Normal before the |Setmo command as this sets up the mode for any section of the screen not included in the |Setmo list.
The demonstration program should make it pretty clear how to print and produce graphics m the various modes once set up with Setmo. In all cases, after using Setmo to set what mode you want to write in, you should set up a window which covers the section of the screen in this mode; see Line 70 of the demonstration program for example. Using windows is a convenient method of ensuring that you do not spill over into another section of the screen which may be displayed in a different mode. It is also important that you do not cause the screen to scroll as this would wreck the syncronisation between screen Ram and mode switching! As the program uses interrupts for all its timings, and interrupts are turned off during cassette and disc operations, you will not get a satisfactory result if you try to mix modes whilst reading or writing to cassette or disc. All other Basic commands and functions can be used as normal with this program running.
The possibilities for use of this program are almost endless: from games to business programs, using a split screen to display complex pie charts in 16 colours in one section of the screen, whilst another section displays statistics in the 80 column mode.
CPCrulez[Content Management System] v8.7-desktop/cache
Page créée en 091 millisecondes et consultée 1407 fois
L'Amstrad CPC est une machine 8 bits à base d'un Z80 à 4MHz. Le premier de la gamme fut le CPC 464 en 1984, équipé d'un lecteur de cassettes intégré il se plaçait en concurrent du Commodore C64 beaucoup plus compliqué à utiliser et plus cher. Ce fut un réel succès et sorti cette même années le CPC 664 équipé d'un lecteur de disquettes trois pouces intégré. Sa vie fut de courte durée puisqu'en 1985 il fut remplacé par le CPC 6128 qui était plus compact, plus soigné et surtout qui avait 128Ko de RAM au lieu de 64Ko.