home *** CD-ROM | disk | FTP | other *** search
- Documentation for @.COM
- ~~~~~~~~~~~~~~~~~~~~~~~
-
- @.COM is an online expression evaluator for CP/M`s
- CCP. I never had a calculator handy when I needed one most
- ,so threw together this program and saved it on each of my
- working disks.
-
- It acts as a calculator in the same manner as the
- calculator or immediate mode of BASIC. The expression may be
- included in the command line or input from the program
- itself.
-
- The expression evaluator package originally came in raw
- form from October 1978 Dr. Dobb`s Journal - page 34 by Mike
- Gabrielson. It now requires CP/M to run (developed under CP/M
- 2.2 on a DISCUS 2D/B).
-
- This is useful for machine language programming with
- its HEX arithmatic and Boolean operators. The answers are
- both in deciaml and hex.
-
- This demonstates evaluating an expression from command
- level. After completion, the program returns control to CPM.
-
- Ex- A>@ #F-5
-
- 10(D) 000A(H) --->> program outputs this answer
-
- A>
-
- But if we just enter `@` at command level, the
- evaluator will be brought up and expressions will be input
- through a built in mini-editor.
-
- Unlike entering the expression at command level , this
- alternative allows you to remain in the evalutor to do many
- calcultions.
-
- To return to CP/M, type '^C' or just hit 'RETURN'.
-
- Ex- A>@
-
- (`?` for info.) --->> 1+2+3+4
-
- 10(D) 0000A(H)
-
- (`?` for info.) --->> -- note it doesnt return
- to CPM.
-
- A short command summary is provided in the program if
- you press `?` as the first character of the expression line.
- This will not work from the command level.
-
- Ex- (`?` for info,) ?
- ---- instructions printed ----
-
- Operators:
- =-=-=-=-=
-
- ( - precedence bracket (for expression nesting)
- & dyadic and
- * dyadic multiply
- + dyadic add or monadic plus
- - dyadic subtract or monadic negate (two`s complement)
- / dyadic divide
- // dyadic remainder
- < dyadic less than
- > dyadic greater than
- <= dyadic less then or equal
- == dyadic equal
- >= dyadic greater than or equal
- << dyadic or monadic rotate left
- >> dyadic or monadic rotate right
- | dyadic inclusive OR
- || dyadic exclusive OR
- ~ monadic one`s complement
- ~= dyadic not equal
-
- Constants
- =-=-=-=-=
-
- All constants are evaluated as 16 bit unsigned integers
- with overflow ignored. The values may range from 0 to 65535
- decimal or 0 to #FFFF hex and may be one or all of the
- following types:
-
- 1) Decimals - 12635
- 2) Hexadecimal - #F23D
- 3) Strings - 'ABC'
-
- Relational Operators
- =-=-=-=-=-=-=-=-=-=-
-
- The dyadic operators: == ~= <= >= < > are used to form
- expressions that evaluate to either zero or one. If the
- relation is true, the operators produce a result of one. A
- false comparison results in zero:
-
- Expression Evaluated result
-
- Ex- 5 == 5 1
- 3+(2~=6) 4
- (1<=2)<=3 1
- #FFFF<0 0
-
- The operators << and >> can be used as dyadic or
- monadic operators to rotate (not shift) 16 bit operands.
- Rotation implies wraparound of bits. Shifting can be
- accomplished with the multiply and divide operators. When
- used as monadic operators operands are rotated one bit. When
- used as dyadic operators, the first operand specifies the
- number of bits to rotate.
-
- Ex- <<2 4
- >>3 #8001
- >>(<<2) 2
- 3>>#f0 #1E
-
- String Operations
- =-=-=-=-=-=-=-=-=
-
- If a string constant appears in an expression with
- operators, the value of the string is the ASCII code of the
- string`s first character. An exception to this rule occurs
- when two strings appear with a relational operator: then a
- character by character comparision of the two strings is
- performed, using the ASCII code to determine relative order.
- If the two strings are of unequal length, the shorter is
- padded on the right with blanks.
-
- Ex- 'A'+1 #42
- 'ABC'FF #41
- 'CAT'<'dog' 1
- 'PAD'=='PAD ' 1
- '123'==#31 1
-
- Closing
- =-=-=-=
-
- This is a hacked together program and has not been
- thoroughly tested. If you find any bugs please pass them on
- to me via a `BBS` or other channel.
-
- Robert Lansdale