DataMuseum.dk

Presents historical artifacts from the history of:

CR80 Wang WCS documentation floppies

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about CR80 Wang WCS documentation floppies

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦47acff502⟧ Wang Wps File

    Length: 46900 (0xb734)
    Types: Wang Wps File
    Notes: PC/PDS/002                
    Names: »3891A «

Derivation

└─⟦9fe574faa⟧ Bits:30006242 8" Wang WCS floppy, CR 0334A
    └─ ⟦this⟧ »3891A « 

WangText



&…05…&…07…%…0c…%…01…%…02…%
…11……09……11……0d……11……02……11…    …11……07……10……0a……10……0f……10……00……10……02……10……07……0f……86…1
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    …02… 
     
     
     
     
     …02…
     
    …02… 
     
    
…0e…
…02…  PC/PDS/002

…02…  EHO/840315…02…#
PROTOCOL
 CONVERTER
      
      
  
PACKAGE
 DESIGN
 SPECIFICATION…02…
      
    …02…  
 PC…0f…









                 PROTOCOL CONVERTER
                 CCIS Low Level Protocol-Simulator
                 Package Design Specification


                 PC/PDS/002













                 ERIK HOLGERSEN                 





                 B[RGE HERMANSEN







                 BHE, EHO, KPL, FILE (1)           
                                                      















                         PC PROJECT MGR    840315


         2.0



         840315                                   



                                                PC/PDS/002     

…02…EHO/840315…02…   ii
PROTOCOL CONVERTER
PACKAGE DESIGN SPECIFICATION     …02…      …02…      
…0f…












       830722                   All        First issue of document
                      

2.0    840315                 All                          
       



                                                PC/PDS/002     

…02…EHO/840315…02…  iii
PROTOCOL CONVERTER
PACKAGE DESIGN SPECIFICATION     …02…      …02…      
…0f…





                                      T̲A̲B̲L̲E̲ ̲O̲F̲ ̲C̲O̲N̲T̲E̲N̲T̲S̲




 1 CCIS LOW LEVEL PROTOCOL SIMULATOR (CLPS) .........
    1

   1.1 FUNCTIONAL SPECIFICATION .....................
      1
     1.1.1 OPEN LINK Sequence .......................
        7
     1.1.2 DATA TRANSMISSION Sequence ...............
       12

   1.2 SOFTWARE STRUCTURE ...........................
     20

   1.3 PACKAGE DATA .................................
     20

   1.4 PACKAGE DESIGN ...............................
     30
     1.4.1 Protocol Entry Pseudo Code ...............
       30
     1.4.2 Event Analyzer Pseudo Code ...............
       33
     1.4.3 Send CLP Message Pseudo Code .............
       45

   1.5 PACKAGE INTERFACES ...........................
     46




        1 C̲C̲I̲S̲ ̲L̲O̲W̲ ̲L̲E̲V̲E̲L̲ ̲P̲R̲O̲T̲O̲C̲O̲L̲ ̲S̲I̲M̲U̲L̲A̲T̲O̲R̲ ̲(̲C̲L̲P̲S̲)̲



1.1      F̲U̲N̲C̲T̲I̲O̲N̲A̲L̲ ̲S̲P̲E̲C̲I̲F̲I̲C̲A̲T̲I̲O̲N̲

         The CLPS package is responsible for simulating the
         GRTS 
         software in the DN355/DN6678 front-end processor on
         the 
         CCIS side and acts as a master to the CLP protocol

         CLPS is implemented in the CR80 LTU and the CLPS SW
         
         therefore has to be down-line loaded from the CR80
         
         memory during initialization of the LTU.

         CLPS communicates with the PC using the following three
         types of subsegments:

         - S̲e̲r̲v̲i̲c̲e̲ ̲M̲e̲s̲s̲a̲g̲e̲s̲  for opening and closing the line

         - C̲o̲n̲t̲r̲o̲l̲ ̲M̲e̲s̲s̲a̲g̲e̲s̲  for delivery of passwords and other
         
           control data.

         - I̲n̲f̲o̲r̲m̲a̲t̲i̲o̲n̲ ̲M̲e̲s̲s̲a̲g̲e̲s̲  used during the transmission
           of data segments 

         In this context the term "messages" means the various
         subsegment types sent between the CLPS and PC including
         header and trailer characters.

         Due to the half-duplex nature of the communication
         link the sets of messages sent from the two sides are
         not symmetrical. Therefore, a description of the possible
         messages sent from either side of the link is given
         in Figure 1.1-1 and 1.1-2.



















































FIGURE 1.1-1 SERVICE/CONTROL MESSAGES…86…1         …02…   …02…   …02…   …02…                          
                 


















































FIGURE 1.1-2 INFORMATION MESSAGES…86…1         …02…   …02…   …02…   …02…           …02…   …02…              
             
         In the above figures the nomenclature of PC/PDS/001
         Reference s 6 and 18 are used:

         "Remote"    =                                           CR80
                                                                 LTU
                                                                 (PC)
         "DN355"     =                                           DN355
                                                                 or
                                                                 DN6678
                                                                 (CR80
                                                                 LTU)
         SYN         =                                           sync.
                                                                 character,
                                                                 #16
         SOH         =                                           start
                                                                 of
                                                                 header,
                                                                 #01
         FC          =                                           varying
                                                                 function
                                                                 code
         SC          =                                           sequence
                                                                 code
                                                                 alternating
                                                                 at
                                                                 
                                                                 each
                                                                 side
                                                                 between
                                                                 #41
                                                                 and
                                                                 #42
                                                                 for
                                                                 each
                                                                 message
                                                                 sent
                                                                 except
                                                                 for
                                                                 IRD2
                                                                 for
                                                                 which
                                                                 it
                                                                 is
                                                                 constant.
         AC          =                                           address
                                                                 code,
                                                                 #40
         OC          =                                           operation
                                                                 code.
                                                                 OC.(2:3)
                                                                 (bits
                                                                 2,1,0)is
                                                                 a
                                                                 three
                                                                 bit
                                                                 field
                                                                 holding
                                                                 the
                                                                 operation
                                                                 code.
                                                                 OC.
                                                                 (5:3)
                                                                 (bits
                                                                 5,4,3)
                                                                 is
                                                                 a
                                                                 three
                                                                 bit
                                                                 field
                                                                 with
                                                                 the
                                                                 binary
                                                                 value
                                                                 000
                                                                 for
                                                                 acknowledge
                                                                 or
                                                                 001
                                                                 for
                                                                 negative
                                                                 acknowledge.
         IC          =                                           identification
                                                                 code
                                                                 #40
         AUX         =                                           auxiliary
                                                                 field,
                                                                 #47
                                                                 (only
                                                                 used
                                                                 in
                                                                 "Select",
                                                                 SRD3).
         STX         =                                           start
                                                                 of
                                                                 text
         MC          =                                           media
                                                                 code…06…1
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 …02…
                                                                 
                                                                 
                                                                 …02…
                                                                 
                                                                 
                                                                 …02…
                                                                 
                                                                 
                                                                 …02…
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
         TEXT FIELD
             a)  from 1 up to 324 bytes of data sent to PC using
                 the IDR3 and/or IDR4 messages.
                 SUPERACK's and SUPERNAK's, will be sent as
                 IDR4 messages.

             b)  1 to 324 bytes of data received from PC in
                 IRD3 and/or IRD4 messages

             c)  $*$LOGID$PSWRD/DNM
                 where ID and PSWRD are two character strings
                 with lengths from 1 to 12 characters each ̲supplied
                 from CR80 together with the OPEN LINK command

             d)  LINE DISCONN. XXX and LINE TERMIN. XXX stands
                 for:
                 LINE DISCONNECTED XXX and
                 LINE TERMINATED XXX.
                 'XXX' is a character string of two or three
                 characters.





             e)  (*) DINDAC is transmitted during an OPEN LINK
                 sequence in an IDR2 subsegment.
                 (*)should be read as the hexadecimal characters:
                 #3C, #2A, and #3E. Cf. PC/PDS/001 Reference
                 3, p.3-A-4-2.
                 

         RS          =   record separator

         ETX         =   end of text, no more subsegments in
                         segment

         ETB         =   end of text, more subsegments will
                     
                           follow to complete the segment

         BCC         =   block check, i.e. ex-or of characters
                         following SOH and including ETX. Denoted
                         "**" in the figures.

         AL          =   alternating independently at both sides
                         between #41 and #42.

         C0          =   constant and equal to the previous
                         value used. 

         All numbers in Figures 1.1-1 and 1.1-2 are hexadecimal.
         Unused fields are marked "-- " and "---".  

         If the text field consist of two messages the first
         text is refered to as X and the other as Y.


         CLPS recognizes incoming messages from PC and assigns
         a constant value taken from the constants declared
         as "pc ̲messages" in section 1.3

         F̲u̲r̲t̲h̲e̲r̲m̲o̲r̲e̲, each incoming message is checked for the
         occurence of one of the following events:

         -   OC.(5:3) = 001 (binary) NAK.

         -   the incoming message contains an error. Check of
             messages is described in subsequent sections. Checks
             are performed according to PC/PDS/001 Reference
             s 6 and 18.

         CLPS is able to send the messages denoted SDR, CDR,
         and IDR shown in Figures 1.1-1 and 1.1-2.

         Any of these messages may furthermore be retransmitted
         any required number of times. 

         Retransmission is performed with the SC value equal
         to the one of the previous message sent.

         For ordinary messages and frames to be retransmitted
         the ACK/NAK field, OC.(5:3) is set to either 000 or
         001 (binary).

         Functionally, the CLPS is divided into an OPEN LINK
         sequence and a DATA TRANSMISSION sequence.

         A state/event description of each of these sequences
         is given in section 1.1.1 and 1.1.2, respectively.


