Author Topic: Routines  (Read 317649 times)

0 Members and 3 Guests are viewing this topic.

Offline turiqwalrus

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 840
  • Rating: +51/-2
  • Wheeeeeee~!
    • View Profile
Re: Routines
« Reply #585 on: October 12, 2011, 10:23:05 am »
nice ;)
once that's optimized, I'll switch from 0.5.3 :P
(and once I finally read the newest commands list x.x)

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 #586 on: October 13, 2011, 12:12:09 am »
Another one :P

How feasible would it be to make xoring lines/circles?  I just got a freaking huge optimization in Essence :D but it requires that whatever draws to the buffer inverts its pixels :|
(the explosions are lines+a circle and the blitz gun is made of lines as well)
Vy'o'us pleorsdti thl'e gjaemue

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: Routines
« Reply #587 on: October 14, 2011, 06:43:24 am »
Who would like a search routine?
I'm not a nerd but I pretend:

Offline MGOS

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 336
  • Rating: +95/-0
    • View Profile
Re: Routines
« Reply #588 on: October 25, 2011, 01:23:50 am »
Does someone know a short and fast routine for a broke / dotted line?

Offline Michael_Lee

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1019
  • Rating: +124/-9
    • View Profile
Re: Routines
« Reply #589 on: October 25, 2011, 01:46:02 am »
I don't know if you could call it either short or fast, but I did once make a variant on a line-drawing algorithm that can also do dotted lines at arbitrary intervals:
http://ourl.ca/4129/138496

I deliberately added a 'Pause' in there, and constructed in such a way so that it would always radiate outwards (I was making a raycaster thing at the time), so it could definitely be optimized.
« Last Edit: October 25, 2011, 01:46:41 am by Michael_Lee »
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 MGOS

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 336
  • Rating: +95/-0
    • View Profile
Re: Routines
« Reply #590 on: October 25, 2011, 07:17:19 am »
Thanks, that's good enough for my purposes.

I found a pixel-wise xor (or / and) function for sprites, to invert a sprite if it is on dark background.

Code: [Select]
pt-Get(X,Y)->W
For(I,0,7)
{W+I} xor ({sprite+I})->{W+I}
End
Pt-Off(X,Y,W)
« Last Edit: November 01, 2011, 10:51:35 am by MGOS »

Offline Keoni29

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2466
  • Rating: +291/-16
    • View Profile
    • My electronics projects at 8times8
Re: Routines
« Reply #591 on: November 24, 2011, 03:29:54 pm »
Thanks, that's good enough for my purposes.

I found a pixel-wise xor (or / and) function for sprites, to invert a sprite if it is on dark background.

Code: [Select]
pt-Get(X,Y)->W
For(I,0,7)
{W+I} xor ({sprite+I})->{W+I}
End
Pt-Off(X,Y,W)

That might come in handy for monochrome games :D
If you like my work: why not give me an internet?








Offline MGOS

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 336
  • Rating: +95/-0
    • View Profile
Re: Routines
« Reply #592 on: November 25, 2011, 10:02:52 am »
That might come in handy for monochrome games :D
Yeah, I needed it for a cursor in my program, which got undesiredly invisible if you moved to a black area.

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: Routines
« Reply #593 on: November 25, 2011, 10:48:05 am »
Thanks, that's good enough for my purposes.

I found a pixel-wise xor (or / and) function for sprites, to invert a sprite if it is on dark background.

Code: [Select]
pt-Get(X,Y)->W
For(I,0,7)
{W+I} xor ({sprite+I})->{W+I}
End
Pt-Off(X,Y,W)

Is something wrong with Pt-Change(X,Y,sprite)?
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: Routines
« Reply #594 on: November 25, 2011, 11:14:00 am »
^That.
I'm not a nerd but I pretend:

Offline MGOS

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 336
  • Rating: +95/-0
    • View Profile
Re: Routines
« Reply #595 on: November 25, 2011, 12:07:32 pm »
Is something wrong with Pt-Change(X,Y,sprite)?
Yeah, else I wouldn't have posted this. The Pt-Change function inverts also white pixels, which isn't desired.
My routine only inverts if the background-pixel AND the sprite-pixel are black.

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: Routines
« Reply #596 on: November 25, 2011, 01:26:58 pm »
Aha.
I'm not a nerd but I pretend:

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Routines
« Reply #597 on: November 25, 2011, 03:20:41 pm »
Is something wrong with Pt-Change(X,Y,sprite)?
Yeah, else I wouldn't have posted this. The Pt-Change function inverts also white pixels, which isn't desired.
My routine only inverts if the background-pixel AND the sprite-pixel are black.

Actually looking at your code, it looks like your routine and Pt-Change() will do exactly the same things.  All Pt-Change is, is an XOR sprite display, which is exactly what you wrote

Offline MGOS

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 336
  • Rating: +95/-0
    • View Profile
Re: Routines
« Reply #598 on: November 25, 2011, 03:40:21 pm »
Is something wrong with Pt-Change(X,Y,sprite)?
Yeah, else I wouldn't have posted this. The Pt-Change function inverts also white pixels, which isn't desired.
My routine only inverts if the background-pixel AND the sprite-pixel are black.

Actually looking at your code, it looks like your routine and Pt-Change() will do exactly the same things.  All Pt-Change is, is an XOR sprite display, which is exactly what you wrote

Ok, I tried it out and it's actually the same. But the routine stays usefull for ANDing sprites and maybe XORing with different buffers

Offline jacobly

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 205
  • Rating: +161/-1
    • View Profile
Re: Routines
« Reply #599 on: December 11, 2011, 02:31:21 am »
Due to multiple requests, I wrote an axe clock library, LIBCLOCK. See CLOCKTST for example code.

Axe Code Function on calculators with a clock (function on calculators without a clock).

Main functions:
ClkOf() Turns the clock off (does nothing).
ClkOn() Turns the clock on (does nothing).
IsClk() Returns 1 if the clock is on, 0 if off (returns 0).
°A:GetDT() Gets the current date and time. Sets 6 consecutive variables, or 6 consecutive words, starting at the passed in address.  In this example, A = year, B = month, C = day, D = hour, E = minute, F = second (returns midnight of January 1, 1997). Do not pass in °r₁.
SetDT(year,month,day,hour,minute,second) Sets the current date and time (does nothing relatively slowly).
DOfWk(year,month,day) Returns the day of the week of the specified date, 1 = Sunday, ..., 7 = Saturday.

Low level functions:
°A:GetRT() Gets the current raw time. Sets 2 consecutive variables, or 2 consecutive words, starting at the passed in address.  In this example, AB = seconds since January 1, 1997 (AB = 0).
°A:SetRT() Sets the current raw time.  Uses 2 consecutive variables, or 2 consecutive words, starting at the passed in address (does nothing).

Bonus functions:
Mul21(r₁,r₂,r₃) Multiplies r₁r₂ by r₃ and stores the result in r₁r₂.
Div21(r₁,r₂,r₃) Divides r₁r₂ by r₃ and stores the result in r₁r₂, and the remainder in r₄. Edit: I think r₃ must be < 256.
« Last Edit: December 11, 2011, 05:30:18 pm by jacobly »