Dead Hackers Society
Other BBSes »
 
 
Demoscene  Coding  CT60  Buy/sell

Atari coding BBS
 
Re: ESC Key
Posted by: Mr.Styckx Jan,09.2011-23:29 

In all the cases, you always read byte from ikbd one byte at a time, each time you pull one byte, the next one is made available in fffc02, it is not lost.

So, the correct way should be to test bit 0 of fffc00 to see if data were received (pseudo code) and ignore following bytes if needed :

wait_ikbd
btst #0,$fffffc00.w
bne.s wait_ikbd

move.b $fffc02,d0

if (nb_bytes_to_ignore > 0)
nb_bytes_to_ignore = nb_bytes_to_ignore - 1
bra.s wait_ikbd

if (d0 between f6 and ff)
<set nb_bytes_to_ignore>
bra.s wait_ikbd

;-- now you should have a real key value (up or down)
cmp.b #1,d0 ; escape
beq.s done

bra.s wait_ikbd

done:
<do whatever you want>
rts


But I agree most of the time, when waiting for space key, we just do :

wait_space:
cmp.b #32,$fffc02
bne.s wait_space


As told by someone else, this works because you rarely move your mouse 32 units with a normal move (but you can try moving it really fast and you will simulate a space bar pressing)


Nicolas







[All messages in this thread]    [Start new thread]

Topic Posted by  Date 
ESC Key quackmore Jan,06.2011-02:47
  Re: ESC Key ggn Jan,06.2011-10:55
    Re: ESC Key quackmore Jan,07.2011-07:10
      Re: ESC Key mikro Jan,07.2011-16:18
        Re: ESC Key ggn Jan,07.2011-22:51
          Re: ESC Key PeP Jan,08.2011-01:17
            Re: ESC Key defjam Jan,08.2011-17:17
              Re: ESC Key Mr.Styckx Jan,09.2011-23:29
                Re: ESC Key quackmore Jan,10.2011-00:29


Reply to this message
Name:
Topic:
Anti-troll code:

Message:

What's the anti-troll code?
That's your personal code to be able to add comments and messages on the dhs.nu site.
Don't have a code or forgot it? Fix it here.
© 1994-2024 Dead Hackers Society Contact: Anders Eriksson