renamed SoftSwitches to IO as it's about to do more

This commit is contained in:
James Tauber 2011-08-16 20:03:06 -04:00
parent 6f1005693c
commit a0ef706a55

View File

@ -309,7 +309,7 @@ class Cassette:
return ord(self.raw[offset]) if offset < len(self.raw) else 0x80 return ord(self.raw[offset]) if offset < len(self.raw) else 0x80
class SoftSwitches: class IO:
def __init__(self, display, speaker, cassette): def __init__(self, display, speaker, cassette):
self.kbd = 0x00 self.kbd = 0x00
@ -346,7 +346,7 @@ class SoftSwitches:
if self.cassette: if self.cassette:
return self.cassette.read_byte(cycle) return self.cassette.read_byte(cycle)
else: else:
pass # print "%04X" % address print "%04X" % address
return 0x00 return 0x00
@ -355,7 +355,7 @@ class Apple2:
def __init__(self, options, display, speaker, cassette): def __init__(self, options, display, speaker, cassette):
self.display = display self.display = display
self.speaker = speaker self.speaker = speaker
self.softswitches = SoftSwitches(display, speaker, cassette) self.io = IO(display, speaker, cassette)
args = [ args = [
sys.executable, sys.executable,
@ -379,7 +379,7 @@ class Apple2:
op = self.core.stdout.read(8) op = self.core.stdout.read(8)
cycle, rw, addr, val = struct.unpack("<IBHB", op) cycle, rw, addr, val = struct.unpack("<IBHB", op)
if rw == 0: if rw == 0:
self.core.stdin.write(chr(self.softswitches.read_byte(cycle, addr))) self.core.stdin.write(chr(self.io.read_byte(cycle, addr)))
self.core.stdin.flush() self.core.stdin.flush()
elif rw == 1: elif rw == 1:
self.display.update(addr, val) self.display.update(addr, val)
@ -399,7 +399,7 @@ class Apple2:
if key: if key:
if key == 0x7F: if key == 0x7F:
key = 0x08 key = 0x08
self.softswitches.kbd = 0x80 + key self.io.kbd = 0x80 + key
update_cycle += 1 update_cycle += 1
if update_cycle >= 1024: if update_cycle >= 1024: