• Axe Parser 5 1
Currently:  

Author Topic: Axe Parser  (Read 498549 times)

0 Members and 1 Guest are viewing this topic.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Axe Parser
« Reply #240 on: March 15, 2010, 11:35:45 pm »
Nice to see a new update out!

However, I do not understand most of the new features are about. Someone will really need to make a screenshot showing them in actions with the results and show some source code or something, cuz it is getting beyond my learning capacities (too low level)
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

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 #241 on: March 15, 2010, 11:46:17 pm »
The only real low level command is the int() which is the sign extension command.  You would mostly use this command when you need to store negative numbers into the RAM in an array.  Negative numbers need 2 bytes since they behave like large positive numbers.  But since you can only store one byte then when you go to read it it will turn into a really small number.  Try doing this:

-1->{L1}
Disp {L1}>Dec

This will not display the 65535 that it is supposed to, instead it will be a smaller positive number.  The way around this is sign extension.  So if you do this instead:

Disp int({L1})>Dec

It will return the correct value.  This only works when the stored value is between -128 and 127.
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Axe Parser
« Reply #242 on: March 16, 2010, 12:07:31 am »
mhmm ok, I understand this one now. However, I think you migth want to specify this into more details in the doc because I alerady saw this:

Quote
int(EXP)   Returns a sign extention for the expression. Converts a signed byte in the range -128 to 127 into a 16 bit number in the same range.
And it was really cryptic. I totally couldn,t understand what you meant by that. "Returns a sign" to me sounds like it returns 1 if the sign is negative and 0 if it isn't, and stuff like that.

And I cannot understand this at all either:

Quote
Fill(PTR1,SIZE)   Whatever byte is already at the location Ptr1 is copied to Size more consecutive bytes. Zero is not a valid Size.
conj(PTR1,PTR2,SIZE)   Size bytes starting from the location Ptr1 are copied to the location at Ptr2. Zero is not a valid Size.
expr(PTR1,PTR2,SIZE)   Size bytes starting from the location Ptr1 are exchanged with the bytes starting at the location Ptr2. Zero is not a valid Size.

Plus another thing I don't get: what is Size for? I know Ptr seems to involve pointers, but I just don't get it... all I get is that conj is for Copy and expr is for exchange, since it's in the new features list

And what are Hexadecimal constants and ASCII constants for? And what are they at all? I ran a CTRL+F in the command list, and both these things returned no results. To me it seems like it's more the documentation that is getting more and more in the style of low level programmers (explained in a way that can only be understood by tech savy people, specifically low-level language programmers). You did a very good job at writing the command list so far, though. I could understand a lot of stuff and thank you for explaining all this stuff and even the tutorials and examples. It,s just that I just can't understand any of this and it is starting to discourage me, as I though Axe was meant to remain a language easy to understand :/. If even after you explain in more details I don't get it, I hope you promise these commands will not be essential in future Axe versions to have decently optimized Axe games, right? Else I am starting to fear I might have to give up on the whole language or team up with someone else for optimizing. Sorry :(
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

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 #243 on: March 16, 2010, 12:15:02 am »
Quote
Fill(PTR1,SIZE)   Whatever byte is already at the location Ptr1 is copied to Size more consecutive bytes. Zero is not a valid Size.
conj(PTR1,PTR2,SIZE)   Size bytes starting from the location Ptr1 are copied to the location at Ptr2. Zero is not a valid Size.
expr(PTR1,PTR2,SIZE)   Size bytes starting from the location Ptr1 are exchanged with the bytes starting at the location Ptr2. Zero is not a valid Size.

Ack that could be put better i think.  Try this on for size DJ

Fill(P,L) Takes the first value at the location pointed to by 'Pointer' and copies it to the next L elemends in RAM.  Or if you want a list metaphore, it takes the first value in List P and copies it to the next L elements in the List.

Conj(A,B,L) Continuing the List metaphor, copy all the elements in List A from 0 to L into List B

Expr(A,B,L) Swap all the elements in Lists A and B up to Element L

EDIT: Nija'd by some better examples and code :P
« Last Edit: March 16, 2010, 12:17:16 am by Builderboy »

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 #244 on: March 16, 2010, 12:16:16 am »
I'll give some examples of these commands in use. For example, instead of doing this to fill the 6 bytes at L1 with zeros:
Code: [Select]
:For(X,0,5
:0->{L1+X
:End
You can do this:
Code: [Select]
0->{L1}
Fill(L1,6

The conj( command is just used to copy a number of bytes from one location to another, like if you want to copy 10 bytes from L1 to L2. Here is the old way:
Code: [Select]
:For(X,0,9
:{L1+X}->{L2+X
:End
And here is the new way:
Code: [Select]
:conj(L1,L2,10
expr( does a similar thing, but it exchanges, or swaps, the data at the two locations.
"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: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Axe Parser
« Reply #245 on: March 16, 2010, 12:37:12 am »
Mhmm ok, because the way it is explained in the doc seems like something totally different. I think it may be best to clarify in the doc that fill does the same thing as the BASIC command, but for pointers instead of lists. Also if I read Builderboy way, I still doN,t get it. To me it seems like he's saying Fill just copy one list element to the next one, not fill the entire list with an element.

About Conj, what if we want to do For(X,9,12:{L1+X}->{L2+X:End?

Also are lists defined the same way as other stuff? Like at the beginning of a program I just do {2,34,5,23,0->L1?
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

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 #246 on: March 16, 2010, 12:57:52 am »
Mhmm ok, because the way it is explained in the doc seems like something totally different. I think it may be best to clarify in the doc that fill does the same thing as the BASIC command, but for pointers instead of lists. Also if I read Builderboy way, I still doN,t get it. To me it seems like he's saying Fill just copy one list element to the next one, not fill the entire list with an element.

About Conj, what if we want to do For(X,9,12:{L1+X}->{L2+X:End?

Also are lists defined the same way as other stuff? Like at the beginning of a program I just do {2,34,5,23,0->L1?
For that example, you would want conj(L1+9,L2+9,4

And remember that L1-L6 are just areas of RAM. So, you will need to initialize data just like for a sprite (you will have to convert the values to hex), and store to a String or Pic or something. Then, you should copy your String/Pic to one of the defined RAM areas. (I suppose technically, you could modify the data while it's in the program, but that only works correctly for no-stub)

Edit: Example code
Code: [Select]
:[0222051700->Pic1
:conj(Pic1,L1,5

Edit2:
Also, remember that Quigibo is planning for real array support later. So it should get easier.
« Last Edit: March 16, 2010, 01:00:56 am by calc84maniac »
"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: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Axe Parser
« Reply #247 on: March 16, 2010, 01:00:16 am »
mhmm ok, that gets even worse now... can anyone write a basic program to convert lists to hex/axe format?
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

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 #248 on: March 16, 2010, 01:05:58 am »
Or better yet, ask Quigibo to implement a traditional looking List format for axe source :P
« Last Edit: March 16, 2010, 01:06:07 am by Builderboy »

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Axe Parser
« Reply #249 on: March 16, 2010, 01:10:55 am »
Well I just suggested this now. But yeah it is getting quite confusing. I guess he ddint't have time to write more doc, altough maybe someone could actually help.

The way I see it it seems like I am pretty much doomed to stick with TI-BASIC for life, but again, maybe I am just misinterpreting the doc :/
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

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 #250 on: March 16, 2010, 12:38:03 pm »
Sorry about the doc.  You're right, I didn't have time. I added the documentation the last minute because I was on my laptop in the library and I realized my battery was running low so I scrambled to put it together as fast as I could.  Still don't have internet yet, probably won't for a while, but I don't mind since I'm trying not to be too distracted from my school work and I'm at school almost every day anyway so I just use it there.  I'll try to make it more clear in the next version.

Also you mentioned that you didn't see the hex and ascii constants?  Those are just alternative ways to write numbers.  Its in the middle of the doc somewhere.

Instead of 11->A it is sometimes more convenient to write E000B->A as hexadecimal, especially when you want to access certain locations in the RAM since they are defined in hex, not base 10.  Its a pretty low lew command though, you generally won't need it, but it was requested so I figured I might as well since at the same time I was doing ASCII constants.

You might be familiar with ASCII already, but each character is represented by a number.  So if you need to display a single character, than instead of Disp "A" you can do Disp 'A'>Frac which saves some bytes.  But you'll most often use this when reading from a string and comparing the characters to another character.  Also, this makes it easy to store data using strings instead of hex since they are easier to read.  Entire maps can be made with a string since you can make statements now like If {Str1+X}='A'

« Last Edit: March 16, 2010, 12:39:09 pm by Quigibo »
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Axe Parser
« Reply #251 on: March 16, 2010, 02:15:36 pm »
Ouch I do hope you did not have crap going on like money issues or the like (no longer being able to afford internet) x.x, or parents cutting your access for any reasons... the later happened to me in 2007, because I spent too much time online. Ended up with barely any way to access Omnimaga for almost half a year.

Don't worry too much about it, though. One issue is that I got an hard time understanding stuff, even in my own language (french).

As for the ASCII/Hex constant, for example, I still can't find them in the doc. This pic is a proof (latest Axe version):

As for ascii I know the chars are assigned to an ASCII number, altough yeah I might use normal text instead since it would be very hard to write entire NPC conversations in ASCII, char by char, not to mention the source code would become insanely huge, limiting myself in memory x.x
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

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 #252 on: March 16, 2010, 02:27:47 pm »
Just search for "ASCII" and you should find it, I think
"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: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Axe Parser
« Reply #253 on: March 16, 2010, 02:31:00 pm »
This?

Quote
'CHAR'   The expression becomes the ASCII value of the single character between the apostrophes. It can even be another apostrophe.

Or maybe this?

Quote
Disp EXP▶Dec   The value of the expression is displayed at the current cursor position in base 10. The cursor is then advanced 5 spaces.
Disp EXP▶Frac   The ASCII character the expression represents is displayed at the current cursor position. The cursor is advanced. A new line is added if it hits the edge.
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

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 #254 on: March 16, 2010, 02:35:57 pm »
'CHAR' is new.  So is EHEX.
___Axe_Parser___
Today the calculator, tomorrow the world!