home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / cpm / math / atsign.lbr / ATSIGN.DQC / ATSIGN.DOC
Encoding:
Text File  |  1986-02-01  |  4.6 KB  |  146 lines

  1.                   Documentation for @.COM
  2.                   ~~~~~~~~~~~~~~~~~~~~~~~
  3.  
  4.      @.COM   is  an online expression evaluator  for  CP/M`s 
  5. CCP.  I never had a calculator handy when I needed one  most 
  6. ,so  threw together this program and saved it on each of  my 
  7. working disks.
  8.  
  9.      It  acts  as  a calculator in the same  manner  as  the 
  10. calculator or immediate mode of BASIC. The expression may be 
  11. included  in  the  command line or input  from  the  program 
  12. itself.
  13.  
  14.      The expression evaluator package originally came in raw 
  15. form from October 1978 Dr.  Dobb`s Journal - page 34 by Mike 
  16. Gabrielson. It now requires CP/M to run (developed under CP/M 
  17. 2.2 on a DISCUS 2D/B).
  18.  
  19.      This  is  useful for machine language programming  with 
  20. its  HEX arithmatic and Boolean operators.  The answers  are 
  21. both in deciaml and hex.
  22.  
  23.      This demonstates evaluating an expression from  command 
  24. level. After completion, the program returns control to CPM.
  25.  
  26. Ex-   A>@ #F-5    
  27.  
  28.       10(D)    000A(H) --->> program outputs this answer
  29.  
  30.       A> 
  31.  
  32.      But  if  we  just  enter  `@`  at  command  level,  the 
  33. evaluator  will be brought up and expressions will be  input 
  34. through a built in mini-editor. 
  35.  
  36.      Unlike entering the expression at command level ,  this 
  37. alternative  allows you to remain in the evalutor to do many 
  38. calcultions.
  39.  
  40.      To return to CP/M, type '^C' or just hit 'RETURN'.
  41.  
  42. Ex-   A>@
  43.  
  44.       (`?` for info.) --->> 1+2+3+4
  45.  
  46.       10(D)     0000A(H)
  47.  
  48.       (`?` for info.) --->>         -- note it doesnt return
  49.                                        to CPM.
  50.      
  51.      A  short command summary is provided in the program  if 
  52. you press `?` as the first character of the expression line. 
  53. This will not work from the command level.
  54.  
  55.          Ex-  (`?` for info,) ?
  56.               ---- instructions printed ----
  57.  
  58. Operators:
  59. =-=-=-=-=
  60.  
  61. (    - precedence bracket (for expression nesting)
  62. &    dyadic and
  63. *    dyadic multiply
  64. +    dyadic add or monadic plus
  65. -    dyadic subtract or monadic negate (two`s complement)
  66. /    dyadic divide
  67. //   dyadic remainder
  68. <    dyadic less than
  69. >    dyadic greater than
  70. <=   dyadic less then or equal
  71. ==   dyadic equal
  72. >=   dyadic greater than or equal
  73. <<   dyadic or monadic rotate left
  74. >>   dyadic or monadic rotate right
  75. |    dyadic inclusive OR
  76. ||   dyadic exclusive OR
  77. ~    monadic one`s complement
  78. ~=   dyadic not equal
  79.  
  80. Constants
  81. =-=-=-=-=
  82.  
  83.      All constants are evaluated as 16 bit unsigned integers 
  84. with overflow ignored.  The values may range from 0 to 65535 
  85. decimal  or  0  to #FFFF hex and may be one or  all  of  the 
  86. following types:
  87.  
  88. 1) Decimals    - 12635
  89. 2) Hexadecimal - #F23D
  90. 3) Strings     - 'ABC'
  91.  
  92. Relational Operators
  93. =-=-=-=-=-=-=-=-=-=-
  94.  
  95.      The  dyadic operators: == ~= <= >= < > are used to form 
  96. expressions  that  evaluate to either zero or  one.  If  the 
  97. relation is true,  the operators produce a result of one.  A 
  98. false comparison results in zero:
  99.  
  100.       Expression       Evaluated result
  101.  
  102.  Ex-  5 == 5           1
  103.       3+(2~=6)         4
  104.       (1<=2)<=3        1
  105.       #FFFF<0          0
  106.  
  107.      The  operators  <<  and >> can be  used  as  dyadic  or 
  108. monadic  operators  to rotate (not shift) 16  bit  operands. 
  109. Rotation  implies  wraparound  of  bits.   Shifting  can  be 
  110. accomplished  with the multiply and divide  operators.  When 
  111. used as monadic operators operands are rotated one bit. When 
  112. used  as dyadic operators,  the first operand specifies  the 
  113. number of bits to rotate.
  114.  
  115.  Ex-  <<2              4
  116.       >>3              #8001
  117.       >>(<<2)          2
  118.       3>>#f0           #1E
  119.  
  120. String Operations
  121. =-=-=-=-=-=-=-=-=
  122.  
  123.      If  a  string  constant appears in an  expression  with 
  124. operators,  the value of the string is the ASCII code of the 
  125. string`s first character.  An exception to this rule  occurs 
  126. when  two strings appear with a relational operator: then  a 
  127. character  by  character comparision of the two  strings  is 
  128. performed, using the ASCII code to determine relative order. 
  129. If  the two strings are of unequal length,  the  shorter  is 
  130. padded on the right with blanks.
  131.  
  132.  Ex-   'A'+1            #42
  133.        'ABC'&#FF        #41
  134.        'CAT'<'dog'      1
  135.        'PAD'=='PAD '    1
  136.        '123'==#31       1
  137.  
  138. Closing
  139. =-=-=-=
  140.  
  141.      This  is  a  hacked together program and has  not  been 
  142. thoroughly tested.  If you find any bugs please pass them on 
  143. to me via a `BBS` or other channel.
  144.  
  145.                                    Robert Lansdale
  146.