[comp.sys.amiga] QMouse and LaceTogl utilities

kim@amdahl.UUCP (Kim DeVaughn) (12/31/86)

[ "Send lawyers, guns, and money ..." ]

Here are a couple of *tiny* utilities that were written by a fellow
Amigaite here at Amdahl (Bob Rethemeyer).  I'm posting them for him
since he doesn't have direct access to the net.

Both are written in assembler, and provide a couple of VERY useful
functions in VERY little space (QMouse is only about 100 bytes long,
and LaceTogl is under 250 bytes)!

Being fairly sensitive to the "interlace flicker" (and lacking a medium/
long persistence monitor ;-)), I don't use LaceTogl too much.  QMouse
is another story though!

With Qmouse, I've been able to consolidate the 3 or 4 various "flavors"
of WorkBench floppys and Startup-Sequences that I used to have to have
(CLI only, WB only, with/without RAM: loading, etc.)  Thanks, Bob!!

Now I wonder how small Matt (and Steve's) "shell" can be ... where's
my 68000 assembler manual :-)?

Anyway, here's the shar file with both programs ... sources and executibles.
Just strip off this verbage (and the .signature), unshar, and uudecode the
.uue files.  But you all know the drill (hi, Andy :-)) ...

/kim


P.S.  You can send me any comments you have for Bob ... I'll pass 'em along.


# This is a shell archive.  Remove anything before this line, then
# unpack it by saving it in a file and typing "sh file".  (Files
# unpacked will be owned by you and have default permissions.)
#
# This archive contains:
# QMouse.asm QMouse.uue LaceTogl.asm LaceTogl.uue

echo x - QMouse.asm
cat > "QMouse.asm" << '//E*O*F QMouse.asm//'
**********************************************************************
*    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 "<Hold down mouse-left for more RAM>"
*          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
//E*O*F QMouse.asm//

echo x - QMouse.uue
cat > "QMouse.uue" << '//E*O*F QMouse.uue//'
begin 644 QMouse
M   #\P         "          $    "    !@   ^D    "3OD         
M  /L     0    $    "         _(   /I    !B9\ +_@ 1 K   "@   
. $ *  ! Y@A.=0   _("
 
end
//E*O*F QMouse.uue//

echo x - LaceTogl.asm
cat > "LaceTogl.asm" << '//E*O*F LaceTogl.asm//'
         PLEN 60
**********************************************************************
*    Program: LACETOGL- A CLI program to force interlace mode on/off.
*    Author:  Robert Rethemeyer, Sunnyvale, CA  (thru BBS-HT)
*    Date:    07/22/86
*    Status:  RELEASED TO THE PUBLIC DOMAIN, "AS-IS"
**********************************************************************
* This program is modeled after the "SETLACE" C program by
* Bob Pariseau on Fish disk #9.  The advantage of LACETOGL is its
* small size: 248 bytes instead of 15504 for SETLACE.  It takes up only
* one block of space on your workbench disk.  This program works with
* either DOS 1.1 or 1.2, however with 1.2 it has no effect if the
* Workbench Interlace preference is already on.  For more information,
* refer to the documentation accompanying the SETLACE program.
*
* To use this program, just execute it from a CLI.  If interlace mode
* is off, it will be turned on; if it is already on, it is turned off.
* It prints the message "Interlace Toggled" if successful.
**********************************************************************
         NOLIST
  INCLUDE "exec/types.i"
  INCLUDE "libraries/dos_lib.i"
  INCLUDE "graphics/gfxbase.i"
  INCLUDE "graphics/display.i"
         LIST
ExecBase EQU  4
         XREF  _LVOOpenLibrary
         XREF  _LVOCloseLibrary
         XREF  _LVORemakeDisplay
**********************************************************************
LaceTogl:
         MOVE.L  ExecBase,a6
*                                   OPEN DOS LIBRARY
         LEA     doslib(pc),a1
         MOVEQ   #0,d0
         JSR     _LVOOpenLibrary(a6)
         MOVE.L  d0,a4
         BEQ.S   broke1
*                                   OPEN GRAPHICS LIBRARY
         LEA     gfxlib(pc),a1
         MOVEQ   #0,d0
         JSR     _LVOOpenLibrary(a6)
         MOVE.L  d0,a5
         BEQ.S   broke2
*                                   OPEN INTUITION LIBRARY
         LEA     intlib(pc),a1
         MOVEQ   #0,d0
         JSR     _LVOOpenLibrary(a6)
         MOVE.L  d0,a3
         BEQ.S   broke3
*                                   TOGGLE INTERLACE MODE
         EOR.W   #INTERLACE,gb_system_bplcon0(a5)
         MOVE.L  a3,a6
         JSR     _LVORemakeDisplay(a6)
         MOVE.L  ExecBase,a6
*                                   PRINT SUCCESS MESSAGE
         JSR     _LVOOutput(a4)
         MOVE.L  d0,d1
         LEA     mesg(pc),a2
         MOVE.L  a2,d2
         MOVEQ   #18,d3
         JSR     _LVOWrite(a4)
*                                   CLEAN UP AND RETURN
         MOVE.L  a3,a1
         JSR     _LVOCloseLibrary(a6)
broke3   MOVE.L  a5,a1
         JSR     _LVOCloseLibrary(a6)
broke2   MOVE.L  a4,a1
         JSR     _LVOCloseLibrary(a6)
broke1   MOVEQ   #0,d0
         RTS                        ALL DONE
************************************************************       
         CNOP    0,2
mesg     DC.B    'Interlace Toggled',10
         CNOP    0,2
doslib   DC.B    'dos.library',0
         CNOP    0,2
gfxlib   DC.B    'graphics.library',0
         CNOP    0,2
intlib   DC.B    'intuition.library',0
         END
//E*O*F LaceTogl.asm//

echo x - LaceTogl.uue
cat > "LaceTogl.uue" << '//E*O*F LaceTogl.uue//'
begin 644 LaceTogl
M   #\P         "          $    "    *@   ^D    "3OD         
M  /L     0    $    "         _(   /I    *BQX  1#^@!R< !.KOW8
M*$!G4$/Z '!P $ZN_=@J0&<\0_H ='  3J[]V"9 9R@*;0 $ *0L2TZN_H L
M>  $3JS_Q"( 1?H ("0*=A).K/_0(DM.KOYB(DU.KOYB(DQ.KOYB< !.=4EN
M=&5R;&%C92!4;V=G;&5D"F1O<RYL:6)R87)Y &=R87!H:6-S+FQI8G)A<GD 
7 &EN='5I=&EO;BYL:6)R87)Y     _)R
 
end
//E*O*F LaceTogl.uue//

echo Possible errors detected by \'wc\' [hopefully none]:
temp=/tmp/shar$$
trap "rm -f $temp; exit" 0 1 2 3 15
cat > $temp <<\!!!
     56    363   2516 QMouse.asm
      6     30    169 QMouse.uue
     81    302   3103 LaceTogl.asm
      9     41    369 LaceTogl.uue
    152    736   6157 total
!!!
wc  QMouse.asm QMouse.uue LaceTogl.asm LaceTogl.uue | sed 's=[^ ]*/==' | diff -b $temp -
exit 0


-- 
UUCP:  {sun,decwrl,hplabs,pyramid,ihnp4,seismo,oliveb,cbosgd}!amdahl!kim
DDD:   408-746-8462
USPS:  Amdahl Corp.  M/S 249,  1250 E. Arques Av,  Sunnyvale, CA 94086
CIS:   76535,25

[  Any thoughts or opinions which may or may not have been expressed  ]
[  herein are my own.  They are not necessarily those of my employer. ]