• Axe Q&A 5 5
Currently:  

Author Topic: Axe Q&A  (Read 599919 times)

0 Members and 9 Guests are viewing this topic.

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: Axe Q&A
« Reply #1425 on: March 17, 2012, 06:27:42 pm »
As far as I know, if you use a custom named variable, it is impossible to modify the location it points to, as it is treated as a constant pointer.  It is also impossible to have only a single byte custom variable as far as I know.

Actually, you can have a single byte variable with custom names just as you can do with the regular variables.  Using the r modifier after the variable name treats it as a single byte value rather than a 2 byte value.
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline ccadem

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 5
  • Rating: +0/-0
    • View Profile
Re: Axe Q&A
« Reply #1426 on: March 17, 2012, 07:27:07 pm »
Where can I find a good, basic Axe tutorial?

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Axe Q&A
« Reply #1427 on: March 17, 2012, 08:02:19 pm »
The best one so far (unless you're a French speaker) is still the Documentation.pdf file included with Axe.




Offline mrmprog

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 559
  • Rating: +35/-1
    • View Profile
Re: Axe Q&A
« Reply #1428 on: March 20, 2012, 01:21:44 pm »
In a game I am making, the AI needs to be able to tell how far away it is from the nearest black pixel, in each of the 4 directions. Could anyone write an extremly fast routine to acomplish this?
« Last Edit: March 20, 2012, 01:23:11 pm by mrmprog »

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Axe Q&A
« Reply #1429 on: March 20, 2012, 01:28:09 pm »
Code: [Select]
Lbl Black
0->r3
Repeat pxl-test(r1+r3++,r2+r3) or pxl-test(r1-r3,r2+r3) or pxl-test(r1+r3,r2-r3) or pxl-test(r1-r3,r2-r3)
End
Return

That should work and be pretty fast too, although it will get slower as the enemy moves far away from other black pixels.  Would your level design warrant searching by steps larger than 1?

Offline Darl181

  • «Yo buddy, you still alive?»
  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3408
  • Rating: +305/-13
  • VGhlIEdhbWU=
    • View Profile
    • darl181.webuda.com
Re: Axe Q&A
« Reply #1430 on: March 20, 2012, 02:34:06 pm »
So, files (Y1 etc) work in Copy() right?

Also say I getCalc(...)→{L1+8}r.  In a Copy statement, do I tell it L1+8 or do I somehow specify that it's two bytes?  Or does it default to two-byte values?
« Last Edit: March 20, 2012, 02:37:00 pm by Darl181 »
Vy'o'us pleorsdti thl'e gjaemue

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Axe Q&A
« Reply #1431 on: March 20, 2012, 03:27:07 pm »
So, files (Y1 etc) work in Copy() right?

Also say I getCalc(...)→{L1+8}r.  In a Copy statement, do I tell it L1+8 or do I somehow specify that it's two bytes?  Or does it default to two-byte values?

Yes Files work in a copy statement, but what do you mean by your second question?  The copy statement copies a certain number of bytes from one location to another

Offline Darl181

  • «Yo buddy, you still alive?»
  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3408
  • Rating: +305/-13
  • VGhlIEdhbWU=
    • View Profile
    • darl181.webuda.com
Re: Axe Q&A
« Reply #1432 on: March 20, 2012, 08:06:09 pm »
So, files (Y1 etc) work in Copy() right?

Also say I getCalc(...)→{L1+8}r.  In a Copy statement, do I tell it L1+8 or do I somehow specify that it's two bytes?  Or does it default to two-byte values?

Yes Files work in a copy statement, but what do you mean by your second question?  The copy statement copies a certain number of bytes from one location to another
Hm, how about "What's the syntax for how I do the L# pointer?"  Basically how do I tell it that it's a two-byte pointer and not a one-byte pointer.
By "location", I'm guessing that defaults to two bytes?  Not sure tho.
Vy'o'us pleorsdti thl'e gjaemue

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Axe Q&A
« Reply #1433 on: March 20, 2012, 08:12:31 pm »
How do you tell what that what is a two byte pointer?  Pointers in general are usually two bytes, and both {#} and {#}r can use two byte pointers.  Maybe post the code you are trying to get to work?

Offline Darl181

  • «Yo buddy, you still alive?»
  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3408
  • Rating: +305/-13
  • VGhlIEdhbWU=
    • View Profile
    • darl181.webuda.com
Re: Axe Q&A
« Reply #1434 on: March 20, 2012, 08:15:39 pm »
Don't have the full code atm, but it's like
Copy(Y1,L1+15,672)
I'm wondering if typing it like that would treat L1+15 as a two-byte pointer, rather than literally L1+15.
Vy'o'us pleorsdti thl'e gjaemue

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: Axe Q&A
« Reply #1435 on: March 20, 2012, 09:57:14 pm »
Copy(Y1,L1+15,672) will copy 672 bytes from Y1 to L1. Under normal cases, this means that {Y1+X} will now equal {L1+X} for any X between 0 and 671.
What I think you are afraid that that code might do would be expressed by Copy(Y1,{L1+15}r,672)
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline Darl181

  • «Yo buddy, you still alive?»
  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3408
  • Rating: +305/-13
  • VGhlIEdhbWU=
    • View Profile
    • darl181.webuda.com
Re: Axe Q&A
« Reply #1436 on: March 21, 2012, 06:40:08 pm »
Another, unrelated...
How far does the VAR++ / VAR-- syntax stretch?
I tried to optimize
{L2+10}++
If {L2+10}=8

to
!If {L2+10}++-8
And it didn't return true when it should in the context I'm using it :P though it did compile without error.
Putting parenthesis around {L2+10}++ didn't have the statement working either.  Also tried !If {L2+10}---255 (it's one byte) but it didn't do much.

I'm guessing it's peepholed anyways, but it makes for smaller source and faster typing.
The syntax appears kind of weird, but should this work?
Vy'o'us pleorsdti thl'e gjaemue

Offline jacobly

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 205
  • Rating: +161/-1
    • View Profile
Re: Axe Q&A
« Reply #1437 on: March 21, 2012, 06:48:05 pm »
Another, unrelated...
How far does the VAR++ / VAR-- syntax stretch?
I tried to optimize
{L2+10}++
If {L2+10}=8

to
!If {L2+10}++-8
And it didn't return true when it should in the context I'm using it :P though it did compile without error.
Putting parenthesis around {L2+10}++ didn't have the statement working either.  Also tried !If {L2+10}---255 (it's one byte) but it didn't do much.

