Using OR-color, parts of sprite in y-dir is masked away

بواسطة Bengalack

Hero (660)

صورة Bengalack

17-08-2022, 18:16

Using OR-color, parts of sprite in y-dir is masked away

It seems like, when using OR-color on a sprite, parts of it are masked away in the case where a sprite with EVEN higher priority moves alongside. Not very well explained, I know, so I made a case. Test this to see what I mean:

https://webmsx.org/?MACHINE=MSX2&ROM=https://drive.google.co...

Here we have these 3 16x16 sprites, with a full/filled square, like this:

Sprite 0: Color 0x02 "green", no CC-bit
Sprite 1: Color 0x04 "blue", no CC-bit
Sprite 2: Color 0x08 "red", CC-bit set

Sprite 0|2: OR-Color 0x02|0x08 = 0x0A "yellow"
Sprite 1|2: OR-Color 0x04|0x08 = 0x0C "dark green"

So, press cursor keys to move sprite 0, with the highest priority, around. Why is sprite 2 (the sprite with the CC-bit set) masked away according to the y-pos of a sprite that is "two steps" higher in priority? Sprite 1 did not mask off anything on sprite 2.

(Other keys: SPACE = TURN OFF CC-BIT, RETURN = TURN ON CC-BIT)

I've tested this in openmsx, bluemsx, webmsx and on a physical machine.

It's probably me that is blind, but I haven't seen this in the documentation. Where is it?

Login أوregister لوضع تعليقاتك

بواسطة Guillian

Prophet (3513)

صورة Guillian

17-08-2022, 18:47

According to V9958 Technical Data Book Programmer’s Guide:

Quote:

5.2.5. Priority mechanism and multicolored sprite combinations (SM2)
In sprite mode 2 (SM2), if the “CC” bit of the sprite color table entry is set to 1, the
sprite priority mechanism is cancelled for the specified line. Collision mechanism does not
work, mixing color codes of the lines of affected sprites using “OR” logical operation.
This logical color mixing will work for sprite N if its affected line has CC bit set, and
this line will collide with the line of another sprite which has CC bit reset to “0” and has
lower number (N-1, N-2, ..., 0 – i.e. higher priority).
Moreover, the line of the sprite having CC bit set to “1” will not be displayed at all if
there will be no lower number sprite with the line with CC bit set to “0” at the same screen
line.

بواسطة Bengalack

Hero (660)

صورة Bengalack

17-08-2022, 19:14

Thanks a lot! I see now that a variant of that line also exists in v9938 Technical Data Book. I've been using this reference: https://github.com/Konamiman/MSX2-Technical-Handbook and this part seems to be left out.