open BitVectors;; open Util;; open Pretty;; let hex = IntelHex.intel_hex_of_file "Test.hex" in let mem = IntelHex.process_intel_hex hex in let status = ASMInterpret.load_mem mem ASMInterpret.initialize in let observe status = let pc = status.ASMInterpret.pc in let instr,_,_ = ASMInterpret.fetch status.ASMInterpret.code_memory pc in prerr_string (BitVectors.hex_string_of_vect pc) ; prerr_endline (": " ^ pp_instruction instr) in (* DPM: for debugging! *) let mem_pretty_print status = let rec aux status pc = let instr, pc', cost = ASMInterpret.fetch status.ASMInterpret.code_memory pc in prerr_string $ ((hex_string_of_vect pc) ^ ": "); prerr_string $ (pp_instruction instr) ^ " "; prerr_endline $ string_of_int cost; if int_of_vect pc' > 200 then (* DPM: hardcoded on a case-by-case basis *) () else aux status pc' in aux status status.ASMInterpret.pc; prerr_endline "-------------------------------------" in mem_pretty_print status; ASMInterpret.execute observe status ;;