At your command
A new command for Locomotive Basic on the CPC 464 with Scroll by S J Woodford
The following machine code routine adds a new command to Locomotive Basic,; SCROLL. It uses the ROM routine Scr SW Roll, which is accessed via the firmware jumpblock, location &BC50. The ROM routine will roll the area of screen as specified by the parameters held in the Z80 registers E,L,D & H. The E register is loaded with the bottom most row of the area to roll, the L register is loaded with the top most row of the area to roll, and the D & H registers are set to contain the right and left most columns of the area.
The area is best thought of as a window. The normal function of the ROM routine would be to roll text within a window during text output to the screen, etc. The screen in any mode is divided into 25 rows (lines of text on screen), numbered 0 to 24, the first column fleft most) in any mode is column 0, but the last column (right most) in Mode 0 is column 19, in Mode one it is column 39, and in Mode two, 79. As a brief example, if you wished to Scroll the top five lines of the screen in Mode one, you would require, top row 0, bottom row 4, left most column 0, right most column 39.
Three other registers are used to contain data to perform the Scroll, these are B, C, and A. B register contains the information to control the direction of the Scroll. If B is zero, then the text within the area will be moved downwards, and if the B register contains a value that is greater than this, then the text will be moved upwards. The Cregister contains the number of Scrolls to perform. One Scroll will move all text and graphics within the area defined up or down one row/line, so 25 Scrolls would roll the whole height of the screen, that is, if E=2A and L=0. That just leaves us with the A register. When a Scroll is actioned, a vacant line is produced, and the bytes of screen memory that go to make up this line are poked with a value that would normally set them to the background colour (Ink 0). If this value is altered then a substitute colour can be displayed, as can a stippled pattern depending on what value is used. The Basic demonstration program (Listing 3) creates an abstract effect using this.
The machine code routine is 107 bytes long and should be loaded into reserved memory at &AB14 and above. It can be relocated, but this is best achieved by entering Listing 1 (Assembly language source listing) into an Assembler and changing Line 280 to any address that is less than Himem - 107. Lines 310-410 use the by now familiar, RSX Log On Routine, &BCD1. Once set up and called, this ROM routine will allow you to enter from Basic the command :SCROLL, followed by any parameters required, which in turn will then call your routine, in this case Scroll at line 430.
The Basic Hex Dump and Loader (Listing 2), when typed in and Run will load the routine into reserved memory at &AB14 and above. A brief check on the accuracy of the data is made and if incorrect, a break in Line 300 will occur.
If correct you will be invited to save the code to tape; if this is not wished then the Basic loader will self-destruct leaving just the machine code in memory.
When a program is Newed all the space once occupied by it is not completely released, so if memory space is an important factor then it will be best to load the code directly from tape into memory with: MEMORY &AB13:Load"",&AB14. Once in memory the first thing to do is to log the command on to Basic with Call &AB14. If the command is not logged on, each time it is encountered in a program or is entered directly from the keyboard, the error message "Unknown Command" will be printed.
Listing 3 is a Basic demonstration program. It starts off by creating abstract colour patterns in modes 0, 1 and 2, followed by a short text demonstration.
Syntax of Commands
Command No One
This will perform a full width, full height scroll 28 times (all text and graphics on screen will be moved up and off screen).
Commnad No Two
This is almost the same as above, but will scroll the whole screen up F number of lines.
Command No Three
When using this command in your programs the letters A-G are to be replaced with the following:
- A = Left most column of area to SCROLL
- B = Right most column of area to SCROLL
- C = Top most row of area
- D = bottom most row of area
- E = Zero to scroll downwards, Non Zero to scroll upwards
- F = Number of SCROLLS to perform
- G = Encoded ink colour to set vacant line to, this is worth experimenting with.
CPCrulez[Content Management System] v8.7-desktop/cache
Page créée en 115 millisecondes et consultée 1253 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.