Omnimaga: The Coders Of Tomorrow
Welcome, Guest. Please login or register.
 
Omnimaga: The Coders Of Tomorrow
25 May, 2013, 07:03:12 *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   home   news downloads projects tutorials misc forums rules new posts irc about Login Register  
+-OmnomIRC

You must Register, be logged in and have at least 40 posts to use this shout-box! If it still doesn't show up afterward, it might be that OmnomIRC is disabled for your group or under maintenance.

Note: You can also use an IRC client like mIRC, X-Chat or Mibbit to connect to an EFnet server and #omnimaga.

Pages: 1 ... 38 39 [40] 41 42   Go Down
  Print  
Author Topic: Routines -  (Read 42578 times) Bookmark and Share
0 Members and 1 Guest are viewing this topic.
turiqwalrus
LV8 Addict (Next: 1000)
********
Offline Offline

Gender: Male
Last Login: Yesterday at 23:17:21
Date Registered: 25 November, 2010, 00:38:42
Location: In a shadowed grotto far from the eyes of the world.
Posts: 708


Total Post Ratings: +42

View Profile
« Reply #585 on: 12 October, 2011, 16:23:05 »
0

nice Wink
once that's optimized, I'll switch from 0.5.3 Tongue
(and once I finally read the newest commands list x.x)
Logged
Darl181
Vy'o'us pleorsdtu tlh'e gjaemue.
Coder Of Tomorrow
LV12 Extreme Poster (Next: 5000)
*
Online Online

Gender: Male
Last Login: Today at 07:00:53
Date Registered: 10 June, 2010, 00:32:08
Location: {I*9+L₁+1},{I*9+L₁+3}
Posts: 3283


Total Post Ratings: +267

View Profile WWW
« Reply #586 on: 13 October, 2011, 06:12:09 »
+1

Another one Tongue

How feasible would it be to make xoring lines/circles?  I just got a freaking huge optimization in Essence Cheesy 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)
Logged




 
Spoiler for Stuff:



OS 2.43  Boot 1.02  Hardware Rev. B

OS 1.04.32

OS 3.1.0.392  Boot1 3.0.99  Boot2 3.10.16
Spoiler for Misc:
Quote
You'll understand / It's not a shame / To be always / Losing the game / Burma-Shave
"Dynamic userbars!"
Omnimaga radio
Interactive Omnimaga radio
Our World of Text
Draw on websites
Then blow them up
In-browser flight simulator
Haxball: MMO soccer/air hockey game
  Draw with sand.  Yay?
The Game
You just lost the game
Zombo.com
light post color is #dfefff
dark post color is #cae4ff
quote box color is #6699ff
transparent color is...transparent 0.o
Spoiler for Forum search alternative (bookmarklet):
https://www.squarefree.com/bookmarklets/search.html
javascript:q=""+(window.getSelection?window.getSelection():document.getSelection?document.getSelection():document.selection.createRange().text);if(!q)q=prompt("No%20selected%20text;%20enter%20search%20term.").replace(/\s\+/g,"%252B");if(q!=null)location="http://www.google.com/search?q="+q.replace(/\s+/g,"+")+"+site:"+location.hostname;void(0);
aeTIos
You got stair'd!
LV12 Extreme Poster (Next: 5000)
************
Offline Offline

Gender: Male
Last Login: Today at 02:17:21
Date Registered: 15 September, 2010, 06:00:00
Location: Netherlands, Overijssel
Posts: 3121


Total Post Ratings: +120

View Profile
« Reply #587 on: 14 October, 2011, 12:43:24 »
0

Who would like a search routine?
Logged

If something above sounds rude, feel free to vote it down, it was not meant to be rude<<lolol
--Always stay relAXEd!--


Spoiler for Hidden:


