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: 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....
 
2024-02-19 02:38
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...)
2024-02-19 08:29
Mixer

Registered: Apr 2008
Posts: 422
This reminds me of the eor fill.
2024-02-19 21:42
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.
2024-02-21 18:08
Krill

Registered: Apr 2002
Posts: 2854
Quoting JackAsser
... tables to figure out ...
You lost me there. :)
2024-02-21 18:22
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?
2024-02-21 21:08
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.
2024-02-22 10:50
WVL

Registered: Mar 2002
Posts: 886
But dear Jackasser, with those same chars you can zoom down to 6 pixel wide chars.
2024-02-22 11:33
Oswald

Registered: Apr 2002
Posts: 5026
can we stop calling it chars ? maybe a stride ?
2024-02-22 15:01
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. :)
2024-02-22 15:01
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
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
Hok/Remember
Fred/Channel 4
JCH/Vibrants
Ax!s/Onslaught - TND
Aomeba/Artline Desig..
Guests online: 113
Top Demos
1 Next Level  (9.8)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.7)
5 Edge of Disgrace  (9.6)
6 Comaland 100%  (9.6)
7 Uncensored  (9.6)
8 No Bounds  (9.6)
9 Wonderland XIV  (9.6)
10 Bromance  (9.5)
Top onefile Demos
1 Layers  (9.7)
2 It's More Fun to Com..  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 TRSAC, Gabber & Pebe..  (9.5)
7 Rainbow Connection  (9.5)
8 Dawnfall V1.1  (9.5)
9 Quadrants  (9.5)
10 Daah, Those Acid Pil..  (9.5)
Top Groups
1 Oxyron  (9.3)
2 Booze Design  (9.3)
3 Censor Design  (9.3)
4 Crest  (9.3)
5 Performers  (9.3)
Top Diskmag Editors
1 Jazzcat  (9.4)
2 Magic  (9.4)
3 hedning  (9.2)
4 Elwix  (9.1)
5 A Life in Hell  (9.1)

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