1.1.1    O̲P̲E̲N̲ ̲L̲I̲N̲K̲ ̲S̲e̲q̲u̲e̲n̲c̲e̲


        a)   S̲t̲a̲t̲e̲s̲ ̲i̲n̲ ̲O̲P̲E̲N̲ ̲L̲I̲N̲K̲ ̲(̲S̲O̲L̲)̲

         SOL0    Before CR80 open link command

         SOL1    Before sending RFD to PC.

         SOL2    Before receiving SELECT to PC

         SOL3    Before accept of ID and PSWRD in received LOGON
                 message

         SOL4    Before receiving LOGON TO DINDAC

         SOL5    Before accept of start

         SDT0    Starting state of Data Transmission sequence


        b)   E̲v̲e̲n̲t̲ ̲c̲l̲a̲s̲s̲e̲s̲ ̲i̲n̲ ̲O̲P̲E̲N̲ ̲L̲I̲N̲K̲ ̲(̲E̲O̲L̲)̲

         EOL0    CR80 OPEN LINK command

         EOL1    READY FOR DISCONNECT, SRD1 

         EOL3    SELECT, SRD3

         EOL4    LOGON, CRD1 with ID and PSWRD

         EOL5    LOGON to DINDAC, CRD1

         EOL6    ACK, NO REQUEST, IRD1 

         EOL7    Message is in error. Message checking will
                 be performed during analysis of input according
                 to PC/PDS/001 Reference  18.

         EOL8    Bits 5,4,3, OC.(5;3) is NAK

         EOL9    CR80 CLOSE LINK command

         EOL10   Time out on answer 

         EOL11   Other events



        c)   A̲c̲t̲i̲o̲n̲s̲ ̲p̲e̲r̲f̲o̲r̲m̲e̲d̲ ̲d̲u̲r̲i̲n̲g̲ ̲O̲P̲E̲N̲ ̲L̲I̲N̲K̲ ̲(̲A̲O̲L̲)̲

         AOL0    Initialize variables, reset timer

         AOL1    Read and store the userid/password and baudrate
                 from CR80. Set baudrate according to value
                 given in OPEN LINK command.

         AOL2    Send READY FOR DISCONNECT, SDR1.
                 Start answer ̲timer.

         AOL3    Send TRANSMIT DATA, IDR1.
                 Start answer ̲timer.

         AOL4    Send TRANSMIT DATA, IDR1 and start answer ̲timer.

         AOL5    Send DINDAC start message, IDR2X. Start answer
                 ̲timer.

         AOL6    Answer pending OPEN LINK request from CR80
                 with result OK

         AOL7    ACK/NAK field of previous message sent is set
                 to NAK and the message is retransmitted without
                 altering the SC field.
                 Start answer ̲timer.


         AOL8    Retransmit previous frame with same SC and
                 ACK in the ACK/NAK field of OC.
                 Start answer ̲timer.

         AOL9    Answer CR80 CLOSE ̲LINK command. Cancel pending
                 OPEN LINK command. Send DISCONNECT, SDR2.

         AOL10   Notify CR80 of error condition in response
                 to an OPEN ̲link command. 

         AOL11   Answer pending CR80 OPEN ̲LINK command with
                 reason code for closing.
                 If no command syntax error then set error to
                 open link sequence error.
                 Send DISCONNECT, SDR2.

         AOL12   Send TRANSMIT DATA,IDR1 with NAK in the ACK/NAK
                 field of OC.
                 Start answer ̲timer.

         AOL13   If answer ̲timer ̲count is less than noresponse
                 ̲-
                 limit, then retransmit the previeus message
                 with NAK in the ACK/NAK field of OC and the
                 same SC else send DISCONNECT, SDR2 and notify
                 CR80 of error in open link sequence.

         AOL14   Reject CR80 command with reason code ̲current
                 state.


         States entered and events occurring during a typical
         OPEN LINK sequence are emphasized using fat lines in
         Figure 1.1.1-1.

         LTU system SW, which is used both in the CLP and CLPS
         is referred to in PC/PDS/001 Reference  15.




















































FIGURE 1.1.1-1 STATE/EVENT TABLE: OPEN LINK SEQUENCE…86…1         …02…   …02…   …02…   …02…                   
                        
