Re: A83: About Input again ..


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

Re: A83: About Input again ..




>Hi ... 
>I found the PaneJump (PlainJump) input routine that you seggeested and 
>it does work in the game. I don`t understand it though.


> push bc
> ld a,$FE
> out (1),a
> in a,(1)
> ld b,a
> ld a,$BF
> out (1),a
> in a,(1)
> or $0F
> and b
> pop bc

  I don't really know but...

    The above code originally came from the 85 routine, OTH_ARROW. Using 
the keyboard handler, it detects all the keys simulataneously from a 
from a particular collumn(row?).
  Using the bits, multiple keys can be tested all at once. For contrary 
example:
   call $4014  ;GET_KEY
   cp $36      ;Test Mode
   jr z,fire   ;Go here if detected
   cp $09      ;Test Enter
   jr z,fire2  ;Go here if detected

  If you press MODE and ENTER at the same time, only the MODE action 
will be activated because GET_KEY only returns one value, and the z-flag 
only tests for one value.

OTH_ARROW works like this:
    call OTH_ARROW ;Call routine above
    bit 0,a        ;test down key
    jr z,down      ;down action
    bit 1,a        ;test for left as well
    jr z,left      ;left action
    bit 2,a        ;also test for Right
    jr z,Right     ;do right action
      ...and so on

  The bits are:      
DOWN  = 0
LEFT  = 1
RIGHT = 2
UP    = 3
Y=    = 4
2ND   = 5
MODE  = 6
DEL   = 7

   So using OTH_ARROW, these 8 buttons are detected simulataneously. If 
you need to test for other keys, you can use the key handler, but 
multiple key checks won't be supported(this is useful when using CLEAR 
as an exit key, but it sucks when you want to use ALPHA as an action 
key).
   Hope that helps...
  Sam

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com