Some MSX video timing questions (Emulation MSX Forum)MSX Resource Center               
              
English Nederlands Espa�ol Portugu�s Russian         
 News
   Frontpage
  News archive
  News topics

 Resources
   MSX Forum
  Articles
  Reviews
  Fair reports
  Photo shoots
  Fairs and meetings
  Polls
  Links
  Search

 Software
   Downloads
  Webshop

 MRC
   Who we are
  Join our team
  Donate
  Policies
  Contact us
  Link to Us
  Statistics

 Search
 
  

  

 Login
 

Username

Password




Don't you have an account yet? Become an MSX-friend and register an account now!.


 Statistics
 

There are 52 guests and 2 MSX friends online

You are an anonymous user.
 

MSX Forum


MSX Forum

Emulation - Some MSX video timing questions

Author

Some MSX video timing questions

erikd
msx freak
Posts: 139
Posted: May 02 2006, 21:48   
Hi again,

I hope someone can clear up a few questions for me.
I'm having some trouble properly emulating the timing of things related to interrupts and video emulation which I couldn't find clear documentation for.

How I set up timing now (for PAL) is like this:

* 313 lines
* the first line of the display output is at line 40
* at the end of all 313 lines, the VDP (might) generate the VBlank IRQ
* the VBLANK timing bits in the VDP status registers are reset/set at the first cq last display lines (so not line 0 and 313, but line 40 and 232 or 252)
* HBLANK timing bits get reset/set as a rough guess (reset after 1/16 of one line, set after 15/16 of one line)
* the line number where a HBlank interrupt can take place counts from the first display line (40)onwards (so not the 1st line of the whole frame including borders)

With this set up, I can see that the screen split in Ashguine2 works fine, but Gryzor doesn't work properly and Vampire Killer shows sprite flicker when the player is somewhere high in the screen. The first display line of 40 was basically trial and error until the screen split in ashguine2 looked okay...

So my questions:
* Are VBLANK interrupts indeed generated after the whole frame, or are they generated after the last display line (so when the lower border begins)?
* Are above settings approx. ok?
* Is there any clear documentation about this that I missed?

Thanks!
Erik
manuel
msx guru
Posts: 3552
Posted: May 02 2006, 22:12   
Quite accurate documentation: the openMSX source code
mars2000you
msx master
Posts: 1723
Posted: May 02 2006, 22:24   
Or the blueMSX source code
erikd
msx freak
Posts: 139
Posted: May 02 2006, 22:47   
I was afraid you were going to say that :-)
Not exactly bed time reading material but hey, I guess I have to bite the bullet...
erikd
msx freak
Posts: 139
Posted: May 02 2006, 23:31   
As an aside, I never thought MSX2 emulation would be this hard!
My own emulator JEmu2 already supports lots of different kinds of hardware, including a few 16 bit arcades (CPS1, snowbros), and Sega Master System but MSX2 emulation is much, much harder than any of them. Kudos to the people who were able to do it right!
Edwin
msx professional
Posts: 626
Posted: May 03 2006, 01:11   
Right is a big word, both the accurate emulators are still trying to get the details right that cause incompatibilities in some programs. I think the problem with MSX2 emulation is that the trickery that is timing sensitive is actually used.
BiFi
msx guru
Posts: 3142
Posted: May 03 2006, 07:56   
about the number of lines in PAL/NTSC... There is no emulator capable of emulating that correctly... and with that I mean the vertical display stretch which needs to be rendered...
Sonic_aka_T

msx guru
Posts: 2269
Posted: May 03 2006, 11:40   
Quote:

* HBLANK timing bits get reset/set as a rough guess (reset after 1/16 of one line, set after 15/16 of one line)

Not really sure about that, they appear to be set 'late', but this may also simply be because of Z80-sluggishness. The best way to find this out is to put your emu and hardware side-by-side and change the 'delay value' until both display the same thing.

Quote:

So my questions:
* Are VBLANK interrupts indeed generated after the whole frame, or are they generated after the last display line (so when the lower border begins)?

VBLANK starts after the last display line. (unless the program forces overscan mode)

Quote:

* Are above settings approx. ok?

They seem to be, although the numbers threw me off a little. (I'm used to seeing only the programmer's side of this)

Quote:

* Is there any clear documentation about this that I missed?

The V9938 manual has all the timing values in it. I remember using this once to create a high-speed interrupt using line-interrupts.
erikd
msx freak
Posts: 139
Posted: May 03 2006, 20:02   
Thanks for that. I just found an important little bug regarding bit 7 of status register 0 (VBLANK IRQ flag) which seems to fix a lot
erikd
msx freak
Posts: 139
Posted: May 04 2006, 02:12   
BTW, is there a V9938 databook somewhere to download which is complete? I only found an incomplete transcribed version in various places.
The best document I found on MSX hw is the excellent Portar document (which I used extensively for writing my emulator), but even that is missing many details which can only be found in source files of the better emulators. And the 'MILC' site was very useful too. Any more resources you know about?
Don't say the blue/openMSX emulator source I've seen the sources, but they seem to focus on functionality rather than documentation like for example the MAME source (which *is* very useful as documentation).
manuel
msx guru
Posts: 3552
Posted: May 04 2006, 08:47   
Freel free to join our openMSX IRC channel (#openMSX on irc.freenode.net) where you can get more info about where is what in the source and other knowledge of the developers. Also check the openMSX documentation.
Sonic_aka_T

msx guru
Posts: 2269
Posted: May 04 2006, 15:31   
Quote:

BTW, is there a V9938 databook somewhere to download which is complete? I only found an incomplete transcribed version in various places.

IIRC there's a large PDF on funet. It's a scanned version, and the page numbers don't match, but it is quite complete. It also has the timing values in miliseconds iirc.
 
 







(c) 1994 - 2008 MSX Resource Center Foundation. MSX is a trademark of MSX Licensing Corporation.