[A89] Re: =?iso-8859-1?q?=5Frowread=28=29?=


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

[A89] Re: =?iso-8859-1?q?=5Frowread=28=29?=




-------------------
> Thanks Scott.  I'll try that little formula.  I also have one more
question.  
> In the working program I wrote from the information I found in the
examples, 
> I made a simple sprite move around the screen using the arrows. 
There is 
> only one problem.  The sprite moves so fast that it looks like it is
just 
> jumping from one side of the screen to the other.  How do i go about
stopping 
> this?  I tried using a countdown timer and registering it with 1,
but that 
> slowed it down way too much.  Any ideas?  Thanks!
> 
> CalenWakefield
> 
> 
> 
> 

Are you using low-level keyboard reading? If so, then the program
probably thinks you are holding the key down when in fact you are not.

The timer functions are too slow. They have interrupts only in the
1/20 multiples. Int 1 runs 495 times/sec, or 495 Hz. Wish timers were
based on that... Oh well...

Anyway, one think you might try is 1) a short loop that does nothing
(waits for the keypress to dissipate), or 2) wait until the keypress
no longer registers (this may have some odd side effects though --
worked okay for me though).

So, for option 1, we have two vars.

void delay(void) {
  short int l1, l2 = 0;

  for (l1 = 0; l1 < 20000; l1++) {
    for (l2 = 25000; l2 >= 0; l2--) {
    }
  }

  // you'll probably need to play with those values...
  // they may be different on the TI-89 from the TI-92+, and hw1 from
hw2
}

It may be better to wait until the key is no longer being registered,
however, this means the user cannot hold down the key. This may be
bad...

while (_rowread(ROW) & key);

That line just waits until the keypress is dissipated (well, until it
no longer registers)...

This should take so little time that it won't be noticable. No more
than half a nanosecond.

This may have side-effects though...

Also, it may be good to disable interrupts 1 and 5.

Anyway, hope this helps. If not, I guess I didn't answer the right
question.

John David Ratliff
jdratlif@cs.indiana.edu



References: