CREATE YOUR OWN CURSOR
by Jerry WhiteAt last...you can create a cursor in any color, shape, and blink rate you choose. This short BASIC program works on all Atari computers. Antic Disk subscribers, RUN "D:PMCURSOR.BAS"
You know about Pinball Construction Set,
for making your own video pinball games, Music Construction Set, for composing
complete musical pieces with minimum hassle. Welcome to Cursor Construction
Set! If you're tired of looking at a square white unblinking cursor,
this program is for you.
Type in Listing 1. Check it with TYPO and SAVE a copy.
When you RUN the BASIC program, you're first asked for
the cursor flash rate, from 1 to 64. The higher the number, the faster
the rate. For starters, try 16.
You're then prompted to enter a cursor color number from
0 to 255. (Your Atari BASIC manual has a chart of the color numbers.) For
a bright yellow cursor, try 28. Be careful not to use the background
color, or the cursor won't be visible.
When you've entered these two values, the cursor appears
and the program ends. You may then LIST and tinker with the program,
or issue a NEW command and use your custom cursor on another program.
You can even keep your custom cursor when you change graphics modes.
To return to the standard Atari cursor, POKE 752,0, and to use our custom
cursor, POKE 752,1. The only drawback is that you can't use other
Player/Missile Graphics while using the custom cursor. To completely
disable the custom cursor routine, press [RESET].
HOW IT WORKS
This program uses Atari's Player/ Missile Graphics capability to set
up a "player" as the cursor.
Line 630 contains the data that sets the cursor's shape.
As written, the cursor is a thin underline. You modify the shape
by changing the data in this line. Listing 2 contains the assembly
language source code for the machine language "vertical blank" routine
used in Listing 1. You need not enter Listing 2.
Although the machine language routine contained in Listing
1 is relocatable to other memory addresses, it's usually best not to store
it as part of a string. When you use the immediate mode, BASIC may
move the location of a string in RAM. But the vertical blank routine
must remain at a fixed address. So if you need to use immediate mode,
keep the routine in a fixed location. This BASIC demo finds a safe
location by subtracting 33 pages from RAMTOP (the top of available memory)
to insure that the 181-byte routine is stored well below the display list
and the screen memory for any graphics mode. If you use only Graphics
0, you could change the 33 in line 350 to 6, leaving more room for your
BASIC program.
The program uses Player/Missile Graphics in single-line
resolution to create the cursor. The cursor is Player Two, and its
data is stored in Page Six, to avoid reserving an additional chunk of RAM
for Player/Missile memory.
Antic Contributing Editor Jerry White is co-author of "Windows" which appears elsewhere in this issue We rushed this piece into print to answer 11-year-old Brian Woodruff's August I/O letter which generated a great deal of reader response.
LISTING 1: PMCURSOR.BAS Download
LISTING 2: PMCURSOR.ASM Download / View