Author Topic: Routines  (Read 313135 times)

0 Members and 1 Guest are viewing this topic.

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: Routines
« Reply #525 on: March 03, 2011, 09:43:39 am »
Xeda made this routine for running Basic progs:
Okay, so earlier I was asked by aeTIos for a hex code to run BASIC programs in Axe and I have heard that this was requested by others, so here goes my rendition... I am sorry in advance if my Axeing is horrible, this is only my second routine:
Code: [Select]
"prgmHELLO"→Str1                     ;Name of the var
Str1                                 ;To get the pointer to the string in HL (Ans)
Asm(E7FDCB08CEEF9B4AFDCB088E         ;

As a word of warning, do not use "Stop" in your BASIC programs... This seems to cause a crash :(
You can use "Return" and all the other commands, though, to my knowledge.

I hope this helps!
++ Xeda, well done!
And the Axe is okay :D
« Last Edit: March 03, 2011, 09:44:04 am by aeTIos »
I'm not a nerd but I pretend:

Offline Michael_Lee

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1019
  • Rating: +124/-9
    • View Profile
Re: Routines
« Reply #526 on: March 18, 2011, 01:25:07 am »
Drawing Bezier Curves

I found a webpage on Bezier curves, and translated it to Axe.
It basically takes two points, a vector from those two points (represented by the grey line), and draws a curve.

[2ND] to flip between changing the two adjustable grey lines, and [CLEAR] to quit.

Source and gif attached.
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.

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Routines
« Reply #527 on: March 18, 2011, 01:27:58 am »
That is really cool!  If you drag the lines too far does the curve become dotted?  Or are you using some awesomly clever algorithm to make sure the curve is always continuous?

Offline Michael_Lee

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1019
  • Rating: +124/-9
    • View Profile
Re: Routines
« Reply #528 on: March 18, 2011, 01:38:03 am »
The curve is comprised of 8 dots connected to each other by lines.  They should always be continuous, although they might become a bit angular.
I would have done more points, but it seems two byte vars were too small for more dots.

I'm not exactly certain what happens if you drag the lines too far, except that they wrap to the other side and then warp oddly.
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.

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Routines
« Reply #529 on: March 18, 2011, 01:44:38 am »
Ahh thats a very simple solution that I hadent thought of! Very nice implementation :) I love these curves, they are so useful!

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: Routines
« Reply #530 on: March 20, 2011, 08:24:27 pm »
Oooh, very shiny.  Nice job, Michael! :D

Offline Darl181

  • «Yo buddy, you still alive?»
  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3408
  • Rating: +305/-13
  • VGhlIEdhbWU=
    • View Profile
    • darl181.webuda.com
Re: Routines
« Reply #531 on: March 21, 2011, 07:03:18 pm »
So we know how to make fire from Builderboy's tutorial.
Code: [Select]
.Axe
ClrDraw
[FEFDFBF7EFDFBD7F]->Str1  //Each Byte here has 7 bits set and 1 bit not set (like FE is 11111110 in binary)
                      //This is so that we can erase a random pixel, since Axe has no built in way to do that
Line(0,63,95,63       //the pixels to catch fire, explained a little later

Repeat getKey(15)    //until we press clear

For(F,L6+12,L6+767       //loop through all of the screen pixels except the last 12
{F} and {rand^8+Str1}->{F-12}   //take the byte, use AND to erase a single bit from it, and then store it into the byte directly *above* it
End                     //this makes it so that as the byte rises, each frame a pixel is erased from it

DispGraph

End

Today, after some experimenting, I figured out how to make water.

Code: [Select]
.Axe
ClrDraw
[FEFDFBF7EFDFBD7F]->Str1  //Each Byte here has 7 bits set and 1 bit not set (like FE is 11111110 in binary)
                      //This is so that we can erase a random pixel, since Axe has no built in way to do that
Line(0,0,95,63       //the pixels to catch fire, explained a little later

Repeat getKey(15)    //until we press clear

For(F,L6+12,L6+767      
L6+755→F
While F-L6     //loop through all of the screen pixels except the first 12
F-1→F
{F} and {rand^8+Str1}->{F+12}   //take the byte, use AND to erase a single bit from it, and then store it into the byte directly *below* it
End                     //this makes it so that as the byte drops, each frame a pixel is erased from it

DispGraph

End

voilà, it's water.
« Last Edit: March 21, 2011, 07:03:52 pm by Darl181 »
Vy'o'us pleorsdti thl'e gjaemue

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Routines
« Reply #532 on: March 21, 2011, 07:14:48 pm »
Nice, that looks good as a sort of sprinkler effect :) For water that doesn't evaporate, there's this.




Offline Darl181

  • «Yo buddy, you still alive?»
  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3408
  • Rating: +305/-13
  • VGhlIEdhbWU=
    • View Profile
    • darl181.webuda.com
Re: Routines
« Reply #533 on: March 21, 2011, 07:29:07 pm »
I was able to use it for a menu, and I figured I might as well post it  ;)

Quote from the next post
That looks pretty nice.  It's too bad the water coming from the character looks a little funny when he moves down.  Other than that, wonderful job! ;D
It works the same as the fire, so the fire looks odd when moving up.

The post after that
For a moment there I thought you magically saw a quote from the future O.O
You have a lot to learn...
jk :P
such as this?
Maybe...
ok I'll stop now :P
« Last Edit: March 21, 2011, 08:00:54 pm by Darl181 »
Vy'o'us pleorsdti thl'e gjaemue

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: Routines
« Reply #534 on: March 21, 2011, 07:29:08 pm »
That looks pretty nice.  It's too bad the water coming from the character looks a little funny when he moves down.  Other than that, wonderful job! ;D

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Routines
« Reply #535 on: March 21, 2011, 07:35:02 pm »
Quote from the next post
That looks pretty nice.  It's too bad the water coming from the character looks a little funny when he moves down.  Other than that, wonderful job! ;D
It works the same as the fire, so the fire looks odd when moving up.

For a moment there I thought you magically saw a quote from the future O.O




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: Routines
« Reply #536 on: March 21, 2011, 07:37:40 pm »
Quote from the next post
That looks pretty nice.  It's too bad the water coming from the character looks a little funny when he moves down.  Other than that, wonderful job! ;D
It works the same as the fire, so the fire looks odd when moving up.

For a moment there I thought you magically saw a quote from the future O.O
It's only one second; he could do it, if he really believed.

Offline Happybobjr

  • James Oldiges
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2325
  • Rating: +128/-20
  • Howdy :)
    • View Profile
Re: Routines
« Reply #537 on: March 21, 2011, 07:43:26 pm »
Quote from the next post
That looks pretty nice.  It's too bad the water coming from the character looks a little funny when he moves down.  Other than that, wonderful job! ;D
It works the same as the fire, so the fire looks odd when moving up.

For a moment there I thought you magically saw a quote from the future O.O
such as this?
« Last Edit: March 21, 2011, 07:43:41 pm by Happybobjr »
School: East Central High School
 
Axe: 1.0.0
TI-84 +SE  ||| OS: 2.53 MP (patched) ||| Version: "M"
TI-Nspire    |||  Lent out, and never returned
____________________________________________________________

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: Routines
« Reply #538 on: March 25, 2011, 03:26:31 am »
Lol XD

Anyway nice routines guys above, I love the water effect and I think the bezier curves could be useful for a drawing program.

Offline ZippyDee

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 729
  • Rating: +83/-8
  • Why not zoidberg?
    • View Profile
Re: Routines
« Reply #539 on: March 25, 2011, 03:47:39 am »
I agree, that bezier curve routine is awesome. It could be pretty great for a lot of things actually. For example: using that routine to draw the curves connecting  control points in a uniform b-spline could allow you to draw smooth curved lines between a set of points. If anyone could write a fast enough routine to do that, drawing arbitrary curves (for any reason) could end up being much smoother. Dealing with control points in beziers is not as straightforward as spline control points.

In fact, using a uniform b-spline with quadratic bezier curves could likely be faster and easier to implement into a uniform b-spline algorithm. (unless I'm just remembering wrong and uniform b-splines already use quadratic instead of cubic...)
There's something about Tuesday...


Pushpins 'n' stuff...