Google
 

Trailing-Edge - PDP-10 Archives - decus_20tap2_198111 - decus/20-0063/filsnd.mac
There are 4 other files named filsnd.mac in the archive. Click here to see a list.
	TITLE FILSND
	ENTRY DFHACK

	DEFINE ERRMES(A)
<	JRST [TTCALL 3,[ASCIZ/A/]
;;;		JSA 16,HNGUPF##
		pushj 17,hngup##
		EXIT]>

	DEFINE MESOUT(A)
<	MOVEI M,[ASCIZ/A
/]
	PUSHJ P,MESTYP>

	P=17
	C=16
	M=15
	P2=14
	P1=13

	AC=0
	T1=1
	T2=2
	T3=3

	DSK=1

	NLINES=5

DFHACK:	RESET
	MOVE P,[IOWD PDLEN,PDLST]
	PUSHJ P,GETIOX
	PUSHJ P,GETNAM
	SETZM INITF#
IT:	TTCALL 3,[ASCIZ/INITIATING TRANSFER?   /]
	TTCALL 4,0
	TTCALL 11,
	CAIE "N"
	CAIN "Y"
	SKIPA
	JRST [TTCALL 3,[ASCIZ/
TYPE Y OR N 
/]
		JRST IT]
	CAIN "Y"
	SETOM INITF
SORR:	TTCALL 3,[ASCIZ/SEND OR RECEIVE?  /]
	TTCALL 4,0
	TTCALL 11,
	CAIN "R"
	JRST RECV
	CAIN "S"
	JRST SEND
	TTCALL 3,[ASCIZ/TYPE  S OR R
/]
	JRST SORR

SEND:	PUSHJ P,OPNFIL
	ERRMES(<FILE DOES NOT EXIST>)
	SETZM COUNT
