mirror of
https://github.com/jtauber/applepy.git
synced 2024-11-26 16:49:32 +00:00
added load_file to RAM
This commit is contained in:
parent
bc0406f211
commit
4c333ec125
@ -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]
|
||||
|
Loading…
Reference in New Issue
Block a user