[TI-ASM] The in's and out's of key input

Got questions? Got answers? Go here for both.

Moderator: MaxCoderz Staff

Post Reply
User avatar
crzyrbl
Calc Wizard
Posts: 518
Joined: Wed 06 Jul, 2005 4:56 pm
Location: 3rd rock....

[TI-ASM] The in's and out's of key input

Post by crzyrbl »

Can someone explain in depth how to use the 2 following instructions:

in
out

thnx in advance
Last edited by crzyrbl on Thu 07 Jun, 2007 5:24 am, edited 1 time in total.
(\__/)
(='.'=)This is Bunny. Copy and paste bunny into your
(")_(")signature to help him gain world domination.

Image
User avatar
Dwedit
Maxcoderz Staff
Posts: 579
Joined: Wed 15 Dec, 2004 6:06 am
Location: Chicago!
Contact:

Post by Dwedit »

You read a list of Ports and what they do from a website such as WikiTI.
You know your hexadecimal output routine is broken when it displays the character 'G'.
User avatar
crzyrbl
Calc Wizard
Posts: 518
Joined: Wed 06 Jul, 2005 4:56 pm
Location: 3rd rock....

Post by crzyrbl »

I should probably be more specific. I'm having trouble with getting keyboard input. I'm still relatively new to assembly.
(eventually I also want to know how to detect multiple keypresses as well)
*title changed
(\__/)
(='.'=)This is Bunny. Copy and paste bunny into your
(")_(")signature to help him gain world domination.

Image
User avatar
Dwedit
Maxcoderz Staff
Posts: 579
Joined: Wed 15 Dec, 2004 6:06 am
Location: Chicago!
Contact:

Post by Dwedit »

You know your hexadecimal output routine is broken when it displays the character 'G'.
User avatar
Halifax
Sir Posts-A-Lot
Posts: 225
Joined: Mon 01 Jan, 2007 10:39 am
Location: Pennsylvania, US

Post by Halifax »

Have you tried reading Asm in 28 days? I recommend that because it explains the exact thing you want to do with multiple keypresses and everything else.
King Harold
Calc King
Posts: 1513
Joined: Sat 05 Aug, 2006 7:22 am

Post by King Harold »

What Asm in 28 days doesn't tell though is that sometimes multiple keypresses 'mess up' and leave result differing from what you'd expect. Single keypresses should always work fine though, and you won't have much trouble if you only check the arrows for multi presses.
If you write a little program displays all groups then you should be able to figure out which keys you can 'safely' press together.
(you might want to use the key scanning routines that I have been going on about, use the one with INI - it's cool :) )

edit: you can have real trouble when there are more than 3 being pressed, I don't know whether many games even need that because you only have 2 thumbs but take it into consideration when you're thinking about funky combo's and 'special moves' etc.
User avatar
crzyrbl
Calc Wizard
Posts: 518
Joined: Wed 06 Jul, 2005 4:56 pm
Location: 3rd rock....

Post by crzyrbl »

Ah, I see, I have to use the BIT instruction then...hmm, I think I got it now :). Are there problems with detecting 3 buttons? For example two directionals and 2nd or something around there?
Last edited by crzyrbl on Fri 08 Jun, 2007 10:34 pm, edited 1 time in total.
(\__/)
(='.'=)This is Bunny. Copy and paste bunny into your
(")_(")signature to help him gain world domination.

Image
King Harold
Calc King
Posts: 1513
Joined: Sat 05 Aug, 2006 7:22 am

Post by King Harold »

Im not sure about that one, you'd have to try in on HW since the emulators might not be 100% accurate.
You don't HAVE to use bit operations, but that's probably safer. If possible, use a shift operation and catch the carry, it's faster. If you only have to test some middle bit and throw the rest away then you could use logic AND.
User avatar
Jim e
Calc King
Posts: 2457
Joined: Sun 26 Dec, 2004 5:27 am
Location: SXIOPO = Infinite lives for both players
Contact:

Post by Jim e »

The effect that King Harold is talking about is caused by the grid setup of the keyboard. If 3 or more buttons are being pressed its possible to get bad reads from the key port. Basic rule of thumb is this: If a particular bit is reset in more than one group, then those groups will return the same value, which will be all those groups AND together.

Code: Select all

     | | 
-0000+0+0
 00000000
-0000+0*0
The idea is the plus signs are actually being pressed, where as the asterisk is a false press. Typically this problem doesn't occur, its not easy to hold the combination that this can occur in. For gaming, coders usually stick to only certain groups.

To answer your question Arrows, 2nd, mode, alpha & F1 will all be okay to use together in any key combination.
Image
User avatar
Halifax
Sir Posts-A-Lot
Posts: 225
Joined: Mon 01 Jan, 2007 10:39 am
Location: Pennsylvania, US

Post by Halifax »

Well I forget right now but isn't F1-F5 in one group I don't know. But I have always had this question. With those could you detect up to 5 keypresses or anything?? Since they are all or'd together. This would be useful for something like Guitar Hero :)
User avatar
crzyrbl
Calc Wizard
Posts: 518
Joined: Wed 06 Jul, 2005 4:56 pm
Location: 3rd rock....

Post by crzyrbl »

I'm having trouble getting my emulator to recognize the combination up+left+2nd, yet all the other combos work (2 arrows and 2nd that is). Is this just an emulator problem or is it deeper than that?
(\__/)
(='.'=)This is Bunny. Copy and paste bunny into your
(")_(")signature to help him gain world domination.

Image
Andy_J
Calc Master
Posts: 1110
Joined: Mon 20 Dec, 2004 10:01 pm
Location: In the state of Roo Fearing
Contact:

Post by Andy_J »

It might actually stem from your computer's keyboard, due to the same matrix problems as outlined above for the calculator's keypad -- computer keyboards are made the same way.
ImageImage
Image
User avatar
crzyrbl
Calc Wizard
Posts: 518
Joined: Wed 06 Jul, 2005 4:56 pm
Location: 3rd rock....

Post by crzyrbl »

that's exactly right. I used the mouse to press 2nd and all three registered correctly. You get the gold star!
(\__/)
(='.'=)This is Bunny. Copy and paste bunny into your
(")_(")signature to help him gain world domination.

Image
Post Reply