• Features Wishlist 5 1
Currently:  

Author Topic: Features Wishlist  (Read 692580 times)

0 Members and 5 Guests are viewing this topic.

Ashbad

  • Guest
Re: Features Wishlist
« Reply #2085 on: April 08, 2011, 05:13:30 pm »
It's much easier to just draw two sprites in axe than to write a new set of wrapping sprite display routines in ASM.

Actually the wrapping code in assembly is much smaller than the clipping code ;)

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: Features Wishlist
« Reply #2086 on: April 09, 2011, 05:15:53 am »
^ Not really. Pseudo-wrapping in the horizontal direction is smaller, but its not real wrapping because the half sprite on the right side of the screen would be shifted down by one pixel and additional clipping would be needed for the last row so it wouldn't leak into memory after the screen.  This is better suited for an Axiom though since wrapping is rarely needed and can be done easily with 2 sprites.


Anyway, I came up with a new advanced syntax idea!  I was thinking of allowing programmers to take advantage of the stack the z80 offers but I'm concerned about memory leaks this could cause and undesired conflicts when calling routines since Axe uses the same stack behind the scenes.  But then I realized there is a way I could do it that would be both easy to use and be impossible to leak memory.  The solution is to:

1) Only allow the pair if they are in the same scope.  I define scope loosely... it has to fit on one line, but CAN intersect most single argument commands.
2) Require a pop for each push in that scope or else throw a syntax error.
3) Allow automatic integration into the right-hand side of binary operations.

For a non-technical explanation: Think of it as storing a value (maybe the result of a large computation) to a place you want to read later without having to use a temporary variable or do the computation again.  You can nest as many of these as you want without concern about memory.  I decided to use the pi character (π) to implement this.  Storing to it pushes the variable and reading from it pops it.

For example here is code to swap the values of 2 variables using a temporary:
Code: [Select]
A->T B->A T->BHere is the same code using the stack instead.
Code: [Select]
A->π B->A π->BSince each variable read or write is 3 bytes, but each stack read or write is only 1 byte, this code saves 4 bytes and is slightly faster.

Another example:
Code: [Select]
{A*3}->X {A*3+1}->Y {A*3+2}->ZHere is a case where you can nest them together:
Code: [Select]
{A*3->π->π}->X {π+1}->Y {π+2}->ZThis saves a HUGE amount of memory.

When nesting, the most recent store to the stack is the one that gets read when you read from the stack.  Here is a pairing example:

A->π
   B->π
      C->π
      π->D
   π->E
   F->π
   π->G
π->H


I'm hoping this will lead to more possibilities to optimize code.  I know at least one individual will have a field day with this ;) Let me know if anyone, especially asm programmers, have questions or concerns.  It seems to work in my head, but I haven't tried implementing it so there may be some unforeseen problems.
« Last Edit: April 09, 2011, 05:21:03 am by Quigibo »
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Features Wishlist
« Reply #2087 on: April 09, 2011, 05:23:25 am »
Quigibo, I didn't read the whole thing, but we can use pi in Axe?

Ashbad

  • Guest
Re: Features Wishlist
« Reply #2088 on: April 09, 2011, 09:16:50 am »
No scout ;)

But quigibo, this is awesome.  This really could save a lot of memory and speed for advanced programmers :D. This is like a dream come true... Sorta.

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: Features Wishlist
« Reply #2089 on: April 09, 2011, 10:27:57 am »
That is wonderful!  Excellent idea, Quigibo, I can't wait to see the code that comes from this. :D

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
Re: Features Wishlist
« Reply #2090 on: April 09, 2011, 02:31:22 pm »
Cool feature addition. =) I seem to remember a couple people asking about this as a possible feature.

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Features Wishlist
« Reply #2091 on: April 09, 2011, 02:33:59 pm »
Could you add an option to the options menu for expert users that would turn off the scope checking? Because I can definitely think of times when I wanted to be able to push/pop across multiple lines for extreme optimizations.


EDIT: Also Quigibo, do you want to put up that poll that you had proposed earlier about the GetCalc() functions?
« Last Edit: April 09, 2011, 03:13:34 pm by Runer112 »

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: Features Wishlist
« Reply #2092 on: April 09, 2011, 04:04:02 pm »
Could you add an option to the options menu for expert users that would turn off the scope checking? Because I can definitely think of times when I wanted to be able to push/pop across multiple lines for extreme optimizations.
I like this idea too, as it could potentially be very useful. ;D

SirCmpwn

  • Guest
Re: Features Wishlist
« Reply #2093 on: April 09, 2011, 04:06:45 pm »
^ Not really. Pseudo-wrapping in the horizontal direction is smaller, but its not real wrapping because the half sprite on the right side of the screen would be shifted down by one pixel and additional clipping would be needed for the last row so it wouldn't leak into memory after the screen.  This is better suited for an Axiom though since wrapping is rarely needed and can be done easily with 2 sprites.


Anyway, I came up with a new advanced syntax idea!  I was thinking of allowing programmers to take advantage of the stack the z80 offers but I'm concerned about memory leaks this could cause and undesired conflicts when calling routines since Axe uses the same stack behind the scenes.  But then I realized there is a way I could do it that would be both easy to use and be impossible to leak memory.  The solution is to:

