def __init__(self, value, lineNum, parent): self.lineNum = lineNum self.parent = parent self.size = 0 self.lastLabels = [] self.isInt = False self.error = None try: self.extra = eval_0xSCAmodified(value, {}, preEval=True) self.labels = extractVaribles(self.extra, "") except Exception as err: self.printError(repr(err)) self.labels = [] self.extra = None return labels = {"$$globalLabel":""} for x in self.labels: labels[x] = address(address(1)) try: self.size = len(self._extraWords(labels)) except NameError as err: self.printError("We encountered an error that shouldn't happen, this probably represents a bug in the assembler.") self.printError(repr(err)) return
def __init__(self, value, lineNum, parent): self.lineNum = lineNum self.parent = parent try: self.extra = eval_0xSCAmodified(value, {}, preEval=True) self.labels = extractVaribles(self.extra, "") except Exception as err: self.printError(repr(err))
def __init__(self, part, lineNum, parent, allowShortLiteral): self.lineNum = lineNum self.parent = parent registers = value.registers cpu = value.cpu self.value = None self.extra = None self.shortLiteral = False self.allowShortLiteral = allowShortLiteral if type(part) == type(0x42): self.value = part & 0x3F elif type(part) == type(""): if part.startswith("[") and part.endswith("]"): part = part[1:-1] if part.lower() in registers: self.value = 0x08 | registers[part.lower()] elif part.upper() == "SP++": self.value = cpu["POP"] elif part.upper() == "--SP": self.value = cpu["PUSH"] elif part.upper() == "SP+[PC++]": self.value = cpu["PICK"] elif part.upper() == "SP": self.value = cpu["PEEK"] elif part.upper() == "[PC++]": self.value = 0x1E elif part.upper() == "PC++": self.value = 0x1F else: self.value = -1 self.extra = part elif part.lower() in registers: self.value = registers[part.lower()] elif part.upper() in cpu: self.value = cpu[part.upper()] else: self.value = 0x1F self.extra = part else: self.value = 0x1F self.extra = part labels = {} self.lastLabels = [] self.labels = () if self.extra != None: try: self.extra = eval_0xSCAmodified(self.extra, {}, preEval=True) self.labels = extractVaribles(self.extra, "") except Exception as err: self.printError(repr(err)) return if len(self.labels) == 0: #We need to force an optimize for those short literals self.labels = ["NotReally"] self.optimize({"NotReally":address(address(0)), "$$globalLabel":""}) self.labels = [] self.lastLabels = []