xref: /csrg-svn/usr.bin/pascal/pc2/langpats.c (revision 62112)
148060Sbostic /*-
2*62112Sbostic  * Copyright (c) 1979, 1984, 1993
3*62112Sbostic  *	The Regents of the University of California.  All rights reserved.
448060Sbostic  *
548060Sbostic  * %sccs.include.redist.c%
622272Sdist  */
72086Smckusick 
816964Smckusick #ifndef lint
9*62112Sbostic static char sccsid[] = "@(#)langpats.c	8.1 (Berkeley) 06/06/93";
1048060Sbostic #endif /* not lint */
112086Smckusick 
1216964Smckusick #include "inline.h"
1316964Smckusick 
142086Smckusick /*
1516964Smckusick  * Pattern table for Pascal library routines.
162086Smckusick  */
1716964Smckusick struct pats language_ptab[] = {
182086Smckusick 
1911877Smckusick #ifdef vax
209141Smckusick /*
2116964Smckusick  * General Pascal library routines
229141Smckusick  */
2324397Smckusick 	{ 2, "_ROUND\n",
2416964Smckusick "	movd	(sp)+,r0\n\
2516964Smckusick 	cvtrdl	r0,r0\n" },
262086Smckusick 
2724397Smckusick 	{ 2, "_TRUNC\n",
2816964Smckusick "	movd	(sp)+,r0\n\
2916964Smckusick 	cvtdl	r0,r0\n" },
302086Smckusick 
3124397Smckusick 	{ 1, "_ACTFILE\n",
329141Smckusick "	movl	(sp)+,r1\n\
339141Smckusick 	movl	12(r1),r0\n" },
349141Smckusick 
3524397Smckusick 	{ 2, "_FCALL\n",
3616964Smckusick "	movl	(sp)+,r5\n\
3716964Smckusick 	movl	(sp),r0\n\
3816964Smckusick 	movc3	4(r0),__disply+8,(r5)\n\
393437Smckusic 	movl	(sp)+,r0\n\
404015Smckusic 	movc3	4(r0),8(r0),__disply+8\n" },
412086Smckusick 
4224397Smckusick 	{ 2, "_FRTN\n",
433437Smckusic "	movl	(sp)+,r0\n\
4416964Smckusick 	movl	(sp)+,r5\n\
4516964Smckusick 	movc3	4(r0),(r5),__disply+8\n" },
462086Smckusick 
4724397Smckusick 	{ 3, "_FSAV\n",
4816964Smckusick "	movl	(sp)+,r3\n\
4916964Smckusick 	movl	(sp)+,r4\n\
5016964Smckusick 	movl	(sp),r5\n\
5116964Smckusick 	movl	r3,(r5)\n\
5216964Smckusick 	ashl	$3,r4,4(r5)\n\
5316964Smckusick 	movc3	4(r5),__disply+8,8(r5)\n\
544015Smckusic 	movl	(sp)+,r0\n" },
552086Smckusick 
569141Smckusick /*
579141Smckusick  * Pascal relational comparisons
589141Smckusick  */
5924397Smckusick 	{ 3, "_RELEQ\n",
6016964Smckusick "	movl	(sp)+,r0\n\
6116964Smckusick 	movl	(sp)+,r1\n\
6216964Smckusick 	movl	(sp)+,r3\n\
634015Smckusic 	movl	r0,r4\n\
642102Smckusic 1:\n\
652102Smckusic 	movzwl	$65535,r0\n\
662102Smckusic 	cmpl	r4,r0\n\
672195Smckusic 	jleq	3f\n\
682102Smckusic 	subl2	r0,r4\n\
692102Smckusic 	cmpc3	r0,(r1),(r3)\n\
702102Smckusic 	jeql	1b\n\
712102Smckusic 2:\n\
722195Smckusic 	clrl	r0\n\
732195Smckusic 	jbr	4f\n\
742195Smckusic 3:\n\
752102Smckusic 	cmpc3	r4,(r1),(r3)\n\
762195Smckusic 	jneq	2b\n\
772102Smckusic 	incl	r0\n\
782102Smckusic 4:\n" },
792086Smckusick 
8024397Smckusick 	{ 3, "_RELNE\n",
8116964Smckusick "	movl	(sp)+,r0\n\
8216964Smckusick 	movl	(sp)+,r1\n\
8316964Smckusick 	movl	(sp)+,r3\n\
844015Smckusic 	movl	r0,r4\n\
852086Smckusick 1:\n\
862102Smckusic 	movzwl	$65535,r0\n\
872102Smckusic 	cmpl	r4,r0\n\
882195Smckusic 	jleq	3f\n\
892102Smckusic 	subl2	r0,r4\n\
902102Smckusic 	cmpc3	r0,(r1),(r3)\n\
912102Smckusic 	jeql	1b\n\
922102Smckusic 2:\n\
932195Smckusic 	movl	$1,r0\n\
942195Smckusic 	jbr	4f\n\
952195Smckusic 3:\n\
962102Smckusic 	cmpc3	r4,(r1),(r3)\n\
972195Smckusic 	jneq	2b\n\
982102Smckusic 4:\n" },
992086Smckusick 
10024397Smckusick 	{ 3, "_RELSLT\n",
10116964Smckusick "	movl	(sp)+,r0\n\
10216964Smckusick 	movl	(sp)+,r1\n\
10316964Smckusick 	movl	(sp)+,r3\n\
1044015Smckusic 	movl	r0,r4\n\
1052195Smckusic 	jbr	2f\n\
1062102Smckusic 1:\n\
1072102Smckusic 	subl2	r0,r4\n\
1082102Smckusic 	cmpc3	r0,(r1),(r3)\n\
1092195Smckusic 	jneq	3f\n\
1102102Smckusic 2:\n\
1112195Smckusic 	movzwl	$65535,r0\n\
1122195Smckusic 	cmpl	r4,r0\n\
1132195Smckusic 	jgtr	1b\n\
1142102Smckusic 	cmpc3	r4,(r1),(r3)\n\
1152102Smckusic 3:\n\
1162102Smckusic 	jlss	4f\n\
1172086Smckusick 	clrl	r0\n\
1182102Smckusic 	jbr	5f\n\
1192102Smckusic 4:\n\
1202086Smckusick 	movl	$1,r0\n\
1212102Smckusic 5:\n" },
1222086Smckusick 
12324397Smckusick 	{ 3, "_RELSLE\n",
12416964Smckusick "	movl	(sp)+,r0\n\
12516964Smckusick 	movl	(sp)+,r1\n\
12616964Smckusick 	movl	(sp)+,r3\n\
1274015Smckusic 	movl	r0,r4\n\
1282195Smckusic 	jbr	2f\n\
1292102Smckusic 1:\n\
1302102Smckusic 	subl2	r0,r4\n\
1312102Smckusic 	cmpc3	r0,(r1),(r3)\n\
1322195Smckusic 	jneq	3f\n\
1332102Smckusic 2:\n\
1342195Smckusic 	movzwl	$65535,r0\n\
1352195Smckusic 	cmpl	r4,r0\n\
1362195Smckusic 	jgtr	1b\n\
1372102Smckusic 	cmpc3	r4,(r1),(r3)\n\
1382102Smckusic 3:\n\
1392102Smckusic 	jleq	4f\n\
1402086Smckusick 	clrl	r0\n\
1412102Smckusic 	jbr	5f\n\
1422102Smckusic 4:\n\
1432086Smckusick 	movl	$1,r0\n\
1442102Smckusic 5:\n" },
1452086Smckusick 
14624397Smckusick 	{ 3, "_RELSGT\n",
14716964Smckusick "	movl	(sp)+,r0\n\
14816964Smckusick 	movl	(sp)+,r1\n\
14916964Smckusick 	movl	(sp)+,r3\n\
1504015Smckusic 	movl	r0,r4\n\
1512195Smckusic 	jbr	2f\n\
1522102Smckusic 1:\n\
1532102Smckusic 	subl2	r0,r4\n\
1542102Smckusic 	cmpc3	r0,(r1),(r3)\n\
1552195Smckusic 	jneq	3f\n\
1562102Smckusic 2:\n\
1572195Smckusic 	movzwl	$65535,r0\n\
1582195Smckusic 	cmpl	r4,r0\n\
1592195Smckusic 	jgtr	1b\n\
1602102Smckusic 	cmpc3	r4,(r1),(r3)\n\
1612102Smckusic 3:\n\
1622102Smckusic 	jgtr	4f\n\
1632086Smckusick 	clrl	r0\n\
1642102Smckusic 	jbr	5f\n\
1652102Smckusic 4:\n\
1662086Smckusick 	movl	$1,r0\n\
1672102Smckusic 5:\n" },
1682086Smckusick 
16924397Smckusick 	{ 3, "_RELSGE\n",
17016964Smckusick "	movl	(sp)+,r0\n\
17116964Smckusick 	movl	(sp)+,r1\n\
17216964Smckusick 	movl	(sp)+,r3\n\
1734015Smckusic 	movl	r0,r4\n\
1742195Smckusic 	jbr	2f\n\
1752102Smckusic 1:\n\
1762102Smckusic 	subl2	r0,r4\n\
1772102Smckusic 	cmpc3	r0,(r1),(r3)\n\
1782195Smckusic 	jneq	3f\n\
1792102Smckusic 2:\n\
1802195Smckusic 	movzwl	$65535,r0\n\
1812195Smckusic 	cmpl	r4,r0\n\
1822195Smckusic 	jgtr	1b\n\
1832102Smckusic 	cmpc3	r4,(r1),(r3)\n\
1842102Smckusic 3:\n\
1852102Smckusic 	jgeq	4f\n\
1862086Smckusick 	clrl	r0\n\
1872102Smckusic 	jbr	5f\n\
1882102Smckusic 4:\n\
1892086Smckusick 	movl	$1,r0\n\
1902102Smckusic 5:\n" },
1912086Smckusick 
1929141Smckusick /*
1939141Smckusick  * Pascal set operations.
1949141Smckusick  */
19524397Smckusick 	{ 4, "_ADDT\n",
19616964Smckusick "	movl	(sp)+,r0\n\
19716964Smckusick 	movl	(sp)+,r1\n\
19816964Smckusick 	movl	(sp)+,r2\n\
19916964Smckusick 	movl	(sp)+,r4\n\
2002086Smckusick 	movl	r0,r3\n\
2012086Smckusick 1:\n\
2022086Smckusick 	bisl3	(r1)+,(r2)+,(r3)+\n\
2032086Smckusick 	sobgtr	r4,1b\n" },
2042086Smckusick 
20524397Smckusick 	{ 4, "_SUBT\n",
20616964Smckusick "	movl	(sp)+,r0\n\
20716964Smckusick 	movl	(sp)+,r1\n\
20816964Smckusick 	movl	(sp)+,r2\n\
20916964Smckusick 	movl	(sp)+,r4\n\
2102086Smckusick 	movl	r0,r3\n\
2112086Smckusick 1:\n\
2122086Smckusick 	bicl3	(r2)+,(r1)+,(r3)+\n\
2132086Smckusick 	sobgtr	r4,1b\n" },
2142086Smckusick 
21524397Smckusick 	{ 4, "_MULT\n",
21616964Smckusick "	movl	(sp)+,r0\n\
21716964Smckusick 	movl	(sp)+,r1\n\
21816964Smckusick 	movl	(sp)+,r2\n\
21916964Smckusick 	movl	(sp)+,r4\n\
2202086Smckusick 	movl	r0,r3\n\
2212086Smckusick 1:\n\
2222086Smckusick 	mcoml	(r1)+,r5\n\
2232086Smckusick 	bicl3	r5,(r2)+,(r3)+\n\
2242086Smckusick 	sobgtr	r4,1b\n" },
2252086Smckusick 
22624397Smckusick 	{ 4, "_IN\n",
22716964Smckusick "	movl	(sp)+,r1\n\
22816964Smckusick 	movl	(sp)+,r2\n\
22916964Smckusick 	movl	(sp)+,r3\n\
23016964Smckusick 	movl	(sp)+,r4\n\
2312230Smckusic 	clrl	r0\n\
2322195Smckusic 	subl2	r2,r1\n\
2332195Smckusic 	cmpl	r1,r3\n\
2342102Smckusic 	jgtru	1f\n\
2352195Smckusic 	jbc	r1,(r4),1f\n\
2362195Smckusic 	incl	r0\n\
2379141Smckusick 1:\n" },
2389141Smckusick 
2399141Smckusick /*
2409141Smckusick  * Pascal runtime checks
2419141Smckusick  */
24224397Smckusick 	{ 1, "_ASRT\n",
24316964Smckusick "	movl	(sp)+,r0\n\
24416964Smckusick 	tstl	r0\n\
2459141Smckusick 	jneq	1f\n\
2469141Smckusick 	pushl	$0\n\
2479141Smckusick 	pushl	$_EASRT\n\
2489141Smckusick 	calls	$2,_ERROR\n\
2499141Smckusick 1:\n" },
2509141Smckusick 
25124397Smckusick 	{ 2, "_ASRTS\n",
25216964Smckusick "	movl	(sp)+,r0\n\
25316964Smckusick 	movl	(sp)+,r1\n\
2549141Smckusick 	tstl	r0\n\
2559141Smckusick 	jneq	1f\n\
2569141Smckusick 	pushl	r1\n\
2579141Smckusick 	pushl	$_EASRTS\n\
2589141Smckusick 	calls	$2,_ERROR\n\
2599141Smckusick 1:\n" },
2609141Smckusick 
26124397Smckusick 	{ 1, "_CHR\n",
2629141Smckusick "	movl	(sp)+,r0\n\
2639141Smckusick 	cmpl	r0,$127\n\
2649141Smckusick 	jlequ	1f\n\
2659141Smckusick 	pushl	r0\n\
2669141Smckusick 	pushl	$_ECHR\n\
2679141Smckusick 	calls	$2,_ERROR\n\
2689141Smckusick 1:\n" },
2699141Smckusick 
27024397Smckusick 	{ 0, "_LINO\n",
2719141Smckusick "	incl	__stcnt\n\
2729141Smckusick 	cmpl	__stcnt,__stlim\n\
2739141Smckusick 	jlss	1f\n\
2749141Smckusick 	pushl	__stcnt\n\
2759141Smckusick 	pushl	$_ELINO\n\
2769141Smckusick 	calls	$2,_ERROR\n\
2779141Smckusick 1:\n" },
2789141Smckusick 
27924397Smckusick 	{ 1, "_NIL\n",
2809141Smckusick "	movl	(sp)+,r0\n\
2819141Smckusick 	cmpl	r0,__maxptr\n\
2829141Smckusick 	jgtr	1f\n\
2839141Smckusick 	cmpl	r0,__minptr\n\
2849141Smckusick 	jgeq	2f\n\
2859141Smckusick 1:\n\
2869141Smckusick 	pushl	$0\n\
2879141Smckusick 	pushl	$_ENIL\n\
2889141Smckusick 	calls	$2,_ERROR\n\
2899141Smckusick 2:\n" },
2909141Smckusick 
29124397Smckusick 	{ 2, "_RANDOM\n",
29216964Smckusick "	movd	(sp)+,r0\n\
2939141Smckusick 	emul	__seed,$1103515245,$0,r0\n\
2949141Smckusick 	ediv	$0x7fffffff,r0,r1,r0\n\
2959141Smckusick 	movl	r0,__seed\n\
2969141Smckusick 	cvtld	r0,r0\n\
2979141Smckusick 	divd2	$0d2.147483647e+09,r0\n" },
2989141Smckusick 
29924397Smckusick 	{ 3, "_RANG4\n",
30016964Smckusick "	movl	(sp)+,r0\n\
30116964Smckusick 	movl	(sp)+,r1\n\
30216964Smckusick 	movl	(sp)+,r2\n\
3039141Smckusick 	cmpl	r0,r1\n\
3049141Smckusick 	jlss	1f\n\
3059141Smckusick 	cmpl	r0,r2\n\
3069141Smckusick 	jleq	2f\n\
3079141Smckusick 1:\n\
3089141Smckusick 	pushl	r0\n\
3099141Smckusick 	pushl	$_ERANG\n\
3109141Smckusick 	calls	$2,_ERROR\n\
3119141Smckusick 2:\n" },
3129141Smckusick 
31324397Smckusick 	{ 2, "_RSNG4\n",
31416964Smckusick "	movl	(sp)+,r0\n\
31516964Smckusick 	movl	(sp)+,r1\n\
3169141Smckusick 	cmpl	r0,r1\n\
3179141Smckusick 	jlequ	1f\n\
3189141Smckusick 	pushl	r0\n\
3199141Smckusick 	pushl	$_ERANG\n\
3209141Smckusick 	calls	$2,_ERROR\n\
3219141Smckusick 1:\n" },
3229141Smckusick 
32324397Smckusick 	{ 1, "_SEED\n",
32416964Smckusick "	movl	(sp)+,r1\n\
32516964Smckusick 	movl	__seed,r0\n\
32616964Smckusick 	movl	r1,__seed\n" },
3279141Smckusick 
32824397Smckusick 	{ 3, "_SUBSC\n",
32916964Smckusick "	movl	(sp)+,r0\n\
33016964Smckusick 	movl	(sp)+,r1\n\
33116964Smckusick 	movl	(sp)+,r2\n\
3329141Smckusick 	cmpl	r0,r1\n\
3339141Smckusick 	jlss	1f\n\
3349141Smckusick 	cmpl	r0,r2\n\
3359141Smckusick 	jleq	2f\n\
3369141Smckusick 1:\n\
3379141Smckusick 	pushl	r0\n\
3389141Smckusick 	pushl	$_ESUBSC\n\
3399141Smckusick 	calls	$2,_ERROR\n\
3409141Smckusick 2:\n" },
3419141Smckusick 
34224397Smckusick 	{ 2, "_SUBSCZ\n",
34316964Smckusick "	movl	(sp)+,r0\n\
34416964Smckusick 	movl	(sp)+,r1\n\
3459141Smckusick 	cmpl	r0,r1\n\
3469141Smckusick 	jlequ	1f\n\
3479141Smckusick 	pushl	r0\n\
3489141Smckusick 	pushl	$_ESUBSC\n\
3499141Smckusick 	calls	$2,_ERROR\n\
3509141Smckusick 1:\n" },
35111877Smckusick #endif vax
3529141Smckusick 
35311877Smckusick #ifdef mc68000
35412871Smckusick /*
35512871Smckusick  * General Pascal library routines
35612871Smckusick  */
35724397Smckusick 	{ 1, "_ACTFILE\n",
35817204Smckusick "	movl	sp@+,a0\n\
35912871Smckusick 	movl	a0@(12),d0\n" },
36012871Smckusick 
36124397Smckusick 	{ 4, "_ADDT\n",
36217204Smckusick "	movl	sp@+,a0\n\
36317204Smckusick 	movl	sp@+,d0\n\
36417204Smckusick 	movl	sp@+,a1\n\
36517204Smckusick 	movl	sp@+,d1\n\
36617204Smckusick 	movl	a0,sp@-\n\
36717204Smckusick 	movl	a2,sp@-\n\
36817204Smckusick 	movl	d0,a2\n\
36912871Smckusick 	subql	#1,d1\n\
37012871Smckusick 1:\n\
37112871Smckusick 	movl	a2@+,d0\n\
37212871Smckusick 	orl	a1@+,d0\n\
37312871Smckusick 	movl	d0,a0@+\n\
37412871Smckusick 	dbra	d1,1b\n\
37512871Smckusick 	movl	sp@+,a2\n\
37617204Smckusick 	movl	sp@+,d0\n" },
37712871Smckusick 
37824397Smckusick 	{ 4, "_SUBT\n",
37917204Smckusick "	movl	sp@+,a0\n\
38017204Smckusick 	movl	sp@+,d0\n\
38117204Smckusick 	movl	sp@+,a1\n\
38217204Smckusick 	movl	sp@+,d1\n\
38317204Smckusick 	movl	a0,sp@-\n\
38417204Smckusick 	movl	a2,sp@-\n\
38517204Smckusick 	movl	d0,a2\n\
38612871Smckusick 	subql	#1,d1\n\
38712871Smckusick 1:\n\
38812871Smckusick 	movl	a1@+,d0\n\
38912871Smckusick 	notl	d0\n\
39012871Smckusick 	andl	a2@+,d0\n\
39112871Smckusick 	movl	d0,a0@+\n\
39212871Smckusick 	dbra	d1,1b\n\
39312871Smckusick 	movl	sp@+,a2\n\
39417204Smckusick 	movl	sp@+,d0\n" },
39512871Smckusick 
39624397Smckusick 	{ 4, "_MULT\n",
39717204Smckusick "	movl	sp@+,a0\n\
39817204Smckusick 	movl	sp@+,d0\n\
39917204Smckusick 	movl	sp@+,a1\n\
40017204Smckusick 	movl	sp@+,d1\n\
40117204Smckusick 	movl	a0,sp@-\n\
40217204Smckusick 	movl	a2,sp@-\n\
40317204Smckusick 	movl	d0,a2\n\
40412871Smckusick 	subql	#1,d1\n\
40512871Smckusick 1:\n\
40612871Smckusick 	movl	a2@+,d0\n\
40712871Smckusick 	andl	a1@+,d0\n\
40812871Smckusick 	movl	d0,a0@+\n\
40912871Smckusick 	dbra	d1,1b\n\
41012871Smckusick 	movl	sp@+,a2\n\
41117204Smckusick 	movl	sp@+,d0\n" },
41212871Smckusick 
41324397Smckusick 	{ 4, "_IN\n",
41417204Smckusick "	movl	sp@+,d0\n\
41517204Smckusick 	movl	sp@+,a0\n\
41617204Smckusick 	movl	sp@+,d1\n\
41717204Smckusick 	movl	sp@+,a1\n\
41817204Smckusick 	subl	a0,d0\n\
41917204Smckusick 	cmpl	d1,d0\n\
42015124Speter 	jhi	1f\n\
42117204Smckusick 	movl	d0,d1\n\
42217204Smckusick 	lsrl	#3,d1\n\
42317204Smckusick 	btst	d0,a1@(0,d1:l)\n\
42415124Speter 	jeq	1f\n\
42512871Smckusick 	moveq	#1,d0\n\
42615124Speter 	jra	2f\n\
42712871Smckusick 1:\n\
42812871Smckusick 	moveq	#0,d0\n\
42912871Smckusick 2:\n" },
43017204Smckusick 
43124397Smckusick 	{ 3, "_RANG4\n",
43217204Smckusick "	movl	sp@+,d0\n\
43317204Smckusick 	movl	sp@+,a0\n\
43417204Smckusick 	movl	sp@+,a1\n\
43517204Smckusick 	cmpl	a0,d0\n\
43615840Saoki 	jlt	1f\n\
43717204Smckusick 	cmpl	a1,d0\n\
43815840Saoki 	jle	2f\n\
43915840Saoki 1:\n\
44015840Saoki 	pea	_ERANG\n\
44115840Saoki 	jbsr	_ERROR\n\
44215840Saoki 	addqw	#4,sp\n\
44315840Saoki 2:\n" },
44424397Smckusick 	{ 2, "_RSNG4\n",
44517204Smckusick "	movl	sp@+,a0\n\
44617204Smckusick 	movl	sp@+,a1\n\
44717204Smckusick 	cmpl	a1,a0\n\
44815840Saoki 	jls	1f\n\
44915840Saoki 	pea	_ERANG\n\
45015840Saoki 	jbsr	_ERROR\n\
45115840Saoki 	addqw	#4,sp\n\
45215840Saoki 1:\n" },
45317204Smckusick 
45424397Smckusick 	{ 3, "_SUBSC\n",
45517204Smckusick "	movl	sp@+,d0\n\
45617204Smckusick 	movl	sp@+,a0\n\
45717204Smckusick 	movl	sp@+,a1\n\
45817204Smckusick 	cmpl	a0,d0\n\
45917204Smckusick 	jlt	1f\n\
46017204Smckusick 	cmpl	a1,d0\n\
46117204Smckusick 	jle	2f\n\
46217204Smckusick 1:\n\
46317204Smckusick 	pea	_ESUBSC\n\
46417204Smckusick 	jbsr	_ERROR\n\
46517204Smckusick 	addqw	#4,sp\n\
46617204Smckusick 2:\n" },
46717204Smckusick 
46824397Smckusick 	{ 2, "_SUBSCZ\n",
46917204Smckusick "	movl	sp@+,a0\n\
47017204Smckusick 	movl	sp@+,a1\n\
47117204Smckusick 	cmpl	a1,a0\n\
47217204Smckusick 	jls	1f\n\
47317204Smckusick 	pea	_ESUBSC\n\
47417204Smckusick 	jbsr	_ERROR\n\
47517204Smckusick 	addqw	#4,sp\n\
47617204Smckusick 1:\n" },
47717204Smckusick 
47811877Smckusick #endif mc68000
47911877Smckusick 
48030061Smckusick #ifdef tahoe
48130061Smckusick 	{ 2, "_TRUNC\n",
48230061Smckusick "	ldd	(sp)\n\
48330061Smckusick 	movab	8(sp),sp\n\
48430061Smckusick 	cvdl	r0\n" },
48530061Smckusick 
48630061Smckusick 	{ 1, "_ACTFILE\n",
48730061Smckusick "	movl	(sp)+,r1\n\
48830061Smckusick 	movl	12(r1),r0\n" },
48930061Smckusick 
49030061Smckusick /*
49130061Smckusick  * Pascal set operations.
49230061Smckusick  */
49330061Smckusick 
49430061Smckusick 	{ 4, "_ADDT\n",
49530061Smckusick "	movl	(sp)+,r0\n\
49630061Smckusick 	movl	(sp)+,r1\n\
49730061Smckusick 	movl	(sp)+,r2\n\
49830841Smckusick 	movl	(sp)+,r3\n\
49930841Smckusick 	clrl	r4\n\
50030061Smckusick 1:\n\
50130841Smckusick 	orl3	(r1)[r4],(r2)[r4],(r0)[r4]\n\
50230841Smckusick 	aoblss	r3,r4,1b\n" },
50330061Smckusick 
50430061Smckusick 	{ 4, "_SUBT\n",
50530061Smckusick "	movl	(sp)+,r0\n\
50630061Smckusick 	movl	(sp)+,r1\n\
50730061Smckusick 	movl	(sp)+,r2\n\
50830841Smckusick 	movl	(sp)+,r3\n\
50930841Smckusick 	decl	r3\n\
51030061Smckusick 1:\n\
51130841Smckusick 	mcoml	(r2)[r3],r4\n\
51230841Smckusick 	andl3	r4,(r1)[r3],(r0)[r3]\n\
51330841Smckusick 	decl	r3\n\
51430841Smckusick 	jgeq	1b\n" },
51530061Smckusick 
51630061Smckusick 	{ 4, "_MULT\n",
51730061Smckusick "	movl	(sp)+,r0\n\
51830061Smckusick 	movl	(sp)+,r1\n\
51930061Smckusick 	movl	(sp)+,r2\n\
52030841Smckusick 	movl	(sp)+,r3\n\
52130841Smckusick 	clrl	r4\n\
52230061Smckusick 1:\n\
52330841Smckusick 	andl3	(r1)[r4],(r2)[r4],(r0)[r4]\n\
52430841Smckusick 	aoblss	r3,r4,1b\n" },
52530061Smckusick 
52630093Smckusick 	{ 4, "_IN\n",
52730093Smckusick "	movl	(sp)+,r1\n\
52830093Smckusick 	movl	(sp)+,r2\n\
52930093Smckusick 	movl	(sp)+,r3\n\
53030093Smckusick 	movl	(sp)+,r4\n\
53130093Smckusick 	clrl	r0\n\
53230093Smckusick 	subl2	r2,r1\n\
53330093Smckusick 	cmpl	r1,r3\n\
53430093Smckusick 	jgtru	1f\n\
53530093Smckusick 	shrl	$3,r1,r2\n\
53630093Smckusick 	movzbl	(r4)[r2],r3\n\
53730093Smckusick 	andl2	$7,r1\n\
53830093Smckusick 	jbc	r1,r3,1f\n\
53930093Smckusick 	incl	r0\n\
54030093Smckusick 1:\n" },
54130093Smckusick 
54230061Smckusick /*
54330061Smckusick  * Pascal runtime checks
54430061Smckusick  */
54530061Smckusick 	{ 1, "_ASRT\n",
54630061Smckusick "	movl	(sp)+,r0\n\
54730061Smckusick 	tstl	r0\n\
54830061Smckusick 	jneq	1f\n\
54930061Smckusick 	pushl	$0\n\
55030061Smckusick 	pushl	$_EASRT\n\
55130061Smckusick 	callf	$12,_ERROR\n\
55230061Smckusick 1:\n" },
55330061Smckusick 
55430061Smckusick 	{ 2, "_ASRTS\n",
55530061Smckusick "	movl	(sp)+,r0\n\
55630061Smckusick 	movl	(sp)+,r1\n\
55730061Smckusick 	tstl	r0\n\
55830061Smckusick 	jneq	1f\n\
55930061Smckusick 	pushl	r1\n\
56030061Smckusick 	pushl	$_EASRTS\n\
56130061Smckusick 	callf	$12,_ERROR\n\
56230061Smckusick 1:\n" },
56330061Smckusick 
56430061Smckusick 	{ 1, "_CHR\n",
56530061Smckusick "	movl	(sp)+,r0\n\
56630061Smckusick 	cmpl	r0,$127\n\
56730061Smckusick 	jlequ	1f\n\
56830061Smckusick 	pushl	r0\n\
56930061Smckusick 	pushl	$_ECHR\n\
57030061Smckusick 	callf	$12,_ERROR\n\
57130061Smckusick 1:\n" },
57230061Smckusick 
57330061Smckusick 	{ 0, "_LINO\n",
57430061Smckusick "	incl	__stcnt\n\
57530061Smckusick 	cmpl	__stcnt,__stlim\n\
57630061Smckusick 	jlss	1f\n\
57730061Smckusick 	pushl	__stcnt\n\
57830061Smckusick 	pushl	$_ELINO\n\
57930061Smckusick 	callf	$12,_ERROR\n\
58030061Smckusick 1:\n" },
58130061Smckusick 
58230061Smckusick 	{ 1, "_NIL\n",
58330061Smckusick "	movl	(sp)+,r0\n\
58430061Smckusick 	cmpl	r0,__maxptr\n\
58530061Smckusick 	jgtr	1f\n\
58630061Smckusick 	cmpl	r0,__minptr\n\
58730061Smckusick 	jgeq	2f\n\
58830061Smckusick 1:\n\
58930061Smckusick 	pushl	$0\n\
59030061Smckusick 	pushl	$_ENIL\n\
59130061Smckusick 	callf	$12,_ERROR\n\
59230061Smckusick 2:\n" },
59330061Smckusick 
59430061Smckusick 	{ 3, "_RANG4\n",
59530061Smckusick "	movl	(sp)+,r0\n\
59630061Smckusick 	movl	(sp)+,r1\n\
59730061Smckusick 	movl	(sp)+,r2\n\
59830061Smckusick 	cmpl	r0,r1\n\
59930061Smckusick 	jlss	1f\n\
60030061Smckusick 	cmpl	r0,r2\n\
60130061Smckusick 	jleq	2f\n\
60230061Smckusick 1:\n\
60330061Smckusick 	pushl	r0\n\
60430061Smckusick 	pushl	$_ERANG\n\
60530061Smckusick 	callf	$12,_ERROR\n\
60630061Smckusick 2:\n" },
60730061Smckusick 
60830061Smckusick 	{ 2, "_RSNG4\n",
60930061Smckusick "	movl	(sp)+,r0\n\
61030061Smckusick 	movl	(sp)+,r1\n\
61130061Smckusick 	cmpl	r0,r1\n\
61230061Smckusick 	jlequ	1f\n\
61330061Smckusick 	pushl	r0\n\
61430061Smckusick 	pushl	$_ERANG\n\
61530061Smckusick 	callf	$12,_ERROR\n\
61630061Smckusick 1:\n" },
61730061Smckusick 
61830061Smckusick 	{ 1, "_SEED\n",
61930061Smckusick "	movl	(sp)+,r1\n\
62030061Smckusick 	movl	__seed,r0\n\
62130061Smckusick 	movl	r1,__seed\n" },
62230061Smckusick 
62330061Smckusick 	{ 3, "_SUBSC\n",
62430061Smckusick "	movl	(sp)+,r0\n\
62530061Smckusick 	movl	(sp)+,r1\n\
62630061Smckusick 	movl	(sp)+,r2\n\
62730061Smckusick 	cmpl	r0,r1\n\
62830061Smckusick 	jlss	1f\n\
62930061Smckusick 	cmpl	r0,r2\n\
63030061Smckusick 	jleq	2f\n\
63130061Smckusick 1:\n\
63230061Smckusick 	pushl	r0\n\
63330061Smckusick 	pushl	$_ESUBSC\n\
63430061Smckusick 	callf	$12,_ERROR\n\
63530061Smckusick 2:\n" },
63630061Smckusick 
63730061Smckusick 	{ 2, "_SUBSCZ\n",
63830061Smckusick "	movl	(sp)+,r0\n\
63930061Smckusick 	movl	(sp)+,r1\n\
64030061Smckusick 	cmpl	r0,r1\n\
64130061Smckusick 	jlequ	1f\n\
64230061Smckusick 	pushl	r0\n\
64330061Smckusick 	pushl	$_ESUBSC\n\
64430061Smckusick 	callf	$12,_ERROR\n\
64530061Smckusick 1:\n" },
64630061Smckusick #endif tahoe
64730061Smckusick 
64824397Smckusick 	{ 0, "", "" }
6492086Smckusick };
650