DECLARE SUB getJoy (x AS INTEGER, y AS INTEGER, x2 AS INTEGER, y2 AS INTEGER, b AS INTEGER) '$INCLUDE: 'QB.BI' DIM x AS INTEGER, y AS INTEGER DIM x2 AS INTEGER, y2 AS INTEGER DIM b AS INTEGER DO getJoy x, y, x2, y2, b LOCATE 1, 1 PRINT "Sticks (" + LTRIM$(STR$(x)) + ", " + LTRIM$(STR$(y)) + ") " PRINT "Buttons"; FOR j% = 0 TO 3 PRINT SGN(b AND (2 ^ j%)); NEXT j% LOOP UNTIL LEN(INKEY$) SUB getJoy (x AS INTEGER, y AS INTEGER, z AS INTEGER, t AS INTEGER, b AS INTEGER) DIM reg AS regTypeX ' get buttons (bitflags) ' &h01 - joystick 1 button 1, or "A" on XBox 360 controller ' &h02 - joystick 1 button 2, or "B" on XBox 360 controller ' &h04 - joystick 2 button 1, or "X" on XBox 360 controller ' &h08 - joystick 2 button 2, or "Y" on XBox 360 controller reg.ax = &H8400 reg.dx = 0 CALL interruptX(&H15, reg, reg) b = &HF XOR (((reg.ax AND &HFF) \ 16) AND &HF) ' get sticks reg.ax = &H8400 reg.dx = 1 CALL interruptX(&H15, reg, reg) x = reg.ax ' joystick 1 stick X, or left analog stick X on XBox 360 controller y = reg.bx ' joystick 1 stick Y, or left analog stick Y on XBox 360 controller t = reg.cx ' joystick 2 stick X, or triggers balance on XBox 360 controller z = reg.dx ' joystick 2 stick Y, or right analog stick Y on XBox 360 controller END SUB