home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / pdp11 / k11dsp.mac < prev    next >
Text File  |  2020-01-01  |  6KB  |  306 lines

  1.     .title    k11dsp    dispatch to correct terminal i/o for RT11, PRO/RT,TSX
  2.     .ident    /2.24/
  3.  
  4.     
  5.  
  6.  
  7.     .if ndf, K11INC
  8.     .ift
  9.     .include    /IN:K11MAC.MAC/
  10.     .endc
  11.  
  12.     .enabl    gbl
  13.  
  14. ;    08-Nov-84  16:16:40  Brian Nelson
  15. ;
  16. ;    Collect K11PRT, K11RTT and K11TSX into separete overlays in
  17. ;    the same region (either disk or virtual).  Dispatch to  the
  18. ;    correct one based on (1)  the exectype flag  set at program
  19. ;    entry in XINIT, or (2) force PRO/350 mode  if the device is
  20. ;    X?: (checked in  ASSDEV  below).  While the cost in address
  21. ;    space is a bit  to create  overlay table entries for all of
  22. ;    the ept's in each module is about 300 words,  doing so will
  23. ;    save me the need to create multiple save images  every time
  24. ;    I  change Kermit-11.  Additionally,  one save image for all
  25. ;    systems sounds like a nice idea to me.
  26. ;
  27. ;    12-Sep-86  11:20:20 BDN Changed around to separate I/D space
  28. ;                Not needed for RT but may as well be
  29. ;                consistant.
  30.  
  31.  
  32.     .macro    ENTRY    ep
  33.     .enabl    lsb
  34. ep::    mov    #200$    ,r0
  35.     jmp    dispat
  36.     .save
  37.     .psect    $PDATA    ,D
  38. 200$:    .word    M.'EP,X.'EP,T.'EP
  39.     .restore
  40.     .dsabl    lsb
  41.     .endm    ENTRY
  42.  
  43.     .macro    CALLDSP    ep
  44.     .enabl    lsb
  45.     mov    #200$    ,r0
  46.     call    dispat
  47.     return
  48.     .save
  49.     .psect    $PDATA    ,D
  50. 200$:    .word    M.'ep,X.'ep,T.'ep
  51.     .restore
  52.     .dsabl    lsb
  53.     .endm    CALLDSP
  54.  
  55.  
  56.     .save
  57.     .psect    packet    ,rw,d,lcl,rel,con
  58. packet::.blkb    MAXLNG+20
  59.     .even
  60.     .even
  61.     .psect    rttda
  62. consav::.blkb    50
  63. ttparm::.blkb    50
  64.     .restore
  65.  
  66.  
  67.  
  68.     JSW    =    44
  69.     .MCALL    .TTINR
  70.  
  71. dispatch:
  72.     tst    proflg            ; is this a pro/350 today?
  73.     bne    pro            ; yes
  74.     tst    tsxflg            ; is this tsx/tsx+
  75.     bne    tsx
  76.     jsr    pc    ,@(r0)        ; no, it plain old RT11. Use
  77.     return                ; multiple terminal service for i/o
  78.  
  79. pro:    tst    (r0)+            ; pro/rt11, do the right thing
  80.     jsr    pc    ,@(r0)        ; simple
  81.     return
  82.  
  83. tsx:    cmp    (r0)+    ,(r0)+        ; tsx
  84.     jsr    pc    ,@(r0)        ; call the routine
  85.     return                ; and exit
  86.  
  87.  
  88.  
  89.  
  90.     ENTRY    TTYSAV
  91.     ENTRY    TTYRST
  92.     ENTRY    DEADEV
  93.  
  94.  
  95. Assdev::mov    @r5    ,r0        ; get the first character of the name
  96.     cmpb    @r0    ,#'0        ; if a digit, then insure proflag is
  97.     blo    5$            ; is turned off (in case this is a
  98.     cmpb    @r0    ,#'9        ; normal 11 with MT and XL service.
  99.     bhi    5$            ; not a mt line setting
  100.     clr    proflg            ; turn off the XC/XL flag please
  101.     tst    tsxsave            ; /59/ TSX+
  102.     beq    5$            ; /59/ No
  103.     mov    #ER$LIN    ,r0        ; /59/ Yes, error
  104.     return                ; /59/
  105. 5$:    cmpb    @r0    ,#'C&137    ; /44/ CLn: and TSX+?
  106.     beq    6$            ; /44/ Yes
  107.     cmpb    @r0    ,#'K&137    ; /56/ KL?
  108.     beq    6$            ; /56/ Yes
  109.     cmpb    @r0    ,#'X&137    ; if XC or XL, then treat as a PRO/350
  110.     bne    10$            ; no
  111. 6$:    tst    tsxflg            ; are we tsx?
  112.     beq    7$            ; no
  113.     mov    sp    ,tsxcl        ; and set tsx and cl mode
  114. 7$:    clr    tsxflg            ; shut off tsx mode, enable PRO
  115.     mov    sp    ,proflg        ; simple to do
  116.     br    100$            ; and dispatch to the correct thing
  117. 10$:    cmpb    @r0    ,#'T&137    ; /39/ SET LIN TT: ?
  118.     bne    30$            ; /39/ no
  119.     clr    proflg            ; /39/ yes, for RT11 use console then
  120.     tst    tsxflg            ; /39/ already been here or real TSX+
  121.     bne    20$            ; /39/ yes, leave things alone then
  122.     mov    #-1    ,tsxflg        ; /39/ flag to use TSX tt handling
  123.     cmpb    parity    ,#PAR$NONE    ; /39/ no parity?
  124.     beq    15$            ; /39/ yes, fake space parity then
  125.     tstb    parity            ; /39/ parity already set up?
  126.     bne    20$            ; /39/ yes
  127. 15$:    mov    #PAR$SPACE,parity    ; /39/ need 8bit quoting also
  128. 20$:    movb    #60.    ,setrec+p.spsiz    ; /39/ console port won't do XON/XOFF
  129.     movb    #60.    ,setsen+p.spsiz    ; /39/ fast enough to avoid data loss
  130.     movb    #60.    ,senpar+p.spsiz    ; /43/ Here for safety.
  131. 30$:
  132. 100$:    CALLDSP    ASSDEV
  133. 110$:    return
  134.  
  135.     .enabl    lsb
  136.  
  137. Ttyini::CALLDSP    TTYINI
  138.     tst    r0
  139.     beq    iniend
  140.     mov    r0    ,r1
  141.     message    <Line init failure - >
  142.     direrr    r1
  143.     mov    r1    ,r0
  144. iniend:    return
  145.  
  146.     ENTRY    TTYFIN
  147.     
  148.  
  149.  
  150.  
  151.  
  152.  
  153.     ENTRY    XBINREAD
  154.     ENTRY    BINREAD
  155.     ENTRY    BINWRITE
  156.  
  157.     PAKREA    ==    BINREAD
  158.     PAKWRI    ==    BINWRITE
  159.  
  160.     ENTRY    CANTYP
  161.     ENTRY    TTXON
  162.     ENTRY    SENBRK
  163.     ENTRY    TTPARS
  164.     ENTRY    GTTNAM
  165.     ENTRY    SETSPD
  166.     ENTRY    TTSPEED
  167.     ENTRY    TTYSET
  168.     ENTRY    TTRFIN
  169.     ENTRY    TTRINI
  170.     ENTRY    FINRT
  171.     ENTRY    TTYDTR
  172.     ENTRY    TTYHAN
  173.     ENTRY    KBREAD
  174.  
  175. tidias::
  176. tidiar::return
  177.  
  178. rstsrv::clr    r0
  179.     return
  180.  
  181. inqdtr::mov    #-1    ,r0
  182.     return
  183.  
  184. inqpar::clr    r0
  185.     return
  186.  
  187.  
  188.  
  189.  
  190.     .MCALL    .TTINR    ,.TTYIN    ,.TTYOU
  191.  
  192. clrcns::call    chkabo
  193.     tst    r0
  194.     bne    clrcns
  195.     return
  196.  
  197.     .mcall    .SERR    ,.HERR    ,.TTINR    ,.TWAIT
  198.  
  199. read1c::mov    @#JSW    ,-(sp)
  200.     .SERR
  201. 5$:    bis    #40000!10000!100,@#JSW
  202.     tst    tsxsav
  203.     ble    10$
  204.     mov    #tsxon    ,r0
  205.     EMT    375
  206.     mov    #tsxsin    ,r0
  207.     EMT    375
  208. 10$:    .TTINR
  209.     bcc    90$
  210.     .TWAIT    #rtwork,#tsxwai
  211.     br    5$
  212. 90$:    bic    #^C<40000!10000!100>,@#JSW
  213.     mov    r0    ,-(sp)
  214.     .HERR
  215.     tst    tsxsav
  216.     ble    100$
  217.     mov    #tsxoff    ,r0
  218.     EMT    375
  219. 100$:    mov    (sp)+    ,r0
  220.     bis    (sp)+    ,@#JSW
  221.     return
  222.  
  223.     .save
  224.     .psect    $pdata    ,d
  225. tsxon:    .byte    0,152
  226.     .word    'U&137,0
  227. tsxsin:    .byte    0,152
  228.     .word    'S&137,0
  229. tsxoff:    .byte    0,152
  230.     .word    'T&137,0
  231. tsxwai:    .word    0,3
  232.     .restore
  233.  
  234. Wrtall::mov    r1    ,-(sp)        ; /56/ Save registers
  235.     mov    r0    ,-(sp)        ; /56/ Ditto
  236.     mov    6(sp)    ,r1        ; /56/ Get string address
  237. 10$:    tstb    @r1            ; /56/ All done?
  238.     beq    100$            ; /56/ Yes, exit
  239.     .TTYOU    (r1)+            ; /56/ No, dump
  240.     br    10$            ; /56/ Next please
  241. 100$:    mov    (sp)+    ,r0        ; /56/ Pop registers
  242.     mov    (sp)+    ,r1        ; /56/ Ditto
  243.     mov    (sp)+    ,(sp)        ; /56/ Move return address up
  244.     return                ; /56/ And exit
  245.  
  246.  
  247. chkabo::
  248.     mov    @#JSW    ,-(sp)
  249.     bis    #40000!10000!100,@#JSW    ; enable special input modes
  250.     .ttinr                ; check for ^z or ^x
  251.     bcc    100$            ; no
  252.     clr    r0            ; nothing, return a null
  253. 100$:    bic    #^C<40000!10000!100>,@sp;
  254.     bis    (sp)+    ,@#JSW
  255.     return                ; return( failure )
  256.  
  257.  
  258.  
  259.     .if ne    ,0
  260.     .ift                ; Moved to region
  261.  
  262. $CBTA::    JSR    R5,$SAVRG
  263.     MOVB    R2,R5
  264.     CLRB    R2
  265.     SWAB    R2
  266.     ASR    R2
  267.     BCC    E00134
  268.     TST    R1
  269.     BPL    E00134
  270.     NEG    R1
  271.     MOVB    #55,(R0)+
  272. E00134:    MOV    R0,R4
  273.     ROR    R2
  274.     ROR    R2
  275.     ROR    R3
  276.     CLRB    R3
  277.     BISB    R2,R3
  278.     CLRB    R2
  279.     BISB    #60,R2
  280.     MOV    R1,R0
  281. E00160:    MOV    R0,R1
  282.     CLR    R0
  283.     DIV    R5,R0
  284.     CMP    R1,#11
  285.     BLOS    E00200
  286.     ADD    #7,R1
  287. E00200:    ADD    R2,R1
  288.     MOV    R1,-(SP)
  289.     DECB    R3
  290.     BLE    E00234
  291.     TST    R0
  292.     BNE    E00230
  293.     TST    R2
  294.     BPL    E00234
  295.     TST    R3
  296.     BPL    E00230
  297.     BIC    #20,R2
  298. E00230:    CALL    E00160
  299. E00234:    MOVB    (SP)+,(R4)+
  300.     MOV    R4,R0
  301.     RETURN
  302.  
  303.     .endc
  304.  
  305.     .end
  306.