GameBoy emulator

Hi :waving_hand:,

I’ve ported my first Game Boy emulator to the PicoCalc, currently running on a Raspberry Pi Pico W. The emulator is based on a fork of the PocketPico project. It’s functional, but not yet optimized.

Here’s what currently works:

  • Audio
  • Screen
  • Keyboard

What still needs to be optimized:

  • Display

I suspect there’s an issue with either the display refresh rate, as the performance isn’t very smooth. So I’m reaching out to fellow developers for help with this.

There’s a function called lcd_draw_line_bis that allows scaling the display, but it slows things down even more. There’s still a lot of work to do to optimize and clean up the code…

The project is available here: GitHub - TheKiwil/PocketPico: Game Boy emulation on the Raspberry Pi RP2350 for PicoCalc

Scale version:

Will

13 Likes

Update : Now it’s works well on “full” screen

22 Likes

This looks great! Excited to try it whenever mine arrives. there are lots of fun homebrew gameboy games / apps.

I can’t wait to try this!

This is nice. Did you observe improvements in using DMA/PIO for talking to the LCD?

The implementation of PicoCalc is largely inspired by the one proposed by ClockworkPi for the NES emulator (PicoCalc/Code/NES at master · clockworkpi/PicoCalc · GitHub). So I can’t really say whether it adds any real value.

Thank you for amazing project. Are you going to make compability with Pico 1 H?

I’m immediately interested, though I feel like that will be a better project for the lyra.

It works @TheKiwil I see what you mean with the display

I think you just need to switch to BGR

I also notice progress doesn’t save :sweat_smile:

Hi,

Thanks. To save, press select and start.

Will

1 Like

Hello @TheKiwil and thank you for the PocketPico (and also the ftp server). Do you think it’s possible to make M.C.U.M.E. work on the PicoCalc (and a uf2 of the ftp)?
I would love to have a C64 emulated on my precious with the Pico2W :star_struck:
It also emulate many old consoles as master system and pc engine… I wish I had the knowledge to make those work too.

Cheers and keep up the great work :raising_hands:

1 Like

Also maybe you have to trigger inverse Color:

0x1000021

1 Like

Great catch

If I can get this thing to build correctly I’ll add those in.

I tried on a Mac but these are the build steps (according to the documentation)

git clone https://github.com/slintak/PocketPico.git
cd PocketPico
git submodule update --init --recursive
make configure
make build

I switched to using cmake and the Raspberry Pi Pico Visual Studio Code extension

Actually, I just got it to work lol I’m not sure what I messed up last night.

I did

git clone https://github.com/TheKiwil/PocketPico.git
cd PocketPico
git submodule update --init --recursive

Then opened it in Visual Studio Code and imported as a Raspberry Pi Pico project using Pico SDK 2.1.1

Actually nvm that didn’t work.

[build] /Users/user/pico/PocketPico/ext/ili9488_p/picocalc.c:497:13: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
[build]   497 |             printf("try to reset i2c\n");
[build]       |             ^~~~~~
[build] /Users/user/pico/PocketPico/ext/ili9488_p/picocalc.c:7:1: note: include '<stdio.h>' or provide a declaration of 'printf'
[build]     6 | #include "i2ckbd.h"
[build]   +++ |+#include <stdio.h>
[build]     7 | 
[build] /Users/user/pico/PocketPico/ext/ili9488_p/picocalc.c:497:13: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
[build]   497 |             printf("try to reset i2c\n");
[build]       |             ^~~~~~
[build] /Users/user/pico/PocketPico/ext/ili9488_p/picocalc.c:497:13: note: include '<stdio.h>' or provide a declaration of 'printf'
[build] /Users/user/pico/PocketPico/ext/ili9488_p/picocalc.c: In function 'wait_key':
[build] /Users/user/pico/PocketPico/ext/ili9488_p/picocalc.c:598:17: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
[build]   598 |                 printf("key %d pressed\n", i);
[build]       |                 ^~~~~~
[build] /Users/user/pico/PocketPico/ext/ili9488_p/picocalc.c:598:17: note: include '<stdio.h>' or provide a declaration of 'printf'

I’ll fork it and give it an update

I got it to build now


I think I got the color working now too (well according to reddit, these are the correct colors since Pokemon Red was only black/white and it matches the Super Game Boy colors)

Here’s my fork of it with all of the changes

I also submitted a pull request @TheKiwil

3 Likes

Hi,

hanks for the progress. However, I put a Pico2W back into the Picocalc, and I can’t run your UF2. I compiled a UF2 on my side, and the firmware starts, but it’s impossible to launch a game.

I think is link to the Pico SDK 2.2.0.

Interesting, it works for me (I just nuked my 2W and reflashed it again)

It was built using the Pico SDK v2.1.1 since v2.2.0 wasn’t released at the time of your last edits

Great idea. I’ll take a look when time permits.

Hi,

Given the interest in my port, I decided to dive back into it — both to integrate @jblanked changes and to make it compatible with the new SDK 2.2.0, and consequently with @pelrun bootloader.

This required a fair amount of work, especially around flash write handling and core1 synchronization (using now the system queue).

I’ve created a dedicated branch while waiting for a finalized version: https://github.com/TheKiwil/PocketPico/tree/bootloader

So far, I’ve confirmed that this version works with both Pico2 and Pico2 W boards.

What’s next:

  • Ensure compatibility with the original Pico1 (particularly flash management)

  • Clean up and optimize the code

@Guidouil, I’ll take a look too :wink: when I have some time.

4 Likes

Awesome best of luck!!

This may be a bit out of your control, but could you take a look at saving progress too? For example, I can save in Pokemon but my progress is lost when I cut the PicoCalc off (I can only start a New Game)