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 - Charles's VDP doc

Reply to topic
Author Message
NeoZeed
  • Guest
Reply with quote
Charles's VDP doc
Post Posted: Mon May 29, 2000 11:15 am

Hello all,

After reading the Charles McDonald Sms VDP doc (and particulary the pseudo code) , i can figure out why does the interrupt can be asserted after the first 192 lines only on the 30 next lines.

int vdp_int(int scanline)
{
/* Lines 0-192 */
/* Also, why this <= and not only < for having only 192 lines */

if(scanline <= 0xC0)
{
......
}
else /* Lines 193-261 */
{
/* Load counter */
counter = reg[10];

/* Why this 0xE0 (224) i was supposing that it's the (262-192) but seems not, why only 30 lines ???????

if((scanline < 0xE0) && (status & 0x80) && (reg[1] & 0x20))
{
return (1);
}
}

/* No interrupt for this line */
return (0);
}

Can someone help me please .

Tia

NeoZeed


 
  • Joined: 28 Sep 1999
  • Posts: 1197
Reply with quote
Post Posted: Mon May 29, 2000 6:35 pm

Quote
> After reading the Charles McDonald Sms VDP doc (and particulary the pseudo code) , i can figure out why does the interrupt can be asserted after the first 192 lines only on the 30 next lines.

Firstly, I want to say that the rules I have on interrupts
are by no means accurate, it's just what I've observed while
developing my emulator. :))

Interrupts can occur on lines 0-191. They can also happen on
line 192. This is because at the end of line 191, the V counter
is incremented first, then the interrupt checking and other
tasks are done by the VDP. So, in reality, all this happens
at the very end of line 191, but when a game reads the V
counter, it will get 192 back since the V counter was inremented.

This is basically true for all lines, at the very end of the
line, the V counter is inremented even though you aren't
on the next line yet. But the time between this happening and
the next line starting is very short (it's the length of
the horizontal retrace or something incredibly small like that)


Quote
> /* Why this 0xE0 (224) i was supposing that it's the (262-192) but seems not, why only 30 lines ???????

I found that some games didn't like allowing interrupts from
lines 193 through 261. I figured there was probably some
point where interrupts were no longer accepted, so by chance
I picked 224. (This is because the Genesis VDP is very similar
to the SMS VDP, and it has a 224 line display, so...)

Maybe the value is something else like 212, 208, 240, etc,
but I don't really have anyway to confirm this.

If you are working with the TMS9918, I want to point out
that the interrupt system doesn't work quite like the SMS.



  View user's profile Send private message Visit poster's website
Reply to topic



Back to the top of this page

Back to SMS Power!