A86: GET_KEY bug?
[Prev][Next][Index][Thread]
A86: GET_KEY bug?
David Piper and I were working on an input routine for the
chess/checkers program. I prefer _getkey to GET_KEY, but we had to use
GET_KEY. The reason is that _getkey seems to wait for a key, and we
needed to make something blink while waiting for the input. Anyway,
there was a bad bug in our counter register, b, which I eventually
traced to GET_KEY. I wrote a test program and was suprised by the
results:
;why doesn't this print an 'A'?
ld b,'A' ;'A' in b
loop: call GET_KEY ;get key, 0 for none
jr z,loop ;if no key, loop
ld a,b ;put b in a
call _putc ;print char in a
For some reason, if I take out the loop, it works! I think it could be
because the only part of GET_KEY that modifies b is the part that
executes when a key is pressed. Is this a bug in TASM or GET_KEY? Or am
I doing something wrong? I thought everybody might like to know, if they
don't already, because it cost me several of hours of time trying to
find the problem.