[







Spoiler for Still Alive:
This was a triumph.
I'm making a note here: HUGE SUCCESS.
It's hard to overstate my satisfaction.

Aperture Science:
We do what we must because we can.
For the good of all of us
Except the ones who are dead.

But there's no sense crying over every mistake
You just keep on trying till you run out of cake
And the science gets done and you make a neat gun
For the people who are still alive.

I'm not even angry.
I'm being so sincere right now.
Even though you broke my heart and killed me.
And tore me to pieces.
And threw every piece into a fire.
As they burned it hurt because
I was so happy for you.

Now these points of data make a beautiful line
And we're out of beta we're releasing on time.
So I'm GLaD I got burned think of all the things we learned
For the people who are still alive.

Go ahead and leave me.
I think I prefer to stay inside.
Maybe you'll find someone else to help you.
Maybe Black Mesa -
THAT WAS A JOKE. HA HA, FAT CHANCE.
Anyway, this cake is great:
It's so delicious and moist.

Look at me still talking when there's science to do.
When I look out there it makes me GLaD I'm not you.
I've experiments to run there is research to be done
On the people who are still alive

And believe me I am still alive.
I'm doing science and I'm still alive.
I feel FANTASTIC and I'm still alive.
While you're dying I'll be still alive.
And when you're dead I will be still alive.

Still alive
Still alive
MGOS
LV5 Advanced (Next: 300)
*****
Offline Offline

Gender: Male
Last Login: Today at 00:15:35
Date Registered: 29 July, 2011, 16:54:53
Location: Germany
Posts: 297


Total Post Ratings: +74

View Profile
« Reply #588 on: 25 October, 2011, 07:23:50 »
0

Does someone know a short and fast routine for a broke / dotted line?
Logged

Click those to see more information Smiley
Current   
Projects: 
Michael_Lee
LV9 Veteran (Next: 1337)
*********
Offline Offline

Gender: Male
Last Login: 09 August, 2012, 18:48:39
Date Registered: 05 August, 2010, 01:00:06
Posts: 1020

Total Post Ratings: +115

View Profile
« Reply #589 on: 25 October, 2011, 07:46:02 »
0

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://www.omnimaga.org/index.php?topic=1532.msg84372#msg84372

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: 25 October, 2011, 07:46:41 by Michael_Lee » Logged

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.
MGOS
LV5 Advanced (Next: 300)
*****
Offline Offline

Gender: Male
Last Login: Today at 00:15:35
Date Registered: 29 July, 2011, 16:54:53
Location: Germany
Posts: 297


Total Post Ratings: +74

View Profile
« Reply #590 on: 25 October, 2011, 13:17:19 »
0

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.


1
2
3
4
5
6
pt-Get(X,Y)->W
For(I,0,7)
{W+I} xor ({sprite+I})->{W+I}
End
Pt-Off(X,Y,W)
« Last Edit: 01 November, 2011, 16:51:35 by MGOS » Logged

Click those to see more information Smiley
Current   
Projects: 
Keoni29
LV9 Veteran (Next: 1337)
*********
Offline Offline

Gender: Male
Last Login: Today at 00:26:58
Date Registered: 15 March, 2011, 16:23:33
Location: The Netherlands
Posts: 1119


Total Post Ratings: +146

View Profile WWW
« Reply #591 on: 24 November, 2011, 22:29:54 »
0

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.


1
2
3
4
5
6
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 Cheesy
Logged


Spoiler for Hidden:
Last signature update 10:55 april 22nd 2013
MGOS
LV5 Advanced (Next: 300)
*****
Offline Offline

Gender: Male
Last Login: Today at 00:15:35
Date Registered: 29 July, 2011, 16:54:53
Location: Germany
Posts: 297


Total Post Ratings: +74

View Profile
« Reply #592 on: 25 November, 2011, 17:02:52 »
0

That might come in handy for monochrome games Cheesy
Yeah, I needed it for a cursor in my program, which got undesiredly invisible if you moved to a black area.
Logged

Click those to see more information Smiley
Current   
Projects: 
calc84maniac
Epic z80 roflpwner
Coder Of Tomorrow
LV11 Super Veteran (Next: 3000)
*
Offline Offline

Gender: Male
Last Login: Today at 03:47:14
Date Registered: 28 August, 2008, 05:09:05
Location: Right behind you.
Posts: 2735


Total Post Ratings: +373

View Profile
« Reply #593 on: 25 November, 2011, 17:48:05 »
0

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.


1
2
3
4
5
6
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)?
Logged

"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman
aeTIos
You got stair'd!
LV12 Extreme Poster (Next: 5000)
************
Offline Offline

Gender: Male
Last Login: Today at 02:17:21
Date Registered: 15 September, 2010, 06:00:00
Location: Netherlands, Overijssel
Posts: 3121


Total Post Ratings: +120

View Profile
« Reply #594 on: 25 November, 2011, 18:14:00 »
0

^That.
Logged

If something above sounds rude, feel free to vote it down, it was not meant to be rude<<lolol
--Always stay relAXEd!--


Spoiler for Hidden:


