Hello NES DEV
I have a question may be somehow strange.
I have implemented successfully , both of sprite rendering and BG rendering blocks in the PPU ( in vhdl )
each of them works the right way when tested alone , the problem comes when integrating both and using the priority MUX
as far as I knew , the bit 5 in the attribure byte of the sprite is used as a selection for this mux , my problem is that after the sprite is
drawn , no background again is drawn till the end of the scanline, I knew the reason , this is because that after the sprite , the priority
logic still sees the same data ( i.e.: 2 pattern register , attribute register) so for sure the background won't be drawn in this line
I think there is a logical problem in the priority calculation I did so what I want to know the right logic and what is done when the sprite in the current scan line is rendered ?
what I implemented is :
I have a question may be somehow strange.
I have implemented successfully , both of sprite rendering and BG rendering blocks in the PPU ( in vhdl )
each of them works the right way when tested alone , the problem comes when integrating both and using the priority MUX
as far as I knew , the bit 5 in the attribure byte of the sprite is used as a selection for this mux , my problem is that after the sprite is
drawn , no background again is drawn till the end of the scanline, I knew the reason , this is because that after the sprite , the priority
logic still sees the same data ( i.e.: 2 pattern register , attribute register) so for sure the background won't be drawn in this line
I think there is a logical problem in the priority calculation I did so what I want to know the right logic and what is done when the sprite in the current scan line is rendered ?
what I implemented is :
Code:
N.B: & = concatenation
attribute bit_5 of the sprite being rendered =
sprite0.attribute_byte.bit5 if ( (iam rendering now) and (sprite0_x has reached 0) and ( upper 2 palette bits & patter plane1 bit & pattern plane0 bit = "00" ) )
else : the same but sprite1 till reaching 7
I use the " attribute bit_5 of the sprite being rendered " as the selection of the mux
attribute bit_5 of the sprite being rendered =
sprite0.attribute_byte.bit5 if ( (iam rendering now) and (sprite0_x has reached 0) and ( upper 2 palette bits & patter plane1 bit & pattern plane0 bit = "00" ) )
else : the same but sprite1 till reaching 7
I use the " attribute bit_5 of the sprite being rendered " as the selection of the mux