| |
Krill
Registered: Apr 2002 Posts: 2854 |
Stacking multicolour layers in assembly
Consider 3 single-coloured multicolour layers, such that, e.g.,
00 or 01 - layer 1
00 or 10 - layer 2
00 or 11 - layer 3 (with 00 being background or transparent).
Now, how to merge them, rendering one over/on top of the other (no "glenz"-like colour blending, particular layer ordering isn't important as long as any kind of priority regime is preserved, and background/transparent may not be 00) using only binary arithmetic or other primitives, but no lookup tables?
With the above example, it's some kind of max operation on bitpairs, with something like
|00 01 10 11
--------------
00|00 01 10 11
01|01 01 10 11
10|10 10 10 11
11|11 11 11 11 but this doesn't seem to map very well to the 6502's operations. =) |
|
... 81 posts hidden. Click here to view all posts.... |
| |
chatGPZ
Registered: Dec 2001 Posts: 11145 |
Please define what exactly you want it to do (making the second op an OR and then just use EOR is trivial...) |
| |
Mixer
Registered: Apr 2008 Posts: 422 |
This reminds me of the eor fill. |
| |
JackAsser
Registered: Jun 2002 Posts: 1990 |
Just had to check how I did my 4-layer chesszoomer in Super Larsson Bros back in 2008. Totally forgot how I did it and only remembered that I used 3 layers in the chars (Stacking MC layers) and one in sprites.
In that code I can only scale down to char-sized checkers and I only move in MC resolution, hence a checker-char for one layer can be one of 8 different chars. I use 8 512-byte tables to figure out the final pixel-values indexed by A+(B<<3)+(C<<6) which combines into ((A&~B)&0x55) | (B&0xaa) | C. I have two sets of these 8 tables, one for opaque rendering and one for additive blending. It's 8 tables because of 8 combinations of odd/even checkers for each of the three layers. |
| |
Krill
Registered: Apr 2002 Posts: 2854 |
Quoting JackAsser... tables to figure out ... You lost me there. :) |
| |
Oswald
Registered: Apr 2002 Posts: 5026 |
"a checker-char for one layer can be one of 8 different chars."
I am lost already here. chars? |
| |
JackAsser
Registered: Jun 2002 Posts: 1990 |
Quote: "a checker-char for one layer can be one of 8 different chars."
I am lost already here. chars?
<Off-topic since this is a table based approach>
Checker-char, as the possible values for a byte in a scaled checker board line.
0: 11111111
1: 11111100
2: 11110000
3: 11000000
4: 00000000
5: 00000011
6: 00001111
7: 00111111
If you only scale down do char-size checkers with a motion in x of 2 pixels you have only these 8 combinations.
Three of those layers yields 8*8*8 = 512 combinations to stack them, or blend, or whatever operation you wanna do in those tables.
However, using the lda/and/or trick here is probably faster but requires different scalers to produce the correct bitpairs for each of the layers. |
| |
WVL
Registered: Mar 2002 Posts: 886 |
But dear Jackasser, with those same chars you can zoom down to 6 pixel wide chars. |
| |
Oswald
Registered: Apr 2002 Posts: 5026 |
can we stop calling it chars ? maybe a stride ? |
| |
JackAsser
Registered: Jun 2002 Posts: 1990 |
Quote: But dear Jackasser, with those same chars you can zoom down to 6 pixel wide chars.
Yes yes I know but didn't bother to update the text. :) |
| |
JackAsser
Registered: Jun 2002 Posts: 1990 |
Quote: can we stop calling it chars ? maybe a stride ?
Technically they ARE chars, but only line 7 visible. :P |
Previous - 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 - Next |