please dont rip this site
;
; Read PC joystick (game) port: int joystick(int results[4], char flags)
;   results = Integer array to receive the AX, AY, BX, and BY values
;   flags   = Bits 0,1,2,3 = Disable AX,AY,BX,BY       (1 = Disable)
;   Returns : Bits 0,1,2,3 = Error reading AX,AY,BX,BY (1 = Error)
;             Bits 4,5,6,7 = Buttons A1,A2,B1,B2       (0 = Pressed)
;
; Values placed in 'results' will range from 0 to 'n', where 'n' is
; dependant on the speed of the hardware. Experiment with your system
; to determine the actual maximum values, and scale the results to
; the range of measurements you are taking.
;
; To add to DDS MICROC-C 8086 library: CD to LIB86 subdirectory, copy in
; this file, and issue the commands: (omit memory models you don't want)
;       slib i=tiny    a=joystick
;       slib i=small   a=joystick
;
; Copyright 1989-2000 Dave Dunfield
; All rights reserved.
;
; Permission granted for personal (non-commercial) use only.
;
joystick MOV    BX,SP           ;Address parms
        MOV     AH,2[BX]        ;Get mask flags
        MOV     BX,4[BX]        ;Get array address
        MOV     DX,#$0201       ;Address game port
        XOR     CX,CX           ;Zero initial count
        AND     AX,#$0F00       ;Mask AH, AL=0
        OUT     DX,AL           ;Write to I/O port
?1      IN      AL,DX           ;Read I/O port
        OR      AL,AH           ;Mask already received ports
        TEST    AL,#$01         ;AX bit set
        JNZ     ?2              ;No, its not
        MOV     [BX],CX         ;Save position
        OR      AH,#$01         ;Disable further AX
?2      TEST    AL,#$02         ;AY bit set
        JNZ     ?3              ;No, try next
        MOV     2[BX],CX        ;Save position
        OR      AH,#$02         ;Disable further AY
?3      TEST    AL,#$04         ;BX bit set?
        JNZ     ?4              ;No, try next
        MOV     4[BX],CX        ;Save position
        OR      AH,#$04         ;Disable further BX
?4      TEST    AL,#$08         ;BY bit set?
        JNZ     ?5              ;No, try next
        MOV     6[BX],CX        ;Save position
        OR      AH,#$08         ;Disable further BY
?5      INC     CX              ;Advance count
        JZ      ?6              ;Overflow...
        CMP     AH,#$0F         ;All bits set?
        JNZ     ?1              ;No, keep looking
?6      NOT     AH              ;Invert bits
        AND     AL,AH           ;Set flags
        XOR     AH,AH           ;Zero high
        RET

file: /Techref/com/dunfield/ftp/embedpc/joystick_asm.htm, 5KB, , updated: 2002/11/1 16:54, local time: 2017/11/22 20:00,
TOP NEW HELP FIND: 
54.224.168.206:LOG IN

 ©2017 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE! / 

<A HREF="http://www.piclist.com/techref/com/dunfield/ftp/embedpc/joystick_asm.htm"> Joystick.asm </A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

  PICList 2017 contributors:
o List host: MIT, Site host massmind.org, Top posters @20171122 RussellMc, Van Horn, David, James Cameron, Sean Breheny, alan.b.pearce, IVP, Neil, David C Brown, Bob Blick, Denny Esterline,
* Page Editors: James Newton, David Cary, and YOU!
* Roman Black of Black Robotics donates from sales of Linistep stepper controller kits.
* Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters.
* Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated!
* Contributors: Richard Seriani, Sr.
 

Welcome to www.piclist.com!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .