Author Topic: Axe Parser  (Read 493818 times)

0 Members and 2 Guests are viewing this topic.

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6265
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Re: Axe Parser
« Reply #1995 on: October 02, 2011, 12:05:35 am »
That seems like a pretty good way to safely implement stack usage. But could there also be commands for more experienced coders that simply equate to push hl, pop hl, and ex (sp),hl? Because your idea is great for casual coders, but crazy people like me like to be able to squeeze every last byte out of code. Something like you suggested here seems to be a good idea for syntax, and calc84maniac suggested a good syntax for ex (sp),hl here. Of course you would want to warn users about the dangers of these commands in the command list, but I don't think it's too dangerous to warrant not adding. There are so many other ways a programmer can crash their calculator with Axe, adding a new one won't really change much.
Directly using pushing/popping can definitely cause problems in the middle of expressions, and in For(const) loops for example. There are too many things subject to change in the implementation of Axe for direct stack access not to be potentially buggy unless you know a lot about the inner workings of Axe. I think Asm() will suffice for crazy hackage.

Edit: Well, I suppose Axe could keep track of all pushes/pops as well as which ones are manual and which ones are internal. It could then error if it tries to internally pop a manual push or manually pop an internal push. That's fairly safe, I guess.
Not good if someone wants that to happen though
/e

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 #1996 on: October 02, 2011, 12:35:30 am »
That seems like a pretty good way to safely implement stack usage. But could there also be commands for more experienced coders that simply equate to push hl, pop hl, and ex (sp),hl? Because your idea is great for casual coders, but crazy people like me like to be able to squeeze every last byte out of code. Something like you suggested here seems to be a good idea for syntax, and calc84maniac suggested a good syntax for ex (sp),hl here. Of course you would want to warn users about the dangers of these commands in the command list, but I don't think it's too dangerous to warrant not adding. There are so many other ways a programmer can crash their calculator with Axe, adding a new one won't really change much.
Directly using pushing/popping can definitely cause problems in the middle of expressions, and in For(const) loops for example. There are too many things subject to change in the implementation of Axe for direct stack access not to be potentially buggy unless you know a lot about the inner workings of Axe. I think Asm() will suffice for crazy hackage.

Edit: Well, I suppose Axe could keep track of all pushes/pops as well as which ones are manual and which ones are internal. It could then error if it tries to internally pop a manual push or manually pop an internal push. That's fairly safe, I guess.
Not good if someone wants that to happen though
If you're at the point where you want to access internal Axe values, you're probably better off using Asm() since that would be Axe-version-specific behavior.
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline GamerMX1248

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 5
  • Rating: +0/-0
    • View Profile
Re: Axe Parser
« Reply #1997 on: October 05, 2011, 11:39:41 am »
Any chance we will see 32 bit numbers soon, or will everything just move to floatin point vars towords the end of development?

will an input command for getting numbers instread of arrays of tokens be made soon?

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 #1998 on: October 05, 2011, 04:05:08 pm »
Heya and welcome here! I'm unsure what were the plans for 32 bits numbers, but I think Runer112 posted a routine that allowed combining two numbers into one to make 32 bit ones, sort of. However I'm unsure how reliable it was and where it is on the forums. Native 32 bit support would definitively be cool for those who needs high values such as scores (such as in SMB series where scores easily reach the hundred thousands) or RPGs where damages reach 9999 and where calculating defense/atk/elemental properties causes them to overflow past 65535 or 32767 like in certain SNES RPGs.
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 #1999 on: October 05, 2011, 04:25:23 pm »
32 bit numbers and floating point are not planned.  The z80 processor operates in 8 and 16 bit modes and any 32 bit operations have to be done in software.  There is also no hardware support for floating points, so this is even more expensive to do in software.  If you don't mind the slowdown and complexity though, there are routines you can write in pure Axe to treat 2 or more variables as single larger variables.

The alternative to floating point is fixed point notation, which is supported in Axe.  This allows numbers from about -128.00 to 128.00 with a precision of about .004.  I'd say about 90% of games can avoid using fixed point or big numbers all together, but with the recent increase of physics platformers, maybe that statistic is lower.
« Last Edit: October 05, 2011, 04:26:29 pm by Quigibo »
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Axe Parser
« Reply #2000 on: October 06, 2011, 12:08:19 pm »
Any chance we will see 32 bit numbers soon ?
I think Runer112 posted a routine that allowed combining two numbers into one to make 32 bit ones, sort of.
Yes. Here it is.
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline squidgetx

  • Food.
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1881
  • Rating: +503/-17
  • rawr.
    • View Profile
Re: Axe Parser
« Reply #2001 on: October 06, 2011, 03:48:54 pm »
lol how did this get unstickied...

fixed. um trying to think of something else constructive to say but i can't. i'll just say that

axe is probably the most amazing thing ever to come to the 83/84 series. it is what made me join omnimaga in the first place after a year when I thought I was done with calcs, and it kept me here long enough for me to be able to join staff. it helped me get my first feature on ticalc.org, and right now all of my calc projects are in axe. it has achieved the near-impossible state of having perfect syntax, a great gui/compiler that produces almost asm quality code, and it is a great way for less experienced users to start understanding more of how the calc works. so kudos to quigibo, runer112, and omni and everyone for making this so fricking amazing.