1.1.2    D̲A̲T̲A̲ ̲T̲R̲A̲N̲S̲M̲I̲S̲S̲I̲O̲N̲ ̲S̲e̲q̲u̲e̲n̲c̲e̲


        a)   S̲t̲a̲t̲e̲s̲ ̲i̲n̲ ̲D̲A̲T̲A̲ ̲T̲R̲A̲N̲S̲M̲I̲S̲S̲I̲O̲N̲ ̲(̲S̲D̲T̲)̲

         SDT0    Wait for Request Input

         SDT1    Request Input Received 

         SDT2    Segment Accumulation

         SDT3    Segment Received

         SDT4    Subsegments to be Sent

         SDT5    Segment Sent (but not fully acknowledged)

         SDT6    Ack,no request Received

         SDT7    Ready for Closing Link

         SOL0    Link Closed


        b)   E̲v̲e̲n̲t̲ ̲c̲l̲a̲s̲s̲e̲s̲ ̲i̲n̲ ̲D̲A̲T̲A̲ ̲T̲R̲A̲N̲S̲M̲I̲S̲S̲I̲O̲N̲ ̲(̲E̲D̲T̲)̲

         EDT0    Unrecoverable Error indicated by the variable
                 data ̲transmission ̲error

         EDT1    CR80 Close Link command

         EDT2    CR80 Request Input command

         EDT3    CR80 Request Output - data will have to be
                 sent as more than one subsegment (ETB), i.e.
                 data segment of more than 324 bytes.

         EDT4    CR80 Request Output - data can be sent as one
                 subsegment (ETX), e.g. SUPER NAK's or SUPER
                 ACK's.

         EDT5    CR80 Cancel Input Request command

         EDT6    CR80 Cancel Output Request command

         EDT7    CR80 Show Statistics command

         EDT8    CR80 Reset Statistics command

         EDT9    READY FOR DISCONNECT, SRD1

         EDT10   ACK, NO REQUEST, IRD1 and subsegment ̲type:=
                    
                 etb ̲subsegment           
                 CLPS has received IRD1 and remaining data to
                 be sent exceed 324 bytes.

         EDT11   ACK, NO REQUEST, IRD1 and subsegment ̲type:=
                    
                 etx ̲subsegment. CLPS has received IRD1 and
                 data to be sent can be held in one subsegment.

         EDT12   CLPS has received a data subsegment which is
                 a mid- or first subsegment of a segment, IRD3.


         EDT13   CLPS has received a data subsegment which is
                 the last subsegment or an entire segment, IRD4.

         EDT14   Bits 5,4,3, OC.(5:3) is 001 (binary) corresponding
                 to NAK.

         EDT15   Message is in error. Message checking will
                 be performed during analysis of input according
                 to PC/PDS/001 Reference  18.

         EDT16   BREAK, CRD2.

         EDT17   WAIT, IRD2.

         EDT18   Timeout for answer.

         EDT19   Disconnect SRD2 received.

         EDT20   Illegal request output.

         EDT 21  Others.



        c)   A̲c̲t̲i̲o̲n̲s̲ ̲p̲e̲r̲f̲o̲r̲m̲e̲d̲ ̲d̲u̲r̲i̲n̲g̲ ̲D̲A̲T̲A̲ ̲T̲R̲A̲N̲S̲M̲I̲S̲S̲I̲O̲N̲ ̲(̲A̲D̲T̲)̲

         ADT0    Prepare for input from the line. Initialize
                 variables.
                 IF ack ̲to ̲be ̲sent THEN send TRANSMIT DATA,IDR1,
                                      ack ̲to ̲be ̲sent:= false
                                      start answer ̲timer

         ADT1    Accumulate ETB subsegment data from IRD3. Update
                 statistic counters. Send TRANSMIT DATA, IDR1.
                 Start answer ̲timer

         ADT2    Accumulate ETX subsegment data from IRD4. Send
                 data segment to CR80 in reply to pending Request
                 Input Command. Update statistic counters. Set
                 flag ack ̲to ̲be ̲sent:= true;
                 If output ̲pending is true then answer request
                 output with OK result code
                 Set output ̲pending to false

         ADT3    Cancel pending Input Request identified in
                 command. Notify CR80 and clean up input buffers.

         ADT4    Cancel pending Output Request identified in
                 command. Notify CR80 and clean up output buffers.

         ADT5    Notify CR80 about the number of:

                 - messages transmitted
                 - messages retransmitted
                 - information messages
                   received error free
                 - messages received in error
                 Cf. PC/PDS/001 Reference  15, section 3.1.2.
                 Reset c ̲status entry.

         ADT6    Reset counters:
                   messages ̲transmitted
                   messages ̲retransmitted
                   i ̲messages ̲received
                   messages ̲received ̲error
                 Cf. PC/PDS/001 Reference  15, section 3.1.2
                 Reset c ̲status entry.


         ADT7    Set ack ̲to ̲be ̲sent to false. Update statistics,
                 update subsegment ̲type according to the number
                 of remaining bytes to be sent in subsequent
                 subsegments. Variable request ̲o ̲errors:= 0.
                 Send ETB ̲subsegment in IDR3.
                 If ldunumber is last segment then set last
                 to true. Start answer ̲timer.

         ADT8    Set ack ̲to ̲be ̲sent to false. Update statistics.
                 Variable request ̲o ̲errors:= 0. Send last or
                 entire ETX ̲subsegment in IDR4 message.
                 If ldunumber is last segment then set last
                 to true. Start answer ̲timer.

         ADT9    If last is false then answer pending CR80 Request
                 Output with OK result code upon reception of
                 ACK on last subsegment in segment sent. Update
                 statistics.
                 else send TRANSMIT DATA, IDR1 and set output
                 ̲pending to true.

         ADT10   Update Statistics. If last is true, then send
                 TRANSMIT DATA and start answer ̲timer.

         ADT11   Cancel pending CR80 commands. Clean up all
                 input/output buffers. Send READY FOR DISCONNECT,
                 SDR1,start answer ̲timer.

         ADT12   Cancel pending CR80 commands, notify CR80 of
                 closing. Clean up all input/output buffers.
                 Send DISCONNECT, SDR2, start answer ̲timer.

         ADT13   Clean up input/output buffers. Reject pending
                 CR80 commands. Reset counters: req ̲i ̲errors,
                 req  ̲o ̲errors, data ̲transmission ̲error, and
                 dt ̲wait ̲count. Notify CR80 of fatal error.

         ADT14   IF ack ̲to ̲be ̲sent = true THEN send IRD1, ack
                 ̲to ̲be ̲sent:= false and start answer ̲timer.

         ADT15   Reject CR80 command with reason code = current
                 state.



         ADT16   Retransmit previous message with same SC and
                 OC.(5:3)= 001 (binary), NAK. If no previous
                 
                 message, then send TRANSMIT DATA, SDR1. Increment
                 req ̲i ̲errors, if greater than
                 req ̲io ̲error ̲limit, then set data ̲transmission
                 ̲error to true. Start answer ̲timer. Update statistics.

         ADT17   Retransmit previous message with same SC and
                 OC.(5:3)= 000 (binary), ACK. 
                 Update statistics. Start answer ̲timer.

         ADT18   Increment req ̲i ̲errors, if then greater than
                 req ̲io ̲error ̲limit set data ̲transmission ̲error
                 to true.

         ADT19   Increment req ̲o ̲errors if greater than
                 req ̲io ̲error ̲limit set data ̲transmission ̲error
                 to true.

         ADT20   Prepare for input from the line. Initiate variables.
                 Send TRANSMIT DATA, IDR1. Start answer ̲timer.
                 Set ack ̲to ̲be ̲sent to false.

         ADT21   Prepare for input from the line. Initiate variables.
                 Send TRANSMIT DATA, IDR1. Start answer ̲timer.
                 Set ack ̲to ̲be ̲sent to false. Set output ̲pending
                 to true

         ADT22   Start answer ̲timer. Set wait to true.

         ADT23   If wait is true then update counter for number
                 of waits else update counter for number of
                 no ̲responce.
                 If one of the counters is greater than the
                 limits then send DISCONNECT,SDR2 else if wait
                 is false then set OC (5:3) to 001, NAK and
                 retransmit the previous message with same SC.
                 Start answer ̲timer.
                 Set wait to false.

         ADT24   Cancel pending CR80 commands, notify CR80 about
                 closing. Clean up all input/output buffers.

         Figures 1.1.2-1 and 1.1.2-2 depict typical receive
         segment and send segment sequences.

         Segments are received and sent by the CR80 commands
         Request Input and Request Output.

         An overview of the most commonly used state transistions
         is given in Figure 1.1.2-3.






















































 FIGURE 1.1.2-1 STATE EVENT TABLE FOR DATA TRANSMISSION, 
                     RECEIVE SEGMENT






















































 FIGURE 1.1.2-2 STATE/EVENT TABLE FOR DATA TRANSMISSION, 
                       SEND SEGMENT


