[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reading Joystick Position




On Mon, 18 Nov 2002 20:51:36 -0600 "Joel" <joelbuckley54.nospam.@hotmail.com> wrote:
 
> You have the right addresses, but the wrong technique.
> Accessing $C070 (49266) starts a quad timer (all four Paddle inputs).
> The paddles provide the R in an RC time constant.
> The timer outputs show up as the hi bit of those 4 addresses.
> After the timers time out, the hi bit goes from high to low.
> A software timing loop determines the PDL value.
> It's fast (12 microseconds per tic), so you can't duplicate this with Peeks
> from Applesoft.
> Here's the routine.
> $FB1E
> PREAD LDA $C070 start timers, enter with paddle # in X
>  LDY #0
>  NOP
>  NOP
> PREAD2 LDA $C064,X
>  BPL RTS2D
>  INY
>  BNE PREAD2
>  DEY ; 255 max
> RTS2D RTS

Hmmm. think I've got it: to get the X-Y coords of the Joystick, I would
need to call this routine twice with LDX #0 and LDX #1 respectively. 
Each time thru I would need to return to sender and store $C064,X.
If this works the way I think it does, then it is possible to read 
either coordinate seperately.
Is this routine part of ProDOS or BASIC.SYSTEM or would I need to make
it part of my program?
SW