Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: DJ Omnimaga on March 18, 2010, 04:23:06 pm

Title: Key codes (for Getkey() users)
Post by: DJ Omnimaga on March 18, 2010, 04:23:06 pm
Should be easier to find since these topics grows pretty fast. I think Quigibo should add them to the doc when he gets some free time.

53 52 51 50 49
54 55 56    4
             2    3
48 40 32    1
47 39 31 23 15
46 38 30 22 14
45 37 29 21 13
44 36 28 20 12
43 35 27 19 11
42 34 26 18 10
    33 25 17 9

Those are the keys of the calculator...  the pattern, basically, is just dereasing numbers asyou move down the rows and to the right, with the arrow keys and the top two rows being different
Title: Re: Key codes (for Getkey() users)
Post by: SirCmpwn on March 18, 2010, 05:21:22 pm
I wrote a quick program earlier that tells me the keycodes when I press them, I have always found that a bit easier.
Title: Re: Key codes (for Getkey() users)
Post by: meishe91 on March 18, 2010, 05:23:13 pm
Isn't that the same layout for ASM? Just making sure since I'm not really familiar with it.
Title: Re: Key codes (for Getkey() users)
Post by: DJ Omnimaga on March 18, 2010, 05:23:54 pm
yeah that can be useful too. I guess it help to memorize some of them tho for some ppl ^^

@meishe91 I don't know ASM so I couldn,t tell. It's different from the BASIC one and the one shared between xLIB and Celtic III, though.
Title: Re: Key codes (for Getkey() users)
Post by: SirCmpwn on March 18, 2010, 05:26:10 pm
The asm layout is completely different, you have to activate key groups, then you get back a byte with different bits set to represent different keys.  It appears to be the xLib layout, though, at first glance.
Title: Re: Key codes (for Getkey() users)
Post by: DJ Omnimaga on March 18, 2010, 05:29:30 pm
Mhmm, strange, I swear it was different, but again, I haven't used xLIB in 3 years x.x

EDIT: After checking its readme, it definitively appears to be xLIB layout. I guess it should be more familiar to its users, then.
Title: Re: Key codes (for Getkey() users)
Post by: ztrumpet on March 18, 2010, 05:32:24 pm
The asm layout is completely different, you have to activate key groups, then you get back a byte with different bits set to represent different keys.  It appears to be the xLib layout, though, at first glance.
Yup, I'm pretty sure it is the xLib layout.  I've been using the xLib readme for key codes, so, yeah... ;D

 *Ztrumpet prints this out...
Title: Re: Key codes (for Getkey() users)
Post by: meishe91 on March 18, 2010, 05:37:49 pm
Oh, ya. Just saw that on TIBD that it is xLib, thanks.
Title: Re: Key codes (for Getkey() users)
Post by: Quigibo on March 19, 2010, 02:40:44 pm
So I guess I will make 41 the [on] key since it appears to be missing.  Nice layout!  I was going to add one, but I couldn't find one on the internet and I didn't want to spend time making my own.
Title: Re: Key codes (for Getkey() users)
Post by: DJ Omnimaga on March 19, 2010, 02:49:10 pm
Are you sure though? I wonder if the ON key works a bit differently. For example, if you press On duriong an Axe game, nothing will happen, but when exiting the program, the ERR:BREAK message will finally show up.


But I guess it doesn't hurt to try ^^
Title: Re: Key codes (for Getkey() users)
Post by: Gale on March 19, 2010, 03:05:31 pm
yeah, on one of my axe programs i forgot to make a way to stop the Repeat loop, so i got stuck for a while with no ON key break P:
Title: Re: Key codes (for Getkey() users)
Post by: DJ Omnimaga on March 19, 2010, 03:54:08 pm
I think this is actually the biggest risk of axe programming. If you forget to put an exit in your program or if you mess up and the code never reaches the exit button check, then yoU're screwed unless you did backups x.x
Title: Re: Key codes (for Getkey() users)
Post by: SirCmpwn on March 19, 2010, 04:22:57 pm
I never keep anything in RAM anymore, it's too dangerous, especially now that I'm using Axe more often.  Here is an app that lets you do everything you could possibly want, while still keeping things in the archive: http://www.ticalc.org/archives/files/fileinfo/400/40029.html (http://www.ticalc.org/archives/files/fileinfo/400/40029.html)
Title: Re: Key codes (for Getkey() users)
Post by: DJ Omnimaga on March 19, 2010, 05:37:47 pm
That one allowed editing archived programs? nice. I thought it was just some sort of rip-off from Noshell.
Title: Re: Key codes (for Getkey() users)
Post by: Builderboy on March 19, 2010, 07:00:50 pm
I still want ON breaking supported, even if it becomes an optional feature while compiling for debug mode :P
Title: Re: Key codes (for Getkey() users)
Post by: ztrumpet on March 19, 2010, 08:31:00 pm
That one allowed editing archived programs? nice. I thought it was just some sort of rip-off from Noshell.
It's actually pretty cool.  I prefer Mirage over it, but it's my second favorite shell. :)  (I try to go as hook-less as possible. ;D)

I still want ON breaking supported, even if it becomes an optional feature while compiling for debug mode :P
Same here.  I like the security of pressing On. :D
Title: Re: Key codes (for Getkey() users)
Post by: Eeems on March 19, 2010, 09:21:37 pm
I would like to be able to use the ON key like an interupt key. So when you hit ON it will quit to a certain set code you give (like a menu or displaying all the values of the cars for debugging) and then you can do a lot more with it.
Title: Re: Key codes (for Getkey() users)
Post by: jsj795 on March 20, 2010, 09:01:19 am
how about instead of just ON as the break, pressing multiple keys like ON + Clear or something like that is the default break key?
Title: Re: Key codes (for Getkey() users)
Post by: Quigibo on March 20, 2010, 03:54:13 pm
By the way just so we're all clear, asm does not naively support on-breaks.  Instead, you have to create your own interrupt code to deal with the breaks.  So there really isn't any short term solution until I add interrupt support, which isn't that far away.
Title: Re: Key codes (for Getkey() users)
Post by: Eeems on March 20, 2010, 04:00:33 pm
yay! interrupts!
Title: Re: Key codes (for Getkey() users)
Post by: DJ Omnimaga on March 20, 2010, 11:29:42 pm
Seems like a good idea. I assume the grayscale support, if it ever gets added, will use them too?

