Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-05 - 43,50337/16/ioed.mac
There are 2 other files named ioed.mac in the archive. Click here to see a list.
	SUBTTL	I/O editing routines

	SEARCH	SIMMAC,SIMMCR,SIMRPA
	SALL
	RTITLE	IOED
	MACINIT
	ERRMAC(IO)
	TWOSEG
	RELOC	400000

;AUTHOR:	Elisabeth Engstrom
;VERSION:	1
;PURPOSE:	Contains I/O editing routines:

intern	.IOIC	;Inchar
intern	.IOIF	;Infrac
intern	.IOII	;Inint
intern	.IOIR	;Inreal
intern	.IOIT	;Intext
intern	.IOOC	;Outchar
intern	.IOOF	;Outfrac
intern	.IOOI	;Outint
intern	.IOOR	;Outreal
intern	.IOOX	;Outfix
intern	.IOOT	;Outtext
intern	IOTXR	;[41] Return addr for calling TX GET routines
;


	EXTERN	.CSRA
	EXTERN	.CSSA.
	EXTERN	.IOFD
	EXTERN	.IOIG
	EXTERN	.IOLI
	EXTERN	.IOOG
	EXTERN	.SAAR
	EXTERN	.TXGC
	EXTERN	.TXGF
	EXTERN	.TXGI
	EXTERN	.TXGR
	EXTERN	.TXPF
	EXTERN	.TXPI
	EXTERN	.TXPR
	EXTERN	.TXPX
	EXTERN	.TXVA

QIOIMG==OFFSET(ZFIIMG)
QIOPOS==OFFSET(ZTVCP)+QIOIMG
	SUBTTL	IOIC


COMMENT;
PURPOSE:		IMPLEMENT INCHAR
ENTRY:			.IOIC
INPUT ARGUMENTS:	REG XTAC CONTAINING NUMBER OF XTOP
			REG XTOP CONTAINING REFERENCE TO FILE OBJECT
NORMAL EXIT:		RETURN
ERROR EXIT:		-
OUTPUT ARGUMENTS:	REG XTOP CONTAINING CHARACTER
CALL FORMAT:		MOVEI	XTAC,XTOP
			EXEC	.IOIC
;

