Mercurial > lcfOS
diff python/outstream.py @ 250:f5fba5b554d7
Removal of obsolete editor
author | Windel Bouwman |
---|---|
date | Sun, 28 Jul 2013 19:07:51 +0200 |
parents | e41e4109addd |
children | 04c19282a5aa |
line wrap: on
line diff
--- a/python/outstream.py Fri Jul 26 20:26:05 2013 +0200 +++ b/python/outstream.py Sun Jul 28 19:07:51 2013 +0200 @@ -9,6 +9,7 @@ class Section: def __init__(self): + self.address = 0 self.instructions = [] def emit(self, item): @@ -35,11 +36,10 @@ def emit(self, item): assert self.currentSection - self.sections[self.currentSection].emit(item) + self.currentSection.emit(item) - def selectSection(self, s): - self.currentSection = s - self.getSection(s) + def selectSection(self, sname): + self.currentSection = self.getSection(sname) def getLabelAddress(self, lname): assert isinstance(lname, str) @@ -57,16 +57,9 @@ def backpatch(self): """ Fixup references to other parts in the assembler """ - for s in self.sections: - # TODO parameterize this: - if s == 'code': - address = 0x08000000 - elif s == 'data': - address = 0x02000000 - else: - address = 0x0 - - for i in self.sections[s].instructions: + for s in self.sections.values(): + address = s.address + for i in s.instructions: i.address = address i.resolve(self.getLabelAddress) bts = i.encode()