Last change
on this file since 183 was
150,
checked in by mulligan, 10 years ago
|
Manages to load and emulate a simple array program. A few obscure bugs.
|
File size:
1.0 KB
|
Line | |
---|
1 | open BitVectors;; |
---|
2 | open Util;; |
---|
3 | open Pretty;; |
---|
4 | |
---|
5 | let hex = IntelHex.intel_hex_of_file "Test.hex" in |
---|
6 | let mem = IntelHex.process_intel_hex hex in |
---|
7 | let status = ASMInterpret.load_mem mem ASMInterpret.initialize in |
---|
8 | let observe status = |
---|
9 | let pc = status.ASMInterpret.pc in |
---|
10 | let instr,_,_ = ASMInterpret.fetch status.ASMInterpret.code_memory pc in |
---|
11 | prerr_string (BitVectors.hex_string_of_vect pc) ; |
---|
12 | prerr_endline (": " ^ pp_instruction instr) |
---|
13 | in |
---|
14 | (* DPM: for debugging! *) |
---|
15 | let mem_pretty_print status = |
---|
16 | let rec aux status pc = |
---|
17 | let instr, pc', cost = ASMInterpret.fetch status.ASMInterpret.code_memory pc in |
---|
18 | prerr_string $ ((hex_string_of_vect pc) ^ ": "); |
---|
19 | prerr_string $ (pp_instruction instr) ^ " "; |
---|
20 | prerr_endline $ string_of_int cost; |
---|
21 | if int_of_vect pc' > 200 then (* DPM: hardcoded on a case-by-case basis *) |
---|
22 | () |
---|
23 | else |
---|
24 | aux status pc' |
---|
25 | in |
---|
26 | aux status status.ASMInterpret.pc; |
---|
27 | prerr_endline "-------------------------------------" |
---|
28 | in |
---|
29 | mem_pretty_print status; |
---|
30 | ASMInterpret.execute observe status |
---|
31 | ;; |
---|
Note: See
TracBrowser
for help on using the repository browser.