Spirals & horizontal sweep effects
by Fred Pinho
Get ready to rival George Lucas or at least your local TV station with these fancy video effects. Dandy Dissolver is a BASIC program for 8-bit Atari computers with 48K memory and a disk drive.
The Atari is well known for its graphics capabilities. One commonly used feature is page flipping, the ability to rapidly switch from one pre-drawn screen to another simply by altering several bytes in the display list.
While impressive, the technique lacks elegance. Moviemakers often use "dissolves" and "fades" to change from one scene to the next. With its close control of the video screen, your Atari can create a variety of screen dissolves. This articles describes two a spiral dissolve and a horizontal sweep dissolve.
The routines are written in machine language and can be customized to run at any speed in any graphics mode (0-15). You can control and use these routines from your BASIC program with the USR function. Listing 1 demonstrates these dissolves in Graphics 1, a mode frequently used for game screens. Use Listing 2 to create these BASIC subrouties for use in your programs.
Type in Listing 1, DISOLV1.BAS, checking it with TYPO II and SAVE a copy before you RUN it.
Listing 1 draws two hidden Graphics 1 screens and a title screen. Next, the program demonstrates two examples of spiral and sweep dissolves. Press the [OPTION] key to step from one dissolve pattern to the next. Finally, the program demonstrates both dissolve routines at various delay rates.
Listing 2 creates the dissolve routines which you can later include in your own BASIC programs. The dissolve routines are LISTed to a disk file which can later be ENTERed into your BASIC program. These dissolve routines use a delay subroutine which is stored in the lower half of the cassette buffer (locations 1021-1064, $03FD-$0428). This means your program cannot access the cassette.
Type in Listing 2, DISOLV2.BAS, checking it with TYPO II, and SAVE a copy before you RUN the program.
Listing 2 can create three different types of BASIC dissolve routines one "sweep" routine, and two types of "spiral" dissolve routines. You can use any or all of them in your BASIC program. The sweep dissolve works in all graphics modes, and occupies line numbers 32060-32200. Listing 2 will LIST this routine to a disk file called SWEEPDIS.LST.
Due to the wide variety of screen dimensions, two spiral dissolve routines are needed, one for bit-mapped modes (Graphics Modes 3-11, 14 and 15) and one for character modes (Graphics Modes 0-2, 12 and 13).
Note that your spiral patterns will vary with the graphics mode chosen. Spiral dissolves using Graphics Modes 8 and 15 present particularly unusual patterns.
The bit-mapped spiral dissolve routine created by Listing 2 uses line numbers 32000-32200. Listing 2 LISTs this routine to a disk file called SPRBITDS.LST. The character mode spiral dissolve uses line numbers 32030-32200 and is LISTed to disk as SPRCHRDS.LST.
USING WITH BASIC
Any of these routines can easily be merged with your BASIC program. Just LOAD your program, then ENTER the subroutines you need. Make sure your program does not use line numbers above 31999.
As each routine uses exclusive line numbers, you can use all three routines in your program.
After properly setting up your main and hidden screens, begin the dissolve with the appropriate USR call, as shown below.
Use this USR call for sweep dissolves:
Use this USR call for spiral dissolves in bit-mapped modes:
Use this USR call for spiral dissolves in character modes:
HOW IT WORKS
Z is a dummy variable required by the syntax of a USR call.
ADR( $) is the address of the string which holds the dissolve subroutine.
MDLSCR is the address of the middle coordinate of the visible screen. This is the point at which the spiral dissolve begins. To find this address, determine the starting address of screen memory. Add this value to the appropriate value given in Figure 1.
The starting address of visible screen memory (STDSS) is given by PEEK (560) + PEEK(561) * 256. Remember to execute a graphics call before using this formula.
MDLHDN is the address of the middle coordinate of the hidden screen. Find this value the same way you found the value of MDLSCR.
DLY is the delay value. This number can range from one to 65535. Higher values create slower dissolves. You'll have to experiment with your graphics mode to find the best delay value. Generally, the best effects result from delay values between 2000 and 8000.
STDSS is the starting address of visible screen memory.
EDDS is the address of the ending coordinate of visible screen memory. Add STDDS to the value given in Figure 1 to find EDDS.
STDDH is the starting address of the hidden screen.
EDDH is the address of the ending coordinate of the hidden screen. Add STDDH to the value given in Figure 1 to find EDDH.
Figure 1 Graphics Middle Coordinate End Coordinate Mode Factor Factor 0 459 959 1 189 399 2 89 199 3 94 199 4 194 799 5 389 1599 6 789 3199 7 1579 6399 8 3179 7679 9 3819 7679 11 3819 7679 12 379 799 13 179 399 14 1589 3199 15 3179 6399
C0,C1,C2,C3,C4 are the values of the playfield and background color registers (locations 708-712) for the new screen. Although most graphics modes do not use all five color registers, you must specify all five values in the USR call. Otherwise, your computer will lock up.
Listing 1 gives a good example of how to set up and manipulate hidden screens. Remember; each USR call must be typed in exactly as shown, or you'll get unusual effects and possibly a locked-up computer.
Fred Pinho's Atari Time Machine appeared in the September, 1985 Antic. He's a biochemical research engineer from Valley Cottage, New York.