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

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

Small bug fix in abstract syntax of ASM language (JB needs to carry a
bit address as well as a relative offset).

File size: 2.4 KB
Line 
1open Physical;;
2
3type ('a,'b) union2 = [ `U1 of 'a | `U2 of 'b ]
4type ('a,'b,'c) union3 = [ `U1 of 'a | `U2 of 'b | `U3 of 'c ]
5type ('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 ]
6
7type direct = [ `DIRECT of byte ]
8type indirect = [ `INDIRECT of bool ]
9type reg = [ `REG of bit * bit * bit ]
10type acc = [ `A ]
11type b = [ `B ]
12type dptr = [ `DPTR ]
13type data = [ `DATA of byte ]
14type data16 = [ `DATA16 of word ]
15type acc_dptr = [ `A_DPTR ]
16type acc_pc = [ `A_PC ]
17type indirect_dptr = [ `IND_DPTR ]
18type carry = [ `C ]
19type bit = [ `BIT of byte7 ]
20type nbit = [ `NBIT of byte7 ]
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 | direct | indirect ],
43     direct * [ acc | data ],
44     carry * [ bit | nbit]) union3
45 | XRL of
46    (acc * [ 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 * [ indirect | indirect_dptr ],
67            [ indirect | 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 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
Note: See TracBrowser for help on using the repository browser.