Google
 

Trailing-Edge - PDP-10 Archives - BB-K840A-BM_1981 - sources/sa.mac
There are 3 other files named sa.mac in the archive. Click here to see a list.
;TOPS-20 MACRO support for GIGI
;Slide Projector and Character-set Editor
;Rick Ace  NYIT

	SALL
	SEARCH MONSYM,MACSYM
T1==1
T2==2
T3==3
T4==4
AP==16				;FORTRAN ARGUMENT-LIST POINTER


;DATA AREAS FOR TEXTI JSYS

TIBI:	EXP TIBSZ-1		;INITIAL VALUES FOR ARG BLOCK
	RD%BEL+RD%CRF+RD%JFN
	.PRIIN,,.PRIOU		;JFNS
	-1,,IBUF		;DESTINATION STRING
	EXP IBUFSZ*5		;# OF BYTES IN DEST STRING
	-1,,IBUF		;BEGINNING OF DEST BUFFER
	POINT 36,0		;PROMPT STRING
TIBSZ==.-TIBI
IBUFSZ==^D25
TIB:	BLOCK TIBSZ		;TEXTI ARGUMENT BLOCK
IBUF:	BLOCK IBUFSZ		;TYPEIN BUFFER

;MISCELLANEOUS DATA

FF:	EXP -1			;FIRST-TIME FLAG FOR PUTC
ORGMOD:	EXP 0			;ORIGINAL TTY MODES
SUBTTL Character-set Editor / Slide Projector Subroutines

;SUBROUTINE MACRD1(PROMPT,BUF)
; DOES TEXTI JSYS TO READ A LINE FROM THE TERMINAL
; READING STOPS WHEN THE USER HITS CR OR LF
; THE CR AND/OR LF IS REPLACED BY A NULL
;  PROMPT: sv(sx(PROMPT STRING))
;  BUF:    sv(sx(STRING WHERE INPUT IS TO BE RETURNED))

MACRD1::MOVE T1,[TIBI,,TIB]	;COPY SKELETON TEXTI ARG BLOCK
	BLT T1,TIB+TIBSZ-1	; TO TIB
	MOVE T1,0(AP)		;GET ADDRESS OF PROMPT
	MOVE T1,(T1)
	HRRM T1,TIB+.RDRTY	;STUFF INTO TEXTI ARG BLOCK

	MOVE T1,TIB+.RDRTY	;GET POINTER TO PROMPT
	PSOUT			;WRITE PROMPT

	MOVEI T1,TIB		;GET ARG BLOCK ADDRESS
	TEXTI			;PROMPT AND READ REPLY
	 JFCL

;NOW TRANSFER THE INPUT TO THE CALLER'S BUFFER

	MOVE T1,[POINT 7,IBUF]	;GET POINTER TO INPUT
	MOVE T2,1(AP)		;GET POINTER TO CALLER'S BUFFER
	MOVE T2,(T2)
RD1:	ILDB T3,T1		;GET A CHARACTER
	CAIN T3,.CHLFD		;NEWLINE?
	SETZ T3,		;YES, REPLACE WITH A NULL
	MOVEM T3,(T2)		;GIVE IT TO THE CALLER
	AOS T2			;BUMP DESTINATION POINTER
	JUMPN T3,RD1		;LOOP UNTIL EOL HIT
	RET
;SUBROUTINE PUTC(CHARACTER)
; WRITES THE ARGUMENT CHARACTER TO THE TERMINAL

PUTC::	AOSG FF			;FIRST TIME?
	JRST [	MOVEI 1,.PRIOU	;YUP
		RFCOC
		TRO 3,400000	;SEND REAL ESCAPES, NOT $
		TRZ 3,200000
		SFCOC
		JRST .+1]
	MOVE 1,@0(AP)		;GET ARG
	CAIN 1,.CHLFD		;LINE-FEED?
	JRST [	HRROI 1,[ASCIZ/
/]				;YUP, SEND CR-LF
		PSOUT
		RET]
	PBOUT			;WRITE IT TO THE TERMINAL
	RET
;SUBROUTINE UTTY(FUNCTION)
; PERFORMS VARIOUS OPERATING-SYSTEM-DEPENDENT TERMINAL FUNCTIONS
; SEE GDEF FOR FUNCTION CODE DEFINITIONS

UTTY::	MOVEI 1,.PRIIN
	RFMOD			;GET TTY MODES IN AC2
	SKIPN ORGMOD		;FIRST TIME?
	MOVEM 2,ORGMOD		;YES, REMEMBER ORIGINAL MODES
	MOVE 4,@0(AP)		;GET FUNCTION CODE
	JRST UTV(4)		;DISPATCH
UTV:	0
	JRST [	MOVE 2,ORGMOD	;1 RESTORE ALL
		STPAR
		RET]
	JRST [	TXZ 2,TT%WID	;2 CLEAR OPERATING-SYSTEM WRAPAROUND
		STPAR
		RET]
	JRST UTV+1		;3 RESTORE O/S AUTOWRAP (HACK)
	JRST [	TXZ 2,TT%ECO	;4 CLEAR ECHO
		SFMOD
		RET]
	JRST [	TXO 2,TT%ECO	;5 SET ECHO
		SFMOD
		RET]
;SUBROUTINE WAITX(N)
; SUSPENDS PROGRAM FOR N SECONDS

WAITX::	MOVE 1,@0(AP)		;GET # OF SECONDS
	IMULI 1,^D1000		;CONVERT TO MILLISECONDS
	DISMS			;SLEEP FOR THAT LONG
	RET
;INTEGER FUNCTION IAND(ARG1,ARG2)
;		  IEOR(ARG1,ARG2)
;		  IOR(ARG1,ARG2)
; RETURNS LOGICAL "AND", "EOR", OR "OR" OF ARGUMENTS

IAND::	MOVE 0,@0(AP)
	AND 0,@1(AP)
	RET

IEOR::	MOVE 0,@0(AP)
	XOR 0,@1(AP)
	RET

IOR::	MOVE 0,@0(AP)
	OR 0,@1(AP)
	RET

	END