From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,45e26111d672df77 X-Google-Attributes: gid103376,public From: tmoran@bix.com (Tom Moran) Subject: Re: Joystick control Date: 1999/05/06 Message-ID: <3731cfee.1463515@news.pacbell.net>#1/1 X-Deja-AN: 474816050 References: <7gqmd1$imo$1@nnrp1.deja.com> X-Complaints-To: abuse@pacbell.net X-Trace: typhoon-sf.snfc21.pbi.net 926011856 207.214.211.121 (Thu, 06 May 1999 10:30:56 PDT) Organization: SBC Internet Services NNTP-Posting-Date: Thu, 06 May 1999 10:30:56 PDT Newsgroups: comp.lang.ada Date: 1999-05-06T00:00:00+00:00 List-Id: >I am trying to write an application that supports a joystick. My ancient DOS code for joystick buttons is type joybuttons is record button_a:boolean; button_b:boolean; button_c:boolean; button_d:boolean; end record; for joybuttons use record button_a at 0 range 7 .. 7; button_b at 0 range 6 .. 6; button_c at 0 range 5 .. 5; button_d at 0 range 4 .. 4; end record; function joy return joybuttons is b:byte; function convert is new unchecked_conversion(byte, joybuttons); begin inport(16#200#, b); return convert(b); end joy; Getting x,y positions at that level is less convenient because basically you have to send a byte, then see how long it takes for different bits to become 1 - time is proportional to coordinate. An easier way is to do an interrupt 16#15# with AX = 16#84#. If DX = 0 you'll get "joybuttons" back in AL, if DX = 1 you'll get x,y of joystick one back in AX,BX, and x,y of joystick two in CX,DX. I don't include that code here because calling an interrupt is even more compiler library specific than "inport" IO. Of course if you are running under an OS that insulates you from the joystick, you'll have to look in that OS's docs to see how to input joystick info.