[Coco] CoCo joystk() Routine

Arthur Flexser flexser at fiu.edu
Fri Dec 7 20:06:28 EST 2007


I'd expect that the extra time to scan 4 axes rather than one would be pretty
negligible compared with how long it takes the joystick to move from one
position to another that has a distinguishably different reading.  So, my guess
is you wouldn't improve the responsiveness of the joystick noticeably by doing
this.  I'd be curious if you see any improvement.

Art

On Fri, 7 Dec 2007, Joel Ewy wrote:

> Thanks Robert,  that's what I was looking for.  Wouldn't tightening up
> this routine also have a (linear) effect on overall runtime?  Looks like
> I'd better take a look at the 'Unravelled' book.
> 
> JCE
> 
> 
> Robert Gault wrote:
> > Joel Ewy wrote:
> >> Hey all,
> >>
> >> I seem to remember something about the CoCo BASIC ROM sampling all
> >> joystick axes when you use joystk() to read one of them.  Is there a
> >> relatively simple fix for that (assuming CoCo 3 or 64K CoCo 1/2 in
> >> all-RAM mode of course)?
> >>
> >> JCE
> >>
> >
> > With a caveat, what you want can be done. First, the only reason for
> > doing this would be you can't sample fast enough for your purpose. If
> > that is the case, you can only get a speed-up by a factor of 4 by
> > sampling a single stick and axis. Second, the ROM routine samples 10
> > times to make sure there is no "bounce" in the results. You might
> > choose to sample all four sticks but fewer times to get a good value.
> > Third, the ROM only samples the sticks when you request data for
> > axis#0. otherwise it just reads stored values. Fresh values require
> > all four axis to be read.
> >
> >  The joystick routine is at $A9CA-$AA19. It can be separated into
> > several parts. 1) Check for illegal axis #. 2) Check for axis#0 to
> > select refresh or stored data read. 3) Sample an axis 10 times for a
> > match. 4) Shift to next axis. You probably will want to keep 1) and 3)
> > but discard 2) and 4), if I read your request correctly.
> >  So, at $A9D0 is a bne $A9D4 which needs to be changed to a brn or
> > completely nop'd out to remove 1). For a single byte correction, POKE
> > &HA9D0,&H21.
> >  At $A9E3 there is a ldb #3 which preselects the axis to be read and
> > will later be decremented to get all axes. Here you must enter the
> > specific axis you want read, 0, 1, 2, or 3; POKE &HA9E4,axis#. This
> > must be changed each time you want to select a different axis. At
> > $AA17, is a bpl $A9E5 if all axes have not been read. This needs to be
> > a brn or nop'd so POKE &HAA17,&H21. Now 4) has been removed from the
> > ROM routine.
> >
> > -- 
> > Coco mailing list
> > Coco at maltedmedia.com
> > http://five.pairlist.net/mailman/listinfo/coco
> >
> 
> 
> --
> Coco mailing list
> Coco at maltedmedia.com
> http://five.pairlist.net/mailman/listinfo/coco
> 




More information about the Coco mailing list