1 | (*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*) |
---|
2 | (* FILENAME: ASMInstruction.ml *) |
---|
3 | (* DESCRIPTION: Intel 8051 series assembly language AST, and functions for *) |
---|
4 | (* pretty printing and converting to valid assembly programs *) |
---|
5 | (* suitable for consumption by SDCC. *) |
---|
6 | (* CREATED: 17/09/2010, Dominic Mulligan *) |
---|
7 | (* BUGS: `to_cdcc_assembly_format' not yet implemented. *) |
---|
8 | (*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*) |
---|
9 | |
---|
10 | open Bit;; |
---|
11 | open Nibble;; |
---|
12 | open Byte;; |
---|
13 | open Byte7;; |
---|
14 | open Word;; |
---|
15 | open Word11;; |
---|
16 | |
---|
17 | module type ASM_INSTRUCTION = |
---|
18 | sig |
---|
19 | type bit |
---|
20 | type nibble |
---|
21 | type byte |
---|
22 | type byte7 |
---|
23 | type word |
---|
24 | type word11 |
---|
25 | |
---|
26 | type ('a,'b) union2 = |
---|
27 | [ `U1 of 'a | `U2 of 'b ] |
---|
28 | type ('a,'b,'c) union3 = |
---|
29 | [ `U1 of 'a | `U2 of 'b | `U3 of 'c ] |
---|
30 | type ('a,'b,'c,'d,'e,'f) union6 = |
---|
31 | [ `U1 of 'a | `U2 of 'b | `U3 of 'c | `U4 of 'd | `U5 of 'e | `U6 of 'f ] |
---|
32 | |
---|
33 | type direct = [ `DIRECT of byte ] |
---|
34 | type indirect = [ `INDIRECT of bit ] |
---|
35 | type ext_indirect = [ `EXT_INDIRECT of bit ] |
---|
36 | type reg = [ `REG of bit * bit * bit ] |
---|
37 | type acc = [ `A ] |
---|
38 | type b = [ `B ] |
---|
39 | type dptr = [ `DPTR ] |
---|
40 | type data = [ `DATA of byte ] |
---|
41 | type data16 = [ `DATA16 of word ] |
---|
42 | type acc_dptr = [ `A_DPTR ] |
---|
43 | type acc_pc = [ `A_PC ] |
---|
44 | type indirect_dptr = [ `IND_DPTR ] |
---|
45 | type ext_indirect_dptr = [ `EXT_IND_DPTR ] |
---|
46 | type carry = [ `C ] |
---|
47 | type bit_addr = [ `BIT of byte ] |
---|
48 | type nbit_addr = [ `NBIT of byte ] |
---|
49 | type rel = [ `REL of byte ] |
---|
50 | type addr11 = [ `ADDR11 of word11 ] |
---|
51 | type addr16 = [ `ADDR16 of word ] |
---|
52 | |
---|
53 | type asm_instruction = |
---|
54 | ADD of acc * [ reg | direct | indirect | data ] |
---|
55 | | ADDC of acc * [ reg | direct | indirect | data ] |
---|
56 | | SUBB of acc * [ reg | direct | indirect | data ] |
---|
57 | | INC of [ acc | reg | direct | indirect | dptr ] |
---|
58 | | DEC of [ acc | reg | direct | indirect ] |
---|
59 | | MUL of acc * b |
---|
60 | | DIV of acc * b |
---|
61 | | DA of acc |
---|
62 | | ANL of |
---|
63 | (acc * [ reg | direct | indirect | data ], |
---|
64 | direct * [ acc | data ], |
---|
65 | carry * [ bit_addr | nbit_addr]) union3 |
---|
66 | | ORL of |
---|
67 | (acc * [ reg | data | direct | indirect ], |
---|
68 | direct * [ acc | data ], |
---|
69 | carry * [ bit_addr | nbit_addr]) union3 |
---|
70 | | XRL of |
---|
71 | (acc * [ data | reg | direct | indirect ], |
---|
72 | direct * [ acc | data ]) union2 |
---|
73 | | CLR of [ acc | carry | bit_addr ] |
---|
74 | | CPL of [ acc | carry | bit_addr ] |
---|
75 | | RL of acc |
---|
76 | | RLC of acc |
---|
77 | | RR of acc |
---|
78 | | RRC of acc |
---|
79 | | SWAP of acc |
---|
80 | | MOV of |
---|
81 | (acc * [ reg | direct | indirect | data ], |
---|
82 | [ reg | indirect ] * [ acc | direct | data ], |
---|
83 | direct * [ acc | reg | direct | indirect | data ], |
---|
84 | dptr * data16, |
---|
85 | carry * bit_addr, |
---|
86 | bit_addr * carry) union6 |
---|
87 | | MOVC of acc * [ acc_dptr | acc_pc ] |
---|
88 | | MOVX of |
---|
89 | (acc * [ ext_indirect | ext_indirect_dptr ], |
---|
90 | [ ext_indirect | ext_indirect_dptr ] * acc) union2 |
---|
91 | | SETB of [ carry | bit_addr ] |
---|
92 | | PUSH of direct |
---|
93 | | POP of direct |
---|
94 | | XCH of acc * [ reg | direct | indirect ] |
---|
95 | | XCHD of acc * indirect |
---|
96 | | JC of rel |
---|
97 | | JNC of rel |
---|
98 | | JB of bit_addr * rel |
---|
99 | | JNB of bit_addr * rel |
---|
100 | | JBC of bit_addr * rel |
---|
101 | | ACALL of addr11 |
---|
102 | | LCALL of addr16 |
---|
103 | | RET |
---|
104 | | RETI |
---|
105 | | AJMP of addr11 |
---|
106 | | LJMP of addr16 |
---|
107 | | SJMP of rel |
---|
108 | | JMP of indirect_dptr |
---|
109 | | JZ of rel |
---|
110 | | JNZ of rel |
---|
111 | | CJNE of |
---|
112 | (acc * [ direct | data ], |
---|
113 | [ reg | indirect ] * data) union2 * rel |
---|
114 | | DJNZ of [ reg | direct ] * rel |
---|
115 | | NOP |
---|
116 | |
---|
117 | val to_string: asm_instruction -> string |
---|
118 | (* val to_cdcc_assembly_format: asm_instruction -> string DPM: implement! *) |
---|
119 | end;; |
---|
120 | |
---|
121 | module ASMInstructionFunctor(Bit: BIT) |
---|
122 | (Nibble: NIBBLE |
---|
123 | with type bit = Bit.bit) |
---|
124 | (Byte: BYTE |
---|
125 | with type bit = Bit.bit |
---|
126 | and type nibble = Nibble.nibble) |
---|
127 | (Byte7: BYTE7 |
---|
128 | with type bit = Bit.bit |
---|
129 | and type nibble = Nibble.nibble) |
---|
130 | (Word: WORD |
---|
131 | with type bit = Bit.bit |
---|
132 | and type nibble = Nibble.nibble |
---|
133 | and type byte = Byte.byte) |
---|
134 | (Word11: WORD11 |
---|
135 | with type bit = Bit.bit |
---|
136 | and type byte = Byte.byte): ASM_INSTRUCTION |
---|
137 | with type bit = Bit.bit |
---|
138 | and type nibble = Nibble.nibble |
---|
139 | and type byte = Byte.byte |
---|
140 | and type byte7 = Byte7.byte7 |
---|
141 | and type word = Word.word |
---|
142 | and type word11 = Word11.word11 = |
---|
143 | struct |
---|
144 | type bit = Bit.bit |
---|
145 | type nibble = Nibble.nibble |
---|
146 | type byte = Byte.byte |
---|
147 | type byte7 = Byte7.byte7 |
---|
148 | type word = Word.word |
---|
149 | type word11 = Word11.word11 |
---|
150 | |
---|
151 | type ('a,'b) union2 = |
---|
152 | [ `U1 of 'a | `U2 of 'b ] |
---|
153 | type ('a,'b,'c) union3 = |
---|
154 | [ `U1 of 'a | `U2 of 'b | `U3 of 'c ] |
---|
155 | type ('a,'b,'c,'d,'e,'f) union6 = |
---|
156 | [ `U1 of 'a | `U2 of 'b | `U3 of 'c | `U4 of 'd | `U5 of 'e | `U6 of 'f ] |
---|
157 | |
---|
158 | type direct = [ `DIRECT of byte ] |
---|
159 | type indirect = [ `INDIRECT of bit ] |
---|
160 | type ext_indirect = [ `EXT_INDIRECT of bit ] |
---|
161 | type reg = [ `REG of bit * bit * bit ] |
---|
162 | type acc = [ `A ] |
---|
163 | type b = [ `B ] |
---|
164 | type dptr = [ `DPTR ] |
---|
165 | type data = [ `DATA of byte ] |
---|
166 | type data16 = [ `DATA16 of word ] |
---|
167 | type acc_dptr = [ `A_DPTR ] |
---|
168 | type acc_pc = [ `A_PC ] |
---|
169 | type indirect_dptr = [ `IND_DPTR ] |
---|
170 | type ext_indirect_dptr = [ `EXT_IND_DPTR ] |
---|
171 | type carry = [ `C ] |
---|
172 | type bit_addr = [ `BIT of byte ] |
---|
173 | type nbit_addr = [ `NBIT of byte ] |
---|
174 | type rel = [ `REL of byte ] |
---|
175 | type addr11 = [ `ADDR11 of word11 ] |
---|
176 | type addr16 = [ `ADDR16 of word ] |
---|
177 | |
---|
178 | type asm_instruction = |
---|
179 | ADD of acc * [ reg | direct | indirect | data ] |
---|
180 | | ADDC of acc * [ reg | direct | indirect | data ] |
---|
181 | | SUBB of acc * [ reg | direct | indirect | data ] |
---|
182 | | INC of [ acc | reg | direct | indirect | dptr ] |
---|
183 | | DEC of [ acc | reg | direct | indirect ] |
---|
184 | | MUL of acc * b |
---|
185 | | DIV of acc * b |
---|
186 | | DA of acc |
---|
187 | | ANL of |
---|
188 | (acc * [ reg | direct | indirect | data ], |
---|
189 | direct * [ acc | data ], |
---|
190 | carry * [ bit_addr | nbit_addr]) union3 |
---|
191 | | ORL of |
---|
192 | (acc * [ reg | data | direct | indirect ], |
---|
193 | direct * [ acc | data ], |
---|
194 | carry * [ bit_addr | nbit_addr]) union3 |
---|
195 | | XRL of |
---|
196 | (acc * [ data | reg | direct | indirect ], |
---|
197 | direct * [ acc | data ]) union2 |
---|
198 | | CLR of [ acc | carry | bit_addr ] |
---|
199 | | CPL of [ acc | carry | bit_addr ] |
---|
200 | | RL of acc |
---|
201 | | RLC of acc |
---|
202 | | RR of acc |
---|
203 | | RRC of acc |
---|
204 | | SWAP of acc |
---|
205 | | MOV of |
---|
206 | (acc * [ reg | direct | indirect | data ], |
---|
207 | [ reg | indirect ] * [ acc | direct | data ], |
---|
208 | direct * [ acc | reg | direct | indirect | data ], |
---|
209 | dptr * data16, |
---|
210 | carry * bit_addr, |
---|
211 | bit_addr * carry) union6 |
---|
212 | | MOVC of acc * [ acc_dptr | acc_pc ] |
---|
213 | | MOVX of |
---|
214 | (acc * [ ext_indirect | ext_indirect_dptr ], |
---|
215 | [ ext_indirect | ext_indirect_dptr ] * acc) union2 |
---|
216 | | SETB of [ carry | bit_addr ] |
---|
217 | | PUSH of direct |
---|
218 | | POP of direct |
---|
219 | | XCH of acc * [ reg | direct | indirect ] |
---|
220 | | XCHD of acc * indirect |
---|
221 | | JC of rel |
---|
222 | | JNC of rel |
---|
223 | | JB of bit_addr * rel |
---|
224 | | JNB of bit_addr * rel |
---|
225 | | JBC of bit_addr * rel |
---|
226 | | ACALL of addr11 |
---|
227 | | LCALL of addr16 |
---|
228 | | RET |
---|
229 | | RETI |
---|
230 | | AJMP of addr11 |
---|
231 | | LJMP of addr16 |
---|
232 | | SJMP of rel |
---|
233 | | JMP of indirect_dptr |
---|
234 | | JZ of rel |
---|
235 | | JNZ of rel |
---|
236 | | CJNE of |
---|
237 | (acc * [ direct | data ], |
---|
238 | [ reg | indirect ] * data) union2 * rel |
---|
239 | | DJNZ of [ reg | direct ] * rel |
---|
240 | | NOP |
---|
241 | |
---|
242 | let to_string = |
---|
243 | function |
---|
244 | ACALL (`ADDR11 (a10,a9,a8,b1)) -> |
---|
245 | "ACALL addr11 (" ^ Word11.to_string (a10,a9,a8,b1) ^ ")" |
---|
246 | | ADD (`A,`REG (r1,r2,r3)) -> |
---|
247 | "ADD A Rn (" ^ Bit.to_string r1 ^ Bit.to_string r2 ^ Bit.to_string r3 ^ ")" |
---|
248 | | ADD (`A, `DIRECT b1) -> |
---|
249 | "ADD A direct (" ^ Byte.to_string b1 ^ ")" |
---|
250 | | ADD (`A, `INDIRECT i1) -> |
---|
251 | "ADD A @Ri (" ^ Bit.to_string i1 ^ ")" |
---|
252 | | ADD (`A, `DATA b1) -> |
---|
253 | "ADD A #data (" ^ Byte.to_string b1 ^ ")" |
---|
254 | | ADDC (`A, `REG(r1,r2,r3)) -> |
---|
255 | "ADDC A Rn (" ^ Bit.to_string r1 ^ Bit.to_string r2 ^ Bit.to_string r3 ^ ")" |
---|
256 | | ADDC (`A, `DIRECT b1) -> |
---|
257 | "ADDC A direct (" ^ Byte.to_string b1 ^ ")" |
---|
258 | | ADDC (`A,`INDIRECT i1) -> |
---|
259 | "ADDC A @Ri (" ^ Bit.to_string i1 ^ ")" |
---|
260 | | ADDC (`A,`DATA b1) -> |
---|
261 | "ADDC A #data (" ^ Byte.to_string b1 ^ ")" |
---|
262 | | AJMP (`ADDR11 (a10,a9,a8,b1)) -> |
---|
263 | "AJMP addr11 (" ^ Word11.to_string (a10,a9,a8,b1) ^ ")" |
---|
264 | | ANL (`U1 (`A, `REG (r1,r2,r3))) -> |
---|
265 | "ANL A Rn (" ^ Bit.to_string r1 ^ Bit.to_string r2 ^ Bit.to_string r3 ^ ")" |
---|
266 | | ANL (`U1 (`A, `DIRECT b1)) -> |
---|
267 | "ANL A direct (" ^ Byte.to_string b1 ^ ")" |
---|
268 | | ANL (`U1 (`A, `INDIRECT i1)) -> |
---|
269 | "ANL A @Ri (" ^ Bit.to_string i1 ^ ")" |
---|
270 | | ANL (`U1 (`A, `DATA b1)) -> |
---|
271 | "ANL A #data (" ^ Byte.to_string b1 ^ ")" |
---|
272 | | ANL (`U2 (`DIRECT b1,`A)) -> |
---|
273 | "ANL direct A (" ^ Byte.to_string b1 ^ ")" |
---|
274 | | ANL (`U2 (`DIRECT b1,`DATA b2)) -> |
---|
275 | "ANL direct #data (" ^ Byte.to_string b1 ^ Byte.to_string b2 ^ ")" |
---|
276 | | ANL (`U3 (`C,`BIT b1)) -> |
---|
277 | "ANL C bit (" ^ Byte.to_string b1 ^ ")" |
---|
278 | | ANL (`U3 (`C,`NBIT b1)) -> |
---|
279 | "ANL C /bit (" ^ Byte.to_string b1 ^ ")" |
---|
280 | | CJNE (`U1 (`A, `DIRECT b1), `REL b2) -> |
---|
281 | "CJNE A direct rel (" ^ Byte.to_string b1 ^ Byte.to_string b2 ^ ")" |
---|
282 | | CJNE (`U1 (`A, `DATA b1), `REL b2) -> |
---|
283 | "CJNE A #data rel (" ^ Byte.to_string b1 ^ Byte.to_string b2 ^ ")" |
---|
284 | | CJNE (`U2 (`REG(r1,r2,r3), `DATA b1), `REL b2) -> |
---|
285 | "CJNE Ri #data rel (" ^ Byte.to_string b1 ^ Byte.to_string b2 ^ ")" |
---|
286 | | CJNE (`U2 (`INDIRECT i1, `DATA b1), `REL b2) -> |
---|
287 | "CJNE @Ri #data rel (" ^ Bit.to_string i1 ^ Byte.to_string b1 ^ Byte.to_string b2 ^ ")" |
---|
288 | | CLR `A -> |
---|
289 | "CLR A" |
---|
290 | | CLR `C -> |
---|
291 | "CLR C" |
---|
292 | | CLR (`BIT b1) -> |
---|
293 | "CLR bit (" ^ Byte.to_string b1 ^ ")" |
---|
294 | | DA `A -> |
---|
295 | "DA A" |
---|
296 | | DEC `A -> |
---|
297 | "DEC A" |
---|
298 | | DEC (`REG(r1,r2,r3)) -> |
---|
299 | "DEC Rn" |
---|
300 | | DEC (`DIRECT b1) -> |
---|
301 | "DEC direct (" ^ Byte.to_string b1 ^ ")" |
---|
302 | | DEC (`INDIRECT i1) -> |
---|
303 | "DEC @Ri (" ^ Bit.to_string i1 ^ ")" |
---|
304 | | DIV (`A, `B) -> |
---|
305 | "DIV A B" |
---|
306 | | DJNZ (`REG(r1,r2,r3), `REL b1) -> |
---|
307 | "DJNZ Rn rel (" ^ Bit.to_string r1 ^ Bit.to_string r2 ^ Bit.to_string r3 ^ Byte.to_string b1 ^ ")" |
---|
308 | | DJNZ (`DIRECT b1, `REL b2) -> |
---|
309 | "DJNZ direct rel (" ^ Byte.to_string b1 ^ Byte.to_string b2 ^ ")" |
---|
310 | | INC `A -> |
---|
311 | "INC A" |
---|
312 | | INC (`REG(r1,r2,r3)) -> |
---|
313 | "INC Rn (" ^ Bit.to_string r1 ^ Bit.to_string r2 ^ Bit.to_string r3 ^ ")" |
---|
314 | | INC (`DIRECT b1) -> |
---|
315 | "INC direct (" ^ Byte.to_string b1 ^ ")" |
---|
316 | | INC (`INDIRECT i1) -> |
---|
317 | "INC @Ri (" ^ Bit.to_string i1 ^ ")" |
---|
318 | | INC `DPTR -> |
---|
319 | "INC DPTR" |
---|
320 | | JB (`BIT b1, `REL b2) -> |
---|
321 | "JB bit rel (" ^ Byte.to_string b1 ^ Byte.to_string b2 ^ ")" |
---|
322 | | JBC (`BIT b1, `REL b2) -> |
---|
323 | "JBC bit rel (" ^ Byte.to_string b1 ^ Byte.to_string b2 ^ ")" |
---|
324 | | JC (`REL b1) -> |
---|
325 | "JC rel (" ^ Byte.to_string b1 ^ ")" |
---|
326 | | JMP `IND_DPTR -> |
---|
327 | "JMP @A + DPTR" |
---|
328 | | JNB (`BIT b1, `REL b2) -> |
---|
329 | "JNB bit rel (" ^ Byte.to_string b1 ^ Byte.to_string b2 ^ ")" |
---|
330 | | JNC (`REL b1) -> |
---|
331 | "JNC rel (" ^ Byte.to_string b1 ^ ")" |
---|
332 | | JNZ (`REL b1) -> |
---|
333 | "JNZ rel (" ^ Byte.to_string b1 ^ ")" |
---|
334 | | JZ (`REL b1) -> |
---|
335 | "JZ rel (" ^ Byte.to_string b1 ^ ")" |
---|
336 | | LCALL (`ADDR16 (b1,b2)) -> |
---|
337 | "LCALL addr16 (" ^ Byte.to_string b1 ^ Byte.to_string b2 ^ ")" |
---|
338 | | LJMP (`ADDR16 (b1,b2)) -> |
---|
339 | "LJMP addr16 (" ^ Byte.to_string b1 ^ Byte.to_string b2 ^ ")" |
---|
340 | | MOV (`U1 (`A, `REG(r1,r2,r3))) -> |
---|
341 | "MOV A Rn (" ^ Bit.to_string r1 ^ Bit.to_string r2 ^ Bit.to_string r3 ^ ")" |
---|
342 | | MOV (`U1 (`A, `DIRECT b1)) -> |
---|
343 | "MOV A direct (" ^ Byte.to_string b1 ^ ")" |
---|
344 | | MOV (`U1 (`A, `INDIRECT i1)) -> |
---|
345 | "MOV A @Ri (" ^ Bit.to_string i1 ^ ")" |
---|
346 | | MOV (`U1 (`A, `DATA b1)) -> |
---|
347 | "MOV A #data (" ^ Byte.to_string b1 ^ ")" |
---|
348 | | MOV (`U2 (`REG(r1,r2,r3), `A)) -> |
---|
349 | "MOV Rn A (" ^ Bit.to_string r1 ^ Bit.to_string r2 ^ Bit.to_string r3 ^ ")" |
---|
350 | | MOV (`U2 (`REG(r1,r2,r3), (`DIRECT b1))) -> |
---|
351 | "MOV Rn direct (" ^ Bit.to_string r1 ^ Bit.to_string r2 ^ Bit.to_string r3 ^ ")" |
---|
352 | | MOV (`U2 (`REG(r1,r2,r3), (`DATA b1))) -> |
---|
353 | "MOV Rn #data (" ^ Bit.to_string r1 ^ Bit.to_string r2 ^ Bit.to_string r3 ^ ")" |
---|
354 | | MOV (`U3 (`DIRECT b1, `A)) -> |
---|
355 | "MOV direct A (" ^ Byte.to_string b1 ^ ")" |
---|
356 | | MOV (`U3 (`DIRECT b1, `REG(r1,r2,r3))) -> |
---|
357 | "MOV direct Rn (" ^ Bit.to_string r1 ^ Bit.to_string r2 ^ Bit.to_string r3 ^ ")" |
---|
358 | | MOV (`U3 (`DIRECT b1, `DIRECT b2)) -> |
---|
359 | "MOV direct direct (" ^ Byte.to_string b1 ^ Byte.to_string b2 ^ ")" |
---|
360 | | MOV (`U3 (`DIRECT b1, `INDIRECT i1)) -> |
---|
361 | "MOV direct @Ri (" ^ Byte.to_string b1 ^ Bit.to_string i1 ^ ")" |
---|
362 | | MOV (`U3 (`DIRECT b1, `DATA b2)) -> |
---|
363 | "MOV direct #data (" ^ Byte.to_string b1 ^ Byte.to_string b2 ^ ")" |
---|
364 | | MOV (`U2 (`INDIRECT i1, `A)) -> |
---|
365 | "MOV @Ri A (" ^ Bit.to_string i1 ^ ")" |
---|
366 | | MOV (`U2 (`INDIRECT i1, `DIRECT b1)) -> |
---|
367 | "MOV @Ri direct (" ^ Bit.to_string i1 ^ Byte.to_string b1 ^ ")" |
---|
368 | | MOV (`U2 (`INDIRECT i1, `DATA b1)) -> |
---|
369 | "MOV @Ri #data (" ^ Bit.to_string i1 ^ Byte.to_string b1 ^ ")" |
---|
370 | | MOV (`U5 (`C, `BIT b1)) -> |
---|
371 | "MOV C bit (" ^ Byte.to_string b1 ^ ")" |
---|
372 | | MOV (`U6 (`BIT b1, `C)) -> |
---|
373 | "MOV bit C (" ^ Byte.to_string b1 ^ ")" |
---|
374 | | MOV (`U4 (`DPTR, `DATA16(b1,b2))) -> |
---|
375 | "MOV DPTR #data16 (" ^ Byte.to_string b1 ^ Byte.to_string b2 ^ ")" |
---|
376 | | MOVC (`A, `A_DPTR) -> |
---|
377 | "MOVC A @A + DPTR" |
---|
378 | | MOVC (`A, `A_PC) -> |
---|
379 | "MOVC A @A + PC" |
---|
380 | | MOVX (`U1 (`A, `EXT_INDIRECT i1)) -> |
---|
381 | "MOVX A @Ri (" ^ Bit.to_string i1 ^ ")" |
---|
382 | | MOVX (`U1 (`A, `EXT_IND_DPTR)) -> |
---|
383 | "MOVX A @DPTR" |
---|
384 | | MOVX (`U2 (`EXT_INDIRECT i1, `A)) -> |
---|
385 | "MOVX @Ri A ( " ^ Bit.to_string i1 ^ ")" |
---|
386 | | MOVX (`U2 (`EXT_IND_DPTR, `A)) -> |
---|
387 | "MOVX @DPTR A" |
---|
388 | | MUL(`A, `B) -> |
---|
389 | "MUL A B" |
---|
390 | | NOP -> |
---|
391 | "NOP" |
---|
392 | | ORL (`U1(`A, `REG(r1,r2,r3))) -> |
---|
393 | "ORL A Rn (" ^ Bit.to_string r1 ^ Bit.to_string r2 ^ Bit.to_string r3 ^ ")" |
---|
394 | | ORL (`U1(`A, `DIRECT b1)) -> |
---|
395 | "ORL A direct (" ^ Byte.to_string b1 ^ ")" |
---|
396 | | ORL (`U1(`A, `INDIRECT i1)) -> |
---|
397 | "ORL A @Ri (" ^ Bit.to_string i1 ^ ")" |
---|
398 | | ORL (`U1(`A, `DATA b1)) -> |
---|
399 | "ORL A #data (" ^ Byte.to_string b1 ^ ")" |
---|
400 | | ORL (`U2(`DIRECT b1, `A)) -> |
---|
401 | "ORL direct A (" ^ Byte.to_string b1 ^ ")" |
---|
402 | | ORL (`U2 (`DIRECT b1, `DATA b2)) -> |
---|
403 | "ORL direct #data (" ^ Byte.to_string b1 ^ Byte.to_string b2 ^ ")" |
---|
404 | | ORL (`U3 (`C, `BIT b1)) -> |
---|
405 | "ORL C bit (" ^ Byte.to_string b1 ^ ")" |
---|
406 | | ORL (`U3 (`C, `NBIT b1)) -> |
---|
407 | "ORL C \\bit (" ^ Byte.to_string b1 ^ ")" |
---|
408 | | POP (`DIRECT b1) -> |
---|
409 | "POP direct (" ^ Byte.to_string b1 ^ ")" |
---|
410 | | PUSH (`DIRECT b1) -> |
---|
411 | "PUSH direct (" ^ Byte.to_string b1 ^ ")" |
---|
412 | | RET -> |
---|
413 | "RET" |
---|
414 | | RETI -> |
---|
415 | "RETI" |
---|
416 | | RL `A -> |
---|
417 | "RL A" |
---|
418 | | RLC `A -> |
---|
419 | "RLC A" |
---|
420 | | RR `A -> |
---|
421 | "RR A" |
---|
422 | | RRC `A -> |
---|
423 | "RRC A" |
---|
424 | | SETB `C -> |
---|
425 | "SETB C" |
---|
426 | | SETB (`BIT b1) -> |
---|
427 | "SETB bit (" ^ Byte.to_string b1 ^ ")" |
---|
428 | | SJMP (`REL b1) -> |
---|
429 | "SJMP rel (" ^ Byte.to_string b1 ^ ")" |
---|
430 | | SUBB (`A, `REG(r1,r2,r3)) -> |
---|
431 | "SUBB A Rn (" ^ Bit.to_string r1 ^ Bit.to_string r2 ^ Bit.to_string r3 ^ ")" |
---|
432 | | SUBB (`A, `DIRECT b1) -> |
---|
433 | "SUBB A direct (" ^ Byte.to_string b1 ^ ")" |
---|
434 | | SUBB (`A, `INDIRECT i1) -> |
---|
435 | "SUBB A @Ri (" ^ Bit.to_string i1 ^ ")" |
---|
436 | | SUBB (`A, `DATA b1) -> |
---|
437 | "SUBB A #data (" ^ Byte.to_string b1 ^ ")" |
---|
438 | | SWAP `A -> |
---|
439 | "SWAP A" |
---|
440 | | XCH (`A, `REG(r1,r2,r3)) -> |
---|
441 | "XCH A Rn (" ^ Bit.to_string r1 ^ Bit.to_string r2 ^ Bit.to_string r3 ^ ")" |
---|
442 | | XCH (`A, `DIRECT b1) -> |
---|
443 | "XCH A direct (" ^ Byte.to_string b1 ^ ")" |
---|
444 | | XCH (`A, `INDIRECT i1) -> |
---|
445 | "XCH A @Ri (" ^ Bit.to_string i1 ^ ")" |
---|
446 | | XCHD(`A, `INDIRECT i1) -> |
---|
447 | "XCHD A @Ri (" ^ Bit.to_string i1 ^ ")" |
---|
448 | | XRL(`U1(`A, `REG(r1,r2,r3))) -> |
---|
449 | "XRL A Rn (" ^ Bit.to_string r1 ^ Bit.to_string r2 ^ Bit.to_string r3 ^ ")" |
---|
450 | | XRL(`U1(`A, `DIRECT b1)) -> |
---|
451 | "XRL A direct (" ^ Byte.to_string b1 ^ ")" |
---|
452 | | XRL(`U1(`A, `INDIRECT i1)) -> |
---|
453 | "XRL A @Ri (" ^ Bit.to_string i1 ^ ")" |
---|
454 | | XRL(`U1(`A, `DATA b1)) -> |
---|
455 | "XRL A #data (" ^ Byte.to_string b1 ^ ")" |
---|
456 | | XRL(`U2(`DIRECT b1, `A)) -> |
---|
457 | "XRL direct A (" ^ Byte.to_string b1 ^ ")" |
---|
458 | | XRL(`U2(`DIRECT b1, `DATA b2)) -> |
---|
459 | "XRL direct #data (" ^ Byte.to_string b2 ^ ")" |
---|
460 | end;; |
---|
461 | |
---|
462 | module ASMInstruction = ASMInstructionFunctor (Bit) (Nibble) (Byte) |
---|
463 | (Byte7) (Word) (Word11);; |
---|