howdy, all.
a year ago, tom kuurstra posted a question about how to get faster
keyboard response. various suggestions were made, but no conclusions
were drawn.
http://www.powerbasic.com/support/pb...ead.php?t=1206
i've recently had to look into the same question and have come up with
some answers. i'm doing a dedicated test unit and use a soyo k7vem motherboard
with a 1 ghz piii, w98se, and use the isa bus for hardware control.
this allows me to look at system performance on a scope by issuing io writes and
looking for the pulses.
first, both inkey$ and instat give the same abysmal performance.
do while instat
out &h210,0
loop
a$ = inkey$
runs in about 55 milliseconds.
using inkey$ produces the same result.
and i don't think that it's a coincidence that this is an 18-hz rate. it seems clear
that both functions are mediated by the system clock. presumably, either command
causes a wait until the system clock occurs, which will be essentially a random wait
of from 0 - 55 msec, depending on exactly when the command occurs.
if, instead, i look at io address &h60, things get a _lot_ better. the following loop:
do while ((x% <> 0) and (x% < 128)) 'looking for x% < 128 avoids responding to key release
x% = inp(&h60)
out &h210,0 'this is just my port write address
loop
a$ = inkey$ 'remember to flush the buffer
runs in 8 microseconds. that's nearly 4 orders of magnitude improvement.
i hope this comes in handy for someone.
jim martin
------------------
a year ago, tom kuurstra posted a question about how to get faster
keyboard response. various suggestions were made, but no conclusions
were drawn.
http://www.powerbasic.com/support/pb...ead.php?t=1206
i've recently had to look into the same question and have come up with
some answers. i'm doing a dedicated test unit and use a soyo k7vem motherboard
with a 1 ghz piii, w98se, and use the isa bus for hardware control.
this allows me to look at system performance on a scope by issuing io writes and
looking for the pulses.
first, both inkey$ and instat give the same abysmal performance.
do while instat
out &h210,0
loop
a$ = inkey$
runs in about 55 milliseconds.
using inkey$ produces the same result.
and i don't think that it's a coincidence that this is an 18-hz rate. it seems clear
that both functions are mediated by the system clock. presumably, either command
causes a wait until the system clock occurs, which will be essentially a random wait
of from 0 - 55 msec, depending on exactly when the command occurs.
if, instead, i look at io address &h60, things get a _lot_ better. the following loop:
do while ((x% <> 0) and (x% < 128)) 'looking for x% < 128 avoids responding to key release
x% = inp(&h60)
out &h210,0 'this is just my port write address
loop
a$ = inkey$ 'remember to flush the buffer
runs in 8 microseconds. that's nearly 4 orders of magnitude improvement.
i hope this comes in handy for someone.
jim martin
------------------
Comment