Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support NES emulator with IDF v5 and ESP-BSP #20

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
build/
managed_components/**
build/*
dependencies.lock
sdkconfig
sdkconfig.old
*.nes

.vscode/*
.devcontainer/*
games/*
temp/*
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# For more information about build system see
# https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/build-system.html
# The following five lines of boilerplate have to be in your project's
# CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
add_compile_options("-Wstringop-truncation")
project(nesemu)
9 changes: 0 additions & 9 deletions Makefile

This file was deleted.

68 changes: 68 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# ESP32-NESEMU, a Nintendo Entertainment System emulator for the ESP32 (IDF v5)
====================================================================

This is a quick and dirty port of Nofrendo, a Nintendo Entertainment System emulator. It lacks sound, but can emulate a NES at close to full speed, albeit with some framedrop due to the way the display is driven.

The portation of NES emulator is based on [ESP-BSP](https://github.com/espressif/esp-bsp) code and it allows to change the board quickly.

| Selection of the game | Super Mario | Donkey Kong | qBert |
| :----------: | :-----------: | :----------: | :----------: |
| <img src="doc/images/gameselection.jpg"> | <img src="doc/images/supermario.jpg"> | <img src="doc/images/donkeykong.jpg"> | <img src="doc/images/qbert.jpg"> |

## Warning
-------

This is a proof-of-concept (only for demo) and not an official application note. As such, this code is entirely unsupported by Espressif.

## USB HID Controller
---------

The games are controlled by USB HID SNES GamePad.

<img src="doc/images/controller.jpg">

## Build and flash
---------

```
idf.py -p COMx flash monitor
```

## Board selection
---------

For change the board, please edit the [`components/esp_nes/idf_component.yml`](components/esp_nes/idf_component.yml) file and change these lines to another BSP component:

```
ws_7inch:
version: "bsp/7inch_update"
path: "SquareLine/boards/custom_waveshare_7inch/components/ws_7inch/"
git: https://github.com/espressif/esp-bsp.git
```

For example, you can use this for ESP-BOX:

```
esp-box: "*"
```

## ROM
---
This NES emulator does not come with a ROM. This demo allows to select between three games, each game must be flashed to right flash region:

1. Game: `0x00100000`
2. Game: `0x00200000`
3. Game: `0x00300000`

You can use this command for flash the game into right flash region:

```
python esptool.py --chip esp32s3 --port "COM3" --baud $((230400*4)) write_flash -fs 4MB 0x100000 .\games\supermario.nes
```

## Copyright
---------

Code in this repository is Copyright (C) 2016 Espressif Systems, licensed under the Apache License 2.0 as described in the file LICENSE. Code in the
components/nofrendo is Copyright (c) 1998-2000 Matthew Conte ([email protected]) and licensed under the GPLv2.

68 changes: 0 additions & 68 deletions README.rst

This file was deleted.

8 changes: 8 additions & 0 deletions components/esp_nes/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
file(GLOB_RECURSE T_SOURCES *.c)
file(GLOB_RECURSE IMAGES images/*.c)

idf_component_register(
SRCS ${T_SOURCES} ${IMAGES}
INCLUDE_DIRS "."
PRIV_REQUIRES driver nofrendo hid nvs_flash
)
8 changes: 8 additions & 0 deletions components/esp_nes/idf_component.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: "1.0.0"
description: esp_nes
dependencies:
idf: ">=5.0"
ws_7inch:
version: "bsp/7inch_update"
path: "SquareLine/boards/custom_waveshare_7inch/components/ws_7inch/"
git: https://github.com/espressif/esp-bsp.git
Loading