;;; System-Call Macro.

DEFINE $CALL PROC,IN,OUT,CTLB
	;COUNT ARGUMENTS
	.CLST.==0
	.CLCT. IN
	.CLCT. OUT
	.CLCT. CTLB

043000,,[SETZ
	.1STWD SIXBIT/PROC/
	.CLAG. 4000,CTLB
	.CLAG. 0,IN
	.CLAG. 2000,OUT
	IFN .CLST.,INFORM BAD FORMAT SYSTEM CALL - PROC
]
TERMIN

DEFINE .CLCT. ?A,B,C,D,E,F,G,H		;CROCK DUE TO IRP LOSS
IFNB [A] .CLST.==.CLST.+1
IFNB [B] .CLST.==.CLST.+1
IFNB [C] .CLST.==.CLST.+1
IFNB [D] .CLST.==.CLST.+1
IFNB [E] .CLST.==.CLST.+1
IFNB [F] .CLST.==.CLST.+1
IFNB [G] .CLST.==.CLST.+1
IFNB [H] .CLST.==.CLST.+1
TERMIN

;;; ARGUMENT POINTER GENERATOR FOR ABOVE
;;; A # INDICATES AN IMMEDIATE ARGUMENT

DEFINE .CLAG. BITS?A,B,C,D,E,F,G,H
IFNB [A] .CLG1. BITS,A
IFNB [B] .CLG1. BITS,B
IFNB [C] .CLG1. BITS,C
IFNB [D] .CLG1. BITS,D
IFNB [E] .CLG1. BITS,E
IFNB [F] .CLG1. BITS,F
IFNB [G] .CLG1. BITS,G
IFNB [H] .CLG1. BITS,H
TERMIN

DEFINE .CLG1. BITS?ARG
  .CLST.==.CLST.-1	;COUNT ARGS
  .CLG2.==0
  IRPNC 0,1,-1,CH,REST,[ARG]
    IFE "CH-"#,[ <IFE .CLST.,[400000]+BITS+1000>,,0*"CH+REST
		 .CLG2.==1	;the 0 times is per order rms
		]	;Immediate
    IFE "CH-"?,[ <IFE .CLST.,[400000]+3000>,,0*"CH+REST
		 .CLG2.==1
		]	;Error-code argument
    IFN "CH-40, .ISTOP	;STOP ON FIRST NON BLANK
  TERMIN
  IFE .CLG2., <IFE .CLST.,[400000]+BITS>,,ARG
TERMIN
