**Symsyn Instructions**

**
**

+ C $S | add character string to end of ansi string

+ C $S N | as above for N characters

+ C.I $S N | add N characters from C at I to end of string

+ C $S.I N | insert string into string at I for N

+ C.I $S.J N | insert N characters from C at I to string at J

+ X | add 1 to X

+ X Y | add X to Y

+ X Y Z | add X to Y store in Z

+ $S $R | add $S to end of $R

+ $S $R.I | insert $S to $R at I

ABS X | make X a positive number

AND X Y | logical and X to Y

AND X Y Z | as above store in Z

BINSTR X $S | convert bits into displayable characters

BITSTR X $S | as above

CALL LABEL | subroutine call with 0 to 5 values

CALLTHRU X | call address in X

CLOSE X | close file

~ X $S | convert binary to decimal string

~ $S X | convert decimal string to binary

DATETIME X | system date and time to binary

DATETIME $S | system date and time to string

DDES KEY DATA | decrypt data (8 bytes) with key (8 bytes) result in data

DDES KEY DATA.I | as above, data indexed

DELAY N | sleep for N milliseconds

/ X Y Z | divide X by Y store in Z

ENDIF | end of the IF clause

EDES KEY DATA | encrypt data (8 bytes) with key (8 bytes) result in data

EDES KEY DATA.I | as above, data indexed

ELSE | code follows that will be run if the previous IF was not true

FILL 'A' C | fill string C with 'A'

FILL 123 X | fill array X with value 123

FIND C $S I | find character C in string store address in I

FIND $S $R I | find string in string store address in I

GETITEM $S $R | remove first item from string $S and place in $R

GETITEM $S X | as above, convert to integer or real and store in X

GOIF | go back to previous IF and retest

GO LABEL | go to label

GOTHRU X | go to address in X

GRAB C | own resource named in string C

HEXSTR X $S | convert to string of hexadecimal digits

IF X BIT 23 | if bit number 23 of X is a 1

IF C EQ D | if character equals character

IF X EQ Y | if integer equals integer

IF $S EQ $R | if string equals string

IF $S.I EQ C | if string item at I equals character C

| EQ equal - may be replaced with other comparison symbols

| NE not equal

| GT greater than

| LT less than

| GE greater than or equal

| LE less than or equal

| = equal

| <> not equal

| > greater than

| < less than

| >= greater than or equal

| <= less than or equal

IFPOSTED C | if event C has been posted

IFPOSTED C $S | if event C has been posted, receive data into $S

IORESULT | value of the last I/O operation

MAKEFILE C X | create an untyped file named by string C. X will be the handle

MAKEFILE $S X | as above with string $S

MAKETEXT C X | create a text file named by string C

MAKETEXT $S X | as above

C D | move character(s) C to D

C D N | move N characters from C to D

C $S | move character(s) C to string $S

C $S N | move N characters from C to $S

C.I $S N | move N characters from C at I to $S

C $S.I N | move N characters from C to $S at I

C.I $S.J N | move N characters from C at I to $S at J

C [] | display string C

C.I D.J N | move N characters from C at I to D at J

X | move 0 to X

X Y | move X to Y

X Y.I | move X to word I in array Y

X $S.I | move 8 bytes from word X to string $S at location I

X #$S | set string length of $S to value in X

X.I Y | move word I in array X to Y

X.I Y.J | move word I in array X to word J in array Y

X:18:4 Y | move the 4 bits of X starting with bit number 18 to Y

Y X:18:4 | move least significant 4 bits of Y to X starting at bit number 18

$S | set length of string $S to 0

$S C | move string $S to C

$S C N | move N characters from $S to C

$S $R | move $S to $R

$S $R N | move N characters from $S to $R

$S X | move 8 bytes from $S to word X

$S.I C N | move N characters from location I in string $S to C

$S.I C.J N | move N characters from location I in $S to J in $R

$S.I X | move 8 bytes from location I in $S to X

$S.I $R N | move N characters from I in $S to $R

[] $S | read from console to string $S

$S [] | display string $S

#$S X | move length of $S to X

LOWERCASE $S | make characters in string lower case

MAX X Y Z | move the larger of X and Y to Z

MIN X Y Z | move the smaller of X and Y to Z

MOD X Y Z | X mod Y store in Z

MSBETWEEN X Y Z | milliseconds between X and Y into Z

* X Y | multiply X times Y, result in Y

* X Y Z | multiply X times Y result in Z

^ X Y Z | raise X to the Y power store in Z

NOT X | logical not of X

OPENFILE C X | open an existing untyped file named by string C. X is the handle

OPENFILE $S X | as above with string $S

OPENTEXT C X | open an exiting text file

OPENTEXT $S X | as above

OR X Y | logical or X with Y result in Y

