home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / cdccyber / cdcazl.asm < prev    next >
Assembly Source File  |  2020-01-01  |  64KB  |  1,894 lines

  1. *comdeck  cdkcbtz  convert blanks to zeroes in a word.
  2.  btz      ctext  cdkcbtz - convert blanks to zeroes in a word.
  3.  btz      space  4,10 
  4.           if     -def,qual$,1 
  5.           qual   cdkcbtz
  6.           base   d
  7.  btz      space  4,10 
  8. ***       btz - convert blanks to zeroes in a word. 
  9. *         g. m. townsend.    83/08/22.  code based on *comcztb*.
  10. *         btz converts all blanks in a word to 00 characters. 
  11.  btz      space  4,10 
  12. ***       btz converts all blanks in a word to 00 characters. 
  13. *         entry  (x1) = word to be converted. 
  14. *                (b1) = 1.
  15. *         exit   (x6) = converted word. 
  16. *                (x7) = final character mask. 
  17. *         uses   x - 3, 6, 7. 
  18. *                b - none.
  19. *                a - 3. 
  20. *         calls  none.
  21.   
  22.   
  23.  btz>     subr               entry/exit 
  24.           sa3    btza 
  25.           bx7    x1-x3       convert blanks to 00, others to misc 
  26.           sa3    a3+b1
  27.           bx6    x3*x7       remove upper bit from all characters 
  28.           bx7    -x3*x7      isolate upper bits 
  29.           ix6    x6+x3       any non-zero character produces carry
  30.           bx6    x6+x7       merge upper bits and carries 
  31.           bx7    -x3*x6      all non-zero characters = 40b
  32.           bx6    x7 
  33.           lx7    -5 
  34.           ix7    x6-x7
  35.           bx7    x6+x7       now have mask
  36.           bx6    x7*x1       clear spaces from original word
  37.           eq     btz>        and return 
  38.   
  39.  btza     con    10h
  40.           con    37373737373737373737b
  41.  btz      space  4,10 
  42.           base   *
  43.  qual$    if     -def,qual$ 
  44.           qual   *
  45.  btz>     equ    /cdkcbtz/btz>
  46.  qual$    endif 
  47.  btz      endx
  48. *comdeck  cdkcmfs  move fortran string. 
  49.  mfs      ctext  cdkcmfs - move fortran string. 
  50.  mfs      space  4,10 
  51.           if     -def,qual$,1 
  52.           qual   cdkcmfs
  53.           base   d
  54.  mfs      space  4,10 
  55. ***       mfs - move fortran string.
  56. *         g. m. townsend.    83/05/31.
  57. *         mfs moves a (possibly unaligned) ftn5 character string
  58. *         into a word-aligned buffer. 
  59.  mfs      space  4,10 
  60. ***       mfs moves a ftn5 character string into a buffer.  this is 
  61. *         particularly useful for subroutines which need their data 
  62. *         word-aligned.  if the string is too long for the buffer, it 
  63. *         is truncated;  if too short, it is padded with zeroes.
  64. *         mfs also works for ftn4 or ftn5 hollerith strings (characters 
  65. *         stored in variables of other types);  since such strings
  66. *         have no associated length they will be copied until the 
  67. *         buffer is filled. 
  68. *         strings must be in cm (not ecs/lcm) and must not exceed 
  69. *         777777b characters in length. 
  70. *         entry  (x1) = aplist entry specifying string in cm
  71. *                            (see ftn5 reference manual) or address 
  72. *                            of hollerith string. 
  73. *                (b1) = 1.
  74. *                (b6) = fwa of output buffer. 
  75. *                (b7) = size of output buffer, in words.
  76. *         exit   (b6) = lwa+1 of buffer.
  77. *         uses   x - 1, 2, 6, 7.
  78. *                b - 3, 4, 5, 6, 7. 
  79. *                a - 2, 6.
  80. *         calls  none.
  81.   
  82.   
  83.  mfs>     subr               entry/exit 
  84.           sa2    x1          (a2/x2) = current input word 
  85.           mx7    -6          (x7) = one-character mask
  86.           ax1    24 
  87.           bx6    -x1+x7      -(beginning char position) 
  88.           ax1    6
  89.           sb3    x1          (b3) = number of chars left (0 = unknown). 
  90.           sb4    x6+10       (b4) = number of chars left in x2
  91.           ix1    x6+x6       -2 * bcp 
  92.           ix1    x6+x1       -3 * bcp 
  93.           lx1    1           -6 * bcp (0 to -54)
  94.           sb5    x1 
  95.           ax2    b5          position x2 to first input character 
  96.           mx6    0           (x6) = output word in progress 
  97.           sb5    54          (b5) = shift count for stuffing output 
  98.           nz     b3,mfs2     if input char count provided 
  99.           sb3    -1          no, use huge count 
  100.           eq     mfs2        join main loop 
  101.   
  102.  mfs1     sa2    a2+1        get next input word
  103.           sb4    10          indicate 10 chars available
  104.  mfs2     zr     b3,mfs4     if input string exhausted
  105.           zr     b4,mfs1     if need to load new input word 
  106.  mfs3     lx2    6           no, position to next character 
  107.           sb3    b3-b1       count character from string
  108.           bx1    -x7*x2      isolate it 
  109.           sb4    b4-b1       count character from x2
  110.           lx1    b5          position it
  111.           sb5    b5-6        adjust shift count for next time 
  112.           bx6    x6+x1       add into output word 
  113.           pl     b5,mfs2     if output word not full
  114.           sa6    b6          yes, save output word
  115.           sb7    b7-b1       count it 
  116.           sb6    b6+b1       bump store address 
  117.           sb5    54          reset shift count
  118.           mx6    0           clear output word
  119.           gt     b7,mfs2     if output buffer not full
  120.           eq     mfs>        if full, return
  121.   
  122.  mfs4     mx2    0           use zeroes for remaining characters
  123.           sb4    b0          indicate huge number left
  124.           eq     mfs3        rejoin loop
  125.  mfs      space  4,10 
  126.           base   *
  127.  qual$    if     -def,qual$ 
  128.           qual   *
  129.  mfs>     equ    /cdkcmfs/mfs>
  130.  qual$    endif 
  131.  mfs      endx
  132. *comdeck  cdkcmvc            move characters. 
  133.  mvc      ctext  cdkcmvc - cm string move.
  134.  mvc      space  4,10 
  135.           if     -def,qual$,1 
  136.           qual   cdkcmvc
  137.           base   d
  138.  mvc      space  4,10 
  139. ***       mvc - move character string.
  140. *         r. o. anderson, 
  141. *         w. r. sears        75/05/21.
  142. *         r. o. anderson.    80/07/03.  handle char offsets .gt. 9. 
  143. *         mvc moves character strings.
  144.  mvc      space  4,10 
  145. ***       mvc moves strings from one location to another on what
  146. *         appears to be a character by character basis.  mvc does not 
  147. *         change characters in the destination area that lie beyond the 
  148. *         space covered by the string that was moved. 
  149. *         entry  (a1) = source address. 
  150. *                (a2) = destination address.
  151. *                (b1) = 1.
  152. *                (b2) = source character offset (0 to 131071).
  153. *                (b3) = destination character offset (0 to 131071). 
  154. *                (b4) = number of characters to move (0 to 131071). 
  155. *         exit   string moved.
  156. *         uses   x - 1, 2, 3, 4, 5, 6, 7. 
  157. *                b - 2, 3, 4, 5.
  158. *                a - 1, 2, 3, 4, 6, 7.
  159.   
  160.   
  161.  mvc.csiz equ    6           bits per character 
  162.  mvc.cpw  equ    60/mvc.csiz characters per word
  163.   
  164.   
  165.  mvc4     bx7    x2          set up 
  166.           sa2    a2-b1       for first
  167.           bx6    x2          iteration
  168.           sa6    a2          of loop
  169.  mvc5     bx5    -x3*x1      -123456789 
  170.           bx2    x4*x7       abc------- 
  171.           sa1    a1+b1       klmnopqrst 
  172.           bx7    x3*x1       k--------- 
  173.           bx7    x5+x7       k123456789 
  174.           lx7    b2,x7       89k1234567 
  175.           bx6    -x4*x7      ---1234567 
  176.           bx6    x6+x2       abc1234567 
  177.           sb4    b4-mvc.cpw  decrement characters left
  178.           le     b4,mvc6     if done
  179.           sa6    a6+b1       store this word
  180.           eq     mvc5        loop till done 
  181.   
  182.  mvc6     sa2    mvca+mvc.cpw-1+b4  get proper edit mask
  183.           sb3    b3-60       set up right circular shift of mask
  184.           lx2    -b3,x2      ---******- 
  185.           bx1    x4+x2       *********- 
  186.           bx3    x4*x2       ---------- 
  187.           bx7    x4*x7       890------- 
  188.           sa2    a6+b1       abcdefghij 
  189.           sa4    a2+b1       klmnopqrst 
  190.           bx2    -x1*x2      ---------j 
  191.           bx4    -x3*x4      klmnopqrst 
  192.           bx6    x1*x6       abc123456- 
  193.           bx7    x3*x7       ---------
  194.           bx6    x6+x2       abc123456j 
  195.           bx7    x7+x4       klmnopqrst 
  196.           sa6    a2          update 
  197.           sa7    a4          last words 
  198.  mvc>     subr               entry/exit 
  199.           le     b4,mvc>     quit if nothing to do
  200.           sx6    mvc.csiz    x6 = bits per character
  201.  mvc0     sb2    b2-10       compute source word address
  202.           mi     b2,mvc0a    if word address ok 
  203.           sa1    a1+b1       advance 1 word 
  204.           eq     mvc0 
  205.   
  206.  mvc0a    sb2    b2+10       compute corrected source offset
  207.           mx5    1           for mask generation
  208.           sb5    b2          save source offset for later 
  209.  mvc0b    sb3    b3-10       compute destination word address 
  210.           mi     b3,mvc0c    if word address ok 
  211.           sa2    a2+b1       advance 1 word 
  212.           eq     mvc0b
  213.   
  214.  mvc0c    sb3    b3+10       compute corrected destination offset 
  215.           sx7    b2          convert
  216.           ix7    x7*x6       source offset
  217.           sb2    x7          to bits
  218.           sx7    b3          convert
  219.           ix7    x7*x6       destination offset 
  220.           sb3    x7          to bits
  221.           ax3    x5,b2       build source and 
  222.           ax4    x5,b3       destination masks
  223.           lx5    b1,x3       compensate 
  224.           bx3    x5*x3       for
  225.           lx5    b1,x4       extra
  226.           bx4    x5*x4       bit
  227.           sx6    a1          get fwa of source area 
  228.           sb2    b2-b3       b2 is offset difference
  229.           pl     b2,mvc1     skip if positive 
  230.           sb2    b2+60       else make it positive
  231.  mvc1     sx7    a2          get destination fwa
  232.           ix5    x6-x7       see if fwa source .ge. fwa dest. 
  233.           pl     x5,mvc4     if so
  234.           sx5    b5+b4       get character offset of lwa source 
  235.           sx7    mvc.cpw     compute
  236.           mx6    -1          characters per word
  237.           ix6    x6+x7       minus one
  238.           ix5    x5+x6       x5 = offset + rounding value 
  239. *          ix7    x5/x7,b5    word offset of lwa + 1 source 
  240.           ix7    x5/x7       word offset of lwa + 1 source
  241.           sx6    a1          compute lwa + 1
  242.           ix5    x6+x7       of source
  243.           sx6    a2          see if lwa + 1 source
  244.           ix6    x6-x5       .le. fwa destination 
  245.           pl     x6,mvc4     if so
  246.           sa1    x5-1        a1 = lwa source
  247.           sx6    a2          compute
  248.           ix5    x6+x7       lwa + 1 destination
  249.           sa2    x5-1        a2 = lwa destination 
  250.           sx7    mvc.cpw     compute
  251.           sx6    b4          remainder of 
  252.           px6    x6,b0         integer divide 
  253.           px7    x7,b0
  254.           nx7    x7,b0
  255.           fx5    x6/x7
  256.           ux6,b5 x6          restore registers
  257.           lx6    x6,b5
  258.           ux7,b5 x7 
  259.           lx7    x7,b5
  260.           ux5,b5 x5 
  261.           lx5    x5,b5
  262.           ix5    x5*x7       number of characters / chars per word
  263.           ix5    x6-x5       then get 
  264.           ix5    x5-x7       index into mask table
  265.           sb5    mvca+mvc.cpw-1+x5  b5 = pointer to mask
  266.           bx6    x3          save 
  267.           sa6    mvcb        both 
  268.           bx7    x4          masks
  269.           sa7    a6+b1       for later
  270.           lx6    x1,b2       ^!+"*/[]() 
  271.           bx5    x4*x6       ^!+------- 
  272.           bx6    x3*x1       +--------- 
  273.           sa1    a1-b1       0123456789 
  274.           bx1    -x3*x1      -123456789 
  275.           bx6    x6+x1       +123456789 
  276.           lx7    x6,b2       89+1234567 
  277.           bx6    x4*x7       89+------- 
  278.           sa1    a1+b1       +"*/[]()^! 
  279.           lx1    x1,b2       ^!+"*/[]() 
  280.           bx1    -x4*x1      ---"*/[]() 
  281.           bx6    x6+x1       89+"*/[]() 
  282.           sa3    b5          get the edit mask
  283.           sb5    b3-60       get mask rotation value
  284.           lx3    -b5,x3      **-******* 
  285.           bx1    x4+x3       ********** 
  286.           bx3    x4*x3       **-------- 
  287.           sa4    a2+b1       %%%%%%%%%% 
  288.           bx4    -x3*x4      --%%%%%%%% 
  289.           bx5    x3*x5       ^!-------- 
  290.           bx5    x5+x4       ^!%%%%%%%% 
  291.           bx2    -x1*x2      ---------- 
  292.           bx4    x1*x6       89+"*/[]() 
  293.           bx6    x5          ^!%%%%%%%% 
  294.           sa6    a4          update last word in dest. area 
  295.           bx6    x4+x2       89+"*/[]() 
  296.           sa6    a2          update the next to last word 
  297.           cx1    x1          see
  298.           cx3    x3          how many 
  299.           ix3    x3+x1       characters 
  300.           sx1    mvc.csiz    were 
  301. *          ix3    x3/x1,b5    used
  302.           ix3    x3/x1       used 
  303.           sb5    x3          and decrement
  304.           sb4    b4-b5       the total
  305.           le     b4,mvc>     if done
  306.           sa1    a1-b1       0123456789 
  307.           sa3    mvcb        recover
  308.           sa4    a3+b1       masks
  309.  mvc2     bx5    x3*x1       0--------- 
  310.           bx2    -x4*x7      ---1234567 
  311.           sa1    a1-b1       abcdefghij 
  312.           bx7    -x3*x1      -bcdefghij 
  313.           bx7    x7+x5       0bcdefghij 
  314.           lx7    b2,x7       ij0bcdefgh 
  315.           bx6    x4*x7       ij0------- 
  316.           bx6    x6+x2       ij01234567 
  317.           sb4    b4-mvc.cpw  decrement characters left
  318.           le     b4,mvc3     if done
  319.           sa6    a6-b1       store this word
  320.           eq     mvc2        loop till done 
  321.   
  322.  mvc3     bx6    -x4*x6      ---bcdefgh 
  323.           sa1    a6-b1       klmnopqrst 
  324.           bx1    x4*x1       klm------- 
  325.           bx6    x1+x6       klmbcdefgh 
  326.           sa6    a1          store last word
  327.           eq     mvc>        return 
  328.   
  329.  mvca     vfd    mvc.csiz/-0,*p/0  mask table 
  330.  .mvcif   ifgt   mvc.cpw,2
  331.  .mvcset  set    mvc.csiz 
  332.  .mvc1up  dup    mvc.cpw-2
  333.  .mvcset  set    .mvcset+mvc.csiz 
  334.           vfd    .mvcset/-0,*p/0
  335.  .mvc1up  endd
  336.  .mvcif   endif 
  337.           data   -0 
  338.   
  339.  mvcb     bss    2           to save masks
  340.  mvc      space  4,10 
  341.           base   *
  342.  qual$    if     -def,qual$ 
  343.           qual   *
  344.  mvc>     equ    /cdkcmvc/mvc>
  345.  qual$    endif 
  346.  mvc      endx
  347. *comdeck  cdkcscs  select character set.
  348.  scs      ctext  cdkcscs - select character set.
  349.  scs      space  4,10 
  350.           if     -def,qual$,1 
  351.           qual   cdkcscs
  352.           base   d
  353.  scs      space  4,10 
  354. ***       scs - select character set. 
  355. *         g. m. townsend.    81/02/17.
  356. *         scs determines the character set of a file by inspecting the
  357. *         first buffer full of data.
  358.  scs      space  4,10 
  359. ***       scs looks at a portion of a file to determine whether it is 
  360. *         display code or 7-in-12 ascii.  it does this by seeing if 
  361. *         there are zero bits where they should be for an ascii file; 
  362. *         if not, the file is assumed to be in display code.  the 
  363. *         algorithm is not foolproof -- it can falsely diagnose a file
  364. *         as ascii if it contains only the display code characters
  365. *         a, 5, and 6 (also *:* in 64-character set) in odd-numbered
  366. *         columns.  despite this, the method works well in practice.
  367. *         scs looks at all the data in a circular buffer, as indicated
  368. *         by the fet.  the caller should first issue a read, then call
  369. *         scs.
  370. *         entry  (x2) = fet address.
  371. *                (b1) = 1.
  372. *         exit   (x6) = 1 if display code.
  373. *                (x6) = 0 if buffer is empty. 
  374. *                (x6) = -1 if nos 812 ascii.
  375. *                (x6) = -2 if ut 812 ascii. 
  376. *         uses   x - 1, 3, 6. 
  377. *                b - 2, 3, 4, 5.
  378. *                a - 1, 3.
  379.   
  380.   
  381.  scs>     subr               entry/exit 
  382.           recall x2          wait for read to finish
  383.           sa1    x2+b1
  384.           sb2    x1          (b2) = first 
  385.           sa1    a1+b1
  386.           sb3    x1          (b3) = in
  387.           sa1    a1+b1
  388.           sb4    x1          (b4) = out 
  389.           sa1    a1+b1
  390.           sb5    x1          (b5) = limit 
  391.           sx6    b0 
  392.           eq     b3,b4,scs>  if empty buffer, return
  393.           sa3    scsa        (x3) = mask
  394.           sx6    b1          assume display code
  395.  scs1     sa1    b4          fetch word 
  396.           bx1    -x3*x1 
  397.           zr     x1,scs2     if ok ascii so far, check more 
  398.           sa1      b4              check against ut 812 ascii 
  399.           sa3      scsb 
  400.           bx1      -x3*x1 
  401.           nz       x1,scs>         if display code, return
  402. scs2      sb4      b4+b1           bump pointer 
  403.           eq     b4,b3,scs3  if no more in buffer 
  404.           lt     b4,b5,scs1  if not yet to limit
  405.           sb4    b2          go back to first 
  406.           ne     b4,b3,scs1  if more to check 
  407.  scs3     sx6    -b1         indicate ascii 
  408.           sa1      scsa 
  409.           bx1      x1-x3
  410.           zr       x1,scs>         if nos 812 ascii 
  411.           sx6      -2              indicate ut 812 ascii
  412.           eq     scs>        return 
  413.   
  414. scsa      data   41774177417741774177b  mask for bits in ascii chars
  415. scsb      data   43774377437743774377b  mask for ut 812 chars 
  416.  scs      space  4,10 
  417.           base   *
  418.  qual$    if     -def,qual$ 
  419.           qual   *
  420.  scs>     equ    /cdkcscs/scs>
  421.  qual$    endif 
  422.  scs      endx
  423. *comdeck  cdkcsxt            convert characters, sixbit to twelvebit. 
  424.  sxt      ctext  cdkcsxt - sixbit to twelve bit character mapping.
  425.  sxt      space  4,10 
  426.           if     -def,qual$,1 
  427.           qual   cdkcsxt
  428.           base   d
  429.  sxt      space  4,10 
  430. ***       sxt - sixbit to twelve bit character mapping. 
  431. *         r. o. anderson.    75/01/27.
  432. *         sxt converts a 6-bit character set into a 12-bit character
  433. *         set.
  434.  sxt      space  4,10 
  435. ***       sxt performs a character mapping operation using a conversion 
  436. *         table of 1 character per word, right justified, binary zero 
  437. *         filled.  the table is assumed to be long enough to allow
  438. *         mapping of any character encountered in the input string. 
  439. *         entry  (b1) = 1.
  440. *                (b2) = address of input string.
  441. *                (b3) = length of input string, in words. 
  442. *                (b4) = address of output string. 
  443. *                (b5) = address of conversion table.
  444. *         exit   string converted.
  445. *         uses   x - 1, 2, 6, 7.
  446. *                b - none.
  447. *                a - 1, 2, 6. 
  448.   
  449.   
  450.   
  451.  sxt>     subr               entry/exit 
  452.           sx6    b3          save input 
  453.           sa6    sxta        string length
  454.           sx6    b4          save output
  455.           sa6    a6+b1       start address
  456.           sb3    b2+b3       compute lwa + 1 of input area
  457.           mx7    -6          set up a one byte mask 
  458.  sxt1     sa1    b2          read up the next word to convert 
  459.           mx6    0           clear assembly register
  460.  .sxt     dup    5
  461.           lx1    6           get one character
  462.           bx2    -x7*x1      in x2
  463.           sa2    b5+x2       get replacement
  464.           lx6    12          make room for new character
  465.           bx6    x6+x2       add in new character 
  466.  .sxt     endd
  467.           sa6    b4          store output word
  468.           mx6    0           clear assembly register
  469.  .sxt     dup    5
  470.           lx1    6           get one character
  471.           bx2    -x7*x1      in x2
  472.           sa2    b5+x2       get replacement
  473.           lx6    12          make room for new character
  474.           bx6    x6+x2       add in new character 
  475.  .sxt     endd
  476.           sa6    a6+b1       store output word
  477.           sb2    b2+b1       increment in pointer 
  478.           sb4    a6+b1       increment out pointer
  479.           lt     b2,b3,sxt1  loop till done 
  480.           sa1    sxta        recover input
  481.           sb3    x1          string length
  482.           sa1    a1+b1       recover output 
  483.           sb4    x1          start address
  484.           sb2    b2-b3       restore input starting address 
  485.           eq     sxt>        return 
  486.   
  487.  sxta     bss    2           to save length and out start addr
  488.  sxt      space  4,10 
  489.           base   *
  490.  qual$    if     -def,qual$ 
  491.           qual   *
  492.  sxt>     equ    /cdkcsxt/sxt>
  493.  qual$    endif 
  494.  sxt      endx
  495. *comdeck  cdkctxs            convert characters, twelvebit to sixbit. 
  496.  txs      ctext  cdkctxs - twelve bit to sixbit character mapping.
  497.  txs      space  4,10 
  498.           if     -def,qual$,1 
  499.           qual   cdkctxs
  500.           base   d
  501.  txs      space  4,10 
  502. ***       txs - twelve bit to sixbit character mapping. 
  503. *         r. o. anderson.    75/01/27.
  504. *         txs converts a 12-bit character set into a 6-bit character
  505. *         set.
  506.  txs      space  4,10 
  507. ***       txs performs a character mapping operation using a conversion 
  508. *         table of 1 character per word, right justified, binary zero 
  509. *         filled.  the table is assumed to be long enough to allow
  510. *         mapping of any character encountered in the input string. 
  511. *         entry  (b1) = 1.
  512. *                (b2) = address of input string.
  513. *                (b3) = length of input string, in words. 
  514. *                (b4) = address of output string. 
  515. *                (b5) = address of conversion table.
  516. *         exit   string converted.
  517. *         uses   x - 1, 2, 6, 7.
  518. *                b - none.
  519. *                a - 1, 2, 6. 
  520.   
  521.   
  522.   
  523.  txs>     subr               entry/exit 
  524.           sx6    b3          save input 
  525.           sa6    txsa        string length
  526.           sx6    b4          save output
  527.           sa6    a6+b1       start address
  528.           sb3    b2+b3       compute lwa + 1 of input area
  529.           mx7    -12         set up a one byte mask 
  530.  txs1     sa1    b2          read up the next word to convert 
  531.           mx6    0           clear assembly register
  532.  .txs     dup    5
  533.           lx1    12          get one character
  534.           bx2    -x7*x1      in x2
  535.           sa2    b5+x2       get replacement
  536.           lx6    6           make room for new character
  537.           bx6    x6+x2       add in new character 
  538.  .txs     endd
  539.           sb2    b2+b1       increment in pointer 
  540.           ge     b2,b3,txs3  store word if input length odd 
  541.           sa1    b2          else get next word and continue
  542.  .txs     dup    5
  543.           lx1    12          get one character
  544.           bx2    -x7*x1      in x2
  545.           sa2    b5+x2       get replacement
  546.           lx6    6           make room for new character
  547.           bx6    x6+x2       add in new character 
  548.  .txs     endd
  549.           sa6    b4          store output word
  550.           sb2    b2+b1       increment in pointer 
  551.           sb4    b4+b1       increment out pointer
  552.           lt     b2,b3,txs1  loop till done 
  553.  txs2     sa1    txsa        recover input
  554.           sb3    x1          string length
  555.           sa1    a1+b1       recover output 
  556.           sb4    x1          start address
  557.           sb2    b2-b3       restore input starting address 
  558.           eq     txs>        return 
  559.   
  560.  txs3     lx6    30          position partial word
  561.           sa6    b4          save it
  562.           eq     txs2        to complete exit 
  563.   
  564.  txsa     bss    2           to save length and out start addr
  565.  txs      space  4,10 
  566.           base   *
  567.  qual$    if     -def,qual$ 
  568.           qual   *
  569.  txs>     equ    /cdkctxs/txs>
  570.  qual$    endif 
  571.  txs      endx
  572. *comdeck  cdkcvfn            validate file name.
  573.  vfn      ctext  cdkcvfn - validate file name.
  574.  vfn      space  4,10 
  575.           if     -def,qual$,1 
  576.           qual   cdkcvfn
  577.           base   d
  578.  vfn      space  4,10 
  579. ***       vfn - validate file name. 
  580. *         g. m. townsend.    78/02/02.
  581. *         vfn checks that a string is a legal file name.
  582.  vfn      space  4,10 
  583. ***       entry  (x1) = file name, l format.
  584. *                (b1) = 1.
  585. *         exit   (x1) = 0 if legal. 
  586. *         uses   x - 1, 2, 6. 
  587. *                b - 2. 
  588. *                a - none.
  589.   
  590.   
  591.  vfn>     subr               entry/exit 
  592.           mi     x1,vfn>     if negative, return immediately
  593.           bx2    x1 
  594.           ax2    54 
  595.           sx2    x2-1r0 
  596.           pl     x2,vfn>     if first char numeric, return
  597.           sb2    7           (b2) = character counter 
  598.           mx2    -6          (x2) = character mask
  599.  vfn1     lx1    6
  600.           bx6    -x2*x1      (x6) = character 
  601.           zr     x6,vfn>     if zero character, return
  602.           sx6    x6-1r9-1 
  603.           pl     x6,vfn>     if illegal character, return 
  604.           bx1    x2*x1       clear out last char, it is legal 
  605.           sb2    b2-b1
  606.           nz     b2,vfn1     if more characters to test 
  607.           eq     vfn>        return 
  608.  vfn      space  4,10 
  609.           base   *
  610.  qual$    if     -def,qual$ 
  611.           qual   *
  612.  vfn>     equ    /cdkcvfn/vfn>
  613.  qual$    endif 
  614.  vfn      endx
  615. *deck rel 
  616.           ident  cpu.btz
  617.           entry  btz> 
  618.  btz      title  btz - convert blanks to zeroes in a word.
  619.           comment convert blanks to zeroes in a word. 
  620. *call     cdkcbtz 
  621.           end 
  622.           ident  cpu.mfs
  623.           entry  mfs> 
  624.  mfs      title  mfs - move fortran string. 
  625.           comment move fortran string.
  626. *call     cdkcmfs 
  627.           end 
  628.           ident  cpu.mvc
  629.           entry  mvc> 
  630.  mvc      title  mvc - move characters. 
  631.           comment move characters.
  632. *call     cdkcmvc 
  633.           end 
  634.           ident  cpu.scs
  635.           entry  scs> 
  636.  scs      title  scs - select character set.
  637.           comment select character set. 
  638. *call     cdkcscs 
  639.           end 
  640.           ident  cpu.sxt
  641.           entry  sxt> 
  642.  sxt      title  sxt - convert characters, sixbit to twelvebit. 
  643.           comment convert characters, sixbit to twelvebit.
  644. *call     cdkcsxt 
  645.           end 
  646.           ident  cpu.txs
  647.           entry  txs> 
  648.  txs      title  txs - convert characters, twelvebit to sixbit. 
  649.           comment convert characters, twelvebit to sixbit.
  650. *call     cdkctxs 
  651.           end 
  652.           ident  cpu.vfn
  653.           entry  vfn> 
  654.           sst 
  655.  vfn      title  vfn - validate file name.
  656.           comment validate file name. 
  657. *call     cdkcvfn 
  658.           end 
  659. *deck macrel
  660.           ident  macrel 
  661.           entry    macrel.,macrel=,macwal=
  662.           sst 
  663.           b1=1
  664.           list   f
  665.           title  macrel - system macro interface routines.
  666.           comment  system macro interface routines. 
  667.  macrel   space  4,10 
  668. ***       macrel - system macro interface routines. 
  669. *         t. r. ramsey.      76/08/08.
  670. *         copyright control data corporation. 1976. 
  671.  macrel   space  4,10 
  672. ***              macrel is a collection of relocatable modules that 
  673. *         provide the interface between higher level language modules 
  674. *         and the system macros.
  675. *         fortran calling sequences are shown in each module along with 
  676. *         other pertinent information, e.g., entry, exit. 
  677.           title  macrel - system macro interface routines.
  678.  macrel   space  4,10 
  679. **               macrel modules translate parameters in higher level
  680. *         language calling sequences into macro calling sequences.
  681. *         fortran calling sequences mentioned are equivalent to 
  682. *         cobol (enter using), sympl, etc.
  683. *         entry  fortran *call* and function reference calling
  684. *                sequences use the actual parameter list, call by 
  685. *                reference calling sequence where - 
  686. *                 (a1)      = fwa of aplist 
  687. *                ((a1))     # first parameter 
  688. *                ((a1+1))   # second parameter
  689. *                  .          . 
  690. *                  .          . 
  691. *                  .          . 
  692. *                ((a1+n))   # n-th parameter
  693. *                ((a1+n+1)) = 0 (zero)  (nominally)  (un-needed herein) 
  694. *                 (x1)      # first parameter 
  695. *         exit   for *call*, typically none, but see individual modules.
  696. *                for function references, 
  697. *                (x6) = function result 
  698. *                (x7) = second word of two word result, e.g., complex 
  699. *         uses   preserves a0 
  700. *         calls  macrel. if macro undefined or not coded yet
  701. *                macrel= if argument error
  702. *         needs  each module contains a call to a macro whose name is 
  703. *                the same as the module (except where noted).  these
  704. *                macros are defined in systext (kronos nos) and cputext 
  705. *                (scope nos/be) and also in jettext.  jettext is the
  706. *                preferred system text. 
  707. *         note   b1 is set to one upon entry to each module 
  708. *         other  macrel is a collection of relocatable modules combined 
  709. *                into one *update* deck entity named macrel.  the 
  710. *                modules are arranged in the same order as the macros 
  711. *                in jettext.
  712.  macrel.  space  4,10 
  713. **        macrel. - undefined macro processor.
  714. *         entry  (x1) = macro name in 0l format 
  715. *         exit   does not exit
  716. *         uses   a6  b1  x6 
  717. *         calls  none 
  718. *         needs  macros abort, message
  719.   
  720.   
  721.  macrel.  subr               entry/exit 
  722.           sb1    1
  723.           bx6    x1 
  724.           sa6    maca+3 
  725.           message  maca,,rcl
  726.           abort 
  727.           eq       macrel.
  728.   
  729.  maca     data   c* macrel - undefined macro -   fill-in.*
  730.  macrel=  space  4,10 
  731. **        macrel= - illegal argument processor. 
  732. *         entry  (x1) = macro name in 0l format 
  733. *                (x2) = illegal argument
  734. *         exit   does not exit
  735. *         uses   a6  b1  x0,x1,x2,x6
  736. *         calls  ztb= 
  737. *         needs  macros abort, message
  738.   
  739.   
  740.  macrel=  subr               entry/exit 
  741.           sb1    1
  742.           bx0    x2          save second argument 
  743.           lx1    -6 
  744.           sx2    1r-
  745.           bx1    x1+x2
  746.           rj     =xztb= 
  747.           bx1    x0 
  748.           sa6    macb 
  749.           rj     =xztb= 
  750.           sa6    macb+3 
  751.           message  macb,,rcl
  752.           abort  ,nd
  753.           eq       macrel=
  754.   
  755.  macb     data   c* fill-in - illegal argument  >fill-it-in<.*
  756.  macwal=  space  4,10 
  757. **        macwal= - word align a 10 or less character parameter.
  758. *         entry  (x1) = ftn/ftn5 argument list item.
  759. *         exit   (x2) = value from argument list, left justified, with
  760. *                space fill, unless value was 0b or all spaces, in
  761. *                which case, 0b returned. 
  762. *         uses   a2,a3,a6  b1,b3,b4,b5,b6,b7  x1,x2,x3,x6,x7
  763. *         calls  mfs>, ztb=.
  764.   
  765.   
  766.  macwal=  subr               entry/exit 
  767.           sb1    1
  768.           sb6    macc        where mfs can stash the result 
  769.           sb7    b1          length of mfs buffer 
  770.           rj     =xmfs>      move the option
  771.           sa2    macc        get the result 
  772.           zr     x2,macwal=  if nothing specified, return binary zero 
  773.           bx1    x2          for ztb
  774.           rj     =xztb=      blank out the 00b characters 
  775.           sa2    macd        spaces 
  776.           bx2    x2-x6
  777.           zr     x2,macwal=  map spaces to zero for ftn5
  778.           bx2    x6          for most of our callers, this is best
  779.           eq     macwal=     return 
  780.   
  781.  macc     bss    1           buffer for mfs 
  782.  macd     data   10h
  783.   
  784.           end 
  785.           ident  excst
  786.           entry  excst
  787.           sst 
  788.           syscom b1 
  789.  excst    title  excst - execute control statement for ftn. 
  790.           comment (ftn) execute control statement.
  791.  excst    space  4,10 
  792. *****     excst - execute control statement for ftn.
  793. *         r. o. anderson.    83/10/31.
  794. *         allow ftn program to execute a control statement. 
  795.  excst    space  4,10 
  796. ***       excst allows an ftn program to execute a control
  797. *         statement at termination. 
  798. *         call excst(string)
  799. *         entry  *string* is a hollerith string (ftn4), including 
  800. *                a line terminator, or a character variable (ftn5). 
  801. *                in either case, the maximum length is 80 characters. 
  802. *         exit   does not return. 
  803. *         calls  mfs>, sys=.
  804.   
  805.   
  806.  excst    subr     =               entry (only) 
  807.           sb1      1               always 
  808.           sb6      ccdr            where to put the image 
  809.           sb7      8               maximum buffer length
  810.           rj       =xmfs>          move the string
  811.           excst    ccdr            execute image
  812. *         system   pcc,r,ccdr      execute image (does not return)
  813.           endrun                   in case we did a 1aj command 
  814.   
  815.           end 
  816.           ident  close
  817.           entry    close
  818.           sst 
  819.           b1=1
  820.           title  close - close file.
  821.           comment   close file. 
  822.  close    space  4,10 
  823. ***       close - close file. 
  824. *         call close (file,option)
  825. *         entry  (file) = first word of the fet 
  826. *                (option) = a hollerith string or character variable
  827. *                           with any of the following values. 
  828. *                         = 0 or blanks, close with rewind
  829. *                         = ^nr^, close without rewind
  830. *                         = ^reel^, close reel with rewind
  831. *                         = ^reelnr^, close reel without rewind 
  832. *                         = ^reelun^, close reel with rewind, unload
  833. *                         = ^return^, close with rewind, return 
  834. *                         = ^rewind^, close with rewind 
  835. *                         = ^unload^, close with rewind, unload 
  836. *         exit   to argument-error processor if option is unrecognized
  837. *         else   none 
  838.   
  839.   
  840.  close    subr
  841.           sb1    1
  842.           sa1    a1+b1       point to option
  843.           rj     =xmacwal=   word align option
  844.           sa1    a1-b1       reset x1 to be fet address 
  845.           zr,x2  clo1 
  846.           sa3    =0hnr
  847.           bx4    x2-x3
  848.           zr,x4  clo2        if nr
  849.           sa3    =0hreel
  850.           bx4    x2-x3
  851.           zr,x4  clo3        if reel
  852.           sa3    =0hreelnr
  853.           bx4    x2-x3
  854.           zr,x4  clo4        if reelnr
  855.           sa3    =0hreelun
  856.           bx4    x2-x3
  857.           zr,x4  clo5        if reelun
  858.           sa3    =0hreturn
  859.           bx4    x2-x3
  860.           zr,x4  clo6        if return
  861.           sa3    =0hrewind
  862.           bx4    x2-x3
  863.           zr,x4  clo7        if rewind
  864.           sa3    =0hunload
  865.           bx4    x2-x3
  866.           zr,x4  clo8        if unload
  867.           sa1    =0lclose 
  868.           rj     =xmacrel=   diagnose illegal argument
  869.           eq     close
  870.   
  871.  clo1     close  x1 
  872.           eq     close
  873.   
  874.  clo2     close  x1,nr
  875.           eq     close
  876.   
  877.  clo3     closer x1 
  878.           eq     close
  879.   
  880.  clo4     closer x1,nr
  881.           eq     close
  882.   
  883.  clo5     closer x1,unload
  884.           eq     close
  885.   
  886.  clo6     close  x1,return
  887.           eq     close
  888.   
  889.  clo7     close  x1 
  890.           eq     close
  891.   
  892.  clo8     close  x1,unload
  893.           eq     close
  894.   
  895.           end 
  896.           ident  open 
  897.           entry  open 
  898.           sst 
  899.           b1=1
  900.           title  open - open file for processing. 
  901.           comment   open file for processing. 
  902.  open     space  4,10 
  903. ***       open - open file for processing.
  904. *         call open (file,option) 
  905. *         entry  (file) = first word of the fet 
  906. *                (option) = a hollerith string or character variable
  907. *                           with any of the following values. 
  908. *                         = 0 or blanks, same as ^alter^
  909. *                         = ^alter^, open with rewind for i-o 
  910. *                         = ^alternr^, open for i-o 
  911. *                         = ^nr^, open
  912. *                         = ^read^, open with rewind for input
  913. *                         = ^readnr^, open for input
  914. *                         = ^reel^, open reel with rewind 
  915. *                         = ^reelnr^, open reel 
  916. *                         = ^write^, open with rewind for output
  917. *                         = ^writenr^, open for output
  918. *         exit   to argument-error processor if option is unrecognized
  919. *         else   none 
  920.   
  921.   
  922.  open     subr
  923.           sb1    1
  924.           sa1    a1+b1       point to option
  925.           rj     =xmacwal=   word align option
  926.           sa1    a1-b1       reset x1 to be fet address 
  927.           zr,x2  ope1 
  928.           sa3    =0halter 
  929.           sa4    =0halternr 
  930.           sa5    =0hnr
  931.           bx3    x2-x3
  932.           bx4    x2-x4
  933.           zr,x3  ope2        if alter 
  934.           bx5    x2-x5
  935.           zr,x4  ope3        if alternr 
  936.           zr,x5  ope4        if nr
  937.           sa3    =0hread
  938.           sa4    =0hreadnr
  939.           sa5    =0hreel
  940.           bx3    x2-x3
  941.           bx4    x2-x4
  942.           zr,x3  ope5        if read
  943.           bx5    x2-x5
  944.           zr,x4  ope6        if readnr
  945.           zr,x5  ope7        if reel
  946.           sa3    =0hreelnr
  947.           sa4    =0hwrite 
  948.           sa5    =0hwritenr 
  949.           bx3    x2-x3
  950.           bx4    x2-x4
  951.           zr,x3  ope8        if reelnr
  952.           bx5    x2-x5
  953.           zr,x4  ope9        if write 
  954.           zr,x5  ope10       if writenr 
  955.           sa1    =0lopen
  956.           rj     =xmacrel=   diagnose illegal argument
  957.           eq     open 
  958.   
  959.  ope1     open   x1 
  960.           eq     open 
  961.   
  962.  ope2     open   x1,alter 
  963.           eq     open 
  964.   
  965.  ope3     open   x1,alternr 
  966.           eq     open 
  967.   
  968.  ope4     open   x1,nr
  969.           eq     open 
  970.   
  971.  ope5     open   x1,read
  972.           eq     open 
  973.   
  974.  ope6     open   x1,readnr
  975.           eq     open 
  976.   
  977.  ope7     open   x1,reel
  978.           eq     open 
  979.   
  980.  ope8     open   x1,reelnr
  981.           eq     open 
  982.   
  983.  ope9     open   x1,write 
  984.           eq     open 
  985.   
  986.  ope10    open   x1,writenr 
  987.           eq     open 
  988.   
  989.           end 
  990.           ident  read 
  991.           entry  read 
  992.           sst 
  993.           b1=1
  994.           title  read - read file to cio buffer.
  995.           comment   read file to cio buffer.
  996.  read     space  4,10 
  997. ***       read - read file to cio buffer. 
  998. *         call read (file)
  999. *         entry  (file) = first word of the fet 
  1000.   
  1001.   
  1002.  read     subr
  1003.           sb1    1
  1004.           read   x1 
  1005.           eq     read 
  1006.   
  1007.           end 
  1008.           ident  writer 
  1009.           entry  writer 
  1010.           sst 
  1011.           b1=1
  1012.           title  writer - write end of record.
  1013.           comment   write end of record.
  1014.  writer   space  4,10 
  1015. ***       writer - write end of record. 
  1016. *         call writer (file,level)
  1017. *         entry  (file) = first word of the fet 
  1018. *                (level) = record level 
  1019.   
  1020.   
  1021.  writer   subr
  1022.           sb1    1
  1023.           sa3    a1+b1       address of level 
  1024.           sa3    x3          level
  1025.           writer x1,x3
  1026.           eq     writer 
  1027.   
  1028.           end 
  1029.           ident  readc
  1030.           entry  readc
  1031.           sst 
  1032.           b1=1
  1033.           title  readc - read coded line in *c* format. 
  1034.           comment   read coded line in *c* format.
  1035.  readc    space  4,10 
  1036. ***       readc - read coded line in *c* format.
  1037. *         call readc (file,buf,n,status)
  1038. *         transfers data until the end of line byte (0000) is sensed. 
  1039. *         entry  (file) = first word of the fet 
  1040. *                (buf) = first word of the working buffer 
  1041. *                (n) = word count of the working buffer 
  1042. *         exit   (status) = 0, transfer complete
  1043. *                         = -1, end-of-file detected on file
  1044. *                         = -2, end-of-information detected on file 
  1045. *                         = lwa, end-of-record detected on file before
  1046. *                                transfer was complete
  1047. *                     lwa = address + 1 of last word transferred to 
  1048. *                           working buffer
  1049.   
  1050.   
  1051.  readc    subr
  1052.           sb1    1
  1053.           sa3    a1+b1       fwa of working buffer
  1054.           sa4    a3+b1       address of word count
  1055.           sa5    a4+b1       (x5) = address of status word
  1056.           bx6      x5 
  1057.           sa4    x4          word count 
  1058.           readc  x1,x3,x4 
  1059.           bx6    x1 
  1060.           sa6    x5 
  1061.           eq     readc
  1062.   
  1063.           end 
  1064.           ident  readw
  1065.           entry  readw
  1066.           sst 
  1067.           b1=1
  1068.           title  readw - read data to working buffer. 
  1069.           comment   read data to working buffer.
  1070.  readw    space  4,10 
  1071. ***       readw - read data to working buffer.
  1072. *         call readw (file,buf,n,status)
  1073. *         entry  (file) = first word of the fet 
  1074. *                (buf) = first word of the working buffer 
  1075. *                (n) = word count of the working buffer 
  1076. *         exit   (status) = 0, transfer complete
  1077. *                         = -1, end-of-file detected on file
  1078. *                         = -2, end-of-information detected on file 
  1079. *                         = lwa, end-of-record detected on file before
  1080. *                                transfer was complete
  1081. *                     lwa = address + 1 of last word transferred to 
  1082. *                           working buffer
  1083.   
  1084.   
  1085.  readw    subr
  1086.           sb1    1
  1087.           sa3    a1+b1       fwa of working buffer
  1088.           sa4    a3+b1       address of word count
  1089.           sa5    a4+b1       (x5) = address of status word
  1090.           sa4    x4          word count 
  1091.           readw  x1,x3,x4 
  1092.           bx6    x1 
  1093.           sa6    x5 
  1094.           eq     readw
  1095.   
  1096.           end 
  1097.           ident  writew 
  1098.           entry  writew 
  1099.           sst 
  1100.           b1=1
  1101.           title  writew - write data from working buffer. 
  1102.           comment   write data from working buffer. 
  1103.  writew   space  4,10 
  1104. ***       writew - write data from working buffer.
  1105. *         call writew (file,buf,n)
  1106. *         entry  (file) = first word of the fet 
  1107. *                (buf) = first word of the working buffer 
  1108. *                (n) = word count of the working buffer 
  1109.   
  1110.   
  1111.  writew   subr
  1112.           sb1    1
  1113.           sa3    a1+b1       fwa of working buffer
  1114.           sa4    a3+b1       address of word count
  1115.           sa4    x4          word count 
  1116.           writew x1,x3,x4 
  1117.           eq     writew 
  1118.   
  1119.           end 
  1120.           ident  mtr
  1121.           entry  mtr
  1122.           sst 
  1123.           b1=1
  1124.  mtr      title  mtr - issue monitor calls from ftn.
  1125.           comment      issue monitor calls from ftn.
  1126.  mtr      space  4,10 
  1127. *****     mtr - issue monitor calls from ftn. 
  1128. *         b. l. trumbo.     78-aug-31 
  1129. *         mtr allows monitor calls to be issued from an ftn program,
  1130. *         either as a 60-bit request, or in the same format as
  1131. *         the *system* macro. 
  1132.  mtr      space  4,10 
  1133. ***       mtr - issue monitor calls from ftn. 
  1134. *         call mtr (ppcall) 
  1135. *         call mtr (ppname,recall)
  1136. *         call mtr (ppname,recall,arg)
  1137. *         call mtr (ppname,recall,arg1,arg2)
  1138. *         entry  *ppcall* is a 60-bit (integer) quantity, and is
  1139. *                  issued as a monitor call without modification. 
  1140. *                *ppname* is the name of the pp routine to be called, 
  1141. *                  left justified.  only the upper 18 bits are used.
  1142. *                *recall* is either zero or non-zero.  if it is zero, 
  1143. *                  no recall bit is inserted. 
  1144. *                *arg* is an argument to be passed to the pp routine
  1145. *                  called.  the lower 36 bits are passed as the lower 
  1146. *                  36 bits of the ra+1 call.
  1147. *                *arg1* is an argument to be passed to the pp routine 
  1148. *                  called.  the lower 18 bits are passed as the lower 
  1149. *                  18 bits of the ra+1 call.
  1150. *                *arg2* is an argument to be passed to the pp routine 
  1151. *                  called.  the lower 18 bits are passed as bits 18 
  1152. *                  thru 35 of the ra+1 call.
  1153. *         exit   all input arguments preserved, monitor call issued.
  1154. *                if recall bit was set in call, ra+1 will be clear. 
  1155. *         uses   a1,a2,a3,a4,   a6
  1156. *                b1 
  1157. *                x1,x2,x3,x4,   x6,x7 
  1158. *         calls  sys=.
  1159.  mtr      space  4,10 
  1160.  mtr2     bx4    -x6*x4      strip *arg* to 36 bits, assuming no *arg2* 
  1161.           lx3    40d         position recall bit
  1162.           bx2    x2+x4       combine pp name and arg(s) 
  1163.           bx2    x2+x3       or in recall bit 
  1164.  mtr1     bx6    x2 
  1165.           system             issue the monitor call in x6 
  1166.   
  1167.  mtr      subr   =           entry/exit 
  1168.           sb1    1           11th commandment 
  1169.           sa2    x1          pick up pp name
  1170.           sa1    a1+b1       pick up address of *recall* arg
  1171.           zr     x1,mtr1     if only one arg, issue it as is
  1172.           mx7    18 
  1173.           sa3    x1          pick up *recall* arg 
  1174.           mx4    0           assume zero *arg*
  1175.           cx3    x3          convert *recall* to a bit
  1176.           sa1    a1+b1       pick up address of *arg* 
  1177.           cx3    x3 
  1178.           bx2    x7*x2       strip pp name down to 3 chars
  1179.           cx3    x3 
  1180.           mx6    -36d        mask for use at mtr2 
  1181.           cx3    x3          now have only one recall bit 
  1182.           zr     x1,mtr2     if no *arg* supplied, use zero 
  1183.           sa4    x1          if *arg* supplied, use it
  1184.           sa1    a1+b1       pick up address of *arg2*
  1185.           zr     x1,mtr2     if no *arg2* 
  1186.           sa1    x1 
  1187.           mx7    -18d 
  1188.           bx4    -x7*x4      strip *arg1* down to 18 bits 
  1189.           bx1    -x7*x1      strip *arg2* down to 18 bits 
  1190.           lx1    18d
  1191.           bx4    x4+x1       x4 contains composite arg
  1192.           eq     mtr2 
  1193.   
  1194.           end 
  1195.           ident  endrun 
  1196.           entry    endrun 
  1197.           sst 
  1198.           b1=1
  1199.           list   f
  1200.           title  endrun - end central program.
  1201.           comment   endrun. 
  1202.  endrun   space  4,10 
  1203. ***       endrun - end central program. 
  1204. *         call endrun 
  1205. *         entry  none 
  1206. *         exit   does not exit
  1207.   
  1208.   
  1209.  endrun   subr
  1210.           sb1    1
  1211.           endrun
  1212.   
  1213.           end 
  1214.           ident  recall 
  1215.           entry  recall 
  1216.           sst 
  1217.           b1=1
  1218.           list   f
  1219.           title  recall - place program in recall status. 
  1220.           comment   place program in recall status. 
  1221.  recall   space  4,10 
  1222. ***       recall - place program in recall status.
  1223. *         call recall (status)
  1224. *         entry  (status) = 0, one system periodic recall is issued 
  1225. *                         = other, program is recalled when bit 0 is set
  1226. *         exit   none if (status) =0
  1227. *         else   bit 0 of status is set 
  1228.   
  1229.   
  1230.  recall   subr
  1231.           sb1    1
  1232.           sa2    x1          status word
  1233.           zr,x2  rec1        if single recall 
  1234.           recall x1          else, auto-recall
  1235.           eq     recall 
  1236.   
  1237.  rec1     recall
  1238.           eq     recall 
  1239.   
  1240.           end 
  1241.           ident  rtime
  1242.           entry  rtime
  1243.           sst 
  1244.           b1=1
  1245.           list   f
  1246.           title  rtime - obtain real time clock reading.
  1247.           comment   obtain real time clock reading. 
  1248.  rtime    space  4,10 
  1249. ***       rtime - obtain real time clock reading. 
  1250. *         call rtime (status) 
  1251. *         entry  none 
  1252. *         exit   (status) = response
  1253. *         kronos response - 
  1254. **t       24/ seconds,36/ milliseconds
  1255. *         scope response -
  1256. **t       24/ junk,24/ seconds,12/ qm 
  1257. *         time is system software clock time since deadstart
  1258. *         qm = 1/4096 of a second 
  1259.   
  1260.   
  1261.  rtime    subr
  1262.           sb1    1
  1263.           bx5    x1 
  1264.           rtime  x1 
  1265.           sa1    x5 
  1266.           bx6    x1          return response as function result 
  1267.           eq     rtime
  1268.   
  1269.           end 
  1270.           ident  movech 
  1271.           entry  movech 
  1272.           sst 
  1273.           syscom b1 
  1274.  movech   title  movech - mvc> interface for ftn. 
  1275.           comment (ftn) move character strings. 
  1276.  movech   space  4,10 
  1277. *****     movech - mvc> interface for ftn.
  1278. *         r. o. anderson.     02/17/76. 
  1279. *         ftn interface to the character move subroutine. 
  1280.  movech   space  4,10 
  1281. ***       movech - move character strings.
  1282. *         movech source,offsets,destination,offsetd,nchars
  1283. *         moves *nchars* from *source* to *destination*.
  1284. *         entry  *source* = the address of the first word of the
  1285. *                           source string.
  1286. *                *offsets* = the character offset (0 - 131071) into 
  1287. *                            *source*.
  1288. *                *destination* = the address of the first word of 
  1289. *                                the destination area.
  1290. *                *offsetd* = the character offset (0 - 131071) into 
  1291. *                            *destination*. 
  1292. *                *nchars* = the number of characters to move. 
  1293. *                (b1) = 1.
  1294. *         exit   the string has been moved. 
  1295. *         uses   x - 1, 2, 3, 4, 5, 6, 7. 
  1296. *                b - 2, 3, 4, 5.
  1297. *                a - 1, 2, 3, 4, 5, 6, 7. 
  1298. *         calls  mvc>.
  1299.   
  1300.   
  1301.           purgmac movech
  1302.  movech   macro  source,offsets,dest,offsetd,nchars 
  1303.           r=     a1,source
  1304.           r=     b2,offsets 
  1305.           r=     a2,dest
  1306.           r=     b3,offsetd 
  1307.           r=     b4,nchars
  1308.           rj     =xmvc> 
  1309.           endm
  1310.  movech   space  4,10 
  1311. ***       movech provides an ftn callable interface to the university 
  1312. *         or arizona character string move subroutine.
  1313. *         call movech(src,bcps,dest,bcpd,nchr)
  1314. *         entry  *src*  is the variable or array containing the first 
  1315. *                       character of the source string. 
  1316. *                *bcps* is the beginning character position for the 
  1317. *                       string starting in *src* (0 - 131071).
  1318. *                *dest* is the variable or array containing the first 
  1319. *                       character of the destination string.
  1320. *                *bcpd* is the beginning character position for the 
  1321. *                       string starting in *dest* (0 - 131071). 
  1322. *                *nchr* is the number of characters to move.
  1323. *         exit   movech will return after moveing *src* to *dest*.
  1324. *         calls  mvc>.
  1325.   
  1326.   
  1327.  movech   subr               entry/exit 
  1328.           sb1    1           and b1 shall be 1
  1329.           bx2    x1 
  1330.           mx0    -6          also used below
  1331.           ax2    24 
  1332.           bx2    -x0*x2 
  1333.           sb2    x2          get character variable offset or zero
  1334.           sa2    a1+b1
  1335.           sa1    x1          (a1) = address of source string
  1336.           sa3    a2+b1
  1337.           sa2    x2 
  1338.           sb2    b2+x2       (b2) = bcp of source string
  1339.           sa2    x3          (a2) = address of destination string 
  1340.           ax3    24 
  1341.           bx3    -x0*x3 
  1342.           sb3    x3          get character variable offset or zero
  1343.           sa3    a3+b1
  1344.           sa4    x3 
  1345.           sb3    b3+x4       (b3) = bcp of destination string 
  1346.           sa3    a3+b1
  1347.           sa4    x3 
  1348.           sb4    x4          (b4) = number of characters to move
  1349.           movech a1,b2,a2,b3,b4  move the strings 
  1350.           eq     movech      return 
  1351.   
  1352.           end 
  1353.           ident    xcon 
  1354.           entry    xcon 
  1355.           sst 
  1356.           syscom   b1 
  1357. xcon      title    xcon - connect/disconnect terminal files.
  1358. xcon      space    4,10 
  1359. **        xcon - connect a file to a terminal.
  1360. *         call xcon(fet,code) 
  1361. *         entry    (fet) = fet address
  1362. *                  (code) = <0, disconnect (return) file
  1363. *                            0, dpc connect 
  1364. *                            1, 128 character ascii connect 
  1365. *                            2, 256 character ascii connect 
  1366. *         exit     file connected to the terminal 
  1367. xcon      subr     =
  1368.           sb1      1
  1369.           sx2      x1              (x2) = fet address 
  1370.           sa1      a1+b1
  1371.           sa1      x1 
  1372.           bx3      x1              (x3) = function code 
  1373.           ng       x3,xcon2        if only disconnect 
  1374.           status   x2              check if local 
  1375.           mx0      11 
  1376.           lx0      1
  1377.           sa4      x2              get fet+0
  1378.           bx4      -x0*x4 
  1379.           zr       x4,xcon3        if not local 
  1380. xcon1     open     x2,nr,r         check device type
  1381.           sa4      x2              clear all but fn+complete
  1382.           mx0      43 
  1383.           lx0      1
  1384.           bx6      x0*x4
  1385.           sa6      x2 
  1386.           sa4      x2+b1           check for ct device
  1387.           ax4      48 
  1388.           sx4      x4-2rtt         nos
  1389. *         sx4      x4-2rct-774000b nos/be 
  1390.           zr       x4,=xxcon       if already ct device, return 
  1391. xcon2     evict    x2,r            return local copy
  1392.           ng       x3,=xxcon       if only disconnect, return 
  1393. xcon3     sa1      x2              set filename for assign
  1394.           mx0      48 
  1395.           bx6      x0*x1
  1396.           sa6      xconb
  1397.           sx3      b1             set complete
  1398.           bx6      x6+x3
  1399.           sa6      x2 
  1400.           sx4      x2              save fet address 
  1401. *         system   pcc,ar,xcona    create the ct file 
  1402.           sx2      x4 
  1403. xcon4     sa1      x2              get fet+0
  1404.           mx0      43              keep fn+complete 
  1405.           lx0      1
  1406.           bx1      x0*x1
  1407.           mx7      1               ascii bit mask 
  1408.           lx7      43 
  1409.           nz       x3,xcon5        if not dpc char set
  1410.           bx6      x1              store fet+0
  1411.           sa6      x2 
  1412.           sa1      x2+b1           clear ascii bit
  1413.           bx6      -x7*x1 
  1414.           sa6      a1 
  1415.           eq       =xxcon 
  1416. xcon5     sa4      x2+b1           set ascii bit in fet+1 
  1417.           bx6      x4+x7
  1418.           sb3      x3 
  1419.           sb3      b3-b1
  1420.           nz       b3,xcon6        if 256 char ascii
  1421.           sa6      a4 
  1422.           bx6      x1              set fet+0
  1423.           sa6      x2 
  1424.           eq       =xxcon 
  1425. xcon6     sb3      b3-b1
  1426.           nz       b3,=xxcon       if invalid mode
  1427.           sa6      a4 
  1428.           bx6      x1+x3           set odd bit for 256 char ascii 
  1429.           sa6      x2              set fet+0
  1430.           eq       =xxcon 
  1431.   
  1432. xcona     data     h*.assign,ct,* 
  1433. xconb     data     0
  1434.           end 
  1435.           ident  xscs 
  1436.           entry  xscs 
  1437.           sst 
  1438.           b1=1
  1439.  xscs     title  xscs - scs interface for ftn.
  1440.           comment (ftn) sense character set.
  1441.  xscs     space  4,10 
  1442. *****     xscs - scs interface for ftn. 
  1443. *         s. h. jay          83/02/04.
  1444. *         ftn interface to the sense character set routine. 
  1445.  xscs     space  4,10 
  1446. ***       xscs provides an ftn callable link to the university
  1447. *         of arizona sense character set subroutine.
  1448. *         n = xscs(fet) 
  1449. *         entry  *fet* is array containing an fet.  a read should 
  1450. *                be done on this fet before calling xscs. 
  1451. *         exit   *n* = 1 for display code,
  1452. *                      0 if buffer empty, 
  1453. *                      -1 if ascii. 
  1454. *         calls  scs> 
  1455.   
  1456.   
  1457.  xscs     subr               entry/exit 
  1458.           sb1    1
  1459.           sx2    x1          (x2) = fet address 
  1460.           rj     =xscs> 
  1461.           eq     xscs        return 
  1462.   
  1463.           end 
  1464.           ident  xsxt 
  1465.           entry  xsxt 
  1466.           syscom b1 
  1467.  xsxt     title  xsxt - sxt> interface for ftn. 
  1468.           comment (ftn) convert sixbit to twelvebit.
  1469.  xsxt     space  4,10 
  1470. *****     xsxt - sxt> interface for ftn.
  1471. *         r. o. anderson.     02/17/76. 
  1472. *         l. n. shipp.       80/05/09.  fix mcs parameter typo. 
  1473. *         ftn interface to the sixbit to twelvebit character conversion 
  1474. *         routine.
  1475.  mcs      space  4,10 
  1476. ***       mcs - map character sets into other character sets. 
  1477. *         mcs    in=,inlen=,inbs=,out=,outbs=,table=
  1478. *         converts the characters in *in* via *table* placing them
  1479. *         in *out*. 
  1480. *         entry  *in=* the address of the first word of the input 
  1481. *                      character string.
  1482. *                *inlen=* the length of the input string in words.
  1483. *                *inbs=* the byte size (6 or 12) of the input chars.
  1484. *                *out=* the address of the first word of the output 
  1485. *                       character string buffer. if *outbs* is .le. 
  1486. *                       *inbs*, *out* and *in* may point to the same
  1487. *                       area. 
  1488. *                *outbs=* the byte size (6 or 12) of the output chars.
  1489. *                *table=* the address of the character set mapping
  1490. *                         table.  this table has 1 entry per word,
  1491. *                         right justified with binary zero fill.
  1492. *                (b1) = 1.
  1493. *         exit   the characters have been mapped. 
  1494. *         uses   x - 1, 2, 6, 7.
  1495. *                b - 2, 3, 4, 5.
  1496. *                a - 1, 2, 6. 
  1497. *         calls  sxs>, sxt>, txs>, or txt>. 
  1498.   
  1499.   
  1500.           purgmac mcs 
  1501.  mcs      macroe in,inlen,out,inbs,outbs,table
  1502.           r=     b2,in
  1503.           r=     b3,inlen 
  1504.           r=     b4,out 
  1505.           r=     b5,table 
  1506.           ifeq   inbs,6,2 
  1507.  ^%s"mcs1 micro  1,, s
  1508.           skip   4
  1509.           ifeq   inbs,12d,2 
  1510.  ^%s"mcs1 micro  1,, t
  1511.           skip   1
  1512.           err    input byte size must be 6 or 12. 
  1513.           ifeq   outbs,6,2
  1514.  ^%s"mcs2 micro  1,, s
  1515.           skip   4
  1516.           ifeq   outbs,12d,2
  1517.  ^%s"mcs2 micro  1,, t
  1518.           skip   1
  1519.           err    output byte size must be 6 or 12.
  1520.           rj     =x'^%s"mcs1'x'^%s"mcs2'> 
  1521.           endm
  1522.  xsxt     space  4,10 
  1523. ***       xsxt provides an ftn callable link to the university of 
  1524. *         arizona sixbit to twelvebit character conversion routine. 
  1525. *         call xsxt(in,len,out,tbl) 
  1526. *         entry  *in*   is a variable or array containing the 
  1527. *                       characters to be converted (10 per word). 
  1528. *                *len*  is the word length of the array *in*. 
  1529. *                *out*  is the variable or array to receive the 
  1530. *                       converted characters (5 per word).
  1531. *                *tbl*  is an array containing the conversion table.
  1532. *                       this table contains 1 character per word, 
  1533. *                       right justified, with binary zero fill. 
  1534. *         exit   xsxt will return after doing the conversion. 
  1535. *         calls  sxt>.
  1536.   
  1537.   
  1538.  xsxt     subr               entry/exit 
  1539.           sb1    1           and b1 shall be 1
  1540.           sb2    x1          (b2) = input area address
  1541.           sa1    a1+b1
  1542.           sa2    x1 
  1543.           sb3    x2          (b3) = word length of input
  1544.           sa1    a1+b1
  1545.           sb4    x1          (b4) = output area address 
  1546.           sa1    a1+b1
  1547.           sb5    x1          (b5) = conversion table address
  1548.           mcs    in=b2,inlen=b3,out=b4,table=b5,inbs=6,outbs=12 
  1549.           eq     xsxt        return 
  1550.   
  1551.           end 
  1552.           ident  xtxs 
  1553.           entry  xtxs 
  1554.           syscom b1 
  1555.  xtxs     title  xtxs - txs> interface for ftn. 
  1556.           comment (ftn) convert twelvebit to sixbit.
  1557.  xtxs     space  4,10 
  1558. *****     xtxs - txs> interface for ftn.
  1559. *         r. o. anderson.     02/17/76. 
  1560. *         l. n. shipp.       80/05/09.  fix mcs parameter typo. 
  1561. *         ftn interface to the twelvebit to sixbit character conversion 
  1562. *         routine.
  1563.  mcs      space  4,10 
  1564. ***       mcs - map character sets into other character sets. 
  1565. *         mcs    in=,inlen=,inbs=,out=,outbs=,table=
  1566. *         converts the characters in *in* via *table* placing them
  1567. *         in *out*. 
  1568. *         entry  *in=* the address of the first word of the input 
  1569. *                      character string.
  1570. *                *inlen=* the length of the input string in words.
  1571. *                *inbs=* the byte size (6 or 12) of the input chars.
  1572. *                *out=* the address of the first word of the output 
  1573. *                       character string buffer. if *outbs* is .le. 
  1574. *                       *inbs*, *out* and *in* may point to the same
  1575. *                       area. 
  1576. *                *outbs=* the byte size (6 or 12) of the output chars.
  1577. *                *table=* the address of the character set mapping
  1578. *                         table.  this table has 1 entry per word,
  1579. *                         right justified with binary zero fill.
  1580. *                (b1) = 1.
  1581. *         exit   the characters have been mapped. 
  1582. *         uses   x - 1, 2, 6, 7.
  1583. *                b - 2, 3, 4, 5.
  1584. *                a - 1, 2, 6. 
  1585. *         calls  sxs>, sxt>, txs>, or txt>. 
  1586.   
  1587.   
  1588.           purgmac mcs 
  1589.  mcs      macroe in,inlen,out,inbs,outbs,table
  1590.           r=     b2,in
  1591.           r=     b3,inlen 
  1592.           r=     b4,out 
  1593.           r=     b5,table 
  1594.           ifeq   inbs,6,2 
  1595.  ^%s"mcs1 micro  1,, s
  1596.           skip   4
  1597.           ifeq   inbs,12d,2 
  1598.  ^%s"mcs1 micro  1,, t
  1599.           skip   1
  1600.           err    input byte size must be 6 or 12. 
  1601.           ifeq   outbs,6,2
  1602.  ^%s"mcs2 micro  1,, s
  1603.           skip   4
  1604.           ifeq   outbs,12d,2
  1605.  ^%s"mcs2 micro  1,, t
  1606.           skip   1
  1607.           err    output byte size must be 6 or 12.
  1608.           rj     =x'^%s"mcs1'x'^%s"mcs2'> 
  1609.           endm
  1610.  xtxs     space  4,10 
  1611. ***       xtxs provides an ftn callable link to the university of 
  1612. *         arizona twelvebit to sixbit character conversion routine. 
  1613. *         call xtxs(in,len,out,tbl) 
  1614. *         entry  *in*   is a variable or array containing the 
  1615. *                       characters to be converted (5 per word).
  1616. *                *len*  is the word length of the array *in*. 
  1617. *                *out*  is the variable or array to receive the 
  1618. *                       converted characters (10 per word). 
  1619. *                *tbl*  is an array containing the conversion table.
  1620. *                       this table contains 1 character per word, 
  1621. *                       right justified, with binary zero fill. 
  1622. *         exit   xtxs will return after doing the conversion. 
  1623. *         calls  txs>.
  1624.   
  1625.   
  1626.  xtxs     subr               entry/exit 
  1627.           sb1    1           and b1 shall be 1
  1628.           sb2    x1          (b2) = input area address
  1629.           sa1    a1+b1
  1630.           sa2    x1 
  1631.           sb3    x2          (b3) = word length of input
  1632.           sa1    a1+b1
  1633.           sb4    x1          (b4) = output area address 
  1634.           sa1    a1+b1
  1635.           sb5    x1          (b5) = conversion table address
  1636.           mcs    in=b2,inlen=b3,out=b4,table=b5,inbs=12,outbs=6 
  1637.           eq     xtxs        return 
  1638.   
  1639.           end 
  1640.           ident  xvfn 
  1641.           entry  xvfn 
  1642.           sst 
  1643.           syscom b1 
  1644.           title  xvfn - validate file name. 
  1645.           comment (ftn) validate file name. 
  1646.  xvfn     space  4,10 
  1647. ***       xvfn - validate file name.
  1648. *         ans = xvfn (lfn)
  1649. *         entry  *lfn* = logical file name.  trailing spaces will be
  1650. *                        deleted before name is validated.
  1651. *         exit *ans* = 0 if file name is valid. 
  1652.   
  1653.   
  1654.  xvfn     subr               entry/exit 
  1655.           sb1    1
  1656.           sb6    xvfna
  1657.           sb7    b1 
  1658.           rj     =xmfs>      word align the lfn 
  1659.           sa1    xvfna
  1660.           rj     =xbtz>      convert blanks to 00b
  1661.           bx1    x6 
  1662.           rj     =xvfn>      check out the name 
  1663.           bx6    x1          set function value 
  1664.           eq     xvfnx       return 
  1665.   
  1666.  xvfna    bss    1
  1667.   
  1668.           end 
  1669.           ident  retfile
  1670.           sst 
  1671.           entry  retfile,unlfile
  1672.           syscom b1 
  1673.  retfile  title  retfile - return/unload a file.
  1674.           comment return/unload a file. 
  1675.           space  4,10 
  1676. ***       retfile - return/unload a file. 
  1677. *         call retfile(lfn) 
  1678. *         call unlfile(lfn) 
  1679. *         entry  lfn = a hollerith string or a character string 
  1680. *                      containing the name of the file to be returned 
  1681. *                      (retfile) or unloaded (unlfile).  spaces are 
  1682. *                      removed from lfn before processing.
  1683. *         exit   file is gone.
  1684.  retfile  space  4,10 
  1685. **        retfile - close/return a file.
  1686.   
  1687.   
  1688.  retfile  subr               entry/exit 
  1689.           sb1    1           b1=1 
  1690.           rj     sff         set file name in fet 
  1691.           close  retfilea,unload,rcl
  1692.           eq     retfilex    return 
  1693.  unlfile  space  4,10 
  1694. **        unlfile - close/unload a file.
  1695.   
  1696.   
  1697.  unlfile  subr               entry/exit 
  1698.           sb1    1           b1=1 
  1699.           rj     sff         set file name in fet 
  1700.           close  retfilea,unload,rcl
  1701.           eq     unlfilex    return 
  1702.  sff      space  4,10 
  1703. **        sff - set file name in fet. 
  1704. *         entry  (x1) = ftn parameter pointer for lfn.
  1705. *         exit   (retfilea) contains lfn + complete bit.
  1706. *         uses   x - 1, 2, 6, 7.
  1707. *                b - 2, 3, 4, 5, 6, 7.
  1708. *                a - 2, 6.
  1709. *         calls  btz>, macwal=. 
  1710.   
  1711.   
  1712.  sff      subr               entry/exit 
  1713.           rj     =xmacwal=   get the file name
  1714.           bx1    x2 
  1715.           rj     =xbtz>      delete any spaces
  1716.           sa1    retfilea 
  1717.           sx1    b1 
  1718.           bx6    x6+x1       add complete bit 
  1719.           sa6    retfilea    stash in fet 
  1720.           eq     sffx        return 
  1721.   
  1722.  retfilea vfd    42/**,18/1 
  1723.           con    100b        first
  1724.           con    100b        in 
  1725.           con    100b        out
  1726.           con    101b        limit
  1727.   
  1728.           end 
  1729.