Ignore:
Timestamp:
Mar 7, 2011, 11:10:57 AM (9 years ago)
Author:
ayache
Message:

Hex output not too long for mcu anymore. Readable output added.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Deliverables/D2.2/8051/src/ASM/Pretty.ml

    r627 r640  
    4444    `Label l -> l ^ ":"
    4545  | `Cost l -> l ^ ":"
    46   | `Jmp j -> "Jmp " ^ j
    47   | `Call j -> "Call " ^ j
     46  | `Jmp j -> "ljmp " ^ j
     47  | `Call j -> "lcall " ^ j
    4848  | `WithLabel i -> pp_jump i
    4949  | `Begin_fun -> "\n; Begin function"
     
    9999
    100100let print_program p =
    101   let f s i = Printf.sprintf "%s%s\n" s (pp_instruction i) in
    102   "Org 0\n\n" ^ (List.fold_left f "" p.ASM.pcode) ^ "\nEND\n"
     101  let mem = ASMInterpret.load_code_memory p.ASM.code in
     102  let f (s, pc) _ =
     103    let (inst, new_pc, _) = ASMInterpret.fetch mem pc in
     104    (Printf.sprintf "%s%s: %s%s\n"
     105       s
     106       (string_of_int (BitVectors.int_of_vect pc))
     107       (pp_instruction inst)
     108       (if BitVectors.WordMap.mem pc p.ASM.cost_labels then
     109           " ;; (" ^ (BitVectors.WordMap.find pc p.ASM.cost_labels) ^ ")"
     110        else ""),
     111     new_pc) in
     112  fst (List.fold_left f ("", BitVectors.zero `Sixteen) p.ASM.code)
Note: See TracChangeset for help on using the changeset viewer.