1) Only allow the pair if they are in the same scope.  I define scope loosely... it has to fit on one line, but CAN intersect most single argument commands.
2) Require a pop for each push in that scope or else throw a syntax error.
3) Allow automatic integration into the right-hand side of binary operations.

For a non-technical explanation: Think of it as storing a value (maybe the result of a large computation) to a place you want to read later without having to use a temporary variable or do the computation again.  You can nest as many of these as you want without concern about memory.  I decided to use the pi character (π) to implement this.  Storing to it pushes the variable and reading from it pops it.

For example here is code to swap the values of 2 variables using a temporary:
Code: [Select]
A->T B->A T->BHere is the same code using the stack instead.
Code: [Select]
A->π B->A π->BSince each variable read or write is 3 bytes, but each stack read or write is only 1 byte, this code saves 4 bytes and is slightly faster.

Another example:
Code: [Select]
{A*3}->X {A*3+1}->Y {A*3+2}->ZHere is a case where you can nest them together:
Code: [Select]
{A*3->π->π}->X {π+1}->Y {π+2}->ZThis saves a HUGE amount of memory.

When nesting, the most recent store to the stack is the one that gets read when you read from the stack.  Here is a pairing example:

A->π
   B->π
      C->π
      π->D
   π->E
   F->π
   π->G
π->H


I'm hoping this will lead to more possibilities to optimize code.  I know at least one individual will have a field day with this ;) Let me know if anyone, especially asm programmers, have questions or concerns.  It seems to work in my head, but I haven't tried implementing it so there may be some unforeseen problems.

\o/ that sounds great!  I always love the addition of lower level features.
Which individual do you speak of?

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: Features Wishlist
« Reply #2094 on: April 09, 2011, 05:15:43 pm »
Can we have a feature like "Zeros()," but for any data.  For instance, something like this:
Command(1,12) would be the same as [010101010101010101010101]
Command([56],4) would be the same as [56565656]
Command(127,6) would be the same as Data(127,127,127,127,127,127)
Potentially, this command could even be used for repeating sets of data.  For instance:
Command([010203],12) would be the same as [010203010203010203010203]
Command("Text"[00],15) would be the same as "Text"[00]"Text"[00]"Text"[00]

So, what do you think?  Could this be a command?  I think it's a good idea, to avoid situations like this. :)
« Last Edit: April 09, 2011, 05:16:06 pm by ztrumpet »

Offline Freyaday

  • The One And Only Serial Time Killing Catboy-Capoeirista-Ballerino
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1970
  • Rating: +128/-15
  • I put on my robe and pixel hat...
    • View Profile
Re: Features Wishlist
« Reply #2095 on: April 09, 2011, 06:34:52 pm »
I see two problems with pi as it is now:
Too many consecutive pushes without pops will cause an overflow, even if the pops occur later on
And
A->pi->pi puts A once on the stack because, as it is now specified, pi-> is a pop, so pi->pi pops the top value then pushes it back in, doing nothing but waste cycles. Also, could there be a command for reading that top value w/o popping it? And a complementary command for deleting the top value off the stack w/o having to store it anywhere?
In other news, Frey continues kicking unprecedented levels of ass.
Proud member of LF#N--Lolis For #9678B6 Names


I'm a performer at heart; I stole it last week.
My Artwork!

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: Features Wishlist
« Reply #2096 on: April 09, 2011, 06:39:10 pm »
Too many consecutive pushes without pops will cause an overflow, even if the pops occur later on
It normally doesn't cause a problem in Asm, so why would it cause a problem in Axe?
A->pi->pi puts A once on the stack because, as it is now specified, pi-> is a pop, so pi->pi pops the top value then pushes it back in, doing nothing but waste cycles.
No, it doesn't work like that, as it would read "A->pi" and then "->pi". :)
Could there be a command for reading that top value w/o popping it?
Nope, as it's impossible without something like "pi->A->pi".
A complementary command for deleting the top value off the stack w/o having to store it anywhere?
Sure: "pi"
« Last Edit: April 09, 2011, 07:10:40 pm by ztrumpet »

Ashbad

  • Guest
Re: Features Wishlist
« Reply #2097 on: April 09, 2011, 06:41:53 pm »
Those are actually brilliant points you brought up -- less advanced users trying to tap into this may accidentally push 2K of data to the stack (which is way past the ~300 byte safe zone and would probably hurt the VAT) in a loop with a push without a pop -- maybe limit this to maybe 50 pushes?  (or ~299 :P)

This would keep it safe for newbies who have no idea what the stack is but think it has something to do with virtual plates ;)

Offline Freyaday

  • The One And Only Serial Time Killing Catboy-Capoeirista-Ballerino
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1970
  • Rating: +128/-15
  • I put on my robe and pixel hat...
    • View Profile
Re: Features Wishlist
« Reply #2098 on: April 09, 2011, 06:59:15 pm »
So, am I right or not? I don't know; to be honest, I don't know much about the actual way the calc operates. I am not an ASM programmer.
In other news, Frey continues kicking unprecedented levels of ass.
Proud member of LF#N--Lolis For #9678B6 Names


I'm a performer at heart; I stole it last week.
My Artwork!

Ashbad

  • Guest
Re: Features Wishlist
« Reply #2099 on: April 09, 2011, 07:09:16 pm »
I'd say one of your concerns was brilliant, the others Ztrumpet rightfully cleared up :)