MiSTer-devel / C64_MiSTer

111 stars 57 forks source link

The game Athena stutters and GFX get corrupted when climbing down a rope to go down a level (Previous issue of game running at half speed has been fixed) #162

Open chr0m opened 6 months ago

chr0m commented 6 months ago

This is a weird one and has been an issue in with the core for as long as I can remember. I haven't seen it with any other game

The game seems to run at half speed and the image flickers. Setting Turbo mode to Smart 2x seems to make it run properly, but not I'm still not sure if it is running at the correct speed.

This game works as expected on a real C64 :)

paich64 commented 6 months ago

Can you provide a link to the exact release you are using ? So that i can test the exact same binaries.

eriks5 commented 6 months ago

I downloaded a version from

https://www.myabandonware.com/game/athena-4ik

which has the reported slowdown. It slows down even in the latest C64 nightly.

Interestingly, it works correctly in the C128 core. So I'll see if I can figure out what changes made in that core fixes this issue and see if it can be easily backported to the C64 core.

chr0m commented 6 months ago

Thanks for that. I was going to find a link when I got the chance. I tried a few different releases, they all had the issue.

paich64 commented 6 months ago

@eriks5 is the 8521 also concerned by this issue ?

eriks5 commented 6 months ago

Likely, there are only minimal changes between 6526 and 8521, but I only tested with a real 6526 as I don't have an 8521

paich64 commented 6 months ago

I meant on the core :) or can it be the 6526 file you are modifying is common to 6526 and 8521 so the changes you bring will also be applicable to 8521 ? Also (and again because my knowledge is weak), do you think the changes are safe when it comes to other games / demos etc ?

eriks5 commented 6 months ago

Yes the mos6526.v is for both 6526 and 8521. The same bug is also in the 8520 which is a separate file in the C64 core. For the C128 core I merged the 8520 with the 6526 and 8521 for convenience, but I did not port that merge. The 8520 is used by the 1581. The serial shift register is not used by the 1581 in the C64 core. It is in the C128, because it is used for fast serial IEC.

It's a bit weird this game breaks because of the CIA serial shift register. The shift registers are normally only used for the UART expansion of the C64, so it should have no effect on games or demos. The Athena game probably uses the interrupt of the shift register for timing, instead of the normal timer interrupt. I haven't looked at what the happens in the game itself, I found the issue by trying all old C128 core builds I had until I found the point in time where the issue got fixed, and checked the commits between those builds. I found the issue was fixed with the commit changing the shift registers, and backporting that change to the C64 fixed it there too.

This change has been in the C128 core since June 2022, and tested by using a real 1571 with the core.

chr0m commented 6 months ago

Just tested the latest unstable and it's fixed. Thanks so much! I should have raised this issue ages ago :D

chr0m commented 6 months ago

Found another issue with the game now :D

When you climb down a ladder the game scrolls down to another level and it is all stuttery on the MiSTer and sometimes the GFX get all messed up. Like half of sprites missing and animations not working. Dunno what it is about this game!

I tried it on the C128 core in C64 mode and it has the same issue there as well.

I tried the exact same version of the game on my real C64 and it was fine

chr0m commented 6 months ago

I see this has been merged into MiSTer_main now. Should I close this and open a new issue for the other problem I found with this game?

sorgelig commented 6 months ago

You can rename the title of issue and continue here