Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-04 - 43,50325/ion.mac
There are no other files named ion.mac in the archive.
; File:   ION.MAC
;
;    This work was supported by the Advanced Research
;    Projects Agency of the Office of the Secretary of
;    Defense (F44620-73-C-0074) and is monitored by the
;    Air Force Office of Scientific Research.

;	SET CMUSW==1 FOR A CMU VERSION OF BLISS
;		OR ==0 FOR A STANDARD VERSION.  THE
;		CMU VERSION ACCEPTS THE FUNNY CMU PPN'S
;
;	SET BLIS11==1 FOR BLISS 11 COMPILER I/O MODULE (BL11IO)
;		OR ==0 FOR BLISS 10 COMPILER I/O MODULE (LOIO)
;
;	SET TIMSW==1 TO GENERATE TIMING HOOKS
;
;	SET NONREN==1 TO GENERATE NONSHARABLE CODE
;		OR ==0 FOR SHARABLE CODE
;
IFNDEF NONREN,<NONREN==0
		TWOSEG>	;ASSUME SHARABLE
	JOBREN==124
	LOC JOBREN
	XWD 0,RENADR

	JOB41==41
	LOC JOB41
	JFCL	; NOP FOR SIX12 UUO'S


IFE NONREN,<RELOC 400000>
IFN NONREN,<RELOC>

IFNDEF TIMSW,<TIMSW==0>
IFN TIMSW,<
    IF1,<PRINTX TIMING TURNED ON!!>>


BLIS11==1


IFNDEF CMUSW, <CMUSW==0>
IFNDEF BLIS11, <BLIS11==0>

IFE BLIS11, <
    TITLE BL10IO    BLISS COMPILER I/O  R. JOHNSSON  21-JUN-72
    IF1,<PRINTX BL10IO MODULE>
    IFE CMUSW, <
	IF1,<PRINTX STANDARD VERSION>
	DEFINE SUBTLE (STR) <
	SUBTTL BL10IO---STANDARD VERSION---STR
	PAGE >
	>
    IFN CMUSW, <
	IF1,<PRINTX CMU VERSION>
	DEFINE SUBTLE (STR) <
	SUBTTL BL10IO---CMU VERSION---STR
	PAGE >
	>
    >

IFN BLIS11, <
    TITLE BL11IO  BLISS COMPILER I/O  R. JOHNSSON  21-JUN-72
    IF1,<PRINTX BL11IO MODULE>
    IFE CMUSW, <
	IF1,<PRINTX STANDARD VERSION>
	DEFINE SUBTLE (STR) <
	SUBTTL BL11IO---STANDARD VERSION---STR
	PAGE >
	>
    IFN CMUSW, <
	IF1,<PRINTX CMU VERSION>
	DEFINE SUBTLE (STR) <
	SUBTTL BL11IO---CMU VERSION---STR
	PAGE >
	>
    >

DEFINE IFCMU <IFN CMUSW>
DEFINE IFB11 <IFN BLIS11>
DEFINE IFB10 <IFE BLIS11>


SUBTLE <DECLARATIONS>

; EXTERNALS

EXTERNAL	DOPAGE		; TRUE ==> A FORM FEED WAS SEEN
EXTERNAL	BUFFL		; LENGTH OF INPUT BUFFER
EXTERNAL	BUFF,PBUFF	; INPUT LINE BUFFER
EXTERNAL	PUNT		; ABORT COMPILATION ROUTINE
EXTERNAL	CURCHN		; CURRENT INPUT CHANNEL
EXTERNAL	BUFDATA		; HEAD OF IO BUFFER DATA STRUCTURE
EXTERNAL	SIX12		; TIMER/DEBUG MODULE
EXTERNAL	ERR8		; INPUT FILE ERROR ROUTINE
EXTERNAL	ERR12		; LINE TOO LONG
EXTERNAL	SEGCALL		; SEGMENT SWAPPER FOR OVERLAY
EXTERNAL	LMARG		; CONTAINS SEQUENCE NUMBER FOR LINED FILES
EXTERNAL	SOSPGC		; LOGICAL PAGE COUNT
EXTERNAL	RLS		; IO RELEASE ROUTINE
EXTERNAL	TTYLIS		; TTY OUTPUT ROUTINE
EXTERNAL	FLAGS		; CORE LOCATION OF COMPILER FLAGS
EXTERNAL	.ENT.1,.EXT.1	; BLISS ROUTINE PROLOG/EPILOG ROUTINES
EXTERNAL	PAGCNT		; PHYSICAL PAGE IN LOGICAL PAGE
INTERNAL	READTEXT	; CALLED BY COMPILER TO GET A LINE

$F=:2
$V=:3

