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
Mapar007


Advanced Member


Joined: 04 Oct 2008
Posts: 365

Posted: 26 Dec 2009 09:54:35 am    Post subject:

Wait... Wasn't the GetKey hook for GetCSC? (oh man, I've misinterpreted that right from the start...)

Last edited by Guest on 26 Dec 2009 09:54:58 am; edited 1 time in total
Back to top
FloppusMaximus


Advanced Member


Joined: 22 Aug 2008
Posts: 472

Posted: 26 Dec 2009 10:08:46 pm    Post subject:

There's been a lot of confusion about both of those hooks in the past. Part of that confusion is the fact that the GetKey hook deals, in part, with keypad scancodes (i.e., "GetCSC" values). But the hook is only called by the GetKey routine, so it can only modify the behavior of programs that use GetKey.

The GetKey hook is called at two points while GetKey is running. First, when GetKey first starts up, or after a key is pressed, but before displaying the cursor, the hook is called with A=1Ah. At that point, if the hook returns with zero set, the value of A is taken as a keycode, and GetKey returns immediately.

Second, after each time GetCSC is called, the hook is called with A=1Bh and B being the value returned by GetCSC (usually either zero or a scancode). If the hook returns with zero set, again, A is taken as a keycode and GetKey returns. Otherwise, A is taken as a scancode which is handled by GetKey as usual.
Back to top
account4me2


Newbie


Joined: 16 Jun 2009
Posts: 27

Posted: 28 Dec 2009 06:52:06 pm    Post subject:

Guys, I gave the first post a significant overhaul because it was a bit misleading - I've made things clearer now, and added info I've learned from this thread.


magicdanw wrote:
Regardless of whether they're blocked as a rule, it's very possible for them to be explicitly blocked by an application. You've gotta experiment with the application you want to run and try to find one that doesn't get blocked. I'd check out the app change hook, personally.

I don't really know a thing about the app change hook, magicdanw, but do you mind explaining how it would solve my problem? One thing I think I know is that it doesn't watch for keypresses, so how could it be useful?

FloppusMaximus wrote:
The (bizarrely named) RawKey hook is only called when the system monitor is running. So no, it will not be called during most Flash apps. It's not a matter of "blocking". Likewise, many other hooks (parser, localization, help, menu, catalog, graphing, etc.) will not be called during a typical Flash app, because most apps don't use those OS features.

Interesting. So which hooks will be called during a typical Flash app? Could any of them be useful here?

FloppusMaximus wrote:
The GetKey hook is called when the GetKey routine is running (which is the case for many, but by no means all, Flash applications.) If the GetKey routine is running, then (theoretically, at least) it should be safe for you to call a routine such as JForceCmdNoChar that exits the running app.

Would it be plausible to edit NoteFolio so that it runs the GetKey routine, so we can do exactly what you said? And while we're at it, does the RawKey hook work the same way (does it only work when a 'RawKey routine' is running, and thus if we run that routine, the hook will work?)?


Again, guys, thanks for all your help.
Back to top
FloppusMaximus


Advanced Member


Joined: 22 Aug 2008
Posts: 472

Posted: 28 Dec 2009 10:35:07 pm    Post subject:

Well, I've looked at Notefolio a little bit, and it is incredibly bizarre. You can forget about most of what I just said. :)

The app is actually monitor-driven (I have no idea why) but instead of using cxMain, it receives keypresses using a RawKey hook. Essentially the entire app is driven by calls to that hook; it's a ridiculously complicated way to do something really simple (i.e., GetKey in an infinite loop.) So while it's true that setting a RawKey hook prior to starting Notefolio won't do any good, it's for a rather different reason than I was thinking. :)

