Calculating and Converting

The Calculator and Converter functions of CFS can also be used in connections. All Calculator and Converter input must begin with the character string ^= .

Arithmetic and logical Operations:

The four basic arithmetical functions + - * /, as well as % calculations and the logical operations .AND., .OR., .XOR. are provided. Operands can be entered in hexadecimal or decimal format. The mathematical expression should be entered as follows:

^=value [ op value ] ...

value Decimal or Hexadecimal value.

Values containing only the numbers 0 to 9 will be interpreted as decimal values. If the value contains the characters A to F, they will be treated as hexadecimal. Suffixing a decimal value with H or X (e.g. 10H) will cause it to be interpreted as a hexadecimal value.

op Arithmetic or logical operator. The following operators are available:

+ Addition

- Subtraction

* Multiplication

/ Division

% % calculationg

.+. Addition without regard to the sign (address calculation)

.-. Subtraction without regard to the sign (adress calculation)

.AND. logical AND function

.OR. logical OR-function

.XOR. logical Exclusive-OR

The individual operations are evaluated linearly. Example: ^=10+10*2 gives the result 40, and not 30 as would normally be expected. The same is true for all logical operations.

Examples:

^=16+80H

The value 144 in decimal and 90H in hexadecimal will be displayed in the system line as the addition result.

^=7FFFFD45.+.FFF

The value 80000D44 will be displayed as the result of this logical addition. The arithmetic addition =7FFFFD45+FFF will result in the error message 'result too big ...' , since the maximum positive hexadecimal value of 7FFFFFFF will have been exceeded (Fixed-point overflow).

^=1200%14+1200%85

This expression will be evaluated as follows:

14% of 1200=168, 168+1200=1368, 85% of 1368=1162.

^=7C

The decimal and hexadecimal representation of the given value will be displayed: 7C= 124 (7C)

^=1.OR.2.OR.4.OR.8

The four hexadecimal operands are logically OR-ed with one another The hexadecimal value F is displayed as the result.

^=AFFE.AND.5001H

The two hexadecimal operands are logically AND-ed with each other. The hexadecimal value 0H is displayed as the result.

^=7FFE.XOR.FF0

The two hexadecimal operands are logically XOR-ed with each other. The hexadecimal value 700EH is displayed as the result.

Character and Hexadecimal Conversion:

Strings entered in hexadecimal notation will be converted to character format. Character format strings will converted to hexadecimal format. Strings to be converted should be entered in the following format:

^=X'string' | ^=[C]'string'

Non-printable characters will be displayed as a '?' when converting to character format.

Examples:

^=X'C1C442'

The character equivalent C'AD?' for X'C1C442' will be displayed in the system line Non-printable characters in character format will be displayed as '?' .

^='AFFE'

The hexadecimal equivalent X'C1C6C6C5' for C'AFFE' will be displayed in the system line.