|
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]
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.
|