Novice mistakes...

Por Sdw

Resident (50)

imagem de Sdw

02-12-2008, 23:16

Let me share this story so you can all point fingers at me and laught at my newbie expense! Tongue

So, I've just spent about an hour trying to track down a strange sprite problem:
I had some sprites moving around the screen, but sometimes it seemed like all sprites flickered off for one single frame!
After disabling more and more of my code, I finally had just the sprites moving about, moving nicely around the whole screen, all the way down, disappearing in the lower border and reappearing at the top, just as I intended (I bet most of you can guess what the problem is now! Big smile)
I finally came to the conclusion that somehow it seemed like when one sprite hit a certain position, all sprites turned off, regardless of what my program did.
That seemed crazy, but I soldiered on, manually changing the y-positon and recompiling. But I didn't have the patience to try all Y-values, so I thought, hey, perhaps the 9918-docs has something to say about this:
"Sprite processing is terminated if the VDP finds a value of 208 (D0) in the vertical position field of any entry in the Sprite Attribute Table.

DOH!

Guess the lesson to be learned is check the documentation before trying to find bugs! LOL!

Entrar ou registrar-se para comentar

Por ARTRAG

Enlighted (6932)

imagem de ARTRAG

02-12-2008, 23:29

Smile
you have just found an important feature of the msx1 vdp
It is useful when you want to put off all the sprites writing just one byte

Por Hrothgar

Champion (479)

imagem de Hrothgar

03-12-2008, 10:36

An interesting feature indeed. If we agree not to call it a bug that is.
What should a programmer do to circumvent this when sprites are meant to cross that line? Have a routine at every frame that checks each and every sprite for Y=208 and then tweak the value? That seems a lot more problems and increased CPU burden for real world use cases than the ability to switch sprites off with one single byte. And they could at least have taken Y=255 for a more future-proof value?

Por ARTRAG

Enlighted (6932)

imagem de ARTRAG

03-12-2008, 11:46

no, they could have not used Y=255 as it is used for sprites under the upper border
IMHO there is NO bug in the 9918/28 where there is no vertical scroll, and thus no reason to not use Y=0xd0 as special condition
the real bug/flaw/weakness is in the msx2/2+/TR VDPS where, with the vertical scroll, you have to actually test for all the Y in order to avoid the critical value even when all the sprites are in the visible the screen !!