def make_top(self, args): if args.E: return None from asm import Assembler assembler = Assembler() assembler.parse(self.text_file().read(), self.infile.name) assembler.finish() return assembler.top
def showOpCodes(): print('{:<10}\t{:>10}\t{:>20}'.format('OpCode', 'Hex', 'Bin')) for name, member in OpCode.__members__.items(): print('{:<10}\t{:>10}\t{:>20}'.format(name, hex(member.value), bin(member.value))) if __name__ == '__main__': #showOpCodes() #showExampleEncodings() #print() #asm = Assembler('examples/factorial.asm') #asm = Assembler('examples/misc.asm') #asm = Assembler('examples/mul.asm') #asm = Assembler('examples/int.asm') asm = Assembler('examples/mov.asm') #asm = Assembler('examples/br.asm') #print('generated code:') program_memory = asm.parse() #for i in program_memory: # print('0x{0:04X}\t0b{0:016b}'.format(i)) cpu = Cpu(program_memory) seq = Seq(MPM, cpu) #TODO: intreruperi dbg = Debugger(seq) dbg.attach() # print(cpu.__dict__) # print(seq.__dict__)