RSX - Scroller (Computing With the Amstrad)Applications Divers
★ Ce texte vous est présenté dans sa version originale ★ 
 ★ This text is presented to you in its original version ★ 
 ★ Este texto se presenta en su versión original ★ 
 ★ Dieser Text wird in seiner Originalfassung präsentiert ★ 

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:

  • IX+0 column
  • IX+2 row
  • IX+4 width
  • IX+6 height
  • IX+8 pen
The A register holds the number of parameters on entry - 4 or 5. The first thing the routines do is call SETUP which uses the parameters to find screen addresses and the new background colour. If there are only four parameters the new background colour is set to PEN 0 by default.

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"
20 |MESLFT,@a$,1
30 a$="1234567890"
40 |MESRIT,@a$,25

Program 1

Note how the string is defined immediately before the command and that the string parameter after the RSX command is preceded by a @ to tell the operating system to pass the address of the variable.

Going back to the assembly listing again - Program III - these routines use LFTSCL and RITSCL to scroll the line left or right and the routine FNDSTR finds the address of the string descriptor. The string descriptor consists of three bytes - byte 0 -length of the string, and bytes 1 and 2 - address where the string is stored.

The contents of byte 0 is used to print the correct number of characters in the string and the DE register is used as a pointer to the string so that the characters can be printed by the TXT OUTPUT routine at &BB5A.

Scrolling a message on entails three steps. Firstly print a character at the edge of the screen, then scroll the line by the width of one character and finally find the next character to print and go back to the first step.

This sequence is performed by RITMES and LFTMES in the assembly listing. There is also a pause routine to slow things down a bit.

While the message is scrolling you cannot input a keystroke to perform some new action, but a way around this is to define another string holding the message, take one character from it at a time and put it into a$ so that a$ is only one character long. Now the keyboard can be read after every character is scrolled.

This leads to jerky scrolling because of the delay caused by returning to Basic between characters. It would be better to test for a keypress within the machine code at RITMES or LFTMES.

Now we'll get down to entering the machine code. Type in Program III and run it. When you are sure you have made no errors save the code as:

SAVE "scroller.bin",b,40000,800

To use it in your own programs first set HIMEM to 39999 and load the code at 40000 as it is not relocatable. Then to set up the RSX commands simply CALL 40000 - you can now use the extra commands.

The demonstration program -Program IV - will give you an idea of what these routines can do. After that you're only limited by your own imagination.


★ PUBLISHER: Computing With The Amstrad
★ YEAR: 1987


» RSX-SCROLLER    (Computing  with  the  Amstrad)    ENGLISHDATE: 2020-08-24
DL: 19 fois
NOTE: 40 Cyls

» RSX-SCROLLER    (Computing  with  the  Amstrad)    LISTINGDATE: 2020-05-27
DL: 29 fois
SIZE: 352Ko
NOTE: 3 pages/PDFlib v1.6

» RSX-SCROLLER    (Computing  with  the  Amstrad)    LISTINGDATE: 2020-05-02
DL: 28 fois
TYPE: text


L'alinéa 8 de l'article L122-5 du Code de la propriété intellectuelle explique que « Lorsque l'œuvre a été divulguée, l'auteur ne peut interdire la reproduction d'une œuvre et sa représentation effectuées à des fins de conservation ou destinées à préserver les conditions de sa consultation à des fins de recherche ou détudes privées par des particuliers, dans les locaux de l'établissement et sur des terminaux dédiés par des bibliothèques accessibles au public, par des musées ou par des services d'archives, sous réserve que ceux-ci ne recherchent aucun avantage économique ou commercial ». Pas de problème donc pour nous!

CPCrulez[Content Management System] v8.7-desktop/c
Page créée en 836 millisecondes et consultée 1048 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.