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
PS2
joystick 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 aPS2
joystick withSPI
interface, enter thecs
pin numbermosi
: If using aPS2
joystick withSPI
interface, enter themosi
pin numbermiso
: If using aPS2
joystick withSPI
interface, enter themiso
pin numberclk
: If using aPS2
joystick withSPI
interface, enter theclk
pin 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.nes
for example
2. Shortcuts
2.1. Keyboard (serial port)
move
:W A S D
A
:J
B
:K
start
:M
orEnter
option
:N
or\
exit
:ESC
volume -
:-
volume +
:=
run speed -
:R
run speed +
:F
2.2. Joystick
move
:<-
^
V
->
A
:□
B
:×
start
:START
select
:SELECT
exit
: novolume -
:R2
volume +
:R1
run speed -
:L1
run 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")