[







Spoiler for Still Alive:
This was a triumph.
I'm making a note here: HUGE SUCCESS.
It's hard to overstate my satisfaction.

Aperture Science:
We do what we must because we can.
For the good of all of us
Except the ones who are dead.

But there's no sense crying over every mistake
You just keep on trying till you run out of cake
And the science gets done and you make a neat gun
For the people who are still alive.

I'm not even angry.
I'm being so sincere right now.
Even though you broke my heart and killed me.
And tore me to pieces.
And threw every piece into a fire.
As they burned it hurt because
I was so happy for you.

Now these points of data make a beautiful line
And we're out of beta we're releasing on time.
So I'm GLaD I got burned think of all the things we learned
For the people who are still alive.

Go ahead and leave me.
I think I prefer to stay inside.
Maybe you'll find someone else to help you.
Maybe Black Mesa -
THAT WAS A JOKE. HA HA, FAT CHANCE.
Anyway, this cake is great:
It's so delicious and moist.

Look at me still talking when there's science to do.
When I look out there it makes me GLaD I'm not you.
I've experiments to run there is research to be done
On the people who are still alive

And believe me I am still alive.
I'm doing science and I'm still alive.
I feel FANTASTIC and I'm still alive.
While you're dying I'll be still alive.
And when you're dead I will be still alive.

Still alive
Still alive
MGOS
LV5 Advanced (Next: 300)
*****
Offline Offline

Gender: Male
Last Login: Today at 00:15:35
Date Registered: 29 July, 2011, 16:54:53
Location: Germany
Posts: 297


Total Post Ratings: +74

View Profile
« Reply #595 on: 25 November, 2011, 19:07:32 »
0

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.
Logged

Click those to see more information Smiley
Current   
Projects: 
aeTIos
You got stair'd!
LV12 Extreme Poster (Next: 5000)
************
Offline Offline

Gender: Male
Last Login: Today at 02:17:21
Date Registered: 15 September, 2010, 06:00:00
Location: Netherlands, Overijssel
Posts: 3121


Total Post Ratings: +120

View Profile
« Reply #596 on: 25 November, 2011, 20:26:58 »
0

Aha.
Logged

If something above sounds rude, feel free to vote it down, it was not meant to be rude<<lolol
--Always stay relAXEd!--


Spoiler for Hidden:


[







Spoiler for Still Alive:
This was a triumph.
I'm making a note here: HUGE SUCCESS.
It's hard to overstate my satisfaction.

Aperture Science:
We do what we must because we can.
For the good of all of us
Except the ones who are dead.

But there's no sense crying over every mistake
You just keep on trying till you run out of cake
And the science gets done and you make a neat gun
For the people who are still alive.

I'm not even angry.
I'm being so sincere right now.
Even though you broke my heart and killed me.
And tore me to pieces.
And threw every piece into a fire.
As they burned it hurt because
I was so happy for you.

Now these points of data make a beautiful line
And we're out of beta we're releasing on time.
So I'm GLaD I got burned think of all the things we learned
For the people who are still alive.

Go ahead and leave me.
I think I prefer to stay inside.
Maybe you'll find someone else to help you.
Maybe Black Mesa -
THAT WAS A JOKE. HA HA, FAT CHANCE.
Anyway, this cake is great:
It's so delicious and moist.

Look at me still talking when there's science to do.
When I look out there it makes me GLaD I'm not you.
I've experiments to run there is research to be done
On the people who are still alive

And believe me I am still alive.
I'm doing science and I'm still alive.
I feel FANTASTIC and I'm still alive.
While you're dying I'll be still alive.
And when you're dead I will be still alive.

Still alive
Still alive
Builderboy
Physics Guru
LV13 Extreme Addict (Next: 9001)
*************
Offline Offline

Gender: Male
Last Login: Today at 04:12:47
Date Registered: 20 April, 2009, 00:28:53
Location: Ravenholm
Posts: 5643


Total Post Ratings: +589

View Profile
« Reply #597 on: 25 November, 2011, 22:20:41 »
0

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
Logged

MGOS
LV5 Advanced (Next: 300)
*****
Offline Offline

Gender: Male
Last Login: Today at 00:15:35
Date Registered: 29 July, 2011, 16:54:53
Location: Germany
Posts: 297


Total Post Ratings: +74

View Profile
« Reply #598 on: 25 November, 2011, 22:40:21 »
0

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
Logged

Click those to see more information Smiley
Current   
Projects: 
jacobly
LV4 Regular (Next: 200)
****
Online Online

Last Login: Today at 06:49:23
Date Registered: 09 October, 2011, 01:53:09
Posts: 199

Total Post Ratings: +149

View Profile
« Reply #599 on: 11 December, 2011, 09:31:21 »
+5

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.

* LIBCLOCK.8xp (1.16 KB - downloaded 21 times.)
* CLOCKTST.8xp (0.81 KB - downloaded 17 times.)
« Last Edit: 12 December, 2011, 00:30:18 by jacobly » Logged
Pages: 1 ... 38 39 [40] 41 42   Go Up
  Print  
 
Jump to:  

Powered by EzPortal
Powered by MySQL Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Powered by PHP
Page created in 0.587 seconds with 31 queries.
Skin by DJ Omnimaga edited from SMF default theme with the help of tr1p1ea.
All programs, games and songs avaliable on this website are property of their respective owners.
Best viewed in Opera, Firefox, Chrome and Safari with a resolution of 1024x768 or above.