Author Topic: Routines  (Read 312722 times)

0 Members and 1 Guest are viewing this topic.

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6266
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Routines
« on: February 18, 2010, 11:12:16 pm »
Share your cool little axe parser routines here! Or big too.
I currently don't have any, but I was wondering if anybody could come up with a good line drawing one (from point a to b).
I'll put up some that I come up with later too I guess.

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 #1 on: February 19, 2010, 02:21:18 pm »
would that be in Axe code or in z80 ASM (for helping Quigibo)?

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Routines
« Reply #2 on: February 19, 2010, 03:04:00 pm »
Mmm i'm thinking it would be in Axe code, just to help out people in the future :)

I'll see if i can get a line drawing code whipped up, sounds like a good challenge ^^

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: Routines
« Reply #3 on: February 19, 2010, 03:24:03 pm »
Line drawing will obviously be built in later, so don't worry too much about that.
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Routines
« Reply #4 on: February 19, 2010, 03:29:35 pm »
Haha alright then :P

Maybe I'll upload my very primitive and integer based Sin routine XD

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6266
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Re: Routines
« Reply #5 on: February 19, 2010, 04:06:58 pm »
Axe Parser code :P

yeah, I know line will be included later, but now I can't stop trying to figure out how to do it with only pxl-on() x.x
/e

Offline Galandros

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1140
  • Rating: +42/-10
    • View Profile
Re: Routines
« Reply #6 on: February 19, 2010, 04:11:23 pm »
Axe Parser code :P

yeah, I know line will be included later, but now I can't stop trying to figure out how to do it with only pxl-on() x.x
Get the slope from the 2 points and pixel on points in line between the 2 points. Basically use y=mx+b equation.
This is how it can be done in assembly. There is a tutorial for this in Patagay assembly tutorial.
By using sine and cosine is also possible...
« Last Edit: February 19, 2010, 04:12:57 pm by Galandros »
Hobbing in calculator projects.

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6266
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Re: Routines
« Reply #7 on: February 19, 2010, 04:35:01 pm »
hmm, but how would you do that with no decimal places?
/e

Offline Galandros

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1140
  • Rating: +42/-10
    • View Profile
Re: Routines
« Reply #8 on: February 19, 2010, 04:45:03 pm »
hmm, but how would you do that with no decimal places?
If you want 1 decimal place then use that number times 10 and the least significant digit is your decimal place.
Example of to show what the previous phrase means:
.1 turns 1
1.9 turns 19

Now imagine you want to multiply A and B where A is .1 (10) and B=1.9 (19).
You do (A*B)/100.
Note that these expressions are equivalent: .1*1.9 =  ((1/10) * (19/10)) / 100
Hobbing in calculator projects.

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6266
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Re: Routines
« Reply #9 on: February 19, 2010, 04:51:16 pm »
well that would work, but Axe doesn't support decimals, so that would be an issue...
/e

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 #10 on: February 19, 2010, 05:00:33 pm »
Wasn't decimal support going to arrive in future versions of Axe? I remember Quigibo telling me on Yahoo that some variables would be reserved for integers while some others would be reserved for floating points...

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6266
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Re: Routines
« Reply #11 on: February 19, 2010, 05:23:17 pm »
hmm, I don't know, but that would be nice, as of currently it doesn't allow for it.
/e

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: Routines
« Reply #12 on: February 20, 2010, 12:26:26 am »
Check this out:

http://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm

Its probably what I'll be using, it only requires addition and bit-shifting, no floats.
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6266
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Re: Routines
« Reply #13 on: February 20, 2010, 12:40:28 am »
Sweet! I'll try and make a routine that can work for now until it's integrated.
/e

Offline Galandros

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1140
  • Rating: +42/-10
    • View Profile
Re: Routines
« Reply #14 on: February 20, 2010, 03:31:44 am »
Check this out:

http://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm

Its probably what I'll be using, it only requires addition and bit-shifting, no floats.
There are already two excellent implementations in z80 of that algorithm by James Montelongo and quarnos.
To download the James Montelongo one see his ticalc profile. For quarnos see MaxCoderz forum.
« Last Edit: February 20, 2010, 03:50:15 am by Galandros »
Hobbing in calculator projects.