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

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

Fixing type errors in execute1.

File size: 2.7 KB
RevLine 
[27]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
[28]5type direct = [ `DIRECT of byte ]
[46]6type indirect = [ `INDIRECT of bit ]
7type ext_indirect = [ `EXT_INDIRECT of bit ]
[28]8type reg = [ `REG of bit * bit * bit ]
[27]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 ]
[46]17type ext_indirect_dptr = [ `EXT_IND_DPTR ]
[27]18type carry = [ `C ]
[46]19type bit = [ `BIT of byte ]
20type nbit = [ `NBIT of byte ]
[27]21type rel = [ `REL of byte ]
22type addr11 = [ `ADDR11 of word11 ]
23type addr16 = [ `ADDR16 of word ]
24
25type instruction =
26 (* arithmetic operations *)
[97]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
[27]35
36 (* logical operations *)
[97]37 | `ANL of
[28]38    (acc * [ reg | direct | indirect | data ],
[27]39     direct * [ acc | data ],
40     carry * [ bit | nbit]) union3
[97]41 | `ORL of
[35]42    (acc * [ reg | data | direct | indirect ],
[27]43     direct * [ acc | data ],
44     carry * [ bit | nbit]) union3
[97]45 | `XRL of
[35]46    (acc * [ data | reg | direct | indirect ],
[27]47     direct * [ acc | data ]) union2
[97]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
[27]55
56 (* data transfer *)
[97]57 | `MOV of 
[27]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
[97]65 | `MOVC of acc * [ acc_dptr | acc_pc ]
66 | `MOVX of (acc * [ ext_indirect | ext_indirect_dptr ],
[46]67            [ ext_indirect | ext_indirect_dptr ] * acc) union2
[97]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
[27]73
74 (* program branching *)
[97]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
[100]96 | `Cost of string
[97]97 | `Label of string
[100]98 | `Jmp of string
99 | `Call of string
100 ]
Note: See TracBrowser for help on using the repository browser.