V9990 p-mode sprite priority

By GhostwriterP

Champion (510)

GhostwriterP's picture

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.).

Login or register to post comments

By Manuel

Ascended (15600)

Manuel's picture

07-09-2019, 12:32

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

By wouter_

Champion (415)

wouter_'s picture

07-09-2019, 12:37

Nice find. Could you provide a testcase?