Re: A86: Re: Key input


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

Re: A86: Re: Key input




this code would be better if it used bit testing rather than 'cp'
instructions... then it could test more than one key at a time. MAKE
SURE YOU PUT A HALT IN FRONT OF IT!

Ahmed El-Helw wrote:
> 
> how about direct input?  it is the fastest and only way as far as I know..
> here is an ex:
> 
> ld  a,0ffh   ;Reset keyport
>  out  (1),a   ;Clear Port
>  ld  a,0feh   ;Load desired port
>  out     (1),a   ;Clear Keys
>  in  a,(1)   ;Input Key
>  cp 251   ;If key is right
>  jp  z,GunRight  ;Goto Right
>  cp  253   ;If key is left
>  jp  z,GunLeft  ;Goto Left
>  cp 247   ;Is it key Up
>  jp z,GunUp   ;Move Up
>  cp 254   ;Is it Down
>  jp z,GunDown  ;Move Down
>  ld  a,0ffh   ;Reset keyport
>  out  (1),a   ;Clear Port
>  ld  a,0bfh   ;Load desired port
>  out     (1),a   ;Clear Keys
>  in  a,(1)   ;Input Key
>  cp  223   ;Is it 2nd
>  jp  z,shoot   ;Shoot if so
>  cp 127   ;Is it delete
>  jp z,QuickPause  ;Pause
>  cp 191   ;Is it Exit [Note - would result in Key Mode on 83]
>  ret z   ;Return from Program if so
>  jp nz,NoKey  ;NoKey Otherwise
> 
> --From DuckHunt
> 
> Hope this helps...
> Ahmed
> -----Original Message-----
> From: BIOSERRORS <BIOSERRORS@aol.com>
> To: assembly-86@lists.ticalc.org <assembly-86@lists.ticalc.org>
> Date: Saturday, May 16, 1998 11:48 PM
> Subject: A86: Key input
> 
> >
> >What's the best way to read simultaneous key presses?  Especially,
> down+left
> >at the same time.  I know how to read directly from the port, but I don't
> know
> >how to read more than one keypress at a time.
> >

-- 

=====================================
=                                   =
=   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: