PICO-8 Display Driver

I got an idea the other day to write a display driver in PICO-8 using the GPIO pins and here it is. The cart replaces the flip() function with a custom one that writes the PICO-8 frame buffer to a connected display (with a ssd1351 controller) over SPI using the GPIO pins on a Raspberry Pi. Turns out that it actually works :)

I use this display/controller board from Adafruit

Emulating SPI over the GPIO pins seems to be quite slow however and it takes about 5 seconds to render a single frame. I believe that if zep exposes the hardware SPI functionality of wiringPi in addition to the GPIO pins it would run in real time. You can try commenting out the first line in spi_write_n() to “emulate” hardware SPI (with DD_ENABLE=TRUE).

Instructions are included in the cart if you would like to try it at home. Remember to enable GPIO pins on the RPi first and running pico8 as super user (“sudo ./pico8”)

Wishlist:

* hardware spi (example: spi8(byte), spi32(four_bytes), spi(0x6000,8192) -- from memory)
* delay functionality (like Arduino's delayMicros())

UPDATE! (2020-09-05)

After checking the official PICO-8 manual, it seems like zep added support for hardware SPI by means of the serial() function in version 0.1.12!