Line | |
---|
1 | open BitVectors;; |
---|
2 | open Physical;; |
---|
3 | |
---|
4 | exception CodeTooLarge |
---|
5 | |
---|
6 | type time = int;; |
---|
7 | type line = [`P0 | `P1 ];; (* ??? *) |
---|
8 | type continuation = |
---|
9 | unit (* |
---|
10 | [`In of time * line * byte * continuation] option * |
---|
11 | [`Out of (time -> line -> byte -> continuation) ] |
---|
12 | *) |
---|
13 | |
---|
14 | type 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; (* can be reduced *) |
---|
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 | |
---|
52 | module IntMap: Map.S with type key = int |
---|
53 | |
---|
54 | val assembly: |
---|
55 | ASM.labelled_instruction list -> BitVectors.byte list (*ASM.instruction list * symbol_table *) * string IntMap.t |
---|
56 | |
---|
57 | (* |
---|
58 | val link: |
---|
59 | (ASM.instruction list * symbol_table * cost_map) list -> BitVectors.byte list |
---|
60 | *) |
---|
61 | |
---|
62 | val initialize: status |
---|
63 | |
---|
64 | val load_mem: Physical.WordMap.map -> status -> status |
---|
65 | val load: BitVectors.byte list -> status -> status |
---|
66 | |
---|
67 | exception 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. *) |
---|
72 | val execute: (status -> unit) -> status -> status |
---|
73 | |
---|
74 | val fetch: Physical.WordMap.map -> word -> ASM.instruction * word * int |
---|
Note: See
TracBrowser
for help on using the repository browser.