Author Topic: Disabeling the "ON" button during an App?  (Read 9709 times)

0 Members and 1 Guest are viewing this topic.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55941
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Disabeling the "ON" button during an App?
« Reply #15 on: October 10, 2010, 02:47:28 pm »
I unfortunately cannot help due to lack of ASM knowledge but one thing to be careful with when using direct input is to make sure to either add a delay between key detections or get rid of key repeat by checking if the user has released the key you pressed before continuing further in the program. Also make sure there's a small delay before checking if people released the key, so it gets detected at all. Not sure how long the delay would be in ASM, though. Otherwise, what happens is that in your game menus, options will be chosen way too fast and it will be impossible to accurately navigate through menus due to key detection being too sensitive. In-game it can also pose problem if your game has everything moving tile-by-tile. An example of this problem would be the first version of Splut, which was submitted to the contest.
I had that problem before already, but luckely Quigibo had a perfect solution for that:
http://ourl.ca/6459/105146

So direct input would defenitely be an option.
Ah good to hear. Good luck with your other stuff. :D

Offline Jerros

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 137
  • Rating: +9/-0
    • View Profile
Re: Disabeling the "ON" button during an App?
« Reply #16 on: October 11, 2010, 07:03:50 am »
Perhaps you could post the source, that way we could see what is really happening.
The loop is over 600 lines, and that's without the calls and jumps outside of the loop, so I don't think I can bother anyone with that. :O
If you REALLY wan't  me to post it, I will, but it would take way to long for someone to look through it, only to find that I'm making some nooby mistake that could've easely been fixed without all that efford...

So basically, as long as I don't know that turns interrupts back on, I'd have to put di's everywhere at random? (hehe...)
Rather than doing that, is there a concrete list with command that turn interrupts back on?
That way I can go over things myself without bothering anyone.

Thanks for the replies all!
« Last Edit: October 11, 2010, 07:04:32 am by Jerros »


79% of all statistics are made up randomly.

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: Disabeling the "ON" button during an App?
« Reply #17 on: October 11, 2010, 10:10:24 am »
I'll look through it. Basically what I would do is run it in wabbitemu and place a breakpoint at $0038. $0038 is where the calculator goes when an interrupt happens, so if you follow the interrupt through, it will point you back to the location of the hidden EI.

Actually, even just posting the app I could probably find the problem.
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 Jerros

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 137
  • Rating: +9/-0
    • View Profile
Re: Disabeling the "ON" button during an App?
« Reply #18 on: October 11, 2010, 01:34:13 pm »
I'll look through it. Basically what I would do is run it in wabbitemu and place a breakpoint at $0038. $0038 is where the calculator goes when an interrupt happens, so if you follow the interrupt through, it will point you back to the location of the hidden EI.
I'll send you a PM tomorrow then, if it's not too much trouble for you.
Thank you.


79% of all statistics are made up randomly.

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: Disabeling the "ON" button during an App?
« Reply #19 on: October 12, 2010, 05:18:12 pm »
Jerros already knows, but for every one else... The OS actually delays when it sees an ON interrupt. It runs a 100 t-state loop 4000 times waiting for the state of the ON button to change. That's just stupid, this is horrible for any type of program that needs to run at a decent pace.

Anyways, the fix was to put a di \ ld a, %00001010 \ out (03), a after the GetCSC. Oh, and be prepared for a great game from Jerros ;).
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 DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55941
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Disabeling the "ON" button during an App?
« Reply #20 on: October 12, 2010, 10:31:45 pm »
Is that why code in Axe interrupts run slower than if you don't use them?

Also I can't wait to see his game :D

Offline Jerros

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 137
  • Rating: +9/-0
    • View Profile
Re: Disabeling the "ON" button during an App?
« Reply #21 on: October 13, 2010, 04:55:54 am »
Like ThePenguis already said, it's fixed now.
This what I did with his solution:
Code: [Select]
   (...)
    b_call _GetCSC
    CP     skKey
    JP     Z, Label
AfterLabel:
di
ld a, %00001010
out (03), a
         (...)

Label:
   (...)
   JR   AfterLabel
If you put this in the loop, ON won't cause much trouble anymore.
(Though EXESSIVELY spamming the button will still result in a very occasional small slowdown, though the origional point was to prevent cheating, which is effectively impossible now;P)
Works good enough for me. :P
Thank you ThePenguin!
« Last Edit: October 13, 2010, 04:58:12 am by Jerros »


79% of all statistics are made up randomly.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55941
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Disabeling the "ON" button during an App?
« Reply #22 on: October 13, 2010, 05:02:55 am »
Nice :D

Offline Jerros

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 137
  • Rating: +9/-0
    • View Profile
Re: Disabeling the "ON" button during an App?
« Reply #23 on: October 14, 2010, 02:56:57 am »
Is it a mindf**k of me, or does it seem to be slightly less responsive to the keypresses when using the code above?
Any theory that can back that up, or am I making up things here?


79% of all statistics are made up randomly.

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: Disabeling the "ON" button during an App?
« Reply #24 on: October 14, 2010, 05:02:51 pm »
If you are still using getCSC then yes, it will be less responsive because the interrupts aren't turned on for most of the time. Which would make the getCSC only check for keypresses once per loop. If you are using direct key presses, then it wouldn't have any affect, unless you didn't make the checking routine very well. ;)
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 Jerros

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 137
  • Rating: +9/-0
    • View Profile
Re: Disabeling the "ON" button during an App?
« Reply #25 on: October 15, 2010, 06:09:52 am »
If you are still using getCSC then yes, it will be less responsive because the interrupts aren't turned on for most of the time. Which would make the getCSC only check for keypresses once per loop. If you are using direct key presses, then it wouldn't have any affect, unless you didn't make the checking routine very well. ;)
Using GetCSC...
So I guess I replace it with a direct routine.
Though I'd have to fix the fact that holding down buttons will result in ALOT of keypresses, but I believe I already have a script for that somewhere.
Thanks.

EDIT: Haha, found a way to bypass the whole problem; just make sure people don't press the ON button at all:
Code: [Select]
in a,($04)
bit 3,a
jp z,Quit
« Last Edit: October 25, 2010, 04:12:20 am by Jerros »


79% of all statistics are made up randomly.