home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / computervision / kermit.sconnect < prev    next >
Text File  |  2020-01-01  |  4KB  |  143 lines

  1. * 14 aug 85 esj attempt to use a queue structure to prevent dropping
  2. *              characters in connect mode
  3. * 18-jul-85 pcc; fix so it compiles
  4. *
  5. *************************************** CVCOMMAND.KERMIT.SCONNECT ******
  6. *
  7.       E:F A:S(NWLS)
  8.       E:O SCONNECT.
  9. *
  10. ************************************************************************
  11. *
  12. *
  13. *     Allows the local KERMIT to act as a dumb terminal connected to
  14. *     another computer.
  15. *
  16. /INCLUDE BYU.PROG.KERMIT.SYM.EQU.KERCOM
  17. /INCLUDE BYU.PROG.KERMIT.SYM.EQU.KERDEF
  18. *
  19.    EQU LCLQSIZ = 1000
  20.    EQU RMTQSIZ = 10
  21. *
  22.    I'R TISUNIT
  23.    I'R TISTYPE
  24.    I'R COUNT
  25.    I'R CHBUF
  26.    I'R STATUS
  27.    G'L LCLCHQ(LCLQSIZ)        ; char queues for local and remote devices
  28.    I'R RMTCHQ(RMTQSIZ)
  29.    I'R LCLQPTRI                ; index to next empty spot in queue
  30.    I'R RMTQPTRI
  31.    I'R LCLQPTRO                ; index to next char to be dumped in queue
  32.    I'R RMTQPTRO
  33.  
  34.  
  35. *Formats to V:S
  36.    V:S F101 = $ To exit from CHAT mode; type control-!$
  37. *
  38. ******************* start of executable code ***************************
  39. *
  40.    STATUS=YES
  41.  
  42.    E:E TYPMSG.(F101)
  43.    CHBUF = CTL.(ESCHAR)
  44.    E'E TYPE.(1,CHBUF.LSH.8)
  45.  
  46.    E'E TRANSPAR.
  47.  
  48. ;  start up the queue structures
  49.    LCLQPTRI = LCLQPTRO = 0
  50.    RMTQPTRI = RMTQPTRO = 0
  51.  
  52. ;  start up the io flags
  53.        LOCALDEV(1) = -1
  54.        RMTDEV(1)   = -1
  55.  
  56. ;     r't
  57. ;        w'r there is input
  58. ;           input char
  59. ;           did char come from localdev?
  60. ;           yes --> is it the escape char?
  61. ;                 yes --> punt to exit
  62. ;                 no  --> send to rmtdev queue
  63. ;           no  --> it came from the rmtdev
  64. ;                   send it to the localdev queue
  65. ;        e'l
  66. ;        w'r lcldev is not busy and lcldev queue is not empty
  67. ;           send char to lcldev
  68. ;        e'l
  69. ;        w'r rmtdev is not busy and rmtdev queue is not empty
  70. ;           send char to rmtdev
  71. ;        e'l
  72. ;     f'r
  73.  
  74.    R'T
  75.       W'E CHKINPUT.(TISUNIT,COUNT) .E. 0
  76.          E'E INPUT.(TISUNIT, TISTYPE, COUNT, CHBUF)
  77.  
  78.          W'R TISUNIT .E. LOCALDEV
  79.             W'R CHBUF .E. ESCHAR
  80.                T'O DONE
  81.             O'E
  82. ;            E'E TPUTCH.(CHBUF, RMTDEV)
  83. ;              put the char on the queue and ignore overflow condition for now
  84.                RMTCHQ(RMTQPTRI) = CHBUF
  85.                RMTQPTRI = (RMTQPTRI + 1) .MOD. RMTQSIZ
  86. #              E'E HEXDMP.(1,11,1,RMTCHQ(RMTQPTRO))
  87.  
  88.             E'L
  89.  
  90.          O'E
  91. ;         E'E TPUTCH.(CHBUF, LOCALDEV)
  92. ;           put the char on the queue and ignore overflow condition for now
  93.  
  94.             LCLCHQ(LCLQPTRI) = CHBUF
  95.             LCLQPTRI = (LCLQPTRI + 1) .MOD. LCLQSIZ
  96. #           E'E HEXDMP.(0,10,0,LCLCHQ(LCLQPTRO))
  97.          E'L
  98.       E'W
  99.  
  100. ;     if the queue is not empty and there is no io in progress or
  101. ;     this is the first time through the io loop, print a char
  102.       W'R LCLQPTRI .NE. LCLQPTRO
  103. #        E'E HEXDMP.(0,1,0,LOCALDEV)
  104.          W'R LOCALDEV(1) .E. -1
  105. ;           this is for the first time through
  106.             E'E TPUTCH.(LCLCHQ(LCLQPTRO), LOCALDEV)
  107.             LCLQPTRO = (LCLQPTRO + 1) .MOD. LCLQSIZ
  108. #           E'E HEXDMP.(0,1,0,LOCALDEV)
  109.  
  110.          O'R TESTIO.(LOCALDEV(1)) .NE. 0
  111. ;           this is for all of the other times through when io is done
  112.             LOCALDEV(1) = -1 ; clear io flag
  113.             E'E TPUTCH.(LCLCHQ(LCLQPTRO), LOCALDEV)
  114.             LCLQPTRO = (LCLQPTRO + 1) .MOD. LCLQSIZ
  115. #           E'E HEXDMP.(0,1,0,LOCALDEV)
  116.          E'L
  117.       E'L
  118.  
  119. ;     ditto
  120.       W'R RMTQPTRI .NE. RMTQPTRO
  121. #        E'E HEXDMP.(1,2,1,RMTDEV)
  122.          W'R RMTDEV(1) .E. -1
  123. ;           this is for the first time through
  124.             E'E TPUTCH.(RMTCHQ(RMTQPTRO), RMTDEV)
  125.             RMTQPTRO = (RMTQPTRO + 1) .MOD. RMTQSIZ
  126. #           E'E HEXDMP.(1,2,1,RMTDEV)
  127.  
  128.          O'R TESTIO.(RMTDEV(1)) .NE. 0
  129. ;           this is for all of the other times through when io is done
  130.             RMTDEV(1) = -1 ; clear io flag
  131.             E'E TPUTCH.(RMTCHQ(RMTQPTRO), RMTDEV)
  132.             RMTQPTRO = (RMTQPTRO + 1) .MOD. RMTQSIZ
  133. #           E'E HEXDMP.(1,2,1,RMTDEV)
  134.          E'L
  135.       E'L
  136.  
  137.    F'R
  138.  
  139. DONE   E'E OPAQUE.
  140.        E'E TYPE.(0,0)
  141.    F'N
  142.    E'N
  143.