;;;;   Handy-dandy Midas macros and definitions   ;;;;;;;;;;;;;;;   The Uncola

	   arg==:0		    ?		.uso=:.uio %tjsio
	   argi=:1000,,		    ?		.bso=:.bio %tjsio
	    val=:2000,,		    ?		.uad=:.uao %tjdis
	 errcod=:3000,,		    ?		.bad=:.bao %tjdis
	  cbits=:4000,,		    ?		.uid=:.uio %tjdis
	 cbitsi=:5000,,		    ?		.bid=:.bio %tjdis

define syscal name, p0, p1, p2, p3, p4, p5, p6, p7, p10, p11, p12, p13, p14;
	 .call	[setz;
		   sixbit name;
		   ifsn [][p0][?p0] ifsn [][p1][?p1] ifsn [][p2][?p2] ifsn [][p3][?p3] ifsn [][p4][?p4] ifsn [][p5][?p5] ifsn [][p6][?p6] ifsn [][p7][?p7] ifsn [][p10][?p10] ifsn [][p11][?p11] ifsn [][p12][?p12] ifsn [][p13][?p13] ifsn [][p14][?p14]((setz))]

	termin 

define salloc length;						allocate stack

	ifdef stklen,[ifg <stklen-length>, stklen=length];
	 .else [   .m"stklen=length;
		       .m"sp=:17;
		     .m"call=:pushj  sp,
		   .m"return=:popj   sp,
		     .m"save=:push   sp,
		   .m"restor=:pop    sp,
		     .m"jstf=:jumpge sp,;	jump if stack full
		    .m"jstnf=:jumpl  sp,;	jump if stack not full
		    .m"stemp=:camg   sp, stack;	skip if stack fully popped
		   .m"stnemp=:camle  sp, stack;	skip if stack not fully popped

		define .m"callno sraddr, eraddr;   if stack ovrflw would occur
				   jstnf  .+2;	     then
				   call   eraddr;	jump to error handler
				   call   sraddr;    else call subroutine
			    termin 

		define .m"retno;         return if no stack overpop will occur
				   stemp;         else execution drops through
				   return;
			    termin 

		define .m"saveno value, eraddr;  if stack overflow would occur
				   jstnf  .+2;	   then
				   call   eraddr;      jump to error handler
				   save   value;   else push
			    termin 

		define .m"restno value, eraddr;		pop if stack not empty
				   stnemp;
				   call   eraddr;
				   restor value;
			    termin 

		move  sp, stack ];

	termin 

  suicide=:.logout 1,