Anyway, Notefolio also uses GetKey and font hooks for whatever reason; and it also disables most other hooks while it's running. So if you want to hook your own code in there somewhere, you'll need to be very sneaky. One thing you could do would be to install a localize hook (one of the few hooks Notefolio doesn't disable) that would wait until Notefolio starts up, then replace (say) Notefolio's RawKey hook with your own hook (which, in addition to whatever else it did, would need to call Notefolio's hook.) This is really a horrible kludge, and whatever it is you're trying to do, you may find it easier to replace Notefolio than to try to hack around it like this.

As to what hooks will be called during a *normal* Flash app's execution? Well, lots of apps use GetKey, so the GetKey hook will work a lot of the time, as will the silent link hook. The cursor hook will work if the app uses a cursor; the drawing hook will work if the app uses system drawing routines like IPoint and ILine. Nearly all apps display text at some point, so the font and localize hooks will usually get called at least once. The USB hook will work nearly everywhere. Of course, most of these are not terribly useful; what you really want to know is what hook(s) will be called at the correct time for what you're trying to do (intercept keypresses, display stuff on screen, or whatever.)

I think magicdanw's point was that you could use the app change hook to detect when Notefolio exits (i.e., after the user presses 2nd+Quit); you could regain control at that point and do whatever you want.
Back to top
magicdanw
pcGuru()


Calc Guru


Joined: 14 Feb 2007
Posts: 1110

Posted: 29 Dec 2009 01:24:57 am    Post subject:

Yep. Install an app change hook before running Notefolio, and when you quit the app (with the normal keypress, I know you wanted to change it, but that'd be another thing to figure out...) the hook should be called with A=0.
Back to top
account4me2


Newbie


Joined: 16 Jun 2009
Posts: 27

Posted: 29 Dec 2009 10:37:02 pm    Post subject:

FloppusMaximus wrote:
One thing you could do would be to install a localize hook (one of the few hooks Notefolio doesn't disable) that would wait until Notefolio starts up, then replace (say) Notefolio's RawKey hook with your own hook (which, in addition to whatever else it did, would need to call Notefolio's hook.) This is really a horrible kludge, and whatever it is you're trying to do, you may find it easier to replace Notefolio than to try to hack around it like this.

Does that method involve more work than changing NoteFolio's quit sequence and using an app change hook like magicdanw suggested?

And what do you mean by 'replace Notefolio' - do you mean find an alternative app that serves the same purpose (if you know of one, feel free to suggest it)?


It seems from those other hooks you mentioned that the other methods we've discussed (localize, app change) could be easier or better suited to this purpose. Thanks for the info though. Smile
Back to top
FloppusMaximus


Advanced Member


Joined: 22 Aug 2008
Posts: 472

Posted: 30 Dec 2009 08:57:40 pm    Post subject:

How else would you propose to change the quit key, if not by using a key hook?
Back to top
magicdanw
pcGuru()


Calc Guru


Joined: 14 Feb 2007
Posts: 1110

Posted: 30 Dec 2009 09:09:15 pm    Post subject:

Maybe if you say what exactly this whole mess is going to be used for, we can recommend another app, or a way to implement functionality into your own program. Basically, what is your goal here?
Back to top
account4me2


Newbie


Joined: 16 Jun 2009
Posts: 27

Posted: 01 Jan 2010 12:22:53 am    Post subject:

FloppusMaximus wrote:
How else would you propose to change the quit key, if not by using a key hook?

Originally magicdanw offered to attempt a disassembly, but the thread then got sidetracked (http://www.unitedti.org/forum/index.php?s=&showtopic=9181&view=findpost&p=139390).

So would that method (changing NoteFolio's quit sequence via disassembly and using an app change hook in ASM app #1 to detect NoteFolio's quit) be simpler or more complicated than the localize hook method?


and magicdanw don't worry about recommending another app. what I need for ASM application #2 is a decent document creator+viewer, and I'm almost certain there is none that compares to NoteFolio. asm app #1 I'm certain can't be replaced.


Last edited by Guest on 02 Jan 2010 03:21:03 am; edited 1 time in total
Back to top
DrDnar


Member


Joined: 28 Aug 2009
Posts: 116

Posted: 01 Jan 2010 01:12:41 pm    Post subject:

Oh, well, I'm working on an application that may provide just that. You'll just have to wait until I possibly never finish it. (It may turn out to be slow and require a rewrite.) But I'm hopeful I can have basic editing functionality working by the time my break is over. I already plan on allowing external applications to access the editing functionality via its own callback mechanism. The application would have the responsibility of handling keypresses, and thereby have pretty good control over the edit buffer. For example, if you only wanted to let the user enter a number, you would just not pass any other keys to the editor than numbers.

The editor uses a custom variable width, variable height font routine that can read the font data from both RAM and the archive. It can currently display a string in a box of any size with word wrap and stops when the box is full. The project is currently in an organization and planing stage, as I've found that making an editor with word wrap isn't a trivial task. Here's an old screen shot just because I have it:
Back to top
FloppusMaximus


Advanced Member


Joined: 22 Aug 2008
Posts: 472

Posted: 02 Jan 2010 11:02:09 pm    Post subject:

Great, now you've got that stuck in my head. :P

TI probably would not appreciate you distributing modified versions of the NoteFolio app, so I wouldn't recommend going that route. In any case, if your app is going to depend on NoteFolio, better to depend on the original NoteFolio than some hacked version.

It's a shame there aren't any really good text editors for the TI-83+; I like Evan Hoke's QWERTY, but it's lacking a lot of features, and it has a bit of a learning curve. I'm looking forward to seeing yours, Dr. D'nar, when it gets finished.
Back to top
DrDnar


Member


Joined: 28 Aug 2009
Posts: 116

Posted: 03 Jan 2010 01:10:23 am    Post subject:

Hehe!

I liked QWERTY too, though the curvyness of the TI-84+ makes it harder to use. And the fact that my hands have grown since eighth grade, but that's a different matter. It would be possible to add support for QWERTY-style editing easily enough.

The editor is currently taking 0.2 seconds per screen redraw. I may have to drop support for archived fonts and data to speed things up.

Over the weekend I hacked up a mostly functional font editor in Visual Basic Express. All it's currently missing is the ability to save font files, though it can load them.
Back to top
FloppusMaximus


Advanced Member


Joined: 22 Aug 2008
Posts: 472

Posted: 03 Jan 2010 10:18:53 pm    Post subject:

Reading data from the archive shouldn't be a major bottleneck if done properly. If you're using VPutMap or UserPutMap, that's probably a bigger issue; even in textWrite mode, those routines are disgustingly slow. Flashbook gets pretty good frame rates just using LoadPattern and a custom display routine, as well as keeping a table of character widths cached in RAM.

Back on topic (sort of), account4me2, I think if you could explain in more detail what it is you're trying to do with NoteFolio, we might be able to give you better advice.


Last edited by Guest on 03 Jan 2010 10:22:09 pm; edited 1 time in total
Back to top
account4me2


Newbie


Joined: 16 Jun 2009
Posts: 27

Posted: 13 Jan 2010 02:32:52 am    Post subject:

[quote name='Dr. D'nar' post='139619' date='Jan 1 2010, 07:12 PM']Oh, well, I'm working on an application that may provide just that.[/quote]
Sounds good. Be sure to post a link here when you've completed it. Smile Btw are you using the GetKey hook in your app?



FloppusMaximus wrote:
TI probably would not appreciate you distributing modified versions of the NoteFolio app, so I wouldn't recommend going that route.

Well I wouldn't be distributing it, it would be for me only. So in light of that fact, do you mind answering this:
account4me2 wrote:
So would that method (changing NoteFolio's quit sequence via disassembly and using an app change hook in ASM app #1 to detect NoteFolio's quit) be simpler or more complicated than the localize hook method?

(How much work is involved in each?)


FloppusMaximus wrote:
Back on topic (sort of), account4me2, I think if you could explain in more detail what it is you're trying to do with NoteFolio, we might be able to give you better advice.

Well I've already explained in pretty good detail what I want to do...
Quote:
ASM application #2 is already written to quit normally by pushing [2nd]+[Mode] aka 'Quit', and its source is unavailable (ideally, multiple apps could be used as 'ASM application #2', however 'NoteFolio' made by TI is the one I'm most interested in).
ASM application #1 has a specific function to perform and could be written to either:
a)perform this function once run, or
b)perform this function in response to a combination of keypresses,
and it's source is available.
When [Down Arrow]+[Clear] is pushed, ASM application #2 is quit and ASM application #1's function is performed.

It's no more complicated than that (the function of ASM application #1 isn't worth explaining because it's irrelevant). I'm just looking for the simplest way to quit NoteFolio and perform ASM application #1's function in response to [Down Arrow]+[Clear].


Thanks again for your help guys!
Back to top
magicdanw
pcGuru()


Calc Guru


Joined: 14 Feb 2007
Posts: 1110

Posted: 13 Jan 2010 07:32:28 am    Post subject:

Based on what's been said about how Notefolio uses the monitors, I suspect it would be more difficult than I thought to modify which key quits the app, and what it does from there. I said that when I thought you were talking about a program, not an application.

It still might help if you explain that "irrelevant" function of the other application. You never know!
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
    » Goto page Previous  1, 2
» View previous topic :: View next topic  
Page 2 of 2 » All times are UTC - 5 Hours

 

Advertisement