Bionja wrote:
appears from 0 to 255 and fades from 255 to 0 respectively
What the... Do you think the NES uses 24bit RGB? I know the NES has:
a shade of black,
a shade of dark grey,
a shade of light grey,
and a shade of white, that's literally it.
(That's why the fading looks kind of choppy in the picture)
and about fading the background, I heard the NES doesn't have a universal brightness register, so you'd have to fade the background by having multiple palettes that you switch through every couple of frames or so.
I've never coded for the NES, but I know you would probably use a table that would hold the different color values, then you would upload the color to CGRAM. (Somehow. Like I said, I've never done anything on the NES.)
here's a little code:
Code:
infinite_loop:
wai ;make it so the NES doesn't go at 3000 miles per hour
ldx FrameNumber ;this is a register
cpx #$?? ;this number can be anything, just don't make it longer than the table! (The table is four) this sees if you are done fading
beq infinite_loop ;jump back to infinite_loop because the fading is done
lda #Pallete,x ;this is the address of a table that holds the different palette numbers
sta Somewhere ;don't know, I've never coded for the NES
inx ;increase x ;x says how many frames you have gone through
stx FrameNumber ;this is a register
bra infinite_loop
Pallete:
.DB $??,$??,$??,$??
The code above only changes one palette though, and don't expect it to work how it is now, because you still need an init code to clear registers and you need to create a code to say what happens during v blank.
Just thinking, could you actually have a table that points to another table? that would be a way to change multiple colors per frame.