RTA INSTRUCTION SET DEFINITION ============================== 1. NUMERIC INSTRUCTIONS ----------------------- MOVE: mov b a Move instruction. Move value a to b. -------------------------------------------------------------------------------- CLR: clr a Clear instruction. Set a to 0. -------------------------------------------------------------------------------- INC: inc a Increment instruction. Set a to a+1. -------------------------------------------------------------------------------- DEC: dec a Decrement instruction. Set a to a-1 -------------------------------------------------------------------------------- ADD: add a b Add b to a -------------------------------------------------------------------------------- SUB: sub a b Sub b from a -------------------------------------------------------------------------------- MUL: mul a b Multiplicate a with b. -------------------------------------------------------------------------------- DIV: div a b Divide a by b. -------------------------------------------------------------------------------- POWER: power a b Set a to the b-th power of a -------------------------------------------------------------------------------- ROOT: root a b Give a the b-th root of a. Remark: in case of square root a must be 2, not empty. -------------------------------------------------------------------------------- EXP*: exp a ; base e (2.71...) exp10 a ; base 10 exp2 a ; base 2 expx a b ; arbitrary base b Set a on a-th power of e, 10, 2 or arbitrary value b. -------------------------------------------------------------------------------- LOG*: log a ; base e (2.71...) log10 a ; base 10 log2 a ; base 2 logx a b ; arbitrary base b Logarithm (base e, 10, 2 or b) of a. -------------------------------------------------------------------------------- SIN GROUP: sin a cos a tan a cot a sec a csc a Sine, cosine, tangent, cotangent, secant (1/cosine), cosecant (1/sine) of a -------------------------------------------------------------------------------- ASIN GROUP: asin a b ; *) cos acos a b ; *) sin atan a b ; *) cos acot a b ; *) sin asec a b ; *) csc acsc a b ; *) sec Inverse sine, sosine, tangent, cotangent, secant (1/cosine), cosecant (1/sine) of a. Remark: The RTA arcus functions use the sign of an auxillary function b *) to cover a full (-pi...+pi) range. Without b (b=0) common mathematical range. -------------------------------------------------------------------------------- SINH GROUP: sinh a cosh a tanh a coth a sech a csch a Sine hyperbolicus, cosine hyperbolicus, tangent hyperbolicus, cotangent hyperbolicus, secant hyperbolicus, cosecant hyperbolicus of a -------------------------------------------------------------------------------- ASINH GROUP: asinh a acosh a atanh a acoth a asech a acsch a Area sinus hyperbilicus, area cosine hyperbolicus, area tangent hyperbolicus etc. of a. -------------------------------------------------------------------------------- BIN: bin a Binarysation of a: If a=0 then set a to 0, else set a to 1. -------------------------------------------------------------------------------- NOT: not a If a=0 then set a to 1, else set a to 0. -------------------------------------------------------------------------------- AND: and a b If a<>0 and b<>0 then set a to 1, otherwise set a to 0. -------------------------------------------------------------------------------- OR: or a b If a<>0 or b<>0 then set a to 1, otherwise set a to 0. -------------------------------------------------------------------------------- ABS: abs a Absolute value of a. Gives a a positive sign. If a<0 set a to -a, otherwise set a to a. -------------------------------------------------------------------------------- NEG: neg a Negation. Change the sign of a. Set a to -a. -------------------------------------------------------------------------------- SGN: sgn a Sign. Produces +1 in case of positive a, -1 in case of negative a, 0 in case of a=0. -------------------------------------------------------------------------------- ROUND: round a Rounds a to next integer. -------------------------------------------------------------------------------- CEIL: ceil a Rounds a to higher value direction. -------------------------------------------------------------------------------- FLOOR: floor a Rounds a to lower value direction. -------------------------------------------------------------------------------- FIX: fix a Integer of a. Rounds a to zero direction. -------------------------------------------------------------------------------- FRAC: frac a Fraction of a (without sign). ---------------------------------------------------------------------- Overview -- neg/abs/sgn/round/ceil/floor/fix/frac table: ---------------------------------------------------------------------- a neg a abs a sgn a round a ceil a floor a fix a frac a ---------------------------------------------------------------------- 3.44 -3.44 +3.44 +1 3 3 4 3 0.44 3.66 -3.66 +3.46 +1 4 3 4 3 0.66 0.00 0.00 0.00 0 0 0 0 0 0.00 -3.44 +3.44 +3.44 -1 -3 -3 -4 -3 0.44 -3.66 +3.66 +3.66 -1 -4 -3 -4 -3 0.66 ---------------------------------------------------------------------- -------------------------------------------------------------------------------- CLIP: clip a b c Clip a into b ... c range. Set a to b if ac otherwsie to a. -------------------------------------------------------------------------------- CMOD: cmod a b c Clip and modulo: Clip a into b ... c range by sawtooth. Algorithm: a=b+a\(c-b) where \ is modulo function (division remainder). Remark: Gives in case of b=0 the (rational) division remainder. -------------------------------------------------------------------------------- RANDOM: random a Set a to a random value 0 ... 1. -------------------------------------------------------------------------------- 2. BRANCH INSTRUCTIONS ---------------------- COMPARE INSTRUCTIONS: cmpgt a b l cmpge a b l cmplt a b l cmple a b l cmpeq a b l cmpne a b l Compare q and b and jump. If a is > b (greather than, gt) >= b (greather than or equal, ge) < b (less than, lt) <= b (less than or equal, le) = b (equal, eq) <> b (not equal, ne) then jump to label l -------------------------------------------------------------------------------- TEST INSTRUCTIONS: tstgt a l tstge a l tstlt a l tstle a l tsteq a l tstne a l Test a and jump. If if a is > 0 (greather than, gt) >= 0 (greather than or equal, ge) < 0 (less than, lt) <= 0 (less than or equal, le) = 0 (equal, eq) <> 0 (not equal, ne) then jump to label l. A test is a compare with b=0. -------------------------------------------------------------------------------- JUMP: jump l (Unconditioned) jump to label l. -------------------------------------------------------------------------------- 3. IO INSTRUCTIONS ------------------ There are 3 simple "virtual devices", the "DIALOG", the "PRINTER" and the "FILE". D I A L O G I/O INPUT: input a s Input of a value a by user dialog with dialog text s. Program break, continuation by user. -------------------------------------------------------------------------------- OUTPUT: output a s Output of a value a by user dialog with dialog text s. Program break, continuation by user. -------------------------------------------------------------------------------- PAUSE: pause s Only program break and output of message text s. Continuation by user. -------------------------------------------------------------------------------- PROOF: proof a s Output of a value a by user dialog with dialog text s. No program break. -------------------------------------------------------------------------------- INFO: info s Output of a message text s. No program break. -------------------------------------------------------------------------------- P R I N T E R I/O CLS: cls Clear screen. Clear the internal output text area. -------------------------------------------------------------------------------- PRINTN: printn a b c Print number. Formatted output of an value a on the output text area, b decimal digits before, c behind decimal point. If b=0: variable number of digits before decimal point If c=0: then integer conversion without decimal point In case of b>0 and c>0 string length is b+c+2 (b, c, sign and dec point) In case of b>0 and c=0 string length is b+c+1 (b, c and sign) Positive sign is space, negative sign is minus. In case of b>0 but to less (overflow case) string is a star string with a leading space: " *****". Range of b and c: 0 ... 100. If <0 then 0, if >100 then 100. -------------------------------------------------------------------------------- PRINTS: prints a b c Print string. Formatted output of a string s on the output text area -------------------------------------------------------------------------------- F I L E I/O READ: read a b Read a single value from file "a.dat" to a. Also possible to read an array, where b is its length reduced by 1. b value 0 moves 1 single value, b>0 an array. Every value is a text line in the file. -------------------------------------------------------------------------------- WRITE: write a b Write a single value a to file "a.dat". Also possible to write an array, where b is its length reduced by 1. b value 0 moves 1 single value, b>0 an array. Every line of the file is readen and converted into a value in the symbol table. -------------------------------------------------------------------------------- SAVE: save s Saves the output text array into a text file "s.txt". -------------------------------------------------------------------------------- 4. POINTER INSTRUCTIONS ----------------------- ADROF: adrof p a Give p the address of a. p becomes a pointer of a. -------------------------------------------------------------------------------- GET: get a p q Indirect move to a. Add p (pointer) and q (offset). Read the value from address p+q to a. -------------------------------------------------------------------------------- PUT: put p q a Indirect move from a. Add p (pointer) and q (offset). Write a to address p+q. -------------------------------------------------------------------------------- 5. CONTROL INSTRUCTIONS ----------------------- INIT: init Machine Initialisation. First instruction of a programm. Automatically generated by assembler. -------------------------------------------------------------------------------- NOP: nop No operation. -------------------------------------------------------------------------------- MODE: mode a Set the machine mode to value 0 1 or 2. 0='run without stop', 1='stop on error', 2='stepwise'. -------------------------------------------------------------------------------- HALT: halt Hard processor break. -------------------------------------------------------------------------------- ERR: err a l Error handler. Set a on last instruction error code. 0 means no error. In error case jump ("errjump") to label l. -------------------------------------------------------------------------------- EXIT: exit Program exit. -------------------------------------------------------------------------------- 6. PSEUDO INSTRUCTIONS ---------------------- Pseudo instruction doesn't run "on machine" at the runtime. They are "running" "in the assembler" at assembler or translator time. _CONFIG: _config a Configuration with a configuration paramater a. Reserved. Remark: a must be a number. -------------------------------------------------------------------------------- _NAME: _name s Gives the program the name s. Recommended as first program instruction. -------------------------------------------------------------------------------- _VAR: _var a Declaration of variable a. Generates a variable a in the symbol table. -------------------------------------------------------------------------------- _DIM: _dim a b -------------------------------------------------------------------------------- Declatation of array a, length b. Generates b+2 variables with the names a, a(0), a(1), a(2) ... a(b). Sets the a(0) address on "array pointer" a. Remark: b must be a number. -------------------------------------------------------------------------------- _LAB: _lab l or (alternatively form): l: Definition of label l. Labels ar needed as jump targets. -------------------------------------------------------------------------------- _END: _end Programs end. Last program line. -------------------------------------------------------------------------------- APPENDIX errcode a DEPRECIATED! Sets a on last instruction error code. 0 means no error. Note: Also gives the correct error code of an error causing instruction in case of an immediate following errjump instruction (so called "Was error mechanism"): If needed both handle an error in errjump-errcode-order. Better and now recomended: err instruction. errjump l DEPRECIATED! On error (during last instruction) jump to label l. Note: No jump after an error causing instruction and intermediate errcode instruction ("error lost case"): Don’t handle an error in errcode-errjump-order. Now recommended: err instruction.