Go Penguin WIP platformer for MSX 1

Pagina 16/16
9 | 10 | 11 | 12 | 13 | 14 | 15 |

Van albs_br

Champion (473)

afbeelding van albs_br

12-09-2021, 02:55

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?

Van Metalion

Paragon (1625)

afbeelding van Metalion

12-09-2021, 09:26

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.

Van Grauw

Ascended (10767)

afbeelding van Grauw

12-09-2021, 11:54

Detect VDP version routine on the MAP.

Van DamnedAngel

Champion (266)

afbeelding van DamnedAngel

12-09-2021, 13:00

albs_br wrote:

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

Van albs_br

Champion (473)

afbeelding van albs_br

12-09-2021, 16:31

DamnedAngel wrote:
albs_br wrote:

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.

Van Metalion

Paragon (1625)

afbeelding van Metalion

12-09-2021, 16:39

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.

Pagina 16/16
9 | 10 | 11 | 12 | 13 | 14 | 15 |