| |
Rudi Account closed
Registered: May 2010 Posts: 125 |
Speedcode
Let's say my loop has to iterate 16K times.
unrolling the loop would not be ideal, because then it would be 16K*the amount of bytes inside the loop.
What does speedcode actually do? Unroll loops?
I saw lecture by Ninja at a conference about just LDA's and STA's to specific address locations. But what do these address locations store? tables or opcode+data?
First I thought about actually loading and storing the opcode and data, but afterwards I thought this wouldn't be right! The LDA's and STA's take each x-amount of cycles that I really dont need, and the opcodes and data themselves are the only thing I need :D
I got an idea now about using only one opcode for doing a same operation, but loading and storing the data in 1 or 2 byte format. Perhaps the LDA and STA needs to jump back and forth (as a consequence, i dont know).
Still its a subject that I recently am looking into since i would guess (as an approximation that) my routine will only run in 7 fps as it is now. Ideas or ramblings are welcome about this issue and topic!
(I forgot to ask. Do you make your own tools/or generators for speedcode generation?) |
|
... 20 posts hidden. Click here to view all posts.... |
| |
Rudi Account closed
Registered: May 2010 Posts: 125 |
Groepaz: i used this in my noize-generator several months ago:
rol
adc $d012
and experiment by exchanging adc with eor/sbc. in some cases that worked out better. also the $a2 timer could work. anyway, this wasnt about random number generation. the prng will be an experiment when the effect works. which will take months or perhaps years.
i've decided that regular mode cannot be done. so i'll have to rewrite the whole algorithm and use multicolor or some kind of stretched sprites to do this effect. but i learned alot in this thread. ill be re-reading some of it later because there are some things that are usefull to know.
|
| |
enthusi
Registered: May 2004 Posts: 677 |
For Assembloids I generate a proper sbox ;-) |
| |
johncl
Registered: Aug 2007 Posts: 37 |
A fun RND routine is one that uses 256 bytes filled with the simple rnd routine that is on codebase here:
http://codebase64.org/doku.php?id=base:fast_8bit_ranged_random_..
Every frame you add some new numbers, and just wrap around that 256 byte buffer. So whenever you need a random number in your other code its likely a new one there or something you had 256 bytes back in time. In many cases this is more than enough for many uses.
Generally whenever you can use a lookup table for stuff, then use that to speed up code. |
| |
chatGPZ
Registered: Dec 2001 Posts: 11386 |
look what i posted above =) |
| |
Danzig
Registered: Jun 2002 Posts: 440 |
Quote:that said, dont listen to whoever tells you to use timers or raster or something like that for "random". it gives horrible results, even a static table will work better (and is faster).
please follow the quoted advice.
raster and timer are sequentially increasing so randomness depends on the time between the demand of a value.
even stuff like eoring rasterline with timer deserves to be called "predictable" in the widest meaning. using actual rasterline as the seed is ok. |
Previous - 1 | 2 | 3 - Next |