Tile Rendering and Game Pad

A project log for 1Bitsy 1UP

ARM Cortex-M4F based retro inspired handheld game console.

Piotr Esden-TempskiPiotr Esden-Tempski 07/09/2017 at 21:471 Comment

Some more progress on the 1Bitsy 1UP firmware. Now that I managed to load some assets into the 1Bitsy I also have added a tile-map and implemented a simple rendering routine. I have also added a font to the assets and wrote a routine that is drawing the current frame-rate in the right upper corner of the display.

I was reading out this variable in the past but it was in the range of 42 not 78fps... this caused quite a bit of consternation. I have now added some code that toggles a GPIO on each frame and my oscilloscope agrees that the frame-rate is indeed 78fps. Based on the parallel interface data rate the numbers agree: 12MHz byte clock -> 12MB/s data rate / 16bit/pixel (RGB565) -> 6MPixel/s / 320x240 -> 78.125fps I bet I was doing something wrong in the past and reading out a wrong value for the fps. It is really exciting to see that we are running almost at the internal LCD frame rate (we should be able to do TE signal sync! aka. VSYNC). While I was already at it I also added code that sets a GPIO hi when filling a pixslice with pixels. This indicates how much time we are spending with rendering of the picture within the frame time.

The above picture shows the frame GPIO toggle (yellow trace, 38.94Hz = 77.88fps) and the time spent rendering the pixels. We obviously have a lot of time where the MCU is waiting for a pixslice to become available/scheduled. The STM32F4 does not stop to amaze me how fast it is! :D

As a next step I have added code to read out a gamepad shift register. The hardware that is in production at the moment has the same circuit as a SNES gamepad. This means two 8 bit parallel to serial shift registers. To be able to start writing some interactive code I have added a simple bitbang latch and clock out routine. I can now move the tilemap around using the D-Pad. I also added a small debug indicator showing 1's and 0's for all the shift register bits. Pressing any button will flip the corresponding bit on the display.

This is all very good progress. In my opinion! ;D Still lot's of code needs to be written before we have something that resembles a console game, but that is part of the fun! :D


oshpark wrote 07/11/2017 at 18:24 point

Very exciting!

  Are you sure? yes | no