A89: Re: OSInitBetweenKeyDelay


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

A89: Re: OSInitBetweenKeyDelay




Hello!
    If you're disabling interrupts, you must be using the function
_rowread() to access the keyboard.  _rowread() accesses the keyboard
hardware directly and is not affected by OSInitBetweenKeyDelay().  You'll
have to calculate the delay "manually" within your program.  The way I do it
is:

int keydelay = 0;

// in the main loop, where the keypresses are checked
if (keydelay)
{
    keydelay--;
}
else
{
    // check keys
    if (a_key_is_pressed)
    {
        keydelay = 5000;
        // do whatever else you do when a key is pressed
    };
};

In this loop, after a key is pressed, you have to wait for the main loop to
go around 5000 times before keydelay is 0 and the keys are checked again.
You can expand this example to have two different key delays for different
keys.  For example, you could have one for the arrow keys and one for the
rotating keys (this is highly desireable in a Tetris type program).  There
could also be certain keys that are always checked, such as ESC.
There's probably a better way (I'm no expert), but this works fine for me.
Hope this helps!

----- Original Message -----
From: Bubba Stinky <BubbaStinky@netscape.net>
To: <assembly-89@lists.ticalc.org>
Sent: Tuesday, August 08, 2000 1:36 PM
Subject: A89: OSInitBetweenKeyDelay



I am writing a tetris clone for the TI-89 in C using TI-GCC.  When I press
rotate the pieces spin about 100 times per second.  I would like to lower
that
to about 1 rotation per second, so I tried using OSInitKeyInitDelay(number)
and OSInitBetweenKeyDelay(number).

However, no matter what number large or small I use in these functions, the
rotation speed doesn't change.  Could it be becuase I am using grayscale or
because I am disabling interrupts like the TI-GCC faq?

save_int_1 = peek_l (0x64);
poke_l (0x40064, dummy_int);
// enable grayscale
// do your code
// disable grayscale
poke_l (0x40064, save_int_1);





References: