********************************************************************** * Program: QMOUSE - CLI "IF" test for mouse button * Author: Robert Rethemeyer, Sunnyvale, CA * Date: 10/05/86 * Status: RELEASED TO THE PUBLIC DOMAIN, "AS-IS" ********************************************************************** * QMOUSE is a program to query the status of the left mouse button. * It sets a return code of 0 if the button is NOT pressed, * or a return code of 8 if it IS pressed. This return code can * be used as a WARN condition in a CLI "execute" file. * * QMOUSE provides a way to optionally alter the way that * "startup-sequence" operates when booting the machine. * For example, some DOS 1.2 users load the most frequently used * commands into RAM disk in the startup-sequence. Since that * lessens the total memory available, some programs will not run. * These users usually must keep a separate Workbench disk which * does not load the RAM. Using QMOUSE and an IF statement in the * startup-sequence, the loading of RAM can be conditionally skipped. * Do nothing during the startup to load the RAM as usual; hold * down the button to not load the RAM if extra RAM will be needed. * Imaginative users may think of other uses for QMOUSE. * * When pressing the button, be sure the mouse pointer is off of the * drag bar, otherwise the execution of the file pauses. * Here is a basic example of how to use QMOUSE in the startup-sequence: * * echo "Workbench 1.2" * ... etc.... * echo "" * wait 1 sec * QMouse * IF NOT WARN * echo "Loading RAM:C" * makedir RAM:C * path ....etc... * copy c:dir to ram:c * copy ....etc... * ELSE * echo "RAM:C not present" * ENDIF * ********************* Begin text of program ************************** NOLIST INCLUDE "hardware/cia.i" LIST XREF _ciaa * location of 8520 chips ********************************************************************** QMouse: MOVEA.L #_ciaa,a3 * address of chip register MOVE.B ciapra(a3),d0 * get register data AND.L #CIAF_GAMEPORT0,d0 * mask out mouse button bit EOR.B #CIAF_GAMEPORT0,d0 * invert it LSR.B #3,d0 * shift to bit 3 RTS * return with bit as return code END