[comp.sys.amiga] Startup Options

JKT100@psuvm.psu.edu (JKT) (09/13/90)

I'm looking for a program that I could call from my startup sequence
that would check the status of a certain mouse button or keyboard key
and would take action if the given button or key were depressed.

My goal is to set up my 2000 so I can hold down a button or key and
have it go straight into a certain mode (such as A-Max or whatever)
if I hold that button down, but if I do nothing, it will go to workbench
by default.

I realize if I knew C better I could write a little program to do this,
but I don't.  If anyone has a simple solution, could they post it here?
Even a short bit of C source would be great - I'd just copy it into
my editor and compile it here.   (I have Lattice 5.04).

If this can be done with a script (I don't think it can, but wouldn't
mind being proven incorrect) could someone post an example?

                                       Thanks,

                                                            Kurt
--
 -----------------------------------------------------------------------
|| Kurt Tappe   (215) 363-9485  || Amigas, Macs, IBM's, C-64's, NeXTs, ||
|| 184 W. Valley Hill Rd.       ||  Apple ]['s....  I use 'em all.     ||
|| Malvern, PA 19355-2214       ||  (and in that order too!   ;-)      ||
||  jkt100@psuvm.psu.edu         --------------------------------------||
||  jkt100@psuvm.bitnet  jkt100%psuvm.bitnet@psuvax1  QLink: KurtTappe ||
 -----------------------------------------------------------------------

thad@cup.portal.com (Thad P Floryan) (09/14/90)

JKT100@psuvm.psu.edu (JKT) in <90255.205037JKT100@psuvm.psu.edu> writes:

	I'm looking for a program that I could call from my startup sequence
	that would check the status of a certain mouse button or keyboard key
	and would take action if the given button or key were depressed.

	My goal is to set up my 2000 so I can hold down a button or key and
	have it go straight into a certain mode (such as A-Max or whatever) if
	I hold that button down, but if I do nothing, it will go to workbench
	by default.

	I realize if I knew C better I could write a little program to do
	this, but I don't.  If anyone has a simple solution, could they post
	it here?  Even a short bit of C source would be great - I'd just copy
	it into my editor and compile it here.  (I have Lattice 5.04).

	If this can be done with a script (I don't think it can, but wouldn't
	mind being proven incorrect) could someone post an example?

Well, you're in luck; I just "happened" to see your posting.  For the solution
to your quest:

CLI6> ls -l src:qmouse
----ar-e- 87-02-09 00:49:33    1      104 QMouse
----ar--- 87-02-09 00:49:39    5     2516 QMouse.asm
----ar--- 87-11-22 00:59:31    4     1690 QMouse.doc
Dirs:0    Files:3    Blocks:10    Bytes:4310    
CLI6> 

That's the ORIGINAL "QMouse" by Bob Rethemeyer.  As an example of how I use it
in my s:startup-sequence, here are some extracts:

[...]

echo "*E[B *E[42m    LEFT-MOUSE FOR NO DISK BUFFERS    *E[43m *E[0m*E[A"
wait 2 sec
QMouse
IF NOT WARN
	echo " *E[K*E[43m            ADDING BUFFERS             *E[0m*E[A"
	sys:c/failat 21
	sys:Utilities/AddBuffers >NIL: df0: 25
	sys:Utilities/AddBuffers >NIL: df1: 25
	sys:Utilities/AddBuffers >NIL: df2: 25
ENDIF

[...]

echo " *E[42m  LEFT-MOUSE FOR DISK-BASED COMMANDS  *E[43m *E[0m*E[A"
wait 2 sec
QMouse
IF NOT WARN
	echo " *E[K*E[43m           MakeRAM Starting            *E[0m*E[A"
	assign	C:		RAM:C
	copy	sys:c		RAM:C QUIET
	copy	util:pkax	RAM:C QUIET
	copy	util:zoo	RAM:C QUIET
	copy	util:remcr	RAM:C QUIET
	copy	util:less	RAM:C QUIET
ELSE
	echo " *E[K*E[43m              NO MakeRAM               *E[0m*E[A"
	assign	C:	SYS:C
ENDIF

Those two extracts above should give you some ideas.  If I don't touch the
mouse button during a boot, my "preferred" system configuration is set by
default.  The color choices in the echo strings are based on my preferences
of a paper-white background, black characters, a red cursor per:

	Color	RGB (hex)
	  0	FEC
	  1	000
	  2	FB8
	  3	F00

Since Bob's QMouse is so short, I've included the source and the uuencoded
executable below.

Thad Floryan [ thad@cup.portal.com (OR) ..!sun!portal!cup.portal.com!thad ]

-------------------- begin included material --------------------

#	This is a shell archive.
#	Remove everything above and including the cut line.
#	Then run the rest of the file through sh.
#----cut here-----cut here-----cut here-----cut here----#
#!/bin/sh
# shar:    Shell Archiver
#	Run the following text with /bin/sh to create:
#	QMouse.doc
#	QMouse.asm
#	Qmouse.uue
# This archive created: Fri Sep 14 01:25:13 1990
echo shar: extracting QMouse.doc
sed 's/^X//' << \SHAR_EOF > QMouse.doc
X**********************************************************************
X*    Program: QMOUSE - CLI "IF" test for mouse button
X*    Author:  Robert Rethemeyer, Sunnyvale, CA
X*    Date:    10/05/86
X*    Status:  RELEASED TO THE PUBLIC DOMAIN, "AS-IS"
X**********************************************************************
X
XQMOUSE is a program to query the status of the left mouse button.  It sets a
Xreturn code of 0 if the button is NOT pressed, or a return code of 8 if it
XIS pressed.  This return code can be used as a WARN condition in a CLI
X"execute" file. 
X
XQMOUSE provides a way to optionally alter the way that "startup-sequence"
Xoperates when booting the machine.  For example, some DOS 1.2 users load the
Xmost frequently used commands into RAM disk in the startup-sequence.  Since
Xthat lessens the total memory available, some programs will not run.  These
Xusers usually must keep a separate Workbench disk which does not load the
XRAM.  Using QMOUSE and an IF statement in the startup-sequence, the loading
Xof RAM can be conditionally skipped.  Do nothing during the startup to load
Xthe RAM as usual; hold down the button to not load the RAM if extra RAM will
Xbe needed.  Imaginative users may think of other uses for QMOUSE. 
X
XWhen pressing the button, be sure the mouse pointer is off of the drag bar,
Xotherwise the execution of the file pauses.  Here is a basic example of how
Xto use QMOUSE in the startup-sequence:
X
X	echo "Workbench 1.2"
X	... etc....
X	echo "<Hold down mouse-left for more RAM>"
X	wait 1 sec
X	QMouse
X	IF NOT WARN
X	   echo "Loading RAM:C"
X	   makedir RAM:C
X	   path ....etc...
X	   copy c:dir to ram:c
X	   copy ....etc...
X	ELSE  
X	   echo "RAM:C not present"
X	ENDIF
SHAR_EOF
if test 1690 -ne "`wc -c QMouse.doc`"
then
echo shar: error transmitting QMouse.doc '(should have been 1690 characters)'
fi
echo shar: extracting QMouse.asm
sed 's/^X//' << \SHAR_EOF > QMouse.asm
X**********************************************************************
X*    Program: QMOUSE - CLI "IF" test for mouse button
X*    Author:  Robert Rethemeyer, Sunnyvale, CA
X*    Date:    10/05/86
X*    Status:  RELEASED TO THE PUBLIC DOMAIN, "AS-IS"
X**********************************************************************
X* QMOUSE is a program to query the status of the left mouse button.
X* It sets a return code of 0 if the button is NOT pressed,
X* or a return code of 8 if it IS pressed.  This return code can
X* be used as a WARN condition in a CLI "execute" file.
X*
X* QMOUSE provides a way to optionally alter the way that
X* "startup-sequence" operates when booting the machine.
X* For example, some DOS 1.2 users load the most frequently used
X* commands into RAM disk in the startup-sequence.  Since that
X* lessens the total memory available, some programs will not run.
X* These users usually must keep a separate Workbench disk which
X* does not load the RAM.  Using QMOUSE and an IF statement in the
X* startup-sequence, the loading of RAM can be conditionally skipped.
X* Do nothing during the startup to load the RAM as usual;  hold
X* down the button to not load the RAM if extra RAM will be needed.
X* Imaginative users may think of other uses for QMOUSE.
X*
X* When pressing the button, be sure the mouse pointer is off of the
X* drag bar, otherwise the execution of the file pauses.
X* Here is a basic example of how to use QMOUSE in the startup-sequence:
X*
X*          echo "Workbench 1.2"
X*          ... etc....
X*          echo "<Hold down mouse-left for more RAM>"
X*          wait 1 sec
X*          QMouse
X*          IF NOT WARN
X*          echo "Loading RAM:C"
X*          makedir RAM:C
X*          path ....etc...
X*          copy c:dir to ram:c
X*          copy ....etc...
X*          ELSE  
X*          echo "RAM:C not present"
X*          ENDIF
X*         
X********************* Begin text of program **************************
X         NOLIST
X         INCLUDE "hardware/cia.i"
X         LIST
X         XREF    _ciaa                 * location of 8520 chips
X**********************************************************************
XQMouse:
X         MOVEA.L #_ciaa,a3             * address of chip register
X         MOVE.B  ciapra(a3),d0         * get register data
X         AND.L   #CIAF_GAMEPORT0,d0    * mask out mouse button bit
X         EOR.B   #CIAF_GAMEPORT0,d0    * invert it
X         LSR.B   #3,d0                 * shift to bit 3
X         RTS                           * return with bit as return code
X         END
SHAR_EOF
if test 2516 -ne "`wc -c QMouse.asm`"
then
echo shar: error transmitting QMouse.asm '(should have been 2516 characters)'
fi
echo shar: extracting Qmouse.uue
sed 's/^X//' << \SHAR_EOF > Qmouse.uue
Xbegin 777 Qmouse.uue
XM```#\P`````````"``````````$````"````!@```^D````"3OD`````````V
XM``/L`````0````$````"`````````_(```/I````!B9\`+_@`1`K```"@```9
X.`$`*``!`Y@A.=0```_("R
X``
Xend
SHAR_EOF
if test 177 -ne "`wc -c Qmouse.uue`"
then
echo shar: error transmitting Qmouse.uue '(should have been 177 characters)'
fi
#	End of shell archive
exit 0

-------------------- end of included material --------------------

vincelee@earthquake.Berkeley.EDU (Vincent H. Lee) (09/15/90)

In article <90255.205037JKT100@psuvm.psu.edu> JKT100@psuvm.psu.edu (JKT) writes:
>I'm looking for a program that I could call from my startup sequence
>that would check the status of a certain mouse button or keyboard key
>and would take action if the given button or key were depressed.
>
>My goal is to set up my 2000 so I can hold down a button or key and
>have it go straight into a certain mode (such as A-Max or whatever)
>if I hold that button down, but if I do nothing, it will go to workbench
>by default.
>
>
>                                       Thanks,
>
>                                                            Kurt

There's a PD program called Startup which does something similar--It brings up
a window with 5 gadgets which you can select to execute 5 different startup
sequences, or it will timeout to a default after a settable number of secs
have passed.

-Vince