Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - VDP status flags 'garbage' bits...

Reply to topic
Author Message
  • Joined: 05 Sep 2013
  • Posts: 3827
  • Location: Stockholm, Sweden
Reply with quote
VDP status flags 'garbage' bits...
Post Posted: Thu Feb 16, 2017 2:15 pm
Some days ago, I started discussing with Calindro about the unused bits in the VDP status flags (here's what Charles' VDP doc says about them [excerpt]):

 Status flags
 ----------------------------------------------------------------------------
 Reading the control port returns a byte containing status flags:

 MSB                         LSB
 INT OVR COL --- --- --- --- ---

 INT - Frame interrupt pending
 OVR - Sprite overflow
 COL - Sprite collision

 The remaining bits are not set by the VDP, and return garbage values for
 the SMS and SMS 2.


...and we were wondering, since the SMS VDP is derived from the Texas Instruments TMS9918, if that 'garbage' in there is really completely meaningless or if, by chance, could be somehow connected to the index of the overflowing sprite, as the TMS9918 uses those bits for storing the number of the sprites that is overflowing.

Of course we don't have enough bits in there to store a number which could be up to 63, so we made some hypothesis and went on anyway.

Thus Calindro and Psidum wrote a test ROM, and I also coded one myself too. What came out from both tests is that, as expected, what's found in there is indeed linked to the index of the overflowing sprite, when sprites are overflowing. The following table details what's in there according to overflow status/overflowing sprite index:

 overflowing sprite # | value             | example (decimal)
 ---------------------+-------------------+-------------------------------------------------------------
    *NO* overflow     | 31 ($1F)          | (all five bits are set)
      8<=x<=14        | f=round_up(x/2)   | f(8)=4  f(9)=5  f(10)=5 f(11)=6 f(12)=6 f(13)=7 f(14)=7
     14<=x<=63        | f=round_down(x/2) | f(14)=7 f(15)=7 f(16)=8 f(17)=8 f(18)=9 f(19)=9 f(20)=10 ...


We run that only on two SMS II so far, and further tests are missing too.

So, even if it might not be all that useful, I thought maybe it was interesting to share that anyway.

I'm also attaching my test ROM C source. Feel free to experiment with that on your system and let us know if the outcome is different. Also I'm wondering what if, for instance, there are two overflowing sprites on the same line... or what if there are two separated overflows on screen... well, I'll run a few more tests and I'll let you know. Of course I'm also open to additional suggestions :)

Once more thanks to Calindro and Psidum for their support! :)
overflow.rar (17.42 KB)
Overflow test ROM w/ sources

  View user's profile Send private message Visit poster's website
  • Joined: 01 Jan 2014
  • Posts: 331
Reply with quote
Post Posted: Sun Feb 19, 2017 8:42 am
In regards to multiple overflows we found 1st instance is represented. Another odd thing is details are cleared when switching sat. These two things have not been double checked yet so don't take it for gospel.
  View user's profile Send private message
Reply to topic



Back to the top of this page

Back to SMS Power!