OR X Y Z | logical or X with Y result in Z

PACKHEX $R $S | compact displayable hex characters to 4 bit nibbles

PACKHEX $S | as above

PARAM | receive 1 to 5 values from CALL

PAUSE | let next prog in the queue run

POPCOUNT X Y Z | number of one bits in X, store in Z. Y is 0..63 - highest bit

POST C | post an event named in C

POST C $S | post an event named in C and associate data in $S

RANDOM I J | generate a random number between 0 and I, store in J

RANDOMIZE | initialize the random number generator

REPLACE C D $S | replace each occurrence of C with character D in string $S

RESTORE | retrieve 1 to 5 values from stack saved by SAVE

RETURN | go back to calling point with 0 to 5 values

RESULT | receive 1 to 5 values from RETURN

SAVE | place 1 to 5 values in the stack for later RESTORE

SHELL C RSLT | send command in C to OS, RSLT = 0 is success

SHELL $S RSLT | send command in $S to OS, RSLT = 0 is success

SHL X N | logical shift left X by N bits

SHR X N | logical shift right X by N bits

SQRT X Y | square root of X to Y (rounded)

SSX C | send command in the string C to SSX runtime

SSX $S | send command in the string $S to SSX runtime

START | an optional LABEL which identifies the first instruction

STARTIMER N | start the timer N milliseconds

STOP | end prog

- X | subtract 1 from X

- X Y | subtract X from Y

- X Y Z | subtract X from Y result in Z

- $S N | delete N characters from $S

- $S.I N | delete N characters from $S at I

TRIMLEFT $S | delete leading spaces

TRIMRIGHT $S | delete trailing spaces

UNGRAB C | release resource named by C

UNPACKHEX $R $S | expand 4 bit nibbles to displayable characters

UNPACKHEX $S | as above

UNPOST C | unpost event named by C

UPCASE $S | make characters in string upper case

VADD X Y Z | add corresponding members of X to Y store in Z

VAVG X Y | average of members of X store in Y

VMUL X Y Z | multiply corresponding members of X to Y store in Z

VSUM X Y | sum members of X store total in Y

WAIT C | wait for event C to be posted

WAIT C $S | wait for event C to be posted, place associated data in $S

WAITIMER | wait for timer to expire

XOR X Y | logical exclusive or X with Y result in Y

XOR X Y Z | logical exclusive or X with Y result in Z

**Math Expressions**

An expression is a combination of Integers or Reals and operators that Symsyn interprets according to rules of precedence to produce another value.

**Integer Expressions**

Integer expressions are enclosed in a pair of ( ). The result of the expression is placed in the following integer variable or string.

` `

` ( x + 3 ) y`

` ( x min y ) z`

` ( x shl 2 ) z`

` ( ( ( x * 3 ) + 5 ) mod 2 ) z`

` `

`( x xor y ) z`

` ( not x ) y`

` ( x^2 + y^2 ) $s`

The Integer operators:

** + | add**

** - | subtract**

** * | multiply**

** / | integer divide**

** mod | modulus**

** ^ | power**

** and | logical and**

** or | logical or**

** xor | logical exclusive or**

** shl | shift left bits**

** shr | shift right bits**

** min | minimum of 2 values**

** max | maximum of 2 values**

** not | logical not**

** abs | absolute value**

** sqrt | integer square root**

** **

**Real (Floating Point) Expressions**

Real expressions are enclosed in a pair of { }. The result of the expression is placed in the following real variable or string.

` { sqrt ( rx^2 + ry^2 ) } rz`

` { 15 % ((rx + ry) * 1.06 ) } rz`

` { degtorad(rlon2 - rlon1) } lon1`

` { cos rlon1 * cos rlat1 - cos rlat2 } rdx`

` { arcsin(sqrt(rdx^2 + rdy^2 + rdz^2)/2) * 12745.6 } rkms`

` { sin ( degtorad ( lat ) ) } $s`

` `

` `

The Real operators:

** + | add**

** - | subtract**

** * | multiply**

** / | divide **

** ^ | power**

** % | percent**

** min | minimum of 2 values**

** max | maximum of 2 values**

** abs | absolute value**

** sqrt | square root**

** ****degtorad | degrees to radians**

** radtodeg | radians to degrees**

** ** **sin | sine**

** cos | cosine**

** tan | tangent**

** arcsin | arc sine**

** arccos | arc cosine**

** arctan** **| arc tangent**

** **

**String Expressions**

String expressions are enclosed in a pair of " ". The result of the expression is placed in the following string variable or exported.

` " 'The GCR distance is : ' $kms ' kilometers.' " []`

` " 'ABC' 'DEF' $string $string2 ' ' realvariable1 ' . ' " $S`

Copyright 2015 - 2020 Symsyn Group