t3x.org / t3x / t3x-manual / 4B.html
 
T3X - A Minimum Procedural Language
Version 8.1.5, Online Edition
Copyright(C) 1996-2004
Nils M Holm
 
Previous:
4.10 Stack Manipulation
TOC | Index | Back Next:
4.12 Predicates

4.11 Arithmetic Instructions

0x001C   ADD   -   ADD numbers

Remove two elements S0 and S1 and push their sum: S1+S0.

0x001E   BAND   -   compute Bitwise AND

Remove two elements S0 and S1, perform a bitwise AND on them and push the result: S1 & S0.

0x0016   BNOT   -   compute Bitwise NOT

Invert each bit of the top element: ~S0.

0x001F   BOR   -   compute Bitwise OR

Remove two elements S0 and S1, perform a bitwise OR on them and push the result: S1 | S0.

0x0021   BSHL   -   compute Bitwise SHift Left

Remove two elements S0 and S1, shift the bits of S1 to the left by S0 positions and push the result: S1 << S0.

0x0022   BSHR   -   compute Bitwise SHift Right

Remove two elements S0 and S1, shift the bits of S1 to the right by S0 positions and push the result: S1 >> S0.

0x0020   BXOR   -   compute Bitwise eXclusive OR

Remove two elements S0 and S1, perform a bitwise XOR on them and push the result: S1 ^ S0.

0x0018   DIV   -   DIVide numbers

Remove two elements S0 and S1, compute the (signed) integer part of their quotient and push it: S1 / S0. If S0=0, signal a fatal error and halt.

0xC02D   INCG   A   N   -   INCrement Global

Add the value N to the memory cell located at the address A. This is exactly the same as

LDG A NUM N ADD SAVG A

but more efficient.

0xC02E   INCI   M   N   -   INCrement Instance variable

Add the value N to the memory cell whose absolute address is SELF + M*BPW. INCI M N is equal to

LDI M NUM N ADD SAVI M

but more efficient.

0xC02F   INCL   M   N   -   INCrement Local

Add the value N to the memory cell whose absolute address is FP - M*BPW. INCL M N is equal to

LDL M NUM N ADD SAVL M

but more efficient.

0x0015   LNOT   -   compute Logical NOT

If the top element is equal to zero, replace it with -1 and otherwise with zero: S0=0-> -1: 0.

0x001B   MOD   -   compute MODulus

Remove two elements S0 and S1, compute their division remainder and push it: S1 MOD S0. S1 MOD S0 is defined as S1 - S1./S0.*S0 where './' denotes an unsigned integer division and '.*' an unsigned multiplication. If S0=0, signal a fatal error and halt.

0x0017   MUL   -   MULtiply numbers

Remove two elements S0 and S1, compute their (signed) product and push it: S1 * S0. Do not perform any overflow checking.

0x0014   NEG   -   NEGate number

Negate the top element: -S0.

0x0000   GLUE   -   instruction GLUE

Rest for a cycle.

0x001D   SUB   -   SUBtract numbers

Remove two elements S0 and S1 and push their difference: S1-S0.

0x001A   UDIV   -   Unsigned DIVide

Remove two elements S0 and S1, compute the unsigned integer part of their quotient and push it: .S1 / .S0. If S0=0, signal a fatal error and halt.

0x0019   UMUL   -   Unsigned MULtiply

Remove two elements S0 and S1, compute their unsigned product and push it: .S1 * .S0. Do not perform any overflow checking.

Previous:
4.10 Stack Manipulation
TOC | Index | Back Next:
4.12 Predicates