Google
 

Trailing-Edge - PDP-10 Archives - BB-W661B-BM_1984 - tools/svcxmi.mac
There is 1 other file named svcxmi.mac in the archive. Click here to see a list.
	SALL
	TITLE	SVCXMI	Communication Master Program
	SEARCH	MONSYM,MACSYM,X25SYM

; Copyright (c) 1982, 1983 by
; DIGITAL EQUIPMENT CORPORATION, Maynard, Massachusetts 01754
;
; This software is furnished under a license and may be used and  copied
; only  in  accordance  with  the  terms  of  such  license and with the
; inclusion of the above copyright notice.  This software or  any  other
; copies  thereof may not be provided or otherwise made available to any
; other person.  No title to and ownership of  the  software  is  hereby
; transferred.
;
; The information in this software is subject to change  without  notice
; and  should  not  be  construed  as  a commitment by Digital Equipment
; Corporation.
;
; Digital assumes no responsibility for the use or  reliability  of  its
; software on equipment which is not supplied by Digital.

; Accumulators

S1=1					;Scratch ACs
S2=2
S3=3
S4=4
T1=5					;Temporary ACs
T2=6
SP=17

; Push Down Stack

SIZE=^D256
STACK:	BLOCK	SIZE

; X.25 Access Argument Blocks

WSPSIZ=<^D128/4>+.PBSIZ
WSPACE:	BLOCK	WSPSIZ			;Working area for the X.25 library
ARGBLK:	BLOCK	^D10			;Argument block
BUFFER:	BLOCK	^D32			;Transmitted data buffer
STATE:	BLOCK	1			;Port state
PROMPT:	ASCIZ	/> /
HELP:	ASCIZ	/Enter text:
/

; Interrupt System Storage Definitions

CH.X25=0				;Interrupt channel number
SAVEPC:	BLOCK	1			;Location for saved PC
LEVTAB:	SAVEPC				;Interrupt level table
	REPEAT	2,<0>
CHNTAB:	1,,SRVCKT			;Interrupt handler entry
	REPEAT	^D35,<0>		;Unused channels have 0

START:	RESET				;Reset the world
	MOVE	SP,[IOWD SIZE,STACK]	;Set up push down stack
	MOVEI	S1,.FHSLF		;Current process
	MOVE	S2,[LEVTAB,,CHNTAB]	;Interrupt table
	SIR
	EIR				;Enable system
	MOVE	S2,[1B<CH.X25>]		;Activate channel
	AIC
	MOVEI	T1,XS%UND
	MOVEM	T1,STATE		;Set port state to UNDEFINED
	SETZM	ARGBLK			;Initialize entire argument block area
	MOVE	T1,[ARGBLK,,ARGBLK+1]
	BLT	T1,ARGBLK+^D9
	MOVE	T1,[CH.X25,,WSPACE]
	MOVEM	T1,ARGBLK		;Interrupt channel and work area
	MOVE	T1,[POINT 7,[ASCIZ/TELENET/]]
	MOVEM	T1,ARGBLK+2		;Network name
	MOVE	T1,[POINT 7,[ASCIZ/X25-GATE/]]
	MOVEM	T1,ARGBLK+3		;Access password
	MOVE	T1,[POINT 7,[ASCIZ/311030300012/]]
	MOVEM	T1,ARGBLK+4		;Destination DTE address
	MOVEI	S1,ARGBLK
	CALL	X%ISC##
	MOVE	T1,ARGBLK+1		;Get return code
	CAIE	T1,XC%SUC		;Is it successful ?
	HALTF				;No, terminate
	MOVEI	T1,XS%CAG		;Yes,
	MOVEM	T1,STATE		;Change port state to CALLING
	WAIT				;Dismiss the process

SRVCKT:	SETZM	ARGBLK+1		;Initialize argument block entries
	MOVE	T1,[ARGBLK+1,,ARGBLK+2]
	BLT	T1,ARGBLK+^D9
	MOVEI	S1,ARGBLK		;Pass access argument block
	CALL	X%RPS##			;Check port state
	MOVE	T1,ARGBLK+1		;Get return code
	CAIE	T1,XC%SUC		;Is it successful ?
	 JRST	X25TPA			;No, terminate
	MOVE	T1,STATE		;Get old port state
	HRRZ	T2,ARGBLK+2		;Get new port state
	CAIN	T1,XS%CAG		;From CALLING state
	 JRST	[CAIN	T2,XS%CAG	;Remain in CALLING state
		  JRST	SRVCKT		;Check the port state again
		 CAIN	T2,XS%RUN	;Changed to RUNNING state
		  JRST	X25SDM		;Transmit data to the network
		 JRST	X25TPA]		;Otherwise, terminate
	CAIN	T1,XS%RUN		;From RUNNING state
	 JRST	[CAIN	T2,XS%RUN	;Remain in RUNNING state
		 DEBRK			;Do nothing
		 JRST	X25TPA]		;Otherwise, terminate
	JRST	X25TPA			;Don't want to handle other states

X25SDM:	MOVEI	T1,XS%RUN
	MOVEM	T1,STATE		;Update port state to RUNNING
	HRROI	S1,HELP
	PSOUT

SDM.1:	HRROI	S1,PROMPT
	PSOUT
	HRROI	S1,BUFFER		;Receiving buffer
	MOVEI	S2,^D128		;Maximum length
	HRROI	S3,PROMPT		;Prompt text
	RDTTY
	 JRST	X25TPA			;Failed, terminate virtual circuit
	HRRZ	T2,S2			;Get remaining length
	CAIN	T2,^D126		;Is it empty string (only <cr><lf>) ?
	 JRST	X25TPA			;Yes, that's it
	SETZM	ARGBLK+1		;Initialize argument block entries
	MOVE	T1,[ARGBLK+1,,ARGBLK+2]
	BLT	T1,ARGBLK+^D9
	MOVEI	T1,^D128		;Get the actual length of the string
	SUB	T1,T2
	MOVEM	T1,ARGBLK+2
	HRROI	T1,BUFFER
	MOVEM	T1,ARGBLK+3		;Get pointer to the text string
	MOVEI	S1,ARGBLK
	CALL	X%SDM##			;Send the string to the network
	MOVE	T1,ARGBLK+1		;Get the return code
	CAIE	T1,XC%SUC		;Is it successful ?
	 JRST	[TXNN	T1,XC%PER	;No, then is it procedure error ?
		  JRST	SDM.1		;No, it is non-fatal error
		 JRST	X25TPA]		;Yes, terminate
	JRST	SDM.1			;Get next string from terminal

X25TPA:	MOVEI	S1,ARGBLK		;Terminate port access
	CALL	X%TPA##
	HALTF				;Stop program
	END	START			;End Of Program
; Local Modes:
; Mode:MACRO
; Auto Save Mode:2
; Comment Column:40
; Comment Rounding:+1
; End: