source: Deliverables/D4.1/ASM.mli @ 101

Last change on this file since 101 was 101, checked in by mulligan, 9 years ago

Fixing type errors in execute1.

File size: 2.7 KB
Line 
1type ('a,'b) union2 = [ `U1 of 'a | `U2 of 'b ]
2type ('a,'b,'c) union3 = [ `U1 of 'a | `U2 of 'b | `U3 of 'c ]
3type ('a,'b,'c,'d,'e,'f) union6 = [ `U1 of 'a | `U2 of 'b | `U3 of 'c | `U4 of 'd | `U5 of 'e | `U6 of 'f ]
4
5type direct = [ `DIRECT of byte ]
6type indirect = [ `INDIRECT of bit ]
7type ext_indirect = [ `EXT_INDIRECT of bit ]
8type reg = [ `REG of bit * bit * bit ]
9type acc = [ `A ]
10type b = [ `B ]
11type dptr = [ `DPTR ]
12type data = [ `DATA of byte ]
13type data16 = [ `DATA16 of word ]
14type acc_dptr = [ `A_DPTR ]
15type acc_pc = [ `A_PC ]
16type indirect_dptr = [ `IND_DPTR ]
17type ext_indirect_dptr = [ `EXT_IND_DPTR ]
18type carry = [ `C ]
19type bit = [ `BIT of byte ]
20type nbit = [ `NBIT of byte ]
21type rel = [ `REL of byte ]
22type addr11 = [ `ADDR11 of word11 ]
23type addr16 = [ `ADDR16 of word ]
24
25type instruction =
26 (* arithmetic operations *)
27 [ `ADD of acc * [ reg | direct | indirect | data ]
28 | `ADDC of acc * [ reg | direct | indirect | data ]
29 | `SUBB of acc * [ reg | direct | indirect | data ]
30 | `INC of [ acc | reg | direct | indirect | dptr ]
31 | `DEC of [ acc | reg | direct | indirect ]
32 | `MUL of acc * b
33 | `DIV of acc * b
34 | `DA  of acc
35
36 (* logical operations *)
37 | `ANL of
38    (acc * [ reg | direct | indirect | data ],
39     direct * [ acc | data ],
40     carry * [ bit | nbit]) union3
41 | `ORL of
42    (acc * [ reg | data | direct | indirect ],
43     direct * [ acc | data ],
44     carry * [ bit | nbit]) union3
45 | `XRL of
46    (acc * [ data | reg | direct | indirect ],
47     direct * [ acc | data ]) union2
48 | `CLR of [ acc | carry | bit ]
49 | `CPL of [ acc | carry | bit ]
50 | `RL of acc
51 | `RLC of acc
52 | `RR of acc
53 | `RRC of acc
54 | `SWAP of acc
55
56 (* data transfer *)
57 | `MOV of 
58    (acc * [ reg | direct | indirect | data ],
59     [ reg | indirect ] * [ acc | direct | data ],
60     direct * [ acc | reg | direct | indirect | data ],
61     dptr * data16,
62     carry * bit,
63     bit * carry
64     ) union6
65 | `MOVC of acc * [ acc_dptr | acc_pc ]
66 | `MOVX of (acc * [ ext_indirect | ext_indirect_dptr ],
67            [ ext_indirect | ext_indirect_dptr ] * acc) union2
68 | `SETB of [ carry | bit ]
69 | `PUSH of direct
70 | `POP of direct
71 | `XCH of acc * [ reg | direct | indirect ]
72 | `XCHD of acc * indirect
73
74 (* program branching *)
75 | `JC of rel
76 | `JNC of rel
77 | `JB of bit * rel
78 | `JNB of bit * rel
79 | `JBC of bit * rel
80 | `ACALL of addr11
81 | `LCALL of addr16
82 | `RET
83 | `RETI
84 | `AJMP of addr11
85 | `LJMP of addr16
86 | `SJMP of rel
87 | `JMP of indirect_dptr
88 | `JZ of rel
89 | `JNZ of rel
90 | `CJNE of (acc * [ direct | data ], [ reg | indirect ] * data) union2 * rel
91 | `DJNZ of [ reg | direct ] * rel
92 | `NOP ]
93
94type labelled_instruction =
95 [ instruction
96 | `Cost of string
97 | `Label of string
98 | `Jmp of string
99 | `Call of string
100 ]
Note: See TracBrowser for help on using the repository browser.