1.2      S̲O̲F̲T̲W̲A̲R̲E̲ ̲S̲T̲R̲U̲C̲T̲U̲R̲E̲

         The CSLP has the same software structure as CLP.



1.3      P̲A̲C̲K̲A̲G̲E̲ ̲D̲A̲T̲A̲

         The data description given here is based on the syntax
         for SWELL declarations even though the design is intended
         for implementation in Z80 code.

         CONST
           req ̲io ̲error ̲limit =      10; "max err./command
           dt ̲wait ̲count ̲limit=      10; "max wait counts
           id ̲size            =      35; "char. in passwrd/id
           segment ̲size       =    1140; "max segment size
           subsegment ̲size    =     324; "max subsegm. size
           noresponse ̲limit  =        7; "max number of noresponse

         TYPE
           sequences = (             "const. for sequence id
             open ̲link,              "eol event
             data ̲transmission);     "edt event

           cr80 ̲commands = (         "used for open, close etc.       illegal
                                                                      ̲command, "used
                                                                               if
                                                                               multiple
                                                                               commands
             no ̲command,             "of the same type is present
             open,
             close,
             req ̲input,
             req ̲output,
             cancel ̲input,
             cancel ̲output,
             show ̲stat,
             reset ̲stat);


           command ̲state = (         "used in global table
             not ̲rec,                "not received
             already ̲rec);           "already received

           pending ̲commands =        "type used for check of
             RECORD                  "CR80 commands
               open ̲1,
               close ̲1,
               req ̲i,
               req ̲o,
               cancel ̲i,
               cancel ̲o,
               show ̲s,
               reset ̲s               : command ̲state;
             END;

           pc ̲frames =
             RECORD                  "define message format
               syn0,
               syn1,
               syn2,
               syn3,
               soh,
               fc,
               sc,
               ac,
               oc,
               ic,
               aux,
               stx,
               mc                    : char; "characters
               text : array(0..323) of char;
               rs,
               etx,
               etb,
               bcc                   : char; "characters
             END;


           pc ̲messages = (           "message analysis
             no ̲message,             "of pc events
             frame ̲error,
             nak,
             srd3,                   "select
             srd4,                   "no instruction
             srd1,                   "RFD
             srd2,                   "disconnect
             crd1 ̲pswrd,             "logon password
             crd1 ̲keywrd,            "logon keyword
             crd2,                   "break
             cdr1,                   "line down
             ird1,                   "ack no request
             ird2,                   "wait
             idr1,                   "transmit data
             idr2,                   "DIN start
             idr3,                   "mid subsegment
             idr4),                  "last subsegment
             seqcon);                "constant sequence number

           clps ̲messages = (         "msg. sent from CLPS
             sr1,                    "ready for disconnect
             sr2,                    "disconnect
             ir1,                    "transmit data
             ir3,                    "first/mid subsegm.
             ir4,                    "last/entire subsegm.
             cr1,                    "line down message
             ir1,                    "transm. data sim.
             ir2);                   "DINDAC start

           open ̲link ̲states = (      "constants for state id
             so10,                   "
             so11,                   "States are defined
             so12,                   "in 1.1.1.a
             so13,                   "
             so14,                   "
             so15);                  "


           data ̲transmission ̲states = ("constants for state
           id
             sdt0,                   "
             sdt1,                   "  States are
             sdt2,                   "  defined in
             sdt3,                   "  1.1.2.a
             sdt4,                   "
             sdt5,                   "
             sdt6,                   "
             sdt7);                  "

           open ̲link ̲events = (      "constants for event id
             eo10,                   "
             eo11,                   "  Events are
             eo12,                   "  defined in
             eo13,                   "  1.1.1.b
             eo14,                   "
             eo15,                   "
             eo16,                   "
             eo17,                   "
             eo18,                   "
             eo19,                   "
             eo110);                 "

           data ̲trans ̲events = (     "  Constants for event
                                     id
             edt0,                   "  events are defined in
             edt1,                   "  1.1.2.b
             edt2                    "
             edt3,                   "
             edt4,                   "
             edt5,                   "
             edt6,                   "
             edt7,                   "
             edt8,                   "
             edt9,                   "
             edt10,                  "
             edt11,                  "
             edt12,                  "
             edt13,                  "
             edt14,                  "
             edt15,                  "
             edt16,                  "
             edt17,                  "
             edt18,                  "
             edt19,                  "
             edt20,                  "
             edt21);                 "


           open ̲link ̲actions = (     "
             ao10,                   "  open link
             ao11,                   "  action
             ao12,                   "  routines
             ao13,                   "  are defined
             ao14,                   "  in 1.1.1.c
             ao15,                   "
             ao16,                   "
             ao17,                   "
             ao18,                   "
             ao19,                   "
             ao110,                  "
             ao111,                  "
             ao112,                  "
             ao113,                  "
             ao114);                 "

           line ̲down ̲message ̲codes= ("cf PC/PDS/001 Ref 18 pp
           34,35
             CP,       "Central system disconnects.
             DIS,      "Received DIS PC II control record.
             ICC,      "Invalid command to/from central system.
             PAS,      "Did not receive user ID password.
             ABT,      "No SNUMB on Abort control card.
             S/I,      "Missing SNUMB or IDENT card.
             ONA,      "Output not available.
             INV,      "Invalid control card.
             IMF,      "Invalid message format.
             SLV,      "Slave program not in
                       "system (DAC only).
             OC,       "Output complete.
             SPD,      "Link space denied.
             NSA,      "No link space available.
             LNE,      "Link number error.
             6UA,      "Central system unavailable.
             RCE,      "Retry count exhausted.


             DOL,      "Device off-line.
             EOF,      "End-of-File (EOF status cannot recover).
             TNK,      "Terminal not known.
             RCM,      "Remote computer module.
             ACT,      "Line active.
             NDS,      "Line not completely disconnected.
             MCE,      "Media code error.
             XID,      "Blank or zero ID.
             "ID,      "Duplicate ID.
             PTF,      "No PAT entries available for input.
             SNB,      "Messing $ SNUMB card.
             SIZ,      "Job source too long.
             NUM,      "No available program number for job.
             DSC,      "Excessive disk errors.
             DUP,      "Duplicate SNUMB's
             LNK);     "No disk links available.



           data ̲transmission ̲actions=(
             adt0,                   "  data
             adt1,                   "  transmission
             adt2,                   "  action
             adt3,                   "  routines
             adt4,                   "  are defined in
             adt5,                   "  1.1.2.c
             adt6,                   "
             adt7,                   "
             adt8,                   "
             adt9,                   "
             adt10,                  "
             adt11,                  "
             adt12,                  "
             adt13,                  "
             adt14,                  "
             adt15,                  "
             adt16,                  "
             adt17,                  "
             adt18,                  "
             adt19,                  "
             adt20,                  "
             adt21,                  "
             adt22,                  "
             adt23,                  "
             adt24);                 "

           subsegment ̲type = (       "ETB/ETX to be sent
             etb ̲subsegment,         "first/mid subsegm.
             etx ̲subsegment);        "last or entire

           table ̲element =
             RECORD
               state,
               action : integer;
             END;



           ol ̲table ̲column =         "column in state event
             RECORD                  "table for open link
               s0,                   
               s1,
               s2,
               s3,
               s4,
               s5 : table ̲element;
             END;

           dt ̲table ̲column =…02…"column in state event
             RECORD                  "table for data transm.
               s0,
               s1,
               s2,
               s3,
               s4,
               s5,
               s6,
               s7 : table ̲element;
             END;

         clps ̲command ̲id = (         "identifies incoming cmd
           clps ̲open ̲link ̲id,
           clps ̲close ̲link ̲id,
           clps ̲request ̲input ̲id,
           clps ̲request ̲output ̲id,
           clps ̲cancel ̲input ̲id,
           clps ̲cancel ̲output ̲id,
           clps ̲show ̲statistics ̲id,
           clps ̲reset ̲statistics ̲id);

         clps ̲open ̲link ̲cmd =
           RECORD
             command ̲id: clps ̲command ̲id;
             addr: address; "pointer to parameters
           END;

         clps ̲logon ̲params =
           RECORD
             baudrate ̲ccis: integer;
             id ̲pass: array(0..35) of char;
           END;



         clps ̲close ̲cmd =
           RECORD
             command ̲id: clps ̲command ̲id;
           END;

         clps ̲request ̲input ̲cmd =
           RECORD
             command ̲id: clps ̲command ̲id:
             addr: address; "address of data buffer
           END;

         clps ̲request ̲output ̲cmd =
           RECORD
             command ̲id: clps ̲command ̲id;
             addr: address; "address of data buffer
             bytes: integer;
           END;

         clps ̲cancel ̲input ̲cmd =
           RECORD
             command ̲id: clps ̲command ̲id;
           END;

         clps ̲cancel ̲output ̲cmd =
           RECORD
             command ̲id: clps ̲command ̲id:
           END;

         clps ̲show ̲statistics ̲cmd =
           RECORD
             command ̲id: clps ̲command ̲id;
             addr: address; "address of clps ̲response ̲params
           END;

         clps ̲reset ̲statistics ̲cmd =
           RECORD
             command ̲id: clps ̲command ̲id;
           END;

         clps ̲response =
           RECORD
             command ̲id: clps ̲command ̲id;
             result,
             bytes: integer;
             fill: ARRAY(0..1) OF integer;
           END;



         clps ̲response ̲params =
           RECORD
             msg ̲transmitted,
             msg ̲retransmitted,
             info ̲msg ̲received,
             msg ̲in ̲error         :  integer
           END;


         VAR
           open ̲link ̲nak ̲count,      "count NAK's
           event ̲class,              "event recognized
           state,                    "state id
           action ̲id,                "action id
           req ̲o ̲errors,             "count err. in DT
           req ̲i ̲errors,             "count err. in DT
           data ̲transmission ̲error,  "ctrl. variable
           baudrate,                 "for HW initializ.
           messages ̲transmitted,     "statistics inform.
           messages ̲retransmitted,   "subsegm. retransm.
           i ̲messages ̲received,      "info messgs receiv.
           frames ̲received ̲error,    "incom. subs., error
           sequence ̲id,              "open, data, or ccis sim.
           cr ̲80 ̲command,            "of type ̲cr80 ̲commands
           pc ̲message,               "of type pc ̲message
           out ̲byte ̲count,           "bytes sent from segment
           actual ̲segment ̲size,      "size of segm. to be sent
           message ̲reference,        "pointer to msg. header
           text ̲reference            "pointer to text field
                                   :  integer;

           start ̲protocol,           "indicates RFD to be sent
           open ̲link ̲timeout,        "timeout flag in open link
           naks ̲exceeded,            "too many naks per transm.
           set ̲nak,                  "set nak before sending
                                     frame
           freeze ̲sc,                "don't change sc
           ack ̲to ̲be ̲sent,           "flag outstanding ACK
           output ̲pending,           "flag for pending CR80
                                     answer
           wait,                     "flag for wait message
           last                      "flag for last output segment
                                   :  boolean;

           id ̲pass,                  "for holding char. strings
           test ̲id ̲pass              "fixed array for simulation
                                   :  array(0..id ̲size) of char;
                                     "35 characters & delimit.


           pc ̲frame,                 "pc msg. format
           clps ̲frame,               "clps message format
                                   :  pc ̲frames;

           message ̲status            "error, nak, implied ack.
                                   :  cr80 ̲commands;

           ol ̲state ̲table : array(0..eo111) OF ol ̲table ̲column;
           dt ̲state ̲table : array(0..edt18) OF dt ̲table ̲column;

           line ̲down ̲message ̲code:   line ̲down ̲message ̲codes;

         INIT                        "initialization of variables
           id ̲pass        = (:0:);   "fill with nulls
           test ̲id ̲pass   = '$*$LOGID$PASSWORD/DNM';
           ol ̲state ̲table = .......; "cf. section 1.1.1
           dt ̲state ̲table = .......; "cf. section 1.1.2
           ack ̲to ̲be ̲sent = true;



