Plotter / Dot Flag
Watcha boys :)
I'm bored at the moment waiting for other guys to (hopefully sometime soon...) deliver music and code for the megademo so I've been doing other little small bits of code while I wait. :D In case anyone can make use of it I made a little plotter routine today and then added a couple of sine waves to turn it into a dot flag. I can't say it's the fastest or best way to do a dot flag but it works and, well, like I said - I was bored... ;) |
Nice one, had a (very) quick look, my version of your innerloop looks like:
Code:
move.w d0,d1 |
Nice one Sting :)
Yeah, like I just said to WayneK on PM - I literally *threw* this code together in a few minutes this afternoon so I'm 100% sure it can be made much much better. :D I'll tweak it into something nicer code wise at some point. :great |
Quote:
|
Check the new version attached.
A couple of very small optimisations have been made but the main optimisation is Sting's much (much!) better plot code - now credited in the source to him. Accordingly, the flag now has an additional 60 dots per frame. All hail StingRay! :) |
Quote:
I did a little experimenting and I think the routines produce good results. I have the X and Y position and the individual bits precomputed. try it.... Code:
;******* Code:
CalcDot: move.l PlaneBufferWork(pc),a0 Code:
Code:
so long.... victim |
Quote:
Quote:
Code:
|
Why are the nop's in there, out of interest?
|
Because I didn't feel like posting trivial "calc y-offset/draw a dot" code. The nops are just placeholders.
|
Hahaha, fair enough, for some reason I thought there was going to be a hidden piece of cunning :D
|
Quote:
Good man StingRay, :great because you've got me almost. But one must be careful what one writes. Above all, if you want to write that it should be on one of the fastest routine, it becomes dangerous. There are simply too many tricks. For this reason, I have changed my post a precaution :cheese I think this routine produced very good results. Code:
;*** for 68020+ victim |
Just use 64 bytes wide bitplanes (or 32 even if you don't need a wide screen) and do a shift instead, it's simple and fast.
|
Yes, using a single shift whenever possible will always be faster than with a pre-calculated table, if you can't use that for whatever reason then make sure the table is located at less than 128 bytes from the accessing instruction and use something like :
Code:
move.w MulTabY(pc,d1.w*2),d1 Notice that it will probably be faster to use a series of shifts on 68020+ processors and faster to use precalc tables on plain 68000. |
Quote:
Correct, small but nice. :greatI have changed the top so long... victim |
Watcha chaps :)
It's a long time since I messed around with any plotting but today I made a new plotter and I've been testing it out. I'm going for all out speed with this one so I've used shifts and tables and gotten the main plotting loop down to 8 instructions. Doing a rough speed test by just plotting a pixel to the screen over and over I can do 1134 iterations of the plotting loop in one frame. Now, this is a vast improvement over the circa maximum 300 or so plots per frame that my very first plotting routine could do but obviously the total won't really be as high as that once I add in required things like clearing the screen, double buffering and some kind of nice method of deciding where to plot the pixels so they make pretty patterns. :D So, two questions: 1. Are there any other tricks or cheats (other than using lookup tables) to get even more plots per frame...? 2. If not, how are there oldskool demos out there where the coder claims things like 3000 or 10,000 (:shocked) or whatever plots per frame...? |
I guess they're cheating in various ways like taking advantage of symetry/mirroring, only doing one of X/Y calcs per frame (X even, Y odd VBLs), or triple-buffering and using a previous frames 'dots' as a trail/'blur' etc... (since it's already been calced/plotted) - there must be other cheats but it's early and I haven't had coffee yet :)
|
Nice one WayneK :great
I'll add these to my ever growing "things to do coding experiments with" list. :) |
Wow, so this is where the cool stuff is going on, on EAB....I don't know how I've been missing it all. Hey Paul! Could you send me an exe of that dot plotter flag to my email address? Thanks.
|
I will do Brett, as soon as we're finished at the hospital - just waiting to leave - our little son was born yesterday! \o/
|
Quote:
|
All times are GMT +2. The time now is 14:47. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.