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

0 Members and 3 Guests are viewing this topic.

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: Axe Q&A
« Reply #510 on: July 14, 2011, 11:22:49 pm »
By the way, using and not(mask) is actually much less optimized than doing and inverted_mask. If you're using a binary mask, change all the 0's to 1's or vice versa. If you're using a decimal mask, just subtract the mask from 255.
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Axe Q&A
« Reply #511 on: July 18, 2011, 02:20:59 pm »
Ok, I have a very newbish question. Are there the binary and,nand,or,xor,etc ops in Axe ? Not that (4 and 2 = 1) because 4 and 2 aren't 0 but that (00000100 and 00000010 = 00000000) ?
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 #512 on: July 18, 2011, 02:22:03 pm »
In Axe, the logical operators are binary operators. 4 and 2 equals 0 in Axe.

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Axe Q&A
« Reply #513 on: July 18, 2011, 02:23:09 pm »
O.O I didn't know that !
That's why I put "very newbish question".
Thanks a lot !!!
(I love Axe)

EDIT: You have exactly +255 respect O.O b11111111
« Last Edit: July 18, 2011, 02:25:13 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 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 #514 on: July 18, 2011, 02:37:04 pm »
It's and. 4 and 2 should actually return 0.

EDIT: Ninja'd by fifteen minutes ???
« Last Edit: July 18, 2011, 02:37:40 pm by Deep Thought »




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 #515 on: July 18, 2011, 02:39:50 pm »
I think the reason bitwise expressions work in if statements is because it's only manipulating one bit.  They're essentially doing the same thing, iirc.

EDIT:
* Darl181 pokes again for some tutorial or another on bitwise expressions to be put in the docs ;)
« Last Edit: July 18, 2011, 02:51:36 pm by Darl181 »
Vy'o'us pleorsdti thl'e gjaemue

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 #516 on: July 18, 2011, 02:49:48 pm »
I think the reason bitwise expressions work in if statements is because it's only manipulating one bit.  They're essentially doing the same thing, iirc.

Yeah, that's why If 5 and 6 returns true, since

    %00000101
AND %00000110
=== %00000100


but If 4 and 2 returns false, since

    %00000100
AND %00000010
=== %00000000
« Last Edit: July 18, 2011, 02:50:02 pm by Deep Thought »




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 #517 on: July 18, 2011, 03:13:24 pm »
Ok...
I went to compile DS in 1.0.1 and got a "Bad Flash" error pretty much instantly.
What exactly causes this to happen?


EDIT: nvm, just a really fun axe bug x.x
« Last Edit: July 23, 2011, 01:16:38 am by Darl181 »
Vy'o'us pleorsdti thl'e gjaemue

Offline selectcoaxial

  • LV2 Member (Next: 40)
  • **
  • Posts: 29
  • Rating: +0/-0
    • View Profile
Re: Axe Q&A
« Reply #518 on: July 23, 2011, 12:22:40 am »
Hi, I'm trying to create a new string randomly with letters from another string. This is what I have so far and it keeps giving me Bad Symbol error. I'm using Axe 0.5.3.

Code: [Select]
.RANDTXT
"0123456789-+/*^,()"→Str0
{Str0}+rand^18→Str1
Disp Str1

Offline mrmprog

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 559
  • Rating: +35/-1
    • View Profile
Re: Axe Q&A
« Reply #519 on: July 23, 2011, 12:48:45 am »
I am no Axe expert, but I don't think you can store a var to a pointer. (I am probably wrong)

Offline selectcoaxial

  • LV2 Member (Next: 40)
  • **
  • Posts: 29
  • Rating: +0/-0
    • View Profile
Re: Axe Q&A
« Reply #520 on: July 23, 2011, 01:11:33 am »
or would it be better if I try to do this
Code: [Select]
{Str0+rand^18}→Str1?
Make a string with the byte at rand^18 of the string Str0 is pointing to and reference it with Str1?

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 #521 on: July 23, 2011, 01:24:51 am »
Try the latter.  As you're probably aware the brackets denote pointers.  What the initial code does is get the pointer to Str0, return the value of the byte there, then to that value add rand^18 to it.  I'm guessing that's what you're not trying to do :P
Also, iirc, you'll need to define Str1 before hand. 
Another thing, strings are zero-terminated.  That means the string lasts until it hits a zero.  So if you don't explicitly put a zero at the end of a string (unless you're defining with quotes (or maybe it always does that, I haven't tested it) ) the string could stretch for almost any amount.  Not good.

Assuming you're storing only one byte: [0000]→Str1 should work.  Then put the second code you posted. Read the post after this.
« Last Edit: July 23, 2011, 12:22:28 pm by Darl181 »
Vy'o'us pleorsdti thl'e gjaemue

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Axe Q&A
« Reply #522 on: July 23, 2011, 11:11:03 am »
or would it be better if I try to do this
Code: [Select]
{Str0+rand^18}→Str1?
Make a string with the byte at rand^18 of the string Str0 is pointing to and reference it with Str1?
Please note that because Axe uses left to right order of operations that code isn't doing what you want.  It's doing {(Str0+rand)^18}->Str1 though you probably want {rand^18+Str0}->Str1 .  In addition, I'm pretty sure you want {Str1} instead of just Str1 .  Good luck with your program! :)

Offline selectcoaxial

  • LV2 Member (Next: 40)
  • **
  • Posts: 29
  • Rating: +0/-0
    • View Profile
Re: Axe Q&A
« Reply #523 on: July 24, 2011, 12:26:02 am »
I've tried what you said and it compiled nicely. I ran the program, it ran but the program return anything, it just says Done.

I want a 16-letter string so that's 32 0's for defining the string

Code: [Select]
.RANDTXT
[00000000000000000000000000000000]→Str1
"0123456789-+/*^,()"→Str0
For(I,1,16
{rand^18+Str0}→{Str1+2I-2}
End
Disp Str1

Why doesn't it display the string?
« Last Edit: July 24, 2011, 12:41:09 am by selectcoaxial »

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 #524 on: July 24, 2011, 12:37:38 am »
Just as a hint/rule of thumb, you can count from zero--so that would be For(I,0,15).  Also iirc parenthesis, for the most part, should be closed.

At what part does it crash?  What might help figure out what's going on (because frankly I'm kind of confused at this point as well, I'll prolly have to test it or something :P): put in some Disps so you can tell how far it gets into the code before it goes.

Is this the entirety of the code, or is there something else in the program that might be messing with it?
« Last Edit: July 24, 2011, 12:37:45 am by Darl181 »
Vy'o'us pleorsdti thl'e gjaemue