That said I still need to figure out how all the functional programming stuff works, having trouble wrapping my head around how the compiler deals with all of it :P
« Last Edit: October 06, 2011, 03:54:36 pm by squidgetx »

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 #2002 on: October 06, 2011, 06:30:20 pm »
Thanks ;D

IMPORTANT SYNTAX CHANGE
I am planning to make a non-minor syntax change in the next version.  If anyone is opposed to the following, please let me know now.  This will likely cause incompatibility with a few programs, but its a very easy correction to make to your program.

The change involves the Data() command with 2-byte values.  The current syntax is Data(C1,C2r,C3) to indicate that C1 and C3 are taken to be single byte values whereas C2 is taken to be a 2 byte value.  This works okay for now because C1 and C2 are constants or constant expressions but this syntax does not work with other expressions because you could have an expression that ends with an R, like for instance nib{}r and it would be impossible to tell if you meant nib{} as a 2 byte number, or nib{}r as a 1 byte number.

Now given that, the Data command still only takes constants, but I am adding a new command for sequential data writing that CAN take expressions, and I would like the 2 commands to be consistent.  My current idea is that any expression fully enclosed in extra parenthesis will be taken as a 2 byte number and otherwise a 1 byte number.  In the case of Data, this would look like: Data(C1,(C2),C3)

I personally think this is more readable anyway and easier to type since you don't have to go through any menus.  Any thoughts or other suggestions?
« Last Edit: October 06, 2011, 06:32:08 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 #2003 on: October 06, 2011, 06:38:15 pm »
How about just using the r modifier still? Old things like Data(C1,C2r,C3) should still be allowed if the entry is a constant, but you would also allow for parentheses like Data(C1,(C2)r,C3), which would work for expressions. This seems like the best idea to me, as it not only provides backwards compatibility, but also still makes it clear that the value is to be parsed as 2 bytes.


EDIT: In case you see this Quigibo, pre-processor conditionals would be super awesome sauce. ;D
« Last Edit: October 06, 2011, 06:49:10 pm by Runer112 »

Offline squidgetx

  • Food.
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1881
  • Rating: +503/-17
  • rawr.
    • View Profile
Re: Axe Parser
« Reply #2004 on: October 06, 2011, 07:03:24 pm »
I could go either way. I don't like the idea of losing the backwards compatibility, but on the other hand I hate typing the r every time =/ On the other hand (again) I don't use it much for large scale data entry anyway which I just do on the computer so maybe it's ok :P

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 #2005 on: October 07, 2011, 03:04:10 am »
@Runer:  That makes the syntax deceptively misleading.  If I allow Constr then a user would assume that Varr would work that way as well.  Since Varr is valid syntax it is definitely misleading.
___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 #2006 on: October 07, 2011, 11:28:33 am »
I wouldn't think it's misleading. If you documented the correct way of doing it as ()r, I think this should solve most problems. New users wouldn't even think about using the old syntax because they wouldn't know it exists. And old users would be familiar with the change and would know that, since Data() used to work only with constants, you can only use the old 2-byte indicator syntax with constants. I would say that using () to specify 2-byte values carries its own problems anyways, since most programmers should know that a plain extra set of parentheses should do nothing to the code.
« Last Edit: October 07, 2011, 03:01:38 pm by Runer112 »

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 #2007 on: November 01, 2011, 11:56:58 pm »
Good news everybody!  I'm almost done with the new Bitmap() command! ;D

I've been working on it for nearly 2 weeks and it now handles all of my test cases and just needs some optimizing.  At just over 200 bytes, its definitely the largest and most complex piece of assembly I have ever written.  It uses no shadow registers or iy so its interrupt safe and compatible with any buffer.

You can draw sprites as small as 1x1 and as large as 224x192 which means you can move larger-than-buffer images across the screen for cut-scenes and stuff like that with ease.  Its not super fast though, its probably only slightly faster than drawing the 8x8 spites individually, but I'll benchmark it once I finish optimizing.
___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 #2008 on: November 02, 2011, 12:21:05 am »
That sounds awesome! I guess my only question about it is if there will be a way to draw the image with logic other than overwrite, as it might be nice to be able to draw large sprites that combine nicely with the background in games and such.

And don't forget to browse the Axe issue tracker thingy if you ever want ideas for what to fix/optimize/add. I guess the first two are more important, but the third one is always good to have content added from as well. Especially if there are small, easy things to add that would still be awesome.


EDIT: Oh, and are you completely getting rid of the old command? Because it might still be useful to some due to not requiring a large routine for things that don't really need amazing clipping logic or speed.
« Last Edit: November 02, 2011, 12:24:31 am by Runer112 »

Offline leafy

  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1554
  • Rating: +475/-97
  • Seizon senryakuuuu!
    • View Profile
    • keff.me
Re: Axe Parser
« Reply #2009 on: November 02, 2011, 01:58:26 am »
Awesome! That bitmap command's exactly what I had in mind ^^
In-progress: Graviter (...)