Short: Read the joystick buttons in ARexx Author: fox@ridhughz.demon.co.uk (Ridwan Hughes) Uploader: fox@ridhughz.demon.co.uk (Ridwan Hughes) Type: util/rexx I once found out how to read/write the parallel port in ARexx and wrote a simple level meter for 8bit sound samplers, but as my 2 Amigas are linked through the parallel port it means I can't use it for inputting with so I looked at reading the 5 inputs from the joystick port as I don't use that, and after a little help (thanks Neko for the docs) I figured out how to read the joystick port in arexx. It's dead dead dead dead simple, just add these lines into your ARexx script whenever you need to read the joystick port: /* reading a joystick plugged into the mouse port */ mem=import('00df f00a'x,2) j0u=bittst(c2b(bitxor(bittst(mem,9),bittst(mem,8))),0) j0d=bittst(c2b(bitxor(bittst(mem,1),bittst(mem,0))),0) j0l=bittst(mem,9) j0r=bittst(mem,1) j0f=1-bittst(import('00bf e041'x,1),6) /* reading a joystick plugged into the joystick port */ mem=import('00df f00c'x,2) j1u=bittst(c2b(bitxor(bittst(mem,9),bittst(mem,8))),0) j1d=bittst(c2b(bitxor(bittst(mem,1),bittst(mem,0))),0) j1l=bittst(mem,9) j1r=bittst(mem,1) j1f=1-bittst(import('00bf e041'x,1),7) j0f is joystick port 0 fire button (the left mouse basically) j1f is joystick port 1 fire button (the normal joystick fire) figure the rest out for yourself :) The variables return 0 or 1 for the state of the button. With this kind of input you can put manual switches into an old joystick lead which will enable you to "physically" configure programs, you could have an ARexx script on bootup sensing a switch on the joystick port which then would execute separate scripts according to the switch position. Myself, I'll at first be using it to set wether I'm in front of the computer or away/asleep as when my computer is online it has scripts to keep it on IRC & ICQ, the switch would control wether I'm '/away' on IRC and 'Not Available' on ICQ. have fun Rid