ON support seems like a good idea cuz I know many people will forget to add an exit to their game in the future (if not alerady) and lose progress on their projects and give up x.x
Title: Re: Key codes (for Getkey() users)
Post by: LordConiupiter on March 24, 2010, 02:37:16 am
yeah, just happend to me that I had to take out my batteries.
But I wont give up.

I also like the grayscale idea, but I think that will slow down your programs, so there has to be something to switch it on/off, like: FnOn/FnOff
Title: Re: Key codes (for Getkey() users)
Post by: DJ Omnimaga on March 24, 2010, 02:43:19 am
Ouch, I hope you did not lose too much x.x

And yeah for grayscale, something interrupt-based would be nice. Of course if done the way I think it might not be that slow, but the issue is that the program would become horribly massive. See Reuben Quest (altough it's mostly TI-BASIC). Had this game not used grayscale, it would be at least 2x smaller in size
Title: Re: Key codes (for Getkey() users)
Post by: LordConiupiter on March 24, 2010, 12:04:11 pm
yes, and it uses 3 colors? white-gray-black?
how many colors are going to be used for grayscale games in Axe?
I think 3 is enough, but perhaps 4/5 could be nice/usefull
Title: Re: Key codes (for Getkey() users)
Post by: trevmeister66 on March 24, 2010, 12:06:20 pm
I'm guessing 3 will be the typical number, and sometimes 4 if used properly, but I doubt 5 will ever be used (is that even possible on a calc?)
Title: Re: Key codes (for Getkey() users)
Post by: cooliojazz on March 24, 2010, 02:23:29 pm
Well yes, actually.  Look at Calc84Maniac's Chip's Challenge.  It uses 8 :)
Title: Re: Key codes (for Getkey() users)
Post by: DJ Omnimaga on March 24, 2010, 03:42:12 pm
5 is possible. Calc84maniac uses 8. Nitacku made a program to create 5 lv grayscale xLIB/Celtic pics. However, 5 in BASIC looks crappy on a regular 83+. In ASM it may be tolerable, though. Keep in mind, however, that grayscale takes much more memory to store tiles, if you got many, though.
Title: Re: Key codes (for Getkey() users)
Post by: indubitably on April 07, 2010, 11:30:31 pm
I wrote a quick program earlier that tells me the keycodes when I press them, I have always found that a bit easier.

Can you post the code for this, i thought i wrote one correctly but it returns odd symbols.
Seeing this code would help me a lot.
Title: Re: Key codes (for Getkey() users)
Post by: SirCmpwn on April 07, 2010, 11:31:44 pm
Oh, I can just whip it up really quick, I deleted the source and kept the binary.  Give me a moment.



###########################



Code: (Axe Basic) [Select]
0->K
While K=/=15
getkey->K
If K
ClrHome
Disp K>Dec
End
End

This will always display 15 if when you exit.  If you don't care about that and can manage to remember that Clear==15, you can optimize to this:
Code: (Axe Basic) [Select]
Repeat getkey(15)
getkey->K
If K
ClrHome
Disp K>Dec
End
End

Also, this one doesn't loop, and is even smaller:
Code: (Axe Basic) [Select]
Pause 5000
Disp getkey>Dec

You have a couple seconds to press a key before it polls for it.
Title: Re: Key codes (for Getkey() users)
Post by: indubitably on April 07, 2010, 11:47:08 pm
Thank you this was actually very helpful. So I guess what i need to learn is how to read from a variable. i never used the >dec command before.
Title: Re: Key codes (for Getkey() users)
Post by: SirCmpwn on April 07, 2010, 11:50:44 pm
Well, in Axe, >Dec says to display a nubmer in decimal format.  Otherwise, it will use the variable as a pointer and display random gibberish from that point in memory to the next zero.  Also, >Frac will display the character represented by the variable.  For instance:
65->X
Disp X  // Displays everything from 0x00041h (hex) to the next zero
Disp X>Dec // Displays 5
Disp X>Frac // Displays "a"
Title: Re: Key codes (for Getkey() users)
Post by: indubitably on April 07, 2010, 11:58:08 pm
is there a tutorial of some kind with the non-basic commands?
Should i just look at a tutorial for xlib or something?
Title: Re: Key codes (for Getkey() users)
Post by: SirCmpwn on April 08, 2010, 12:00:25 am
Hmm, tutorial...
I don't think so.  But it is getting pretty late here, I'll whip one up tomorrow.
Title: Re: Key codes (for Getkey() users)
Post by: indubitably on April 08, 2010, 12:02:05 am
okay thanks for the help though, the variable to decimal command will keep me busy for a while ;D
Title: Re: Key codes (for Getkey() users)
Post by: DJ Omnimaga on April 08, 2010, 10:09:56 pm
The documentation HTML file explains each commands if you didn't check it yet. However, it doesn,t go in full depth for all commands yet, so it can still be confusing, especially pointers and data management.
Title: Re: Key codes (for Getkey() users)
Post by: SirCmpwn on April 08, 2010, 11:08:39 pm
@indubitably: I posted a comparison between Axe Basic and TI-Basic that should help you out.