diff python/outstream.py @ 235:ff40407c0240

Fix ALabel to Label
author Windel Bouwman
date Mon, 15 Jul 2013 17:20:37 +0200
parents 83781bd10fdb
children 8786811a5a59
line wrap: on
line diff
--- a/python/outstream.py	Sun Jul 14 19:29:21 2013 +0200
+++ b/python/outstream.py	Mon Jul 15 17:20:37 2013 +0200
@@ -16,20 +16,17 @@
         assert isinstance(item, Instruction)
         self.sections[self.currentSection].append(item)
 
-    def align(self, alignment):
-        self.emit(Alignment(alignment))
-
     def selectSection(self, s):
         self.currentSection = s
         if not s in self.sections:
             self.sections[s] = []
 
-    def getLabelAddress(self, l):
-        assert isinstance(l, Label)
+    def getLabelAddress(self, lname):
+        assert isinstance(lname, str)
         for s in self.sections.values():
             for i in s:
                 if type(i) is Label:
-                    if i.name == l.name:
+                    if i.name == lname:
                         return i.address
         return 0
 
@@ -62,7 +59,10 @@
             assert type(insword) is bytes
             insword = binascii.hexlify(bytes(reversed(insword))).decode('ascii')
             asm = str(i)
-            print('    0x{0:08x} 0x{1} {2}'.format(addr, insword, asm))
+            if len(insword) == 0:
+                print('    {}'.format(asm))
+            else:
+                print('    0x{0:08x} 0x{1} {2}'.format(addr, insword, asm))
 
 class TextOutputStream(OutputStream):
     pass