V9990 p-mode sprite priority

Door GhostwriterP

Hero (527)

afbeelding van GhostwriterP

07-09-2019, 11:15

As we all know sprite priority among sprites is controlled with order in spat, where the sprite with lowest sprite no. has the higher priority, nothing new here.

Additionally on V9990 in p-mode you can control the (tile) layer / sprite priority with the pr1 bit in the 'additional info' of the sprite. When the bit is set then the sprite is displayed behind the layer and in front when reset. So far so good.

Interesting becomes the case where a sprite with an higher priority is put behind the layer (pr1 set) and another sprite with a lower priority is put in front of the layer (pr1 reset).

In high level the vdp looks up for a pixel out of the (16 preselected) sprites and picks the pixel from the sprite with highest priority, then it checks this with the (tile) layer pixel and based on layer/sprite priority either the pixel of the sprite or layer is displayed.

But, what about the sprite in front of the layer? Well it has a lower priority so its pixel is not looked at and simply not displayed.

So basically higher priority sprites behind the layer can be used to mask lower priority sprites in front of the layer.
Undoubtedly this feature could be utilised for some nice effect.

Since this is an openMSX topic Wink , in openMSX two things are emulated incorrectly:

1. the sprite with lower priority with pr1 reset is displayed in front of a sprite with higher priority with pr1 set. Note that priority among sprites is and should solely be controlled by order in spat.

2. no 'masking' behaviour as described above, instead the lower priority sprite is shown (maybe entwined with 1.).

Aangemeld of registreer om reacties te plaatsen

Van Manuel

Ascended (15969)

afbeelding van Manuel

07-09-2019, 12:32

Can you make a minimum demo showing these effects so that we can easily test it?

Van wouter_

Champion (420)

afbeelding van wouter_

07-09-2019, 12:37

Nice find. Could you provide a testcase?

Van GhostwriterP

Hero (527)

afbeelding van GhostwriterP

18-09-2019, 11:51

Alright, made the test and posted this issue on github! Link

Van Manuel

Ascended (15969)

afbeelding van Manuel

18-09-2019, 15:28

Thanks, reporting that way yields the highest chance we can fix it! Smile