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

  1.     .title    K11RTI    One shot init code
  2.     .ident    /3.51/
  3.  
  4.  
  5. ;    23-May-86  18:23:36 BDN    Creation from K11RT4.MAC
  6. ;    07-Jun-86  05:39:17 BDN XM edits.
  7. ;
  8. ;     As is most exec specific code, this has turned into a MESS.
  9. ;
  10. ;     There are some significant assumptions made  here.  One  is
  11. ;    that  for  the  virtual  KERMIT  (K11XM.SAV)  is  that  APR7
  12. ;    (160000-177777) is available and does NOT contain  any  code
  13. ;    overlays.  This  is because for XM image we create a dynamic
  14. ;    region mapped from APR7 to allow placement  of  buffers  and
  15. ;    the  like  up there. In the case of the disk overlayed image
  16. ;    (K11RT4.MAC) we just do a .SETTOP  to  177776  and  allocate
  17. ;    buffers  there, allowing the USR to swap if need be over the
  18. ;    buffers. Additionally, the .FETCH buffer is,  for  the  disk
  19. ;    overlayed  (non-virtual)  K11RT4.SAV,  allocated  from  this
  20. ;    .SETTOP area.  In  the  case  of  XM,  however,  we  have  a
  21. ;    problem.  In  order  to reduce the size of the ROOT to allow
  22. ;    K11XM to run as a foreground job we ended up  with  the  top
  23. ;    of  the  root mapped by APR1 (20000-37777). Now it is a well
  24. ;    known fact that XM places many constraints on what  you  can
  25. ;    put  in the range, QUE elements being the best known example
  26. ;    of something you CAN NOT put there. It also turns  out  that
  27. ;    you  must NEVER try to load a handler into that area either.
  28. ;    If you do, depending on the address,  you  can  expect  very
  29. ;    erratic  behavior  from the handler, if not outright failure
  30. ;    and a system crash. Such was the case on  the  PRO/350.  The
  31. ;    XC  driver  would  MOST  of the time work ok, but the system
  32. ;    would ALWAYS crash on a .HRESET directive.  Addtionally  the
  33. ;    XC  OFFDRV  .SPFUN, while setting the 'shutdown' flag in the
  34. ;    driver,  would  be  ignored  at  program  exit.   Thus   any
  35. ;    outstanding  XC  reads would attempt to enter a non-existent
  36. ;    completion routine when the remote  server  timed  out,  and
  37. ;    hang the PRO. 
  38. ;    
  39. ;     The  correct method to control this buffer (K11XM.COM only)
  40. ;    is to set the extend size  for  the  psect  HNBUFF  at  link
  41. ;    time. 
  42. ;
  43. ;     There  are  a couple of things here for TSX+ also. One, the
  44. ;    TSX+ directive  for  altering  the  physical  address  space
  45. ;    limit  is  used,  this is simply an EMT 375 with R0 pointing
  46. ;    to an argument block of the form 
  47. ;
  48. ;    .byte    0,141
  49. ;    .word    TOP_ADDRESS_DESIRED
  50. ;
  51. ;     This is done because, as in the case  of  the  RSTS/E  RT11
  52. ;    emulator,  the  .SETTOP  directive  only returns the current
  53. ;    high limit, it has no effect on the memory allocation.  Both
  54. ;    systems  thus  have special directives to actually alter the
  55. ;    memory size, alternativly one can  patch  location  56  (for
  56. ;    both)  to  force  additional  allocation. The other, left in
  57. ;    for historical reasons, asks for the TSX+ 'Line  Number'  in
  58. ;    order  to  determine if the system is TSX+. I have left that
  59. ;    in the  init  code  instead  of  setting  the  flag  in  the
  60. ;    previously  described  directive  because  I have no idea if
  61. ;    the other directive works on older versions of TSX+. 
  62.  
  63.  
  64.  
  65.     .sbttl    local copies of MUL and DIV (we relocate the real code)
  66.  
  67.     .macro    mul    src,reg
  68.     .ntype $$,reg
  69.     mov    src    ,-(sp)
  70.     mov    reg    ,-(sp)
  71.     call    p$mul
  72.     .iif eq    ,$$-1    ,mov    (sp)+    ,r1
  73.     .iif eq    ,$$-3    ,mov    (sp)+    ,r3
  74.     .iif eq    ,$$-5    ,mov    (sp)+    ,r5
  75.     .iif  ne ,<$$+1>&1, .error    ; bad dst reg for MUL macro
  76.     .endm    mul
  77.  
  78.     .macro    div    src,reg
  79.     .ntype    $$,reg
  80.     mov    src    ,-(sp)
  81.     .iif eq    ,$$,    mov r1    ,-(sp)
  82.     .iif eq    ,$$-2,    mov r3    ,-(sp)
  83.     .iif eq    ,$$-4,    mov r5    ,-(sp)
  84.     call    p$div
  85.     .if    eq, $$
  86.     mov    (sp)+    ,r1
  87.     mov    (sp)+    ,r0
  88.     .endc
  89.     .if    eq, $$-2
  90.     mov    (sp)+    ,r3
  91.     mov    (sp)+    ,r2
  92.     .endc
  93.     .if    eq, $$-4
  94.     mov    (sp)+    ,r5
  95.     mov    (sp)+    ,r4
  96.     .endc
  97.     .endm    div
  98.  
  99.  
  100.  
  101.  
  102.     .sbttl    Macro references and local read/write data
  103.  
  104.  
  105.  
  106.  
  107.     .if ndf, K11INC
  108.     .ift
  109.     .include    /IN:K11MAC.MAC/
  110.     .endc
  111.  
  112.  
  113.     .psect    dirmap    ,rw,d,gbl,rel,ovr
  114. dirnam:    .blkw    1
  115. dirbfr:    .blkw    1
  116.  
  117.     .psect    rwdata    ,rw,d,lcl,rel,con
  118.  
  119. time:    .word    0,40
  120. mtsts:    .word    0,0,0,0,0
  121. timbuf:    .word    0,0
  122. timbf1:    .word    0,0
  123. tenth:    .word    0,6
  124. totall:    .word    0
  125.  
  126.     cr    =    15
  127.     lf    =    12
  128.     ff    =    14
  129.     soh    =    1
  130.     maxsiz    =    1000
  131.     errbyt    ==    52
  132.     topmem    =    50
  133.     JSW    =    44
  134.  
  135.  
  136. ;    RMON offsets
  137.  
  138.     CONFIG    =    300        ; Primary RT11 configuration word
  139.     CONFG2    =    370        ; The second one
  140.     SYSGEN    =    372        ; RT11 SYSGEN options offset
  141.     $USRLC    =    266        ; Location of the USR offset
  142.     SYSVER    =    276        ; The system major and minor version
  143.  
  144. ;    Flags
  145.  
  146.     CLOCK    =    100000        ; In CONFIG, if a line clock present
  147.     MARKTIM    =    2000        ; SJ Marktime is present
  148.     PRO350    =    20000        ; In CONFG2, set if a PRO/350 or 380
  149.     TSXPLU    =    100000        ; In CONFG2, set if TSX+ (not used)
  150.                     ;
  151.     VIRTUAL    =    2000        ; In the JSW, if set, a virtual job
  152.     SJSYS    =    1        ; In CONFIG, clear if a SJ system
  153.     XMSYS    =    10000        ; In CONFIG, set if XM and SJSYS off
  154.                     ;
  155.     HNSIZE    =    6000        ; Allocation for handlers in SJ/FB
  156.  
  157.                     
  158. ;    Macros needed
  159.  
  160.     .MCALL    .QSET,.TWAIT,.FETCH,.GVAL,.SETTOP,.SERR,.HERR,.GTIM
  161.     .MCALL    .DSTAT,.MTSTAT,.EXIT,.GTJB
  162.  
  163. ;    Macros needed for the XM dynamic region support
  164.  
  165.     .MCALL    .WDBBK    ,.WDBDF    ,.RDBBK    ,.RDBDF    ,.CRRG    ,.CRAW
  166.  
  167.  
  168.     .save                    ; Save CURRENT Psect
  169.     .psect    MAPWIN    ,rw,d,gbl,rel,con    ; Insure window data in ROOT
  170.                         ;
  171.     BINLSIZE ==    40*4
  172.     ALLOC    =    14000            ; How much to allocate for NOW
  173.  
  174.     .WDBDF
  175.     .RDBDF
  176. apr7wi::.WDBBK    7,ALLOC/100,0,0,ALLOC/100,WS.MAP
  177. apr7re::.RDBBK    ALLOC/100
  178.  
  179. mapwrk::.blkw    7
  180.  
  181.     LN$CNT    =    LN$ALL            ; Maximum for recalling
  182.  
  183.     .restore                ; Pop Last PSECT
  184.  
  185.  
  186.     .sbttl    Start RT11 specific things
  187.     .enabl    lsb
  188.     .psect    $CODE    ,ro,i,lcl,rel,con
  189.  
  190. mapini::mov    #p$mul    ,k11$mul    ; For now
  191.     mov    #p$div    ,k11$div    ; This will change soon.
  192.     mov    #p$ttyou,$ttyout    ; Ditto...
  193.     mov    #p$cbta    ,$$cbta        ; 
  194.     return
  195.  
  196. xinit::    mov    sp    ,infomsg    ; Default to verbosity
  197.     mov    #$$BUFP    ,totall        ; Determine total allocation
  198.     add    #100+200+100+100,totall    ; For TT, Directory, PHNUM buffering
  199.     add    #1200    ,totall        ; For Misc buffering
  200.     add    #<LN$MAX+2>*LN$CNT,totall; Insure CLE space
  201.     add    #120*2    ,totall        ; For CMDBUF and ARGBUF
  202.     add    #picend-picstart,totall    ; For relocating code
  203.     STRCPY    #defdir    ,#dkname    ; Set default device name
  204.     .GTIM    #rtwork    ,#timbuf    ; Insure clock rollover
  205.     .GVAL    #rtwork,#CONFIG        ; Check for what we are running on
  206.     bit    #SJSYS    ,r0        ; Can't run on SJ (perhaps)
  207.     bne    10$            ; Ok, FB or XM
  208.     .PRINT    #nosj            ; No, die
  209.     dec    montyp            ; Exec type saved
  210.     br    20$            ;
  211. 10$:    bit    #XMSYS    ,r0        ; Check for XM system.
  212.     beq    20$            ; No, must be FB
  213.     inc    montyp            ; Its XM, save flag.
  214.     mov    #$limit+2,hilimit    ; We really want VIRTUAL limit
  215. 20$:    .GTJB    #rtwork,#jobsts        ; So we know if BG or FG job.
  216.     .QSET    #rtque,#nrtque        ; Allocate extra que elements
  217.     mov    sp    ,rtvol        ; Assume volume header checks
  218.     mov    @#50    ,r5        ; Save low core HIGH LIMIT
  219.                     ;
  220.     .SERR                ; TSX+, grab some extra memory
  221.     mov    #tsxmem    ,r0        ; But inhibit aborts under RT11
  222.     mov    #160000    ,r2        ; Top limit minimum for VIRTUAL
  223.     add    totall    ,r2        ; Got it.
  224.     bit    #VIRTUAL,@#JSW        ; Is this the virtual overlay
  225.     bne    30$            ; save image. If ne, YES
  226.     mov    r5    ,r2        ; Disk overlayed, reset amount
  227.     add    #HNSIZE    ,r2        ; of memory desired then.
  228.     add    totall    ,r2        ; Done.
  229.     mov    r2    ,2(r0)        ; Insert the new size now.
  230.     dec    r2            ; 
  231. 30$:    EMT    375            ; Call TSX now
  232.     bcs    40$            ; Must be RT11 today
  233.     cmp    r0    ,r2        ; TSX+, did it give us enough?
  234.     bhis    40$            ; Yes, Keep on going
  235.     octout    r0
  236.     octout    r2
  237.     message    <Please alter HIMEM to allow 32KW address space>,CR
  238. 40$:    .HERR                ; Re-enable RT11 aborts now
  239.                     ;
  240.     mov    #freept    ,r2        ; Setup a pointer to this
  241.     mov    @hilimit,@r2        ; Free core list for SJ/FB .FETCH
  242.     add    #3    ,@r2        ; + 2 to pointer above us please
  243.     bic    #1    ,@r2        ; Insure even address
  244.                     ;
  245.     bit    #VIRTUAL,@#JSW        ; Is this the K11XM image running?
  246.     bne    50$            ; No, do a normal .SETTOP
  247.                     ;
  248.     .SETTOP    #-2            ; SJ or FB, or TSX and disk overlays
  249.     br    70$            ; Ask for all of it, ignore the USR
  250.                     ;
  251. 50$:    .CRRG    #mapwrk    ,#apr7re    ; Its K11XM.SAV on RTXM or TSX+
  252.     bcs    60$            ; We will instead create a region.
  253.     mov    apr7re+r.gid,apr7wi+w.nrid; This will allow future expansion.
  254.     .CRAW    #mapwrk    ,#apr7wi    ; Create address window and MAP it.
  255.     mov    #ALLOC+160000,r0    ; Assume for now that we got it.
  256.     bcc    70$            ; Successfull
  257. 60$:    movb    @#ERRBYT,r1        ; It failed, get the error code and
  258.     MESSAGE    <Failure to create or map APR7 region, error:>
  259.     DECOUT    r1            ; Dump the error code
  260.     MESSAGE                ; A CR/LF
  261.     mov    r1    ,r0        ; Error code
  262.     call    maperr            ; Get the error text address
  263.     .PRINT    r0            ; Dump the text
  264.     .EXIT                ; And go away now on mapping failure.
  265.                     ;
  266.                     ;
  267. 70$:    mov    r0    ,r1        ; Save the current MAX address.
  268.     mov    r1    ,maxtop        ; Again, save the highest possible addr
  269.     cmp    @r2    ,r1        ; Is there REALLY space available?
  270.     bhi    80$            ; No, DIE
  271.     sub    @r2    ,r1        ; Compute space available now.
  272.     cmp    totall    ,r1        ; Space availble for buffer pool?
  273.     blo    90$            ; Yes, it's ok
  274. 80$:    .PRINT    #nobuf            ; Print an error message and DIE
  275.     clr    r0            ; Exit
  276.     .EXIT                ; Bye now.
  277. 90$:    call    loadpic            ; Relocate some code
  278.     mov    #2    ,r3        ; Offset into BUFDEF and BUFLST
  279.     mov    #4    ,r0        ; Four buffers to set up
  280. 100$:    mov    @r2    ,BUFLST(r3)    ; Setup our buffer addresses now
  281.     mov    @r2    ,BUFDEF(r3)    ; into the appropiate pointers.
  282.     add    #MAXSIZ    ,@r2        ; Fix FREEPT up to point to next.
  283.     add    #2    ,r3        ; Point to next list entry
  284.     sob    r0    ,100$        ; Simple
  285.     mov    @r2    ,xklgbuf    ; A special buffer for XC/XL/CL
  286.     add    #$$LBUF    ,@r2        ; Add in the allocation now.
  287.     mov    @r2    ,albuff        ; Allocate this buffer
  288.     add    #ALSIZE    ,@r2        ; And move the pointer up
  289.     clr    @albuff            ; Insure this is cleared out.
  290.     mov    @r2    ,r0        ; Save it
  291.     mov    @r2    ,$prtbuf    ; Allocate a tt output buffer
  292.     add    #100    ,@r2        ; And move up again.
  293.     mov    @r2    ,dirnam        ; Allocate more static buffers
  294.     add    #200    ,@r2        ; Move up
  295.     mov    @r2    ,dirbfr        ; Allocate more dir listing buffers
  296.     add    #100    ,@r2        ; And move on up.
  297.     mov    @r2    ,phnum        ; Save a phonenumber for REDIAL
  298.     clrb    @phnum            ; Clear it
  299.     add    #100    ,@r2        ; Next please
  300.     mov    @r2    ,bintyp        ; More to go
  301.     add    #BINLSIZ,@r2        ;
  302.     mov    @r2    ,totp.s        ; Some packet stats
  303.     add    #34*2*2    ,@r2        ;
  304.     mov    @r2    ,totp.r        ; Some packet stats
  305.     add    #34*2*2    ,@r2        ;
  306.     mov    #LN$CNT    ,r3        ; Recall buffer count
  307.     mov    r3    ,lastcnt    ; Save globally
  308.     mov    #lastli    ,r4        ; Where to stuff the addresses
  309. 104$:    mov    @r2    ,(r4)+        ; Command line editing
  310.     add    #LN$MAX+2,@r2        ; Move up
  311.     sob    r3    ,104$        ; Keep going
  312.     mov    @r2    ,cmdbuf        ; Insert command line buffer
  313.     add    #120    ,@r2        ; Next
  314.     mov    @r2    ,argbuf        ; Argument buffer
  315.     add    #120    ,@r2        ; Next
  316.                     ;    
  317. 105$:    clrb    (r0)+            ; Clear out now
  318.     cmp    r0    ,@r2        ; Done?
  319.     blos    105$            ; No
  320.                     ; All done with buffer allocation.
  321.     mov    r2    ,fetpt        ; Setup pointers for .FETCH now.
  322.     mov    @hilimit,fetptmax    ; Max address for .FETCHING
  323.     tst    montyp            ; But if this is XM, then we must
  324.     ble    110$            ; force handlers into LOWCORE
  325.     mov    #xmflow    ,xmfetpt    ; We must insure APR0 .FETCHING
  326.     add    #3    ,xmfetpt    ; low core overlay instead.
  327.     bic    #1    ,xmfetpt    ; Insure EVEN
  328.     mov    #xmfetpt,fetpt        ; Now insert address of pointer
  329.     mov    #xmftop    ,fetptmax    ; This is the top of XM .FETCH space
  330.                     ;
  331. 110$:    clr    proflg            ; assume not a pro/350
  332.     clr    tsxflg            ; assume not TSX+
  333.     clr    tsxcl            ; assume not tsx and cl
  334. ;
  335. ; ---    Use tried-and-true method to detect TSX+
  336. ;
  337.     .SERR                ; Stop abort from RT-11
  338.     mov    #tsxlin    ,r0        ; Set the EMT
  339.     EMT    375            ; Do it
  340.     bcs    120$            ; Not TSX if an error
  341.     mov    #1,tsxflg        ; it's TSX+, folks
  342.     mov    #1    ,tsxsav        ; Have to save TSXFLG
  343.     mov    sp,remote        ; assume remote if TSX+
  344.     mov    #tsxtrm    ,r0        ; Now get terminal type
  345.     EMT    375            ; Do it
  346.     bcs    120$            ; Oops
  347.     clr    vttype            ; Assume unknown
  348.     clr    r1            ; Map terminal type now.
  349. 115$:    inc    r1            ; Next please
  350.     tstb    trmlst-1(r1)        ; End of the list yet?
  351.     bmi    120$            ; Yes
  352.     cmpb    r0    ,trmlst-1(r1)    ; No, a match?
  353.     bne    115$            ; No, keep looking
  354.     movb    trmtyp-1(r1),vttype    ; Save internal code for TT type
  355. 120$:    .HERR                ; Reenable heavy-duty aborts
  356.     tst    tsxsave            ; Where now?
  357.     beq    130$            ; Off to more RTCL1 checks
  358.     jmp    170$            ; No, TSX - skip to the end
  359.  
  360.  
  361. 130$:    .GVAL    #rtwork,#SYSVER        ; check for RT version 5 please
  362.     cmpb    r0    ,#5        ; must be version 5 for PRO/350
  363.     blo    140$            ; no, can't be a pro
  364.     .GVAL    #rtwork,#CONFG2        ; get config word number two
  365.     bit    #PRO350    ,r0        ; is this a pro/350 ?
  366.     beq    140$            ; no
  367.     STRCPY    #ttname    ,#xc$dev    ; /42/ use strcpy, use XC:
  368.     STRCPY    #ttdial    ,#xc$dev    ; /42/ use strcpy, use XC:
  369.     mov    sp    ,proflg        ; it's a pro/350, folks
  370.     clr    remote            ; we want to be a local kermit
  371.     PRINT    #xcmsg            ; say so
  372.     br    165$            ; /54/
  373.  
  374. 140$:    .DSTAT    #rtwork    ,#XCR50        ; /39/ check for XC and XL
  375.     bcc    160$            ; /39/ found XC
  376.     .DSTAT    #rtwork    ,#XLR50        ; /39/ no  XC try XL
  377.     bcc    160$            ; /39/ found XL
  378.     .MTSTAT    #rtwork    ,#mtsts        ; /39/ No XC: or XL:, look for
  379.     bcs    150$            ; /39/ multiple terminal service
  380.     tst    mtsts+4            ; /39/ Any LUNS generated ?
  381.     bne    160$            ; /39/ Yes
  382. 150$:    .PRINT    #noxcmt            ; /39/ No, warn user of such fact
  383.     mov    sp    ,remote        ; /39/ Place us in remote mode and
  384.     mov    #-1    ,tsxflg        ; /39/ Fake it using TSX code.
  385.     mov    #PAR$SPACE,parity    ; /39/ Force 8 bit quoting
  386. 160$:    CALLS    gttnam    ,<#errtxt>    ; Get the name of the console tt:
  387.     PRINT    #ttn            ; And say what it should be
  388.     PRINT    #errtxt            ; Print it
  389.     PRINT    #crlf            ; Finish the line
  390. 165$:    tst    jobsts            ; /54/ Frunned?
  391.     beq    170$            ; /54/ No
  392.     clr    blip            ; /54/ Yes, no packet status display
  393.     PRINT    #nolog            ; /54/ Inform
  394.                     ;
  395. 170$:    mov    sp    ,clkflg        ; Assume a clock (reasonable)
  396.     .GVAL    #rtwork,#CONFIG        ; Get the configuration word
  397.     bit    #SJSYS    ,r0        ; Is this a SJ monitor ?
  398.     bne    180$            ; No, just exit
  399.     bit    #CLOCK    ,r0        ; SJ, is there a clock present
  400.     bne    175$            ; Yes
  401.     message    <Kermit may not run correctly without a clock>,CR
  402.     clr    clkflg            ; Flag no clock
  403.     br    180$            ; All done
  404. 175$:    .GVAL    #rtwork    ,#SYSGEN    ; Check for MARK TIME support
  405.     bit    #MARKTIM,r0        ; Well?
  406.     bne    180$            ; Yes, support is present
  407.     message    <Kermit should have timer support for optimal >
  408.     message    <operation. Do a sysgen>,CR
  409. 180$:
  410. 190$:
  411. 200$:    call    procl            ; See if a PRO on TSX+
  412.     clr    r0            ; No errors
  413.     return
  414.  
  415.     .dsabl    lsb
  416.  
  417.  
  418.  
  419.     .sbttl    See if we want to set up comm port on PRO/TSX+
  420.  
  421.     .enabl    lsb
  422.  
  423. procl:    .SERR                ; Just to be safe.
  424.     mov    #tsxlin    ,r0        ; Find out the line number
  425.     EMT    375            ; Do it
  426.     bcs    100$            ; Must be rt11
  427.     dec    r0            ; Which line (1=console)
  428.     bne    90$            ; Not console
  429.     .DSTAT    #rtwork,#pisys        ; Console. See if this is a pro
  430.     bcs    90$            ; Can't be.
  431.     mov    #cl0text,r1        ; For the STRCPY
  432.     mov    #cl0asn    ,r0        ; Try to assign line 3 to CL1
  433.     EMT    375            ; Do it
  434.     bcc    10$            ; Success
  435.     mov    #cl1text,r1        ; For the STRCPY
  436.     mov    #cl1asn    ,r0        ; CL1 is busy, try CL1 for the PRO.
  437.     EMT    375            ; Try it.
  438.     bcs    90$            ; CL1 and CL1 are busy (unlikely).
  439. 10$:    clr    remote            ; Say we are a local Kermit.
  440.     clr    tsxflg            ; Use PRO code for CL
  441.     mov    sp    ,tsxcl        ; Flag TSX+ and CLn:
  442.     mov    sp    ,proflg        ; Say we are a PRO now.
  443.     STRCPY    #ttname    ,r1        ; And copy the CL unit name
  444.     STRCPY    #ttdial    ,r1        ; And copy the CL unit name
  445.     MESSAGE    <PRO Communications port (line 3) assigned to >
  446.     PRINT    r1            ; Dump the name
  447.     MESSAGE                ; CRLF
  448.     mov    sp    ,tsxcl        ; Set a flag now
  449.     br    100$            ; Exit
  450. 90$:    PRINT    #k$tsx            ; Dialup user
  451.     mov    sp    ,remote        ; Remote user flag
  452. 100$:    .HERR                ; Re-enable
  453.     return                ; Exit
  454.  
  455.  
  456.     .dsabl    lsb
  457.  
  458.  
  459.  
  460.  
  461.  
  462.     .save
  463.     .psect    rwdata    ,rw,d,lcl,rel,con
  464.     .even
  465. tsxlin:    .byte    0,110            ; TSX-Plus get-line-number emt
  466. tsxmem:    .byte    0,141            ; TSX-Plus GET More Memory
  467.     .word    165300 + $$BUFP        ; Should be enough
  468. tsxtrm:    .byte    0,137            ; TSX-Plus Get terminal type
  469. cl0asn:    .byte    0,155            ; Try to assign line 3 to CL0
  470.     .word    0            ; CL0
  471.     .word    3            ; Line 3
  472. cl1asn:    .byte    0,155            ; Try to assign line 3 to CL1
  473.     .word    1            ; CL1
  474.     .word    3            ; Line 3
  475. cl0text:.asciz    /CL0/            ; Asciz names
  476. cl1text:.asciz    /CL1/            ; ...
  477.  
  478. trmlst:    .byte    0    ,1    ,2    ,3    ,4    ,5
  479.     .byte    6    ,7    ,8.    ,9.    ,-1
  480. trmtyp:    .byte    TTY    ,TTY    ,VT100    ,TTY    ,TTY    ,TTY
  481.     .byte    TTY    ,TTY    ,TTY    ,VT200
  482.     .even
  483.     .psect    $pdata
  484.  
  485. dkdev:    .rad50    /DK /
  486. nobuf:    .ascii    /??Kermit-11-F Insufficient space available for buffer pool/
  487.     .byte    cr,lf
  488.     .ascii    /allocation. Please unload handlers or do a SET USR SWAP/
  489.     .byte    cr,lf,0
  490. nosj::    .asciz    /Kermit-11 may not run correctly on a SJ monitor/<cr><lf>
  491. ttn:    .asciz    /RT-11 default terminal line set to unit /
  492. noclock:.ascii    /This system does not appear to have a line clock./<cr><lf>
  493.     .asciz    /Kermit-11 may not run correctly./<cr><lf>
  494. xc$dev:    .asciz    /XC0:/
  495. xcmsg:    .asciz    #PRO/350 comm port set to XC0:#<cr><lf>
  496. k$tsx:    .ascii    /TSX-Plus remote mode/
  497. crlf:    .byte    cr,lf,0
  498. noxcmt:    .ascii    / This system lacks both XC and XL drivers, and has not been/
  499.     .byte    cr,lf
  500.     .ascii    /generated  for Multiple Terminal support.  Only the CONSOLE/
  501.     .byte    cr,lf
  502.     .ascii    /will be usable for Kermit. Eight bit prefixing support will/
  503.     .byte    cr,lf
  504.     .ascii    /be required of the other  Kermit for the transfer of binary/
  505.     .byte    cr,lf
  506.     .asciz    /files./<cr><lf>
  507.     .even
  508. nolog:    .ascii    /Packet status display disabled for FRUNed Kermit. Use/<CR><LF>
  509.     .asciz    /SET UPDATE 1 to enable packet status during transfer./<CR><LF>
  510.     .even
  511. xcr50:    .rad50    /XC /
  512. xlr50:    .rad50    /XL /
  513. dkname:    .asciz    /DK:/
  514. pisys:    .rad50    /PI /
  515.     .even
  516.     .restore
  517.  
  518. inqbuf::mov    #90.    ,r0        ; /42/ Large packets, no buffers
  519.     return                ; /42/ for RT11 however.
  520.  
  521.  
  522.     GLOBAL    <lun.in,lun.ou,proflg,rtvol,rtque,tsxflg>
  523.     GLOBAL    <defdir,infomsg>
  524.  
  525.  
  526.  
  527.     .sbttl    PIC code that gets relocated
  528.  
  529.  
  530.  
  531.     .psect    piccod    ,ro,i,lcl,rel,con
  532.  
  533. loadpic:mov    #picstart,r1        ; Starting address of code to be
  534.     mov    #picend-picstart+2,r0    ; relocated. Number of bytes
  535.     bic    #1    ,r0        ; Insure .EVEN (would be anyway)
  536.     mov    @r2    ,r3        ; Buffer address for code
  537.     add    r0    ,@r2        ; Point to next free address
  538.     mov    r3    ,k11$mul    ; Insert address for EIS emulation
  539.     add    #p$mul-picstart,k11$mul    ; Add offset
  540.     mov    r3    ,k11$div    ; Again.
  541.     add    #p$div-picstart,k11$div    ; Add offset
  542.     mov    r3    ,$ttyout    ; Again
  543.     add    #p$ttyou-picstart,$ttyou; Add offset
  544.     mov    r3    ,$$cbta        ; Again
  545.     add    #p$cbta-picstart,$$cbta    ; Offset
  546. 10$:    movb    (r1)+    ,(r3)+        ; Copy
  547.     sob    r0    ,10$        ; Next please
  548.     return                ; Exit
  549.  
  550.     picstart =    .
  551.  
  552. p$mul::    mov    r0    ,-(sp)
  553.     mov    r1    ,-(sp)
  554.     mov    6(sp)    ,r0
  555.     mov    10(sp)    ,r1
  556.     mov    r0,-(sp)
  557.     mov    #21,-(sp)
  558.     clr    r0
  559. 10$:    ror    r0
  560.     ror    r1
  561.     bcc    20$
  562.     add    2(sp),r0
  563. 20$:    dec    (sp)
  564.     bgt    10$
  565.     cmp    (sp)+    ,(sp)+
  566.     mov    r1    ,10(sp)
  567.     mov    (sp)+    ,r1
  568.     mov    (sp)+    ,r0
  569.     mov    (sp)    ,2(sp)
  570.     tst    (sp)+
  571.     return
  572.     
  573. p$div::    mov    r0    ,-(sp)
  574.     mov    r1    ,-(sp)
  575.     mov    6(sp)    ,r0
  576.     mov    10(sp)    ,r1
  577.     mov    #20,-(sp)
  578.     mov    r1,-(sp)
  579.     clr    r1
  580. e00040:    asl    r0
  581.     rol    r1
  582.     cmp    r1,(sp)
  583.     bcs    e00054
  584.     sub    (sp),r1
  585.     inc    r0
  586. e00054:    dec    2(sp)
  587.     bgt    e00040
  588.     cmp    (sp)+    ,(sp)+
  589.     mov    r1    ,6(sp)
  590.     mov    r0    ,10(sp)
  591.     mov    (sp)+    ,r1
  592.     mov    (sp)+    ,r0
  593.     return
  594.  
  595.  
  596.  
  597. p$ttyo:    save    <r0,r1,r2,r3>        ; save registers we may need
  598.     mov    @r5    ,r1        ; get the string address
  599.     mov    2(r5)    ,r2        ; get the string length
  600.     bne    20$            ; non-zero then
  601.     mov    r1    ,r2        ; count until a null now
  602. 10$:    tstb    (r2)+            ; well ?
  603.     bne    10$            ; not yet, keep looking
  604.     sub    r1    ,r2        ; get the length now
  605.     dec    r2            ; all done
  606.     beq    100$            ; nothing to print at all?
  607.  
  608. 20$:    mov    @#$prtbuf,r0        ; now buffer the i/o to avoid
  609.     mov    #36    ,r3        ; the printing of cr/lf at the
  610. 30$:    tstb    (r1)+            ; don't copy nulls please
  611.     beq    35$            ; ignore if null
  612.     movb    -1(r1)    ,(r0)+        ; copy a byte please
  613. 35$:    dec    r2            ; done yet ?
  614.     beq    40$            ; yes
  615.     sob    r3    ,30$        ; no, next please
  616. 40$:    movb    #200    ,(r0)+        ; insure no carraige control !
  617.     clrb    @r0            ; must be passed .asciz
  618.     mov    @#$prtbuf,r0        ; point back to the start of buffer
  619.     emt    351            ; do the .print kmon request
  620.     tst    r2            ; any more data to buffer ?
  621.     bne    20$            ; yes, try again
  622.  
  623. 100$:    unsave    <r3,r2,r1,r0>
  624.     return
  625.  
  626.  
  627.  
  628.     .sbttl    Conversion from RSX syslib
  629.  
  630.  
  631. P$CBTA:    JSR    R5,@#$SAVRG
  632.     MOVB    R2,R5
  633.     CLRB    R2
  634.     SWAB    R2
  635.     ASR    R2
  636.     BCC    E00134
  637.     TST    R1
  638.     BPL    E00134
  639.     NEG    R1
  640.     MOVB    #55,(R0)+
  641. E00134:    MOV    R0,R4
  642.     ROR    R2
  643.     ROR    R2
  644.     ROR    R3
  645.     CLRB    R3
  646.     BISB    R2,R3
  647.     CLRB    R2
  648.     BISB    #60,R2
  649.     MOV    R1,R0
  650. E00160:    MOV    R0,R1
  651.     CLR    R0
  652.     DIV    R5,R0
  653.     CMP    R1,#11
  654.     BLOS    E00200
  655.     ADD    #7,R1
  656. E00200:    ADD    R2,R1
  657.     MOV    R1,-(SP)
  658.     DECB    R3
  659.     BLE    E00234
  660.     TST    R0
  661.     BNE    E00230
  662.     TST    R2
  663.     BPL    E00234
  664.     TST    R3
  665.     BPL    E00230
  666.     BIC    #20,R2
  667. E00230:    CALL    E00160
  668. E00234:    MOVB    (SP)+,(R4)+
  669.     MOV    R4,R0
  670.     RETURN
  671.  
  672.     picend    =    .
  673.  
  674.     .blkw    2
  675.  
  676.     .end
  677.