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
Xeda112358


Active Member


Joined: 19 May 2009
Posts: 520

Posted: 08 Apr 2012 01:34:08 pm    Post subject:

KeyHook Hacking: Read more below
FontHook Hacking This lets you have much finer control over aspects such as drawing text.
bcall(4744h): Undocumented, even by the community, apparently. I've used this for years to check keyboard scan codes. Pretty much, it returns the keypress in A that is read from 8445h, so it requires interrupts on to work.


When I first discovered the ti83plus.inc file provided by TI, I went through and played with all the RAM equates that I thought would do something. For the newer folks that don't know me well, I started my assembly programming days by programming in hex, so I had a knack for playing with hex codes. Anyways, I saw a few peculiar gaps in RAM and then one that gave me the most reward was the one between 843Fh and 8445h. What struck me as odd was the fact that there were 4 bytes unaccounted for, so I played with them and I made a very fun program:

So what was in the secrets of these bytes? These bytes were counters, but the one at 8442h was the one that you could really take advantage of. When a key is not being pressed, it has a value of 50. As you hold a key down, that decrements until zero. If it is a repeating key and the counter hits zero, it "presses again" so to speak and resets the counter to ten and repeats in this way. The above example is a getkey hook that checks the counter and updates it itself. This is also a feature I put in several programs including BatLib.

However, that ws not the only thing I discovered in playing around. I also made a program to simulate keypresses. The user passes a value through Ans and that key is simulated. For example, Enter has a key code of 9 (these are the same keycodes that you use in Grammer, Axe, and a number of other programs). So to simulate Enter, you do 9:Asm(prgmKS. unfortunately, that just causes the program to be executed over and over (until you press some other key). However, this also lets you open up menus and whatnot, too. What I figured out is that when you add 56 to the keycode, that is like pressing [2nd] and then the key and add another 56, you get [alpha] press. Some of these codes are also replaced with things to clear your RAM, display prgmA (even if you don't have it) and others.


So why did I make this topic now? To be honest, I was looking for a way to redraw the homescreen because I couldn't find a bcall to do it. I just simulated [2nd][mode] on my way out which costs 5 bytes and only 20 cycles XD

I would like to note that I added the RAM equate 8442h on WikiTI a while ago and called it keyDelay if anybody is interested. Feel free to use this info!


Last edited by Guest on 09 Apr 2012 03:47:22 pm; edited 1 time in total
Back to top
jammasterz


Advanced Newbie


Joined: 28 Nov 2011
Posts: 72

Posted: 08 Apr 2012 02:50:01 pm    Post subject:

You really love this calculator, dont you?
Back to top
Xeda112358


Active Member


Joined: 19 May 2009
Posts: 520

Posted: 08 Apr 2012 03:40:25 pm    Post subject:

jammasterz wrote:

You really love this calculator, dont you?

I do indeed Smile What is cool about this is that a whole ton of stuff was discovered by big programmers like BrandonW and Michael Vincent, and others, but then there are little things like this that can be super useful that aren't found until years later Smile I should start posting more of my findings like the font hook hack that I made for BatLib over a year ago and most recently, an undocumented/improperly documented bcall. (I've been using it for about 4 years now and only just found that it is no longer documented anywhere).
Back to top
jammasterz


Advanced Newbie


Joined: 28 Nov 2011
Posts: 72

Posted: 09 Apr 2012 09:39:54 am    Post subject:

Do it. It is allways good when someone documents the undocumented Smile.
Back to top
Xeda112358


Active Member


Joined: 19 May 2009
Posts: 520

Posted: 09 Apr 2012 03:38:07 pm    Post subject:

Cool Very Happy Also, I found another thing out that I should mention in my hack-a-day-sical ventures today. Anywho, I am going to rename this topic to "TI-8x Findings" or something like that if I can :)

So, here is the next topic: Font Hook Hacking:
Breakdown of OSes on which this will work, not work, or somewhere in between:
1.03 fail
1.10 fail
1.12 fail
1.13 good
1.14 good
1.15 good
1.17 good
1.18 good
1.19 good
2.30 good
2.40 good
2.41 good
2.43 good
2.53 works except in MathPrint, but doesn't crash
2.55 works except in MathPrint, but doesn't crash
Luckily, the ones it crashes on are rather ancient, anyways or rare as they didn't exist long.

When using the Font Hook, you cannot do special things on your own. For example, you cannot use your own drawing routines to speed things up. About a year and a half ago, I introduced an 8x8 font hook in BatLib and this is something I had never seen elsewhere. I had to do some semi-hacky things to display fonts in a custom way as opposed to just changing the data displayed and I figured this might be useful for others to use. Pretty much, if you want to use your own routine to display the font when the OS wants to draw a char, try adding this to the end of your hook:

Code:

    ld hl,18
    add hl,sp
    ld sp,hl
    pop hl
    ld a,l
    out (6),a
    pop hl
    pop ix
    pop hl
    pop de
    pop bc
    pop af
    ret


I used that to let me draw the fonts directly to the LCD and make sure the OS didn't try to mess that up. Plus, it skips over tons of OS code XD You will need to handle inverted text on your own, though, too. I just check the flag and use CPL on the data if it is supposed to be inverted.


Last edited by Guest on 09 Apr 2012 03:42:11 pm; edited 1 time in total
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