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.
- 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.
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.
Connecting a PS2 Controller over SPI
It’s also possible to wire up a PS2 Controller using the SPI interface. To quickly test this I’ve used Dupont connectors, removing the plastic part and enlarging the gap a little so I could push them onto the plugs inside the connector. You could cut the cables and solder them or for a more long term solution buy a USB adaptor, open it and solder connections to this.
You don’t need to open the controller connector. I just want to use the same colours for the Dupont connectors
Paste the following code at the >>>> prompt if you are using a 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")
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
If I've saved you some time and you want to say 'Thanks!' you can buy me a coffee here...