1.4      P̲A̲C̲K̲A̲G̲E̲ ̲D̲E̲S̲I̲G̲N̲



1.4.1    P̲r̲o̲t̲o̲c̲o̲l̲ ̲E̲n̲t̲r̲y̲ ̲P̲s̲e̲u̲d̲o̲ ̲C̲o̲d̲e̲

         input :
           none

         output:
           none

         function:
           the mainprogram analyzes events and acts according
           to the sequence invoked (open link or data transm.)
           and the current state.

           the new state and next event are fetched by external
           procedures.

         procedures called:
           event ̲analyzer
           update ̲ol ̲state
           update ̲dt ̲state
           open ̲link0 through open ̲link14 procedures
           data ̲transmission0 through data ̲transmission24
           procedures


         external data:
           sequence ̲id
           event ̲class
           state
           action ̲id
           ol ̲state ̲table
           dt ̲state ̲table

         local data:
           none

         BEGIN "of protocol entry (CLPS mainprogram)
           initialize open link state event table;
           initialize data transmission state event table;
           sequence ̲id:= open ̲link;
           state:= so10; "set initial state
           REPEAT
           BEGIN
             event ̲analyzer(sequence ̲id) "open link or data
             tr.
                           (event ̲class);"input found
               update ̲state(state, event ̲class) "state event
                              (state, action ̲id);  "new state
                                                   "and action

               CASE sequence ̲id OF
               open ̲link:
               BEGIN
                 CASE action ̲id OF
                 ao10  : open ̲link0 () (); "cf. PDS section
                 ao11  : open ̲link1 () (); "1.1.1 for content
                 ao12  : open ̲link2 () (); "of open link
                 ao13  : open ̲link3 () (); "procedures
                 ao14  : open ̲link4 () (); "
                 ao15  : open ̲link5 () (); "
                 ao16  : open ̲link6 () (); "


                 ao17  : open ̲link7 () (); "
                 ao18  : open ̲link8 () (); "
                 ao19  : open ̲link9 () (); "
                 ao110 : open ̲link10() (); "
                 ao111 : open ̲link11() (); "
                 ao112 : open ̲link12() (); "
                 ao113 : open ̲link13() (); "
                 ao114 : open ̲link14() (); "
                 END; "case action ̲id in open link sequence
               END; "servicing open link event

               data ̲transmission:
               BEGIN
                 update ̲dt ̲state(state,event ̲class)
                                (state,action ̲id);

                 CASE action ̲id OF
                 adt0  : data ̲transmission0 () (); "cf. PDS
                 sect.
                 adt1  : data ̲transmission1 () (); "1.1.2 for
                 adt2  : data ̲transmission2 () (); "content
                       of 
                                                   "data
                 adt3  : data ̲transmission3 () (); "transmission
                 adt4  : data ̲transmission4 () (); "procedures
                 adt5  : data ̲transmission5 () (); "
                 adt6  : data ̲transmission6 () (); "
                 adt7  : data ̲transmission7 () (); "
                 adt8  : data ̲transmission8 () (); "
                 adt9  : data ̲transmission9 () (); "
                 adt10 : data ̲transmission10() (); "
                 adt11 : data ̲transmission11() (); "
                 adt12 : data ̲transmission12() (); "
                 adt13 : data ̲transmission13() (); "
                 adt14 : data ̲transmission14() (); "
                 adt15 : data ̲transmission15() (): "
                 adt16 : data ̲transmission16() (); "
                 adt17 : data ̲transmission17() (); "
                 adt18 : data ̲transmission18() (); "
                 adt19 : data ̲transmission19() (); "
                 adt20 : data ̲transmission20() (); "
                 adt21 : data ̲transmission21() (); "
                 adt22 : data ̲transmission22() (); "
                 adt23 : data ̲transmission23() (); "
                 adt24 : data ̲transmission24() (); "
                 END; "end data transmission actions
               END; "data transmission sequence

               END; "case sequence id
             END
             UNTIL A NE A "End repeat forever
           END; "protocol entry.


