Skip to content

Stéphane Hockenhull's website

Bits and Can-do Dad

Starduino for Uzebox

Posted on 2022-08-032023-09-14 By rv6502 No Comments on Starduino for Uzebox

Download Starduino for Uzebox (zip file) (uze file)

Shortly after releasing Starduino on Arduboy, Andrew (AKA CunningFellow) offered me one of his Uzebox DTV units (Big thanks).

The Uzebox is a minimalistic open source hardware game console which at it’s simplest incarnation consist of a few discrete components and a single ATmega644 micro-controller chip (SCART version). For NTSC output an additional AD723 video encoder is needed which still makes it only two ICs for a working game console.

Since there is no graphic chip, no video controller, and no timer-driven DMA on the ATmega644 the CPU has to constantly generate the video signal in real time. Not that this is an issue, just a bit of an extra challenge ( One that I was already familiar with ).

Performance

Both the Arduboy and Uzebox uses an ATmega CPU which meant I didn’t have to rewrite the few assembly routines and compared to the Arduboy the Uzebox is a beast:

Image source: Kozuch – Uzebox – wikipedia CC BY-SA 3.0
ArduboyUzebox
ROM32KB64KB
RAM2.5KB4KB
Speed16Mhz28.6Mhz

That is until you take into account it has no video circuitry:

ArduboyUzebox
RAM (including display)3.5KB4KB
Approximate equivalent speed after
cost of display refresh/update
~14.6Mhz~5.86Mhz (for 224 lines)

OUCH!

Cutting the CPU some slack

The Arduboy has a 128×64 OLED display and since I need 2 video buffers (one to render, one to display) there isn’t enough memory anyway to increase the rendering resolution.

So I created 3 video modes:

The very slow doubled lines (128 lines total):

It’s good for screenshots …

The default “fullscreen” without the line doubling:

And a tiny green mode that gives an extra 2 to 4 fps:

This last one isn’t in black & white as duplicating a bit to an entire register takes more cycles.

The memory format is also different requiring a copy routine rather than a pointer swap but as the drawing load becomes higher the display CPU savings start to really pay off.

Memory

The good news is I got a whole extra 512 bytes of RAM and lots of ROM space to implement the vertex cache I couldn’t on Arduboy due to space constraints. I just need 192+2 bytes (12 bytes * 16 vertices + 16 “valid” bits)

Audio

But I don’t have any extra RAM! I need 262 bytes for the audio buffer and I need two of them to double-buffer it all.

On Arduboy I calculated every audio sample on the fly in the interrupt routine to save on RAM but on Uzebox the CPU is already very busy, too busy to afford .

I had to cut the buffer in half and recalculate the audio mid-frame using recursive interrupts so the display could keep updating. The cost of recursive interrupts on the stack was less than the 262 bytes saved, an overall gain.

A Tight Fit

The blue space on the right represent the space between the top of the variables and the stack. Each square is a byte. That’s a little less than 64 bytes of RAM left.

Early WIP capture in Uzebox emulator

2022 Release

Tiny video mode 2022

Things have kept happening over the last 3 years, including moving to a new house, and finally I found enough time to polish and release the Uzebox port.

That was quite the long back-burner project delay.

It gave me the chance to improve performance on the tiny video mode and make it black-and-white.

The game runs identically with some last minute cosmetic changes the dithering to avoid NTSC chroma carrier clashes and judging by the emulator’s RAM display with that change I am now under 16 bytes of RAM free.

Enjoy.

Starduino™ © 2019-2022 Stephane Hockenhull
All rights reserved.
Not for redistribution or commercial use, including but not limited to installation on devices by sellers, resellers, and manufacturers. Contact for licensing.

Arduino, ATmega644, AVR, Computer Graphics, Hardware, Software Releases, Uncategorized Tags:3D, Arduino, Assembly, AVR, Games, GPU, Hardware, Renderer

Post navigation

Previous Post: We built an EDM BBQ

Related Posts

We built an EDM BBQ Uncategorized
Bad Duino – Bad Apple!! on Arduino Arduino
Fixing that OpenPandora hinge design Experiments
Brickster for Game Boy Color Game Boy
Game Boy Tracker Replay Routines Released Audio
Starduino – 3D Gaming in 28KB – Behind the Pixels Arduino

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Archives

  • August 2022
  • October 2019
  • July 2019
  • January 2019
  • January 2018
  • July 2014
  • June 2014
  • May 2012
  • January 2012
  • December 2011
  • December 2010

Categories

  • Arduino
  • ATmega32U4
  • ATmega644
  • Audio
  • AVR
  • Blog
  • Computer Graphics
  • Computer Vision
  • Experiments
  • Game Boy
  • Games
  • GPU
  • Hardware
  • Linux
  • Mac OSX
  • MS Windows
  • MSDOS
  • Open Pandora
  • Raspberry Pi
  • Renderer
  • Software Releases
  • Uncategorized

Recent Posts

  • Starduino for Uzebox
  • We built an EDM BBQ
  • Starduino Turbo For Arduboy – Faster 3D Gaming Inside 28KB
  • Starduino – 3D Gaming in 28KB – Behind the Pixels
  • Starduino For Arduboy – 3D Gaming Inside 28KB

Recent Comments

  1. Akratos on Bad Duino – Bad Apple!! on Arduino
  2. Clint Beacock on Starduino For Arduboy – 3D Gaming Inside 28KB
  3. Void on Starduino Turbo For Arduboy – Faster 3D Gaming Inside 28KB
  4. millim on Starduino Turbo For Arduboy – Faster 3D Gaming Inside 28KB
  5. Roman on Starduino For Arduboy – 3D Gaming Inside 28KB

Copyright © 2025 Stéphane Hockenhull's website.

Powered by PressBook Masonry Dark

Cleantalk Pixel