A89: Reading Keypresses Directly


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

A89: Reading Keypresses Directly




I'm having some trouble with detecting keypresses directly from the port. .
. somehow, no matter what mask I store in ($600019), it is ignored and
treated as if it was %00000000 (check all rows in the keyboard matrix), and
so whenever I try to check for a bit in the resulting mask from ($60001B),
it is on as long as any key in that column is pressed.  For example, in
using the matrix below, if I store %11111110 number at all in ($600019) and
test Bit 3 (for the right key), it will be set if either right, *, 9, 8, 7,
OR | are pressed, and my mask has no effect on this.  I've tried 2 different
keyboard reading routines (one from the Zelda 89 source and one below from
ti89.acz.org), neither of which make a difference.  Someone PLEASE let me
know why this isn't working -- it's the only thing keeping me from releasing
a public Pokemon Beta (and it's had me stuck for a week. . . I'm desperate)
and creating some pretty nasty crash bugs -- Thanks =)

                    -Scott Noveck (SMN)
                     smn@calc.org
                     Lead Programmer:
                     Pokemon 89 - Zelda 80
                     http://ccia.calc.org


(from ti89.acz.org:)
        Bit 7    Bit 6    Bit 5    Bit 4    Bit 3    Bit 2    Bit 1    Bit 0
----------------------------------------------------------------------------
%1111110 Alpha   Diam     Shift    2nd      Right    Down     Left     Up
----------------------------------------------------------------------------
%1111101 F5      Clear    ^        /        *        -        +        Enter
----------------------------------------------------------------------------
%1111011 F4      BkSpc    T        .        9        6        3        (-)
----------------------------------------------------------------------------
%1110111 F3      Catalog  Z        (        8        5        2        .
----------------------------------------------------------------------------
%1101111 F2      Mode     Y        )        7        4        1        0
----------------------------------------------------------------------------
%1011111 F1      Home     X        =        |        EE       STO>     Apps
----------------------------------------------------------------------------
%0111111                                                               ESC
----------------------------------------------------------------------------

Key Reading Routine:
    move.b #%11111110,($600019)  ;set the row with 2nd in it
    move.b #5,d0
\wait:
    nop
    dbra.b d0,\wait              ;wait for this to take effect
    move.b ($60001b),d0          ;read back keypress data
    btst.b #4,d0                 ;bit 4 is column 4
    beq p2nd                     ;if bit reset, 2nd is pressed



Follow-Ups: