| |
Krill
Registered: Apr 2002 Posts: 2855 |
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.... |
| |
Oswald
Registered: Apr 2002 Posts: 5031 |
how about:
lax layer1
axs #$ff-layer2 ;X:=A&X-#{imm}
lda table_+layer3,x
edit: ok final step not gonna fly, but food for thoughts
edit2:
lax layer1
axs #$ff-layer2 ;X:=A&X-#{imm}
txa
ora layer3 |
| |
Krill
Registered: Apr 2002 Posts: 2855 |
No tables and no index registers, please. =) |
| |
Oswald
Registered: Apr 2002 Posts: 5031 |
Quote: No tables and no index registers, please. =)
|
| |
Martin Piper
Registered: Nov 2007 Posts: 647 |
Hmm, are you sure you want to process one pixel, across three layers, at a time? Not process the whole byte and utilise optimisations processing 4 pixels in one go? |
| |
ChristopherJam
Registered: Aug 2004 Posts: 1382 |
Yes, excellent work CyberBrain!
lol @ Oswald
Martin - my and CyberBrain's solutions do process the whole byte and generate 4 pixels in one go. |
| |
CyberBrain Administrator
Posts: 392 |
Thx - same to you! My solution was based on Groepaz's/Noobtrackers very nice solutions and Groepaz's excellent breakdown of the problem, and those solutions also process whole bytes (4 pixels/bitpairs) at a time. Fun little riddle, btw - i'm sure it has no practical use whatsoever and is just a little brain teaser? :) |
| |
Oswald
Registered: Apr 2002 Posts: 5031 |
I can imagine 3 layers additive like in many miggy vector fx, can be static scrolling texture, or even scroller.. and as Gunnar wants registers free maybe 3 zoomscrollers ? :P :) |
| |
chatGPZ
Registered: Dec 2001 Posts: 11152 |
Ha! Cool stuff. Cjam and Cyberbrain kinda picked up where NT and me stopped, because tired :)
Now i really want to see what you make with it, Krill :=) |
| |
Martin Piper
Registered: Nov 2007 Posts: 647 |
CyberBrain...
lda layer1
adc layer2 ; Assume C = 0
and layer2
If:
layer1 = 01
layer2 = 00 (transparent)
layer3 = 00 transparent
Doesn't that produce 0, which forgets that layer 1 already has a colour? |
| |
chatGPZ
Registered: Dec 2001 Posts: 11152 |
Quote:I can imagine 3 layers additive like in many miggy vector fx, can be static scrolling texture, or even scroller.. and as Gunnar wants registers free maybe 3 zoomscrollers ? :P :)
Layered chessboard zoomers - but with Z rotator!
GOGOGO! :D |
Previous - 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 - Next |