MEGA65 / mega65-rom-public

MEGA65 ROM public issue reporting
4 stars 0 forks source link

Strange slowdown in drawing CHAR text in Hungry Dino game #107

Closed gurcei closed 6 months ago

gurcei commented 6 months ago

Test Environment (required)

Describe the bug While playing the 'hungry dinosaurs' game on a recent rom, the vector art drew fine, but the CHAR text was drawn very slowly.

To Reproduce Steps to reproduce the behavior:

  1. Run the hungry dinos game on rom 920385
  2. Observe vector art drawn fine
  3. After this, observe the text drawn slowly

Expected behavior Behaviour as before in 920384, no slowdown

dansanderson commented 6 months ago

Interesting. I can reproduce this in Xemu but not on real hardware.

With dev core 20231214.21,fcf8cc4 with ROM 920390 in NTSC mode, text appears instantly after pic is drawn, as intended.

lgblgblgb commented 6 months ago

Interesting. I can reproduce this in Xemu but not on real hardware.

With dev core 20231214.21,fcf8cc4 with ROM 920390 in NTSC mode, text appears instantly after pic is drawn, as intended.

Wow. This is a really interesting problem, pls notify me, if it turns out to be an emulation problem, though currently I have no idea how this can happen :-O Is it possible that ROM checks vsync (though that should work the same way as on the hw) or anything which may cause to delay drawing events? My only idea right now at least, or something similar ...

lgblgblgb commented 6 months ago

I've checked the game, what I can see by looking at the title bar of Xemu, that with newer ROMs, the CPU clock is downgraded to 1MHz at the problematic parts, while with older ROMs it stays 40.5MHz. Indeed, the diff between 920384 and 920384 ROMs indicate, there was some CPU speed setting code change between these two ROM versions. So I'm 99.99% sure, this must be the problem. If though it works on the hardware, there must be some Xemu bug here which reacts incorrectly on CPU speed settings. The ROM changelog says (also git diff v920384..v920385 in mega65-rom repo to check the difference between the two releases):

Fix: (Requires new core) 80x50 mode no longer switches to the wrong screen memory when CPU speed changes.
This manifested as half a screen of garbage and instability after DOS operations and the ringing of the bell (Ctrl-G)
while 80x50 mode was active.

If this change requires a newer core, I suppose there was some core change which is not implemented by Xemu yet. @dansanderson, do you remember what change in the core this ROM change depends on? Thanks!

I found this: https://github.com/MEGA65/mega65-core/issues/714

However I am not sure how it's connected, it's about changing speed should not trigger hotreg event, but this bug more seems to be a speed change bug not the side-effects. As far as I can see ...

I will try to write a short example which triggers this problem, as it's kinda hard to test with the "Dino game".

lgblgblgb commented 6 months ago

I think this may be an Xemu problem after all. I've just opened an issue there: https://github.com/lgblgblgb/xemu/issues/394 Surely if you agree this being an Xemu-only bug with newer ROMs, this issue can be closed (I think), but that part is not my task to decide.

dansanderson commented 6 months ago

(I left a comment on the other issue.)

dansanderson commented 6 months ago

Confirmed that ROM 920391 in Xemu-next resolves this issue.