MicroPython NES Emulator on a RISC-V 64 Processor

micropython-nes-emulator-maixpy.jpg

The guys at Sipeed have released a new beta of their MicroPython port for their range of boards based on the Kendryte K210 processor and this one features an emulator for the NES.

You need a NES rom (you can test with this open-source game binary – Nova The Squirrel) and at least version beta_0.2.1 of MaixPy.

The following is working for me on the Maix M1w Dock that I bought from an Indiegogo campaign. They are now available on Seeed and Banggood.

  • Insert a MicroSD card with your NES ROMs (you could upload to Flash as well)
  • Connect your device to USB
  • In Windows, download K-Flash from https://kendryte.com/downloads/ , unzip and run K-Flash.exe
  • In K-Flash select the device’s port
  • Navigate to the MaixPy binary ( beta_0.2.1 available here or Github releases here)
  • Click Flash to upload

I use Putty for the serial monitor. Connect using the settings below (change the port number if needed). If the connection fails, try pressing reset on the board.

Putty

Copy and then paste all the code below into Putty at the >>> prompt and press enter twice and the emulator will start up.

import nes
nes.init(0)
nes.run("/sd/name-of-your-game.nes")

When Putty is the active window (ie you’ve not clicked outside the window) you can control the game using your keyboard. Keys W, A, S and D are the D-pad direction keys. N is select, M start with J and K being the action buttons. This works to a point but there are problems when pressing more than one key.

MicroPython NES Emulator Nova Squirrel

It’s also possible to wire up a PS2 Controller but I don’t have one to test this. The following code is for use with the PS2 controller

import nes
from Maix import GPIO
fm.register(8, fm.fpioa.GPIO0)
wifi_en=GPIO(GPIO.GPIO0,GPIO.OUT)
wifi_en.value(0)
nes.init(1)
nes.run("/sd/name-of-your-game.nes")

References

Installing MaixPy from source in Windows 10: https://robotzero.one/sipeed-maix-micropython/
MaixPy on Github: https://github.com/sipeed/MaixPy
Sipeed homepage: https://sipeed.com/#/
Releases including binary: https://github.com/sipeed/MaixPy/releases
Nova The Squirrel NES game: https://github.com/NovaSquirrel/NovaTheSquirrel

One Reply to “MicroPython NES Emulator on a RISC-V 64 Processor”

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

scroll to top