83Plus:Software:usb8x/Asm Interface/Pad/PadSetup

From WikiTI
Revision as of 18:50, 9 September 2006 by Dan Englender (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Synopsis

Name: PadSetup

Minimum usb8x version: 0.11

Gets an offset and bitmask to help map buttons to functions.

Inputs

None

Outputs

  • B: Offset byte
  • C: Bit mask
  • NC: Success

Destroys

  • AF, BC, DE, HL

Notes

Be sure to initialize the gamepad driver with [[../PadInit|PadInit]] before using this routine.

PadSetup waits for the user to press a button on the gamepad, and then returns the byte offset into the data array and the bit mask to use to check for that button. You can use this information to determine, from the data passed to the callback function, whether a particular button is being pressed.

PadSetup will return failure if any one of the following conditions occurs:

  1. PadSetup cannot determine the offset and bitmask for the button pressed. This means the gamepad is either incompatible or that particular button is not reported in a way that the gamepad driver understands. Analog sticks, for example, will probably not be correctly read by the gamepad driver.
  2. The function times out (timeout occurs after about 2 seconds). On failure, you can call the function a couple of times to reach the timeout length you would like.
  3. The user has pressed the [on] button.

See Also

  • [[../PadStart|PadStart]] - Start relaying gamepad data to the callback function.