NES game emulator
Classic NES game emulator, take us back to childhood!
Or... Let us find a way to let it play itself!
1. Function
1.1. init(rc_type=nes.KEYBOARD, cs, mosi, miso, clk, repeat=16, vol=5)
Initializes the NES emulator
Parameters
tc_type: Remote control type, keyboard(nes.KEYBOARD) (The serial port communicates with the computer's keyboard, it's not directly connected to the board's USB port...) or PS2 joystick(nes.JOYSTICK)。A
PS2joystick is recommended for a better experience. Serial communication can't send more than one key at a time. If you want, you can try to write your own scripts herecs: If using aPS2joystick withSPIinterface, enter thecspin numbermosi: If using aPS2joystick withSPIinterface, enter themosipin numbermiso: If using aPS2joystick withSPIinterface, enter themisopin numberclk: If using aPS2joystick withSPIinterface, enter theclkpin numberrepeat: (Only for keyboard mode!) key repetition ratevol: Initial volume, can be adjusted later
1.2. run(nes)
Run a NES game (ROM)
Parameters
nes: File path of the game'sROM,/sd/mario.nesfor example
2. Shortcuts
2.1. Keyboard (serial port)
move:W A S DA:JB:Kstart:MorEnteroption:Nor\exit:ESCvolume -:-volume +:=run speed -:Rrun speed +:F
2.2. Joystick
move:<-^V->A:□B:×start:STARTselect:SELECTexit: novolume -:R2volume +:R1run speed -:L1run speed +:L2
3. Examples
4. Demo 1: Keyboard (Serial port)
import nes, lcd
lcd.init(freq=15000000)
nes.init(nes.KEYBOARD)
nes.run("/sd/mario.nes")
5. Demo 2: PS2 joystick
import nes, lcd
lcd.init(freq=15000000)
nes.init(nes.JOYSTICK, cs=19, clk=18, mosi=23, miso=21)
nes.run("/sd/mario.nes")