;;;	PUSHJ P,INITC
;;;	JUMP IOINDX#
;;;	JUMP IERR#
;;;	JUMP ITYPE#
	movei	16,[exp  ioindx#
		    exp  ierr#
		    exp  itype#]
	pushj	p,init
	SKIPN IERR
	ERRMES(<COMMUNICATIONS LINE INITIALIZATION ERROR>)
	SKIPE INITF
	PUSHJ P,GETNUM
	TTCALL 3,[ASCIZ/STARTING TO SEND
/]
GLOOP0:	MOVSI 1,-MESSIZ
	HRRI 1,ARRAY
GLOOP1:	PUSHJ P,GETBYT
	JRST LSTMES
	MOVEM C,(1)
	AOBJN 1,GLOOP1
	MOVEI 1,MESSIZ
	MOVEM 1,MESAGE
;;;	PUSHJ P,SENDC##
;;;	JUMP [MESAGE]
;;;	JUMP [MESSIZ+1]
;;;	JUMP IERR
;;;	JUMP ITYPE
	movei	16,[exp	[mesage]
		    exp	[messiz+1]
		    exp	ierr
		    exp	itype]
	pushj	p,sendc##
	SKIPGE IERR
	JRST GLOOP0
	ERRMES (<TRANSMISSION ERROR>)

LSTMES:	HLRES 1
	ADDI 1,MESSIZ
	TRO 1,200
	MOVEM 1,MESAGE
;;;	PUSHJ P,SENDC
;;;	JUMP [MESAGE]
;;;	JUMP [MESSIZ+1]
;;;	JUMP IERR
;;;	JUMP ITYPE
	movei	16,[exp	[mesage]
		    exp [messiz+1]
		    exp	ierr
		    exp	itype]
	pushj	p,send
	SKIPL IERR
	ERRMES(<TRANSMISSION ERROR>)
	SKIPE INITF
;;;	PUSHJ P,DIALC##
;;;	JUMP [0]
;;;	JUMP [0]
;;;	JUMP IERR
;;;	JUMP ITYPE
	movei	16,[exp	[0]
		    exp	[0]
		    exp	ierr
		    exp	itype]
	pushj	p,dialc##
	TTCALL 3,[ASCIZ/
/]
	PUSHJ P,HNGUPC##
	TTCALL 3,[ASCIZ/TRANSFER COMPLETED!/]
	EXIT

RECV:	PUSHJ P,ENTFIL
	MOVE [POINT 4,BUFFER]
	MOVEM BYTPNT
	MOVEI ^D9*^D128
	MOVEM COUNT
;;;	PUSHJ P,INITC##
;;;	JUMP IOINDX
;;;	JUMP IERR
;;;	JUMP ITYPE
	movei	16,[exp	ioindx
		    exp	ierr
		    exp	itype]
	pushj	p,init##
	SKIPL IERR
	ERRMES(<COMMUNICATIONS LINE INITIALIZATION ERROR>)
	SKIPE INITF
	PUSHJ P,GETNUM
RLOOP0:	;;;PUSHJ P,RECVC##
;;;	JUMP [MESAGE]
;;;	JUMP [MESSIZ+1]
;;;	JUMP IERR
;;;	JUMP ITYPE
	movei	16,[exp	[mesage]
		    exp	[messiz+1]
		    exp	ierr
		    exp	itype]
	pushj	p,recvc##
	SKIPL IERR
	ERRMES(<TRANSMISSION ERROR>)
	MOVE MESAGE
	TRZ 200
	JUMPE RDONE1
	MOVNS
	HRL 1,0
	HRRI 1,ARRAY
RLOOP1:	MOVE C,(1)
	PUSHJ P,PUTBYT
	AOBJN 1,RLOOP1
	MOVE MESAGE
	TRNN 200
	JRST RLOOP0
RDONE1:	PUSHJ P,PUTLST
	SKIPE INITF
;;;	PUSHJ P,DIALC##
;;;	JUMP [0]
;;;	JUMP [0]
;;;	JUMP IERR
	movei	16,[exp	[0]
		    exp	[0]
		    exp	ierr]
	pushj	p,dialc##
	PUSHJ P,HNGUPC
	CLOSE DSK,
	EXIT

GETBYT:	PUSHJ P,GETFOR
	POPJ P,
	MOVE M,C
	PUSHJ P,GETFOR
	POPJ P,
	LSH M,4
	IOR C,M
CPOPJ1:	AOS (P)
	POPJ P,

GETFOR:	SOSGE COUNT
	JRST GETBUF
	ILDB C,BYTPNT
	JRST CPOPJ1

GETBUF:	MOVE C,[POINT 4,BUFFER]
	MOVEM C,BYTPNT#
	MOVEI C,^D9*^D128
	MOVEM C,COUNT#
	IN DSK,CL
	JRST GETFOR
	STATZ DSK,1B22
	POPJ P,
	ERRMES(<ERROR READING DSK FILE>)

PUTBYT:	MOVE M,C
	LSH C,-4
	PUSHJ P,PUTFOR
	MOVE C,M
	ANDI C,17
	PUSHJ P,PUTFOR
	POPJ P,

PUTFR0:	SETZM BUFFER
	MOVE P2,[XWD BUFFER,BUFFER+1]
	BLT P2,BUFFER+177
PUTFOR:	SOSGE COUNT
	JRST PUTBUF
	IDPB C,BYTPNT
	POPJ P,
PUTBUF:	MOVE  P2,[POINT 4,BUFFER]
	MOVEM P2,BYTPNT
	MOVEI P2,^D9*^D128
	MOVEM P2,COUNT
	OUT DSK,CL
	JRST PUTFR0
	ERRMES(<ERROR DURING OUTPUT TO DSK>)

PUTLST:	MOVE COUNT
	IDIVI ^D9
	SUBI ^D128
	HRLZS
	HRRI BUFFER-1
	MOVEM CL1
	OUT DSK,CL1
	POPJ P,
	ERRMES(<ERROR DOING OUTPUT TO DSK>)
CL1:	0
	0

GETIOE:	TTCALL 11,
	TTCALL 3,[ASCIZ/
OCTAL DIGITS ONLY!
/]
GETIOX:	SETZ 1,
	TTCALL 3,[ASCIZ/TTY NUMBER?   /]
GETIOL:	TTCALL 4,
	CAIN 15
	JRST GETIOD
	CAIL 60
	CAILE 67
	JRST GETIOE
	SUBI 60
	LSH 1,3
	ADD 1,
	JRST GETIOL
GETIOD:	TRO 1,200000
	HRRZM 1,IOINDX
	TTCALL 11,
	POPJ P,

GETERR:	TTCALL 11,
	TTCALL 3,[ASCIZ/
USE THE FORMAT:  NAME.EXT<CR>
/]
GETNAM:	TTCALL 3,[ASCIZ/FILE NAME?   /]
	MOVEI AC,6
	MOVE T1,[POINT 6,NAME]
	SETZM NAME
	SETZM NAME+1
	INCHWL C
	JRST GETLP2
GETLOP:	INCHSL C
	JRST GETERR
GETLP2:	CAIN C,15
	JRST GETDON
	CAIN C,"."
	JRST GETEXT
	SUBI C,40
	IDPB C,T1
	SOJG AC,GETLOP
GETLP1:	INCHSL C
	JRST GETERR
	CAIN C,15
	JRST GETDON
	CAIE C,"."
	JRST GETLP1
GETEXT:	MOVEI AC,3
	MOVE T1,[POINT 6,NAME+1]
GETELP:	INCHSL C
	JRST GETERR
	CAIN C,15
	JRST GETDON
	SUBI C,40
	IDPB C,T1
	SOJG AC,GETELP
GETDON:	TTCALL 11,
	POPJ P,

OPNFIL:	INIT 1,17
	SIXBIT/DSK/
	XWD OBUF,IBUF
	ERRMES(<DSK NOT AVAILABLE>)
	SETZ P1,
	LOOKUP DSK,NAME
	POPJ P,
	JRST CPOPJ1

ENTFIL:	PUSHJ P,OPNFIL
	JRST OPNFL1
	TTCALL 3,[ASCIZ/FILE ALREADY EXISTS, RENAMING OLD FILE
/]
OVERWRITE:	MOVEI AC,1000
	MOVEI P1,0
OVLOOP:	MOVEI T1,3
	MOVE T2,[POINT 3,P1,26]
	MOVE T3,[POINT 6,NAME1+1]
OVLP1:	ILDB C,T2
	ADDI C,20
	IDPB C,T3
	SOJG T1,OVLP1
	MOVE T1,NAME
	MOVEM T1,NAME1
	HLLZS NAME1+1
	SETZM NAME1+2
	SETZM NAME1+3
	LOOKUP DSK,NAME
	ERRMES(<LOOKUP FAILURE ON FILE>)
	RENAME DSK,NAME1
	JRST RFAIL
	TTCALL 3,[ASCIZ/OLD FILE RENAMED TO /]
	MOVE T1,[POINT 6,NAME1]
RLOOP:	ILDB C,T1
	JUMPE C,REXT
	ADDI C,40
	TTCALL 1,C
	TLNE T1,770000
	JRST RLOOP
REXT:	MOVEI C,"."
	TTCALL 1,C
	MOVE T1,[POINT 6,NAME1+1]
	HLLZS NAME1+1
RELP:	ILDB C,T1
	JUMPE C,RDONE
	ADDI C,40
	TTCALL 1,C
	JRST RELP
RDONE:	TTCALL 3,[ASCIZ/
/]
	HLLZS NAME+1
	SETZM NAME+2
	SETZM NAME+3
	SETZ P1,
OPNFL1:	SETZM NAME+3
	ENTER DSK,NAME
	ERRMES(<ENTER FAILURE ON OUTPUT FILE>)
	POPJ P,


RFAIL:	AOS P1
	SOJG AC,OVLOOP
	ERRMES(<CANNOT RENAME OLD FILE>)

GETNUM:	MOVE 1,[POINT 4,NUMBER]
	SETZM NUMBER
	SETZM NUMBER+1
	TTCALL 3,[ASCIZ/
PHONE # TO DIAL?  /]
	MOVSI 2,-20
DLOOP:	TTCALL 4,0
	CAIN 15
	JRST DIAL
	CAIG "9"
	CAIGE "0"
	JRST ERROR
	SUBI "0"
	IDPB 1
	AOBJN 2,DLOOP
ERROR:	TTCALL 11,
	TTCALL 3,[ASCIZ/USE DIGITS ONLY, NUMBER MUST BE LESS THAN 16 DIGITS.
/]
	JRST GETNUM

NUMBER:	0
	0
DNUM:	0

DIAL:	MOVEI 17
	IDPB 1
	HRRZM 2,DNUM
;;;	PUSHJ P,DIALC##
;;;	JUMP [NUMBER]
;;;	JUMP DNUM
;;;	JUMP IERR
;;;	JUMP ITYPE
	movei	16,[exp	[number]
		    exp	dnum
		    exp	ierr
		    exp	itype]
	pushj	p,dialc##
	SKIPN IERR
	ERRMES(<DIALER ERROR>) 
	TTCALL 3,[ASCIZ/
/]
	POPJ P,

NAME1:	BLOCK 4

NAME:	SIXBIT/FILE/
	0
	0
	0
	0

PDLEN=10
PDLST:	BLOCK PDLEN



IBUF:	BLOCK 3
OBUF:	BLOCK 3

CL:	IOWD ^D128,BUFFER
	0
MESSIZ=^D70
MESAGE:	0
ARRAY:	BLOCK MESSIZ
BUFFER:	BLOCK ^D128

	END DFHACK