; ACCUMULATOR ASSIGNMENTS

	P==0	; BLISS STACK POINTER
	CH==4	; INPUT CHANNEL NUMBER
	BU==5	; INPUT BUFFER HEADER ADDRESS
	W==6	; WORKING REGISTER
	J==7	; HOLDS CHARACTER
	N==12	; JSP REGISTER
	F==17	; FLAG REGISTER

; FLAG BITS OF INTEREST

	ENDBIT==40	; SCANNER HAS SEEN END OF CMD STRING
	FUNNY==100000	; 1 ==> DOING SOS PAGE MARK (CMU)
IFB11, <FINFLG==200>
IFB10, <FINFLG==200000> ; ALL SOURCE FILES HAVE BEEN READ

; I/O BIT MASKS

	IOEOF==20000	; END OF FILE STATUS BIT

; COMPILER CONSTANTS

	LSTCHN==3		; LISTING CHANNEL
	SRCCHN==4		; NORMAL SOURCE CHANNEL
	IOSEG==3		; NUMBER OF I/O HISEGMENT

; CALLI DEFINITIONS

	RESET==0
	EXIT==12

; SIX12 CALL UUO

IFN TIMSW,<OPDEF DEBUG [BYTE(9)37]>

SUBTLE <SOURCE INPUT ROUTINE>

DEFINE RENTRY(RNAME) <
	IFE TIMSW,<
RNAME:>
	IFN TIMSW,<
RNAME:	DEBUG	RNAME
>>

DEFINE REXIT(RNAME) <
	IFE TIMSW,<>
	IFN TIMSW,<
	DEBUG	1,RNAME
>>

RENTRY	READTEXT
	JSP	N,.ENT.1	; BLISS ROUTINE PROLOG
	ADD	P,[XWD 2,2]	; ALLOCATE 2 LOCALS
	DEFINE RDCNT<1($F)>	; GIVE IT A NAME
	DEFINE SAVRET<2($F)>	; ...
IFCMU,< PUSH	P,[0]
	PUSHJ	P,TTYLIS
	SUB	P,[XWD 1,1] >
	MOVE	F,FLAGS		; GET FLAGS OUT OF CORE
	MOVE	N,[POINT 7,BUFF-1,34]
	MOVEM	N,PBUFF
	MOVE	N, BUFFL
	MOVEM	N, RDCNT
	MOVEI	J, " "
	JSP	N, PACK
IFB10,< TLNE	F, FINFLG >
IFB11,< TRNE	F, FINFLG >
	JRST	RTEXIT
	MOVE	CH,CURCHN	; GET CHANNEL NUMBER
	HRRZ	BU,BUFDATA(CH)	; GET BUFFER HEADER ADDRESS
RTEXT1:	JSP	N,INCHR
	JSP	N,RTEXT3
RTEXT2:	SOSG	2(BU)
	PUSHJ	P,CHAR1	;GET A NEW BUFFER
	ILDB	J,1(BU)
RTEXT3:	CAIGE	J," "
	JRST	LOCHAR	;CONTROL CHARACTER
PACK:	SOSGE	RDCNT
	PUSHJ	P,ERR12	;LINE TOO LONG
	IDPB	J,PBUFF
	JRST	(N)	;LOOP
LOCHAR:	CAIN	J,11	;TAB
	JRST	PACK
	CAIN	J,15	;CR
	JRST	RTEXT4
	CAIE	J,14	;FF
	JRST	RTEXT2	;IGNORE
IFB11,<	AOS	SOSPGC		;YES, INCREMENT PAGE COUNT
	SETOM	PAGCNT		;RESET ACTUAL PAGE PER LOGICAL PAGE COUNT
	SETOM	DOPAGE >	;INDICATE FORM FEED WAS SEEN
IFB10,< SETOM	RPAGE >		; SPECIAL FF FLAG FOR BLIS10

IFB10,<
	MOVEI	J,15		; CR
RTEXT4:	JSP	N,PACK
RTEXIT:	MOVEI	J,177		; RUBOUT
	JSP	N,PACK
      >
IFB11,<
RTEXT4:
RTEXIT:	MOVEI	J,177		; RUBOUT
	JSP	N,PACK
	MOVEI	J,15		; CR
	JSP	N,PACK
      >
	MOVE  N,[POINT 7,BUFF-1,34]
	MOVEM N,PBUFF
	MOVEM	F,FLAGS		; RESTORE FLAGS FOR COMPILER
	SUB	P,[XWD 2,2]	; DEALLOCATE LOCALS
REXIT	READTEXT
	JRST	.EXT.1		; BLISS ROUTINE EPILOG


	SUBTLE<CHECK FOR SEQUENCE NUMBERS>
