def run(self): self.program_end = False self.ic = self.object_code[1][0][1] + self.object_code[1][1] while True: run_auto_input = input("execute program automatically? (y/n): ") if run_auto_input == "y": run_auto = True break elif run_auto_input == "n": run_auto = False break else: continue print("running the program ... ") while True: if self.program_end: print_green("program was executed successfully") break opcode = self.mem[self.ic][0] if not run_auto: input("press any key to execute instruction: ") self.process_instruction(opcode) print_div() else: self.process_instruction(opcode)
def simulator_is_on(self): print_green("Simulador MVN on") print(f"to print internal status: {self.STATUS}") print(f"to print table of mnemonics: {self.MNE_TABLE}") print(f"to print assembler status: {self.ASSEMBLER_STATUS}") print(f"to print loader status: {self.LOADER_STATUS}") print(f"to load a program: {self.BOOT}") print(f"to run the program in memory: {self.RUN}") print(f"to clear: {self.CLEAR}") print(f"to help: {self.HELP}") print(f"to turn off: {self.OFF}") print_div()
def cmd_status(self): print_green("Simulator status") print_yellow(f"state: {self.state}") print_yellow(f"program name: {self.program_name}") print_yellow(f"program:") if self.program_name == "": pass else: self.print_program() print_yellow("memory:") pprint(self.mem) print_div()
def print_status(self): print_green("Assembler status") # print_yellow("table of mnemonics") # pprint(self.mnemonics_table) # print_yellow("program lines detailed:") # pprint(self.program_lines_detailed) print_yellow("table of symbols:") pprint(self.symbols_table) # print_yellow("table of constants:") # pprint(self.constants_table) # print_yellow("table of cross references:") # pprint(self.crossref_table) print_yellow("memory:") pprint(self.mem) print_yellow("object code:") pprint(self.object_code)
def scan(self): """ Scans to for files. Prints output for operation: # PATH: /home/magnus/Dropbox # creating DB ... /home/magnus/Dropbox/workspace/mmfinder/db/dropbox.db updatedb -l 0 -U '/home/magnus/Dropbox' -n 'Dropbox Trash english-lingXwavsOnline backups-snapshots .libreoffice .dropbox.cache pubmex-all-pdfs-shit-test' -o '/home/magnus/Dropbox/workspace/mmfinder/db/dropbox.db' # done """ if os.path.exists(self.path_to_scan): dont_db = ' '.join(config.DONT_DB) cmd = "updatedb -l 0 -U '" + self.path_to_scan + "' -n '" + dont_db + "' -o '" + self.filename_db + "'" print cmd if config.RUN_UPDATE: os.system(cmd) print_green('# done') return True else: print_red('# ERROR: No such file or directory') return False
def cmd_mne_table(self): print_green("Table of mnemonics") pprint(self.mnemonicos_table) print_div()
def print_status(self): print_green("Loader status") print_yellow("memory:") pprint(self.mem) print_yellow("object_code:") pprint(self.object_code)
def process_PD(self): """ print acumulator """ print_green(f"{self.ac}") self.ic = add_hex_address(self.ic, self.mnemonicos_table["PD"]["size"])