Trailing-Edge
-
PDP-10 Archives
-
BB-W661B-BM_1984
-
tools/x29trp.mac
There is 1 other file named x29trp.mac in the archive. Click here to see a list.
; Copyright (c) 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.
SALL
TITLE X29TRP Trap And Reject Incoming X.29 Calls
SUBTTL Data Declarations
SEARCH X25SYM
SEARCH MONSYM,MACSYM
; Accumulators
S1=1 ;Scratch ACs
S2=2
S3=3
S4=4
T1=5 ;Temporary ACs
T2=6
SP=17
; Push Down Stack
SIZE=^D200
STACK: BLOCK SIZE
; X.25 Access Argument Blocks
BUFFER: BLOCK 1 ;Virtual circuit data buffer
FILJFN: BLOCK 1 ;Reject text file JFN
FILSIZ: BLOCK 1 ;Reject text file length
PKTSIZ: BLOCK 1 ;Virtual circuit packet size
STATE: BLOCK 1 ;Port state
ARGBLK: BLOCK ^D10 ;Argument block
WSPACE: BLOCK .PBSIZ+<^D128/4> ;Working area for the X.25 library
; 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
SUBTTL Main Program
START: RESET ;Reset the world
MOVE SP,[IOWD SIZE,STACK] ;Set up push down stack
SETUP: CALL PSIINI ;Initialize interrupt system
CALL X25WIC ;Set up incoming call port
WAIT ;Dismiss the process
PSIINI: MOVEI S1,.FHSLF ;Current process
MOVE S2,[LEVTAB,,CHNTAB] ;Interrupt table
SIR
EIR ;Enable system
MOVE S2,[1B<CH.X25>] ;Activate channel
AIC
RET ;Return
X25WIC: MOVEI T1,XS%UND
MOVEM T1,STATE ;Set port state to UNDEFINED
SETZM ARGBLK ;Initialize the argument block
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/SRV:.X29TRAP/]]
MOVEM T1,ARGBLK+2 ;SRV: file descriptor
MOVEI S1,ARGBLK ;Pass access argument block
CALL X%WIC## ;Wait Incoming Call
MOVE T1,ARGBLK+1 ;Get return code
CAIE T1,XC%SUC ;Is it successful ?
HALTF ;No, terminate
MOVEI T1,XS%LSN ;Yes,
MOVEM T1,STATE ;Change port state to LISTENING
RET ;Return
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 current port status
HRRZ T1,ARGBLK+3 ;Get current packet size
MOVEM T1,PKTSIZ ;Save it
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%LSN ;From LISTENING state
JRST [CAIN T2,XS%LSN ;Remain in LISTENING state
JRST SRVCKT ;Check the port state again
CAIE T2,XS%CAD ;Changed to CALLED state ?
JRST X25TPA ;No, terminate port
JRST X25AIC] ;Accept incoming call
JRST X25TPA ;Don't want to handle other states
X25AIC: MOVSI S1,(GJ%OLD+GJ%SHT) ;Get reject text
HRROI S2,[ASCIZ/SYSTEM:X29REJ.TXT/]
GTJFN
JRST X25TPA ;No reject text, terminate circuit
MOVE S2,[7B5+OF%RD]
OPENF
JRST X25TPA ;No reject text, terminate circuit
MOVEM S1,FILJFN ;Save file JFN
SIZEF ;Get file length
JRST X25TPA ;Something is wrong, terminate circuit
MOVEM S2,FILSIZ ;Save file length
SETZM ARGBLK+1 ;Yes, Initialize argument block entries
MOVE T1,[ARGBLK+1,,ARGBLK+2]
BLT T1,ARGBLK+^D9
MOVEI S1,ARGBLK ;Accept incoming call unconditionally
CALL X%AIC##
MOVE T1,ARGBLK+1 ;Get return code
CAIE T1,XC%SUC ;Is it successful ?
JRST X25TPA ;No, terminate
MOVEI T1,XS%RUN ;Yes,
MOVEM T1,STATE ;Change port state to RUNNING
MOVEI S1,ARGBLK ;Get argument block
SETZM ARGBLK+2 ;Reset buffer length and indicators
MOVE T1,FILJFN ;Get reject text file JFN
MOVEM T1,ARGBLK+3 ;Make it the data pointer
TXTOUT: MOVE T1,FILSIZ ;Get file length
CAIG T1,0 ;Anything left to send
JRST REJECT ;No, then clear the circuit
MOVE T2,PKTSIZ ;Get packet size
SUB T1,T2 ;Calculate the remaining length
CAIG T1,0 ;Is this the last packet to send
JRST [MOVE T2,FILSIZ ;Yes
JRST .+1] ;Remaining file length is packet length
MOVEM T1,FILSIZ ;Save remaining file length
HRRZM T2,ARGBLK+2 ;Set packet length
CALL X%SDM## ;Send data
MOVE T1,ARGBLK+1 ;Get return code
CAIE T1,XC%SUC ;Is it successful ?
JRST X25TPA ;No, terminate circuit
JRST TXTOUT ;Send the remaining length
REJECT: MOVE S1,FILJFN ;Get reject text file JFN
CLOSF ;Close file
JFCL 0
SETZM ARGBLK+2 ;Reset packet length and indicators
MOVEI T1,1 ;Send one byte
HRRM T1,ARGBLK+2
MOVE T1,[XM%QUA] ;Set qualified bit
IORM T1,ARGBLK+2
MOVE T1,[1B7]
MOVEM T1,BUFFER
MOVE T1,[POINT 8,BUFFER] ;Get pointer to data
MOVEM T1,ARGBLK+3
CALL X%SDM## ;Send CLEAR INVITATION to PAD
MOVE T1,ARGBLK+1
CAIE T1,XC%SUC ;Is it successful ?
JRST X25TPA ;No terminate circuit
DEBRK
X25TPA: MOVEI S1,ARGBLK
CALL X%TPA## ;Terminate port access
CIS ;Clear interrupt system
JRST SETUP ;Go back to set it up again
END START ;End Of Program
; Local Modes:
; Mode:MACRO
; Auto Save Mode:2
; Comment Column:40
; Comment Rounding:+1
; End: