Author Topic: Axe Language  (Read 6897 times)

0 Members and 1 Guest are viewing this topic.

Offline Axe Programmer

  • LV2 Member (Next: 40)
  • **
  • Posts: 32
  • Rating: +0/-0
    • View Profile
Axe Language
« 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

Offline leafy

  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1554
  • Rating: +475/-97
  • Seizon senryakuuuu!
    • View Profile
    • keff.me
Re: Axe Language
« Reply #1 on: June 04, 2013, 10:43:34 am »
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))).
In-progress: Graviter (...)

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Axe Language
« Reply #2 on: June 04, 2013, 11:51:08 am »
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!
« Last Edit: June 04, 2013, 11:56:13 am by Runer112 »

Offline Axe Programmer

  • LV2 Member (Next: 40)
  • **
  • Posts: 32
  • Rating: +0/-0
    • View Profile
Re: Axe Language
« Reply #3 on: June 24, 2013, 02:13:58 pm »
Thanks for the help, I have another question. How can you check your battery in axe? Like how much you have left?

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: Axe Language
« Reply #4 on: June 24, 2013, 03:24:22 pm »
That would require some assembly I think. Ask on the ASM board for an hex code that'll do what you want.

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Axe Language
« Reply #5 on: June 24, 2013, 11:57:16 pm »
From Xeda's opcodes

Quote 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).
« Last Edit: June 24, 2013, 11:57:31 pm by Hayleia »
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline Axe Programmer

  • LV2 Member (Next: 40)
  • **
  • Posts: 32
  • Rating: +0/-0
    • View Profile
Re: Axe Language
« Reply #6 on: August 06, 2013, 05:47:20 pm »
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. :)
« Last Edit: August 06, 2013, 05:48:44 pm by Axe Programmer »

Offline shmibs

  • しらす丼
  • Administrator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2132
  • Rating: +281/-3
  • try to be ok, ok?
    • View Profile
    • shmibbles.me
Re: Axe Language
« Reply #7 on: August 07, 2013, 12:58:20 am »
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 for a makeshift timer to update your battery icon periodically and then using the homescreen hook 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.

Offline Axe Programmer

  • LV2 Member (Next: 40)
  • **
  • Posts: 32
  • Rating: +0/-0
    • View Profile
Re: Axe Language
« Reply #8 on: August 07, 2013, 02:25:16 pm »
thanks but is there a tutorial on how to use interrupts?

Offline shmibs

  • しらす丼
  • Administrator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2132
  • Rating: +281/-3
  • try to be ok, ok?
    • View Profile
    • shmibbles.me
Re: Axe Language
« Reply #9 on: August 07, 2013, 02:29:36 pm »
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
Code: [Select]
fnInt(LBL,FREQ)use
Code: [Select]
FnOnto enable the interrupt when you want it running, use
Code: [Select]
FnOffany time within your code when you want to temporarily disable them, and
Code: [Select]
LnReg^rbefore 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.
« Last Edit: August 07, 2013, 02:36:24 pm by shmibs »

Offline Axe Programmer

  • LV2 Member (Next: 40)
  • **
  • Posts: 32
  • Rating: +0/-0
    • View Profile
Re: Axe Language
« Reply #10 on: August 07, 2013, 02:36:07 pm »
so where would I put the command for interrupts in the following:

FnOn
Repeat getkey(15)
input
End

Offline shmibs

  • しらす丼
  • Administrator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2132
  • Rating: +281/-3
  • try to be ok, ok?
    • View Profile
    • shmibbles.me
Re: Axe Language
« Reply #11 on: August 07, 2013, 02:38:12 pm »
fnInt(NAME,6)

FnOn
Repeat getkey(15)
input
End

LnReg^r

Return

Lbl NAME
<interrupt code goes here>

Offline Axe Programmer

  • LV2 Member (Next: 40)
  • **
  • Posts: 32
  • Rating: +0/-0
    • View Profile
Re: Axe Language
« Reply #12 on: August 07, 2013, 02:44:46 pm »
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 :)

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Axe Language
« Reply #13 on: August 07, 2013, 02:59:13 pm »
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.

Offline shmibs

  • しらす丼
  • Administrator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2132
  • Rating: +281/-3
  • try to be ok, ok?
    • View Profile
    • shmibbles.me
Re: Axe Language
« Reply #14 on: August 07, 2013, 03:01:53 pm »
/\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 =)