Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > Stacking multicolour layers in assembly
2024-02-15 22:20
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....
 
2024-02-16 10:59
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
2024-02-16 11:17
Krill

Registered: Apr 2002
Posts: 2855
No tables and no index registers, please. =)
2024-02-16 11:26
Oswald

Registered: Apr 2002
Posts: 5031
Quote: No tables and no index registers, please. =)

2024-02-16 13:58
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?
2024-02-16 14:18
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.
2024-02-16 15:02
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? :)
2024-02-16 15:19
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 :)
2024-02-16 15:23
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 :=)
2024-02-16 15:26
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?
2024-02-16 15:27
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
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
drokk54
Francois Prijt/Audia..
Peacemaker/CENSOR/Hi..
CA$H/TRiAD
Oswald/Resource
haschpipan
ArturoDente
Mixer
Guests online: 76
Top Demos
1 Next Level  (9.7)
2 Mojo  (9.7)
3 13:37  (9.7)
4 Coma Light 13  (9.7)
5 Edge of Disgrace  (9.7)
6 Aliens in Wonderland  (9.6)
7 Comaland 100%  (9.6)
8 Uncensored  (9.6)
9 No Bounds  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 Layers  (9.6)
2 Cubic Dream  (9.6)
3 Party Elk 2  (9.6)
4 Copper Booze  (9.6)
5 TRSAC, Gabber & Pebe..  (9.5)
6 Rainbow Connection  (9.5)
7 Dawnfall V1.1  (9.5)
8 It's More Fun to Com..  (9.5)
9 Daah, Those Acid Pil..  (9.5)
10 Birth of a Flower  (9.5)
Top Groups
1 Nostalgia  (9.4)
2 Oxyron  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 SHAPE  (9.3)
Top Graphicians
1 Mirage  (9.8)
2 Archmage  (9.7)
3 Talent  (9.6)
4 Facet  (9.6)
5 Hend  (9.6)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.066 sec.