Google
 

Trailing-Edge - PDP-10 Archives - SRI_NIC_PERM_SRC_3_19910112 - utilities/dmsim.mid
There are no other files named dmsim.mid in the archive.
.SYMTAB 5000.

TITLE DMSIM
SUBTTL MRC 8/79

;  It is not claimed that this crock of shit is any good, just that it lets
; me talk to SAIL!

.DECSAV

A=1 ? B=2 ? C=3 ? D=4

DEFINE FATAL MSG
 HRROI A,[ASCIZ\?!MSG!\]
 PSOUT
 HALTF
 JRST DMSIM
TERMIN

CORBEG==.
PTIBSZ==100.
PTIPTR:	BLOCK 1
PTICTR:	BLOCK 1
PTIBFR:	BLOCK PTIBSZ

TTOBSZ==100.
TTOPTR:	BLOCK 1
TTOCTR:	BLOCK 1
TTOBFR:	BLOCK TTOBSZ

USRNAM:	BLOCK 8.
PTYJFN:	BLOCK 1
PTYNAM:	BLOCK 2
RCVFRH:	BLOCK 1
IDMODP:	BLOCK 1
GETCXP:	BLOCK 1
GETCYP:	BLOCK 1
KLUDGE:	BLOCK 1
OLDMOD:	BLOCK 1
COREND==.-1

