home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / sigm / vol173 / abstract.173 < prev    next >
Encoding:
Text File  |  1984-07-15  |  11.8 KB  |  222 lines

  1. [ICUAP7.DOC]
  2. [Harold V. McIntosh, 16 April 1984]
  3.  
  4. The disk ICUAP7 is a continuation of a series of disks bearing the programming
  5. languages REC and CNVRT, together with explanations and examples. As with most
  6. languages, the lack of manuals and descriptive materials is always a severe
  7. impediment to the propagation of the language. We have so far concentrated on
  8. an explanation of CNVRT, which is written in REC. If a convincing case can be
  9. made for the utility of CNVRT, interest in REC must follow because CNVRT is
  10. entirely written in REC.
  11.  
  12. ICUAP7 contains three HELP files, destined to be used with the ZCPR2 program
  13. HELP.COM. They are large, occupying all of the "56K" memory which is left over
  14. after configuring CP/M 2.2 for a 64K Godbout system based on the 8085/8088 CPU
  15. board. These three files should be taken in conjunction with the HELP file on
  16. ICUAP6, giving altogether:
  17.  
  18.         CNVRT.HLP  (ICUAP6) Summary of the language CNVRT
  19.         CNVPRG.HLP (ICUAP7) Survey of CNVRT programming
  20.         8080.HLP   (ICUAP7) Characteristics of Intel 8080
  21.         8080A.HLP  (ICUAP7) Intel 8080 assembler written in CNVRT
  22.  
  23. Whereas CNVRT.HLP analyzes the syntax of CNVRT and gives a general introduction
  24. to the language, it could not cover all its features. CNVPRG.HLP continues the
  25. exposition of CNVRT by showing how to write a series of simple programs which
  26. have some practical utility. ICUAP contains all of these examples in separate
  27. files from which they may be compiled and executed. These programs are:
  28.  
  29.         SAMPLE.CNV    smallest possible CNVRT program
  30.         VOWEL.CNV    console interaction - recognize vowels
  31.         COPY.CNV    copy a file
  32.         SENTEN.CNV    recognize a sentence (?)
  33.         PYP.CNV        useful PIP look-alike
  34.         PAK.CNV        old standby - join many files in one
  35.         UPAK.CNV    and split them apart again
  36.         BORRA.CNV    erase files subject to confirmation
  37.         FIND.CNV    CBBS(R)'s FIND written in CNVRT
  38.         KWIC.CNV    simple but useful KWIC index
  39.         BINCOM.CNV    compare two binary files - using CNVRT
  40.  
  41. The first four are pure textbook exercises, but the remainder are useful to
  42. some degree. PYP offers the option of copying a file plain, in upper case, in
  43. lower case, eliminating Wordstar markings, or dumping in hexadecimal.
  44.  
  45. PAK and UPAK were used already in ICUAP5 as examples - they join and disperse
  46.     many small files.
  47.  
  48. BORRA, to do something different, allows the user to view the first line of
  49.     a file before confirming its erasure.
  50.  
  51. Find is a CNVRT version of the  FYNDE contained in ICUAP1 - it will search a
  52.     family of files listing occurrences of a keyword. KWIC does the same
  53.     thing but displaces the line so as to center the keyword.
  54.  
  55. Finally, BINCOM compares two binary files to see if they are identical, giving
  56.     a report of the number of bytes compared and the number of discrepancies
  57.     found.
  58.  
  59. While the intention of these programs was to serve as examples of CNVRT program
  60. formulation, there is no reason that they cannot be embellished to individual
  61. taste and used as utilities.
  62.  
  63. -
  64.  
  65. The next step is the presentation of a CNVRT program of a certain complexity,
  66. namely an assembler for the Intel 8080. In reality, it comprises the subject
  67. matter of an undergraduate one semester course on assembler construction. It
  68. is rather large and fairly slow, so it would hardly compete with a commercial
  69. program such as Digital Research's ASM.COM. It was worked out in two weeks,
  70. admittedly on the basis of a considerable previous experience with the Intel
  71. 8080 and assemblers of various forms. Nevertheless, given such a background,
  72. the existence of such an assembler written in CNVRT allows an evaluation of
  73. CNVRT's style of expressing programs.
  74.  
  75. There are three programs which need to be considered together, namely:
  76.  
  77.         8080.CNV    Assemble Intel 8080 code
  78.         HEXEH.CNV    Generate an Intel HEX file
  79.         80T86.CNV    Translate ASM code to ASM86 code
  80.  
  81. As described, the first is an assembler. Slow and bulky, its merit lies in its
  82. revealing the assembly process in absolutely explicit detail. Should there be
  83. a desire to add a "LINK" directive, an "INCLUDE" directive, a file bearing the
  84. symbol table, or whatever, there is a clearly visible place in the program at
  85. which to add any of these features.
  86.  
  87. Thye connoisseur of assembly programs will see quite a few shortcomings in
  88. 8080.CNV - for example, formulas as arguments of org's, ds's or equ's are not
  89. foreseen, quoted ASCII strings may not be arguments of lxi's, there is no shr
  90. or shl to jockey two-byte arguments around, and so on. If 8080.CNV were to be
  91. placed in a situation of practical use, the proper extensions to the program
  92. to accomodate such usage would readily become apparent. After all, we want to
  93. leave a student something that can be added to the program.
  94.  
  95. HEXEH.CNV is separate from 8080.CNV for the sake of convenience. The Intel HEX
  96. file has mostly historical significance, and would be maintained to provide
  97. compatibility with the widely prevalent CP/M. It is not the only intermediate
  98. that an assembler could produce; it is a useful exercise not only to produce
  99. and load a more convenient intermediate, but to contemplate what kind of CNVRT
  100. program would be appropriate in each case to map between one style of binary
  101. or hexidecimal file and another - for example between Intel's HEX files and
  102. Motorola's.
  103.  
  104. Some insight into CNVRT's capabilities becomes visible in the final member
  105. of this triad - 80T86.CNV. It was a day's work to rework 8080.CNV so as to
  106. create the mnemonics and minor alterations in assembler directives needed to
  107. generate Intel 8086 code from 8080 source code. The 8086, and particularly the
  108. mnemonics of its operation codes, was deliberately planned to secure a maximum
  109. degree of compatibility between these two processors; it is not such a simple
  110. task to pass over to the Western Digital WD16 or the Motorola 68000.
  111.  
  112. In reality that day's work was finished in the morning, the afternoon having
  113. been consumed by the discovery of ASM86's tastes in colons not following
  114. data declarations, the need to access BDOS through an interrupt, and so on.
  115.  
  116. However, comparison of 80T86.CNV with Sorcim's TRANS86 shows that BOTH are
  117. bulky and slow (compared to what would be possible in machine language), the
  118. latter apparently having been written in Pascal! We doubt that TRANS86 was
  119. written in a single day.
  120.  
  121. CNVRT as a language is gradually showing the effects of feedback from the
  122. programs which it is being used to write. The patronal aspects of the language
  123. have not changed much, but increased skeletal facilities have been foreseen
  124. since we started the adaptation of CONVERT to strings and microcomputers. One
  125. direction of increase consists purely of additions to the runtime library of
  126. skeleton functions written in REC. These comprise arithmetic functions, format
  127. changes and representation of characters and numbers, and similar additions.
  128.  
  129. In another direction, CNVRT is susceptible to the incorporation of phrases such
  130. as IF, DO, FOR, WHILE, and others familiar from other high level languages. The
  131. meaning of some of these was clear when CONVERT was written, and were contained
  132. in the LISP version of the language; others bear some scrutiny in the light of
  133. the experiences with similar constructs in other languages in past years. Some
  134. of them will no doubt be incorporated into CNVRT as a logical need for them
  135. arises.
  136.  
  137. There are four new constructions which ought to be explained - these are LAM,
  138. IF, WHILE, and patterned reads:
  139.  
  140. LAM:  It is possible to transiently introduce one or more variables either in
  141.     patterns or in skeletons, using the form LAM, which is modelled after
  142.     the lambda which permeates LISP. Writing (LAM,(0 1 2),pattern) makes
  143.     the variables 0, 1 and 2 available for use in pattern - for example
  144.     (LAM,(0),<0>x<0>) would match abcxabc, or any string in which the
  145.     sequence preceding an x also followed it immediately; however the
  146.     variable <0> would not be available in any other part of the rule.
  147.  
  148. IF: The skeleton (IF,(0),S,P,ST,SF) means that we are to form the skeleton
  149.     S. Then, using the variables listed within the parenthesis, if P
  150.     matches S, we evaluate the skeleton ST, leaving the result in the
  151.     workspace. If P does not match S, the skeleton SF is used instead.
  152.  
  153.     Variants on this theme include:
  154.         (if,S,P,ST,SF) is the same as (IF,(),S,P,ST,SF)
  155.         (if,S,P,Q) is the same as (IF,(),S,P,Q,<=>)
  156.         (nf,S,P,ST,SF) is the same as (if,S,P,SF,ST)
  157.         (nf,S,P,Q) is the same as (if,S,P,<=>,Q)
  158.  
  159. WHILE: The skeleton (WHILE,(0 1),S,P,Q,R,F), whose equivalent (while,S,P,Q,R,F)
  160.     binds no local variables, means that we are to form the skeleton S, then
  161.     parse it with the pattern P. Then: first the skeleton Q is evaluated and
  162.     left in the workspace. Next, The skeleton R is evaluated and used in
  163.     place of the skeleton S while the whole process is repeated. Whenever
  164.     P does not match, the final skeleton F is evaluated and left in the
  165.     workspace, completing the work of the WHILE.
  166.  
  167. %R is a function from the runtime library, not a defined skeleton. It admits
  168.     several options, which allow a careful tailoring of just what is to
  169.     be placed in the workspace each time a %R is used. In increasing order
  170.     of complexity:
  171.         (%R) reads one line, without CRLF, from the default reader.
  172.         (%R,D:FILE.EXT) reads a line from the specified disk, file.
  173.         (%R,FILE,pattern) reads text matching pattern from FILE.
  174.         (LAM,(0),(%R,FILE,<0>(^MJ),<0>)) = (%R,FILE)
  175.         (%R,FILE,p,skeleton) reads text matching p, delivers s.
  176.         (%R,FILE,p,st,sf) reads text matching p, delivers st if the
  177.             text was read, but sf if such text could not be read.
  178.         There is risk of filling the workspace and jamming the system
  179.         if the pattern in a patterned read cannot be fulfilled. The
  180.         scheme is, "read just text for pattern p;" it is not, "read
  181.         until text matching pattern p comes along."
  182.  
  183. <=>: This symbol might be read "let it be." In LISP based CONVERT, it was the
  184.     symbol *SAME* or =SAME=, which it is not convenient to introduce into
  185.     CNVRT.REC. The reason for the latter is that we would have to save
  186.     the whole workspace somewhere, once for each recursive level, on the
  187.     chance that might be used somewhere else. Thus, the insistence: use it
  188.     it immediately or forget it! <=> is frequently needed in an IF, or in
  189.     a patterned read, where for one alternative, the workspace is to be
  190.     left untouched.
  191.  
  192. As is our custom, ICUAP7 contains the most recent version of CNVRT.REC, whose
  193. attributes may be discerned from its change log. It would be required for the
  194. execution of the programs on this disk.
  195.  
  196. Our experience since beginning to work intensively with CNVRT has been that
  197. 64K of memory is not sufficient for programs at our current level of interest
  198. and experience. It is not easy to go beyond 64K with the Intel 8080 - at least
  199. not without some hardware constructs which most people would not find readily
  200. available. An obvious choice is to pass REC to a processor with more intrinsic
  201. addressing capability - but the Intel 8086 has segments to be contended with;
  202. the Motorola 68000 has entirely different operation codes.
  203.  
  204. As a compromise, Gerardo Cisneros has reworked the code for RECA86 to give
  205. distinct code segments to REC, the compile area, the pushdown list, and the
  206. workspace; if each of the components has its own segment, the code is still
  207. manageable with sixteen bit addressing, and expands REC to a quarter megabyte -
  208. four times as much space as it has at present. In due course, we will circulate
  209. the assembly listing for QMREC. In the meantime, ICUAP7 contains a .CMD file
  210. for the full 256K bytes, together with a H86 file that can be used to tailor
  211. REC to a system that has less memory - 128K bytes for example. This should be
  212. sufficient to execute such programs as FILCOM.REC, 8080.REC, or the forthcoming
  213. unified "C" compiler.
  214.  
  215. In spite of our previous intentions, the extension beyond 64K has forced us
  216. to abandon our decision to support REC on the Intel 8086 through Sorcim's
  217. ACT86. Although Digital Research's ASM86 has many shortcomings from our point
  218. of view, it is the only widely used assembler available to us which will handle
  219. segments and allow us to reach more memory.
  220.  
  221. [end]
  222.