Hollosi Information eXchange /HIX/
HIX CODER 2074
Copyright (C) HIX
2004-05-09
Új cikk beküldése (a cikk tartalma az író felelőssége)
Megrendelés Lemondás
1 re: Game port programozasa (mind)  54 sor     (cikkei)

+ - re: Game port programozasa (mind) VÁLASZ  Feladó: (cikkei)

> Tudna valaki segiteni, hogy hogyan tudok a gameportrol erteket beolvasni (Tur
bo
>  Pascal, vagy Visual Basic nyelvben)?
Ime egy kis angol leiras. Ha csak digitalis gombokat akarsz beolvasni, 
az nagyon egyszeru - de csak 4 van beloluk. Ha nem jojstickot 
hasznalsz, hanem gamepadot, az kisse bonyolultabb. Van egy beepitett 
beolvasofuggveny - ha kell, elkuldom.

  Port 201H is designated as the Game Adapter Port or Joystick Port. 
It is not
  supported by the PC/XT BIOS, but the AT BIOS service INT 15H SubFn 84H
  provides an easy-to-use interface for the adapter.

  It is an analog-to-digital converter which can be used by scientific
  measuring tools and other devices which present an analog (resistive) 
input
  to the interface.  It accepts up to four digital inputs (on/off data 
such as
  the press of a button) and up to four resistive inputs (such as an 
X-ordinate
  of a Joystick or a temperature value from an electronic thermometer).

  The value obtained by an IN from 201H is as diagrammed:

  Í?7??6??5??4Ď?3??2??1??0Ě
  ?B2?B1?A2?A1?By?Bx?Ay?Ax?
  Ë???????????đ???????????Ż
   ??????????? ????????????? Coordinates (resistive, time-dependent inputs)
        ???????????????????? Buttons/Triggers (digital inputs)

  You can read the buttons (digital inputs)  with:

       mov   dx,201H
       out   dx,al      ;initiate transaction; AL=anything
       in    al,dx      ;read bits 4-7 for buttons: 0=pressed, 1=open

  The joysticks, paddles, measuring devices (resistive inputs) are read by
  tracking the time that an X or Y bit stays high (1) after an OUT 
201,xxx. To
  read an individual resistive input (eg, joystick A, X ordinate):

       mov   dx,201H
       out   dx,al      ;initiate transaction  AL=anything
       mov   cx,-1      ;set resistance counter for first loop
gain: in    al,dx      ;read the settings
       inc   cx         ;bump counter
       test  al,1       ;has X-ordinate for joystick A gone low?
       jnz   again      ;loop until it does (when bit=0, we're done)

  The delay value accumulated in CX will indicate the X-ordinate 
position of
  joystick A.  The resulting value is CPU-dependent.  To ensure 
accuracy, it
  would be better to use a hardware timer, rather than a loop counter.

AGYKONTROLL ALLAT AUTO AZSIA BUDAPEST CODER DOSZ FELVIDEK FILM FILOZOFIA FORUM GURU HANG HIPHOP HIRDETES HIRMONDO HIXDVD HUDOM HUNGARY JATEK KEP KONYHA KONYV KORNYESZ KUKKER KULTURA LINUX MAGELLAN MAHAL MOBIL MOKA MOZAIK NARANCS NARANCS1 NY NYELV OTTHON OTTHONKA PARA RANDI REJTVENY SCM SPORT SZABAD SZALON TANC TIPP TUDOMANY UK UTAZAS UTLEVEL VITA WEBMESTER WINDOWS