openfpga-arduboy icon indicating copy to clipboard operation
openfpga-arduboy copied to clipboard

The Curse of Astarok v1-0

Open JCalhoun85 opened this issue 3 years ago • 6 comments

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.

JCalhoun85 avatar Sep 06 '22 21:09 JCalhoun85

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.

agg23 avatar Sep 08 '22 14:09 agg23

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

JCalhoun85 avatar Sep 09 '22 03:09 JCalhoun85

@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?

uXeBoy avatar Oct 21 '22 03:10 uXeBoy

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

agg23 avatar Oct 21 '22 03:10 agg23

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?

uXeBoy avatar Oct 21 '22 03:10 uXeBoy

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.

agg23 avatar Oct 21 '22 03:10 agg23