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 > Multicolor Bitmapped plotting problem #1
2006-06-26 22:48
The Phantom

Registered: Jan 2004
Posts: 360
Multicolor Bitmapped plotting problem #1

I'm so confused. Wasn't sure if I should post this here, or in the 64 pixeling section. It sounded more of a coding problem to me though, so here it goes.

some code.....

lda backdrop+1
ora $060a
sta $060a ;load color from backdrop+1 and "merge" into screen ram

lda #$50
ora backdrop+1
sta $060a ;load green and "merge" into screen ram

lda $060a
sta $da0a ;load the original screen value and store in color memory

backdrop
.byte $09,$02,etc

The original screen value is $24 (or $), so that would plot "purple" in color ram.

The problem is I can't get the correct color HOW I need it.

I need the red and green switched around. Problem here is i'd like to continue using the data from "backdrop" for my color scheme.

The purple doesn't looked used in the area, so no big worry, well, unless it is being used, hahaha.

I've used numerous color-bit editors and they haven't helped at all.

Any thoughts or suggestions on this?
2006-06-27 07:03
MRT
Account closed

Registered: Sep 2005
Posts: 149
I'm not quite sure what you want to do, but I think it's something like this...

You have a bitmap picture stored at $2000
You have your char-screen setup at $0400
You have your color-screen setup at $d800 (duh :)

You try to switch a color at the char screen... Therefor the corresponding pix on the bitmap should have the value "01" or 10" (bitwise)

Now, if you want to change the color, you should not just do an ORA, but you would have to clear first what's allready there... Something like this perhaps:

    ;set left nyble
    lda $060a
    and #%00001111  ;same as #$0f
    ora #$50        ;green color
    sta $060a
    
    ;...
    
    ;set right nyble
    lda $060a
    and #%11110000  ;same as #$f0
    ora #$01        ;white color
    sta $060a


Does this help you in any way?
2006-06-27 07:28
The Phantom

Registered: Jan 2004
Posts: 360
That does exactly the same thing I posted earlier..

Let's try a different approach..

I'm reading my colors through a data table..

backdrop .byte $05,$04,$03,etc

Alright. We both know how the coloring works (well, obviously I don't know much about it, but who cares).

Now, regarding that ORA #$50 and the first color in "backdrop". (this is really hard to explain, hehe).

I need the ORA #$50 to be a #$05... OR at least someway to read it from the data table that way. When I come around to doing the actual effects around the logo, I can't scroll #$55 or #$92 through the table because it'll affect the other colors. See what I mean?

The empty space completly around my logo is filled with $0a (and those spaces within the logo too). I did it like that to better track the coloring i'll be doing. Oh, I used $0a because i'm not using that color in my logo. I'm thinking that's presenting a problem as well, but I dunno.
2006-06-27 07:52
JackAsser

Registered: Jun 2002
Posts: 2014
sh4tab .byte $00,$10,$20,$30,$40,$50,$60,$70,$80....,$f0

lda color_in_screen_ram
and #$0f
sta tmp
ldx colortableoffset
ldy backdrop,x
lda sh4tab,y
ora tmp
sta color_in_screen_ram

Similar C-code:

tmp=color_in_screen_ram & 0x0f;

// tmp|= backdrop[colortableoffset]<<4;
tmp|=sh4tab[backdrop[colortableoffset]];

color_in_screen_ram=tmp;

So, first load the color from screen ram and mask away the upper nybble, then put it away (tmp).
Then load your color from your backdrop table based on colortableoffset.
Then shift this value 4 bits to the left (using a sh4table for speed up).
Then logically or this value with the masked original color (tmp).
Then store it in screen ram again.


Was this what you asked for? :D
2006-06-27 13:14
Compyx

Registered: Jan 2005
Posts: 631
Why use a temporary variable?

lda color_in_screen_ram
and #$0f
ldx colortableoffset
ldy backdrop,x
ora sh4tab,y
sta color_in_screen_ram

Shorter and faster ;)
2006-06-27 14:55
JackAsser

Registered: Jun 2002
Posts: 2014
@Compyx: 1337
2006-06-27 18:49
The Phantom

Registered: Jan 2004
Posts: 360
Quote: @Compyx: 1337

Sweet..

That's EXACTLY what I was looking for!!!

I used what Compyx suggested and did some playing around with it and the coloring is 100% proper now.

I simply can't thank you guys enough.

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
E$G/HF ⭐ 7
MaD ][/Starship
Ben Breton/Absence o..
jicas/Patagonia
Guests online: 131
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 No Listen  (9.6)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 X-Mas Demo 2024  (9.5)
7 Dawnfall V1.1  (9.5)
8 Rainbow Connection  (9.5)
9 Onscreen 5k  (9.5)
10 Morph  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Censor Design  (9.3)
5 Triad  (9.3)
Top Coders
1 Axis  (9.8)
2 Graham  (9.8)
3 Lft  (9.8)
4 Crossbow  (9.8)
5 HCL  (9.8)

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