Google
 

Trailing-Edge - PDP-10 Archives - BB-H348C-RM_1982 - swskit-v21/demos/ekonet.mac
There are no other files named ekonet.mac in the archive.
	LALL
	SEARCH MONSYM,MACSYM
	.REQUIRE SYS:MACREL

;THIS PROGRAM ACTS AS AN ECHO TESTER FOR THE NETWORK.
;IT WILL OPEN A "SERVER" CONNECTION AND WAIT FOR A CONNECTION.
;ONCE CONNECTED, IT WILL "ECHO" ANY DATA SENT TO IT BY THE
;OTHER OWNER OF THE LINK. IT IS UP TO THE OTHER PROCESS
;TO VERIFY THAT THE DATA ECHOED BACK TO IT IS CORRECT.
;THIS PRORAM WILL COMPUTE THE BAUD RATE OF THE TRANSFER BY
;COMPUTING THE NUMBER OF BYTES IT PROCESSES. ALSO, IT COMPUTES
;THE "CPU EFFECTIVE" BAUD RATE. THIS IS THE PROCESSING RATE
;OF THE PROCESS DURING ITS ACTUAL RUN TIME. THIS METRIC
;GIVES THE MAXIMUM POSSIBLE BANDWIDTH THAT THE NETWORK COULD
;ACHEIVE IF THE TIME-SHARING SCHEDULER, THE DISKS, AND
;THE BUFFERING STRATEGIES WERE NEGLIGIBLE.

;THIS PROGRAM IS WRITTEN TO USE THE SOFTWARE INTERRUPT SYSTEM
;(PSI SYSTEM) SO THAT IT NEED NOT POLL THE LINK FOR DATA
;AVAILABLE. ONLY WHEN DATA IS READY TO BE READ WILL THE PROGRAM
;RUN.

;DATA DEFINITIONS

	P==17			;STACK POINTER
NPDL==10
PDL:	BLOCK NPDL		;RESERVE STACK SPACE
SAVRUN:	Z 0			;SAVE STARING RUN TIME
SAVTIM:	Z 0			;SAVE TIME OF DAY AT CONNECT TIME

PC:	Z 0			;SAVE INTERRUPT PC HERE

LEVTAB:	PC
	PC
	PC
CHNTAB:	1,,GOTSOM		;INTERRUPT CHANNEL FOR DATA AVAILABLE
	1,,CONNCT		;INTERRUPT CHANNEL FOR CONNECT RECEIVED

;START OF PROGRAM

START:	RESET
	MOVE P,[IOWD NPDL,PDL]	;SET UP A STACK FOR ERROR PROCESSING
	SETZM 11		;INIT BYTE COUNTER

;GET NAME OF SERVER FROM CONTROLLING TERMINAL

	HRROI 1,[ASCIZ /
DECnet File Specification (SRV:.taskname):/]
	PSOUT			;PROMPT FOR SERVER NAME
	MOVX 1,GJ%SHT+GJ%FNS	;GET FILE NAME FROM THE TTY
	MOVE 2,[.PRIOU,,.PRIIN]
	GTJFN
	 JRST [	JSERR		;REPORT THE ERROR
		JRST START]	;AND TRY AGAIN
	MOVE 15,1		;SAVE JFN
	MOVX 2,<FLD(44,OF%BSZ)+OF%RD+OF%WR>
	OPENF			;OPEN THE JFN AND SET UP THE LISTENER
	 JRST [	JSERR		;REPORT THE ERROR
		JRST START]	;AND TRY AGAIN
	MOVEI 2,.MOACN		;ASSIGN INTERRUPT CHANNELS TO LINK
	MOVX 3,<FLD(0,MO%DAV)+FLD(1,MO%CDN)+FLD(.MONCI,MO%INA)>
	MTOPR
	MOVEI 1,.FHSLF
	MOVE 2,[LEVTAB,,CHNTAB]
	SIR			;DEFINE PSI SYSTEM TABLES
	MOVX 2,3B1
	AIC			;ENABLE CHANNELS 0 AND 1
	EIR			;TURN ON PSI SYSTEM
PAUSE:	WAIT			;PAUSE UNITL SOMETHING TO DO

;RECEIVED SOME DATA. THIS ROUTINE GOTTEN TO BY PSI
;CHANNEL 0 WHEN DATA IS AVAILABLE TO BE READ

