[comp.sys.atari.st] Using joystick and mouse

fk@vall.dsv.su.se (Fredrik Kilander) (06/27/90)

Could someone be kind enough to supply me some pointers to the canonical
way of getting access to the mouse and joystick information. I know there
is a VDI call which returns the mouse position and button state but
I'd rather grab the info first hand.

The current set of ideas that I entertain involve the following steps:

	a) Save the vectors to the installed mouse and joystick
	   packet handlers.
	b) Save the current state of the keyboard processor
	   and tell it to stop reporting events
	c) Install vectors to my own mouse and joystick packet handler
	d) Tell the keyboard to start reporting again, including any
	   application specific properties of mouse and joystick

	e) Process input until its time to shut down.

	f) Stop the keyboard processor
	g) Reinstall the original keyboard packet handler vectors
	h) Restore the previous state of the keyboard processor
	   and tell it to start reporting events

The above procedure is my general outline of how to do it. If you know
any simpler method, please tell me. Also, I'm interested in the properties
and constraints put upon a packet handler. I seem to remember that one
must return within 1 ms, but how are the arguments organized? Does TOS
prepare the data from the keyboard processor in any way before handling
them to the packet handler?

I don't want to read mouse coordinates out of some TOS-version
specific protected memory location. What I want is to process the
messages as soon as they arrive. In particular I hope to estimate
joystick motion velocities by measuring the interval between
close/open packets. Any references to such techniques would be highly
appreciated. I am using Sozobon C, writing in C and assembler, on a
1040 STFM, TOS 1.0.

	Fredrik Kilander