Author Topic: Redesigning Menus  (Read 6339 times)

0 Members and 1 Guest are viewing this topic.

Offline bobbean

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 14
  • Rating: +2/-0
    • View Profile
Redesigning Menus
« on: September 10, 2013, 11:24:47 pm »
So i've been playing with basic, axe, and assembly for a while now (i'm ok at everything  :P ), and I was wondering how difficult it would be to rewrite a menu that is part of the os. I really dislike the program menu and was hoping to "tweak" it a little. I haven't seen anything like it, and I know it will likely be very difficult, but it's something I want to work towards. Any way you guys can help?

**prepares for crushed dreams**

Offline JamesV

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 276
  • Rating: +77/-0
    • View Profile
    • James V's TI-Calculator page
Re: Redesigning Menus
« Reply #1 on: September 10, 2013, 11:42:54 pm »
I think it would be possible with assembly, but it's fairly advanced (unless I'm over complicating things, which is quite possible... :))

I believe you could write a program that would install an interrupt hook that will run in the OS when the [PRGM] button is pressed, and execute your own "program menu". Unfortunately, I'm no expert when it comes to interrupts and hooks  :-[

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: Redesigning Menus
« Reply #2 on: September 11, 2013, 07:57:39 am »
I guess what you actually want is a custom, self-written menu, so detecting up/down keys on your own etc.

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

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: Redesigning Menus
« Reply #3 on: September 13, 2013, 11:47:36 pm »
There are three ways I see to go about this: the two easier ones are either the menu hook or the raw key hook.

The menu hook gets called rather frequently when the menu shows up so you might be able to tweak some stuff (set a breakpoint at the start of your hook (after checking for the correct menu) and look around at what has been set up. This is your best bet for tweaking stuff). The raw key hook would basically be you completely changing the function of the program button. I don't know what your plans are, but this is probably the more difficult of the two because you'd have to make your own menu.

If this is the first time you've used hooks, you should check out my hook guide.


Now, the third option is patching the OS. This is pretty tricky actually and probably isn't the option you want to use. But, of course, we don't know what you want to change.

Finally, you've sadly picked the worst menu to change. The program menu is generated dynamically and is a pain to mess around with.
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 bobbean

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 14
  • Rating: +2/-0
    • View Profile
Re: Redesigning Menus
« Reply #4 on: September 14, 2013, 01:44:57 am »
Sorry, I should explain more. What I want to do is get rid of the old menu all together (if possible) and just make my own from scratch. Probably have the top 5 buttons do some sort of function, like archive, delete, run, rename, and edit. Kinda like mirage, but simplified. So I assume using a menu hook might me more difficult than its worth.

I was thinking using a key hook could work, but i'm not sure exactly how to go about implementing it. If you haven't already realized i'm kinda a noob :P I could probably figure out the menu on my own, but with the more advanced stuff i'm lost.

Also, while i'm here, what would be the best way to write and test my code? I'm using mimas right now, which is nice, but has no debugging features. (Like I said i'm a noob).


And a little side note, I think you've sent me the links to your hooks 3 or 4 times now :D

Offline chickendude

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 817
  • Rating: +90/-1
  • Pro-Riot Squad
    • View Profile
Re: Redesigning Menus
« Reply #5 on: September 14, 2013, 07:24:34 am »
I would quit programming on-calc and use spasm or brass to assemble with and TilEm2 or WabbitEmu (or even PindurTI) to debug. What exactly do you need help with? Setting up the hook? Coding the menu?

EDIT: From the information on WikiTI i just built a quick program (well, app) to install a raw keyhook to check if Prgm was pressed.
To assemble you'll need ti83plus.inc and app.inc, attached. To assemble you might need to download spasm.
Code: [Select]
#include "ti83plus.inc"
#include "app.inc"

defpage(0, "PrgmMenu")

start:
bcall(_ClrLCDFull)
bit rawKeyHookActive,(iy+sysHookFlg) ;check if hook is active
jr z,activate
;uninstall hook
ld hl,uninstalledTxt
call AppPutS
bcall(_ClrRawKeyHook)
jr quit
;install hook
activate:
ld hl,installedTxt
call AppPutS
in a,(6) ;load the current page into a
ld hl,prgmMenu
bcall(_SetGetKeyHook)
quit:
call pause
bjump(_JForceCmdNoChar) ;ciao!

AppPutS:
ld a,(hl)
or a
ret z
bcall(_PutC)
inc hl
jr AppPutS

pause:
xor a
out (1),a
push af
pop af ;delay for slower calcs
in a,(1)
inc a
jr nz,$-3 ;wait for all keys to be released
in a,(1)
inc a
jr z,$-3 ;wait for a key to be pressed
ret

installedTxt:
.db "Hook Installed!",0

uninstalledTxt:
.db "Hook Uninstalled",0

prgmMenu:
.db 83h ;required byte
cp kPrgm ;check if [Prgm] was pressed
ret nz
ld hl,noMenuTxt
call AppPutS
call pause
bcall(_ClrScrn)
bcall(_HomeUp)
xor a ;set z to ignore keypress
ret

noMenuTxt:
.db "Haha! Now you   have no menu!",0

I'd never used hooks before, either, but the information's out there :)
« Last Edit: September 14, 2013, 08:13:16 am by chickendude »

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: Redesigning Menus
« Reply #6 on: September 14, 2013, 11:34:15 am »
Spasm all the way. I made you a little asm suite that you can use. Just unzip it and put the asm_anywhere folder wherever you want (you can rename it). I would rename it asm and put it at C:\, but that's just me.

To use it, write your source files in the source folder using the template I gave you. Then, to assemble them, double click "double click me.bat" and type

asm <program name>

without the <>. So "asm template" would assemble the template. After that, your program to run will appear in exec.


I like wabbitemu and you can get it here. I've probably logged >400 hours in the debugger.


And finally, chickendude has the right idea. I'll attach a spasm friendly app so you can just gut it and make your own. To assemble an app, just use "app" instead of "asm".
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 bobbean

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 14
  • Rating: +2/-0
    • View Profile
Re: Redesigning Menus
« Reply #7 on: September 14, 2013, 04:16:22 pm »
Thanks chickendude, that's what pretty much what I was asking for. :D But one question, why did you write your own print string function rather than use putS?

Also, thepenguin, did just you make that suite or did you have it already? If you just made it you are amazing. Just a small problem though, I had to download a newer version of spasm from the wabbit website for it to work.

Offline chickendude

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 817
  • Rating: +90/-1
  • Pro-Riot Squad
    • View Profile
Re: Redesigning Menus
« Reply #8 on: September 14, 2013, 04:32:16 pm »
I don't know all the fancy terminology, sorry, someone else can probably fill you in on that. Essentially _PutS reads the string from the address in HL, but an application is stored in flash (in the memory bank that covers $4000-$7FFF). When you jump to the bcall, the flash page that was loaded into that memory bank gets swapped out and the page the bcall is on gets swapped in. Thus the string that was in your application is no longer loaded at that address. _PutC draws the character loaded in the accumulator (a) so you don't have to worry about all that. Another option would be loading your string into safeRAM before calling _PutS.

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: Redesigning Menus
« Reply #9 on: September 14, 2013, 08:10:52 pm »
I just made it. It's not much more than a few folders with 3 .bat files. After a while you can write this stuff without really thinking about it.

Btw, the backups folder is there in case you accidentally delete a file. I've done it before and it sucks. It's not the best backup system, but it works.
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