I'm guessing it's peepholed anyways, but it makes for smaller source and faster typing.
The syntax appears kind of weird, but should this work?

The only time that the ++ or -- syntax ever returns the new value is for constant two-byte memory locations (including 2-byte variables).  What you want is: !If {{L2+10}++}-8

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Axe Q&A
« Reply #1438 on: March 21, 2012, 06:52:46 pm »
Hope this helps. Everything applies to -- as well. (Thanks to jacobly for correcting me on that second row.)
Syntax
Operation
Returns
Notes
{constant}r++Increments the two-byte value at constant pointer constant by oneNew value of {constant}rExactly identical to {constant}r+1→{constant}r
{variable}r++Increments the two-byte value at variable pointer variable by onevariable+1 if the new value of {variable}r is a multiple of 256, variable otherwise
{constant}++ or {variable}++Increments the one-byte value at pointer constant or variable by oneconstant or variableBoth constant and variable pointer expressions are treated the same way for one-byte increments
{constant}rr++ or {variable}rr++Increments the big-endian two-byte value at pointer constant or variable by onevariable if the new value of {constant}rr or {variable}rr is a multiple of 256, variable+1 otherwiseBoth constant and variable pointer expressions are treated the same way for big-endian increments
« Last Edit: July 30, 2012, 04:59:38 pm by Deep Thought »




Offline MGOS

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 336
  • Rating: +95/-0
    • View Profile
Re: Axe Q&A
« Reply #1439 on: April 02, 2012, 08:11:30 am »
For my project I need a flood-fill function. Is it possible to have such a recursive routine for the whole screen or will this lead to stack overflow?
Click here for an explanation what the function does.

EDIT: I found that with the search http://ourl.ca/7869 but it doesn't really help me, the routine causes my calc to crash.
« Last Edit: April 02, 2012, 09:16:06 am by MGOS »