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

  1.     .title    k11cm1    overlay for some command dispatching
  2.     .ident    /2.23/
  3.  
  4. ;    16-Oct-84  15:38:31  Brian Nelson
  5. ;
  6. ;    Creation: 16-Oct-84  15:38:44
  7. ;
  8. ;
  9. ;    Copyright (C) 1983 1984   Change Software, Inc.
  10. ;    
  11. ;    
  12. ;    This software is furnished under a license and may
  13. ;    be  used  and  copied  only in accordance with the
  14. ;    terms of such license and with  the  inclusion  of
  15. ;    the  above copyright notice.  This software or any
  16. ;    other copies thereof may not be provided or other-
  17. ;    wise made available to any other person.  No title
  18. ;    to and ownership of the software is hereby  trans-
  19. ;    ferred.
  20. ;    
  21. ;    The information in this  software  is  subject  to
  22. ;    change  without notice and should not be construed
  23. ;    as a commitment by the author.
  24. ;
  25. ;    12-Sep-86  10:39:27 BDN Convert for I/D space
  26.  
  27.  
  28.  
  29.     .if ndf, K11INC
  30.     .ift
  31.     .include    /IN:K11MAC.MAC/
  32.     .include    /IN:K11CDF.MAC/
  33.     .endc
  34.  
  35.     .enabl    gbl
  36.     .psect
  37.     .psect    $code
  38.  
  39.  
  40.  
  41.     .sbttl    the set command
  42.     .enabl    lsb
  43.  
  44. ;    Note:  For edit /41/ the call to GETPRV for MicroRSX has been
  45. ;    placed in ASSDEV, which is ONLY called from SET LINE (SET$LI)
  46.  
  47.  
  48. c$set::    $name    <SET>
  49.     call    loaset
  50.     calls    getcm0    ,<argbuf,r0>
  51.     mov    r0    ,r2
  52.     bmi    110$
  53.     call    loaset
  54.     calls    getcm1    ,<argbuf,r0,r2>
  55.     tst    r0
  56.     bmi    110$
  57.     jsr    pc    ,@r1
  58.     tst    r0
  59.     beq    100$
  60.     message    <Invalid value for SET>,cr
  61.     inc    status
  62. 100$:    return
  63. 110$:    message    <Unknown/invalid Set command>,cr
  64.     inc    status
  65.     return
  66.  
  67.  
  68.     .dsabl    lsb
  69.  
  70.  
  71.  
  72.     .sbttl    the connect command
  73.  
  74. c$conn::$name    <CON>
  75.     tst    con$dsp            ; /44/ SET [RSX] [CONNECT] done?
  76.     bne    1$            ; /44/ Yes
  77.     mov    #doconn    ,con$dsp    ; /44/ No, insert default routine
  78. 1$:    tstb    @argbuf            ; anything in the arg buffer?
  79.     beq    5$            ; no
  80.     call    set$li            ; set the line then
  81. 5$:    tst    conesc            ; an escape character set ?
  82.     bne    10$            ; yes
  83.     movb    #con$esc,conesc        ; no, set the default in
  84. 10$:    copyz    #ttdial    ,#ttname    ; insure correct name
  85.     clr    remote            ; insure remote flag set
  86.     mov    recdlm    ,-(sp)        ; /56/ Save RMS record delimiter
  87.     mov    #12    ,recdlm        ; /56/ Change to write on line feeds
  88.     call    @con$dsp        ; /44/ Call the user's choice
  89.     mov    (sp)+    ,recdlm        ; /56/ Restore put$ trigger char
  90.     message                ; a cr/lf
  91.     return                ; back to command parser
  92.  
  93.     GLOBAL    <argbuf,conesc,doconn,remote,ttdial,ttname> ; /44/
  94.     GLOBAL    <con$es,con$ds,set$li>                ; /44/
  95.     GLOBAL    <recdlm>                    ; /56/
  96.  
  97.  
  98.  
  99.  
  100.     .sbttl    the local directory and type commands
  101.     .enabl    lsb
  102.  
  103. c$dir::    $name    <DIR>
  104.     tstb    defdir
  105.     beq    10$
  106.     message    <Current default is >
  107.     print    #defdir
  108.     message
  109. 10$:    calls    dodir    ,<argbuf,#0>    ; get the passed filespec for dir
  110.     tst    r0            ; do the directoty. did it work ?
  111.     beq    100$            ; yes
  112.     direrr    r0            ; no, print the error
  113. 100$:    return                ; bye
  114.  
  115.     .dsabl    lsb
  116.  
  117.  
  118. c$who::    calls    systat    ,<#0>
  119.     return
  120.  
  121.  
  122. c$tran::calls    transf    ,<argbuf,#0>
  123.     return
  124.  
  125.  
  126.  
  127.     .sbttl    the take command
  128.     .enabl    lsb
  129.  
  130.  
  131. c$take::$name    <TAKE>
  132.     sub    #filsiz    ,sp        ; save current def dir
  133.     mov    sp    ,r1        ; point to it
  134.     copyz    #defdir    ,r1        ; done
  135.     tst    cmdlun            ; indirect file already open ?
  136.     beq    10$            ; no
  137.     tst    sy.ini            ; during init from INI file?
  138.     bne    5$            ; yes, don't bother with message
  139.     tst    infomsg            ; /41/ How verbose are we today?
  140.     beq    5$            ; /41/ Not very
  141.     message    <Previous TAKE file closed>,cr
  142. 5$:    clr    sy.ini            ; not in an init file anymore
  143.     calls    close    ,<#lun.ta>    ; yes, please close it now
  144.     clr    cmdlun            ; assume the next open will fail?
  145.  
  146. 10$:    copyz    #200$    ,#defdir    ; stuff take defaults in now
  147.     calls    open    ,<argbuf,#lun.ta,#text>
  148.     tst    r0            ; did the open for command file work?
  149.     bne    90$            ; no, print error and exit
  150. 20$:    mov    #lun.ta    ,cmdlun        ; yes, stuff the unit number in
  151.     br    100$            ; bye
  152.  
  153.  
  154. 90$:    direrr    r0            ; print a error message and exit
  155.     clr    cmdlun            ; force input from KB:
  156.  
  157. 100$:    mov    sp    ,r1        ; restore old default directory
  158.     copyz    r1    ,#defdir    ; simple
  159.     add    #filsiz    ,sp        ; copy def dir save area back
  160.     return                ; bye
  161.  
  162.     .save
  163.     .psect    $PDATA    ,D
  164. 200$:    .asciz    /SY:*.CMD/
  165.     .even
  166.     .restore
  167.     .dsabl    lsb
  168.  
  169.     global    <infomsg>
  170.  
  171.  
  172.  
  173.     .sbttl    the SYSTEM command
  174.     .enabl    lsb
  175.  
  176. c$sys::    $name    <SYS>
  177.     tstb    @argbuf            ; need something in ARGBUF
  178.     bne    10$            ; oops
  179.     message    <The SYSTEM command requires a command to execute>,cr
  180.     return
  181. 10$:    strlen    argbuf            ; get the current length so we
  182.     add    argbuf    ,r0        ; can stuff a carriage return
  183.     movb    #cr    ,(r0)+        ; and a null in
  184.     clrb    @r0            ; all set now
  185.     mov    argbuf    ,200$+2
  186.     mov    #200$    ,r5        ; call the PK driver
  187.     call    runjob            ; simple
  188.     tst    r0            ; did it work ?
  189.     beq    100$            ; yes
  190.     message    <Error from spawning command >
  191.     decout    r0
  192.     message
  193. 100$:    message
  194.     return
  195.  
  196.  
  197.  
  198. ;    ierr = runjob(buffer,mode,10,timout)
  199. ;
  200. ;     All parameters for  RSTS are  used so we can use the
  201. ;    generalized PK code used also in MINITAB (C) and TED.
  202. ;    For RSX11M/M+, only the first argument is needed.
  203.  
  204.     .save
  205.     .psect    $PDATA    ,D
  206. 200$:    .word    4,0,220$,230$,240$    ; parameter list
  207. 220$:    .word    100305            ; internal mode for running on the PK
  208. 230$:    .word    10.            ; first free logical unit number
  209. 240$:    .word    10.            ; ten minutes and i kill the PK's job
  210.     .restore
  211.     .dsabl    lsb
  212.  
  213.     global    <argbuf    ,runjob>
  214.  
  215.  
  216.  
  217.  
  218. c$spac::$name    <SPA>
  219.     sub    #120    ,sp        ; allocate space for a buffer
  220.     mov    sp    ,r1        ; point to it
  221.     calls    dskuse    ,<r1>        ; get the usage string
  222.     print    r1            ; print it
  223.     message                ; a crlf
  224.     add    #120    ,sp        ; pop the local buffer
  225.     return                ; and exit
  226.  
  227.  
  228.  
  229.  
  230.     .sbttl    the local type command
  231.     .enabl    lsb
  232.     .save
  233.     .psect    buffer    ,rw,d,lcl,rel,con
  234. buffer:    .blkb    1000
  235.     .restore
  236.  
  237. c$type::$name    <TYP>
  238.     mov    #buffer    ,r4        ; and point to it of course
  239.     calls    fparse    ,<argbuf,r4>    ; parse the filename please
  240.     tst    r0            ; did the $parse work ok ?
  241.     bne    90$            ; no
  242.     print    r4            ; yes, print the expanded name out
  243.     message
  244.  
  245. 5$:    clr    r2            ; assume file not open
  246.     calls    open    ,<argbuf,#lun.in,#text>; try to open passed filename
  247.     tst    r0            ; but did the open work out ?
  248.     bne    90$            ; no
  249.     com    r2            ; flag it as being open please
  250.  
  251. 10$:    tst    cccnt            ; control C typed ?
  252.     bne    90$            ; yes, abort this
  253.     calls    getrec    ,<r4,#lun.in>    ; get the next record
  254.     tst    r0            ; did it work ?
  255.     bne    90$            ; no
  256. 20$:    tst    r1            ; null record (ie, cr/lf only) ?
  257.     beq    30$            ; yep
  258.     print    r4,r1            ; dump the record
  259. 30$:    message                ; a cr/lf
  260.     br    10$            ; next record please
  261.  
  262. 90$:    tst    r0            ; forced exit ?
  263.     beq    95$            ; yes
  264.     cmp    r0    ,#ER$EOF    ; end of file ?
  265.     beq    95$            ; yes, its ok
  266.     direrr    r0            ; no, print the error out
  267. 95$:    tst    r2            ; is the type file open ?
  268.     beq    100$            ; no
  269. 96$:    calls    close    ,<#lun.in>    ; yes, please close it up now
  270. 100$:    return
  271.  
  272.  
  273.     global    <argbuf    ,cccnt    ,defdir    ,ER$EOF    ,lun.in>
  274.  
  275.     .dsabl    lsb
  276.  
  277.  
  278.     .sbttl    print command
  279.  
  280.  
  281. c$prin::calls    qspool    ,<argbuf,#lun.in>
  282.     direrr    r0
  283.     return
  284.  
  285.  
  286.     .end
  287.