Classic Computer Magazine Archive ANTIC VOL. 5, NO. 6 / OCTOBER 1986



"Pointer Construction Set" in ST BASIC

To use Mouse Editor,
you'll need to merge it
with your own ST BASIC

Everyone who has used an Atari ST computer automatically recognizes the black arrow as the mouse pointer, or cursor. This pointer looks fine on the desktop or with a word processor. But wouldn't a rocket ship be more appropriate for a space game or a music note for a MIDI program?

Mouse Editor takes the monotony out of your mouse pointer. It is written in ST BASIC and calls on a few GEM routines. It works best in low resolution but is also fine in medium resolution. (Antic will add high resolution capability, if we get sufficient requests from ST monochrome monitor owners.-ANTIC ED)

The mouse pointer is actually a software "sprite" controlled by the mouse. Unlike Player/Missile graphics of 8-bit Ataris which are generated by the GTIA chip, the ST sprites are displayed without any special hardware. The mouse pointer consists of a 16 x 16 grid of dots with three main parts. The portion of the mouse pointer that you actually see is the "shape." Everything else in your created image is the "mask." (You do not need to use every dot on the grid.) The most important pointer element is the "hotspot." The hotspot is the single dot which selects items-for example, the tip of an arrow-shaped cursor.


Type in Listing 1, MOUSEDITBAS and save a copy to disk. Check it with ST TYPO, following the instructions elsewhere in this issue. After all ST TYPO codes match your typed lines, activate ST BASIC, load in MOUSEDIT.BAS and click on RUN.

You'll see a grid and a menu on the screen. The grid is used for designing the new mouse pointer shape. The menu is used for selecting various options with the normal "point and click" method.

To build the new pointer shape, click the left mouse button on the desired grid square. To build the mask, press the right mouse button on a square. If you made a mistake and need to erase, press either mouse button to blank out a filled square that the pointer is on. While doing these things, you'll notice that the design also appears in two other places at the middle of the screen. This lets you see your design in more accurate perspective. The lower shape includes the mask and the upper shape omits it.

The Change Mouse option lets you change the active mouse pointer into the shape you have designed on the grid. You will first be prompted to select a square for the hotspot. Select this with the left mouse button. Next, the program will ask for colors of the mask and shape. You can select any of the normal colors (1-16). If you are not satisfied with your new pointer and wish to change it some more, select the Reset Mouse option from the menu.

The Save Shape and Load Shape options will save and load the shape and the mask that are on the grid-but not the new colors or the hotspot. After you select one of these menu options, the program asks for a filename (with maximum of eight characters plus three character extender). These options do not change the pointer that is currently active. When you select Load Shape, the active pointer will also appear in the middle of the screen where you normally see what is on the grid.
Mouse Editor main screen
The Save State and Load State menu options only save and load the new hotspot and colors. To save the shape on the grid you must have previously used the Change Mouse function to activate the new pointer. The Load State function only changes the active pointer and won't affect the grid. It is advisable to use both Save Shape and Save State for your new pointer.

To use this program you'll need to merge it with your own ST BASIC program. Then, to call the subroutine, set the variable FILE to the filename of your new pointer and then type gosub CHANGEMOUSE. Your new pointer will load right in and be displayed automatically.

Mouse Editor takes the
monotony out of your
mouse pointer

For more information on using GEM routines see Control GEM with ST BASIC in the April, 1986 Antic.


Below are examples of how to write the key routines of a mouse pointer generator as part of your own ST BASIC programs.

To determine current mouse status:
10 A#=GB
20 IOUT=peek( A#+ 12)
30 gemsys( 39)
40 MOUSE.X=peek( IOUT+2)
50 MOUSE.Y=peek( IOUT+4)
50 MOUSE.BUTTON = peek (IOUT+6)

To select the mouse form out of a predefined set, where FORM is one of:
0 = Arrow
1 = Cursor
2 = Bee
3 = Pointing Hand
4 = Flat Hand
5 = Thin Crosshair
6 = Thick Crosshair
7 = Outline Crosshair
256 = Disable Mouse Form
257 = Enable Mouse Form

10 A#=GB
20 INTIN=peek( A#+8)
40 gemsys( 78)

To set up the mouse pointer form:
10 poke CONTRL, 111
20 poke CONTRL+2, 0
30 poke CONTRL+6, 37
50 poke INTIN+ 2, HOTSPOT.Y
60 poke INTIN + 4, 1
70 poke INTIN + 6, MASK.COLOR
80 poke INTIN + 8, MOUSE.COLOR
90 poke INTIN +10, MASK.DATUM0
100 poke INTIN+40, MASK.DATUM15
110 poke INTIN+42, MOUSE.DATUM0
120 poke INTIN+ 72, MOUSE.DATUM15
130 vdisys(0)

Listing 1: MOUSEDIT.BAS Download

Listing 2: CHANGEMS.BAS Download