From 4c333ec1257e3056c41fcbe3e79dab0423f146c2 Mon Sep 17 00:00:00 2001 From: James Tauber Date: Sat, 13 Aug 2011 09:41:45 -0400 Subject: [PATCH] added load_file to RAM --- applepy.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/applepy.py b/applepy.py index 7b1d211..658ac39 100644 --- a/applepy.py +++ b/applepy.py @@ -249,6 +249,11 @@ class RAM: for offset, datum in enumerate(data): self.__mem[address - self.start + offset] = datum + def load_file(self, address, filename): + with open(filename) as f: + for offset, datum in enumerate(f.read()): + self.__mem[address - self.start + offset] = ord(datum) + def read_byte(self, address): assert self.start <= address <= self.end return self.__mem[address - self.start]