From jbye@acorn.co.uk Wed Jan 27 18:20:55 1993 From: jbye@acorn.co.uk (James) Newsgroups: comp.sys.acorn Subject: Re: Joystick SWIs Date: 14 Jul 92 07:33:50 GMT Organization: Acorn Computers Ltd, Cambridge, England In article <1992Jul13.144102.29178@cs.nott.ac.uk> smb@cs.nott.ac.uk (Simon Burrows) writes: > >I would be most grateful if some kind person could post details of the >official Acorn joystick SWIs. I am developing some software, and it would >be most foolish not to incorporate support for the Acorn SWIs. > >Thanks in advance, > >Simon. And just to be a kind person, here is the documentation attached on the end of this posting. --James ----------------- 8< cut here 8< --------------------------------------- SWI Interface for Joystick Devices ---------------------------------- The Joystick module provides a SWI interface for reading the state of a joystick. When the module initialises, it tests for the existence of built-in joystick hardware and if it does not find any then it will not initialise. Third parties can replace this module to provide support for different hardware. It is recommended that any such modules have version numbers greater than 2.00 so that Acorn can upgrade its own module without preventing its replacement. SWI Joystick_Read (SWI &43F40) ------------------------------- Returns the state of a joystick. On entry: R0 = joystick number On exit: R0 = joystick state Interrupts: Interrupt status is not altered Processor mode: Processor is in SVC mode Re-entrancy: Not defined Use: This SWI is used to obtain the state of the requested joystick. The state is returned in the following format: Byte 0: signed Y value (range -127 to 127) -64, 0 or 64 for single switch joystick (corresponds to Down, Rest, Up). Byte 1: signed X value (range -127 to 127) -64, 0 or 64 for single switch joystick (corresponds to Left, Rest, Right). Byte 2: Switches (e.g. fire buttons) starting in bit 0, unimplemented switches return 0. Byte 3: Reserved. Note that this format allows both digital and analogue devices to be supported. Applications which are only interested in state (up, down, left, right) should not simply test the bytes for positive, negative or zero. It is recommended that the 'at rest' state should span a middle range, say from -32 to 32 since analogue joysticks cannot be relied upon to produce 0 when at rest.