CHARA:	MOVEM	J,LMARG+1
IFCMU,<
	CAMN	J,[ASCII/     /]	; SKIP IF NOT AN SOS PAGE BREAK
	TRO	F, FUNNY		;INDICATE DOING SOS PAGE MARK
      >
	MOVNI	J,5
	ADDM	J,2(BU)
	AOS	1(BU)
INCHR:	SOSG	2(BU)
	PUSHJ	P,CHAR1
	IBP	1(BU)
	MOVE	J, @1(BU)
	TRZE	J,1
	JRST CHARA
IFCMU,<
	TRZE	F, FUNNY	;ARE WE DOING SOS PAGE MARK?
	JRST	INCHR		;YES, SKIP OVER THE 2ND CR
      >
	LDB	J,1(BU)
	CAIN	J,12		;LINE FEED?
	JRST	INCHR		;YES - IGNORE
	JUMPE	J, INCHR
	JRST	(N)		;NO, RETURN

	SUBTLE<GET A NEW BUFFER>

CHAR1:	XCT	INLST-1(CH)	; CALL MONITOR FOR A BUFFER
	POPJ	P,		;EXIT
	HRLZ	W,CH		;SET UP
	LSH	W,5		; CHANNEL NUMBER
	IOR	W,[STATO 0,IOEOF]; FOR STATO
	XCT	W
	PUSHJ	P,ERR8		; INPUT TRANSMISSION ERROR
	MOVEM	N,SAVRET	; SAVE RETURN OVER ROUTINE CALL
	CAIL	CH,SRCCHN+1	; ARE WE IN A REQUIRE?
	JRST	REQEOF		; YES-SPECIAL EOF PROCESSING
	PUSH	P,[SRCCHN]	; PARAMETER
	PUSHJ	P,RLS		; RELEASE CHANNEL
	SUB	P,[XWD 1,1]	; CLEAN UP STACK
	TRNE	F, ENDBIT	; END OF ALL INPUT FILES?
	JRST	CHAR2		; YES
	MOVEM	F,FLAGS		; PASS FLAGS TO INITIO
	PUSH	P,[1]		; CONTINUE SCAN IN INITIO
	PUSH	P,[IOSEG]	; OVERLAY SEGMENT NUMBER
	PUSHJ	P,SEGCALL	; CALL SEGMENT SWAPPER
	SUB	P,[XWD 2,2]	; CLEAN UP
	MOVE	F,FLAGS		; INITIO MAY HAVE CHANGED THEM
	TRNN	$V,1		; TEST FOR NORMAL RETURN
	PUSHJ	P,PUNT		; NO, INITIO ALREADY GAVE MESSAGE
	MOVE	CH,CURCHN	; CHANNEL NUMBER
	MOVE	BU,BUFDATA(CH)	; BUFFER HEADER
	MOVE	N,SAVRET	; RESTORE RETURN ADDRESS
	JRST	CHAR1		; NOW GO BACK AND GET THE NEW BUFFER

INLST:
	IN	1,0
	IN	2,0
	IN	3,0
	IN	4,0
	IN	5,0
	IN	6,0
	IN	7,0
	IN	10,0
	IN	11,0
	IN	12,0
	IN	13,0
	IN	14,0
	IN	15,0
	IN	16,0
	IN	17,0

REQEOF:	PUSH	P,CH		; CURRENT CHANNEL NUMBER
	PUSHJ	P,RLS		; RELEASE THE CHANNEL
	SUB	P,[XWD 1,1]	; CLEAN UP
	SOS	CH,CURCHN	; DECREMENT CHANNEL NUMBER
	HRRZ	BU,BUFDATA(CH)	; BUFFER HEADER
	MOVE	J,[ASCII/     /]
	MOVEM	J,LMARG+1	; BLANK OUT SEQUENCE NUMBER
	SUB	P,[XWD 1,1]	; REMOVE RETURN ADDRESS
	MOVEI	J,15		; CARRIAGE RETURN
	MOVE	N,SAVRET	; RESTORE RETURN ADDRESS
	JRST	(N)		; RETURN

CHAR2:
IFB10,< TLO	F,FINFLG >
IFB11,< TRO	F,FINFLG >	;TELL COMPILER WE'RE THROUGH
	SUB	P,[XWD 1,1]	; REMOVE RETURN ADDRESS
	MOVEI	J,15		; RETURN A CR
	JRST	RTEXT4

RENADR:	CLOSE	LSTCHN,0	; CLOSE LISTING FILE ON REENTRY
	CALLI	0,RESET		; DO NOT WRITE OTHER FILES
	CALLI	0,EXIT		; GO AWAY

	END