mirror of
https://github.com/jtauber/applepy.git
synced 2025-01-15 22:30:01 +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):
|
for offset, datum in enumerate(data):
|
||||||
self.__mem[address - self.start + offset] = datum
|
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):
|
def read_byte(self, address):
|
||||||
assert self.start <= address <= self.end
|
assert self.start <= address <= self.end
|
||||||
return self.__mem[address - self.start]
|
return self.__mem[address - self.start]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user