Omnimaga
Calculator Community => TI Calculators => Axe => Topic started by: Axe Programmer on June 04, 2013, 10:38:36 am
-
Hey guys,
Axe Programmer here. I was wondering if one you smart people out there could help me with sprite rotation in axe. For example say if I had [000000FFFF000000] -> Pic1. If I do rotc(Pic1), how do I display that? I am making an awesome game that I will put out soon. Thanks. ;D
-
There are built in commands to do this; rotC( is ShadeNorm(), and rotCC is Shade_t(). Note, however, that these are not recursive functions, so you can't chain them (like rotC(rotC(Pic1))).
-
You can use rotated/flipped 8*8 sprites pretty much wherever you could normally reference a sprite pointer, such as immediately in a sprite drawing command:
Pt-Off(X,Y,rotC(Pic1))
You can even store the result of rotC(Pic1) (a pointer to the rotated sprite) to a variable to use it later. But beware that the sprite data will be overwritten if you rotate/flip any other sprites because all those operations put the output sprite in the same 8-byte area, so the result is really a pointer that always represents the most recently rotated/flipped sprite. If you want to save a resulting sprite for later so subsequent rotates/flips do not overwrite it, copy it to another 8-byte area of memory you've allocated for it.
Take note that, as leafy mentioned, you cannot nest calls to the rotate/flip functions, because they need the input and output areas to be different to function properly; except for flipH(). One nice aspect of this is that you can rotate a sprite 180 degrees with flipH(flipV(sprite)), but only in that order!
-
Thanks for the help, I have another question. How can you check your battery in axe? Like how much you have left?
-
That would require some assembly I think. Ask on the ASM board for an hex code that'll do what you want.
-
From Xeda's opcodes
Smart Battery Check
EF6F4C3D280A78FE1E
EF21521808
EFB3503E042001AF
EF8C47EFBF4AC9
This is my BSA (Battery Status All) program. If you are
running an 83+, a value of either 0 or 4 is stored in Ans. If
you are using an 84+, a value from 0 to 4 is stored to Ans. 0
is the worst and 4 is the best. To be clear, 2 (meaning your
batteries are okay) is a possible output if you are using an
84+.
(of course, add the Asm() commands in front of each hex code line, or put them all in one line and put an Asm in front of that line).
-
I am working on a battery program. I was wondering how I could display something in the corner of the screen while the calculator is operating normally. I want to make a program that can answer all equations typed in by the user but at the same time show something at the top of the screen. Basically I want to control input. the input command in axe does not let you do anything while the user is entering what they want. Also they can press [2nd]+Mode and exit which I do not want. thanx to whoever figures this out. :)
-
you CAN do other things while running the Input command if you use interrupts. interrupts do exactly what they sound like; they interrupt whatever code is running at regular intervals in order to run something else before returning you back to your previous position to continue running there. it isn't too difficult to manage in axe, and the documentation explains fairly thoroughly, so i won't go into more detail.
if you want to display this during normal homescreen operations, though, then the problem becomes more difficult. i think it could be managed with a somewhat hackish combination of hooks (something like using the cursor hook (http://wikiti.brandonw.net/index.php?title=83Plus:Hooks:9B7C) for a makeshift timer to update your battery icon periodically and then using the homescreen hook (http://wikiti.brandonw.net/index.php?title=83Plus:Hooks:9B8C) to redraw it whenever the screen has been updated). i'm not the person to ask about how to manage this, how good it would look, or if it's even possible, though :P.
-
thanks but is there a tutorial on how to use interrupts?
-
like i said, look in the included documentation for whatever version of axe you downloaded. basically, though, all you have to do is set the interrupt frequency (how often the subroutine will be called) and destination (the name of the subroutine to be called) with
fnInt(LBL,FREQ)
use
FnOn
to enable the interrupt when you want it running, use
FnOff
any time within your code when you want to temporarily disable them, and
LnReg^r
before exiting your program to disable the interrupts and clean things up again for the os.
EDIT: also, these interrupts are fired VERY rapidly, much more rapidly than your battery icon need be redrawn or any battery checking need to be done. for the best results on this project, you should set frequency to 6 (the highest number allowed. higher numbers indicate a lower frequency because it's talking about the duration between interrupts, so i guess "period" would probably be a better description than "frequency" for this field) and then only check once out of every several times the subroutine is executed or (if you're running on a model with crystal timers), use those and (check the battery|update the battery icon) only every second or so.
-
so where would I put the command for interrupts in the following:
FnOn
Repeat getkey(15)
input
End
-
fnInt(NAME,6)
FnOn
Repeat getkey(15)
input
End
LnReg^r
Return
Lbl NAME
<interrupt code goes here>
-
I entered that code into a program and under the label I made it display hello at the top of the screen. the program froze and cleared my ram. what happened?
by the way thank you so much for all this help :)
-
The input command gives full control to the OS, so custom interrupt will be disabled. The only way to alter the functionality of input is with hooks, which are difficult enough to coordinate properly in assembly and not supported Axe features.
-
/\i didn't know it disabled them. thanks =)
in that case, you'll have to piece together an input routine of your own (which is probably a good idea anyways, because the "built in" input routine is a bit messy). there are lots of examples floating around the forums that you could steal and use with practically no changes. give it a quick search =)