1.4.2    E̲v̲e̲n̲t̲ ̲A̲n̲a̲l̲y̲z̲e̲r̲ ̲P̲s̲e̲u̲d̲o̲ ̲C̲o̲d̲e̲

        a)   PROCEDURE event ̲analyzer
                   (sequence ̲id: sequences) "kept at return
                   (event ̲class: integer)

         input :
           sequence ̲id        which type of event should be
                              searched for, open link, data
                              transmission

         output :
           event ̲class        event class found

         function:
           find the event class according to the sequence
           identifier entered telling which state event table
           is currently used.

         procedures called:
           get ̲cr80 ̲command
           get ̲pc ̲message

         external data :
           refer to the data description

         local data    :
           none


         BEGIN  "procedure start
           line ̲down ̲message ̲code:= OK; "initialize result code
           IF sequence ̲id = open ̲link THEN
           BEGIN
             event ̲class:= eo111;
             get ̲pc ̲message()(pc ̲message);    
             IF pc ̲message NE no ̲message THEN
             BEGIN
               CASE pc ̲message OF
               frame ̲error : event ̲class:= eo16;
               nak : event ̲class:= eo17;
               srd1 : event ̲class:= eo12;
               crd1X : event ̲class:= eo13;
               crd1Y : event ̲class:= eo14;
               ird1 : event ̲class:= eo15;
               OTHERWISE event ̲class:= eo111;
             END; "end case clause
             ELSE
             BEGIN "there was no new cr80 command
               get ̲cr80 ̲command() (cr80 ̲command)
               IF cr80 ̲command NE no ̲command THEN
               BEGIN
                 CASE cr80 ̲command OF
                 open : event ̲class:= eo10;
                 close : event ̲class:= eo11;
                 OTHERWISE event ̲class:= eo110; "illegal com
               END  "end get ̲pc ̲command
             END; "end cr80 message decoding
           END; "end of eo10 through eo111



           IF sequence ̲id = data ̲transmission THEN
           BEGIN
             event ̲class:= edt19; "other events are edt18
             IF answer ̲timeout = true THEN
               event ̲class:= edt19
             IF data ̲transmission ̲error = true THEN
               event ̲class:= edt0
             ELSE
             BEGIN
               get ̲pc ̲message()(pc ̲message);
               IF pc ̲message NE no ̲message THEN
               BEGIN
                 CASE pc ̲message OF
                 frame ̲error : event ̲class:= edt15;
                 nak : event ̲class:= edt14;
                 srd1 : event ̲class:= edt9;
                 ird1 :
                 BEGIN "ETX or ETB to be sent?
                   IF actual ̲segment ̲size - out ̲byte ̲count
                   is less than or equal to subsegment ̲size
                   THEN
                     event ̲class:= edt11
                   ELSE
                     event ̲class:= edt10;
                 END; "end of ird1 analysis
                 ird3 : event ̲class:= edt13;
                 ird4 : event ̲class:= edt14;
                 OTHERWISE event ̲class:= edt19;
               END


               ELSE
               BEGIN "there was no new pc command
                 get ̲cr80 ̲command()(cr80 ̲command);
                 IF cr80 ̲command NE no ̲command THEN
                 BEGIN "new cr80 command has arrived
                   CASE cr80 ̲command OF
                   close : event ̲class:= edt1;
                   req ̲input : event ̲class:= edt2;
                   req ̲output :
                   BEGIN
                     IF actual ̲segment ̲size is less than or
                        equal to subsegment ̲size THEN 
                        event ̲class:= edt4
                     ELSE
                        event ̲class:= edt3;
                   END; "req output with ETX or ETB segment
                   cancel ̲input : event ̲class:= edt5;
                   cancel ̲output : event ̲class:= edt6;
                   show ̲stat : event ̲class:= edt7;
                   reset ̲stat : event ̲class:= edt8;
                   OTHERWISE event ̲class:= edt19;
                 END  "end of cr80 command case clause
                 ELSE
                   event ̲class:= edt19; "no message from cr80

               END; "cr80 message analysis
             END; " event is not data transm. error
           END; " sequence ̲id is data ̲transmission

         END; " procedure event ̲analyser


        b) PROCEDURE get ̲cr80 ̲command
                   () "no input
                   (cr80 ̲command: cr80 ̲commands);

         input   :
           none

         output  :
           cr80 ̲command identified by constant contained
           in the type declaration cr80 ̲commands

         function:
           check for presence of a cr80 ̲command. Check
           to avoid multiple pending commands of the
           same type

         procedures called:
           cr80 communication module

         external data :
           command ̲status:  table with one entry for each
           possible cr80 command. Entries have values
           not ̲rec or already ̲rec  "received or not

         local data:
           temp ̲state: command ̲state "for local use

         BEGIN "of procedure get ̲cr80 ̲command
           cr80 ̲command:= no ̲command; "output if no comm.
           call cr80 communication module
           IF cr80 ̲command is present THEN
             cr80 ̲command:= constant; "constant of type
                                      "cr80 ̲commands
           temp ̲state:= not ̲rec;

           CASE cr80 ̲command OF "see if already pending
           no ̲command: ; "no action
           open: temp ̲state:= c ̲status.open ̲1;
           close: temp ̲state:= c ̲status.close ̲1;
           req ̲input: temp ̲state:= c ̲status.req ̲i;
           req ̲output: temp ̲state:= c ̲status.req ̲o;
           cancel ̲input: temp ̲state:= c ̲status.cancel ̲i;
           cancel ̲output: temp ̲state:= c ̲status.cancel ̲o;
           show ̲stat: temp ̲state:= c ̲status,show ̲s;
           reset ̲stat: temp ̲state:=c ̲status.reset ̲s;


           OTHERWISE  ; "no action

           IF temp ̲state = already ̲rec THEN
           BEGIN
             cancel the command received (clear RAM area
             of the excessive command)

             CASE cr80 ̲command OF "restore table entry
             no ̲command: ; "no action
             open: c ̲status.open ̲1:= not ̲rec;
             close: c ̲status.close ̲1:=not ̲rec;                      req
                                                                    ̲input:
                                                                    c
                                                                    ̲status.req
                                                                    ̲i:=
                                                                    not
                                                                    ̲rec;
             req ̲output: c ̲status.req ̲o:= not ̲rec;
             cancel ̲input: c ̲status.cancel ̲i:= not ̲rec;
             cancal ̲output: c ̲status.cancel ̲o:= not ̲rec;
             show ̲stat: c ̲status.show ̲s:= not ̲rec;
             reset ̲state: c ̲status.reset ̲s:= not ̲rec;
             OTHERWISE  : "no action

             cr80 ̲command:= illegal ̲command;
           END
           ELSE
           BEGIN "normal update of command status
             CASE cr80 ̲command OF "restore table entry
             no ̲command: ; "no action
             open: c ̲status.open ̲1:= already ̲rec;
             close: c ̲status.close ̲1:= already ̲rec;
             req ̲input: c ̲status.req ̲i:= already ̲rec;
             req ̲output: c ̲status.req ̲o:= already ̲rec;
             cancel ̲input: c ̲status.cancel ̲i:= already ̲rec;
             cancel ̲output: c ̲status.cancel ̲o:= already rec;
             show ̲stat: c ̲status.show ̲s:= already ̲rec;
             reset ̲stat: c ̲status.reset ̲s:= already ̲rec;
             OTHERWISE  ; "no action
           END; "end of normal table update
         END; "end procedure get ̲cr80 ̲command


        c) PROCEDURE get ̲pc ̲message
                   ( )  "no input
                   (pc ̲message : pc ̲messages)

         input   :
           none

         output  :
           constant identifying pc message event
           (no ̲message, nak, or regular messages).
           Refer to Package Data, section 1.3

         function:
           see if a pc message has arrived.
           Return with message- or error identification
           or the value no ̲message.

         procedures called:
           check ̲pc ̲buffer

         external data:
           none

         local data:
           message ̲group : integer of TYPE =(service,
                                       control, info);
           fc ̲code, oc ̲code : integer;

         BEGIN "of get ̲pc ̲message
           "check for incoming message"
           check ̲pc ̲buffer() (message ̲status,
                                message ̲reference,
                                text ̲reference);

           pc ̲message:= message ̲status;
           IF pc ̲message NE seqcon LOGAND
              pc ̲message NE frame ̲error LOGAND
              pc ̲message NE nak LOGAND
              pc ̲message NE implied ̲ack THEN 
           BEGIN "ordinary message
             fc ̲code:= pc ̲frame.fc; "get function code
             oc ̲code:= pc ̲frame.oc; "get operation code
             IF fc ̲code = #42 LOGOR
                fc ̲code = #43 THEN
               message ̲group:= service;
             IF fc ̲code = #44 THEN message ̲group:= control;
             IF fc ̲code = #4D THEN message ̲group:= info;


             pc ̲message:= frame ̲error;
             CASE message ̲group OF
             service:
             BEGIN "service message validation
               IF oc ̲code = #44 THEN
                 pc ̲message:= sdr1; "RFD
               IF oc ̲code = #46 THEN
                 pc ̲message:= sdr2; "disconnect
               IF oc ̲code = #42 THEN
                 pc ̲message:= srd3; "select
               IF oc ̲code = #40 THEN
                 pc ̲message:= srd4; "no instruction
             END; "service message validation

             control:
             BEGIN "ctrl. msg. validation
               IF oc ̲code NE #40 LOGOR
               (pc ̲frame.sc NE #41 LOGAND "cf.Ref18,p33
                pc ̲frame.sc NE #42) LOGOR
                pc ̲frame.stx NE #02 LOGOR
               (pc ̲frame.mc NE #48 LOGAND
                pc ̲frame.mc NE #4E) LOGOR
                pc ̲frame.rs NE #1E THEN
                pc ̲message:= frame ̲error 
               ELSE
               BEGIN
                 IF pc ̲frame.text = …08…$*$LOGID$PSWRD/DNM…08… THEN
                   pc ̲message:= crd1 ̲pswrd; "simulation
                 IF pc ̲frame.text = …08…$*$DACDINDAC…08… THEN
                      pc ̲message:= crd1 ̲keywrd; "simulation
                 IF pc ̲frame.text = #31 THEN
                      pc ̲message:= crd2; "break
                 IF pc ̲frame.text = …08…LINE DISCONNECTED XXX…08…
                                                      LOGOR
                       pc ̲frame.text = …08…LINE TERMINATED XXX…08…
                                                         THEN
                 BEGIN "line down control message received
                      pc ̲message:= cdr1; "line down message
                      look up the constant of type
                      line ̲down ̲message ̲codes corresponding
                      to the string XXX. Store the
                      constant in the variable
                      line ̲down ̲message ̲code.
                 END;
               END;
             END; "ctrl message validation


             info:
             BEGIN
               IF (oc ̲code NE #40 LOGAND "validation
                   oc ̲code NE #42 LOGAND "Ref.18,p33
                   oc ̲code NE #44) LOGOR
                   (pc ̲frame.sc NE #41 LOGAND
                   pc ̲frame.sc NE #42) LOGOR
                   pc ̲frame.stx NE #02 LOGOR
                   (pc ̲frame.etb NE #03 LOGAND
                   pc ̲frame.etx NE #17) THEN
                     pc ̲message:= frame ̲error;
               ELSE
               BEGIN "valid message
                 IF oc ̲code = #40 THEN
                 BEGIN "no request message
                   IF pc ̲frame.text = …08……08… THEN "no text
                     pc ̲message:= ird1; "ack no request
                   IF pc ̲frame.text = …08…(*)DINDAC…08… LOGOR
                      pc ̲frame.text = …08…(*)RSTRT…08… THEN
                      pc ̲message:= idr2; "DIN/RST msg.
                   IF pc ̲message NE idr2 LOGAND
                      pc ̲frame.text NE …08……08… THEN
                      BEGIN
                       IF pc ̲frame.etb = #17 THEN
                         pc ̲message:= idr3; "etb subsegm.
                       IF pc ̲frame.etx = #03 THEN
                         pc ̲message:= idr4; "etx subsegm.
                      END;
                 END; "no request message

                 IF oc ̲code = #44 THEN
                   pc ̲message:= ird2; "wait
                 IF oc ̲code = #42 THEN
                   pc ̲message:= idr1; "transmit data
               END "valid message
             END;  "information message

           END; "end case message group
          END; "end of normal message validation
         END; "procedure get ̲pc ̲message


        d) PROCEDURE check ̲pc ̲buffer
                   ()
                   (message ̲status : pc ̲messages,
                    message ̲reference,
                    text ̲reference : integer)

         input   :
           none

         output  :
           message ̲status which holds a constant from the
           constants listed in …08…pc ̲messages…08…, i.e.
           no ̲message, frame ̲error, nak, implied ̲ack

         function:
           check incoming message buffer for the arrival
           of a message

         procedures called:
           none

         external data:
           pc ̲frame: pc ̲frames; "cf. Package Data

         local ̲data:
           fc ̲code, oc ̲code, old ̲sc, new ̲sc : integer;
           parity ̲ok, block ̲check ̲ok : boolean;

         BEGIN
           message ̲status:= no ̲message;
           check for incoming message in buffer
           IF no message present THEN
             message ̲status:= no ̲message
           ELSE
           BEGIN "pc message is present
             check for odd parity computed by HW (bit 4 of
             …08…read…08… register #1 on LTU SIO circuit)
             IF no parity error THEN
               parity ̲ok:= true
             ELSE
               parity ̲ok:= false;


             compute a vertical ex ̲OR on characters following
             SOH (#01) and including ETX(#03) or ETB(#17)
             IF pc ̲frame.bcc = BCC computed THEN
               block ̲check ̲ok:= true
             ELSE
               block ̲check ̲ok:= false;

             fc ̲code:= pc ̲frame.fc; "check function code

             IF (fc ̲code NE #42 LOGAND
                 fc ̲code NE #43 LOGAND "used in SELECT
                 fc ̲code NE #44 LOGAND
                 fc ̲code NE #4D) LOGOR
                 parity ̲ok = false LOGOR
                 block ̲check ̲ok = false THEN
                   message ̲status:= frame ̲error
             ELSE
             BEGIN "check for nak
               message ̲reference:= ADDRESS(pc ̲frame); "pointer
               text ̲reference:= ADDRESS(pc ̲frame.text);
               new ̲sc:= pc ̲frame.sc; "sequence code
               message ̲status:= ird3; "arbitrary NE nak
               oc ̲code:= pc ̲frame.oc;
               IF oc ̲code.(5:3) = 001 (binary) THEN
               message ̲status:= nak;
               ELSE
               BEGIN
                 IF old ̲sc = new ̲sc
                 then message ̲status = seqcon;
               END
             END; "nak check
           END; "pc message present
         old ̲sc:= new ̲sc;
         END; "procedure


        e) PROCEDURE update ̲state
                   (state, event ̲class) "input
                   (state, action ̲id) "output

         input   :
           current state to be updated
           event class identified in procedure event ̲analyzer

         output  :
           new state
           action identifier

         function:
           update state and find action ̲id from
           ol ̲state ̲table or dt ̲state ̲table

         external data:
           ol ̲state ̲table
           dt ̲state

         CASE sequence ̲id OF

         open ̲link:
           BEGIN "update ̲ol ̲state
             (state, action ̲id):= ol ̲state ̲table(state, event
             ̲class);
           END; "end procedure

         data ̲transmission:
           BEGIN "update ̲dt ̲state
             (state, action ̲id):= dt ̲state ̲table(state, event
             ̲class);
           END; "end procedure update ̲dt ̲state

         END; "case sequence ̲id


1.4.3    S̲e̲n̲d̲ ̲C̲L̲P̲ ̲M̲e̲s̲s̲a̲g̲e̲ ̲P̲s̲e̲u̲d̲o̲ ̲C̲o̲d̲e̲

         PROCEDURE send ̲clps ̲message
                   (clps ̲message: clps ̲messages,
                   set ̲nak,
                   freeze ̲sc: boolean)
                   ( )

         input   :
           constant of type clps ̲messages (see section
           1.3) identifying which message is to
           be sent. Userid and password are given
           in global variables userid and passwrd.

           set ̲nak = true causes nak field to be set

           freeze ̲sc = true will cause the sc field
           to remain constant compared to previous
           message sent from CLPS

         output  :
           none

         function:
           send a particular message to pc according
           to the message identification held in the
           variable clps ̲message.
           set sequence code field and nak field according to
           input booleans 

         procedures called:
           link driver module

         external data:
           clps ̲message: clps ̲messages; "constant
           clps ̲frame: pc ̲frames; "format of message
           set ̲nak, freeze ̲sc: boolean;

         local data:
           old ̲sc: integer; "previous SC
                            "used by PC


         BEGIN "procedure send ̲clps ̲message
           CASE clps ̲message OF
           sr1       : prepare ready for disconnect, SDR1
           sr2       : prepare disconnect, SDR2
           cr1       : prepare line down message, CDR1
           ir1       : prepare transmit data, IDR1
           ir2       : prepare dindac start, IDR2
           ir3       : prepare first, mid subsegm., IDR3
           ir4       : prepare last/entire subsegment, IDR4
           OTHERWISE ; " end case

           IF set ̲nak = true THEN
             clps ̲frame.oc(5:3):= 001 (binary);
           IF freeze ̲sc = false THEN
           BEGIN
             IF old ̲sc = #41 THEN
               clps ̲frame.sc:= #42
             ELSE
               clps ̲frame.sc:= #41;
           END
           ELSE
             clps ̲frame.sc:= old ̲sc; "previous sc from CLPS
             side

           send message prepared in buffer clps ̲frame
         END; "procedure send ̲clps ̲message



1.5      P̲A̲C̲K̲A̲G̲E̲ ̲I̲N̲T̲E̲R̲F̲A̲C̲E̲S̲

         CLPS receives the following commands from CPA:

         -   logon
         -   close link
         -   request input
         -   request output
         -   cancel input request
         -   cancel output request


         CLPS receives the following commands from CI:

         -   show statistics

         -   reset statistics

         All commands are issued to CLPS through the LTU driver
         which passes command records to the LTU.

         Generally, commands consist of records. In each record
         the first item is an integer identifying the command.

         This command identification is followed by one or more
         parameters. The format of a Request Output command
         is shown below.

         TYPE
           clps ̲request ̲output ̲cmd =
           RECORD
             command ̲id: clps ̲command ̲id;
             addr: address; "integer pointer to output buffer
             bytes: integer;
           END;

         The type clps ̲command ̲id consists of simple integer
         constants.

         Similarly responses are communicated to CR80 using
         formats such as

         TYPE
           clps ̲request ̲output ̲rsp =
           RECORD
             command ̲id: clps ̲command ̲id;
             result: integer;
             ...     "additional
             ...     "parameters
           END;

         A complete description of command formats is given
         in section 1.3.

         A more detailed description of coded command formats
         is given in PC/AUX/009 Protocol Converter CR80-LTU
         I/F.