★ APPLICATIONS ★ DIVERS ★ BASIC COMMANDS|Popular Computing Weekly) ★ |
RSX Fade Mix (Popular Computing Weekly) | Applications Divers |
The machine code program presented here adds two new RSX commands to Basic and is suitable for use on any of the CPCs. The two new commands allow you to 'fadeout' a screen, or 'mix' one screen into another. Each byte of the 16K screen is randomly replaced with a byte from the stored screen which is to be displayed. The Random Number algorithm used only returns each screen address once in the cycle, so the whole process takes only about two seconds. The result is very effective and can be used in games, video titles, or any other program which needs one screen to be replaced with another. The first new command is |FADEOUT, which resets each byte of the screen to Ink 0, in a random order, giving the effect of the screen fading out. The |FADEOUT command can also be followed by a delay value, for example, |FADEOUT, 100 to slow down the process. If no value is given then zero is assumed. The second new command is |MIXSCN, this takes a screen stored in memory and 'mixes'it onto the display, that is, replacing a byte at a time in a random order, until the full 16K has been replaced. MIXSCN must be followed by the address of the stored screen in memory. As the machine code starts at 40000, the highest position a screen can be loaded into is 23616, so the command here would be |MIXSCN,23616. Once again, the optional delay value can be given, as in |MIXSCN,23616,100. To load a screen into the lower memory. first save it from the normal display with SAVE "SCREEN",B,49152,16384,0, then to load back in use, MEMORY 23615:LOAD "SCREEN1",23616. Of course, all this would be done from within a Basic program. To use the program type in the Basic Loader program, save and run it. The program will report if any errors are found in the data statements. The assembly language listing is included for users with access to assemblers, and to show how the program works. For users with 128K memory, it would obviously be nice to be able to store the screens to be mixed in the second bank of RAM. It would be very easy to convert the program to access the second bank, by adding a few lines before and after Line 670, which is where a byte is loaded from the source screen. The whole listing is fully commented and so should be very easy to follow.
|