Classic Computer Magazine Archive ST-Log ISSUE 20 / JUNE 1988 / PAGE 30

Mouse-Ka-source

Personalize your programs!

Turns Mouse-Ka-Mania data files into source code for GFA
Basic, C, or assembly program.

by Charles F. Johnson

Charles F. Johnson is a professional musician, and now semi-professional computer programmer/reviewer/author. He lives in Los Angeles with his wife Patty and Spike, the world's most intelligent (and gluttonous) cat. Charles is a sysop on the Analog Atari SIG on Delphi; his user name is CFJ.

One way to give your programs a distinctive look is to use a custom-designed mouse cursor for some or all functions. Mouse-Ka-Source will take a mouse data file saved with my Mouse-Ka-Mania accessory (from ST-Log 18) and convert it into source code that can be easily included into a GFA BASIC, C, or assembly language program.

To use Mouse-Ka-Source, load GFA Basic, type in Listing 1, and save it to disk. Then simply run the program and follow the prompts it gives you. If you don't have GFA Basic, a compiled version of the program that can be run without the GFA interpreter is included on this month's disk edition of ST-Log, or on the ST-Log ST SIG on Delphi.

If you do program in GFA Basic, this program is especially easy to use; the file that it creates is a full subroutine that does all the work for you. Just merge it with your program and add the statement Gosub My__mouse anytime you wish to change the mouse cursor to your custom shape. The subroutine written by Mouse-Ka-Source uses only local variables, so it shouldn't interfere with any part of the program you merge it with.

The C conversion routine writes the mouse data as an integer array with the label MY__MOUSE (note the capital letters). There are several ways to change the mouse shape from C or assembly; so I didn't write a full subroutine for these conversions. In C, the AES call to change the mouse might look like:

gr_moret = graf_mouse
(255, MY_MOUSE);

or, alternatively, the VDI call:

vsc_form (handle, MY_MOUSE);

When you convert a Mouse-ka-Mania data file to assembly source, it is written as a series of declare statements (dc.w). Asterisks are used to indicate comment lines, as per the Devloper's Kit AS68 assembler convention.

I think you'll find that Mouse-Ka-Source is very easy to use. GEM alert boxes are used to select all the program options, and the GEM file selector is used to choose a mouse data file. The converted source code file will be written to the same directory the data file is in, and the source code filename will be the same as the data filename, with an extension of ".LST," ".H," or ".S" for Basic, C, or assembly source files.

Mouse data files must have an extension of ".DAT" to show up in Mouse-Ka-Source's default File Selector. If you've saved a data file under another name, you'll have to either type it in on the filename line, or edit the directory line to show files with a different extension.

If the mouse data file isn't exactly 74 bytes long (the size of a Mouse-Ka-Mania file) the program will display an alert box telling you, "This is not a Mouse-Ka-Mania data file!" A possible problem arises here, if you've downloaded a data file using Xmodem, and it's been padded out to a multiple of 128 bytes. If you somehow end up with a mouse file that isn't 74 bytes long, just load it into Mouse-Ka-Mania and re-save it—the length will now be correct.