Add Code.Label
@@ -149,6 +149,22 @@ class StructuredModule(Module):
self.addCode(self.footer)
+"""
+Label that can be the target of a jump.
+"""
+class Label (Item):
+ def __init__(self, labelNum, comment):
+ self.labelNum = labelNum
+ self.comment = comment
+
+ def __str__(self):
+ t = "label_%04u:" % (self.labelNum)
+ if self.comment:
+ t += " /// %s" % self.comment
+ t += "\n"
+ return t
+
+
"""
An unstructured block of text that can contain comments and instructions
"""
@@ -160,6 +176,7 @@ class TextBlock(Item):
def __str__(self):
return self.text
+
"""
Inst is a single instruction and is base class for other instructions.
Currently just stores text+comment but over time may grow
@@ -190,7 +207,6 @@ class Inst(Item):
# If lgkmcnt=vmcnt= -1 then the waitcnt is a nop and
# an instruction with a comment is returned.
class WaitCnt (Inst):
-
def __init__(self,lgkmcnt=-1,vmcnt=-1,comment=""):
self.lgkmcnt = lgkmcnt
self.vmcnt = vmcnt
@@ -212,7 +228,6 @@ class WaitCnt (Inst):
return self.formatWithComment(waitStr, self.comment)
-
# uniq type that can be used in Module.countType
class GlobalReadInst (Inst):
def __init__(self,*args):
