city41 / ereader-z80-emulator

A web based emulator for running z80 Nintendo E-Reader apps
GNU General Public License v3.0
2 stars 0 forks source link

halt frames or LoadCustomBackround: too fast in the emulator #1

Closed city41 closed 2 hours ago

city41 commented 3 hours ago

Solitaire does this to deal out the deck

    call _deck_deal_card
    call deck_gfx_render
    ld a, 1
    halt

Where deck_gfx_render calls LoadCustomBackground.

Here it is in mGBA, which is very accurate to a real GBA

https://github.com/user-attachments/assets/f8af6273-1622-4d1b-bb41-a8f653c3fa69

And here it is in the emulator, running on my 5 year old PC

https://github.com/user-attachments/assets/0b9bae5e-a345-40df-9203-3a39a4c40dbd

I suspect LoadCustomBackground is the culprit. On a real GBA, I believe this call takes several frames to complete but is instantaneous on the emulator.

city41 commented 2 hours ago

LoadCustomBackground takes 4 frames on a GBA, versus just 1 in the emulator. I am investigating the base way to slow down ERAPI calls now.