PEP8 compliance
This commit is contained in:
parent
d340d9cb5f
commit
934bf1a495
|
@ -95,7 +95,7 @@ class Display:
|
|||
(0, 0, 255), # medium blue / blue
|
||||
(96, 160, 255), # light blue
|
||||
(128, 80, 0), # brown / dark orange
|
||||
(255, 128 ,0), # orange
|
||||
(255, 128, 0), # orange
|
||||
(192, 192, 192), # gray 2
|
||||
(255, 144, 128), # pink / light red
|
||||
(0, 255, 0), # light green / green
|
||||
|
|
|
@ -68,7 +68,7 @@ def run(win):
|
|||
"--rom", options.rom,
|
||||
]
|
||||
|
||||
p = subprocess.Popen(args)
|
||||
subprocess.Popen(args)
|
||||
cpu, _ = listener.accept()
|
||||
|
||||
win.clear()
|
||||
|
|
14
control.py
14
control.py
|
@ -1,16 +1,18 @@
|
|||
import json
|
||||
import readline
|
||||
import sys
|
||||
import urllib
|
||||
|
||||
URL_PREFIX = "http://localhost:6502"
|
||||
|
||||
|
||||
def get(url):
|
||||
return json.loads(urllib.urlopen(URL_PREFIX + url).read())
|
||||
|
||||
|
||||
def post(url, data=None):
|
||||
return urllib.urlopen(URL_PREFIX + url, json.dumps(data) if data is not None else "")
|
||||
|
||||
|
||||
def value(s):
|
||||
if s.startswith("$"):
|
||||
return int(s[1:], 16)
|
||||
|
@ -18,6 +20,7 @@ def value(s):
|
|||
return int(s[2:], 16)
|
||||
return int(s)
|
||||
|
||||
|
||||
def format_disassemble(dis):
|
||||
r = "%04X- " % dis["address"]
|
||||
for i in range(3):
|
||||
|
@ -32,6 +35,7 @@ def format_disassemble(dis):
|
|||
r += "[%04X] = %0*X" % tuple(dis["memory"])
|
||||
return r
|
||||
|
||||
|
||||
def cmd_disassemble(a):
|
||||
"""Disassemble"""
|
||||
if len(a) > 1:
|
||||
|
@ -43,6 +47,7 @@ def cmd_disassemble(a):
|
|||
for d in disasm:
|
||||
print format_disassemble(d)
|
||||
|
||||
|
||||
def cmd_dump(a):
|
||||
"""Dump memory"""
|
||||
start = value(a[1])
|
||||
|
@ -78,6 +83,7 @@ def cmd_dump(a):
|
|||
print s
|
||||
addr += 16
|
||||
|
||||
|
||||
def cmd_help(a):
|
||||
"""Help commands"""
|
||||
if len(a) > 1:
|
||||
|
@ -91,18 +97,21 @@ def cmd_help(a):
|
|||
for c in sorted(Commands):
|
||||
print " ", c
|
||||
|
||||
|
||||
def cmd_peek(a):
|
||||
"""Peek memory location"""
|
||||
addr = value(a[1])
|
||||
dump = get("/memory/%d" % addr)
|
||||
print "%04X: %02X" % (addr, dump[0])
|
||||
|
||||
|
||||
def cmd_poke(a):
|
||||
"""Poke memory location"""
|
||||
addr = value(a[1])
|
||||
val = value(a[2])
|
||||
post("/memory/%d" % addr, [val])
|
||||
|
||||
|
||||
def cmd_status(a):
|
||||
"""CPU status"""
|
||||
status = get("/status")
|
||||
|
@ -123,10 +132,12 @@ def cmd_status(a):
|
|||
disasm = get("/disassemble/%d" % status["program_counter"])
|
||||
print format_disassemble(disasm[0])
|
||||
|
||||
|
||||
def cmd_quit(a):
|
||||
"""Quit"""
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
def cmd_reset(a):
|
||||
"""Reset"""
|
||||
post("/reset")
|
||||
|
@ -142,6 +153,7 @@ Commands = {
|
|||
"reset": cmd_reset,
|
||||
}
|
||||
|
||||
|
||||
def main():
|
||||
print "ApplePy control console"
|
||||
while True:
|
||||
|
|
|
@ -1166,7 +1166,6 @@ class CPU:
|
|||
self.status_from_byte(self.pull_byte())
|
||||
self.program_counter = self.pull_word()
|
||||
|
||||
|
||||
# @@@ IRQ
|
||||
# @@@ NMI
|
||||
|
||||
|
|
Loading…
Reference in New Issue