💾 Archived View for mirrors.apple2.org.za › archive › ground.icaen.uiowa.edu › MiscInfo › Hardware ›… captured on 2024-07-09 at 05:01:46.

View Raw

More Information

⬅️ Previous capture (2023-06-14)

-=-=-=-=-=-=-

Path: blue.weeg.uiowa.edu!news.uiowa.edu!hobbes.physics.uiowa.edu!newsfeed.ksu.ksu.edu!moe.ksu.ksu.edu!vixen.cso.uiuc.edu!uwm.edu!cs.utexas.edu!usc!nic-nac.CSU.net!csulb.edu!paris.ics.uci.edu!clyde.ics.uci.edu!jlee
From: jlee@ics.uci.edu (Orion Pax)
Newsgroups: comp.sys.apple2.programmer
Subject: Re: Joystick Code... Help Please!
Date: 26 Nov 1994 06:32:24 GMT
Organization: Creative 'Ware @ University of California, Irvine
Lines: 59
Message-ID: <3b6kpo$oos@paris.ics.uci.edu>
References: <3b37bu$8ag@condor.ic.net>
NNTP-Posting-Host: clyde.ics.uci.edu
X-Newsreader: TIN [version 1.2 PL2]

Shawn Platkus (platkus@ic.net) wrote:
: I'm in need of some code to read the joystick values from 65816 assembly.

Here's the code I copied from Out of This World and used in Star Command GS:

readJoystick	START

       php                  ; save states of cpu
       phd
       pea $100             ; put maxReadBound on stack (values max at $FF)
       tsc                  ; point dp to maxReadBound
       tcd
       sei                  ; interrupts off
       lda >$C070           ; reset joystick i/o timer
       ldx #0               ; zero counters	
       txy
readLup anop
       lda >$C064           ; read x/y axises
       and #$8080
       beq quit             ; if neither valid, quit
checkY anop
       asl a
       bcc ySpinWheels      ; if invalid y, do dummy code for dummy cycle time
       iny                  ; else increment y counter
       bra checkX
ySpinWheels anop            ; dummy code of similiar cycle time
       nop
       nop
       nop
checkX anop
       asl a
       beq xSpinWheels      ; if invalidx, do dummy code for dummy cycle time
       inx
       bra maxDec
xSpinWheels anop            ; dummy code of similiar cycle time
       nop
       nop
       nop
maxDec anop
       dec <1               ; this makes sure values are <= 255
       bne readLup
quit anop
       pla
       pld                  ; restore cpu state
       plp
       rtl
       END

Joseph
--
jlee@clyde.ics.uci.edu   | Have you watched your Koko wa GreenWood, Yotoden,
-------------------------+ Gundam 0083, Bubble Gum Crisis/Crash!, Video Girl
II(> Creative 'Ware <)II | Ai, Tenchi Miyou, Ah! My Goddess, Maison Ikkoku,
 Cal-Animage Epsilon VP  | PatLabor, Ranma 1/2, and Five Star Stories today?