home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The CDPD Public Domain Collection for CDTV 2
/
CDPD_II_2352.bin
/
mousetrap
/
mt.doc
< prev
next >
Wrap
Text File
|
1992-11-10
|
13KB
|
277 lines
*****************************************************************************
MOUSETRAP FOR CDTV - DOCUMENTATION
Written for the Buxton Group (UK Amiga Multimedia Research Group),
© 1992 Dave Parkinson.
This document by DaveP, 3-Apr-92
Dave Parkinson, DP Consultants, 20 Mostyn Gardens, London NW10 5QX.
Tel: +81 960 2623, Fax: +81 960 9089, Nets: ariadne@CIX.compulink.co.uk
*****************************************************************************
Terms and conditions
~~~~~~~~~~~~~~~~~~~~
This software documentation etc is copyright (c) Dave Parkinson 1992, but may
be freely distributed under the following conditions:
1. You are welcome to spread this stuff around as you like on BBSs etc -
but please only distribute the archive in full, including the source-
code and these notes.
2. License is granted to include the MouseTrap program in commercial
CDTV titles, or to incorporate the code in your own programs. If you do
this, please consider making a donation to the Terrence Higgins Trust,
52-54 Gray's Inn Road, London WC1X 8BR (UK AIDS/HIV charity) or some
equally deserving cause.
3. No warrenty of any kind is given as regards the suitability of this
software for any purpose whatsoever! The source-code is included in
the archive so you can check it if you like; don't blame me if it
screws up your gold disk.
What's it for?
~~~~~~~~~~~~~~
The MouseTrap program for CDTV serves three functions:
1. To make it much easier to handle the recommended user-interface,
by making the remote controller arrow-keys and A and B buttons
return key closures such as 'u', 'd', 'l', 'r', 'a' and 'b' rather
than mouse move and click events. The A button also by default
acts as a shift key, so you can tell if A is being held down while
arrow-keys are pressed. An option exists to trap IR controller events,
but leave alone trackball or IR-mouse input - this allows an application
to adapt transparently to different input devices.
2. To allow a remote mouse and keyboard to be used on 'slave' CDTV via a
serial-port link to a 'master' Amiga. This can be very useful in a
development environment - see notes on the "Two Bits of Wire"
development system under 'Master and Slave' below.
3. To provide remote diagnostics of input events on CDTV on a 'master'
Amiga. This can be very useful in tracking down certain bugs - eg
are you missing input events, or is the Remote Controller failing to
generate them?
Limitations
~~~~~~~~~~~
The current version of MouseTrap is limited as follows:
1. It only generates key-down events, not key-ups - ie it emulates a weird
sort of keyboard in which the keys go down as often as you like, but
never come back up! This doesn't seem to be a problem in practice (but
let me know if I'm wrong about this).
Use from CLI
~~~~~~~~~~~~
MouseTrap will normally be run from the CLI, eg in the startup-sequence of a
title. When run from CLI, MouseTrap will start a new process then return,
allowing the CLI it was run from to close. There is therefore never any need
to 'run MouseTrap'.
Command-line syntax is as follows:
Mousetrap keys/K/N buttons/K/N grain/K/N delay/K/N speed/K/N device/K
unit/K/N\n baud/K/N diag/K/N nohandshake/S noshift/S notrap/S noball/S
master/S slave/S off/S
Numeric parameters can be given either in decimal, or with a leading 0x in
hex.
Meanings of the various fields are as follows:
keys: Raw key-codes for up, down, left, right. The default is
0x16222813 meaning 'u', 'd', 'l' and 'r'. Raw key-codes (in
hex) and the corresponding UK characters are as follows:
00 ' 10 q 20 a 30 40 space 50 F1 60 l shift
01 1 11 w 21 s 31 z 41 bs 51 F2 61 r shift
02 2 12 e 22 d 32 x 42 tab 52 F3 62 caps lock
03 3 13 r 23 f 33 c 43 enter 53 F4 63 ctrl
04 4 14 t 24 g 34 v 44 return 54 F5 64 l alt
05 5 15 y 25 h 35 b 45 esc 55 F6 65 r alt
06 6 16 u 26 j 36 n 46 del 56 F7 66 l amiga
07 7 17 i 27 k 37 m 47 57 F8 67 r amiga
08 8 18 o 28 l 38 , 48 58 F9 68
09 9 19 p 29 ; 39 . 49 59 F10 69
0A 0 1A [ 2A # 3A / 4A kpad - 5A kpad ( 6A
0B - 1B ] 2B 3B 4B 5B kpad ) 6B
0C = 1C 2C 3C kpad . 4C up 5C kpad / 6C
0D \ 1D kpad 1 2D kpad 4 3D kpad 7 4D down 5D kpad * 6D
0E 1E kpad 2 2E kpad 5 3E kpad 8 4E right 5E kpad + 6E
0F kpad 0 1F kpad 3 2F kpad 6 3F kpad 9 4F left 5F help 6F
For example, to alias the arrow-keys to cursor-keys use
'MouseTrap keys 0x4C4D4F4E'.
buttons: Raw key-codes for middle, A, B. The default is 0x00332035
meaning 'c', 'a', and 'b'. (Okay, C= producing an
IR-controller with a middle mouse-button is pretty unlikely
- but I'm ready for them if they do!) For example, to alias
the A and B buttons to return 'y' and 'n', use
'MouseTrap buttons 0x1536'
grain: Time units to delay before generating first key closure. The
default is 0. Larger values give a slower response.
delay: Time units to delay before starting key-repeat. The default
is 8. To disable key repeat, use 'MouseTrap delay 0'
speed: Time units to delay between key-repeats. Default 2. For
maximum repeat-speed, use 'MouseTrap speed 1'.
device: Device to use for master/slave serial comms, and for remote
diagnostics. The default is 'serial'. To remote control a
CDTV attached an Amiox board serial port 2, you would use
'Mousetrap master device aserial unit 2'.
unit: Unit number to use for master/slave serial comms, and for
remote diagnostics. The default is 0. To remote control a
a CDTV attached to a CBM multi-serial board port 2, you would
use 'Mousetrap master unit 2'.
baud: Baud-rate to use for master/slave serial comms, and for remote
diagnostics. The default is 9600. To push it up to 19200 you
would use 'Mousetrap master baud 19200'.
diag: Followed by a numeric parameter 0 1 or 2 as follows:
0 - no diagnostics
1 - normal diagnostics, excluding timer
2 - full diagnostics, including timer
Note that with full diagnostics, baud rate needs to be set to
at least 9600.
nohandshake: Disable 7-wire handshake for master/slave serial comms, and
for remote diagnostics. Normally, MouseTrap expects to use
a 7-wire null-modem cable between machines (see below for
wiring); if you are only using a 3-wire cable, use something
like 'Mousetrap master nohandshake'.
noshift: Don't treat the A button as a shift-key. The default is to
do so, so if A is held down you will get 'U' 'D' 'L' and 'R'
back from the arrow keys rather than 'u' 'd' 'l' and 'r'.
notrap: Don't trap mouse-events at all. Eg, if you just want remote
diagnostics, use 'MouseTrap diag 1 notrap'.
noball: Trap mouse-events from the conventional IR controller, but
leave alone events from trackball or infra-red mouse. This
allows an application to adapt to input device transparently:
if you get key closures u, d, l, and r, then use a bouncing
highlight; if you start getting mouse-moves, then put up a
cross-hair.
master: Remote control a CDTV - see below. Is taken to imply
'notrap'.
slave: Be remote controlled by an Amiga - see below.
off: Switch off a previously installed MouseTrap.
Use from Workbench
~~~~~~~~~~~~~~~~~~
MouseTrap can also be run from Workbench, either from a Tool icon or from a
Project icon with default tool set to MouseTrap - examples of both are
provided in the archive. When running from Workbench, the command line
options above are given in ToolTypes. For example to get the same effect as
MouseTrap keys 0x4C4D4F4E delay 10 diag 1 noball
you could set up an Icon with tooltypes
KEYS=0x4C4D4F4E
DELAY=10
DIAG=1
NOBALL
Exiting MouseTrap
~~~~~~~~~~~~~~~~~
MouseTrap can be switched off by any of the following methods:
1. Use 'MouseTrap off' from the CLI.
2. Use an icon with tooltype OFF.
3. Via a hot-key - hold down left-Amiga and press Escape.
When running Master/Slave, using left-Amiga-Escape on the master will shut
down the master only and leave the slave running; using left-shift-left-
Amiga-Escape will close down both.
Trying to start MouseTrap when it is already active will close-down the old
version before running the new one.
The diagnostic console (see below) has a close box - but note that this is
used only to get rid of the console, it won't switch off MouseTrap.
Master and Slave
~~~~~~~~~~~~~~~~
MouseTrap can be used to allow a 'slave' CDTV to be remote-controlled using a
'master' Amiga's mouse and keyboard. To do this, the two machines need to
be connected using a 7-wire null-modem cable between serial ports, connected
as follows:
One end Other end
pin 2 (TXD) -------------- 3 (RXD)
3 (RXD) -------------- 2 (TXD)
4 (RTS) -------------- 5 (CTS)
5 (CTS) -------------- 4 (RTS)
6 (DSR) -------------- 20 (DTR)
7 (GND) -------------- 7 (GND)
20 (DTR) -------------- 6 (DSR)
Alternatively, if you are using the NOHANDSHAKE option, only the three wires
connecting pins 2, 3 and 7 are needed - but you stand a greater risk of
losing characters.
The CDTV should then be set up to run 'MouseTrap slave' (with other options
'notrap', 'diag', etc as needed) which the Amiga runs 'MouseTrap master'.
The Amiga mouse and keyboard can then be toggled between local use and
remote-control of the CDTV by the special key combination CTRL-LEFT-AMIGA.
Note the following additional points about Master and Slave:
1. If you have specified the 'diag' option on the slave CDTV, then as soon
as the Master Amiga starts to notice diagnostic messages coming back
it will open a 'Diagnostic Console' to display them. This can be
got rid of using its close box.
2. The slave system can tell remote 'master' mouse events from its IR
controller. So if you're not using 'notrap' on the slave system,
IR mouse events will be aliased to key closures, but the 'master'
mouse will function normally.
3. 'Master' is taken to imply 'notrap' - it's assumed you don't want
to trap the mouse on your Amiga!
4. The MouseTrap master/slave option is ideally used along with ParNet
in the 'Two Bits of Wire' CDTV development system, in which Amiga and
CDTV are linked by both a serial cable as above and a ParNet cable
between parallel ports, used to download code from Amiga to CDTV for
remote execution. If you are willing to cut an early test-disk with
some test data (only) on it, this means that you can test your code 'for
real' on the CDTV as you develop.
Remote diagnostics
~~~~~~~~~~~~~~~~~~
The diag keyword to MouseTrap can be used to give input event diagnostics to
a remote terminal attached via a null-modem cable. This can either be a
standard package such as NComm running with appropriate baud-rate and
handshake options, or it can be another copy of MouseTrap running in 'master'
mode. The format of a typical diagnostic message is as follows:
RawMouse: Cl=2 Sb=0 Cd=$FF Ql=$8000 X=0 Y=8 Tm=447496928.860541
where the various symbols stand for Class, Sub-class, Code, Qualifier, X, Y,
and Time-stamp. You can chose whether to ignore timer events in diagnostics
(diag 1), or whether to give diagnostics for everything including timer (diag
2).
TTFN... DaveP.