agg23 / openfpga-arduboy

Arduboy for Analogue Pocket
GNU General Public License v3.0
57 stars 2 forks source link

The Curse of Astarok v1-0 #8

Open JCalhoun85 opened 1 year ago

JCalhoun85 commented 1 year ago

Screen shifts and wraps around the other side. to recreate bug the game can be found here: https://community.arduboy.com/t/the-curse-of-astarok-v1-0-with-sound/8203 walk to the right to enter the cave. When you finish rolling your die (plays like poker or yahtzee) after damage is dealt the first time the screen shifts. It shifts a certain number of pixels after every round of damage.

agg23 commented 1 year ago

Thanks for the report. This game being broken is particularly interesting, as it suggests there's something not being properly emulated with the display. I also checked on the original core, and it didn't work correctly there either. I'll have to look through the game's code to see what is different.

JCalhoun85 commented 1 year ago

I'm glad it was useful, I have also noticed going through many damage rounds it wraps vertically too just by fewer pixels each time. In case that is relevant to the troubleshooting. Also it runs on my arduboy without this effect

uXeBoy commented 1 year ago

@agg23 - the invert screen command is sent when damage is dealt:

https://github.com/Press-Play-On-Tape/The-Curse-Of-AstaroK/blob/master/Curse/Curse_PlayGameState_Update.ino#L595

The fact that this is causing a screen shift suggests that the command is being interpreted as pixel data, when it should be command data instead... this seems to be handled in the OLED emulation here:

https://github.com/agg23/openfpga-arduboy/blob/master/src/fpga/core/rtl/video/ssd1306-to-vga.v#L170

Maybe the DC line isn't working as it should?

agg23 commented 1 year ago

Thanks for looking into this @uXeBoy. I've been meaning to come back to this, but I've been a little distracted by other consoles :P

uXeBoy commented 1 year ago

No problem - totally relatable 😅

This is where the code seems to make a decision to receive SPI as pixel data vs. OLED commands:

https://github.com/agg23/openfpga-arduboy/blob/master/src/fpga/core/rtl/video/ssd1306-to-vga.v#L222

Where does DC get set / cleared externally?

agg23 commented 1 year ago

It's fed by OledDC, which is pin 4 (0 indexed) of pio_d. I don't actually know much about Arduinos, so that doesn't mean much to me.