source: Deliverables/D4.1/ASMInterpret.mli @ 138

Last change on this file since 138 was 138, checked in by sacerdot, 9 years ago

Several bug fixes and code clean-up.
New main file: test.ml to parse and execute an HEX file.
Usage: ./test.native foo.hex

File size: 1.5 KB
Line 
1open BitVectors;;
2open Physical;;
3
4exception CodeTooLarge
5
6type time = int;;
7type line = [`P0 | `P1 ];; (* ??? *)
8type continuation =
9unit (*
10 [`In of time * line * byte * continuation] option *
11 [`Out of (time -> line -> byte -> continuation) ]
12*)
13
14type status = private
15 { code_memory: WordMap.map;        (* can be reduced *)
16   low_internal_ram: Byte7Map.map;
17   high_internal_ram: Byte7Map.map;
18   external_ram: WordMap.map;
19
20   pc: word;
21
22   (* sfr *)
23   p0: byte;
24   sp: byte;
25   dpl: byte;
26   dph: byte;
27   pcon: byte;
28   tcon: byte;
29   tmod: byte;
30   tl0: byte;
31   tl1: byte;
32   th0: byte;
33   th1: byte;
34   p1: byte;
35   scon: byte;
36   sbuf: byte;
37   p2: byte;
38   ie: byte;
39   p3: byte;
40   ip: byte;
41   psw: byte;
42   acc: byte;
43   b: byte;
44
45   clock: time;
46   timer0: word;
47   timer1: word;
48   timer2: word;  (* can be missing *)
49   io: continuation
50 }
51
52module IntMap: Map.S with type key = int
53
54val assembly:
55 ASM.labelled_instruction list -> BitVectors.byte list (*ASM.instruction list * symbol_table *) * string IntMap.t
56
57(*
58val link:
59 (ASM.instruction list * symbol_table * cost_map) list -> BitVectors.byte list
60*)
61
62val initialize: status
63
64val load_mem: Physical.WordMap.map -> status -> status
65val load: BitVectors.byte list -> status -> status
66
67exception Halt  (* to be raised to stop execution *)
68
69(* the callback function is used to observe the execution
70   trace; it can raise Hold to stop execution. Otherwise
71   the processor never halts. *)
72val execute: (status -> unit) -> status -> status
73
74val fetch: Physical.WordMap.map -> word -> ASM.instruction * word * int
Note: See TracBrowser for help on using the repository browser.