Just had an insight here: if the game is running on MSX 2 or above, I can use unrolled OUTI's, even after VBlank. V9938 works with 15 cycles apart from each OUT operation, instead of the 29 cycles of TMS9918.
So I simply have to check MSXID3 ($002d) for a value different than 0.
It's working perfectly (tested on openMSX) on MSX 2, 2+ and TR.
Is there a better way to perform this check?
Yes, you can use OTIR or unrolled OUTI if it's MSX2 or above.
The simplest way is indeed to check the BIOS ID value at $2D, although by doing so, you will be missing MSX1 computers equipped with the V9938 (they are rare, but they're out there). Alternatively, you could check the VDP identification number in S#1.
Detect VDP version routine on the MAP.
My routine to get when a frame takes more than one Vblank finally works.
How do you do it?
Can you share the reference? I'll search for it in the GitHub.
TIA
My routine to get when a frame takes more than one Vblank finally works.
How do you do it?
Can you share the reference? I'll search for it in the GitHub.
TIA
Actually is very simple, I save the current Jiffy at the frame start and compare it to jiffy at the end of main loop:
MainLoop: ld hl, BIOS_JIFFY ; (v-blank sync) ld a, (hl) .waitVBlank: cp (hl) jr z, .waitVBlank ; ---------------------------------------------------------------- ; Save Jiffy to check if previous frame ended ld a, (hl) ld (CurrentJiffy), a ; Main loop code here ; ...... ; ...... ; ...... ; ...... ; ...... ld a, (BIOS_JIFFY) ld b, a ld a, (CurrentJiffy) cp b call nz, .frameSkip jp MainLoop
Now I see that I should put these two pieces of code inside IFDEF DEBUG directives.
I use the same procedure (waiting for VBLANK to start the main loop) in my game engine.
This trick to see if the loop took longer than a frame is simple yet efficient.
Nice.