Author Topic: Features Wishlist  (Read 690346 times)

0 Members and 2 Guests are viewing this topic.

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: Features Wishlist
« Reply #1575 on: November 20, 2010, 11:17:59 am »
Remember, no decimals in Axe. Periods signify comments, so all Axe sees in that line is the number 3.




Offline Michael_Lee

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1019
  • Rating: +124/-9
    • View Profile
Re: Features Wishlist
« Reply #1576 on: November 22, 2010, 05:33:28 pm »
You could just take your number, inflate it by multiplying it by 128 or something, then divide by 100, multiply by 314, then finally de-inflate by dividing by 128.
N*128*314/199/128->N
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 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: Features Wishlist
« Reply #1577 on: November 22, 2010, 06:38:12 pm »
You could just take your number, inflate it by multiplying it by 128 or something, then divide by 100, multiply by 314, then finally de-inflate by dividing by 128.
N*128*314/199/128->N


For more accuracy, though, you might want to just keep N inflated (by 128 or 256). Then anything you add to or subtract form N would need to be inflated that same amount, and when you actually use N, just deflate it by N/128 or N/256.

And apparently I haven't actually posted this yet, so a feature request: Changing sin( and cos( so that they have a range of -256 to 256 instead of -128 to 128 so that they match the fixed point numbers used by **.
« Last Edit: November 22, 2010, 06:41:38 pm by Deep Thought »




Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Features Wishlist
« Reply #1578 on: November 22, 2010, 10:42:36 pm »
The current sine and cosine routines produce 1-byte outputs, which is why the range is from -127 to 127. It uses a basic approximation that already isn't completely accurate for the output range of -127 to 127, so expanding the output range would just inflate the inaccuracies as well. If you want to inflate the output values, it's probably not that difficult to do with Axe anyways. And if he were to modify the routine to be more accurate and produce 2-byte outputs, it would require a better approximation method and would surely be a much heftier and slower routine.

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: Features Wishlist
« Reply #1579 on: November 23, 2010, 09:39:55 am »
The current sine and cosine routines produce 1-byte outputs, which is why the range is from -127 to 127. It uses a basic approximation that already isn't completely accurate for the output range of -127 to 127, so expanding the output range would just inflate the inaccuracies as well. If you want to inflate the output values, it's probably not that difficult to do with Axe anyways. And if he were to modify the routine to be more accurate and produce 2-byte outputs, it would require a better approximation method and would surely be a much heftier and slower routine.

Oh, okay. It's fine the way it is, anyway (just multiply by two for fixed-point math).




Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Features Wishlist
« Reply #1580 on: November 23, 2010, 10:04:17 am »
Well actually it would be a bit more complicated than just multiplying by 2. For now, you would have to do something like this:
Code: (31 bytes) [Select]
!If sin(A)→B<ᴇ80
B+ᴇFF00→B
End
.8.8 fixed point result in B

When the signed division auto-optimizations are fixed, a better way will be this:
Code: (15 bytes) [Select]
sin(A)*256//256
EDIT: Disregard all of that, the number comes out as fixed point after all.
« Last Edit: November 23, 2010, 11:00:18 am by Runer112 »

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: Features Wishlist
« Reply #1581 on: November 23, 2010, 10:11:25 am »
Well actually it would be a bit more complicated than just multiplying by 2. For now, you would have to do something like this:
Code: (31 bytes) [Select]
!If sin(A)→B<ᴇ80
B+ᴇFF00→B
End
.8.8 fixed point result in B

When the signed division auto-optimizations are fixed, a better way will be this:
Code: (15 bytes) [Select]
sin(A)*256//256
Um, even though the outputs are in the range -127 to 127, they are still sign extended to 16-bits. All you have to do is multiply by 2 to get the range of about -256 to 256 which is -1 to 1 in 8.8 fixed point.
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Features Wishlist
« Reply #1582 on: November 23, 2010, 10:58:57 am »
Oh, nevermind then. I just glanced at the routine and didn't see any 16-bit register operations so assumed it was all 8-bit. But now I see the dec h.

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 #1583 on: November 23, 2010, 03:04:40 pm »
The reason Sin and Cos are -128 to 127 instead of -256 to 255 is because that way, you can fit the result in a single byte.  Also its only 1 byte more to multiply by two whereas it would be 4 bytes to signed divide by two.
___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: Features Wishlist
« Reply #1584 on: November 23, 2010, 03:13:56 pm »
its only 1 byte more to multiply by two whereas it would be 4 bytes to signed divide by two.

Curious i would think, it takes more memory to go one way than the other way?  I guess some operations don't have an equivalent inverse in asm?

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: Features Wishlist
« Reply #1585 on: November 23, 2010, 03:17:23 pm »
its only 1 byte more to multiply by two whereas it would be 4 bytes to signed divide by two.

Curious i would think, it takes more memory to go one way than the other way?  I guess some operations don't have an equivalent inverse in asm?

Yep, it's add hl,hl vs. sra h \ rr l. If the add hl,hl instruction didn't exist, it would take 4 bytes to multiply by two as well, by using sla l \ rl h.
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Features Wishlist
« Reply #1586 on: November 23, 2010, 03:19:21 pm »
Ah i see, its a small optimization that allows you to double HL :) Gotcha, that makes sense ^^

Offline Michael_Lee

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1019
  • Rating: +124/-9
    • View Profile
Re: Features Wishlist
« Reply #1587 on: November 25, 2010, 12:11:50 pm »
Request:
Command to interact directly with bits, sort of like the nib{ command.
Also, I'm pretty sure this has been requested before, but a way to draw lines and write text to the backbuffer.  Please?
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 Yeong

  • Not a bridge
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3739
  • Rating: +278/-12
  • Survivor of Apocalypse
    • View Profile
Re: Features Wishlist
« Reply #1588 on: November 25, 2010, 12:20:10 pm »
Request:
Also, I'm pretty sure this has been requested before, but a way to draw lines and write text to the backbuffer.  Please?
Don't you add r to write at the back buffer?
ex) Line(a,b,c,d)r

My request
including compiled prgm/BASIC prgm in Axe source code
Sig wipe!

Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: Features Wishlist
« Reply #1589 on: November 25, 2010, 12:23:33 pm »
yeong, no, drawing lines to the backbuffer isn't supported. also, i *think* Asm(prgmCOMPILED) should work. not sure. but implementing BASIC would be far more difficult.

two relatively simple requests: BCalls InsertMem, DelMem, where the variable's size field is automatically updated and it checks to see if there's enough RAM.
Ex.
InsertMem([POSITION],[SIZE]) returns 0 if not enough RAM or 1 if successfully added.
same with DelMem.
« Last Edit: November 25, 2010, 12:23:50 pm by nemo »