• Axe Parser 5 1
Currently:  

Author Topic: Axe Parser  (Read 554245 times)

0 Members and 11 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 Parser
« Reply #1275 on: September 27, 2010, 11:48:54 pm »
Oh!  I forgot to mention something really important about recursive subroutines!

Even thought they take up more space in the program than the regular subroutines, there is a new way to optimize them.  The "last expression" for each argument is the original argument.  What I mean, is that instead of this:

sub(FACr,r1-1)

You can actually write this:

sub(FACr,-1)

Because the r1 is implied.  Same thing applies to r2, r3, etc in the rest of the arguments.  For any actual recursion, its an extremely important optimization since generally you use the previous value in your expression for the next value passed.
« Last Edit: September 27, 2010, 11:49:42 pm by Quigibo »
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: Axe Parser
« Reply #1276 on: September 27, 2010, 11:52:03 pm »
Nice to know. Can't wait to try it out! :)
"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 DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Axe Parser
« Reply #1277 on: September 27, 2010, 11:57:05 pm »
Interesting, nice to know indeed :D

Offline Raylin

  • Godslayer
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1392
  • Rating: +83/-25
  • I am a certifiable squirrel ninja.
    • View Profile
    • Ray M. Perry
Re: Axe Parser
« Reply #1278 on: September 28, 2010, 02:07:04 am »
I would like to know more about the applications of dereferencing, if you don't mind.
Bug me about my book.

Sarah: TI-83 Plus Silver Edition [OS 1.19]
Cassie: TI-86 [OS 1.XX]
Elizabeth: TI-81 [OS 1.XX]
Jehuty: TI-83 Plus Silver Edition [OS 1.19]
Tesla: CASIO Prizm







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 #1279 on: September 28, 2010, 04:44:40 am »
One example is that you can create multi-byte data abstractions.  Lets say you want to define a "vector" which has a 16-bit X component and a 16-bit Y component.  Conveniently, you can store these in consecutive addresses.  Like A would be the X-part and B would be the Y-part.  Now, lets say you want to write a routine that adds 2 vectors and stores the result in a 3rd vector.  You can do this with a singe routine by pasing the pointer to the vector instead of the vector values themselves (since you can only pass 16-bit numbers at a time):

Code: [Select]
:.Add 2 vectors
:.Vector 1 pointer in r1
:.Vector 2 pointer in r2
:.Resultant vector pointer in r3
:Lbl ADD
:{r1}r+{r2}r->{r3}r
:{r1+2}r+{r2+2}r->{r3+2}r
:Return

So the first line you're adding the X components and the second line you're adding the Y components.  You can use this code for example like this:
Code: [Select]
:.Initialize vector A with (10,20)
:10->A
:20->B
:
:.Initialize vector C with (5,-10)
:5->C
:-10->D
:
:.Add the vectors and store the result into vector E
:sub(ADD,°A,°C,°E)

So now the E holds 15 and F holds 10 thus the vector E has value (15,10).  You can also call the same routine with L1 instead of °E for instance which would save the vector to the locations {L1} through {L1+3} instead of to one of the Axe variables.

The best way to think about the dereferenced variables is like you think about the L1-L6 pointers.  Each variable has it's own "free-ram" (exactly 2 bytes of it) so just like you can get a  free ram location using L1, you can now get the ram location of any variable.  The biggest difference is that when you want to read from a variable, you can just type the letter of the variable so it saves you a lot of typing.  If you wanted to get the ram in L1 on the other hand, you would have to do {L1}r.  And yes, that means that {°A}r is exactly the same as just typing A.
« Last Edit: September 28, 2010, 04:45:37 am by Quigibo »
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline Raylin

  • Godslayer
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1392
  • Rating: +83/-25
  • I am a certifiable squirrel ninja.
    • View Profile
    • Ray M. Perry
Re: Axe Parser
« Reply #1280 on: September 28, 2010, 07:52:52 am »
Ah. I get it. :)

Thank you, sir.
Bug me about my book.

Sarah: TI-83 Plus Silver Edition [OS 1.19]
Cassie: TI-86 [OS 1.XX]
Elizabeth: TI-81 [OS 1.XX]
Jehuty: TI-83 Plus Silver Edition [OS 1.19]
Tesla: CASIO Prizm







Offline shmibs

  • しらす丼
  • Administrator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2132
  • Rating: +281/-3
  • try to be ok, ok?
    • View Profile
    • shmibbles.me
Re: Axe Parser
« Reply #1281 on: September 28, 2010, 08:30:41 am »
does this mean that 0->A->B->C etc to J (or some other later value) can now be written as
:for([some variable outside the set to be initialized,0,[number of vars minus one]
:0->{[counter var]*2+°A}rEnd
?

is that more efficient size wise than the huge list above?

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: Axe Parser
« Reply #1282 on: September 28, 2010, 09:08:50 am »
It might be better to do:
:0->A
:Fill(°A,°J-°A+1


(I assume that °J-°A+1 will be considered as a constant, can Quigibo confirm this?)

Edit:
I just tried it myself, it does indeed seem to be assembled as a constant.
« Last Edit: September 28, 2010, 09:13:20 am by calc84maniac »
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline Raylin

  • Godslayer
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1392
  • Rating: +83/-25
  • I am a certifiable squirrel ninja.
    • View Profile
    • Ray M. Perry
Re: Axe Parser
« Reply #1283 on: September 28, 2010, 10:13:42 am »
So, in essence, dereferencing is just directly using the variables as chunks of memory instead of changing the value of the variable?
Bug me about my book.

Sarah: TI-83 Plus Silver Edition [OS 1.19]
Cassie: TI-86 [OS 1.XX]
Elizabeth: TI-81 [OS 1.XX]
Jehuty: TI-83 Plus Silver Edition [OS 1.19]
Tesla: CASIO Prizm







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 #1284 on: September 28, 2010, 08:06:33 pm »
I think I will give a warning message from now on when the size passes 8812 bytes.

Let's see ... since Axe puts the data on the bottom anyway, maybe you could use that to differentiate the actual code from the data?




Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: Axe Parser
« Reply #1285 on: September 28, 2010, 08:12:34 pm »
What you say would work but for this fact: :(
I would suggest you only say that when code passes that mark, but then I remembered that you decided to mix subroutines and code ;D
« Last Edit: September 28, 2010, 08:13:11 pm by calcdude84se »
"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 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 #1286 on: September 30, 2010, 11:31:38 am »
What do you mean by mixing subroutines and code? Subroutines should count as part of the code, anyway, because you can execute it, but then the data comes after that, right?




Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: Axe Parser
« Reply #1287 on: September 30, 2010, 12:36:58 pm »
I think he meant mixing subroutines and data.
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Axe Parser
« Reply #1288 on: September 30, 2010, 05:55:17 pm »
Wasn't there support for inline data too, now?

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 #1289 on: October 01, 2010, 04:56:25 am »
There has always been support for inline data with the Asm() command.  It literally just inserts the hex code right there.  But the other data like strings are still added to the data section at the end of the program, it just doesn't assign a name to the pointer.
___Axe_Parser___
Today the calculator, tomorrow the world!