Magic Window

by Les Howarth

 

Issue 31

Jan/Feb 88

Next Article >>

<< Prev Article

 

 

Here is a good example of how fast TURBO BASIC can handle players with an unusual effect which could be used in your own programs. You are confronted with a blank screen on which is written an invisible message. As the characters are the same colour as the background you cannot see them. A player missile is used as the 'magic window' to reveal the message. One possible use for this effect would be to create an invisible maze and then use a joystick to move the window in order to find your way round the maze but there must be several other applications.

HOW IT WORKS

Two players are used. Player 0 is used as a frame while Player 2 is used to create the magic glass. Both players are stored in PM$. I should point out that line 10 must be typed in first to ensure that PM$ is the first name in variable name table otherwise the program will not work.

By moving the data within PM$, the players are moved vertically quite fast, so fast in fact that the players are moved from the bottom to the top of the screen instantly. PM graphics are set up in PROC SETUP at line 340. Here is where PM$ is re-directed to the PM storage area. Turbo Basic automatically clears arrays and strings when DIMed but in this instance we need PM$ to be filled with hearts. Line 390 is a quick fill routine which can be used to fill any string with any character. B$ is the shape of the window while C$ is the frame.

There are a few examples included of the special features of Turbo Basic which I will mention in this brief run-down of the program. The dashes in line 100 are obtained just by typing 2 dashes only, when listed you will find all 30 dashes shown. One thing to note, if you want to put in your own message, is that there is a semi colon at the end of each print statement.

Lines 110 to 280 are an infinite loop. The IF statements on lines 180 and 200 are NOT followed by a THEN. Make sure you type the colons where you would expect THEN to occur. The only jump out of this loop appears on line 160. By pressing START, SELECT, or OPTION, the program goes to PROC SLOW on line 300.

The SOUND statement with no parameters turns off all sound. PAUSE is a quick way of producing a delay instead of using a FOR/NEXT loop.

NOW FOR THE MAGIC!

The 'magic' is performed in line 430 where the PRIORITY register is set so that the playfield (in this case capital letters) has priority over Player 2. So there the secret is out! What really happens is that wherever Player 2 is on the screen, the Player only covers the background and not the text thus framing each character.

AtariLister - requires Java

YOU CAN DO THIS

So there's another example of Turbo programming. Can you do better? We'll pay you £20 for a good example of Turbo programming. It must use the features unique to Turbo and be well structured and it must fit on one page. Please also include a brief explanation of the program. Anything will do, but try and make it something that uses the unique features of Turbo Basic.

WHAT IS TURBO BASIC?

Turbo Basic is a new Basic language for the Atari originally published in the German magazine Happy Computing who retain the copyright but have released the program to the public domain. It adds over 60 new commands to Atari Basic, runs three to five times as fast, is totally compatible with Atari Basic and comes with a compiler to compile any Atari BAsic or Turbo Basic program to run at machine language speed. You should be able to get a copy from any source of Public Domain software such as your local user group or the PAGE 6 Accessory Shop.

top