Re: LF: Get key values.


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

Re: LF: Get key values.



Adam King wrote:

> Please corect me if I am wrong, but if I get the values of [600018]
> and
> [60001B] then doing something like
> "       and [600018] , [60001B]         ;where the data values are
> actualy register
> values of those address"
> then interpreting that value into a key value.  This then would bypass
> the
> idole untill a key is pressed nature of the rutien "    jsr
> flib[idle_loop] ".
>  If I am correct if not please point me in the correct direction,
> because i
> dont quite understan the "ports" document in Fargo.  Thanx.

    Unfortunately it doesn't work that way.  You need a conversion table
to go from key bits to key values.  This is done by the TI-OS inside of
auto interrupt 2 (I think).  Anyway, you can easily re-write the idle
loop to do what you want (just check for a keypress).  The one problem
here is that you must continue to allow interrupts to operate - which
you may not want if you're writing a speed-sensitive arcade game.
   If you ARE writing a speed-sensitive routine, you'll have to examine
the bits independently, for instance to check for the UP key you'd set
600018.w to (binary) %1111111110, then wait a sec (a few 'nop'
instructions), then read 60001C.w and test bit 5.  There are of course
ways to read more than one key at a time like this which involves
setting and testing the bits appropriately (for instance, without
setting or reading any more bits, the UP, DOWN, LEFT and RIGHT keys may
be tested with bits 5,7,4 and 3 from the example).

   Hope that helps.  If you have a more specific question, just let us
know..

--Bryan
bcturner@eos.ncsu.edu




References: