delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/02/26/18:27:36

Message-ID: <34F5F9BF.19D6@teleline.es>
Date: Fri, 27 Feb 1998 00:24:48 +0100
From: Mariano Alvarez Fernández <malfer AT teleline DOT es>
Reply-To: malfer AT teleline DOT es
Organization: teleline.es
MIME-Version: 1.0
To: jgh AT dcs DOT ed DOT ac DOT uk
CC: djgpp AT delorie DOT com
Subject: RE: Analogue Joystick

Este es un mensaje multipartes en formato MIME.

--------------71F65E5D4D64
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

I want this little code can help you. It's for Turbo C, but i suppose
it's easy to convert to Djgpp.

--------------71F65E5D4D64
Content-Type: text/plain; charset=us-ascii; name="Testjoy.c"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="Testjoy.c"

/**************************************************************/
/*  TESTYOY Muestra en pantalla los valores X, Y del joy y el */
/*  estado de los pulsadores                                  */
/*  Mariano Alvarez 1990                                      */
/**************************************************************/

#include <stdio.h>
#include <dos.h>
#include <conio.h>

main()
{
  int x, y, boton1, boton2, botones, c;
  while( ! kbhit() ){
    _AH = 0x84;
    _DX = 1;
    geninterrupt( 0x15 );
    x = _AX;
    y = _BX;
    _AH = 0x84;
    _DX = 0;
    geninterrupt( 0x15 );
    botones = _AL;
    boton1 = (botones & 16) ? 1 : 0;
    boton2 = (botones & 32) ? 1 : 0;
    printf( "%6i %6i %6i %6i\n",x,y,boton1,boton2 );
    delay( 100 );
    }
  c = getch();
}



--------------71F65E5D4D64--


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019