Calculator Community > ASM

Miscellaneous ASM Questions

<< < (3/5) > >>

Sue Doenim:
I don't think I'll keep trying to make that program. I like the idea, but there are just some logistical issues. Things like "sin(arcsin(" would get messed up a bunch, and I don't see a nice way to fix that problem. I decided to work on another similar but probably simpler thing. My friend is a tau enthusiast, and he would like the pi keypress to be replaced with a functional tau keypress. (In case you don't know, τ=2π.) I was thinking I would set a raw key hook, and whenever pi is pressed, I would add tau to prgm!. Then I'd install a homescreen hook to allow the tau token to signify its value. What I'm not sure about is what prgm# is. Wikiti says "To retreive the expression to be evaluated use prgm#," but does that mean I edit prgm# to change the answer? Does prgm# hold a copy of prgm!, or what? My plan was to insert "(6.28[etc.])" Where ever a tau was.

Xeda112358:
Oh, you might actually be able to do that relatively easily. If there is a getKey code for the tau token (you'd have to look it up, there might not be), then you could use a getKey hook to override a [PI] keypress.

Then you also have a parser hook that replaces all of the tau tokens with 2pi before passing it back to the OS parser. The nice thing is that 2pi takes 2 bytes and tau is a 2-byte token, so you don't even need to resize. I don't think the parser hook has a mode for when a program ends, so you won't be able to re-replace the 2pis as taus that way, but you could probably make your getKey hook do it!

EDIT: there is in fact a ktau in the ti83plus.inc ! You'll want to use the RawKeyHook and the Parser hook.

Sue Doenim:
I got the Raw Key Hook to work, so now pi keypresses put a tau token. I'm not sure about the Parser hook. I think I understand it pretty well. Replacing all of the tau tokens with 2pi wouldn't always work, though, would it? If you have 3tau, wouldn't that become 32pi?

Xeda112358:
Oh, you are right about that. That would be a little more difficult as you would have to resize variables.
When the parser hook triggers mode 0, the name of the program being parsed is in basic_prog. You could first scan for all tau tokens that can be directly replaced (and replace them), while counting all of the ones that need extra work. Then verify there is enough memory to insert an additional two bytes for each remaining entry. Use InsertMem at the end of the program, but remember to adjust the variable's size bytes as well as basic_end. Finally, replace the remaining tau tokens with "(2pi)".

It is a complicated process, so good luck!

Sue Doenim:
You wouldn't be able to modify the function of the tau token using the other modes of the parser hook, would you? That seems like it would be a cleaner, if more difficult solution.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version