Classic Computer Magazine Archive START VOL. 4 NO. 8 / MARCH 1990

Programming In BASIC

GFA BASIC

Wipes & Dissolves

BY CARLOS TIRADO


The opening and closing "iris" is just one of the many effects you can add to
your GFA BASIC programs with Carlos Tirado's special wipes and dissolves
subroutines.

Now you see it, now you don't in the file W!PES.ARC on Side 1 of your START disk.

This month we'll look at some interesting subroutines you can use in your own GFA BASIC programs. My GFA Wipes & Dissolves will add flash to your screens; these include such classics as the "opening iris" effect, scrolling and several others. A GFA BASIC program that makes excellent use of the routines is also included to give you a full working demonstration.

A Little Background
A wipe is a transition in which an image is gradually replaced with another image, either from side to side or from top to bottom or bottom to top. A dissolve is a transition in which one image is replaced, a piece at a time, with corresponding portions of another image. You see these kinds of special effects in movies and television all the time.

To achieve all this beauty you can use two handy GFA BASIC commands that let you put and move blocks of pictures around to get the effect you want. These commands are BMOVE and BITBLIT. BMOVE works faster and is better suited for wipes; BITBLIT is more flexible in that you can move memory blocks that are not contiguous in a single operation and is more convenient for dissolves. BMOVE is very simple to use - you need only specify two memory locations and the amount of information to be moved. BITBLIT requires many more parameters and preparation, but you'll soon find it's worth the pain when you see the results.

The Program
Included on disk is the program SUSLSHOW.PRG ("Super Slide Show"), a demo of the GFA Wipes & Dissolves. This program will read DEGAS Elite uncompressed low or high resolution pictures from disk and perform a slide show using the special effects of the subroutines. The program runs on any color or monochrome system.

To run the demo, first boot this month's START disk; the START Menu runs automatically. At the main screen, click on Prepare, then select "GFA BASIC Wipes & Dissolves." The program will un-ARC directly onto the destination disk you specify. To run Super Slide Show, double click on SUSLSHOW.PRG; press any key to exit. The Super Slide Show program uses up to four pictures which must be in the same directory as SUSLSHOW.PRG. Sample high resolution picture PIC_1.PI3 was downloaded from the ATARIARTS forum on Compuserve; PIC_4.PI3 is from Antic Software's Maps and Legends Data Disk. You can use Super Slide Show to display up to four of your own low or high resolution pictures simply by renaming them PIC_1 through PIC_4, with the appropriate extension. Medium resolution pictures can he run by modifying the source. SUSLSHOW.LST, in addition to being the source for the demo, is an example of how to call the wipe and dissolve routines. All source is written in GFA BASIC 2.0.


The quest to make
your programs ever
better and more
pleasant never ends.

Using the Routines
On your START disk you'll find the file WIPES.LST, containing wipe and dissolve routines that you can merge into your own GFA-BASIC projects. They require that you provide an area of 32K to hold the image that will replace the current display on your computer's monitor, and that the variable "scrn1" be a pointer to this memory location. The variable "screen" should also he equated to the actual screen address memory. All this is easily accomplished with three lines of code:

s$=SPACES(32000) or SGET s$
scrnl=VARPIR(s$)
screen=XBIOS(2)

However, to make full use of these routines you'll want to spend a few more bytes (256 to be exact):

s$=SPACE$(32256)
scrnl =(INT(VARPTR(s$)/256)+l)*256
screen=XBIOS(2)

Why? Because the Set_screen function of your computer (XBIOS routine No. 5) requires that any memory base for the screen or an alternate screen fall on a 256-byte boundary, and GFA BASIC does not automatically align the string memory for your image to this rule. Using this XBIOS routine you can have an alternate "logical" screen in wich you may print text, draw a graphic, etc. out of the sight of the user and then bring it to the "physical" screen when it's ready using one of the wipes or dissolves presented here. The format of the command is:

VOID XBIOS(5,L:logbase,L:physbase,W:rez)

Use -1 when you don't want to change an XBIOS input. If you set "rez," even to the same resolution, the screen will be cleared, so use -1 instead if you don't want this to happen. In your own programs you would use:

'Activate alternate screen for drawing
VOID XBIOS(5,L:scrnl,L:-1,W:-l)
'
'Here goes your program code to draw the screen
'
'Restore logical screen
VOID XBlOS(5,L:screen,L:-1,,W:-1)
'Jump to the Wipe or Dissolve procedure
GOSUB wipe

Conclusion
We all learned from the beginning that the ST is a powerful computer with great graphics; now you can put that power to work for you with this welcome addition to your GFA BASIC subroutine library. There's room for improvement, of course. You can, with a little imagination, make all kinds of special effects and use them in a variety of applications. The quest to make your programs ever better and more pleasant never ends.

Carlos Tirade lives in Sonora, Mexico. This is his first program for START.