.IOIC:
	PROC
	;SAVE REGS
	EXCH	XWAC1,(XTAC)
	STACK	XTAC
	LF	XSAC,ZTVLNG(XWAC1,QIOIMG)
	LF	X0,ZTVCP(XWAC1,QIOIMG)
	IF	;NO MORE IN CURRENT IMAGE
		CAMGE	X0,XSAC
		GOTO	FALSE
	THEN
		;CODE DIFFERS FROM COMMON BASE TO MAKE IT
		;POSSIBLE TO READ /*
		IF
			;CHECK FOR END OF FILE
			IFOFF	ZIFEND(XWAC1)
			GOTO	FALSE
		THEN
			IOERR	20,INCHAR: end of file
			GOTO	IOIC1
		FI
		;GET ANOTHER IMAGE
		EXEC	.IOIG
		SETZ	X0,	;POS=1
	FI
	LF	XSAC,ZTVSP(XWAC1,QIOIMG)
	ADD	XSAC,X0
	IDIVI	XSAC,5
	LF	X0,ZTVZTE(XWAC1,QIOIMG)
	ADDI	X0,ZTE%S(XSAC)
	ADD	X0,IOBY(XTAC)
	AOS	QIOPOS(XWAC1)
	ILDB	XWAC1,X0
IOIC1:
	UNSTK	XTAC
	EXCH	XWAC1,(XTAC)
	RETURN
	EPROC
	SUBTTL	IOIF


COMMENT;
PURPOSE:		IMPLEMENT INFRAC
ENTRY:			.IOIF
INPUT ARGUMENTS:	REG XTAC CONTAINING NUMBER OF XTOP
			REG XTOP CONTAINING FILE REF
NORMAL EXIT:		RETURN
ERROR EXIT:		-
OUTPUT ARGUMENTS:	FRACTION IN XTOP
CALL FORMAT:		MOVEI	XTAC,XTOP
			EXEC	.IOIF
;

.IOIF:	PROC
	EXCH	XWAC1,(XTAC)
	STACK	XWAC2
	;REG XTAC IS NOT DESTROYED IN IOTX
	LI	XSAC,.TXGF
	EXEC	IOTX
	UNSTK	XWAC2
	EXCH	XWAC1,(XTAC)
	RETURN
	EPROC
	SUBTTL	IOII


COMMENT;
PURPOSE:		IMPLEMENT ININT
ENTRY:			.IOII
INPUT ARGUMENTS:	REG XTAC CONTAINING NUMBER OF XTOP
			REG XTOP CONTAINING FILE REF
NORMAL EXIT:		RETURN
ERROR EXIT:		-
OUTPUT ARGUMENTS:	REG XTOP CONTAINING INTEGER
CALL FORMAT:		MOVEI	XTAC,XTOP
			EXEC	.IOII
;


.IOII:	PROC
	EXCH	XWAC1,(XTAC)
	STACK	XWAC2
	;REG XTAC IS NOT DESTROYED IN IOTX
	LI	XSAC,.TXGI
	EXEC	IOTX
	UNSTK	XWAC2
	EXCH	XWAC1,(XTAC)
	RETURN
	EPROC
	SUBTTL	IOIR


COMMENT;
PURPOSE:		IMPLEMENT INREAL
ENTRY:			.IOIR
INPUT ARGUMENTS:	REG XTAC CONTAINING NUMBER OF XTOP
			REG XTOP CONTAINING FILE REFERENCE
NORMAL EXIT:		RETURN
ERROR EXIT:		-
OUTPUT ARGUMENTS:	REGS XTOP, XTOP+1 CONTAINING LONG REAL ITEM
CALL FORMAT:		MOVEI	XTAC,XTOP
			EXEC	.IOIR
;


.IOIR:	PROC
	EXCH	XWAC1,(XTAC)
	EXCH	XWAC2,1(XTAC)
	;REG XTAC IS NOT DESTROYED IN IOTX
	LI	XSAC,.TXGR
	EXEC	IOTX
	EXCH	XWAC2,1(XTAC)
	EXCH	XWAC1,(XTAC)
	RETURN
	EPROC
	SUBTTL	IOTX

	;IOTX IS CALLED BY .IOIC,.IOIF AND .IOIR
	;FOR INPUT ARGUMENTS SEE CORRESPONDING ROUTINE
	;REG XWAC1 CONTAINS FILE REF, XSAC CONTAINS ADDRESS OF ROUTINE TO CALL

IOTX:	PROC
	LOWADR
	CDEFER
	;THIS CODE IS VALID ONLY IF ZTV = ZTVSP,,ZTVZTE
	;				  ZTVLNG,,ZTVCP
	STACK	XWAC3
	STACK	XTAC
	L	XWAC3,XSAC
	;CHECK IF LASTITEM
	STACK	XWAC1
	LI	XTAC,XWAC1
	EXEC	.IOLI
	IF
		JUMPE	XWAC1,FALSE
	THEN	;NO ITEM
		IOERR	21,ININT:INREAL:INFRAC: end of file
		UNSTK	XWAC1
		GOTO	IOTX1
	FI
	UNSTK	XWAC1

	;COMPUTE LENGTH OF SUBFIELD
	LF	X0,ZTVLNG(XWAC1,QIOIMG)
	LF	XSAC,ZTVCP(XWAC1,QIOIMG)
	SUBI	X0,(XSAC)
	;CHECK IF POS LENGTH
	IF
		JUMPGE	X0,FALSE
	THEN
		IOERR	22,ININT:INREAL:INFRAC: field length negative
	FI
	;CREATE TEXT VAR FOR SUBTEXT IMAGE(POS,LEN-POS+1)
	WLF	XTAC,ZFIIMG(XWAC1)
	HRLZ	XSAC,XSAC
	ADD	XTAC,XSAC
	ST	XTAC,YTXZTV(XLOW)
	HRLZM	X0,YTXZTV+1(XLOW)
	LI	XTAC,XWAC2
	LI	XWAC2,YTXZTV(XLOW)
	;GET CURRENT ITEM
	PUSHJ	XPDP,(XWAC3)
IOTXR:			;[41] Return addr from TX routines
	;ITEM IN XWAC2,XWAC3
	LF	X0,ZTVCP(XWAC1,QIOIMG)
	ADD	X0,YTXZTV+1(XLOW)
	SF	X0,ZTVCP(XWAC1,QIOIMG)
	LD	XWAC1,XWAC2
IOTX1:
	UNSTK	XTAC
	UNSTK	XWAC3
	CENABLE
	RETURN
	EPROC
	SUBTTL	IOIT


COMMENT ;
PURPOSE:		IMPLEMENT TEXT PROCEDURE INTEXT
ENTRY:			.IOIT
INPUT ARGUMENTS:	REG XTOP CONTAINING FILE REF
			REG XTOP+1 CONTAINING LENGTH OF TEXT TO BE COPIED
NORMAL EXIT:		RETURN
ERROR EXIT:		-
OUTPUT ARGUMENTS:	REG XTOP,XTOP+1 CONTAINING TEXT REF TO NEW TEXT
CALL FORMAT:		EXEC	.IOIT
			XWD	N,ADMAP		WHERE XTOP=XWAC1+N
;


.IOIT:	PROC
	LOWADR
	CDEFER
	HLRZ	XTAC,@(XPDP)
	LD	X0,XWAC1(XTAC)
	IF	;length=0
		JUMPN	X1,FALSE
	THEN	;NOTEXT is the answer
		SETZM	XWAC1(XTAC)	;Note that XWAC2(XTAC) is already zero
		AOS	(XPDP)		;[1] MUST SKIP PARAMETER WORD
		GOTO	L9
	FI
	ST	X0,YOBJAD(XLOW)
	ST	X1,YIOSAV(XLOW)
	SKIPE	XSAC,@(XPDP)
	EXEC	.CSSA.
	;LOAD TO STANDARD REGISTERS
	L	XWAC1,YOBJAD(XLOW)
	L	XWAC2,YIOSAV(XLOW)
	AOS	(XPDP)
	SETOM	YSANIN(XLOW)
	LI	XSAC,5*ZTE%S+5-1
	ADD	XSAC,XWAC2
	IDIVI	XSAC,5
	L	XTAC,XSAC
	HRLI	XTAC,QZTE
	EXEC	.SAAR

IFN QSADEA,<	;UPDATE YSADEA IN DEALLOCATE VER.
	L	X0,YSATOP(XLOW)
	ST	X0,YSADEA(XLOW)
	>

	L	XWAC1,YOBJAD(XLOW)
	;NEW TEXT REF ADDRESS IN XTAC
	WHILE	;LENGTH NEGATIVE OR GT 2^18-1
		TLNN	XWAC2,-1
		GOTO	FALSE
	DO
		;[41]:
		IOERC	QDSNIN,24,INTEXT: length out of range
		NEWVALUE XWAC2		;[41]
	OD
	STACK	XWAC3
	SF	XWAC2,ZTECLN(XTAC)
	STACK	XTAC
	ADD	XTAC,[POINT 7,ZTE%S]
	;COMPUTE BYTE POINTER TO TEXT VARIABLE
	LOOP
		LF	XWAC3,ZTVZTE(XWAC1,QIOIMG)
		LF	XSAC,ZTVCP(XWAC1,QIOIMG)
		LF	X0,ZTVSP(XWAC1,QIOIMG)
		ADDI	X0,(XSAC)
		IDIVI	X0,5
		ADDI	XWAC3,ZTE%S
		ADD	XWAC3,X0
		ADD	XWAC3,IOBY(XSAC)
		LF	XSAC,ZTVLNG(XWAC1,QIOIMG)
		LF	X0,ZTVCP(XWAC1,QIOIMG)
		SUB	XSAC,X0
	AS
		CAMG	XWAC2,XSAC
		GOTO	FALSE
		;NOT ENOUGH CHARACTERS IN CURRENT IMAGE.
		;TAKE CARE OF REMAINING ONES
		SUB	XWAC2,XSAC
		WHILE
			SOJL	XSAC,FALSE
		DO
			ILDB	X0,XWAC3
			IDPB	X0,XTAC
		OD
		;END OF FILE CHECK BEFORE INIMAGE, DIFFERS FROM COMMON BASE
		;TO MAKE IT POSSIBLE TO READ /*
		IF
			IFOFF	ZIFEND(XWAC1)
			GOTO	FALSE
		THEN
			IOERR	23,INTEXT: end of file
			GOTO	IOIT2
		FI
		;GET ANOTHER IMAGE
		STACK	XTAC
		EXEC	.IOIG
		UNSTK	XTAC
		GOTO	TRUE
	SA
	ADD	X0,XWAC2
	SF	X0,ZTVCP(XWAC1,QIOIMG)
	WHILE
		SOJL	XWAC2,FALSE
	DO
		ILDB	X0,XWAC3
		IDPB	X0,XTAC
	OD
IOIT2:
	UNSTK	XTAC
	LF	X0,ZTECLN(XTAC)
	ZF	ZTVCP(,XWAC1)	;[113]
	SF	X0,ZTVLNG(,XWAC1)
	HRRZ	XWAC1,XTAC
	SETZM	YOBJAD(XLOW)
	UNSTK	XWAC3
IOIT1:
	SKIPE	XSAC,YCSZAC(XLOW)
	BRANCH	.CSRA
L9():!	CENABLE
	RETURN
	EPROC
	SUBTTL	IOOC


COMMENT ;
PURPOSE:		IMPLEMENT OUTCHAR
ENTRY:			.IOOC
INPUT ARGUMENTS:	REG XWAC1 CONTAINING FILE REF
			REG XWAC3 CONTAINING CHARACTER
NORMAL EXIT:		RETURN
ERROR EXIT:		-
OUTPUT ARGUMENTS:	CHARACTER IN IMAGE
CALL FORMAT:		EXEC	.IOOC
;

.IOOC:
	PROC
	;CHECK IF ROOM IN IMAGE FOR CHARACTER
	LF	XSAC,ZTVCP(XWAC1,QIOIMG)
	LF	X0,ZTVLNG(XWAC1,QIOIMG)
	IF
		CAMGE	XSAC,X0
		GOTO	FALSE
	THEN
		;CALL OUTIMAGE
		EXEC	.IOOG
		SETZ	XSAC,	;POS=1
	FI
	;COMPUTE BYTE POINTER TO CURRENT POS
	;IN IMAGE
	LF	X0,ZTVZTE(XWAC1,QIOIMG)
	LF	XTAC,ZTVSP(XWAC1,QIOIMG)
	ADD	XSAC,XTAC
	IDIVI	XSAC,5
	ADDI	X0,ZTE%S(XSAC)
	ADD	X0,IOBY(XTAC)
	IDPB	XWAC3,X0
	AOS	QIOPOS(XWAC1)
	RETURN
	EPROC
	SUBTTL	IOOF


COMMENT ;
PURPOSE:		IMPLEMENT OUTFRAC
ENTRY:			.IOOF
INPUT ARGUMENTS:	REG XWAC1 CONTAINING FILE REF
			XWAC3 INTEGER VALUE
			XWAC4 NUMBER OF DIGITS IN FRACTION
			XWAC5 FIELD WIDTH
NORMAL EXIT:		RETURN FROM .TXPF
ERROR EXIT:		-
OUTPUT ARGUMENTS:
CALL FORMAT:		EXEC .IOOF
;

.IOOF:
	PROC
	STACK	XWAC2
	L	XWAC2,XWAC5
	EXEC	.IOFD
	UNSTK	XWAC2
	BRANCH	.TXPF
	EPROC
	SUBTTL	IOOI


COMMENT ;
PURPOSE:		IMPLEMENT OUTINT
ENTRY:			.IOOI
INPUT ARGUMENTS:	REG XWAC1 CONTAINING FILE REF
			XWAC3 INTEGER VALUE
			XWAC4 FIELD WIDTH
NORMAL EXIT:		RETURN FROM .TXPI
ERROR EXIT:		-
OUTPUT ARGUMENTS:	-
CALL FORMAT:		EXEC	.IOOI
;

.IOOI:
	PROC
	STACK	XWAC2
	;COMPUTE ADDR OF GLOBAL TEXT VARIABLE
	L	XWAC2,XWAC4
	EXEC	.IOFD
	UNSTK	XWAC2
	BRANCH	.TXPI
	EPROC
	SUBTTL	IOOR


COMMENT ;
PURPOSE:		IMPLEMENT OUTREAL
ENTRY:			.IOOR
INPUT ARGUMENTS:	REG XWAC1 CONTAINING FILE REF
			XWAC3-4 LONG REAL VALUE
			XWAC5 NUMBER OF SIGNIFICANT DIGITS
			XWAC6 FIELD WIDTH
NORMAL EXIT:		RETURN FROM .TXPR
ERROR EXIT:		-
OUTPUT ARGUMENTS:	-
CALL FORMAT:		EXEC	.IOOR
;

.IOOR:
	PROC
	STACK	XWAC2
	L	XWAC2,XWAC6
	EXEC	.IOFD
	UNSTK	XWAC2
	BRANCH	.TXPR
	EPROC
	SUBTTL	IOOX

COMMENT ;
PURPOSE:		IMPLEMENT OUTFIX
ENTRY:			.IOOX
INPUT ARGUMENTS:	REG XWAC1 CONTAINING FILE REF
			XWAC3-4 LONG REAL VALUE
			XWAC5 NUMBER OF DIGITS IN FRACTION
			XWAC6 FIELD WIDTH
NORMAL EXIT:		RETURN FROM .TXPX
ERROR EXIT:		-
OUTPUT ARGUMENTS:	-
CALL FORMAT:		EXEC	.IOOX
;

.IOOX:
	PROC
	STACK	XWAC2
	L	XWAC2,XWAC6
	EXEC	.IOFD
	UNSTK	XWAC2
	BRANCH	.TXPX
	EPROC
	SUBTTL	IOOT


COMMENT ;
PURPOSE:		IMPLEMENT OUTTEXT
ENTRY:			.
INPUT ARGUMENTS:	REG XWAC1 CONTAINING FILE REF
			XWAC3-4 TEXT REF
NORMAL EXIT:		RETURN
ERROR EXIT:		-
OUTPUT ARGUMENTS:	-
CALL FORMAT:		EXEC	.IOOT
;

.IOOT:
	PROC
	SAVE	<XWAC1,XWAC2>
	;COMPUTE ADDRESS OF TEXT VARIABLE
	LF	XWAC2,ZTVLNG(,XWAC3)
	IF	;Not NOTEXT
		JUMPE	XWAC2,FALSE
	THEN
		EXEC	.IOFD
		LD	XWAC1,(XWAC1)
		LI	XTAC,XWAC1
		EXEC	.TXVA
	FI
	RETURN
	EPROC
IOBY:
	;LEFT HAND OF BYTE POINTER BYTE SIZE=7
	XWD	440700,0
	XWD	350700,0
	XWD	260700,0
	XWD	170700,0
	XWD	100700,0
	XWD	010700,0
	SUBTTL	END OF IOED MODULE

	LIT
	END