• Axe Q&A 5 5
Currently:  

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

0 Members and 3 Guests are viewing this topic.

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Axe Q&A
« Reply #1470 on: April 22, 2012, 10:48:26 am »
When I say {L1+200+A}, is L1+200 calculated when parsing or when executing ?
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 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 #1471 on: April 22, 2012, 11:38:06 am »
Axe calculates it when compiling. (You can optimize it more as {A+L1+200}, by the way. Always put constants after.)
« Last Edit: April 22, 2012, 11:38:14 am by Deep Thought »




Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Axe Q&A
« Reply #1472 on: April 22, 2012, 11:40:15 am »
Axe calculates it when compiling. (You can optimize it more as {A+L1+200}, by the way. Always put constants after.)
Ok thanks :)
(and for putting constants after, I do it for little pieces of code like A+3→A but I always forget it otherwise -.-°)
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 Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Axe Q&A
« Reply #1473 on: April 25, 2012, 02:34:12 am »
Hayleia:
A and 1
A^2
Which one is the lightest/fastest ?



Runer112 (I don't remember exactly):
and 1 is smallest and fastest but doesn't touch the highest byte.



aeTIos:
What is the "and" equivalent of ^2 then ?


(That would be great if aeTIos and Runer112 posted their answers back :) (Moreover, I may have written wrong things))


Hayleia, edit

There is sub(LBL,arg) and sub(LBLr,arg).
There is LBL(arg). But is LBLr(arg) valid ??

How much space does calling "stdDev(PTR,N)" take ??
How much space does calling "sub(LBLr,arg)" take ??
« Last Edit: April 25, 2012, 07:57:19 am 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 Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Axe Q&A
« Reply #1474 on: April 25, 2012, 08:32:15 pm »
aeTIos:
What is the "and" equivalent of ^2 then ?

and 1 pretty much is the equivalent of ^2; and 2 just doesn't set the high byte to 0, and is thus 2 bytes smaller and 7 cycles faster. Or you could use the full 16-bit bitwise AND, ·1, which results in the exact same compiled code as ^2.

There is sub(LBL,arg) and sub(LBLr,arg).
There is LBL(arg). But is LBLr(arg) valid ??

I would imagine that LBL(args)r doesn't exist because parsing that would require look-ahead parsing to detect the r before the arguments are parsed, but LBLr(args) seems like it could be implemented. Not sure why it isn't yet.

How much space does calling "stdDev(PTR,N)" take ??
How much space does calling "sub(LBLr,arg)" take ??

Excluding PTR and N of course, the stdDev(PTR,N) call takes 4 bytes, plus 14 bytes for the routine itself.
Again excluding the arguments, sub(LBLr,args) takes a pretty substantial 12 bytes per argument, plus 3 bytes for the call. Unless you absolutely must have a recursive function, I suggest avoiding this, as this costs an extra 9 bytes per argument.

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Axe Q&A
« Reply #1475 on: May 01, 2012, 11:28:15 am »
Ok, new question :P

When I do
__________________________________

Text(0,0,"text")
...
some more code here
...
Text(0,6,"text")
.the same "text" word as before
__________________________________

Is "text" stored once in memory or twice ?
« Last Edit: May 01, 2012, 11:28:52 am 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 MGOS

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 336
  • Rating: +95/-0
    • View Profile
Re: Axe Q&A
« Reply #1476 on: May 01, 2012, 11:35:00 am »
Twice (or as often you use it). To prevent that, you can do
Code: [Select]
"text"->str1
...
text(0,0,str1)
...
text(0,6,str1)

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Axe Q&A
« Reply #1477 on: May 01, 2012, 12:46:14 pm »
Twice (or as often you use it). To prevent that, you can do
Code: [Select]
"text"->str1
...
text(0,0,str1)
...
text(0,6,str1)
I know how to prevent it, I am just lazy and wanted to know if I had to prevent it or no :P
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 Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Axe Q&A
« Reply #1478 on: May 03, 2012, 01:01:20 pm »
(double posting after a little while)

How do we end a conditionnal comment ? with "..." or "...End", like
   this   or this
   ...If CST   ...If CST
   code   code
   ...End   ...
?
« Last Edit: May 03, 2012, 01:02:18 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 kindermoumoute

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 836
  • Rating: +54/-3
    • View Profile
Re: Axe Q&A
« Reply #1479 on: May 03, 2012, 02:44:09 pm »
If °CONST=83, Code1 is compiled, else Code2.
Code: [Select]
:83->°CONST
:
:...If °CONST=83
:.Code1
:...Else
:.Code2
:...End
Projects :

Worms armageddon z80 :
- smoothscrolling Pixelmapping : 100%
- Map editor : 80%
- Game System : 0%

Tutoriel français sur l'Axe Parser
- 1ère partie : en ligne.
- 2ème partie : en ligne.
- 3ème partie : en ligne.
- 4ème partie : 10%
- Annexe : 100%

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: Axe Q&A
« Reply #1480 on: May 03, 2012, 02:56:02 pm »
What's the sense of using comment ifs?
I mean, you could just make it normal, I don't think it compiles different on other calcs....

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Axe Q&A
« Reply #1481 on: May 03, 2012, 02:56:33 pm »
I was just asking for the End, but thanks anyway :)
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 Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Axe Q&A
« Reply #1482 on: May 03, 2012, 04:49:07 pm »
If °CONST=83, Code1 is compiled, else Code2.
Code: [Select]
:83->°CONST
:
:...If °CONST=83
:.Code1
:...Else
:.Code2
:...End

If you tried to compile that, Axe would throw an error. :P There is no End to end conditional comments, you just end blocks like you would end any conditional comment:

Code: [Select]
:...If CONSTANT_EXPRESSION
:.Code goes here
:...Else
:.Other code goes here
:...





What's the sense of using comment ifs?
I mean, you could just make it normal, I don't think it compiles different on other calcs....

You are correct that the code doesn't compile differently on different calculator models on its own. But you can make it compile differently by changing the value of a constant, allowing you to quickly and easily change what code is compiled. This is useful for Axe libraries, creating multiple compiled variations of your program, and testing your programs, among other things. For instance, you could put blocks like this in your program:

Code: [Select]
...If °DEBUG
ClrHome
Disp A►Dec,i,B►Dec,i,C►Dec
getKeyʳ
...

And then simply change the value of the constant °DEBUG before compiling to allow you to turn debugging output on and off. The advantage over a normal If statement is that, if °DEBUG equals 0, the debugging code is not included in the compiled program, which is good if you have 500 bytes of debugging code and you don't want it bloating your official program release.
« Last Edit: May 04, 2012, 01:01:39 am by Runer112 »

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Axe Q&A
« Reply #1483 on: May 04, 2012, 12:57:46 am »
There is no Else or End with conditional comments
???
Commands.html says that "Else" is possible.
But thanks for telling me how to end those conditional comments :)
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 Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Axe Q&A
« Reply #1484 on: May 04, 2012, 01:00:26 am »
Oops, I wasn't correctly remembering my previous experience with conditional comments. Yes, ...Else works. What had me confused is that I remembered ...ElseIf not working and I must have grouped the two together in my mind.