Google
 

Trailing-Edge - PDP-10 Archives - SRI_NIC_PERM_SRC_3_19910112 - mm/mmuuo.mac
There are 2 other files named mmuuo.mac in the archive. Click here to see a list.
	TITLE MMUUO - UUO handler for MM
	SUBTTL UUO handler/MMcM/MRC

	SEARCH MACSYM,MONSYM
	SALL			;Suppress macro expansions
	ASUPPRESS		;Save some symbol table space
	.DIRECTIVE FLBLST	;Sane listings for ASCIZ, etc.

	EXTERN CMDINI,CMDRET,CMDRES,UNTAK0
	EXTERN CMDBLK,CMDFLB,CMDNO1,TPADDR,CLEVEL
	EXTERN STRBUF
	EXTERN F%TAK,F%HOER,MSGLEN

;;;AC's - must match MM.MAC

F==:0				;Flags
A=:1				;Temp and JSYS
B=:2				;Ditto
C=:3				;Ditto
D=:4				;Ditto
E=:5				;Temp & local to routine
T=:6				;Ditto
U=:7				;Ditto
V=:10				;Ditto 
W=:11				;Ditto
L=:12
M=:13				;Current message if any
N=:14
O=:15
;CX=:16				;MACSYM temporary AC
;P=:17

.JBUUO=40			;UUO saved here

	.PSECT DATA

UUOACS:	BLOCK 17		;AC's during LUUO call

	.ENDPS
	.PSECT CODE
UUOH::	MOVEM 16,UUOACS+16	;Save all AC's
	MOVEI 16,UUOACS
	BLT 16,UUOACS+15
	LDB A,[POINT 9,.JBUUO,8] ;Get opcode field
	CAIL A,MAXUUO
	 SETZ A,		;UUO is invalid
	CALL @UUOS(A)		;Do the right routine
	MOVSI 16,UUOACS		;Restore ac's
	BLT 16,16
	RET

UUOS:	%ILUUO
	%PRINT
	%TYPE
	%ETYPE
	%ERROR
	%NOISE
	%DEFAL
	%PRMPT
	%HELP
MAXUUO==.-UUOS

%ILUUO:	HRROI A,[ASCIZ/Invalid UUO /]
	ESOUT%
	MOVX A,.PRIOU
	MOVE B,.JBUUO
	MOVE C,[NO%MAG!NO%LFL!NO%ZRO!<^D12,,^D8>]
	NOUT%
	 NOP
	HRROI A,[ASCIZ/ at /]
	PSOUT%
	MOVX A,.PRIOU
	SOS B,-1(P)		;Get failing PC
	HRRZS B
	MOVE C,[NO%LFL!NO%ZRO+<6,,^D8>]
	NOUT%
	 NOP
	HALTF%
	RET
EOL==:.CHCUN			;Newline for PRINT UUO

%PRINT:	HRRZ A,.JBUUO		;Get byte
	CAIN A,EOL		;Print EOL means do CRLF
	 JRST CRLF
%PRIN0:	PBOUT%
	RET

%TYPE:	CALL TYCRIF		;Check if we should do a CRLF
%TYPE0:	HRRO A,.JBUUO		;Get string
	PSOUT%
	RET

%PRMPT:	SETZM CLEVEL
	HRLZ A,.JBUUO		;Get prompt string
	CALL CMDINI		;Setup that as prompt
	SETZM TPADDR		;Definitely do NOT return here
	RET

TYCRIF:	MOVE A,.JBUUO		;Get instruction
	TLNE A,(<10,0>)		;Wants cr all the time?
	 JRST CRLF		;Yes
	TLNE A,(<1,0>)		;Wants fresh line?
	 JRST CRIF		;Yes
	RET

CRIF::	SAVEAC <A,B>
	MOVX A,.PRIOU
	RFPOS%
	HRROI A,CRLF0
	TXNE B,.RHALF		;If not at start of line,
	 PSOUT%			;Type crlf
	RET

CRLF::	SAVEAC <A>
	HRROI A,CRLF0
	PSOUT%
	RET

CRLF0::	ASCIZ/
/
%ERROR:	CALL CRIF		;Get a fresh line
	MOVE B,.JBUUO		;Get instruction
	TXNE B,<10,0>		;Wants %?
	 SKIPA A,["?"]		;No
	  MOVEI A,"%"
	PBOUT%
	IFXN. B,.RHALF		;Any message to print?
	  CALL %ETYE0		;Yes, print it out
	  MOVE B,.JBUUO		;And recover instruction
	ENDIF.
	IFXN. B,<<4,0>>		;Wants JSYS error message?
	  HRROI A,[ASCIZ/ - /]
	  TXNE B,.RHALF		;If a previous message, type delimiter
	   PSOUT%
	  MOVX A,.PRIOU
	  HRLOI B,.FHSLF	;This fork
	  SETZ C,
	  ERSTR%
	   NOP
	   NOP
	  MOVEI A,.FHSLF	;Yes, check last error
	  GETER%
	  HRRZS B		;Only want error code
	  CAIL B,NPXAMB		;One of the CM%NOP errors?
	   CAILE B,NPXCMA
	ANSKP.
	  LDB A,[POINT 7,STRBUF,6] ;Yes, look like anything in atom buffer?
	ANDN. A			;No
	  TMSG < - ">
	  HRROI A,STRBUF	;Now output atom buffer
	  PSOUT%
	  TMSG <"
