Author Topic: MenuHook Findings  (Read 3537 times)

0 Members and 1 Guest are viewing this topic.

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
MenuHook Findings
« on: April 24, 2012, 10:37:21 pm »
I was playing with an idea that I found on TIBD. I thought that it would be really cool if we could open the string menu or Pic menu and have access to all 256 tokens. Sorry if I got your hopes up, because that has failed (so far). To get it to work, I might have to do a hackjob, but I did uncover a random tidbit of info.

When the OS calls your hook, if it is sending A=1, then you will want to exit with the z flag set. I do this with xor a \ ret. What I found was that we can change the token to be displayed from here without having to write a whole table. How do we do this? DE contains a extended keycode that maps to a token. All you have to do is change this value and the token that will be displayed gets changed. What I did, since my tokens were based on the menu item number and the token was arbitrary:
Code: [Select]
;E contains the Pic number
     ld d,60h            ;Start of a Pic token
     bcall(_TokToKey)    ;4A0Bh   Stores the extended key code to 8446h, A has the rest
     ld de,(8446h)       ;E know has the extended value
     ld d,a              ;DE now has the whole keycode
     xor a
     ret
I don't know where else this might prove useful, but have fun :)

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: MenuHook Findings
« Reply #1 on: April 25, 2012, 06:40:46 pm »
I don't remember the specifics, but I know in one of the early menu hook calls, you get to specify the table that it looks at. With a little bit of OS debugging, you can figure out the format of those tables, and from there you can design your own table which includes whatever you want in the menu.

This is how I added Solver++ to the math menu in zStart a while ago.
« Last Edit: April 25, 2012, 06:41:05 pm by thepenguin77 »
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 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: MenuHook Findings
« Reply #2 on: April 26, 2012, 07:06:46 am »
Yeah, you can define your own table, but I was looking for a way to change only certain menu items without having to make a table. Of course, it probably would be easier to just use a table, but hey, it's good to have options :)

You can also use this idea when the hook is exiting (I think A=4) and you can change which token gets pasted.

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: MenuHook Findings
« Reply #3 on: April 26, 2012, 04:45:55 pm »
Yeah, you can define your own table, but I was looking for a way to change only certain menu items without having to make a table. Of course, it probably would be easier to just use a table, but hey, it's good to have options :)

Well, that's actually what I did. I ran a search for the MATH table and then modified it and used it as my own table. It worked on all OS's, so it was pretty cool.
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 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: MenuHook Findings
« Reply #4 on: April 26, 2012, 04:54:36 pm »
Hmm, I assume you copied the table to RAM? I was looking at avoiding that :/ Or is automatically copied to RAM? I haven't checked yet.

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: MenuHook Findings
« Reply #5 on: April 26, 2012, 05:03:47 pm »
Yes, I did copy it to ram. So you'll have to deal with that if you do it.
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 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: MenuHook Findings
« Reply #6 on: April 26, 2012, 05:14:55 pm »
Yeah, the reason why I was avoiding that was because the menu was going to need 255 elements. I figured that it would be easier to draw the tokens based on a formula.