|
Post by metalfoot on Jun 3, 2006 0:25:30 GMT -5
Is it necessary to fill colour memory each time one POKEs a char to the video screen (ie. poke 1024,1:poke55296,2) or is there some quick workaround to fill colour memory so that I can print in one colour and poke in another?
Just curious...
|
|
|
Post by Jim Lawless on Jun 3, 2006 15:56:03 GMT -5
The BASIC print routine refills the color area with the value at $286, so if you mix POKE's with PRINT's you should always supply the color.
Here's a fill routine I wrote that should fill the color area with whatever you've specified. ( These areas can move around depending on VIC-II settings ... I haven't coded for any of that. )
To use it, call SYS 49152,x where x is the value you want to poke into color memory.
* = $c000 ; fill $d800-$dbe7 with value supplied jsr $b79b ; get 8-bit val in X as color txa ldx #$00 loop = * sta $d800,x sta $d900,x sta $da00,x cpx #$e8 bcs decc sta $db00,x decc = * inx bne loop rts
end
Jim Lawless
|
|
|
Post by metalfoot on Jun 3, 2006 18:13:08 GMT -5
This is what I needed to know. I'm writing a strategy game which, for my simplicity's sake, I'm poking the values of the characters into location, but they need to be a different colour than the playing board onto which they are being poked.
(Actually using extended background character mode... which is fun!)
(Oh, and Robin, it's a different game again. But this one I had my own old source code for so it's a port from the PC to the C64...)
|
|
|
Post by Robin Harbron on Jun 8, 2006 9:34:35 GMT -5
Here's a fill routine I wrote that should fill the color area with whatever you've specified. ( These areas can move around depending on VIC-II settings ... I haven't coded for any of that. ) Not sure if I'm misunderstanding, but colour memory (unfortunately) can't move around - it's fixed to the $d800-$dbe7 area no matter the VIC settings. However, some bitmap modes either ignore colour memory, or also interpret screen memory as colour memory as well - maybe this is what you were getting at? FWIW, I've always done colour clears like this: ldx #250 lda #1 ;white - colour # goes here loop sta $d800-1,x sta $d800+249,x sta $d800+499,x sta $d800+749,x dex bne loop The extra branch is avoided this way.
|
|
|
Post by Jim Lawless on Jun 8, 2006 20:17:33 GMT -5
I stand corrected.
Jim Lawless
|
|
|
Post by mrloadstar on Feb 2, 2007 3:35:02 GMT -5
This is what I needed to know. I'm writing a strategy game which, for my simplicity's sake, I'm poking the values of the characters into location, but they need to be a different colour than the playing board onto which they are being poked. (Actually using extended background character mode... which is fun!) (Oh, and Robin, it's a different game again. But this one I had my own old source code for so it's a port from the PC to the C64...) I did a huge map game where I poked (STAed, actually) the screen codes directly to the screen. For color, I assigned a color for each character -- 256 is such a nice round number. So, if a character had several colors (different strengths, whatever), just use multiple characters, each with its own associated color. I can't imagine what my map would have been like if I had tried to have a color map as well. Dave
|
|