Re: A86: Keyboard using ports


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

Re: A86: Keyboard using ports




it's better to use HALT. even though DI and EI work, using HALT has the
same effect and also conserves battery power. example:

halt

ld a,bitmask1
out (1),a
in a,(1)
bit x,a
jr z,routine
bit x,a
jr z,routine

ld a,bitmask2
out (1),a
in a,(1)
bit x,a
jr z,routine
bit x,a
jr z,routine

.
.
.

David Phillips wrote:
> 
> Is that so the in isn't executed until right after an interrupt occurs?
> Then why not just:
> 
> di
> out (1),a
> in a,(1)
> ei
> 
> At 03:53 PM 5/14/98 -0600, you wrote:
> >
> >be sure to put a HALT command just before checking the 0 port (only once
> >each time you check all the keys you want). if an interrupt occurs
> >during your key check routine (which is actually quite possible if
> >you're checking a lot of keys) then the 0 port may be reset and the port
> >won't read right. also be sure you're using reverse logic for the bits.
> >
> >David Phillips wrote:
> >>
> >> I'm reading in keys, second and arrows, using ports and can't get the right
> >> results.  While the arrows are held and second is pressed, the arrows keep
> >> reporting being pressed.  But when you let up on second, the arrows also
> >> report being let up, even though it's been pressed the entire time.  The
> >> only call to _getkey is for exit, and removing it doesn't help.  I also
> >> threw in a couple of nop's in-between out and in, but it didn't help.  Any
> >> ideas?
> >>
> >> // David Phillips
> >> // mailto:electrum@tfs.net
> >> // AIM: electrum32
> >
> >--
> >
> >=====================================
> >=                                   =
> >=   Kirk Meyer (mailto:_@ibm.net)   =
> >= http://www.bigfoot.com/~kirkmeyer =
> >=                                   =
> >=   "Set your affection on things   =
> >=    above, not on things on the    =
> >=      earth."  Colossians 3:2      =
> >=                                   =
> >=====================================
> >
> >
> 
> // David Phillips
> // mailto:electrum@tfs.net
> // AIM: electrum32

-- 

=====================================
=                                   =
=   Kirk Meyer (mailto:_@ibm.net)   =
= http://www.bigfoot.com/~kirkmeyer =
=                                   =
=   "Set your affection on things   =
=    above, not on things on the    =
=      earth."  Colossians 3:2      =
=                                   =
=====================================



References: