• Axe Parser 5 1
Currently:  

Author Topic: Axe Parser  (Read 559676 times)

0 Members and 4 Guests are viewing this topic.

Offline trevmeister66

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1009
  • Rating: +14/-5
    • View Profile
Re: Axe Parser
« Reply #495 on: April 24, 2010, 06:30:34 pm »
1 byte = 8 bits.
Projects:    nameless RPG: 1.0%  |  Reverse Snake v1.5: 100%  |  Secret Project: 5%  |  DUNGEON: 70%

My MW2 Blog <-- Please visit :)

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 #496 on: April 24, 2010, 06:32:30 pm »
Same as the difference between Hex and decimal, its just the way you write the number

For instance, the number "99" can be written

Hex: 63
Decimal: 99
Binary: 01100011

Binary mostly helps when you have a lot of Boolean variables (true/false) that you want to store into a single byte to save space since you can hold 8 of them per byte.
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Axe Parser
« Reply #497 on: April 24, 2010, 06:33:06 pm »
What is the difference between bytes and bits? I've never really understood that.

A bit = 0 or 1
A byte = 8 bits

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Axe Parser
« Reply #498 on: April 24, 2010, 06:37:25 pm »
I was wondering Quigibo because I plan on making a project in which tiles will appear in groups of 16 at a time, with each tile being either white or black. This works out very well using rand to generate 16 tiles at once, but it is then somewhat difficult to extract the 16 individual bits.

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Axe Parser
« Reply #499 on: April 24, 2010, 06:42:09 pm »
Ah ok. I think I get that a little now. Thanks guys :)
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

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 #500 on: April 24, 2010, 06:55:51 pm »
Actually, there is a little trick you can use extract them.  Try this:

Input: X is the 16-bit variable

:X->B
:For(A,1,16)
:If B^2
:<What to do if the Nth bit from the right is 1>
:End
:B/2->B
:End

It will iterate and read all the bits.

If you just want a specific bit, the Nth bit on the right, then do this:

Input: X is the 16-bit variable
Input: N is which bit (in range 0-15):
Output: Returns the value of the bit.

:X->B
:For(A,1,N)
:B/2->B
:End
:B^2
« Last Edit: April 24, 2010, 06:57:04 pm by Quigibo »
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Axe Parser
« Reply #501 on: April 24, 2010, 09:12:57 pm »
Actually, there is a little trick you can use extract them.  Try this:

:X->B
:For(A,1,N)
:B/2->B
:End
:B^2

Yes, that's almost exactly what I did character for character. But I'm guessing there are much cleaner and faster methods that can be built-in, yes?

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 #502 on: April 24, 2010, 09:41:03 pm »
Yes.  Actually, I think that would be pretty easy to add.  There would have to be one for setting a bit, resting a bit, reading a bit, and possibly flipping a bit.  The problem is that I can't seem to find any intuitive tokens for it.  Maybe binomcdf()?  But there's only 2 of those and its kind of a long one...

EDIT: Also, I should say that these will only work with a CONSTANT as the bit#.  So you can't have the Xth bit with X being a variable.  Otherwise, the routine you wrote is pretty efficient for it.
« Last Edit: April 24, 2010, 09:43:18 pm by Quigibo »
___Axe_Parser___
Today the calculator, tomorrow the world!

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 #503 on: April 24, 2010, 10:04:07 pm »
Mhmm Binomcdf/pdf names are so close to each others, it might get some ppl confused x.x

The bit manipulation functions would be really handy since it makes it would save a lot of space for storing data such as treasure chests open/closed status, if you obtained an item/magic spell, etc

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Axe Parser
« Reply #504 on: April 24, 2010, 11:17:56 pm »
Ok, here's a problem I'm getting close (about 1KB) to running into:

How do you compile a program that is large enough to not leave enough free RAM for both itself and the compiled program?

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 #505 on: April 24, 2010, 11:19:40 pm »
Can you archive the source file before compiling it?

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Axe Parser
« Reply #506 on: April 24, 2010, 11:44:12 pm »
Can you archive the source file before compiling it?

Oh wow you can, didn't realize you could :o

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Axe Parser
« Reply #507 on: April 25, 2010, 12:22:12 am »
I'm having a bit of trouble getting GetCalc(PTR) to locate things. Is it possible to find the pointer of a previously defined piece of data like GDB01? And if so, why does something apparently straightforward like this not work:

Code: [Select]
:[FF]→GDB01
:"GDB01"→Str01
:Disp GetCalc(Str01)►Dec

Does this possibly have something to do with the fact that GDB0 is a two-byte token? When I display Str01, it doesn't display "GDB01", it displays "a{1". It looks like it's breaking the two-byte GDB0 token into one-byte characters.


EDIT: On closer inspection, it appears this command was meant for AppVars, so this approach probably doesn't make sense anyways. However, my question from the second sentence still stands: How can I get the pointer of a previously defined piece of data such as GDB01, but without actually saying GDB01→something? It would be nice to be able to get the pointer of a piece of data with a variable ID, such as GDBA, where A=01.


ANOTHER EDIT: Just a quick question, would GDB1 and GDB10 be the same thing?



Why do I keep not realizing I'm about to double-post until it's too late  :-[

« Last Edit: April 25, 2010, 01:05:14 am by Runer112 »

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Axe Parser
« Reply #508 on: April 25, 2010, 12:50:40 am »
Just letting you know, I would watch the double posting. Use the modify button unless Rule #3 doesn't apply in a certain circumstance.

As for you're code and issues with it. I'm afraid I can't help very much. All I can tell is that there are issues with it, just not how to fix it and such.

For the GDB# thing. I don't think there is a GDB10, only GDB0 to GDB9. Could be wrong though, please correct me if I'm wrong.
« Last Edit: April 25, 2010, 12:52:39 am by meishe91 »
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Axe Parser
« Reply #509 on: April 25, 2010, 01:03:03 am »
Yeah I'm used to forums where double-posting is just fine, so sometimes I don't think to check here. But once I look down at my post(s) and see two in a row I instantly realize :-[


But anyways...

For the GDB# thing. I don't think there is a GDB10, only GDB0 to GDB9. Could be wrong though, please correct me if I'm wrong.

From the documentation:

Quote
Another thing is that Axe allows you to name everything with up to 2 numbers/letters instead of just a single number. The following are all valid names:
Str1
Pic0
GDB4
Str1A
Pic9Z
GDB45
Str66
Pic8C
GDB3X
« Last Edit: April 25, 2010, 01:10:47 am by Runer112 »