Author Topic: Inconsistencies with Keypresses?  (Read 4086 times)

0 Members and 1 Guest are viewing this topic.

Offline Hot_Dog

  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3006
  • Rating: +445/-10
    • View Profile
Inconsistencies with Keypresses?
« on: December 31, 2011, 12:47:48 am »
Darl181 was testing Elimination for me, and he said that he has the following problems on his Ti-84+ BE:

"Walking right (XTΘn) doesn't work for me, however walking left does (ALPHA Key).  Mode brings up a map and fires when you press it again to hide the map (and that fire consumes 2 ammunition), and 2nd toggles the HUD whilst firing.
Pressing apps brings up the light saber as it's supposed to, but only after displaying the map."

In the game, 2nd and MODE are only supposed to fire, nothing else.  The map is supposed to be toggled with MATH, and the HUD is supposed to be toggled with x-1.  I never have these problems on the Ti-83+ SE, is there something that might be causing these problems on this Ti-84+ BE?

Here's some things that Elimination does.  I don't know if it's causing the problem, but it doesn't hurt to list them.  Again, I don't have any of these problems on my Ti-83+ SE.
---------------------------------------------

* Elimination switches flash pages using ports
* Elimination uses crystal timers (for interrupts)
* Elimination uses page $83 for data storage in the $C000-$FFFF area
* Elimination uses ports for keypresses

« Last Edit: December 31, 2011, 12:50:05 am by Hot_Dog »

Offline Runer112

  • Moderator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Inconsistencies with Keypresses?
« Reply #1 on: December 31, 2011, 01:05:27 am »
It sounds to me like your key-reading routine doesn't have enough delay between writing to and reading from the key port. I'm not sure how much delay is safe enough for every calculator, but I know that Quigibo recently increased Axe's number of cycles between the port write and read for key input from 19 to 22 cycles because it turned out that 19 cycles isn't enough for some calculators running at 15MHz. Interestingly enough, Darl181 is the one who reported this problem for Axe as well. :P
« Last Edit: December 31, 2011, 01:06:55 am by Runer112 »

Offline Hot_Dog

  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3006
  • Rating: +445/-10
    • View Profile
Re: Inconsistencies with Keypresses?
« Reply #2 on: December 31, 2011, 08:36:45 am »
It sounds to me like your key-reading routine doesn't have enough delay between writing to and reading from the key port. I'm not sure how much delay is safe enough for every calculator, but I know that Quigibo recently increased Axe's number of cycles between the port write and read for key input from 19 to 22 cycles because it turned out that 19 cycles isn't enough for some calculators running at 15MHz. Interestingly enough, Darl181 is the one who reported this problem for Axe as well. :P

Now that makes sense.  I'm so used to 8 cycles for 6 MHz, I forgot that 15 Mhz needs more time.  Thanks!

Offline Hot_Dog

  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3006
  • Rating: +445/-10
    • View Profile
Re: Inconsistencies with Keypresses?
« Reply #3 on: December 31, 2011, 08:56:42 pm »
I have a 38 T-State delay between writing to the port and reading from it, and it's not working on Darl's Ti-83+ BE.  Any other suggestions?
« Last Edit: December 31, 2011, 08:56:55 pm by Hot_Dog »

Offline Darl181

  • «Yo buddy, you still alive?»
  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3408
  • Rating: +305/-13
  • VGhlIEdhbWU=
    • View Profile
    • darl181.webuda.com
Re: Inconsistencies with Keypresses?
« Reply #4 on: December 31, 2011, 09:17:00 pm »
I'll say that I've had similar problems before, but it seems other people had those too (such as if some odd key were pressed in Devrays the player would move).

84pbe, 2.43, hardware rev. B.
Apps installed are zStart, and Omnicalc through zStart.
« Last Edit: December 31, 2011, 09:18:17 pm by Darl181 »
Vy'o'us pleorsdti thl'e gjaemue

Offline thepenguin77

  • z80 Assembly Master
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1594
  • Rating: +823/-5
  • The game in my avatar is bit.ly/p0zPWu
    • View Profile
Re: Inconsistencies with Keypresses?
« Reply #5 on: January 01, 2012, 12:27:03 am »
This might be unnecessary, but are you writing $FF to the port when you are done? I know when I first switched to 15MHz I had to do that because my calculator would glitch otherwise. I might have done something wrong back then, but all of my programs write $FF after every read.
zStart v1.3.013 9-20-2013 
All of my utilities
TI-Connect Help
You can build a statue out of either 1'x1' blocks or 12'x12' blocks. The 1'x1' blocks will take a lot longer, but the final product is worth it.
       -Runer112

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: Inconsistencies with Keypresses?
« Reply #6 on: January 01, 2012, 12:41:23 am »
Technically, you should write $FF before writing the key group to check. Writing $FF after reading should work too, I guess, but not necessarily for the very first read.
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline Hot_Dog

  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3006
  • Rating: +445/-10
    • View Profile
Re: Inconsistencies with Keypresses?
« Reply #7 on: January 01, 2012, 02:17:29 am »
This might be unnecessary, but are you writing $FF to the port when you are done? I know when I first switched to 15MHz I had to do that because my calculator would glitch otherwise. I might have done something wrong back then, but all of my programs write $FF after every read.

I am writing $FF every time, do I need a delay after that before writing the key group to check?

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Inconsistencies with Keypresses?
« Reply #8 on: January 03, 2012, 01:02:22 pm »
I will say that I have had these kinds of problems before and I got frustrated and added a call 000Bh as the delay and that didn't work :/ I have mentioned this before, but I was told it was a delay issue. Also, I was writing $FF to the port before each write, as well. I wonder if there is a hardware issue in some models? Mine was an 84+SE without the extra RAM and a 84+BE without the extra RAM. Here is what I could do:

Press left and the plus key. Then press Enter and the down key is registered.

It was always things like that, but I could just have coded something wrong or misunderstood the documentation. I will check again later comparing WabbitEmu to my actual calc and whatnot.

Offline Hot_Dog

  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3006
  • Rating: +445/-10
    • View Profile
Re: Inconsistencies with Keypresses?
« Reply #9 on: January 03, 2012, 01:23:58 pm »
If it's a hardware problem, I think I'll remap some of the keys.  Most of the keys are not so important that they need to be that close to the fire button.