def run_assembly(src, inp=None): prg = translator.translate(src.splitlines()) cpu = Executor() if inp: cpu.regs = [int(x, 16) for x in inp.split()] cpu.run(prg) return ' '.join('{:x}'.format(x) for x in cpu.regs)
def main(): try: src = loadSource() prg = translator.translate(src) cpu = EnhancedExecutor() fetchState(cpu) cpu.run(prg) except Exception as e: sys.stderr.write("Error: %s\n" % e)
def main(): print "Content-Type: text/plain" print '' try: src, inputData = loadSource() prg = translator.translate(src) cpu = EnhancedExecutor() if len(inputData) == 1: if cpu.fetchState(inputData[0]): inputData = [] cpu.inputData = '\n'.join(inputData) cpu.run(prg) if len(inputData) == 0: cpu.printRegs() except Exception as e: print "Error: %s\n" % e
def load_assembly(self, src): self.prg = translator.translate(src.splitlines())