★ APPLICATIONS ★ DIVERS ★ SCROLLER ★ |
RSX - Scroller (Computing With the Amstrad) | Applications Divers |
SCROLLER is a collection of 10 machine code routines for CPC Amstrads, two of which scroll a message on to the screen from either left or right while the other eight can be used to scroll off any defined section of the screen horizontally, vertically or diagonally. The screen scrolling routines can be used whenever you wish to remove part or all of the screen in a novel way instead of simply removing it by a CLS command directed to a particular window or the whole screen. The main use will be in games programs to give special effects. The routines scroll vertically one screen row at a time and horizontally in steps of one screen byte - the screen is 80 bytes wide regardless of the current screen mode. This does not give the highest resolution possible, but it is much faster and perfectly adequate. As the bytes are scrolled off, the background colour can be changed to any colour you wish or will be replaced with PEN 0 by default. To make it easy to use, these routines in a Basic program are in the form of RSX commands, so no knowledge of machine code is required. However, for those who would like to understand how they work - and possibly adapt them -there is an assembly listing of the machine code in Program II, produced using Maxam. There-are only four actual directions in which you can scroll the screen memory - up, down, left and right - but by calling, for example, up then right one after the other in a loop the screen memory will appear to scroll diagonally. The assembly listing consists of three main sections. The first sets up and logs on the new RSX commands. In the second there are eight routines which are entered with the IX register pointing to the following parameters:
For the diagonal scrolls the height and width of the defined box are compared and the lower of these two values is used as a loop counter to perform the correct number of scrolls to clear the box. All the RSXs call the required scroll routines repeatedly using the width value for horizontal scrolls and the height value for vertical scrolls. In the third section four scroll routines are set up which are called by the RSXs to do a single scroll in one of the four main directions. The horizontal scroll routines do a one byte scroll left or right and the vertical ones do a one row scroll up or down You can call them as many times as required to clear the defined box. The RSX commands and their associated parameters are: |NORTH, |SOUTH, |EAST, |WEST, |NEAST, |NWEST, |SEAST, |SWEST followed by p, h, w, r, c where: p is the pen colour to replace the old background colour - optional, h is the variable must be set up which contains the message to be scrolled. For simplicity we'll call it a$. This is the first parameter to follow the RSX command. The second parameter required is the row number where you wish the message to be scrolled - from 1 to 25, top to bottom of the screen. Program I shows how to use these two commands. 10 a$="Computing with the Amstrad" |
|
|