GOTSOM:	MOVE 1,15		;GET NETWORK JFN
	SIBE			;SEE IF ANY BYTES TO READ
	 JRST READ		;YES. GO GET THEM
	MOVEI 2,.MORLS		;NO. CHECK IF LINK STILL RUNNING
	MTOPR			;GET STATUS
	TXNN 3,MO%CON		;STILL CONNECTED?
	JRST EOF		;NO
	DEBRK			;YES. HAVE READ ALL AVAIALABLE DATA
				;FOR NOW. WAIT FOR SOME MORE

;HAVE SOME DATA TO READ.
;			 1/ NETWORK JFN
;			2/ # OF BYTES

READ:	ADDI 11,0(2)		;COUNT BYTES RECEIVED
	ADDI 11,0(2)		;ADD IT TWICE
	MOVNI 3,0(2)		;GET NEG OF COUNT
	MOVE 4,3		;SAVE COUNT FOR ECHO OPERATION
	MOVE 2,[POINT 36,10000]	;WHERE TO PUT DATA
	SIN			;GET SOME DATA

;NOW PUT IT BACK OUT ON THE LINK

	MOVE 2,[POINT 36,10000]	;POINT TO DATA JUST READ
	MOVE 3,4		;RECOVER BYTE COUNT
	SOUTR			;WRITE DATA
	GTSTS			;GET DEVICE STATUS
	TXNN 2,GS%EOF		;AT EOF?
	JRST GOTSOM		;NO. SEE IF MORE DATA TO BE READ THEN

;HAVE READ ALL OF THE DATA UP TO THE EOF.

EOF:	HRROI 1,[ASCIZ /
%EOF ENCOUNTERED
/]
	PSOUT
	TIME			;GET CURRENT TIME OF DAY
	SUB 1,SAVTIM		;GET ELAPSED TIME BY SUBTRACTING STARTING TIME
	MOVE 5,1		;SAVE ELPASED TIME
	MOVEI 1,.FHSLF
	RUNTM			;GET CURRENT RUN TIME OF PROCESS
	SUB 1,SAVRUN		;ELAPSED RUN TIME
	JOV .+1			;TURN OFF OVERFLOW
	IMULI 11,44		;COMPUTE BITS RECEIVED
	MULI 11,^D1000		;CONVERSION FOR DIVIDING BY MS INSTEAD OF SECS
	JOV OVERF		;CHECK FOR OVERFLOW
	DMOVE 7,11		;SAVE TOTAL BITS TRANSMITTED WITH MS CONVERSION
	DIV 11,5		;COMPUTE BAUDS (BITS PER SECOND)
	DIV 7,1			;COMPUTE EFFECTIVE BAUDS
	JOV OVERF		;CHECK FOR OVERFLOW AGAIN
	HRROI 1,[ASCIZ /
BAUD RATE= /]
	PSOUT
	MOVEI 1,.PRIOU		;WRITE RESULTS TO TTY
	MOVE 2,11
	MOVEI 3,12		;IN RADIX 10
	NOUT
	 JFCL
	MOVEI 1,[ASCIZ /
EFFECTIVE RATE: /]
	PSOUT
	MOVEI 1,.PRIOU
	MOVE 2,7
	NOUT
	 JFCL
	HALTF			;DONE

;CONNECT RECEIVED
;THIS ROUTINE GOTTEN TO BY PSI INTERRUPT ON CHANNEL 1
;WHEN ANOTHER PROCESS REQUESTS A LINK

CONNCT:	MOVE 1,15		;GET JFN OF CONNECTION
	MOVEI 2,.MOCC		;UNCONDITIONALLY ACCEPT THE CONNECTION
	SETZB 3,4		;NO OPTIONAL DATA TO BE SENT
	MTOPR
	TIME			;GET TIME OF DAY
	MOVEM 1,SAVTIM		;SAVE IT
	MOVEI 1,.FHSLF
	RUNTM			;GET RUN TIME
	MOVEM 1,SAVRUN
	DEBRK			;DONE. WAIT FOR DATA

;BAUD CALCULATION ENCOUNTERED AN ARITHMETIC OVERFLOW

OVERF:	HRROI 1,[ASCIZ /
?OVERFLOW IN BAUD RATE CALCULATION
/]
	PSOUT
	HALTF			;GIVE UP
	END START