Author Topic: Axe Parser  (Read 551974 times)

0 Members and 8 Guests are viewing this topic.

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 Parser
« Reply #1335 on: October 14, 2010, 12:12:56 am »
It's because "0" and 0 are different. The character "0" actually has value E30. Plus, appv is really two bytes, so what you'd need to do is
Code: (Axe) [Select]
A+30→{Str0V+8}
instead of
Code: (Axe) [Select]
A→{Str0V+7}
.

EDIT: Haven't tested it myself; can you tell me if it works?
« Last Edit: October 14, 2010, 12:13:36 am 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 Parser
« Reply #1336 on: October 14, 2010, 12:29:54 am »
Compiling...defragmenting(it's an app)...writing...
No, didn't work.  Maybe I could play around with the variables tonight and try to get results.

Hey, just noticed...the next post will be reply #1337
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 Parser
« Reply #1337 on: October 14, 2010, 12:35:54 am »
Wait! Sorry, I confused myself for a moment. It's not +8, it's +7.

The +30 should be right, though.

Also, 1337!
« Last Edit: October 14, 2010, 12:36:12 am by Deep Thought »




Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: Axe Parser
« Reply #1338 on: October 14, 2010, 06:24:43 pm »
It's because "0" and 0 are different. The character "0" actually has value E30. Plus, appv is really two bytes, so what you'd need to do is
Code: (Axe) [Select]
A+30→{Str0V+8}
instead of
Code: (Axe) [Select]
A→{Str0V+7}
.

EDIT: Haven't tested it myself; can you tell me if it works?

the 30 should either be replaced with E30 or 48.

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 Parser
« Reply #1339 on: October 14, 2010, 06:36:04 pm »
So I have to do the little F or something?
Wait, trying to compile now and it's saying
ERR: UNKNOWN ERR
Code: 4535555

I'm using axe version 0.4.5
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 Parser
« Reply #1340 on: October 14, 2010, 06:38:55 pm »
So I have to do the little F or something?
Use the little E.  Press [2nd] then [,] to get it. :)

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 Parser
« Reply #1341 on: October 14, 2010, 06:40:46 pm »
So I have to do the little F or something?
Use the little E.  Press [2nd] then [,] to get it. :)
Got it.
I don't get why it's not compiling though...

O_o nvm it just compiled.
I guess it garbage collected or something.
« Last Edit: October 14, 2010, 06:42:46 pm by Darl181 »
Vy'o'us pleorsdti thl'e gjaemue

Offline Michael_Lee

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1019
  • Rating: +124/-9
    • View Profile
Re: Axe Parser
« Reply #1342 on: October 14, 2010, 06:51:45 pm »
I don't think I quite have the hang of the Exch( command yet - I'm trying to switch the numbers at variables A and B

Code: [Select]
.TEST
30->A
55->B
ClrHome
Disp A->DEC,B->DEC,i
Exch(A,B,2)
Disp A->DEC,B->DEC,i
Pause 5000

This doesn't work - what am I doing wrong?

(Edited)
« Last Edit: October 14, 2010, 06:54:56 pm by Michael_Lee »
My website: Currently boring.

Projects:
Axe Interpreter
   > Core: Done
   > Memory: Need write code to add constants.
   > Graphics: Rewritten.  Needs to integrate sprites with constants.
   > IO: GetKey done.  Need to add mostly homescreen IO stuff.
Croquette:
   > Stomping bugs
   > Internet version: On hold until I can make my website less boring/broken.

Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: Axe Parser
« Reply #1343 on: October 14, 2010, 06:53:40 pm »
change Exch(A,B,1) to Exch(A,B,2). axe variables A-Z+Theta are 2 bytes large.


Offline Michael_Lee

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1019
  • Rating: +124/-9
    • View Profile
Re: Axe Parser
« Reply #1344 on: October 14, 2010, 06:55:31 pm »
Okay, tried that, but nothing happened.  The two numbers aren't switching at all.
My website: Currently boring.

Projects:
Axe Interpreter
   > Core: Done
   > Memory: Need write code to add constants.
   > Graphics: Rewritten.  Needs to integrate sprites with constants.
   > IO: GetKey done.  Need to add mostly homescreen IO stuff.
Croquette:
   > Stomping bugs
   > Internet version: On hold until I can make my website less boring/broken.

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 Parser
« Reply #1345 on: October 14, 2010, 06:59:36 pm »
A and B are variables, while what you need are the pointers to the variables. Use
Code: (Axe) [Select]
:Exch(°A,°B,2)
instead.

the 30 should either be replaced with E30 or 48.

Whoops, forgot about that :-[
« Last Edit: October 14, 2010, 07:00:03 pm by Deep Thought »




Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: Axe Parser
« Reply #1346 on: October 14, 2010, 07:01:09 pm »
oops, duh. i forgot. axe variables are pointers. when you do Exch(A,B,2), you are swapping the two bytes at A and the two bytes at B. this can cause a ram clear... my apologies. if you run it again, the values will switch back and you shouldn't have a problem though. since exch() is generally used to exchange larger amounts of data your example program is more complex.
 what you want is Exch(°A,°B,2). this gets the pointers to the variables and exchanges them.

ninja'd
« Last Edit: October 14, 2010, 07:01:28 pm by nemo »


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 Parser
« Reply #1347 on: October 14, 2010, 07:02:06 pm »
Yeah, so I'd suggest a RAM clear before you do anything else, just to make sure there aren't any weird glitches.




Offline Michael_Lee

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1019
  • Rating: +124/-9
    • View Profile
Re: Axe Parser
« Reply #1348 on: October 14, 2010, 07:58:37 pm »
Sweet.  Problem solved, thanks.
My website: Currently boring.

Projects:
Axe Interpreter
   > Core: Done
   > Memory: Need write code to add constants.
   > Graphics: Rewritten.  Needs to integrate sprites with constants.
   > IO: GetKey done.  Need to add mostly homescreen IO stuff.
Croquette:
   > Stomping bugs
   > Internet version: On hold until I can make my website less boring/broken.

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 Parser
« Reply #1349 on: October 15, 2010, 02:52:10 am »
Its less code (I think) to just use a temporary:

A->r6
B->A
r6->B

But I am considering adding an "ultra temporary variable" (the pi token) to the axe language to allow greater code optimization. It would use the assembly instruction "ex de,hl" to take advantage of the de register for extremely temporary storage when using store commands, small number incrementing/decrementing, power-of-2 multiplication and referencing commands.  Pretty much anything else will destroy this extremely fragile variable.  Using it for an exchange command for instance would look like this:

A->pi
B->A
pi->B

This would only be 14 bytes instead of 18 from the earlier example.  There are other exploits you can take advantage of too.  After a multiplication (non-optimized) the pi variable would hold the high order word of the result so you can essentially compute the high order *^ and regular * multiplication simultaneously.
___Axe_Parser___
Today the calculator, tomorrow the world!