DMSIM:	CAI
	RESET
	MOVEI A,.FHSLF
	RPCAP
	IOR C,B
	TLNN C,(SC%CTC)
	 JRST [FATAL [Must have CONTROL-C capability to run DMSIM]]
	EPCAP
	MOVE [CORBEG,,CORBEG+1]
	SETZM CORBEG
	BLT COREND
	DMOVE B,[440700,,TTOBFR ? 5*TTOBSZ]
	DMOVEM B,TTOPTR
	HRROI A,[ASCIZ/
Warning: this is not a supported program.  Use at your own risk!
Type EDIT-CTRL-~ followed by any other character to get out.
/]
	PSOUT
	GJINF
	MOVE B,A
	HRROI A,USRNAM
	DIRST
	 JRST [FATAL [DIRST lossage]]
	MOVEI B,^M
	IDPB B,A
	MOVE A,['PTYPAR]
	SYSGT
	HLLZ D,A
	EQVI D,
	ADJSP D,1
FNDPTY:	MOVSI A,.DVDES+.DVPTY
	HRRI A,(D)
	DVCHR
	TLNN B,(DV%AV)
	 JRST [	AOBJN D,FNDPTY
		FATAL [No PTYs]]
	MOVE B,A
	HRROI A,PTYNAM
	DEVST
	 JRST [FATAL [DEVST lossage]]
	MOVEI B,":
	IDPB B,A
	SETZ B,
	IDPB B,A
	MOVSI A,(GJ%SHT)
	HRROI B,PTYNAM
	GTJFN
	 JRST [FATAL [GTJFN lossage]]
	HRRZM A,PTYJFN
	MOVE B,[<7_30.>\OF%RD\OF%WR]
	OPENF
	 JRST [FATAL [OPENF lossage]]
	MOVE A,[CR%MAP\CR%CAP\CR%ST\RCVFRK]
	CFORK
	 JRST [FATAL [CFORK lossage]]
	MOVEM A,RCVFRH
	MOVE A,PTYJFN
	MOVEI B,^C
	BOUT
	MOVEI A,1000.
	DISMS
	MOVE A,PTYJFN
	HRROIAB,[ASCIZ/TERMINAL DATAMEDIA
	SETZ C,
	SOUT
	HRROI B,USRNAM
	SOUT
TTYINI:	MOVEI A,.PRIIN
	RFMOD
	MOVEM B,OLDMOD
	TRZ B,TT%DAM
	SFMOD
	TRZ B,TT%PGM
	STPAR
	DMOVE B,[525252,,525252
		 525252,,525252]
	SFCOC
	MOVEI A,.FHJOB
	SETZB B,C
	STIW
SNDFKL:	MOVEI A,.PRIIN
	BIN
	CAIE B,200\^^
	 JRST SNDFK1
	BIN
	CAIE B,200\^^
	 JRST [	MOVE B,OLDMOD
		SFMOD
		STPAR
		HALTF
		JRST TTYINI]
SNDFK1:	MOVE A,PTYJFN
	BOUT
	JRST SNDFKL

RCVFBI:	CAILE B,5*PTIBSZ
	 MOVEI B,5*PTIBSZ
	MOVEM B,PTICTR
	MOVNI B,(C)
	MOVE B,[440700,,PTIBFR]
	MOVEM B,PTIPTR
	SIN
RCVFRK:	SOSL PTICTR
	 JRST [	ILDB B,PTIPTR
		JRST RCVFR0]
	MOVE A,PTYJFN
	SIBE
	 JRST RCVFBI
	JSR TTOSND
	MOVE A,PTYJFN
	BIN
RCVFR0:	SKIPL GETCXP
	 JRST RCVFR2
	SETZM GETCXP
	CAIGE B,40
	 JRST RCVFR3
	SETOM GETCYP
	XORI B,140
	MOVEM B,GETCXP
	JRST RCVFRK

RCVFR2:	SKIPL GETCYP
	 JRST RCVFR3
	SETZM GETCYP
	CAIGE B,40
	 JRST RCVFR3
	XORI B,140
	MOVEM B,GETCYP
	MOVEI B,33
	JSR TTOCHR
	MOVEI B,"Y
	JSR TTOCHR
	MOVE B,GETCYP
	ADDI B,40
	JSR TTOCHR
	MOVE B,GETCXP
	ADDI B,40
	JSR TTOCHR
	JRST RCVFRK

RCVFR3:	CAIN B,177
	 JRST RCVFRK
	CAIG B,<" >
	 JRST @CTLTAB(B)
RCVFR1:	JSR TTOCHR
	JRST RCVFRK

CTLTAB:	RCVFRK			; ^@
	RCVFRK			; ^A
	[MOVEI B,33		; ^B HU
	 JSR TTOCHR
	 MOVEI B,"H
	 JRST RCVFR1]
	RCVFRK			; ^C
	RCVFRK			; ^D
	RCVFRK			; ^E
	RCVFRK			; ^F
	RCVFR1			; ^G bell
	[AOSG KLUDGE
	  JRST RCVFRK
	 SKIPN IDMODP
	  JRST RCVFR1		; ^H BS
	 MOVEI B,33		; ^H del char
	 JSR TTOCHR
	 MOVEI B,"Q
	 JRST RCVFR1]
	RCVFR1			; ^I TAB
	[SKIPN IDMODP
	  JRST RCVFR1		; ^J LF
	 MOVEI B,33		; ^J ins line
	 JSR TTOCHR
	 MOVEI B,"L
	 JSR TTOCHR
	 JSR PAD
	 JRST RCVFRK]
	RCVFRK			; ^K
	[SETOM GETCXP		; ^L position
	 JRST RCVFRK]
	RCVFR1			; ^M CR
	RCVFRK			; ^N
	RCVFRK			; ^O
	[SETOM IDMODP		; ^P I/D mode on
	 JRST RCVFRK]
	RCVFRK			; ^Q
	RCVFRK			; ^R
	RCVFRK			; ^S
	RCVFRK			; ^T
	RCVFRK			; ^U
	RCVFRK			; ^V
	[MOVEI B,33		; ^W CLEOL
	 JSR TTOCHR
	 MOVEI B,"K
	 JRST RCVFR1]
	[SETZM IDMODP		; ^X cancel
	 JRST RCVFRK]
	RCVFRK			; ^Y
	[MOVEI B,33
	 JSR TTOCHR
	 SKIPN IDMODP
	  SKIPA B,["A]		; ^Z LS
	   MOVEI B,"M		; ^Z del line
	 JSR TTOCHR
	 JSR PAD
	 JRST RCVFRK]
	[MOVEI B,33		; ^[ roll on
	 JSR TTOCHR
	 MOVEI B,"X
	 JRST RCVFR1]
	[MOVEI B,33
	 JSR TTOCHR
	 SKIPN IDMODP
	  SKIPA B,["C]		; ^\ FS
	   MOVEI B,"P		; ^\ ins char
	 JRST RCVFR1]
	RCVFRK			; ^]
	JRST [	MOVEI B,^L	; ^^ MC 
		SETZM IDMODP
		JRST RCVFR1]
	JRST [	MOVEI B,^L	; ^_ ES
		SETZM IDMODP
		JRST RCVFR1]
	JRST [	AOSG KLUDGE
		 JRST RCVFRK
		SKIPN IDMODP	; space for EMACS kludge to fake out DM's
		 JRST RCVFR1
		MOVNI 3
		MOVEM KLUDGE
		JRST @CTLTAB+^\]
IFN 41-<.-CTLTAB>,.FATAL CTLTAB loses

PAD:	0
	MOVEI B,177
	MOVEI 40.
	JSR TTOCHR
	SOJG .-1
	JRST 2,@PAD

TTOCHR:	0
	SOSGE TTOCTR
	 JSR TTOSND
	IDPB B,TTOPTR
	JRST @TTOCHR

TTOSND:	0
	DMOVE B,[440700,,TTOBFR ? 5*TTOBSZ]
	CAMN C,TTOCTR
	 JRST @TTOSND
	MOVEI A,.PRIOU
	MOVEM B,TTOPTR
	EXCH C,TTOCTR
	SUB C,TTOCTR
	SOUT
	JRST @TTOSND
	
END DMSIM