@@ -151,17 +151,12 @@ def read(self):
addr &= ~(self.TARGET_PAGE_SIZE - 1)
if flags & self.RAM_SAVE_FLAG_MEM_SIZE:
- while True:
+ total_length = addr
+ while total_length > 0:
namelen = self.file.read8()
- # We assume that no RAM chunk is big enough to ever
- # hit the first byte of the address, so when we see
- # a zero here we know it has to be an address, not the
- # length of the next block.
- if namelen == 0:
- self.file.file.seek(-1, 1)
- break
self.name = self.file.readstr(len = namelen)
len = self.file.read64()
+ total_length -= len
self.sizeinfo[self.name] = '0x%016x' % len
if self.write_memory:
print(self.name)