1 #define small(x) ((x)>=1 && (x)<=8)
3 /******************************************************************************/
5 /* Group 1 : Load instructions */
7 /******************************************************************************/
15 C_lol ==> "move.l ($1, a6), -(sp)".
17 C_loe.. ==> "move.l ($1+$2), -(sp)".
19 C_lil ==> "move.l ([$1,a6]), -(sp)".
21 C_lof ==> "move.l (sp)+, a0";
22 "move.l ($1,a0),-(sp)".
24 C_lal ==> "pea ($1,a6)".
26 C_lae.. ==> "pea ($1+$2)".
29 $1 == 0 ==> "move.l a6, -(sp)".
30 $1 == 1 ==> "move.l (8, a6), -(sp)".
31 default ==> "move.l (8, a6), a0";
33 "1: move.l (8,a0), a0";
38 $1 == 0 ==> "pea (8,a6)".
39 $1 == 1 ==> "pea ([8,a6],8)".
40 default ==> "move.l (8, a6), a0";
42 "1: move.l (8,a0), a0";
47 $1 == 1 ==> "move.l (sp)+, a0";
49 "move.b (a0), (3,sp)".
50 $1 == 2 ==> "move.l (sp)+, a0";
52 "move.w (a0), (2,sp)".
53 $1 == 4 ==> "move.l (sp)+, a0";
55 $1 == 8 ==> "move.l (sp)+, a0";
56 "move.l (4,a0),-(sp)";
58 $1 % 4 == 0 ==> "move.l (sp)+, a0";
62 "move.l -(a0), -(sp)";
65 default ==> arg_error( "loi", $1).
69 $1 == 4 ==> "jsr (.los)".
70 default ==> arg_error( "los", $1).
72 C_ldl ==> "move.l ($1+4, a6), -(sp)";
73 "move.l ($1, a6), -(sp)".
75 C_lde.. ==> "move.l ($1+$2+4), -(sp)";
76 "move.l ($1+$2), -(sp)".
78 C_ldf ==> "move.l (sp)+, a0";
79 "move.l ($1+4,a0),-(sp)";
80 "move.l ($1,a0), -(sp)".
85 /******************************************************************************/
87 /* Group 2 : Store instructions */
89 /******************************************************************************/
91 C_stl ==> "move.l (sp)+, ($1,a6)".
93 C_ste.. ==> "move.l (sp)+, ($1+$2)".
95 C_sil ==> "move.l (sp)+, ([$1,a6])".
97 C_stf ==> "move.l (sp)+, a0";
98 "move.l (sp)+, ($1,a0)".
101 $1 == 1 ==> "move.l (sp)+, a0";
104 $1 == 2 ==> "move.l (sp)+, a0";
107 $1 == 4 ==> "move.l (sp)+, a0";
108 "move.l (sp)+, (a0)".
109 $1 == 8 ==> "move.l (sp)+, a0";
110 "move.l (sp)+, (a0)+";
111 "move.l (sp)+, (a0)".
112 $1 % 4 == 0 ==> "move.l (sp)+, a0";
114 "1:move.l (sp)+, (a0)+";
117 default ==> arg_error( "sti", (arith) $1).
120 C_sts ==> "jsr (.sts)".
122 C_sdl ==> "move.l (sp)+, ($1,a6)";
123 "move.l (sp)+, ($1+4,a6)".
125 C_sde.. ==> "move.l (sp)+, ($1+$2)";
126 "move.l (sp)+, ($1+$2+4)".
128 C_sdf ==> "move.l (sp)+, a0";
129 "move.l (sp)+, ($1,a0)";
130 "move.l (sp)+, ($1+4,a0)".
132 /******************************************************************************/
134 /* Group 3 : Integer arithmetic */
136 /******************************************************************************/
139 $1 == 4 ==> "move.l (sp)+, d0";
141 default ==> arg_error( "adi", $1).
144 $1 == 4 ==> "move.l (sp)+, d0";
146 default ==> arg_error( "sbi", $1).
149 $1 == 4 ==> "move.l (sp)+, d0";
152 default ==> arg_error( "mli", $1).
155 $1 == 4 ==> "move.l (sp)+, d0";
159 default ==> arg_error( "dvi", $1).
162 $1 == 4 ==> "move.l (sp)+, d0";
165 "divsl.l (sp)+, d0:d1";
167 default ==> arg_error( "rmi", $1).
170 $1 == 4 ==> "neg.l (sp)".
171 default ==> arg_error( "ngi", $1).
175 $1 == 4 ==> "move.l (sp)+, d0";
179 default ==> arg_error( "sli", $1).
182 $1 == 4 ==> "move.l (sp)+, d0";
186 default ==> arg_error( "sri", $1).
189 /******************************************************************************/
191 /* Group 4 : Unsigned arithmetic */
193 /******************************************************************************/
201 $1 == 4 ==> "move.l (sp)+, d0";
204 default ==> arg_error( "mlu", $1).
207 $1 == 4 ==> "move.l (sp)+, d0";
211 default ==> arg_error( "dvu", $1).
214 $1 == 4 ==> "move.l (sp)+, d0";
217 "divul.l (sp)+, d0:d1";
219 default ==> arg_error( "rmu", $1).
224 $1 == 4 ==> "move.l (sp)+, d0";
228 default ==> arg_error( "sru", $1).
231 /******************************************************************************/
233 /* Group 5 : Floating point arithmetic */
235 /******************************************************************************/
238 $1 == 4 ==> "jsr (adf4)".
239 $1 == 8 ==> "jsr (adf8)".
240 default ==> arg_error( "adf", $1).
243 $1 == 4 ==> "jsr (sbf4)".
244 $1 == 8 ==> "jsr (sbf8)".
245 default ==> arg_error( "sbf", $1).
248 $1 == 4 ==> "jsr (mlf4)".
249 $1 == 8 ==> "jsr (mlf8)".
250 default ==> arg_error( "mlf", $1).
253 $1 == 4 ==> "jsr (dvf4)".
254 $1 == 8 ==> "jsr (dvf8)".
255 default ==> arg_error( "dvf", $1).
257 C_ngf ==> "move.l #7,d0";
261 $1 == 4 ==> "jsr (fif4)".
262 $1 == 8 ==> "jsr (fif8)".
263 default ==> arg_error( "fif", $1).
266 $1 == 4 ==> "jsr (fef4)".
267 $1 == 8 ==> "jsr (fef8)".
268 default ==> arg_error( "fef", $1).
270 /******************************************************************************/
272 /* Group 6 : Pointer arithmetic */
274 /******************************************************************************/
278 default ==> "add.l #$1, (sp)".
281 $1 == 4 ==> "move.l (sp)+, d0";
283 default ==> arg_error( "ads", $1).
286 $1 == 4 ==> "move.l (sp)+, d0";
288 default ==> arg_error( "sbs", $1).
290 /******************************************************************************/
292 /* Group 7 : Increment/decrement/zero */
294 /******************************************************************************/
296 C_inc ==> "add.l #1, (sp)".
298 C_inl ==> "add.l #1, ($1, a6)".
300 C_ine.. ==> "add.l #1, ($1+$2)".
302 C_dec ==> "sub.l #1, (sp)".
304 C_del ==> "sub.l #1, ($1, a6)".
306 C_dee.. ==> "sub.l #1, ($1+$2)".
308 C_zrl ==> "clr.l ($1, a6)".
310 C_zre.. ==> "clr.l ($1+$2)".
312 C_zrf ==> C_zer( $1).
315 $1 == 4 ==> "clr.l -(sp)".
316 $1 == 8 ==> "clr.l -(sp)";
318 default ==> "move.l #$1/4, d0";
324 /******************************************************************************/
326 /* Group 8 : Convert */
328 /******************************************************************************/
330 /* cii, ciu, cuu, cui are assumed to be called with legal arguments only */
332 C_cii ==> " move.l (sp)+, d0";
344 C_cuu ==> "lea (8,sp),sp".
350 C_cfi ==> "jsr (cfi)".
352 C_cfu ==> "jsr (cfu)".
354 C_cff ==> "jsr (cff)".
356 C_cif ==> "jsr (cif)".
358 C_cuf ==> "jsr (cuf)".
360 /******************************************************************************/
362 /* Group 9 : Logical */
364 /******************************************************************************/
367 $1 == 4 ==> "move.l (sp)+, d0";
369 default ==> "move.l #$1/4, d0";
378 $1 == 4 ==> "move.l (sp)+, d0";
380 default ==> "move.l #$1/4, d0";
389 $1 == 4 ==> "move.l (sp)+, d0";
391 default ==> "move.l #$1/4, d0";
400 $1 == 4 ==> "not.l (sp)".
401 $1 == 8 ==> "not.l (sp)";
403 default ==> "move.l #$1/4, d0";
411 $1 == 4 ==> "move.l (sp)+, d0";
415 default ==> arg_error( "rol", $1).
418 $1 == 4 ==> "move.l (sp)+, d0";
422 default ==> arg_error( "ror", $1).
425 /******************************************************************************/
427 /* Group 10 : Sets */
429 /******************************************************************************/
432 $1 == 4 ==> "move.l (sp)+, d0";
438 default ==> "move.l (sp)+, d0";
443 C_inn_narg ==> "move.l (sp)+, d1";
449 $1 == 4 ==> "move.l (sp)+, d0";
453 default ==> "move.l (sp)+, d0";
457 C_set_narg ==> "move.l (sp)+, d1";
461 /******************************************************************************/
463 /* Group 11 : Array */
465 /******************************************************************************/
467 C_lar ==> "move.l #$1, d0";
470 C_lar_narg ==> "move.l (sp)+, d0";
473 C_sar ==> "move.l #$1, d0";
476 C_sar_narg ==> "move.l (sp)+, d0";
479 C_aar ==> "move.l #$1, d0";
483 C_aar_narg ==> "move.l (sp)+, d0";
487 /******************************************************************************/
489 /* Group 12 : Compare */
491 /******************************************************************************/
494 $1 == 4 ==> "clr.l d0";
495 "cmp.l (sp)+, (sp)+";
501 "2 : move.l d0, -(sp)".
502 default ==> "move.l #$1, d0";
508 $1 == 4 ==> "clr.l d0";
509 "cmp.l (sp)+, (sp)+";
515 "2 : move.l d0, -(sp)".
517 default ==> "move.l #$1, d0";
521 C_cmu_narg ==> "move.l (sp)+, d0";
525 C_cms ==> "move.l #$1, d0";
529 C_cms_narg ==> "move.l (sp)+, d0";
533 C_cmp ==> C_cmu( (arith)4).
535 C_tlt ==> "move.l (sp), d0";
542 C_tle ==> "move.l (sp), d0";
549 C_teq ==> "move.l (sp), d0";
556 C_tne ==> "move.l (sp), d0";
563 C_tge ==> "move.l (sp), d0";
570 C_tgt ==> "move.l (sp), d0";
578 $1 == 4 ==> "jsr (cmf4)".
579 $1 == 8 ==> "jsr (cmf8)".
580 default ==> arg_error("cmf", $1).
582 /******************************************************************************/
584 /* Group 13 : Branch */
586 /******************************************************************************/
590 C_blt ==> "move.l (sp)+, d0";
594 C_ble ==> "move.l (sp)+, d0";
598 C_beq ==> "move.l (sp)+, d0";
602 C_bne ==> "move.l (sp)+, d0";
606 C_bge ==> "move.l (sp)+, d0";
610 C_bgt ==> "move.l (sp)+, d0";
614 C_zlt ==> "tst.l (sp)+";
617 C_zle ==> "tst.l (sp)+";
620 C_zeq ==> "tst.l (sp)+";
623 C_zne ==> "tst.l (sp)+";
626 C_zge ==> "tst.l (sp)+";
629 C_zgt ==> "tst.l (sp)+";
633 /******************************************************************************/
635 /* Group 14 : Procedure call instructions */
637 /******************************************************************************/
639 C_cai ==> "move.l (sp)+, a0";
642 C_cal ==> "jsr ($1)".
645 $1 == 4 ==> "move.l d0, -(sp)".
646 $1 == 8 ==> "move.l d1, -(sp)";
648 default ==> arg_error( "lfr", $1).
651 $1 == 0 ==> "unlk a6";
653 $1 == 4 ==> "move.l (sp)+, d0";
656 $1 == 8 ==> "move.l (sp)+, d0";
660 default ==> arg_error( "ret", $1).
662 /******************************************************************************/
664 /* Group 15 : Miscellaneous instructions */
666 /******************************************************************************/
669 small( $1) ==> "add.l #$1, sp".
670 default ==> "lea ($1, sp), sp".
673 $1 == 4 ==> "add.l (sp)+, sp".
674 default ==> arg_error( "ass", $1).
677 $1 == 4 ==> "move.l (sp)+, a0";
680 $1 == 8 ==> "move.l (sp)+, a0";
683 "move.l (4, a1), (4, a0)".
684 default ==> "move.l (sp)+, a0";
688 "move.l (a1)+, (a0)+";
693 $1 == 4 ==> "move.l (sp)+, d0";
699 "move.l (a1)+, (a0)+";
703 default ==> arg_error( "bls", $1).
707 $1 == 4 ==> "move.l (sp)+,a0";
710 default ==> arg_error( "csa", $1).
713 $1 == 4 ==> "move.l (sp)+,a0";
716 default ==> arg_error( "csb", $1).
718 C_dch ==> C_loi( (arith)4).
721 $1 == 4 ==> "move.l (sp), -(sp)".
722 $1 == 8 ==> "move.l (4, sp), -(sp)";
723 "move.l (4, sp), -(sp)".
724 default ==> "move.l #$1/4, d0";
726 "move.l ($1-4, sp), -(sp)";
731 $1 == 4 ==> "move.l (sp)+, d0";
732 "lea (0, sp, d0.l*1), a0";
736 "move.l -(a0), -(sp)";
740 default ==> arg_error( "dus", $1).
742 C_exg ==> "move.l #$1, d0";
745 C_fil.. ==> "move.l #$1+$2, (.filn)".
747 C_gto.. ==> "move.l #$1+$2, a0";
748 "move.l (8, a0), a6";
749 "move.l (4, a0), sp";
752 C_lim ==> "move.l (.trpim), -(sp)".
754 C_lin ==> "move.l #$1, (.lino)".
756 C_lni ==> "add.l #1, (.lino)".
759 $1 == 0 ==> "move.l a6, -(sp)".
760 $1 == 1 ==> "move.l sp, -(sp)".
761 $1 == 2 ==> "move.l (.reghp), -(sp)".
762 default ==> arg_error( "lor", $1).
764 C_lpb ==> C_adp( (arith)8).
766 C_mon ==> "jsr (.mon)".
771 $1 == 4 ==> "move.l (sp)+, a0";
775 "pea (1)"; /* push constant 1 == ERANGE */
777 "1: move.l d0, -(sp)".
778 default ==> arg_error( "rck", $1).
780 C_rtt ==> C_ret( (arith)0).
782 C_sig ==> "move.l (.trppc), a0";
783 "move.l (sp)+, (.trppc)";
786 C_sim ==> "move.l (sp)+, (.trpim)".
789 $1 == 0 ==> "move.l (sp)+, a6".
790 $1 == 1 ==> "move.l (sp)+, sp".
791 $1 == 2 ==> "jsr (.strhp)".
792 default ==> arg_error( "str", $1).
794 C_trp ==> "jsr (.trp)".
796 /*****************************************************************************/
799 $2 == 1 ==> gen1( (ONE_BYTE) atoi( $1)).
800 $2 == 2 ==> gen2( (TWO_BYTES) atoi( $1)).
801 $2 == 4 ==> gen4( (FOUR_BYTES) atol( $1)).
802 default ==> arg_error( "icon", $2).
805 $2 == 1 ==> gen1( (ONE_BYTE) atoi( $1)).
806 $2 == 2 ==> gen2( (TWO_BYTES) atoi( $1)).
807 $2 == 4 ==> gen4( (FOUR_BYTES) atol( $1)).
808 default ==> arg_error( "icon", $2).
810 ..fcon ==> con_float($1, $2).
812 /*****************************************************************************/
818 C_locals ==> "link a6, #-$1".