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)";
240 $1 == 8 ==> "jsr (.adf8)";
242 default ==> arg_error( "adf", $1).
245 $1 == 4 ==> "jsr (.sbf4)";
247 $1 == 8 ==> "jsr (.sbf8)";
249 default ==> arg_error( "sbf", $1).
252 $1 == 4 ==> "jsr (.mlf4)";
254 $1 == 8 ==> "jsr (.mlf8)";
256 default ==> arg_error( "mlf", $1).
259 $1 == 4 ==> "jsr (.dvf4)";
261 $1 == 8 ==> "jsr (.dvf8)";
263 default ==> arg_error( "dvf", $1).
266 $1 == 4 ==> "jsr (.ngf4)".
267 $1 == 8 ==> "jsr (.ngf8)".
268 default ==> arg_error( "ngf", $1).
271 $1 == 4 ==> C_lor((arith)1);
274 $1 == 8 ==> C_lor((arith)1);
277 default ==> arg_error( "fif", $1).
280 $1 == 4 ==> C_lor( (arith) 1);
283 $1 == 8 ==> C_lor((arith)1);
286 default ==> arg_error( "fef", $1).
288 /******************************************************************************/
290 /* Group 6 : Pointer arithmetic */
292 /******************************************************************************/
296 default ==> "add.l #$1, (sp)".
299 $1 == 4 ==> "move.l (sp)+, d0";
301 default ==> arg_error( "ads", $1).
304 $1 == 4 ==> "move.l (sp)+, d0";
306 default ==> arg_error( "sbs", $1).
308 /******************************************************************************/
310 /* Group 7 : Increment/decrement/zero */
312 /******************************************************************************/
314 C_inc ==> "add.l #1, (sp)".
316 C_inl ==> "add.l #1, ($1, a6)".
318 C_ine.. ==> "add.l #1, ($1+$2)".
320 C_dec ==> "sub.l #1, (sp)".
322 C_del ==> "sub.l #1, ($1, a6)".
324 C_dee.. ==> "sub.l #1, ($1+$2)".
326 C_zrl ==> "clr.l ($1, a6)".
328 C_zre.. ==> "clr.l ($1+$2)".
330 C_zrf ==> C_zer( $1).
333 $1 == 4 ==> "clr.l -(sp)".
334 $1 == 8 ==> "clr.l -(sp)";
336 default ==> "move.l #$1/4, d0";
342 /******************************************************************************/
344 /* Group 8 : Convert */
346 /******************************************************************************/
348 /* cii, ciu, cuu, cui are assumed to be called with legal arguments only */
350 C_cii ==> " move.l (sp)+, d0";
362 C_cuu ==> "lea (8,sp),sp".
364 C_ciu ==> "lea (8,sp),sp".
366 C_cui ==> "lea (8,sp),sp".
368 C_cfi ==> "jsr (.cfi)";
369 "move.l (4, sp), d0";
376 C_cfu ==> "jsr (.cfu)";
377 "move.l (4, sp), d0";
384 C_cff ==> "move.l (sp)+, d0";
400 C_cif ==> "move.l (sp)+, d0";
410 C_cuf ==> "move.l (sp)+, d0";
420 /******************************************************************************/
422 /* Group 9 : Logical */
424 /******************************************************************************/
427 $1 == 4 ==> "move.l (sp)+, d0";
429 default ==> "move.l #$1/4, d0";
438 $1 == 4 ==> "move.l (sp)+, d0";
440 default ==> "move.l #$1/4, d0";
449 $1 == 4 ==> "move.l (sp)+, d0";
451 default ==> "move.l #$1/4, d0";
460 $1 == 4 ==> "not.l (sp)".
461 $1 == 8 ==> "not.l (sp)";
463 default ==> "move.l #$1/4, d0";
471 $1 == 4 ==> "move.l (sp)+, d0";
475 default ==> arg_error( "rol", $1).
478 $1 == 4 ==> "move.l (sp)+, d0";
482 default ==> arg_error( "ror", $1).
485 /******************************************************************************/
487 /* Group 10 : Sets */
489 /******************************************************************************/
492 $1 == 4 ==> "move.l (sp)+, d0";
498 default ==> "move.l (sp)+, d0";
503 C_inn_narg ==> "move.l (sp)+, d1";
509 $1 == 4 ==> "move.l (sp)+, d0";
513 default ==> "move.l (sp)+, d0";
517 C_set_narg ==> "move.l (sp)+, d1";
521 /******************************************************************************/
523 /* Group 11 : Array */
525 /******************************************************************************/
527 C_lar ==> "move.l #$1, d0";
530 C_lar_narg ==> "move.l (sp)+, d0";
533 C_sar ==> "move.l #$1, d0";
536 C_sar_narg ==> "move.l (sp)+, d0";
539 C_aar ==> "move.l #$1, d0";
543 C_aar_narg ==> "move.l (sp)+, d0";
547 /******************************************************************************/
549 /* Group 12 : Compare */
551 /******************************************************************************/
554 $1 == 4 ==> "clr.l d0";
555 "cmp.l (sp)+, (sp)+";
561 "2 : move.l d0, -(sp)".
562 default ==> "move.l #$1, d0";
568 $1 == 4 ==> "clr.l d0";
569 "cmp.l (sp)+, (sp)+";
575 "2 : move.l d0, -(sp)".
577 default ==> "move.l #$1, d0";
581 C_cmu_narg ==> "move.l (sp)+, d0";
585 C_cms ==> "move.l #$1, d0";
589 C_cms_narg ==> "move.l (sp)+, d0";
593 C_cmp ==> C_cmu( (arith)4).
595 C_tlt ==> "move.l (sp), d0";
602 C_tle ==> "move.l (sp), d0";
609 C_teq ==> "move.l (sp), d0";
616 C_tne ==> "move.l (sp), d0";
623 C_tge ==> "move.l (sp), d0";
630 C_tgt ==> "move.l (sp), d0";
638 $1 == 4 ==> "jsr (.cmf4)";
641 $1 == 8 ==> "jsr (.cmf8)";
644 default ==> arg_error("cmf", $1).
646 /******************************************************************************/
648 /* Group 13 : Branch */
650 /******************************************************************************/
654 C_blt ==> "move.l (sp)+, d0";
658 C_ble ==> "move.l (sp)+, d0";
662 C_beq ==> "move.l (sp)+, d0";
666 C_bne ==> "move.l (sp)+, d0";
670 C_bge ==> "move.l (sp)+, d0";
674 C_bgt ==> "move.l (sp)+, d0";
678 C_zlt ==> "tst.l (sp)+";
681 C_zle ==> "tst.l (sp)+";
684 C_zeq ==> "tst.l (sp)+";
687 C_zne ==> "tst.l (sp)+";
690 C_zge ==> "tst.l (sp)+";
693 C_zgt ==> "tst.l (sp)+";
697 /******************************************************************************/
699 /* Group 14 : Procedure call instructions */
701 /******************************************************************************/
703 C_cai ==> "move.l (sp)+, a0";
706 C_cal ==> "jsr ($1)".
709 $1 == 4 ==> "move.l d0, -(sp)".
710 $1 == 8 ==> "move.l d1, -(sp)";
712 default ==> arg_error( "lfr", $1).
715 $1 == 0 ==> "unlk a6";
717 $1 == 4 ==> "move.l (sp)+, d0";
720 $1 == 8 ==> "move.l (sp)+, d0";
724 default ==> arg_error( "ret", $1).
726 /******************************************************************************/
728 /* Group 15 : Miscellaneous instructions */
730 /******************************************************************************/
733 small( $1) ==> "add.l #$1, sp".
734 default ==> "lea ($1, sp), sp".
737 $1 == 4 ==> "add.l (sp)+, sp".
738 default ==> arg_error( "ass", $1).
741 $1 == 4 ==> "move.l (sp)+, a0";
744 $1 == 8 ==> "move.l (sp)+, a0";
747 "move.l (4, a1), (4, a0)".
748 default ==> "move.l (sp)+, a0";
752 "move.l (a1)+, (a0)+";
757 $1 == 4 ==> "move.l (sp)+, d0";
763 "move.l (a1)+, (a0)+";
767 default ==> arg_error( "bls", $1).
771 $1 == 4 ==> "move.l (sp)+,a0";
774 default ==> arg_error( "csa", $1).
777 $1 == 4 ==> "move.l (sp)+,a0";
780 default ==> arg_error( "csb", $1).
782 C_dch ==> C_loi( (arith)4).
785 $1 == 4 ==> "move.l (sp), -(sp)".
786 $1 == 8 ==> "move.l (4, sp), -(sp)";
787 "move.l (4, sp), -(sp)".
788 default ==> "move.l #$1/4, d0";
791 "move.l -(a0), -(sp)";
796 $1 == 4 ==> "move.l (sp)+, d0";
797 "lea (0, sp, d0.l*1), a0";
801 "move.l -(a0), -(sp)";
805 default ==> arg_error( "dus", $1).
807 C_exg ==> "move.l #$1, d0";
810 C_fil.. ==> "move.l #$1+$2, (.filn)".
812 C_gto.. ==> "move.l #$1+$2, a0";
813 "move.l (8, a0), a6";
814 "move.l (4, a0), sp";
817 C_lim ==> "move.l (.trpim), -(sp)".
819 C_lin ==> "move.l #$1, (.lino)".
821 C_lni ==> "add.l #1, (.lino)".
824 $1 == 0 ==> "move.l a6, -(sp)".
825 $1 == 1 ==> "move.l sp, -(sp)".
826 $1 == 2 ==> "move.l (.reghp), -(sp)".
827 default ==> arg_error( "lor", $1).
829 C_lpb ==> C_adp( (arith)8).
831 C_mon ==> "jsr (.mon)".
836 $1 == 4 ==> "move.l (sp)+, a0";
840 "pea (1)"; /* push constant 1 == ERANGE */
842 "1: move.l d0, -(sp)".
843 default ==> arg_error( "rck", $1).
845 C_rtt ==> C_ret( (arith)0).
847 C_sig ==> "move.l (.trppc), a0";
848 "move.l (sp)+, (.trppc)";
851 C_sim ==> "move.l (sp)+, (.trpim)".
854 $1 == 0 ==> "move.l (sp)+, a6".
855 $1 == 1 ==> "move.l (sp)+, sp".
856 $1 == 2 ==> "jsr (.strhp)".
857 default ==> arg_error( "str", $1).
859 C_trp ==> "jsr (.trp)".
861 /*****************************************************************************/
864 $2 == 1 ==> gen1( (ONE_BYTE) atoi( $1)).
865 $2 == 2 ==> gen2( (TWO_BYTES) atoi( $1)).
866 $2 == 4 ==> gen4( (FOUR_BYTES) atol( $1)).
867 default ==> arg_error( "icon", $2).
870 $2 == 1 ==> gen1( (ONE_BYTE) atoi( $1)).
871 $2 == 2 ==> gen2( (TWO_BYTES) atoi( $1)).
872 $2 == 4 ==> gen4( (FOUR_BYTES) atol( $1)).
873 default ==> arg_error( "icon", $2).
875 ..fcon ==> con_float($1, $2).
877 /*****************************************************************************/
883 C_locals ==> "link a6, #-$1".
885 C_db_sline ==> "jsr (___u_LiB)".