This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's z80 & ez80 Assembly subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. Z80 & 68k Assembly => z80 & ez80 Assembly
Author Message
thepenguin77


Advanced Newbie


Joined: 17 Jul 2009
Posts: 72

Posted: 17 Jul 2009 08:51:58 pm    Post subject:

I'm working on a asm game for my ti 84 se that uses two "joysticks" and during the button mashing I noticed a quirky behavior on the calculator that's kinda causing problems.

I use the port method of detecting button presses and then use BIT. But what I noticed is that when three buttons that fulfil a certain pattern are pressed, a fourth button is also pressed. I noticed it when I pressed DEL STAT and 8 because the ZOOM button was also pressed. The pattern works in a rectangle.

STAT and 8 are on $F7 as bits 7 and 2
DEL and ZOOM are on $BF as 7 and 2

The picture:
What Should happen
$BF 11111110
$F7 11011110

But Reality
$BF 11011110
$F7 11011110

When any three of the four are pressed, the fourth is automatically pressed. This works with any four buttons as long as they form a rectangle like that.

Has anyone ever heard of this and/or know how to fix this?

edit: changed the bit 3s to 2s


Last edited by Guest on 17 Jul 2009 09:18:22 pm; edited 1 time in total
Back to top
Graphmastur


Advanced Member


Joined: 25 Mar 2009
Posts: 360

Posted: 17 Jul 2009 08:57:55 pm    Post subject:

The rectangle suggest that you aren't testing the groups correctly. Can you show us your code?
Back to top
thepenguin77


Advanced Newbie


Joined: 17 Jul 2009
Posts: 72

Posted: 17 Jul 2009 09:07:10 pm    Post subject:


Code:
   LD   A, $BF
   OUT   (1), A
   NOP
   NOP
   IN   A, (1)
   BIT   2, A
   JP   Z, SaveGame


This is the part that causes problems. But this also works with all my other keypress commands.

When I press DEL STAT and 8 this jumps to SaveGame even though ZOOM was not pressed.
Back to top
FloppusMaximus


Advanced Member


Joined: 22 Aug 2008
Posts: 472

Posted: 17 Jul 2009 11:03:51 pm    Post subject:

That's just the way the keyboard hardware works. There is no way around it. Many PC keyboards have similar problems. (My keyboard, for example, sees A+Z+S as A+Z+S+X; it actually doesn't report the third scancode at all, to avoid confusion.) The TI-Keyboard sees Diamond+LeftShift+RightShift as Diamond+LeftShift+RightShift+Square; you can see this for yourself with Calcsys.

To understand why this is, consider a 2x2 keyboard, consisting of four switches connected by four wires as follows:

Code:
  |   |
-(A)-(B)-
  |   |
-(C)-(D)-
  |   |

Each switch, when pressed, connects one of the horizontal wires to one of the vertical wires. Now, if the 'B' key is pressed, we can test the resistance between various pairs of wires, and find that the second vertical wire is connected to the first horizontal wire. If two keys are pressed, we'll find either that three of the wires are mutually connected, or that there are two pairs of wires that are connected. But what happens if three keys are pressed? Now current from any one of the wires can flow to any of the others. There's no way (electrically speaking) for us to tell precisely which of the three keys are pressed; indeed, it might be all four.

Some more expensive keyboards have more complex wiring, or have diodes added, to avoid this problem. The TI calculators, as you have just seen, don't.


Last edited by Guest on 17 Jul 2009 11:06:17 pm; edited 1 time in total
Back to top
thepenguin77


Advanced Newbie


Joined: 17 Jul 2009
Posts: 72

Posted: 18 Jul 2009 11:06:41 am    Post subject:

Thanks. That makes sense. I changed the

Code:
   BIT   2, A

to

Code:
   CP   $FB

which works, but I don't really like it. But I don't think there's any other way.
Back to top
calc84maniac


Elite


Joined: 22 Jan 2007
Posts: 770

Posted: 18 Jul 2009 03:06:37 pm    Post subject:

I've noticed this oddity before when I made a keypress monitor.
Back to top
SolusIpse


Newbie


Joined: 19 Jul 2009
Posts: 1

Posted: 19 Jul 2009 08:52:48 am    Post subject:

probably something that should be included in Asmin28 for future reference?
Back to top
Display posts from previous:   
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are UTC - 5 Hours

 

Advertisement