>
	ENDIF.
	MOVE B,.JBUUO		;Get instruction
	TXNE B,<10,0>		;"?" error?
	 TRZN F,F%TAK		;Yes, in a TAKE file?
	 IFSKP.
	   HRROI A,[ASCIZ/Error in TAKE file, file aborted
/]
	   ESOUT%		;Indicate TAKE file aborted
	   HLRZ A,CMDBLK+.CMIOJ	;Get TAKE file JFN back
	   CALL UNTAK0		;Leave TAKE file
	 ENDIF.
	LDB A,[POINT 2,.JBUUO,12] ;Get low order bits of ac field
	TRZE F,F%HOER		;Doing MAIL "monitor command"?
	 HALTF%			;Yes, return to EXEC, allow continue
	XCT %ERRS(A)
	JRST %FATAL		;Shouldn't happen

%ERRS:	JRST CMDRES		;0 - return to top level commands
	XCT CMDRET		;1 - user settable return
	JRST %FATAL		;2 - return to exec
	RET			;3 - return to user

%FATAL:	HALTF%
	HRROI A,[ASCIZ/Can't continue
/]
	ESOUT%
	JRST %FATAL
%ETYPE:	CALL TYCRIF		;Type a CR maybe
%ETYE0:	HRRZ U,.JBUUO
%ETYS0:	HRLI U,(<POINT 7,>)	;Get byte pointer to string
%ETYP1:	ILDB A,U		;Get char
	JUMPE A,R		;Done
	CAIE A,"%"		;Escape code?
	 JRST %ETYP0		;No, just print it out
	SETZ V,			;Reset ac
%ETYP2:	ILDB A,U
	CAIL A,"0"		;Is it part of addr spec?
	 CAILE A,"7"
	  JRST %ETYP3		;No
	IMULI V,10		;Yes, increment address
	ADDI V,-"0"(A)
	JRST %ETYP2
%ETYP3:	CAIG A,"Z"
	 CAIGE A,"A"
	  JRST %ETYP0
	CALL @%ETYTB-"A"(A)	;Do dep't thing
	JRST %ETYP1

%ETYP0:	PBOUT%
	JRST %ETYP1

%ETYTB:	%ETYPA			;A - print time
	%ETYPB			;B - print date
	%ETYP0			;C
	%ETYPD			;D - print decimal
	%ETYER			;E - error code
	%ETYPF			;F - floating
	%ETYP0			;G
	%ETYPH			;H - RH as octal
	%ETYP0			;I
	%ETYPJ			;J - file name
	REPEAT 2,<%ETYP0>	;K, L
	%ETYPM			;M - current msg number
	%ETYP0			;N
	%ETYPO			;O - octal
	%ETYPP			;P - pluralizer
	%ETYP0			;Q
	%ETYPR			;R - raw string w/o % processing
	%ETYPS			;S - string
	%ETYPT			;T - date and time
	%ETYPU			;U - user name
	REPEAT 5,<%ETYP0>	;V, W, X, Y, Z
%ETYPA:	MOVX C,OT%NDA		;No day, just time
	JRST %ETYB0

%ETYPT:	TDZA C,C		;Both date and time
%ETYPB:	 MOVSI C,(OT%NTM)	;No time, just day
%ETYB0:	JUMPE V,.+2		;If ac field spec'd
	 SKIPA B,UUOACS(V)	;Use it
	  SETO B,		;Else use now
	MOVX A,.PRIOU
	ODTIM%
	RET

%ETYPD:	SKIPA C,[^D10]		;Decimal
%ETYPO:	 MOVEI C,^D8		;Octal
	MOVE B,UUOACS(V)	;Get data
%ETYO0:	MOVX A,.PRIOU
	NOUT%
	 NOP
	RET

%ETYER:	MOVX A,.PRIOU
	MOVSI B,.FHSLF		;This fork
	HRR B,UUOACS(V)		;Get error code
	ERSTR%
	 NOP
	 NOP
	RET

%ETYPM:	HRRZ B,UUOACS+M		;Current message
	IDIVI B,MSGLEN
	MOVEI C,^D10		;Decimal
	AOJA B,%ETYO0		;Zero is msg 1

%ETYPF:	MOVX A,.PRIOU
	MOVE B,UUOACS(V)
	SETZ C,
	FLOUT%
	 NOP
	RET
%ETYPH:	MOVEI C,^D8
	HRRZ B,UUOACS(V)
	JRST %ETYO0

%ETYPJ:	MOVX A,.PRIOU
	HRRZ B,UUOACS(V)
	MOVE C,[211110,,1]	;Def dev, frc, dir, name, etc
	JFNS%
	RET

%ETYPP:	MOVEI A,"s"
	MOVE B,UUOACS(V)
	CAIE B,1
	 PBOUT%			;Make plural unless just one
	RET

%ETYPR:	SKIPN A,UUOACS(V)
	 RET
	HRLI A,(<POINT 7,>)	;Get byte pointer to string
	PSOUT%
	RET

%ETYPS:	PUSH P,U
	SKIPE U,UUOACS(V)
	 CALL %ETYS0		;Recursive call
CPOPUJ:	POP P,U
	RET

%ETYPU:	MOVX A,.PRIOU
	MOVE B,UUOACS(V)
	DIRST%
	 NOP
	RET
;;;Parse noise word
%NOISE:	MOVSI A,(<BYTE (9) .CMNOI,0>)
	MOVEM A,CMDFLB+.CMFNP
	HRRO A,.JBUUO
	JRST CMDNO1

;;;Set up a default
%DEFAL:	HRRZ B,.JBUUO
	HRROM B,CMDFLB+.CMDEF	;Save default string
	MOVX A,CM%DPP
	IORM A,CMDFLB+.CMFNP	;Yes, say there is one
	RET

;;;Set up help string
%HELP:	HRRZ B,.JBUUO
	HRROM B,CMDFLB+.CMHLP	;Save help string
	MOVX B,CM%HPP
	IORM B,CMDFLB+.CMFNP	;Say there is help
	RET

	.ENDPS

	END