Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-05 - 43,50337/23/trmop.mac
There is 1 other file named trmop.mac in the archive. Click here to see a list.
Comment ! SIMULA specification;
OPTIONS(/E:CODE,trmop);
INTEGER PROCEDURE trmop(funcod,iox,val);
INTEGER funcod,val; REF(Outfile)iox;
!
;! See  MONITOR CALLS 5.10.6 !
;! funcod in range	0000-0777 (octal): Perform specific action.
;!			1000-1777:	Read current value.
;!			2000-2777:	Set new value from val.
;!			1000-3777:	Reserved for DEC customers.


;! MACRO-10 code ;!

	TITLE	trmop

	ENTRY	trmop

;! Author: Lars Enderin June 1975 ;!

;! Makes TRMOP. monitor call accessible (with caution) from SIMULA.
;! On error, -1 is returned.
;! The value returned by TRMOP., if any, is returned as function value.
;! For funcod=1 or 2, however, a skip is represented as +1, noskip as 0
;! (allows test for i/o active on a terminal).

	SEARCH	macsim
	SALL
SPECIFY <
	PROC	trm,<funcod,iox,val>
	INTEGER	<trm,funcod,val>
	REF	iox
	>

	devnam=13	;! See IO modules and SIMRPA

trmop::	L	X1,iox	;! iox=NONE must be translated to own index
	CAIE	X1,NONE
	GOTO	L2
	PJOB		;! Job number this job
	TRMNO.		;! Get universal i/o index for the controlling terminal
	JSP	X1,L9	;! Error, should be impossible!
	GOTO	L3
L2:	L	devnam(X1)	;! Get i/o index corresponding to device
	IONDX.
	JSP	X1,L9
L3:	ST	iox		;! Now translate file ref to i/o index
	MOVEI	XWAC1,funcod
	HRLI	XWAC1,3
	L	funcod
	CAIGE	3000
	CAIGE	2000
	GOTO	L4
	;! Set code, salvage old value first
	SUBI	1000
	EXCH	funcod
	TRMOP.	XWAC1,
	JSP	X1,L9
	ST	XWAC1,trm
	EXCH	funcod
	MOVEI	funcod
	HRLI	3
	TRMOP.
	JSP	X1,L9
	GOTO	L8
L4:	TRMOP.	XWAC1,
	JSP	X1,L9	;! Error
	ST	XWAC1,trm
	GOTO	L8
L9:	SETOM	trm	;! -1 signals an error
L8:	L	funcod
	CAILE	2
	GOTO	L10
	JUMPE	L10
	LI	1
	AOSE	trm	;! no skip if trm=-1 here (same as error return) - translate to 0
	ST	trm	;! Otherwise, return 1 as value
L10:	RETURN
	end;