[A89] Re: _rowread
[Prev][Next][Index][Thread]
[A89] Re: _rowread
OK, in order to understand _rowread, learn something about the hardware. First, the chart in the docs of _rowread of TIGCC are very useful. Now:
at 0x600018 is the mask. It masks out rows corresponding to which bits are 1. So, if only bit 0 is 0, then it will only check the first row. It returns what keys have been pressed in the rows that haven't been masked out (i.e. the bit number corresponding to the row number has 0) in 0x60001b. So, if you want only the key in column 0, put a 0 in that bit number and and it with peekIO (0x60001b), and it will tell you if it has been pressed. _rowread inverts the byte at 0x60001b, so you don't have to do it. You got the first part correctly, but the value you are anding it with also allows for the up arrow to be pressed: 0x0021 is 00100001 in binary, so you are checking whether the key in column 0 or 5 is being pressed. You only want the 5th column, so and it with 0x20 instead, and it will work correctly. I gave this long explanation because understanding it helped me understand the _rowread function better. If you still have questions, refer to j89hw.txt at http://alh.dhs.org/ti
89/download.php?file=http://m101.ryd.student.liu.se/J89hw.txt. Also, you should redirect ai5 to a dummy handler. However, it is much easier to use the _keytest macro instead:
while (!_keytest (RR_SHIFT)) {}
It handles notting bits and stuff for you.
---------------------------------
Do You Yahoo!?
Sign-up for Video Highlights of 2002 FIFA World Cup
References: