PicoVGA is a library that can be used with Raspberry Pi Pico microcontroller to emulate retro games of the 80’s and the 90’s. PicoVGA is a library that allows output from the Raspberry Pi Pico to a VGA monitor or PAL/NTSC TV. This library is particularly used for technical and gaming applications, especially retro game emulation. Also, PicoVGA provides 4 graphic overlay layers with transparency, nearly 30 frame buffer formats with 8 bits graphic output in R3G3B2 format. Implementation of the PicoVGA library is in C++ language.
Features of PicoVGA
Raspberry Pico has 264 KB of RAM, with a dual-core Arm Cortex M0+ processor and two PIO blocks. It allows 1 base layer and 3 overlay layers with transparency for image display. It can give VGA monitor output in 256×192 to 1280×960 resolution. Also, PicoVGA enables automatic configuration of the video mode and overclocking of the processor according to the specified resolution and timing.
PicoVGA gives the option to configure the video output. So, one way is to use the default parameters by initializing video mode through the Video() function. If custom processor frequency is to be set, the PicoVGA library has an overloaded implementation of the Video() function which has to be incorporated by different functions where the desired processor frequency is passed.
For displaying content, PicoVGA divides the image into smaller segments. This is to minimize memory-intensive parts due to limited RAM. It also provides functions to add colour, height and other features to the segment.
For the overlay layers, different overlay programs are predefined for replacing any colour with transparency for layering. Also, it allows RLE compression of the image. Additional features include sprites, Canvas for graphical surfaces and images, image transformation matrix and dedicated functions for text printing. Also, It comes with a random number generation function and ready-to-use fonts. These fonts are in monochrome format.
PicoVGA library supports audio output through PWM modulation. The audio output is done on the GPIO19 port by default. The below image is of a simplified wiring diagram of the VGA monitor output (with audio PWM output).
These are some of the highlights of the PicoVGA library. Also, optimal performance requires consideration for some usage rules. To know more about the rules, please visit here.
The steps for installation, integration and compilation are given here.
Pico for play
Some of the sample programs ready for keyboard control via PC console are:
Ants – card game (sound). Two anthills compete for supremacy. The goal is to build a higher castle. Controls: J left, L right, space select card, D discard, H help, Q quit. The game is played against another player or computer.
Balloons – demonstration of sprite use, flying balloons (43 sprites in total).
A list of all games is available here.
Hrushikesh Vazurkar is an alumni of VNIT Nagpur, CSE Department. He is passionate about competitive programming, web development and AI.