Raph Levien builds vic-2350 retro computer with JIT text rendering
Raph Levien developed vic-2350, an 80s-style home computer on an RP2350 board, using a JIT compiler for fast bitmap text rendering.
Raph Levien created vic-2350, a re-envisioning of an 80s home computer running on an RP2350 microcontroller board. The project uses bitmap fonts chosen for efficiency and aesthetic preferences at low resolutions. The renderer implements proportional spacing and kerning to mimic early Macintosh aesthetics. Levien developed a technique for extremely fast bitmap text rendering on microcontrollers like the RP2350 using a JIT compiler. The RP2350 has 520kB of SRAM, which limits the use of full framebuffers in terms of resolution or bit depth. The vic-2350 renderer uses a 'race-the-beam' technique to fill a video buffer each scanline instead of using a framebuffer. This technique has a budget of approximately 6 cycles per pixel. Levien wrote the renderer in symbolasm because Rust could not meet the performance requirements.
The text rendering pipeline uses a double-buffered display list where one buffer is rendered and scanned out while the other is built by the application. During rendering, the renderer maintains an active list containing only the display objects that intersect the current scanline. Text display objects contain a string stored as 1 byte per character, a pointer to the font, and foreground and background colors. The start method allocates scratch space for JIT code and a 1 bit per pixel intermediate buffer before invoking the JIT compiler. The render method calls the generated JIT code to fill a 1 bit per pixel buffer, followed by a second pass to expand it to 16 bit per pixel RGB 565 format. The second pass runs at a sustained rate of 1.75 cycles per pixel. The font bitmap is stored in an extremely packed format where all ink for glyphs is stored in a wide bitmap image with the same height as the font. The packing algorithm reduces the size of the font bitmap from 1140 to 960 bytes by detecting overlaps and not storing space on either side of glyphs. The per-glyph metadata is tightly packed into a 32 bit integer containing the x position, width of ink, left space, and advance. Without a JIT, displaying a full screen of text with proportional spacing was difficult for earlier implementations like pico-dvi-rs.
Sources
Every sentence of this story was checked against facts quoted from these articles. How we make the news
Spotted an error? Tell us
