Author Topic: Axe Parser  (Read 554106 times)

0 Members and 4 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 #1230 on: September 20, 2010, 10:17:23 pm »
I'm releasing 0.4.5 very soon because I don't want everyone waiting so long for 1.0.0 since its going to take a long time.  In this intermediate version, I will disable Axioms since those are totally under construction right now, but most of the new features and bug fixes will be available.

The command nib{} is the only one where you actually have to do math to the pointer itself.  Like if you have a string of bytes in Str1 then you have to refer to it with nib{Str1*2} since there are twice as many nibbles addresses as there are byte addresses.

The other new thing you'll be able to do is pass by reference commands.  If you are familiar with other languages that use pointers then you might have an idea about what this is, but for those who don't, its a very powerful tool.  Pass by reference is used when you want the function you are using to modify the variables instead of (or in addition to) just returning the result of the calculation.  For instance, say you want to write a function that swaps 2 variables.  You can't just call sub(SWP,A,B) because the subroutine itself only knows the values of A and B and not where to put the result.  So instead you could write the subroutine like this:


:.This is the subroutine.
:.r3 is used as a temporary.
:Lbl SWP
:{r1}r->r3
:{r2}r->{r1}r
:r3->{r2}r
:Return

:.You can call it like this
:sub(SWP,oA,oB)
:.A and B have now swapped their values

So what is going on here?  Well, instead of passing the value of A and B, you pass a pointer to A and B because not only can you read the value by using {pointer}, but you can also write to them as well since you have the pointer at your disposal.  Another way you can take advantage of this systems is by inventing your own data types!  For example, lets say you want a 32-bit double precision integer.  It conveniently fits in 2 Axe variables so you can store them in consecutive addresses like A could be the low word and B could be the high word.  Then, you can pass to the subroutine the pointer to A and the subroutine now has access to A and B because it can read and write to their values with {r1}r and {r1+2}r.  That means, you only need one argument to call the subroutine and you don't need to give it 2 "halves" of the number.  There's probably a billion other uses for this too, but it will definitely make the language more convenient.

I also will take calc84maniac's request from a while back to allow recursive subroutines because all of the Scheme programming I've been doing recently has really opened my eyes to the beauty and the simplicity of using them (even if they are bulkier and less efficient at the assembly side).  If you have no idea what I'm talking about, I'll explain the command with some examples later.  Basically, it automatically saves and restores the r1-r6 variables before and after the call.
« Last Edit: September 20, 2010, 10:19:12 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 #1231 on: September 20, 2010, 10:37:37 pm »
Cool! Pass by reference will be less useful than say, in C, because our largest data structures are two bytes ;D
Keep up the good work, can't wait to try it! :)
"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 Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Axe Parser
« Reply #1232 on: September 20, 2010, 10:55:07 pm »
Oh dear, recursive subroutines is going to destroy Portal D: I use r1-r6 as temp variables inside of my object code, so im going to have to make sure that i don't use those across subroutines

As for all of the other features though, that sounds awesome :D

EDIT: Another question, where are R1-R6 stored anyway?  And how much can you recurse before bad things happen?
« Last Edit: September 20, 2010, 10:58:56 pm by Builderboy »

_player1537

  • Guest
Re: Axe Parser
« Reply #1233 on: September 20, 2010, 11:06:09 pm »
I think they are located in Math<something> It's a small 10-12 byte ram area that math variables or similar are stored.

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 #1234 on: September 20, 2010, 11:07:41 pm »
Oh dear, recursive subroutines is going to destroy Portal D: I use r1-r6 as temp variables inside of my object code, so im going to have to make sure that i don't use those across subroutines

As for all of the other features though, that sounds awesome :D

EDIT: Another question, where are R1-R6 stored anyway?  And how much can you recurse before bad things happen?
Well, my idea was to use sub()r for that. I'm not sure exactly how it's really going to work though.
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Axe Parser
« Reply #1235 on: September 20, 2010, 11:15:23 pm »
So then they much be pushed onto the stack or something?  Hopefully it can be turned off, or accessible via a different command, since i call some subs many many times in a single frame and i dont need all this extra pushing and popping of 6 two byte integers D:

And if they are being pushed onto the stack, is that 12 bytes ever sub?  So less than 33 recursions until crash D:

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 #1236 on: September 20, 2010, 11:17:27 pm »
I like the swapping idea. It may be very useful in games, like a RPG where you swap your HP with MP or swap HP between two chars, or when moving a char to another party slot.

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 #1237 on: September 21, 2010, 12:16:46 am »
Builderboy, no need to panic, nothing is changing with the existing sub() command I am only adding a new command sub()r :)

It only backs up the variables its using so if you call sub(SUB,A,B)r it will only save r1 and r2.  In recursive subroutines, they are saved to the stack.  The actual addresses of r1-r6 are in a really small free-ram area not part of L1-L6.  You can get the actual location now with or1 if you want to pass them by reference or something.
« Last Edit: September 21, 2010, 12:19:09 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 #1238 on: September 21, 2010, 12:33:26 am »
Oh dear. I will need examples for this...
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 Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Axe Parser
« Reply #1239 on: September 21, 2010, 01:09:25 am »
Builderboy, no need to panic, nothing is changing with the existing sub() command I am only adding a new command sub()r :)

It only backs up the variables its using so if you call sub(SUB,A,B)r it will only save r1 and r2.  In recursive subroutines, they are saved to the stack.  The actual addresses of r1-r6 are in a really small free-ram area not part of L1-L6.  You can get the actual location now with or1 if you want to pass them by reference or something.

Sounds excellent :D And also i forgot that the parser can precompile the push and pop since it already knows how many arguments it has ^^ This is going to be so cool :D

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 #1240 on: September 22, 2010, 04:41:43 pm »
Wow, these all sound like wonderful additions!  I can't wait for 0.4.5! ;D  Awesome! :D

Offline LordConiupiter

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 339
  • Rating: +3/-0
  • Just one of the thousands of Axe-fans...
    • View Profile
Re: Axe Parser
« Reply #1241 on: September 22, 2010, 05:05:27 pm »
yeah! reference passing! I realy am looking forward to this update! :D
everytime that I was down, you would always come around, and get my feedback on the ground. (modified part from 'Seasons in the sun')

No matter how many errors are bothering you, always try to stay rel-Axe!

The HoMM project will be resumed as soon Axe 1.0.0 will be released!
Projects:
Code: [Select]
HoMM:   [==--------]    Project 'resumed': I'm suffering overwhelming new ideas being popped up in my dreams :P
tiDE:   [----------]    Explored and understood the main part of the code: just started writing a Tokenizer.



password of the week: uvanapererubupa (Any pronunciation is the right one ;) )   :D click me, and you'll be raided :D

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 #1242 on: September 22, 2010, 11:13:04 pm »
I personally can't wait to see how nibble commands works.
* DJ Omnimaga hopes they save him some trouble in the future for half-byte maps and some data storage.

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 #1243 on: September 25, 2010, 02:51:55 pm »
Just a suggestion, but would it be possible to document which commands have an effect on interrupts?
(I ask mainly because I just learned that Disp >Dec disables them)
"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 Michael_Lee

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1019
  • Rating: +124/-9
    • View Profile
Re: Axe Parser
« Reply #1244 on: September 26, 2010, 07:09:33 pm »
Question: About when do you think 0.4.5 will be out?
I really, really want to use it...
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.