mirror of
https://github.com/jtauber/applepy.git
synced 2024-06-09 05:29:31 +00:00
from __future__ import print_function
This commit is contained in:
parent
934bf1a495
commit
878700d78d
23
control.py
23
control.py
|
@ -1,3 +1,4 @@
|
||||||
|
from __future__ import print_function
|
||||||
import json
|
import json
|
||||||
import sys
|
import sys
|
||||||
import urllib
|
import urllib
|
||||||
|
@ -45,7 +46,7 @@ def cmd_disassemble(a):
|
||||||
addr = status["program_counter"]
|
addr = status["program_counter"]
|
||||||
disasm = get("/disassemble/%d" % addr)
|
disasm = get("/disassemble/%d" % addr)
|
||||||
for d in disasm:
|
for d in disasm:
|
||||||
print format_disassemble(d)
|
print(format_disassemble(d))
|
||||||
|
|
||||||
|
|
||||||
def cmd_dump(a):
|
def cmd_dump(a):
|
||||||
|
@ -80,7 +81,7 @@ def cmd_dump(a):
|
||||||
s += "."
|
s += "."
|
||||||
else:
|
else:
|
||||||
s += " "
|
s += " "
|
||||||
print s
|
print(s)
|
||||||
addr += 16
|
addr += 16
|
||||||
|
|
||||||
|
|
||||||
|
@ -89,20 +90,20 @@ def cmd_help(a):
|
||||||
if len(a) > 1:
|
if len(a) > 1:
|
||||||
f = Commands.get(a[1])
|
f = Commands.get(a[1])
|
||||||
if f is not None:
|
if f is not None:
|
||||||
print f.__doc__
|
print(f.__doc__)
|
||||||
else:
|
else:
|
||||||
print "Unknown command:", a[1]
|
print("Unknown command:", a[1])
|
||||||
else:
|
else:
|
||||||
print "Commands:"
|
print "Commands:"
|
||||||
for c in sorted(Commands):
|
for c in sorted(Commands):
|
||||||
print " ", c
|
print(" ", c)
|
||||||
|
|
||||||
|
|
||||||
def cmd_peek(a):
|
def cmd_peek(a):
|
||||||
"""Peek memory location"""
|
"""Peek memory location"""
|
||||||
addr = value(a[1])
|
addr = value(a[1])
|
||||||
dump = get("/memory/%d" % addr)
|
dump = get("/memory/%d" % addr)
|
||||||
print "%04X: %02X" % (addr, dump[0])
|
print("%04X: %02X" % (addr, dump[0]))
|
||||||
|
|
||||||
|
|
||||||
def cmd_poke(a):
|
def cmd_poke(a):
|
||||||
|
@ -115,7 +116,7 @@ def cmd_poke(a):
|
||||||
def cmd_status(a):
|
def cmd_status(a):
|
||||||
"""CPU status"""
|
"""CPU status"""
|
||||||
status = get("/status")
|
status = get("/status")
|
||||||
print "A=%02X X=%02X Y=%02X S=%02X PC=%04X F=%c%c0%c%c%c%c%c" % (
|
print("A=%02X X=%02X Y=%02X S=%02X PC=%04X F=%c%c0%c%c%c%c%c" % (
|
||||||
status["accumulator"],
|
status["accumulator"],
|
||||||
status["x_index"],
|
status["x_index"],
|
||||||
status["y_index"],
|
status["y_index"],
|
||||||
|
@ -128,9 +129,9 @@ def cmd_status(a):
|
||||||
"I" if status["interrupt_disable_flag"] else "i",
|
"I" if status["interrupt_disable_flag"] else "i",
|
||||||
"Z" if status["zero_flag"] else "z",
|
"Z" if status["zero_flag"] else "z",
|
||||||
"C" if status["carry_flag"] else "c",
|
"C" if status["carry_flag"] else "c",
|
||||||
)
|
))
|
||||||
disasm = get("/disassemble/%d" % status["program_counter"])
|
disasm = get("/disassemble/%d" % status["program_counter"])
|
||||||
print format_disassemble(disasm[0])
|
print(format_disassemble(disasm[0]))
|
||||||
|
|
||||||
|
|
||||||
def cmd_quit(a):
|
def cmd_quit(a):
|
||||||
|
@ -155,7 +156,7 @@ Commands = {
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
print "ApplePy control console"
|
print("ApplePy control console")
|
||||||
while True:
|
while True:
|
||||||
s = raw_input("6502> ")
|
s = raw_input("6502> ")
|
||||||
a = s.strip().split()
|
a = s.strip().split()
|
||||||
|
@ -163,7 +164,7 @@ def main():
|
||||||
if f is not None:
|
if f is not None:
|
||||||
f(a)
|
f(a)
|
||||||
else:
|
else:
|
||||||
print "Unknown command:", s
|
print("Unknown command:", s)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user