[Coco] Detecting Shift key.
Joel Rees
joel.rees at gmail.com
Fri Sep 22 14:16:17 EDT 2017
2017/09/22 22:09 "Dave Philipsen" <dave at davebiz.com>:
>
> That's a pretty crude debounce routine and for the original intention
it's probably not needed. A more robust routine would do more than just
check for the same result a couple of microseconds later.
>
> Dave
>
> > On Sep 22, 2017, at 7:36 AM, Johann Klasek <johann+coco at klasek.at>
wrote:
> >
> >> On Fri, Sep 22, 2017 at 12:06:04PM +0200, Tormod Volden wrote:
> >>> On Fri, Sep 22, 2017 at 2:39 AM, Steven Wallis wrote:
> >> [..]
> >> This will work on all machines to detect shift:
> >
> > How about to debouce? Could this be done like this?
> > Added the "wait for shift" line in case one waits until
> > the shift key is pressed ...
> > Would these modifications of any value?
> >
> >>
> >> ldb #$7F ; pull down row containing shift
> >> stb $FF02
> > wait
> >> ldb $FF00
> > cmpb $FF00
> > bne wait ; debounce
> >> comb
> >> andb #$40 ; check column containing shift
> > beq wait ; wait for shift
> >
> >> bne gocmdl ; return if shift key pressed
> >
> > Johann
This ancient diver framework I wrote for a college class may provide some
insight as to handle the keyboard without wasting CPU cycles riding it, and
providing true debounce.
On the other hand, just checking on whether the shift key is pressed
doesn't really need debounce. And this should also provide reference on how
to do that.
https://ja.osdn.net/users/reiisi/pf/jmr6809bos/
https://ja.osdn.net/users/reiisi/pf/jmr6809bos/scm/tree/master/
https://ja.osdn.net/users/reiisi/pf/jmr6809bos/scm/blobs/master/oswind3test.as9
It's written for the Coco, so certain constants would need to be changed
for the Dragon.
More information about the Coco
mailing list