-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmissingnes.py
More file actions
52 lines (47 loc) · 1.47 KB
/
missingnes.py
File metadata and controls
52 lines (47 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import cheats
import cpu
import instruction
import mem
import opc
import rom
import argparse
import time
def getargs():
parser = argparse.ArgumentParser()
parser.add_argument("rom", help="Path to the ROM to run")
parser.add_argument("--no-audio",
help="Disable audio output",
dest="audio",
action="store_false")
parser.add_argument("--ppu-debug",
help="Print PPU debug information",
dest="ppuDebug",
action="store_true")
# TODO: more general cheat interface
parser.add_argument("--smb-cheats",
help="Activate cheats for Super Mario Bros.",
dest="smbCheats",
action="store_true")
args = parser.parse_args()
return args
def makeCPU(romfilepath,
*cpuargs, **cpukwargs):
r = rom.readRom(romfilepath)
return cpu.CPU(rom=r,
*cpuargs, **cpukwargs)
def run(c):
while True:
c.tick()
if __name__ == "__main__":
args = getargs()
if args.smbCheats:
chts = cheats.CheatManager([cheats.smbInvincible,
cheats.smbInfiniteLives,
cheats.smbNoFall])
else:
chts = None
c = makeCPU(args.rom,
audioEnabled = args.audio,
ppuDebug = args.ppuDebug,
cheats = chts)
run(c)