Arduboy C++ Emulator

I’ve been thinking to make a game to Arduboy, but realized that complie&upload isn’t a very efficient a way of debugging. So I spent a weekends and made a proof-of-concept of an Arduboy emulator:

I just, basically, combined simavr with SFML. What it does, it literally runs machine code for atmega32u, and emulates SSD1306 for display with SPI. Buttons just toggle ports, and sound output goes to the SFML’s audio stream.

So I am wondering whether the community actually needs this. The forum says there’s a JS emulator already, and the one that just implements Arduino library so you actually compile the code for PC.

Actually, before making the post I didn’t even know the JS emulator existed. Yet, it took me two days to make a simple concept with simavr, yet simavr is in development for 7 years already, so I wonder if doing actual proper avr simulation (like in the JS emulator) yourself might be a tough pill to swallow.

So my question is, is there a place for alternative emulator here?

Possible features that this emulator might have:

  • GDB debugging, as simavr supports this (literally, having breakpoints and evaluating variables, according to the arduboy memory map)
  • Have some decent IDE instead of Arduino IDE (printf kind of debugging is just frustrating) configured, so when you hit play, you see emulator immediately and can have breakpoints hit.
  • Save and load state
  • Debug EEPROM
  • Edit flash memory on the fly (like update sprites to see how they fit the game, while you’re in it)
  • Save emulation to a video file

Probable issue here, that emulator will never cover the actual device. Timings might be different, and currently the bootloader is not used. Yet, I’ve run several games here, and they seem to work just fine.

1 Like

Yes, I’m interested. I’ve been trying to write a game using the Arduino IDE.

Tinkercad.com has an Arduino emulator. For example, https://www.tinkercad.com/things/gRBFDuQ7gqr

It would be nice to have something like that for Arduboy.

complie&upload isn’t a very efficient a way of debugging.

You are so right :smiley:

So my question is, is there a place for alternative emulator here?

Of course!

I just, basically, combined simavr1 with SFML. What it does, it literally runs machine code for atmega32u, and emulates SSD1306 for display with SPI. Buttons just toggle ports, and sound output goes to the SFML’s audio stream.

Somebody here on the forums has already made this