" % name_to_id(row["name"]) + desc
+
+ table.append("| %s | %s | %s | %s | %s |" % (opcode, fift, stack, desc, gas))
+
+ return "\n".join(table)
+
+templ = open(args.doc_template, "r").read()
+
+templ = gen_links(templ)
+
+doc = re.sub("{{ *Table: *([a-zA-Z0-9_-]+) *}}", lambda m: make_table(m.group(1)), templ)
+with open(args.out_file, "w") as f:
+ print(doc, file=f)
diff --git a/versioned_docs/version-1.0.0/learn/tvm-instructions/instructions.csv b/versioned_docs/version-1.0.0/learn/tvm-instructions/instructions.csv
new file mode 100644
index 0000000000..63f06f94a3
--- /dev/null
+++ b/versioned_docs/version-1.0.0/learn/tvm-instructions/instructions.csv
@@ -0,0 +1,951 @@
+name,alias_of,tlb,doc_category,doc_opcode,doc_fift,doc_stack,doc_gas,doc_description
+NOP,,#00,stack_basic,00,NOP,-,18,Does nothing.
+SWAP,XCHG_0I,#01,stack_basic,01,SWAP,x y - y x,18,Same as `s1 XCHG0`.
+XCHG_0I,,#0 i:(## 4) {1 <= i},stack_basic,0i,s[i] XCHG0,,18,"Interchanges `s0` with `s[i]`, `1 <= i <= 15`."
+XCHG_IJ,,#10 i:(## 4) j:(## 4) {1 <= i} {i + 1 <= j},stack_basic,10ij,s[i] s[j] XCHG,,26,"Interchanges `s[i]` with `s[j]`, `1 <= i < j <= 15`."
+XCHG_0I_LONG,,#11 ii:uint8,stack_basic,11ii,s0 [ii] s() XCHG,,26,"Interchanges `s0` with `s[ii]`, `0 <= ii <= 255`."
+XCHG_1I,,#1 i:(## 4) {2 <= i},stack_basic,1i,s1 s[i] XCHG,,18,"Interchanges `s1` with `s[i]`, `2 <= i <= 15`."
+PUSH,,#2 i:uint4,stack_basic,2i,s[i] PUSH,,18,Pushes a copy of the old `s[i]` into the stack.
+DUP,PUSH,#20,stack_basic,20,DUP,x - x x,18,Same as `s0 PUSH`.
+OVER,PUSH,#21,stack_basic,21,OVER,x y - x y x,18,Same as `s1 PUSH`.
+POP,,#3 i:uint4,stack_basic,3i,s[i] POP,,18,Pops the old `s0` value into the old `s[i]`.
+DROP,POP,#30,stack_basic,30,DROP,x -,18,"Same as `s0 POP`, discards the top-of-stack value."
+NIP,POP,#31,stack_basic,31,NIP,x y - y,18,Same as `s1 POP`.
+XCHG3,,#4 i:uint4 j:uint4 k:uint4,stack_complex,4ijk,s[i] s[j] s[k] XCHG3,,26,Equivalent to `s2 s[i] XCHG` `s1 s[j] XCHG` `s[k] XCHG0`.
+XCHG2,,#50 i:uint4 j:uint4,stack_complex,50ij,s[i] s[j] XCHG2,,26,Equivalent to `s1 s[i] XCHG` `s[j] XCHG0`.
+XCPU,,#51 i:uint4 j:uint4,stack_complex,51ij,s[i] s[j] XCPU,,26,Equivalent to `s[i] XCHG0` `s[j] PUSH`.
+PUXC,,#52 i:uint4 j:uint4,stack_complex,52ij,s[i] s[j-1] PUXC,,26,Equivalent to `s[i] PUSH` `SWAP` `s[j] XCHG0`.
+PUSH2,,#53 i:uint4 j:uint4,stack_complex,53ij,s[i] s[j] PUSH2,,26,Equivalent to `s[i] PUSH` `s[j+1] PUSH`.
+XCHG3_ALT,,#540 i:uint4 j:uint4 k:uint4,stack_complex,540ijk,s[i] s[j] s[k] XCHG3_l,,34,Long form of `XCHG3`.
+XC2PU,,#541 i:uint4 j:uint4 k:uint4,stack_complex,541ijk,s[i] s[j] s[k] XC2PU,,34,Equivalent to `s[i] s[j] XCHG2` `s[k] PUSH`.
+XCPUXC,,#542 i:uint4 j:uint4 k:uint4,stack_complex,542ijk,s[i] s[j] s[k-1] XCPUXC,,34,Equivalent to `s1 s[i] XCHG` `s[j] s[k-1] PUXC`.
+XCPU2,,#543 i:uint4 j:uint4 k:uint4,stack_complex,543ijk,s[i] s[j] s[k] XCPU2,,34,Equivalent to `s[i] XCHG0` `s[j] s[k] PUSH2`.
+PUXC2,,#544 i:uint4 j:uint4 k:uint4,stack_complex,544ijk,s[i] s[j-1] s[k-1] PUXC2,,34,Equivalent to `s[i] PUSH` `s2 XCHG0` `s[j] s[k] XCHG2`.
+PUXCPU,,#545 i:uint4 j:uint4 k:uint4,stack_complex,545ijk,s[i] s[j-1] s[k-1] PUXCPU,,34,Equivalent to `s[i] s[j-1] PUXC` `s[k] PUSH`.
+PU2XC,,#546 i:uint4 j:uint4 k:uint4,stack_complex,546ijk,s[i] s[j-1] s[k-2] PU2XC,,34,Equivalent to `s[i] PUSH` `SWAP` `s[j] s[k-1] PUXC`.
+PUSH3,,#547 i:uint4 j:uint4 k:uint4,stack_complex,547ijk,s[i] s[j] s[k] PUSH3,,34,Equivalent to `s[i] PUSH` `s[j+1] s[k+1] PUSH2`.
+BLKSWAP,,#55 i:uint4 j:uint4,stack_complex,55ij,[i+1] [j+1] BLKSWAP,,26,"Permutes two blocks `s[j+i+1] … s[j+1]` and `s[j] … s0`.
+`0 <= i,j <= 15`
+Equivalent to `[i+1] [j+1] REVERSE` `[j+1] 0 REVERSE` `[i+j+2] 0 REVERSE`."
+ROT2,BLKSWAP,#5513,stack_complex,5513,"ROT2
+2ROT",a b c d e f - c d e f a b,26,Rotates the three topmost pairs of stack entries.
+ROLL,BLKSWAP,#550 i:uint4,stack_complex,550i,[i+1] ROLL,,26,"Rotates the top `i+1` stack entries.
+Equivalent to `1 [i+1] BLKSWAP`."
+ROLLREV,BLKSWAP,#55 i:uint4 zero:(## 4) {zero = 0},stack_complex,55i0,"[i+1] -ROLL
+[i+1] ROLLREV",,26,"Rotates the top `i+1` stack entries in the other direction.
+Equivalent to `[i+1] 1 BLKSWAP`."
+PUSH_LONG,,#56 ii:uint8,stack_complex,56ii,[ii] s() PUSH,,26,"Pushes a copy of the old `s[ii]` into the stack.
+`0 <= ii <= 255`"
+POP_LONG,,#57 ii:uint8,stack_complex,57ii,[ii] s() POP,,26,"Pops the old `s0` value into the old `s[ii]`.
+`0 <= ii <= 255`"
+ROT,,#58,stack_complex,58,ROT,a b c - b c a,18,Equivalent to `1 2 BLKSWAP` or to `s2 s1 XCHG2`.
+ROTREV,,#59,stack_complex,59,"ROTREV
+-ROT",a b c - c a b,18,Equivalent to `2 1 BLKSWAP` or to `s2 s2 XCHG2`.
+SWAP2,,#5A,stack_complex,5A,"SWAP2
+2SWAP",a b c d - c d a b,18,Equivalent to `2 2 BLKSWAP` or to `s3 s2 XCHG2`.
+DROP2,,#5B,stack_complex,5B,"DROP2
+2DROP",a b - ,18,Equivalent to `DROP` `DROP`.
+DUP2,,#5C,stack_complex,5C,"DUP2
+2DUP",a b - a b a b,18,Equivalent to `s1 s0 PUSH2`.
+OVER2,,#5D,stack_complex,5D,"OVER2
+2OVER",a b c d - a b c d a b,18,Equivalent to `s3 s2 PUSH2`.
+REVERSE,,#5E i:uint4 j:uint4,stack_complex,5Eij,[i+2] [j] REVERSE,,26,Reverses the order of `s[j+i+1] … s[j]`.
+BLKDROP,,#5F0 i:uint4,stack_complex,5F0i,[i] BLKDROP,,26,Equivalent to `DROP` performed `i` times.
+BLKPUSH,,#5F i:(## 4) j:uint4 {1 <= i},stack_complex,5Fij,[i] [j] BLKPUSH,,26,"Equivalent to `PUSH s(j)` performed `i` times.
+`1 <= i <= 15`, `0 <= j <= 15`."
+PICK,,#60,stack_complex,60,"PICK
+PUSHX",,18,"Pops integer `i` from the stack, then performs `s[i] PUSH`."
+ROLLX,,#61,stack_complex,61,ROLLX,,18,"Pops integer `i` from the stack, then performs `1 [i] BLKSWAP`."
+-ROLLX,,#62,stack_complex,62,"-ROLLX
+ROLLREVX",,18,"Pops integer `i` from the stack, then performs `[i] 1 BLKSWAP`."
+BLKSWX,,#63,stack_complex,63,BLKSWX,,18,"Pops integers `i`,`j` from the stack, then performs `[i] [j] BLKSWAP`."
+REVX,,#64,stack_complex,64,REVX,,18,"Pops integers `i`,`j` from the stack, then performs `[i] [j] REVERSE`."
+DROPX,,#65,stack_complex,65,DROPX,,18,"Pops integer `i` from the stack, then performs `[i] BLKDROP`."
+TUCK,,#66,stack_complex,66,TUCK,a b - b a b,18,Equivalent to `SWAP` `OVER` or to `s1 s1 XCPU`.
+XCHGX,,#67,stack_complex,67,XCHGX,,18,"Pops integer `i` from the stack, then performs `s[i] XCHG`."
+DEPTH,,#68,stack_complex,68,DEPTH,- depth,18,Pushes the current depth of the stack.
+CHKDEPTH,,#69,stack_complex,69,CHKDEPTH,i -,18/58,"Pops integer `i` from the stack, then checks whether there are at least `i` elements, generating a stack underflow exception otherwise."
+ONLYTOPX,,#6A,stack_complex,6A,ONLYTOPX,,18,"Pops integer `i` from the stack, then removes all but the top `i` elements."
+ONLYX,,#6B,stack_complex,6B,ONLYX,,18,"Pops integer `i` from the stack, then leaves only the bottom `i` elements. Approximately equivalent to `DEPTH` `SWAP` `SUB` `DROPX`."
+BLKDROP2,,#6C i:(## 4) j:uint4 {1 <= i},stack_complex,6Cij,[i] [j] BLKDROP2,,26,"Drops `i` stack elements under the top `j` elements.
+`1 <= i <= 15`, `0 <= j <= 15`
+Equivalent to `[i+j] 0 REVERSE` `[i] BLKDROP` `[j] 0 REVERSE`."
+NULL,,#6D,tuple,6D,"NULL
+PUSHNULL", - null,18,Pushes the only value of type _Null_.
+ISNULL,,#6E,tuple,6E,ISNULL,x - ?,18,"Checks whether `x` is a _Null_, and returns `-1` or `0` accordingly."
+TUPLE,,#6F0 n:uint4,tuple,6F0n,[n] TUPLE,x_1 ... x_n - t,26+n,"Creates a new _Tuple_ `t=(x_1, … ,x_n)` containing `n` values `x_1`,..., `x_n`.
+`0 <= n <= 15`"
+NIL,TUPLE,#6F00,tuple,6F00,NIL,- t,26,Pushes the only _Tuple_ `t=()` of length zero.
+SINGLE,TUPLE,#6F01,tuple,6F01,SINGLE,x - t,27,"Creates a singleton `t:=(x)`, i.e., a _Tuple_ of length one."
+PAIR,TUPLE,#6F02,tuple,6F02,"PAIR
+CONS",x y - t,28,"Creates pair `t:=(x,y)`."
+TRIPLE,TUPLE,#6F03,tuple,6F03,TRIPLE,x y z - t,29,"Creates triple `t:=(x,y,z)`."
+INDEX,,#6F1 k:uint4,tuple,6F1k,[k] INDEX,t - x,26,"Returns the `k`-th element of a _Tuple_ `t`.
+`0 <= k <= 15`."
+FIRST,INDEX,#6F10,tuple,6F10,"FIRST
+CAR",t - x,26,Returns the first element of a _Tuple_.
+SECOND,INDEX,#6F11,tuple,6F11,"SECOND
+CDR",t - y,26,Returns the second element of a _Tuple_.
+THIRD,INDEX,#6F12,tuple,6F12,THIRD,t - z,26,Returns the third element of a _Tuple_.
+UNTUPLE,,#6F2 n:uint4,tuple,6F2n,[n] UNTUPLE,t - x_1 ... x_n,26+n,"Unpacks a _Tuple_ `t=(x_1,...,x_n)` of length equal to `0 <= n <= 15`.
+If `t` is not a _Tuple_, or if `|t| != n`, a type check exception is thrown."
+UNSINGLE,UNTUPLE,#6F21,tuple,6F21,UNSINGLE,t - x,27,Unpacks a singleton `t=(x)`.
+UNPAIR,UNTUPLE,#6F22,tuple,6F22,"UNPAIR
+UNCONS",t - x y,28,"Unpacks a pair `t=(x,y)`."
+UNTRIPLE,UNTUPLE,#6F23,tuple,6F23,UNTRIPLE,t - x y z,29,"Unpacks a triple `t=(x,y,z)`."
+UNPACKFIRST,,#6F3 k:uint4,tuple,6F3k,[k] UNPACKFIRST,t - x_1 ... x_k,26+k,"Unpacks first `0 <= k <= 15` elements of a _Tuple_ `t`.
+If `|t|
= |t|`, throws a range check exception."
+SETFIRST,SETINDEX,#6F50,tuple,6F50,SETFIRST,t x - t',26+|t|,Sets the first component of _Tuple_ `t` to `x` and returns the resulting _Tuple_ `t'`.
+SETSECOND,SETINDEX,#6F51,tuple,6F51,SETSECOND,t x - t',26+|t|,Sets the second component of _Tuple_ `t` to `x` and returns the resulting _Tuple_ `t'`.
+SETTHIRD,SETINDEX,#6F52,tuple,6F52,SETTHIRD,t x - t',26+|t|,Sets the third component of _Tuple_ `t` to `x` and returns the resulting _Tuple_ `t'`.
+INDEXQ,,#6F6 k:uint4,tuple,6F6k,[k] INDEXQ,t - x,26,"Returns the `k`-th element of a _Tuple_ `t`, where `0 <= k <= 15`. In other words, returns `x_{k+1}` if `t=(x_1,...,x_n)`. If `k>=n`, or if `t` is _Null_, returns a _Null_ instead of `x`."
+FIRSTQ,INDEXQ,#6F60,tuple,6F60,"FIRSTQ
+CARQ",t - x,26,Returns the first element of a _Tuple_.
+SECONDQ,INDEXQ,#6F61,tuple,6F61,"SECONDQ
+CDRQ",t - y,26,Returns the second element of a _Tuple_.
+THIRDQ,INDEXQ,#6F62,tuple,6F62,THIRDQ,t - z,26,Returns the third element of a _Tuple_.
+SETINDEXQ,,#6F7 k:uint4,tuple,6F7k,[k] SETINDEXQ,t x - t',26+|t’|,"Sets the `k`-th component of _Tuple_ `t` to `x`, where `0 <= k < 16`, and returns the resulting _Tuple_ `t'`.
+If `|t| <= k`, first extends the original _Tuple_ to length `n’=k+1` by setting all new components to _Null_. If the original value of `t` is _Null_, treats it as an empty _Tuple_. If `t` is not _Null_ or _Tuple_, throws an exception. If `x` is _Null_ and either `|t| <= k` or `t` is _Null_, then always returns `t'=t` (and does not consume tuple creation gas)."
+SETFIRSTQ,SETINDEXQ,#6F70,tuple,6F70,SETFIRSTQ,t x - t',26+|t’|,Sets the first component of _Tuple_ `t` to `x` and returns the resulting _Tuple_ `t'`.
+SETSECONDQ,SETINDEXQ,#6F71,tuple,6F71,SETSECONDQ,t x - t',26+|t’|,Sets the second component of _Tuple_ `t` to `x` and returns the resulting _Tuple_ `t'`.
+SETTHIRDQ,SETINDEXQ,#6F72,tuple,6F72,SETTHIRDQ,t x - t',26+|t’|,Sets the third component of _Tuple_ `t` to `x` and returns the resulting _Tuple_ `t'`.
+TUPLEVAR,,#6F80,tuple,6F80,TUPLEVAR,x_1 ... x_n n - t,26+n,"Creates a new _Tuple_ `t` of length `n` similarly to `TUPLE`, but with `0 <= n <= 255` taken from the stack."
+INDEXVAR,,#6F81,tuple,6F81,INDEXVAR,t k - x,26,"Similar to `k INDEX`, but with `0 <= k <= 254` taken from the stack."
+UNTUPLEVAR,,#6F82,tuple,6F82,UNTUPLEVAR,t n - x_1 ... x_n,26+n,"Similar to `n UNTUPLE`, but with `0 <= n <= 255` taken from the stack."
+UNPACKFIRSTVAR,,#6F83,tuple,6F83,UNPACKFIRSTVAR,t n - x_1 ... x_n,26+n,"Similar to `n UNPACKFIRST`, but with `0 <= n <= 255` taken from the stack."
+EXPLODEVAR,,#6F84,tuple,6F84,EXPLODEVAR,t n - x_1 ... x_m m,26+m,"Similar to `n EXPLODE`, but with `0 <= n <= 255` taken from the stack."
+SETINDEXVAR,,#6F85,tuple,6F85,SETINDEXVAR,t x k - t',26+|t’|,"Similar to `k SETINDEX`, but with `0 <= k <= 254` taken from the stack."
+INDEXVARQ,,#6F86,tuple,6F86,INDEXVARQ,t k - x,26,"Similar to `n INDEXQ`, but with `0 <= k <= 254` taken from the stack."
+SETINDEXVARQ,,#6F87,tuple,6F87,SETINDEXVARQ,t x k - t',26+|t’|,"Similar to `k SETINDEXQ`, but with `0 <= k <= 254` taken from the stack."
+TLEN,,#6F88,tuple,6F88,TLEN,t - n,26,Returns the length of a _Tuple_.
+QTLEN,,#6F89,tuple,6F89,QTLEN,t - n or -1,26,"Similar to `TLEN`, but returns `-1` if `t` is not a _Tuple_."
+ISTUPLE,,#6F8A,tuple,6F8A,ISTUPLE,t - ?,26,Returns `-1` or `0` depending on whether `t` is a _Tuple_.
+LAST,,#6F8B,tuple,6F8B,LAST,t - x,26,Returns the last element of a non-empty _Tuple_ `t`.
+TPUSH,,#6F8C,tuple,6F8C,"TPUSH
+COMMA",t x - t',26+|t’|,"Appends a value `x` to a _Tuple_ `t=(x_1,...,x_n)`, but only if the resulting _Tuple_ `t'=(x_1,...,x_n,x)` is of length at most 255. Otherwise throws a type check exception."
+TPOP,,#6F8D,tuple,6F8D,TPOP,t - t' x,26+|t’|,"Detaches the last element `x=x_n` from a non-empty _Tuple_ `t=(x_1,...,x_n)`, and returns both the resulting _Tuple_ `t'=(x_1,...,x_{n-1})` and the original last element `x`."
+NULLSWAPIF,,#6FA0,tuple,6FA0,NULLSWAPIF,x - x or null x,26,"Pushes a _Null_ under the topmost _Integer_ `x`, but only if `x!=0`."
+NULLSWAPIFNOT,,#6FA1,tuple,6FA1,NULLSWAPIFNOT,x - x or null x,26,"Pushes a _Null_ under the topmost _Integer_ `x`, but only if `x=0`. May be used for stack alignment after quiet primitives such as `PLDUXQ`."
+NULLROTRIF,,#6FA2,tuple,6FA2,NULLROTRIF,x y - x y or null x y,26,"Pushes a _Null_ under the second stack entry from the top, but only if the topmost _Integer_ `y` is non-zero."
+NULLROTRIFNOT,,#6FA3,tuple,6FA3,NULLROTRIFNOT,x y - x y or null x y,26,"Pushes a _Null_ under the second stack entry from the top, but only if the topmost _Integer_ `y` is zero. May be used for stack alignment after quiet primitives such as `LDUXQ`."
+NULLSWAPIF2,,#6FA4,tuple,6FA4,NULLSWAPIF2,x - x or null null x,26,"Pushes two nulls under the topmost _Integer_ `x`, but only if `x!=0`.
+Equivalent to `NULLSWAPIF` `NULLSWAPIF`."
+NULLSWAPIFNOT2,,#6FA5,tuple,6FA5,NULLSWAPIFNOT2,x - x or null null x,26,"Pushes two nulls under the topmost _Integer_ `x`, but only if `x=0`.
+Equivalent to `NULLSWAPIFNOT` `NULLSWAPIFNOT`."
+NULLROTRIF2,,#6FA6,tuple,6FA6,NULLROTRIF2,x y - x y or null null x y,26,"Pushes two nulls under the second stack entry from the top, but only if the topmost _Integer_ `y` is non-zero.
+Equivalent to `NULLROTRIF` `NULLROTRIF`."
+NULLROTRIFNOT2,,#6FA7,tuple,6FA7,NULLROTRIFNOT2,x y - x y or null null x y,26,"Pushes two nulls under the second stack entry from the top, but only if the topmost _Integer_ `y` is zero.
+Equivalent to `NULLROTRIFNOT` `NULLROTRIFNOT`."
+INDEX2,,#6FB i:uint2 j:uint2,tuple,6FBij,[i] [j] INDEX2,t - x,26,"Recovers `x=(t_{i+1})_{j+1}` for `0 <= i,j <= 3`.
+Equivalent to `[i] INDEX` `[j] INDEX`."
+CADR,INDEX2,#6FB4,tuple,6FB4,CADR,t - x,26,Recovers `x=(t_2)_1`.
+CDDR,INDEX2,#6FB5,tuple,6FB5,CDDR,t - x,26,Recovers `x=(t_2)_2`.
+INDEX3,,#6FE_ i:uint2 j:uint2 k:uint2,tuple,6FE_ijk,[i] [j] [k] INDEX3,t - x,26,"Recovers `x=t_{i+1}_{j+1}_{k+1}`.
+`0 <= i,j,k <= 3`
+Equivalent to `[i] [j] INDEX2` `[k] INDEX`."
+CADDR,INDEX3,#6FD4,tuple,6FD4,CADDR,t - x,26,Recovers `x=t_2_2_1`.
+CDDDR,INDEX3,#6FD5,tuple,6FD5,CDDDR,t - x,26,Recovers `x=t_2_2_2`.
+PUSHINT_4,,#7 i:uint4,const_int,7i,"[x] PUSHINT
+[x] INT",- x,18,"Pushes integer `x` into the stack. `-5 <= x <= 10`.
+Here `i` equals four lower-order bits of `x` (`i=x mod 16`)."
+ZERO,PUSHINT_4,#70,const_int,70,"ZERO
+FALSE",- 0,18,
+ONE,PUSHINT_4,#71,const_int,71,ONE,- 1,18,
+TWO,PUSHINT_4,#72,const_int,72,TWO,- 2,18,
+TEN,PUSHINT_4,#7A,const_int,7A,TEN,- 10,18,
+TRUE,PUSHINT_4,#7F,const_int,7F,TRUE,- -1,18,
+PUSHINT_8,,#80 xx:int8,const_int,80xx,"[xx] PUSHINT
+[xx] INT",- xx,26,Pushes integer `xx`. `-128 <= xx <= 127`.
+PUSHINT_16,,#81 xxxx:int16,const_int,81xxxx,"[xxxx] PUSHINT
+[xxxx] INT",- xxxx,34,Pushes integer `xxxx`. `-2^15 <= xx < 2^15`.
+PUSHINT_LONG,,#82 l:(## 5) xxx:(int (8 * l + 19)),const_int,82lxxx,"[xxx] PUSHINT
+[xxx] INT",- xxx,23,"Pushes integer `xxx`.
+_Details:_ 5-bit `0 <= l <= 30` determines the length `n=8l+19` of signed big-endian integer `xxx`.
+The total length of this instruction is `l+4` bytes or `n+13=8l+32` bits."
+PUSHPOW2,,#83 xx:uint8,const_int,83xx,[xx+1] PUSHPOW2,- 2^(xx+1),26,"(Quietly) pushes `2^(xx+1)` for `0 <= xx <= 255`.
+`2^256` is a `NaN`."
+PUSHNAN,PUSHPOW2,#83FF,const_int,83FF,PUSHNAN,- NaN,26,Pushes a `NaN`.
+PUSHPOW2DEC,,#84 xx:uint8,const_int,84xx,[xx+1] PUSHPOW2DEC,- 2^(xx+1)-1,26,Pushes `2^(xx+1)-1` for `0 <= xx <= 255`.
+PUSHNEGPOW2,,#85 xx:uint8,const_int,85xx,[xx+1] PUSHNEGPOW2,- -2^(xx+1),26,Pushes `-2^(xx+1)` for `0 <= xx <= 255`.
+PUSHREF,,#88 c:^Cell,const_data,88,[ref] PUSHREF,- c,18,"Pushes the reference `ref` into the stack.
+_Details:_ Pushes the first reference of `cc.code` into the stack as a _Cell_ (and removes this reference from the current continuation)."
+PUSHREFSLICE,,#89 c:^Cell,const_data,89,[ref] PUSHREFSLICE,- s,118/43,"Similar to `PUSHREF`, but converts the cell into a _Slice_."
+PUSHREFCONT,,#8A c:^Cell,const_data,8A,[ref] PUSHREFCONT,- cont,118/43,"Similar to `PUSHREFSLICE`, but makes a simple ordinary _Continuation_ out of the cell."
+PUSHSLICE,,#8B x:(## 4) sss:((8 * x + 4) * Bit),const_data,8Bxsss,"[slice] PUSHSLICE
+[slice] SLICE",- s,22,"Pushes the slice `slice` into the stack.
+_Details:_ Pushes the (prefix) subslice of `cc.code` consisting of its first `8x+4` bits and no references (i.e., essentially a bitstring), where `0 <= x <= 15`.
+A completion tag is assumed, meaning that all trailing zeroes and the last binary one (if present) are removed from this bitstring.
+If the original bitstring consists only of zeroes, an empty slice will be pushed."
+PUSHSLICE_REFS,,#8C r:(## 2) xx:(## 5) c:((r + 1) * ^Cell) ssss:((8 * xx + 1) * Bit),const_data,8Crxxssss,"[slice] PUSHSLICE
+[slice] SLICE",- s,25,"Pushes the slice `slice` into the stack.
+_Details:_ Pushes the (prefix) subslice of `cc.code` consisting of its first `1 <= r+1 <= 4` references and up to first `8xx+1` bits of data, with `0 <= xx <= 31`.
+A completion tag is also assumed."
+PUSHSLICE_LONG,,#8D r:(#<= 4) xx:(## 7) c:(r * ^Cell) ssss:((8 * xx + 6) * Bit),const_data,8Drxxsssss,"[slice] PUSHSLICE
+[slice] SLICE",- s,28,"Pushes the slice `slice` into the stack.
+_Details:_ Pushes the subslice of `cc.code` consisting of `0 <= r <= 4` references and up to `8xx+6` bits of data, with `0 <= xx <= 127`.
+A completion tag is assumed."
+,,,const_data,,"x{} PUSHSLICE
+x{ABCD1234} PUSHSLICE
+b{01101} PUSHSLICE",- s,,"Examples of `PUSHSLICE`.
+`x{}` is an empty slice. `x{...}` is a hexadecimal literal. `b{...}` is a binary literal.
+More on slice literals [here](https://github.com/Piterden/TON-docs/blob/master/Fift.%20A%20Brief%20Introduction.md#user-content-51-slice-literals).
+Note that the assembler can replace `PUSHSLICE` with `PUSHREFSLICE` in certain situations (e.g. if there’s not enough space in the current continuation)."
+,,,const_data,," PUSHREF
+ PUSHREFSLICE",- c/s,,"Examples of `PUSHREF` and `PUSHREFSLICE`.
+More on building cells in fift [here](https://github.com/Piterden/TON-docs/blob/master/Fift.%20A%20Brief%20Introduction.md#user-content-52-builder-primitives)."
+PUSHCONT,,#8F_ r:(## 2) xx:(## 7) c:(r * ^Cell) ssss:((8 * xx) * Bit),const_data,8F_rxxcccc,"[builder] PUSHCONT
+[builder] CONT",- c,26,"Pushes a continuation made from `builder`.
+_Details:_ Pushes the simple ordinary continuation `cccc` made from the first `0 <= r <= 3` references and the first `0 <= xx <= 127` bytes of `cc.code`."
+PUSHCONT_SHORT,,#9 x:(## 4) ssss:((8 * x) * Bit),const_data,9xccc,"[builder] PUSHCONT
+[builder] CONT",- c,18,"Pushes a continuation made from `builder`.
+_Details:_ Pushes an `x`-byte continuation for `0 <= x <= 15`."
+,,,const_data,,"<{ code }> PUSHCONT
+<{ code }> CONT
+CONT:<{ code }>",- c,,"Pushes a continuation with code `code`.
+Note that the assembler can replace `PUSHCONT` with `PUSHREFCONT` in certain situations (e.g. if there’s not enough space in the current continuation)."
+ADD,,#A0,arithm_basic,A0,ADD,x y - x+y,18,
+SUB,,#A1,arithm_basic,A1,SUB,x y - x-y,18,
+SUBR,,#A2,arithm_basic,A2,SUBR,x y - y-x,18,Equivalent to `SWAP` `SUB`.
+NEGATE,,#A3,arithm_basic,A3,NEGATE,x - -x,18,"Equivalent to `-1 MULCONST` or to `ZERO SUBR`.
+Notice that it triggers an integer overflow exception if `x=-2^256`."
+INC,,#A4,arithm_basic,A4,INC,x - x+1,18,Equivalent to `1 ADDCONST`.
+DEC,,#A5,arithm_basic,A5,DEC,x - x-1,18,Equivalent to `-1 ADDCONST`.
+ADDCONST,,#A6 cc:int8,arithm_basic,A6cc,"[cc] ADDCONST
+[cc] ADDINT
+[-cc] SUBCONST
+[-cc] SUBINT",x - x+cc,26,`-128 <= cc <= 127`.
+MULCONST,,#A7 cc:int8,arithm_basic,A7cc,"[cc] MULCONST
+[cc] MULINT",x - x*cc,26,`-128 <= cc <= 127`.
+MUL,,#A8,arithm_basic,A8,MUL,x y - x*y,18,
+DIV_BASE,,#A9 m:uint1 s:uint2 cdft:(Either [ d:uint2 f:uint2 ] [ d:uint2 f:uint2 tt:uint8 ]),arithm_div,A9mscdf,,,26,"This is the general encoding of division, with an optional pre-multiplication and an optional replacement of the division or multiplication by a shift. Variable fields are as follows:
+`0 <= m <= 1` - Indicates whether there is pre-multiplication (`MULDIV` and its variants), possibly replaced by a left shift.
+`0 <= s <= 2` - Indicates whether either the multiplication or the division have been replaced by shifts: `s=0` - no replacement, `s=1` - division replaced by a right shift, `s=2` - multiplication replaced by a left shift (possible only for `m=1`).
+`0 <= c <= 1` - Indicates whether there is a constant one-byte argument `tt` for the shift operator (if `s!=0`). For `s=0`, `c=0`. If `c=1`, then `0 <= tt <= 255`, and the shift is performed by `tt+1` bits. If `s!=0` and `c=0`, then the shift amount is provided to the instruction as a top-of-stack _Integer_ in range `0...256`.
+`1 <= d <= 3` - Indicates which results of division are required: `1` - only the quotient, `2` - only the remainder, `3` - both.
+`0 <= f <= 2` - Rounding mode: `0` - floor, `1` - nearest integer, `2` - ceiling.
+All instructions below are variants of this."
+DIV,DIV_BASE,#A904,arithm_div,A904,DIV,x y - q,26,"`q=floor(x/y)`, `r=x-y*q`"
+DIVR,DIV_BASE,#A905,arithm_div,A905,DIVR,x y - q’,26,"`q’=round(x/y)`, `r’=x-y*q’`"
+DIVC,DIV_BASE,#A906,arithm_div,A906,DIVC,x y - q'',26,"`q’’=ceil(x/y)`, `r’’=x-y*q’’`"
+MOD,DIV_BASE,#A908,arithm_div,A908,MOD,x y - r,26,
+DIVMOD,DIV_BASE,#A90C,arithm_div,A90C,DIVMOD,x y - q r,26,
+DIVMODR,DIV_BASE,#A90D,arithm_div,A90D,DIVMODR,x y - q' r',26,
+DIVMODC,DIV_BASE,#A90E,arithm_div,A90E,DIVMODC,x y - q'' r'',26,
+RSHIFTR_VAR,DIV_BASE,#A925,arithm_div,A925,RSHIFTR,x y - round(x/2^y),26,
+RSHIFTC_VAR,DIV_BASE,#A926,arithm_div,A926,RSHIFTC,x y - ceil(x/2^y),34,
+RSHIFTR,DIV_BASE,#A935 tt:uint8,arithm_div,A935tt,[tt+1] RSHIFTR#,x y - round(x/2^(tt+1)),34,
+RSHIFTC,DIV_BASE,#A936 tt:uint8,arithm_div,A936tt,[tt+1] RSHIFTC#,x y - ceil(x/2^(tt+1)),34,
+MODPOW2,DIV_BASE,#A938 tt:uint8,arithm_div,A938tt,[tt+1] MODPOW2#,x - x mod 2^(tt+1),26,
+MULDIV,DIV_BASE,#A984,arithm_div,A98,MULDIV,x y z - q,26,`q=floor(x*y/z)`
+MULDIVR,DIV_BASE,#A985,arithm_div,A985,MULDIVR,x y z - q',26,`q'=round(x*y/z)`
+MULDIVMOD,DIV_BASE,#A98C,arithm_div,A98C,MULDIVMOD,x y z - q r,26,"`q=floor(x*y/z)`, `r=x*y-z*q`"
+MULRSHIFT_VAR,DIV_BASE,#A9A4,arithm_div,A9A4,MULRSHIFT,x y z - floor(x*y/2^z),26,`0 <= z <= 256`
+MULRSHIFTR_VAR,DIV_BASE,#A9A5,arithm_div,A9A5,MULRSHIFTR,x y z - round(x*y/2^z),26,`0 <= z <= 256`
+MULRSHIFTC_VAR,DIV_BASE,#A9A6,arithm_div,A9A6,MULRSHIFTC,x y z - ceil(x*y/2^z),34,`0 <= z <= 256`
+MULRSHIFT,DIV_BASE,#A9B4 tt:uint8,arithm_div,A9B4tt,[tt+1] MULRSHIFT#,x y - floor(x*y/2^(tt+1)),34,
+MULRSHIFTR,DIV_BASE,#A9B5 tt:uint8,arithm_div,A9B5tt,[tt+1] MULRSHIFTR#,x y - round(x*y/2^(tt+1)),34,
+MULRSHIFTC,DIV_BASE,#A9B6 tt:uint8,arithm_div,A9B6tt,[tt+1] MULRSHIFTC#,x y - ceil(x*y/2^(tt+1)),26,
+LSHIFTDIV_VAR,DIV_BASE,#A9C4,arithm_div,A9C4,LSHIFTDIV,x y z - floor(2^z*x/y),26,`0 <= z <= 256`
+LSHIFTDIVR_VAR,DIV_BASE,#A9C5,arithm_div,A9C5,LSHIFTDIVR,x y z - round(2^z*x/y),26,`0 <= z <= 256`
+LSHIFTDIVC_VAR,DIV_BASE,#A9C6,arithm_div,A9C6,LSHIFTDIVC,x y z - ceil(2^z*x/y),34,`0 <= z <= 256`
+LSHIFTDIV,DIV_BASE,#A9D4 tt:uint8,arithm_div,A9D4tt,[tt+1] LSHIFT#DIV,x y - floor(2^(tt+1)*x/y),34,
+LSHIFTDIVR,DIV_BASE,#A9D5 tt:uint8,arithm_div,A9D5tt,[tt+1] LSHIFT#DIVR,x y - round(2^(tt+1)*x/y),34,
+LSHIFTDIVC,DIV_BASE,#A9D6 tt:uint8,arithm_div,A9D6tt,[tt+1] LSHIFT#DIVC,x y - ceil(2^(tt+1)*x/y),26,
+LSHIFT,,#AA cc:uint8,arithm_logical,AAcc,[cc+1] LSHIFT#,x - x*2^(cc+1),26,`0 <= cc <= 255`
+RSHIFT,,#AB cc:uint8,arithm_logical,ABcc,[cc+1] RSHIFT#,x - floor(x/2^(cc+1)),18,`0 <= cc <= 255`
+LSHIFT_VAR,,#AC,arithm_logical,AC,LSHIFT,x y - x*2^y,18,`0 <= y <= 1023`
+RSHIFT_VAR,,#AD,arithm_logical,AD,RSHIFT,x y - floor(x/2^y),18,`0 <= y <= 1023`
+POW2,,#AE,arithm_logical,AE,POW2,y - 2^y,18,"`0 <= y <= 1023`
+Equivalent to `ONE` `SWAP` `LSHIFT`."
+AND,,#B0,arithm_logical,B0,AND,x y - x&y,18,"Bitwise and of two signed integers `x` and `y`, sign-extended to infinity."
+OR,,#B1,arithm_logical,B1,OR,x y - x|y,18,Bitwise or of two integers.
+XOR,,#B2,arithm_logical,B2,XOR,x y - x xor y,18,Bitwise xor of two integers.
+NOT,,#B3,arithm_logical,B3,NOT,x - ~x,26,Bitwise not of an integer.
+FITS,,#B4 cc:uint8,arithm_logical,B4cc,[cc+1] FITS,x - x,26/76,"Checks whether `x` is a `cc+1`-bit signed integer for `0 <= cc <= 255` (i.e., whether `-2^cc <= x < 2^cc`).
+If not, either triggers an integer overflow exception, or replaces `x` with a `NaN` (quiet version)."
+CHKBOOL,FITS,#B400,arithm_logical,B400,CHKBOOL,x - x,26/76,"Checks whether `x` is a “boolean value'' (i.e., either 0 or -1)."
+UFITS,,#B5 cc:uint8,arithm_logical,B5cc,[cc+1] UFITS,x - x,26/76,"Checks whether `x` is a `cc+1`-bit unsigned integer for `0 <= cc <= 255` (i.e., whether `0 <= x < 2^(cc+1)`)."
+CHKBIT,UFITS,#B500,arithm_logical,B500,CHKBIT,x - x,26/76,"Checks whether `x` is a binary digit (i.e., zero or one)."
+FITSX,,#B600,arithm_logical,B600,FITSX,x c - x,26/76,Checks whether `x` is a `c`-bit signed integer for `0 <= c <= 1023`.
+UFITSX,,#B601,arithm_logical,B601,UFITSX,x c - x,26/76,Checks whether `x` is a `c`-bit unsigned integer for `0 <= c <= 1023`.
+BITSIZE,,#B602,arithm_logical,B602,BITSIZE,x - c,26,Computes smallest `c >= 0` such that `x` fits into a `c`-bit signed integer (`-2^(c-1) <= c < 2^(c-1)`).
+UBITSIZE,,#B603,arithm_logical,B603,UBITSIZE,x - c,26,"Computes smallest `c >= 0` such that `x` fits into a `c`-bit unsigned integer (`0 <= x < 2^c`), or throws a range check exception."
+MIN,,#B608,arithm_logical,B608,MIN,x y - x or y,26,Computes the minimum of two integers `x` and `y`.
+MAX,,#B609,arithm_logical,B609,MAX,x y - x or y,26,Computes the maximum of two integers `x` and `y`.
+MINMAX,,#B60A,arithm_logical,B60A,"MINMAX
+INTSORT2",x y - x y or y x,26,Sorts two integers. Quiet version of this operation returns two `NaN`s if any of the arguments are `NaN`s.
+ABS,,#B60B,arithm_logical,B60B,ABS,x - |x|,26,Computes the absolute value of an integer `x`.
+QADD,,#B7A0,arithm_quiet,B7A0,QADD,x y - x+y,26,
+QSUB,,#B7A1,arithm_quiet,B7A1,QSUB,x y - x-y,26,
+QSUBR,,#B7A2,arithm_quiet,B7A2,QSUBR,x y - y-x,26,
+QNEGATE,,#B7A3,arithm_quiet,B7A3,QNEGATE,x - -x,26,
+QINC,,#B7A4,arithm_quiet,B7A4,QINC,x - x+1,26,
+QDEC,,#B7A5,arithm_quiet,B7A5,QDEC,x - x-1,26,
+QMUL,,#B7A8,arithm_quiet,B7A8,QMUL,x y - x*y,26,
+QDIV,,#B7A904,arithm_quiet,B7A904,QDIV,x y - q,34,Division returns `NaN` if `y=0`.
+QDIVR,,#B7A905,arithm_quiet,B7A905,QDIVR,x y - q’,34,
+QDIVC,,#B7A906,arithm_quiet,B7A906,QDIVC,x y - q'',34,
+QMOD,,#B7A908,arithm_quiet,B7A908,QMOD,x y - r,34,
+QDIVMOD,,#B7A90C,arithm_quiet,B7A90C,QDIVMOD,x y - q r,34,
+QDIVMODR,,#B7A90D,arithm_quiet,B7A90D,QDIVMODR,x y - q' r',34,
+QDIVMODC,,#B7A90E,arithm_quiet,B7A90E,QDIVMODC,x y - q'' r'',34,
+QMULDIVR,,#B7A985,arithm_quiet,B7A985,QMULDIVR,x y z - q',34,
+QMULDIVMOD,,#B7A98C,arithm_quiet,B7A98C,QMULDIVMOD,x y z - q r,34,
+QLSHIFT,,#B7AC,arithm_quiet,B7AC,QLSHIFT,x y - x*2^y,26,
+QRSHIFT,,#B7AD,arithm_quiet,B7AD,QRSHIFT,x y - floor(x/2^y),26,
+QPOW2,,#B7AE,arithm_quiet,B7AE,QPOW2,y - 2^y,26,
+QAND,,#B7B0,arithm_quiet,B7B0,QAND,x y - x&y,26,
+QOR,,#B7B1,arithm_quiet,B7B1,QOR,x y - x|y,26,
+QXOR,,#B7B2,arithm_quiet,B7B2,QXOR,x y - x xor y,26,
+QNOT,,#B7B3,arithm_quiet,B7B3,QNOT,x - ~x,26,
+QFITS,,#B7B4 cc:uint8,arithm_quiet,B7B4cc,[cc+1] QFITS,x - x,34,"Replaces `x` with a `NaN` if x is not a `cc+1`-bit signed integer, leaves it intact otherwise."
+QUFITS,,#B7B5 cc:uint8,arithm_quiet,B7B5cc,[cc+1] QUFITS,x - x,34,"Replaces `x` with a `NaN` if x is not a `cc+1`-bit unsigned integer, leaves it intact otherwise."
+QFITSX,,#B7B600,arithm_quiet,B7B600,QFITSX,x c - x,34,"Replaces `x` with a `NaN` if x is not a c-bit signed integer, leaves it intact otherwise."
+QUFITSX,,#B7B601,arithm_quiet,B7B601,QUFITSX,x c - x,34,"Replaces `x` with a `NaN` if x is not a c-bit unsigned integer, leaves it intact otherwise."
+SGN,,#B8,compare_int,B8,SGN,x - sgn(x),18,"Computes the sign of an integer `x`:
+`-1` if `x<0`, `0` if `x=0`, `1` if `x>0`."
+LESS,,#B9,compare_int,B9,LESS,x y - xy,18,
+NEQ,,#BD,compare_int,BD,NEQ,x y - x!=y,18,Equivalent to `EQUAL` `NOT`.
+GEQ,,#BE,compare_int,BE,GEQ,x y - x>=y,18,Equivalent to `LESS` `NOT`.
+CMP,,#BF,compare_int,BF,CMP,x y - sgn(x-y),18,"Computes the sign of `x-y`:
+`-1` if `xy`.
+No integer overflow can occur here unless `x` or `y` is a `NaN`."
+EQINT,,#C0 yy:int8,compare_int,C0yy,[yy] EQINT,x - x=yy,26,"Returns `-1` if `x=yy`, `0` otherwise.
+`-2^7 <= yy < 2^7`."
+ISZERO,EQINT,#C000,compare_int,C000,ISZERO,x - x=0,26,Checks whether an integer is zero. Corresponds to Forth's `0=`.
+LESSINT,,#C1 yy:int8,compare_int,C1yy,"[yy] LESSINT
+[yy-1] LEQINT",x - xyy,26,"Returns `-1` if `x>yy`, `0` otherwise.
+`-2^7 <= yy < 2^7`."
+ISPOS,GTINT,#C200,compare_int,C200,ISPOS,x - x>0,26,Checks whether an integer is positive. Corresponds to Forth's `0>`.
+ISNNEG,GTINT,#C2FF,compare_int,C2FF,ISNNEG,x - x >=0,26,Checks whether an integer is non-negative.
+NEQINT,,#C3 yy:int8,compare_int,C3yy,[yy] NEQINT,x - x!=yy,26,"Returns `-1` if `x!=yy`, `0` otherwise.
+`-2^7 <= yy < 2^7`."
+ISNAN,,#C4,compare_int,C4,ISNAN,x - x=NaN,18,Checks whether `x` is a `NaN`.
+CHKNAN,,#C5,compare_int,C5,CHKNAN,x - x,18/68,Throws an arithmetic overflow exception if `x` is a `NaN`.
+SEMPTY,,#C700,compare_other,C700,SEMPTY,s - ?,26,"Checks whether a _Slice_ `s` is empty (i.e., contains no bits of data and no cell references)."
+SDEMPTY,,#C701,compare_other,C701,SDEMPTY,s - ?,26,Checks whether _Slice_ `s` has no bits of data.
+SREMPTY,,#C702,compare_other,C702,SREMPTY,s - ?,26,Checks whether _Slice_ `s` has no references.
+SDFIRST,,#C703,compare_other,C703,SDFIRST,s - ?,26,Checks whether the first bit of _Slice_ `s` is a one.
+SDLEXCMP,,#C704,compare_other,C704,SDLEXCMP,s s' - x,26,"Compares the data of `s` lexicographically with the data of `s'`, returning `-1`, 0, or 1 depending on the result."
+SDEQ,,#C705,compare_other,C705,SDEQ,s s' - ?,26,"Checks whether the data parts of `s` and `s'` coincide, equivalent to `SDLEXCMP` `ISZERO`."
+SDPFX,,#C708,compare_other,C708,SDPFX,s s' - ?,26,Checks whether `s` is a prefix of `s'`.
+SDPFXREV,,#C709,compare_other,C709,SDPFXREV,s s' - ?,26,"Checks whether `s'` is a prefix of `s`, equivalent to `SWAP` `SDPFX`."
+SDPPFX,,#C70A,compare_other,C70A,SDPPFX,s s' - ?,26,"Checks whether `s` is a proper prefix of `s'` (i.e., a prefix distinct from `s'`)."
+SDPPFXREV,,#C70B,compare_other,C70B,SDPPFXREV,s s' - ?,26,Checks whether `s'` is a proper prefix of `s`.
+SDSFX,,#C70C,compare_other,C70C,SDSFX,s s' - ?,26,Checks whether `s` is a suffix of `s'`.
+SDSFXREV,,#C70D,compare_other,C70D,SDSFXREV,s s' - ?,26,Checks whether `s'` is a suffix of `s`.
+SDPSFX,,#C70E,compare_other,C70E,SDPSFX,s s' - ?,26,Checks whether `s` is a proper suffix of `s'`.
+SDPSFXREV,,#C70F,compare_other,C70F,SDPSFXREV,s s' - ?,26,Checks whether `s'` is a proper suffix of `s`.
+SDCNTLEAD0,,#C710,compare_other,C710,SDCNTLEAD0,s - n,26,Returns the number of leading zeroes in `s`.
+SDCNTLEAD1,,#C711,compare_other,C711,SDCNTLEAD1,s - n,26,Returns the number of leading ones in `s`.
+SDCNTTRAIL0,,#C712,compare_other,C712,SDCNTTRAIL0,s - n,26,Returns the number of trailing zeroes in `s`.
+SDCNTTRAIL1,,#C713,compare_other,C713,SDCNTTRAIL1,s - n,26,Returns the number of trailing ones in `s`.
+NEWC,,#C8,cell_build,C8,NEWC,- b,18,Creates a new empty _Builder_.
+ENDC,,#C9,cell_build,C9,ENDC,b - c,518,Converts a _Builder_ into an ordinary _Cell_.
+STI,,#CA cc:uint8,cell_build,CAcc,[cc+1] STI,x b - b',26,"Stores a signed `cc+1`-bit integer `x` into _Builder_ `b` for `0 <= cc <= 255`, throws a range check exception if `x` does not fit into `cc+1` bits."
+STU,,#CB cc:uint8,cell_build,CBcc,[cc+1] STU,x b - b',26,Stores an unsigned `cc+1`-bit integer `x` into _Builder_ `b`. In all other respects it is similar to `STI`.
+STREF,,#CC,cell_build,CC,STREF,c b - b',18,Stores a reference to _Cell_ `c` into _Builder_ `b`.
+STBREFR,,#CD,cell_build,CD,"STBREFR
+ENDCST",b b'' - b,518,Equivalent to `ENDC` `SWAP` `STREF`.
+STSLICE,,#CE,cell_build,CE,STSLICE,s b - b',18,Stores _Slice_ `s` into _Builder_ `b`.
+STIX,,#CF00,cell_build,CF00,STIX,x b l - b',26,Stores a signed `l`-bit integer `x` into `b` for `0 <= l <= 257`.
+STUX,,#CF01,cell_build,CF01,STUX,x b l - b',26,Stores an unsigned `l`-bit integer `x` into `b` for `0 <= l <= 256`.
+STIXR,,#CF02,cell_build,CF02,STIXR,b x l - b',26,"Similar to `STIX`, but with arguments in a different order."
+STUXR,,#CF03,cell_build,CF03,STUXR,b x l - b',26,"Similar to `STUX`, but with arguments in a different order."
+STIXQ,,#CF04,cell_build,CF04,STIXQ,x b l - x b f or b' 0,26,"A quiet version of `STIX`. If there is no space in `b`, sets `b'=b` and `f=-1`.
+If `x` does not fit into `l` bits, sets `b'=b` and `f=1`.
+If the operation succeeds, `b'` is the new _Builder_ and `f=0`.
+However, `0 <= l <= 257`, with a range check exception if this is not so."
+STUXQ,,#CF05,cell_build,CF05,STUXQ,x b l - x b f or b' 0,26,A quiet version of `STUX`.
+STIXRQ,,#CF06,cell_build,CF06,STIXRQ,b x l - b x f or b' 0,26,A quiet version of `STIXR`.
+STUXRQ,,#CF07,cell_build,CF07,STUXRQ,b x l - b x f or b' 0,26,A quiet version of `STUXR`.
+STI_ALT,,#CF08 cc:uint8,cell_build,CF08cc,[cc+1] STI_l,x b - b',34,A longer version of `[cc+1] STI`.
+STU_ALT,,#CF09 cc:uint8,cell_build,CF09cc,[cc+1] STU_l,x b - b',34,A longer version of `[cc+1] STU`.
+STIR,,#CF0A cc:uint8,cell_build,CF0Acc,[cc+1] STIR,b x - b',34,Equivalent to `SWAP` `[cc+1] STI`.
+STUR,,#CF0B cc:uint8,cell_build,CF0Bcc,[cc+1] STUR,b x - b',34,Equivalent to `SWAP` `[cc+1] STU`.
+STIQ,,#CF0C cc:uint8,cell_build,CF0Ccc,[cc+1] STIQ,x b - x b f or b' 0,34,A quiet version of `STI`.
+STUQ,,#CF0D cc:uint8,cell_build,CF0Dcc,[cc+1] STUQ,x b - x b f or b' 0,34,A quiet version of `STU`.
+STIRQ,,#CF0E cc:uint8,cell_build,CF0Ecc,[cc+1] STIRQ,b x - b x f or b' 0,34,A quiet version of `STIR`.
+STURQ,,#CF0F cc:uint8,cell_build,CF0Fcc,[cc+1] STURQ,b x - b x f or b' 0,34,A quiet version of `STUR`.
+STREF_ALT,,#CF10,cell_build,CF10,STREF_l,c b - b',26,A longer version of `STREF`.
+STBREF,,#CF11,cell_build,CF11,STBREF,b' b - b'',526,Equivalent to `SWAP` `STBREFR`.
+STSLICE_ALT,,#CF12,cell_build,CF12,STSLICE_l,s b - b',26,A longer version of `STSLICE`.
+STB,,#CF13,cell_build,CF13,STB,b' b - b'',26,Appends all data from _Builder_ `b'` to _Builder_ `b`.
+STREFR,,#CF14,cell_build,CF14,STREFR,b c - b',26,Equivalent to `SWAP` `STREF`.
+STBREFR_ALT,,#CF15,cell_build,CF15,STBREFR_l,b b' - b'',526,A longer encoding of `STBREFR`.
+STSLICER,,#CF16,cell_build,CF16,STSLICER,b s - b',26,Equivalent to `SWAP` `STSLICE`.
+STBR,,#CF17,cell_build,CF17,"STBR
+BCONCAT",b b' - b'',26,"Concatenates two builders.
+Equivalent to `SWAP` `STB`."
+STREFQ,,#CF18,cell_build,CF18,STREFQ,c b - c b -1 or b' 0,26,Quiet version of `STREF`.
+STBREFQ,,#CF19,cell_build,CF19,STBREFQ,b' b - b' b -1 or b'' 0,526,Quiet version of `STBREF`.
+STSLICEQ,,#CF1A,cell_build,CF1A,STSLICEQ,s b - s b -1 or b' 0,26,Quiet version of `STSLICE`.
+STBQ,,#CF1B,cell_build,CF1B,STBQ,b' b - b' b -1 or b'' 0,26,Quiet version of `STB`.
+STREFRQ,,#CF1C,cell_build,CF1C,STREFRQ,b c - b c -1 or b' 0,26,Quiet version of `STREFR`.
+STBREFRQ,,#CF1D,cell_build,CF1D,STBREFRQ,b b' - b b' -1 or b'' 0,526,Quiet version of `STBREFR`.
+STSLICERQ,,#CF1E,cell_build,CF1E,STSLICERQ,b s - b s -1 or b'' 0,26,Quiet version of `STSLICER`.
+STBRQ,,#CF1F,cell_build,CF1F,"STBRQ
+BCONCATQ",b b' - b b' -1 or b'' 0,26,Quiet version of `STBR`.
+STREFCONST,,#CF20 c:^Cell,cell_build,CF20,[ref] STREFCONST,b - b’,26,Equivalent to `PUSHREF` `STREFR`.
+STREF2CONST,,#CF21 c1:^Cell c2:^Cell,cell_build,CF21,[ref] [ref] STREF2CONST,b - b’,26,Equivalent to `STREFCONST` `STREFCONST`.
+ENDXC,,#CF23,cell_build,CF23,,b x - c,526,"If `x!=0`, creates a _special_ or _exotic_ cell from _Builder_ `b`.
+The type of the exotic cell must be stored in the first 8 bits of `b`.
+If `x=0`, it is equivalent to `ENDC`. Otherwise some validity checks on the data and references of `b` are performed before creating the exotic cell."
+STILE4,,#CF28,cell_build,CF28,STILE4,x b - b',26,Stores a little-endian signed 32-bit integer.
+STULE4,,#CF29,cell_build,CF29,STULE4,x b - b',26,Stores a little-endian unsigned 32-bit integer.
+STILE8,,#CF2A,cell_build,CF2A,STILE8,x b - b',26,Stores a little-endian signed 64-bit integer.
+STULE8,,#CF2B,cell_build,CF2B,STULE8,x b - b',26,Stores a little-endian unsigned 64-bit integer.
+BDEPTH,,#CF30,cell_build,CF30,BDEPTH,b - x,26,"Returns the depth of _Builder_ `b`. If no cell references are stored in `b`, then `x=0`; otherwise `x` is one plus the maximum of depths of cells referred to from `b`."
+BBITS,,#CF31,cell_build,CF31,BBITS,b - x,26,Returns the number of data bits already stored in _Builder_ `b`.
+BREFS,,#CF32,cell_build,CF32,BREFS,b - y,26,Returns the number of cell references already stored in `b`.
+BBITREFS,,#CF33,cell_build,CF33,BBITREFS,b - x y,26,Returns the numbers of both data bits and cell references in `b`.
+BREMBITS,,#CF35,cell_build,CF35,BREMBITS,b - x',26,Returns the number of data bits that can still be stored in `b`.
+BREMREFS,,#CF36,cell_build,CF36,BREMREFS,b - y',26,Returns the number of references that can still be stored in `b`.
+BREMBITREFS,,#CF37,cell_build,CF37,BREMBITREFS,b - x' y',26,Returns the numbers of both data bits and references that can still be stored in `b`.
+BCHKBITS,,#CF38 cc:uint8,cell_build,CF38cc,[cc+1] BCHKBITS#,b -,34/84,"Checks whether `cc+1` bits can be stored into `b`, where `0 <= cc <= 255`."
+BCHKBITS_VAR,,#CF39,cell_build,CF39,BCHKBITS,b x - ,26/76,"Checks whether `x` bits can be stored into `b`, `0 <= x <= 1023`. If there is no space for `x` more bits in `b`, or if `x` is not within the range `0...1023`, throws an exception."
+BCHKREFS,,#CF3A,cell_build,CF3A,BCHKREFS,b y - ,26/76,"Checks whether `y` references can be stored into `b`, `0 <= y <= 7`."
+BCHKBITREFS,,#CF3B,cell_build,CF3B,BCHKBITREFS,b x y - ,26/76,"Checks whether `x` bits and `y` references can be stored into `b`, `0 <= x <= 1023`, `0 <= y <= 7`."
+BCHKBITSQ,,#CF3C cc:uint8,cell_build,CF3Ccc,[cc+1] BCHKBITSQ#,b - ?,34,"Checks whether `cc+1` bits can be stored into `b`, where `0 <= cc <= 255`."
+BCHKBITSQ_VAR,,#CF3D,cell_build,CF3D,BCHKBITSQ,b x - ?,26,"Checks whether `x` bits can be stored into `b`, `0 <= x <= 1023`."
+BCHKREFSQ,,#CF3E,cell_build,CF3E,BCHKREFSQ,b y - ?,26,"Checks whether `y` references can be stored into `b`, `0 <= y <= 7`."
+BCHKBITREFSQ,,#CF3F,cell_build,CF3F,BCHKBITREFSQ,b x y - ?,26,"Checks whether `x` bits and `y` references can be stored into `b`, `0 <= x <= 1023`, `0 <= y <= 7`."
+STZEROES,,#CF40,cell_build,CF40,STZEROES,b n - b',26,Stores `n` binary zeroes into _Builder_ `b`.
+STONES,,#CF41,cell_build,CF41,STONES,b n - b',26,Stores `n` binary ones into _Builder_ `b`.
+STSAME,,#CF42,cell_build,CF42,STSAME,b n x - b',26,Stores `n` binary `x`es (`0 <= x <= 1`) into _Builder_ `b`.
+STSLICECONST,,#CFC0_ x:(## 2) y:(## 3) c:(x * ^Cell) sss:((8 * y + 2) * Bit),cell_build,CFC0_xysss,[slice] STSLICECONST,b - b',24,"Stores a constant subslice `sss`.
+_Details:_ `sss` consists of `0 <= x <= 3` references and up to `8y+2` data bits, with `0 <= y <= 7`. Completion bit is assumed.
+Note that the assembler can replace `STSLICECONST` with `PUSHSLICE` `STSLICER` if the slice is too big."
+STZERO,STSLICECONST,#CF81,cell_build,CF81,STZERO,b - b',24,Stores one binary zero.
+STONE,STSLICECONST,#CF83,cell_build,CF83,STONE,b - b',24,Stores one binary one.
+CTOS,,#D0,cell_parse,D0,CTOS,c - s,118/43,"Converts a _Cell_ into a _Slice_. Notice that `c` must be either an ordinary cell, or an exotic cell which is automatically _loaded_ to yield an ordinary cell `c'`, converted into a _Slice_ afterwards."
+ENDS,,#D1,cell_parse,D1,ENDS,s - ,18/68,"Removes a _Slice_ `s` from the stack, and throws an exception if it is not empty."
+LDI,,#D2 cc:uint8,cell_parse,D2cc,[cc+1] LDI,s - x s',26,"Loads (i.e., parses) a signed `cc+1`-bit integer `x` from _Slice_ `s`, and returns the remainder of `s` as `s'`."
+LDU,,#D3 cc:uint8,cell_parse,D3cc,[cc+1] LDU,s - x s',26,Loads an unsigned `cc+1`-bit integer `x` from _Slice_ `s`.
+LDREF,,#D4,cell_parse,D4,LDREF,s - c s',18,Loads a cell reference `c` from `s`.
+LDREFRTOS,,#D5,cell_parse,D5,LDREFRTOS,s - s' s'',118/43,Equivalent to `LDREF` `SWAP` `CTOS`.
+LDSLICE,,#D6 cc:uint8,cell_parse,D6cc,[cc+1] LDSLICE,s - s'' s',26,Cuts the next `cc+1` bits of `s` into a separate _Slice_ `s''`.
+LDIX,,#D700,cell_parse,D700,LDIX,s l - x s',26,"Loads a signed `l`-bit (`0 <= l <= 257`) integer `x` from _Slice_ `s`, and returns the remainder of `s` as `s'`."
+LDUX,,#D701,cell_parse,D701,LDUX,s l - x s',26,"Loads an unsigned `l`-bit integer `x` from (the first `l` bits of) `s`, with `0 <= l <= 256`."
+PLDIX,,#D702,cell_parse,D702,PLDIX,s l - x,26,"Preloads a signed `l`-bit integer from _Slice_ `s`, for `0 <= l <= 257`."
+PLDUX,,#D703,cell_parse,D703,PLDUX,s l - x,26,"Preloads an unsigned `l`-bit integer from `s`, for `0 <= l <= 256`."
+LDIXQ,,#D704,cell_parse,D704,LDIXQ,s l - x s' -1 or s 0,26,"Quiet version of `LDIX`: loads a signed `l`-bit integer from `s` similarly to `LDIX`, but returns a success flag, equal to `-1` on success or to `0` on failure (if `s` does not have `l` bits), instead of throwing a cell underflow exception."
+LDUXQ,,#D705,cell_parse,D705,LDUXQ,s l - x s' -1 or s 0,26,Quiet version of `LDUX`.
+PLDIXQ,,#D706,cell_parse,D706,PLDIXQ,s l - x -1 or 0,26,Quiet version of `PLDIX`.
+PLDUXQ,,#D707,cell_parse,D707,PLDUXQ,s l - x -1 or 0,26,Quiet version of `PLDUX`.
+LDI_ALT,,#D708 cc:uint8,cell_parse,D708cc,[cc+1] LDI_l,s - x s',34,A longer encoding for `LDI`.
+LDU_ALT,,#D709 cc:uint8,cell_parse,D709cc,[cc+1] LDU_l,s - x s',34,A longer encoding for `LDU`.
+PLDI,,#D70A cc:uint8,cell_parse,D70Acc,[cc+1] PLDI,s - x,34,Preloads a signed `cc+1`-bit integer from _Slice_ `s`.
+PLDU,,#D70B cc:uint8,cell_parse,D70Bcc,[cc+1] PLDU,s - x,34,Preloads an unsigned `cc+1`-bit integer from `s`.
+LDIQ,,#D70C cc:uint8,cell_parse,D70Ccc,[cc+1] LDIQ,s - x s' -1 or s 0,34,A quiet version of `LDI`.
+LDUQ,,#D70D cc:uint8,cell_parse,D70Dcc,[cc+1] LDUQ,s - x s' -1 or s 0,34,A quiet version of `LDU`.
+PLDIQ,,#D70E cc:uint8,cell_parse,D70Ecc,[cc+1] PLDIQ,s - x -1 or 0,34,A quiet version of `PLDI`.
+PLDUQ,,#D70F cc:uint8,cell_parse,D70Fcc,[cc+1] PLDUQ,s - x -1 or 0,34,A quiet version of `PLDU`.
+PLDUZ,,#D714_ c:uint3,cell_parse,D714_c,[32(c+1)] PLDUZ,s - s x,26,"Preloads the first `32(c+1)` bits of _Slice_ `s` into an unsigned integer `x`, for `0 <= c <= 7`. If `s` is shorter than necessary, missing bits are assumed to be zero. This operation is intended to be used along with `IFBITJMP` and similar instructions."
+LDSLICEX,,#D718,cell_parse,D718,LDSLICEX,s l - s'' s',26,"Loads the first `0 <= l <= 1023` bits from _Slice_ `s` into a separate _Slice_ `s''`, returning the remainder of `s` as `s'`."
+PLDSLICEX,,#D719,cell_parse,D719,PLDSLICEX,s l - s'',26,Returns the first `0 <= l <= 1023` bits of `s` as `s''`.
+LDSLICEXQ,,#D71A,cell_parse,D71A,LDSLICEXQ,s l - s'' s' -1 or s 0,26,A quiet version of `LDSLICEX`.
+PLDSLICEXQ,,#D71B,cell_parse,D71B,PLDSLICEXQ,s l - s' -1 or 0,26,A quiet version of `LDSLICEXQ`.
+LDSLICE_ALT,,#D71C cc:uint8,cell_parse,D71Ccc,[cc+1] LDSLICE_l,s - s'' s',34,A longer encoding for `LDSLICE`.
+PLDSLICE,,#D71D cc:uint8,cell_parse,D71Dcc,[cc+1] PLDSLICE,s - s'',34,Returns the first `0 < cc+1 <= 256` bits of `s` as `s''`.
+LDSLICEQ,,#D71E cc:uint8,cell_parse,D71Ecc,[cc+1] LDSLICEQ,s - s'' s' -1 or s 0,34,A quiet version of `LDSLICE`.
+PLDSLICEQ,,#D71F cc:uint8,cell_parse,D71Fcc,[cc+1] PLDSLICEQ,s - s'' -1 or 0,34,A quiet version of `PLDSLICE`.
+SDCUTFIRST,,#D720,cell_parse,D720,SDCUTFIRST,s l - s',26,Returns the first `0 <= l <= 1023` bits of `s`. It is equivalent to `PLDSLICEX`.
+SDSKIPFIRST,,#D721,cell_parse,D721,SDSKIPFIRST,s l - s',26,Returns all but the first `0 <= l <= 1023` bits of `s`. It is equivalent to `LDSLICEX` `NIP`.
+SDCUTLAST,,#D722,cell_parse,D722,SDCUTLAST,s l - s',26,Returns the last `0 <= l <= 1023` bits of `s`.
+SDSKIPLAST,,#D723,cell_parse,D723,SDSKIPLAST,s l - s',26,Returns all but the last `0 <= l <= 1023` bits of `s`.
+SDSUBSTR,,#D724,cell_parse,D724,SDSUBSTR,s l l' - s',26,"Returns `0 <= l' <= 1023` bits of `s` starting from offset `0 <= l <= 1023`, thus extracting a bit substring out of the data of `s`."
+SDBEGINSX,,#D726,cell_parse,D726,SDBEGINSX,s s' - s'',26,"Checks whether `s` begins with (the data bits of) `s'`, and removes `s'` from `s` on success. On failure throws a cell deserialization exception. Primitive `SDPFXREV` can be considered a quiet version of `SDBEGINSX`."
+SDBEGINSXQ,,#D727,cell_parse,D727,SDBEGINSXQ,s s' - s'' -1 or s 0,26,A quiet version of `SDBEGINSX`.
+SDBEGINS,,#D72A_ x:(## 7) sss:((8 * x + 3) * Bit),cell_parse,D72A_xsss,[slice] SDBEGINS,s - s'',31,"Checks whether `s` begins with constant bitstring `sss` of length `8x+3` (with continuation bit assumed), where `0 <= x <= 127`, and removes `sss` from `s` on success."
+SDBEGINSQ,,#D72E_ x:(## 7) sss:((8 * x + 3) * Bit),cell_parse,D72E_xsss,[slice] SDBEGINSQ,s - s'' -1 or s 0,31,A quiet version of `SDBEGINS`.
+SCUTFIRST,,#D730,cell_parse,D730,SCUTFIRST,s l r - s',26,Returns the first `0 <= l <= 1023` bits and first `0 <= r <= 4` references of `s`.
+SSKIPFIRST,,#D731,cell_parse,D731,SSKIPFIRST,s l r - s',26,Returns all but the first `l` bits of `s` and `r` references of `s`.
+SCUTLAST,,#D732,cell_parse,D732,SCUTLAST,s l r - s',26,Returns the last `0 <= l <= 1023` data bits and last `0 <= r <= 4` references of `s`.
+SSKIPLAST,,#D733,cell_parse,D733,SSKIPLAST,s l r - s',26,Returns all but the last `l` bits of `s` and `r` references of `s`.
+SUBSLICE,,#D734,cell_parse,D734,SUBSLICE,s l r l' r' - s',26,"Returns `0 <= l' <= 1023` bits and `0 <= r' <= 4` references from _Slice_ `s`, after skipping the first `0 <= l <= 1023` bits and first `0 <= r <= 4` references."
+SPLIT,,#D736,cell_parse,D736,SPLIT,s l r - s' s'',26,"Splits the first `0 <= l <= 1023` data bits and first `0 <= r <= 4` references from `s` into `s'`, returning the remainder of `s` as `s''`."
+SPLITQ,,#D737,cell_parse,D737,SPLITQ,s l r - s' s'' -1 or s 0,26,A quiet version of `SPLIT`.
+XCTOS,,#D739,cell_parse,D739,,c - s ?,,"Transforms an ordinary or exotic cell into a _Slice_, as if it were an ordinary cell. A flag is returned indicating whether `c` is exotic. If that be the case, its type can later be deserialized from the first eight bits of `s`."
+XLOAD,,#D73A,cell_parse,D73A,,c - c',,"Loads an exotic cell `c` and returns an ordinary cell `c'`. If `c` is already ordinary, does nothing. If `c` cannot be loaded, throws an exception."
+XLOADQ,,#D73B,cell_parse,D73B,,c - c' -1 or c 0,,"Loads an exotic cell `c` and returns an ordinary cell `c'`. If `c` is already ordinary, does nothing. If `c` cannot be loaded, returns 0."
+SCHKBITS,,#D741,cell_parse,D741,SCHKBITS,s l - ,26/76,"Checks whether there are at least `l` data bits in _Slice_ `s`. If this is not the case, throws a cell deserialisation (i.e., cell underflow) exception."
+SCHKREFS,,#D742,cell_parse,D742,SCHKREFS,s r - ,26/76,Checks whether there are at least `r` references in _Slice_ `s`.
+SCHKBITREFS,,#D743,cell_parse,D743,SCHKBITREFS,s l r - ,26/76,Checks whether there are at least `l` data bits and `r` references in _Slice_ `s`.
+SCHKBITSQ,,#D745,cell_parse,D745,SCHKBITSQ,s l - ?,26,Checks whether there are at least `l` data bits in _Slice_ `s`.
+SCHKREFSQ,,#D746,cell_parse,D746,SCHKREFSQ,s r - ?,26,Checks whether there are at least `r` references in _Slice_ `s`.
+SCHKBITREFSQ,,#D747,cell_parse,D747,SCHKBITREFSQ,s l r - ?,26,Checks whether there are at least `l` data bits and `r` references in _Slice_ `s`.
+PLDREFVAR,,#D748,cell_parse,D748,PLDREFVAR,s n - c,26,Returns the `n`-th cell reference of _Slice_ `s` for `0 <= n <= 3`.
+SBITS,,#D749,cell_parse,D749,SBITS,s - l,26,Returns the number of data bits in _Slice_ `s`.
+SREFS,,#D74A,cell_parse,D74A,SREFS,s - r,26,Returns the number of references in _Slice_ `s`.
+SBITREFS,,#D74B,cell_parse,D74B,SBITREFS,s - l r,26,Returns both the number of data bits and the number of references in `s`.
+PLDREFIDX,,#D74E_ n:uint2,cell_parse,D74E_n,[n] PLDREFIDX,s - c,26,"Returns the `n`-th cell reference of _Slice_ `s`, where `0 <= n <= 3`."
+PLDREF,PLDREFIDX,#D74C,cell_parse,D74C,PLDREF,s - c,26,Preloads the first cell reference of a _Slice_.
+LDILE4,,#D750,cell_parse,D750,LDILE4,s - x s',26,Loads a little-endian signed 32-bit integer.
+LDULE4,,#D751,cell_parse,D751,LDULE4,s - x s',26,Loads a little-endian unsigned 32-bit integer.
+LDILE8,,#D752,cell_parse,D752,LDILE8,s - x s',26,Loads a little-endian signed 64-bit integer.
+LDULE8,,#D753,cell_parse,D753,LDULE8,s - x s',26,Loads a little-endian unsigned 64-bit integer.
+PLDILE4,,#D754,cell_parse,D754,PLDILE4,s - x,26,Preloads a little-endian signed 32-bit integer.
+PLDULE4,,#D755,cell_parse,D755,PLDULE4,s - x,26,Preloads a little-endian unsigned 32-bit integer.
+PLDILE8,,#D756,cell_parse,D756,PLDILE8,s - x,26,Preloads a little-endian signed 64-bit integer.
+PLDULE8,,#D757,cell_parse,D757,PLDULE8,s - x,26,Preloads a little-endian unsigned 64-bit integer.
+LDILE4Q,,#D758,cell_parse,D758,LDILE4Q,s - x s' -1 or s 0,26,Quietly loads a little-endian signed 32-bit integer.
+LDULE4Q,,#D759,cell_parse,D759,LDULE4Q,s - x s' -1 or s 0,26,Quietly loads a little-endian unsigned 32-bit integer.
+LDILE8Q,,#D75A,cell_parse,D75A,LDILE8Q,s - x s' -1 or s 0,26,Quietly loads a little-endian signed 64-bit integer.
+LDULE8Q,,#D75B,cell_parse,D75B,LDULE8Q,s - x s' -1 or s 0,26,Quietly loads a little-endian unsigned 64-bit integer.
+PLDILE4Q,,#D75C,cell_parse,D75C,PLDILE4Q,s - x -1 or 0,26,Quietly preloads a little-endian signed 32-bit integer.
+PLDULE4Q,,#D75D,cell_parse,D75D,PLDULE4Q,s - x -1 or 0,26,Quietly preloads a little-endian unsigned 32-bit integer.
+PLDILE8Q,,#D75E,cell_parse,D75E,PLDILE8Q,s - x -1 or 0,26,Quietly preloads a little-endian signed 64-bit integer.
+PLDULE8Q,,#D75F,cell_parse,D75F,PLDULE8Q,s - x -1 or 0,26,Quietly preloads a little-endian unsigned 64-bit integer.
+LDZEROES,,#D760,cell_parse,D760,LDZEROES,s - n s',26,"Returns the count `n` of leading zero bits in `s`, and removes these bits from `s`."
+LDONES,,#D761,cell_parse,D761,LDONES,s - n s',26,"Returns the count `n` of leading one bits in `s`, and removes these bits from `s`."
+LDSAME,,#D762,cell_parse,D762,LDSAME,s x - n s',26,"Returns the count `n` of leading bits equal to `0 <= x <= 1` in `s`, and removes these bits from `s`."
+SDEPTH,,#D764,cell_parse,D764,SDEPTH,s - x,26,"Returns the depth of _Slice_ `s`. If `s` has no references, then `x=0`; otherwise `x` is one plus the maximum of depths of cells referred to from `s`."
+CDEPTH,,#D765,cell_parse,D765,CDEPTH,c - x,26,"Returns the depth of _Cell_ `c`. If `c` has no references, then `x=0`; otherwise `x` is one plus the maximum of depths of cells referred to from `c`. If `c` is a _Null_ instead of a _Cell_, returns zero."
+EXECUTE,,#D8,cont_basic,D8,"EXECUTE
+CALLX",c - ,18,"_Calls_, or _executes_, continuation `c`."
+JMPX,,#D9,cont_basic,D9,JMPX,c - ,18,"_Jumps_, or transfers control, to continuation `c`.
+The remainder of the previous current continuation `cc` is discarded."
+CALLXARGS,,#DA p:uint4 r:uint4,cont_basic,DApr,[p] [r] CALLXARGS,c - ,26,"_Calls_ continuation `c` with `p` parameters and expecting `r` return values
+`0 <= p <= 15`, `0 <= r <= 15`"
+CALLXARGS_VAR,,#DB0 p:uint4,cont_basic,DB0p,[p] -1 CALLXARGS,c - ,26,"_Calls_ continuation `c` with `0 <= p <= 15` parameters, expecting an arbitrary number of return values."
+JMPXARGS,,#DB1 p:uint4,cont_basic,DB1p,[p] JMPXARGS,c - ,26,"_Jumps_ to continuation `c`, passing only the top `0 <= p <= 15` values from the current stack to it (the remainder of the current stack is discarded)."
+RETARGS,,#DB2 r:uint4,cont_basic,DB2r,[r] RETARGS,,26,"_Returns_ to `c0`, with `0 <= r <= 15` return values taken from the current stack."
+RET,,#DB30,cont_basic,DB30,"RET
+RETTRUE",,26,"_Returns_ to the continuation at `c0`. The remainder of the current continuation `cc` is discarded.
+Approximately equivalent to `c0 PUSHCTR` `JMPX`."
+RETALT,,#DB31,cont_basic,DB31,"RETALT
+RETFALSE",,26,"_Returns_ to the continuation at `c1`.
+Approximately equivalent to `c1 PUSHCTR` `JMPX`."
+BRANCH,,#DB32,cont_basic,DB32,"BRANCH
+RETBOOL",f - ,26,"Performs `RETTRUE` if integer `f!=0`, or `RETFALSE` if `f=0`."
+CALLCC,,#DB34,cont_basic,DB34,CALLCC,c - ,26,"_Call with current continuation_, transfers control to `c`, pushing the old value of `cc` into `c`'s stack (instead of discarding it or writing it into new `c0`)."
+JMPXDATA,,#DB35,cont_basic,DB35,JMPXDATA,c - ,26,"Similar to `CALLCC`, but the remainder of the current continuation (the old value of `cc`) is converted into a _Slice_ before pushing it into the stack of `c`."
+CALLCCARGS,,#DB36 p:uint4 r:uint4,cont_basic,DB36pr,[p] [r] CALLCCARGS,c - ,34,"Similar to `CALLXARGS`, but pushes the old value of `cc` (along with the top `0 <= p <= 15` values from the original stack) into the stack of newly-invoked continuation `c`, setting `cc.nargs` to `-1 <= r <= 14`."
+CALLXVARARGS,,#DB38,cont_basic,DB38,CALLXVARARGS,c p r - ,26,"Similar to `CALLXARGS`, but takes `-1 <= p,r <= 254` from the stack. The next three operations also take `p` and `r` from the stack, both in the range `-1...254`."
+RETVARARGS,,#DB39,cont_basic,DB39,RETVARARGS,p r - ,26,Similar to `RETARGS`.
+JMPXVARARGS,,#DB3A,cont_basic,DB3A,JMPXVARARGS,c p r - ,26,Similar to `JMPXARGS`.
+CALLCCVARARGS,,#DB3B,cont_basic,DB3B,CALLCCVARARGS,c p r - ,26,Similar to `CALLCCARGS`.
+CALLREF,,#DB3C c:^Cell,cont_basic,DB3C,[ref] CALLREF,,126/51,Equivalent to `PUSHREFCONT` `CALLX`.
+JMPREF,,#DB3D c:^Cell,cont_basic,DB3D,[ref] JMPREF,,126/51,Equivalent to `PUSHREFCONT` `JMPX`.
+JMPREFDATA,,#DB3E c:^Cell,cont_basic,DB3E,[ref] JMPREFDATA,,126/51,Equivalent to `PUSHREFCONT` `JMPXDATA`.
+RETDATA,,#DB3F,cont_basic,DB3F,RETDATA,,26,"Equivalent to `c0 PUSHCTR` `JMPXDATA`. In this way, the remainder of the current continuation is converted into a _Slice_ and returned to the caller."
+IFRET,,#DC,cont_conditional,DC,"IFRET
+IFNOT:",f - ,18,"Performs a `RET`, but only if integer `f` is non-zero. If `f` is a `NaN`, throws an integer overflow exception."
+IFNOTRET,,#DD,cont_conditional,DD,"IFNOTRET
+IF:",f - ,18,"Performs a `RET`, but only if integer `f` is zero."
+IF,,#DE,cont_conditional,DE,IF,f c - ,18,"Performs `EXECUTE` for `c` (i.e., _executes_ `c`), but only if integer `f` is non-zero. Otherwise simply discards both values."
+,,,cont_conditional,DE,"IF:<{ code }>
+<{ code }>IF",f -,,Equivalent to `<{ code }> CONT` `IF`.
+IFNOT,,#DF,cont_conditional,DF,IFNOT,f c - ,18,"Executes continuation `c`, but only if integer `f` is zero. Otherwise simply discards both values."
+,,,cont_conditional,DF,"IFNOT:<{ code }>
+<{ code }>IFNOT",f -,,Equivalent to `<{ code }> CONT` `IFNOT`.
+IFJMP,,#E0,cont_conditional,E0,IFJMP,f c - ,18,"Jumps to `c` (similarly to `JMPX`), but only if `f` is non-zero."
+,,,cont_conditional,E0,IFJMP:<{ code }>,f -,,Equivalent to `<{ code }> CONT` `IFJMP`.
+IFNOTJMP,,#E1,cont_conditional,E1,IFNOTJMP,f c - ,18,"Jumps to `c` (similarly to `JMPX`), but only if `f` is zero."
+,,,cont_conditional,E1,IFNOTJMP:<{ code }>,f -,,Equivalent to `<{ code }> CONT` `IFNOTJMP`.
+IFELSE,,#E2,cont_conditional,E2,IFELSE,f c c' - ,18,"If integer `f` is non-zero, executes `c`, otherwise executes `c'`. Equivalent to `CONDSELCHK` `EXECUTE`."
+,,,cont_conditional,E2,IF:<{ code1 }>ELSE<{ code2 }>,f -,,Equivalent to `<{ code1 }> CONT` `<{ code2 }> CONT` `IFELSE`.
+IFREF,,#E300 c:^Cell,cont_conditional,E300,[ref] IFREF,f - ,26/126/51,"Equivalent to `PUSHREFCONT` `IF`, with the optimization that the cell reference is not actually loaded into a _Slice_ and then converted into an ordinary _Continuation_ if `f=0`.
+Gas consumption of this primitive depends on whether `f=0` and whether the reference was loaded before.
+Similar remarks apply other primitives that accept a continuation as a reference."
+IFNOTREF,,#E301 c:^Cell,cont_conditional,E301,[ref] IFNOTREF,f - ,26/126/51,Equivalent to `PUSHREFCONT` `IFNOT`.
+IFJMPREF,,#E302 c:^Cell,cont_conditional,E302,[ref] IFJMPREF,f - ,26/126/51,Equivalent to `PUSHREFCONT` `IFJMP`.
+IFNOTJMPREF,,#E303 c:^Cell,cont_conditional,E303,[ref] IFNOTJMPREF,f - ,26/126/51,Equivalent to `PUSHREFCONT` `IFNOTJMP`.
+CONDSEL,,#E304,cont_conditional,E304,CONDSEL,f x y - x or y,26,"If integer `f` is non-zero, returns `x`, otherwise returns `y`. Notice that no type checks are performed on `x` and `y`; as such, it is more like a conditional stack operation. Roughly equivalent to `ROT` `ISZERO` `INC` `ROLLX` `NIP`."
+CONDSELCHK,,#E305,cont_conditional,E305,CONDSELCHK,f x y - x or y,26,"Same as `CONDSEL`, but first checks whether `x` and `y` have the same type."
+IFRETALT,,#E308,cont_conditional,E308,IFRETALT,f -,26,Performs `RETALT` if integer `f!=0`.
+IFNOTRETALT,,#E309,cont_conditional,E309,IFNOTRETALT,f -,26,Performs `RETALT` if integer `f=0`.
+IFREFELSE,,#E30D c:^Cell,cont_conditional,E30D,[ref] IFREFELSE,f c -,26/126/51,"Equivalent to `PUSHREFCONT` `SWAP` `IFELSE`, with the optimization that the cell reference is not actually loaded into a _Slice_ and then converted into an ordinary _Continuation_ if `f=0`. Similar remarks apply to the next two primitives: cells are converted into continuations only when necessary."
+IFELSEREF,,#E30E c:^Cell,cont_conditional,E30E,[ref] IFELSEREF,f c -,26/126/51,Equivalent to `PUSHREFCONT` `IFELSE`.
+IFREFELSEREF,,#E30F c1:^Cell c2:^Cell,cont_conditional,E30F,[ref] [ref] IFREFELSEREF,f -,126/51,Equivalent to `PUSHREFCONT` `PUSHREFCONT` `IFELSE`.
+IFBITJMP,,#E39_ n:uint5,cont_conditional,E39_n,[n] IFBITJMP,x c - x,26,"Checks whether bit `0 <= n <= 31` is set in integer `x`, and if so, performs `JMPX` to continuation `c`. Value `x` is left in the stack."
+IFNBITJMP,,#E3B_ n:uint5,cont_conditional,E3B_n,[n] IFNBITJMP,x c - x,26,Jumps to `c` if bit `0 <= n <= 31` is not set in integer `x`.
+IFBITJMPREF,,#E3D_ n:uint5 c:^Cell,cont_conditional,E3D_n,[ref] [n] IFBITJMPREF,x - x,126/51,Performs a `JMPREF` if bit `0 <= n <= 31` is set in integer `x`.
+IFNBITJMPREF,,#E3F_ n:uint5 c:^Cell,cont_conditional,E3F_n,[ref] [n] IFNBITJMPREF,x - x,126/51,Performs a `JMPREF` if bit `0 <= n <= 31` is not set in integer `x`.
+REPEAT,,#E4,cont_loops,E4,REPEAT,n c - ,18,"Executes continuation `c` `n` times, if integer `n` is non-negative. If `n>=2^31` or `n<-2^31`, generates a range check exception.
+Notice that a `RET` inside the code of `c` works as a `continue`, not as a `break`. One should use either alternative (experimental) loops or alternative `RETALT` (along with a `SETEXITALT` before the loop) to `break` out of a loop."
+,,,cont_loops,E4,"REPEAT:<{ code }>
+<{ code }>REPEAT",n -,,Equivalent to `<{ code }> CONT` `REPEAT`.
+REPEATEND,,#E5,cont_loops,E5,"REPEATEND
+REPEAT:",n - ,18,"Similar to `REPEAT`, but it is applied to the current continuation `cc`."
+UNTIL,,#E6,cont_loops,E6,UNTIL,c - ,18,"Executes continuation `c`, then pops an integer `x` from the resulting stack. If `x` is zero, performs another iteration of this loop. The actual implementation of this primitive involves an extraordinary continuation `ec_until` with its arguments set to the body of the loop (continuation `c`) and the original current continuation `cc`. This extraordinary continuation is then saved into the savelist of `c` as `c.c0` and the modified `c` is then executed. The other loop primitives are implemented similarly with the aid of suitable extraordinary continuations."
+,,,cont_loops,E6,"UNTIL:<{ code }>
+<{ code }>UNTIL",-,,Equivalent to `<{ code }> CONT` `UNTIL`.
+UNTILEND,,#E7,cont_loops,E7,"UNTILEND
+UNTIL:",-,18,"Similar to `UNTIL`, but executes the current continuation `cc` in a loop. When the loop exit condition is satisfied, performs a `RET`."
+WHILE,,#E8,cont_loops,E8,WHILE,c' c - ,18,"Executes `c'` and pops an integer `x` from the resulting stack. If `x` is zero, exists the loop and transfers control to the original `cc`. If `x` is non-zero, executes `c`, and then begins a new iteration."
+,,,cont_loops,E8,WHILE:<{ cond }>DO<{ code }>,-,,Equivalent to `<{ cond }> CONT` `<{ code }> CONT` `WHILE`.
+WHILEEND,,#E9,cont_loops,E9,WHILEEND,c' - ,18,"Similar to `WHILE`, but uses the current continuation `cc` as the loop body."
+AGAIN,,#EA,cont_loops,EA,AGAIN,c - ,18,"Similar to `REPEAT`, but executes `c` infinitely many times. A `RET` only begins a new iteration of the infinite loop, which can be exited only by an exception, or a `RETALT` (or an explicit `JMPX`)."
+,,,cont_loops,EA,"AGAIN:<{ code }>
+<{ code }>AGAIN",-,,Equivalent to `<{ code }> CONT` `AGAIN`.
+AGAINEND,,#EB,cont_loops,EB,"AGAINEND
+AGAIN:",-,18,"Similar to `AGAIN`, but performed with respect to the current continuation `cc`."
+REPEATBRK,,#E314,cont_loops,E314,REPEATBRK,n c -,26,"Similar to `REPEAT`, but also sets `c1` to the original `cc` after saving the old value of `c1` into the savelist of the original `cc`. In this way `RETALT` could be used to break out of the loop body."
+,,,cont_loops,E314,"REPEATBRK:<{ code }>
+<{ code }>REPEATBRK",n -,,Equivalent to `<{ code }> CONT` `REPEATBRK`.
+REPEATENDBRK,,#E315,cont_loops,E315,REPEATENDBRK,n -,26,"Similar to `REPEATEND`, but also sets `c1` to the original `c0` after saving the old value of `c1` into the savelist of the original `c0`. Equivalent to `SAMEALTSAVE` `REPEATEND`."
+UNTILBRK,,#E316,cont_loops,E316,UNTILBRK,c -,26,"Similar to `UNTIL`, but also modifies `c1` in the same way as `REPEATBRK`."
+,,,cont_loops,E316,UNTILBRK:<{ code }>,-,,Equivalent to `<{ code }> CONT` `UNTILBRK`.
+UNTILENDBRK,,#E317,cont_loops,E317,"UNTILENDBRK
+UNTILBRK:",-,26,Equivalent to `SAMEALTSAVE` `UNTILEND`.
+WHILEBRK,,#E318,cont_loops,E318,WHILEBRK,c' c -,26,"Similar to `WHILE`, but also modifies `c1` in the same way as `REPEATBRK`."
+,,,cont_loops,E318,WHILEBRK:<{ cond }>DO<{ code }>,-,,Equivalent to `<{ cond }> CONT` `<{ code }> CONT` `WHILEBRK`.
+WHILEENDBRK,,#E319,cont_loops,E319,WHILEENDBRK,c -,26,Equivalent to `SAMEALTSAVE` `WHILEEND`.
+AGAINBRK,,#E31A,cont_loops,E31A,AGAINBRK,c -,26,"Similar to `AGAIN`, but also modifies `c1` in the same way as `REPEATBRK`."
+,,,cont_loops,E31A,AGAINBRK:<{ code }>,-,,Equivalent to `<{ code }> CONT` `AGAINBRK`.
+AGAINENDBRK,,#E31B,cont_loops,E31B,"AGAINENDBRK
+AGAINBRK:",-,26,Equivalent to `SAMEALTSAVE` `AGAINEND`.
+SETCONTARGS_N,,#EC r:uint4 n:(#<= 14),cont_stack,ECrn,[r] [n] SETCONTARGS,x_1 x_2...x_r c - c',26+s”,"Similar to `[r] -1 SETCONTARGS`, but sets `c.nargs` to the final size of the stack of `c'` plus `n`. In other words, transforms `c` into a _closure_ or a _partially applied function_, with `0 <= n <= 14` arguments missing."
+SETNUMARGS,SETCONTARGS_N,#EC0 n:(#<= 14),cont_stack,EC0n,[n] SETNUMARGS,c - c',26,"Sets `c.nargs` to `n` plus the current depth of `c`'s stack, where `0 <= n <= 14`. If `c.nargs` is already set to a non-negative value, does nothing."
+SETCONTARGS,,#EC r:uint4 n:(## 4) {n = 15},cont_stack,ECrF,[r] -1 SETCONTARGS,x_1 x_2...x_r c - c',26+s”,"Pushes `0 <= r <= 15` values `x_1...x_r` into the stack of (a copy of) the continuation `c`, starting with `x_1`. If the final depth of `c`'s stack turns out to be greater than `c.nargs`, a stack overflow exception is generated."
+RETURNARGS,,#ED0 p:uint4,cont_stack,ED0p,[p] RETURNARGS,-,26+s”,"Leaves only the top `0 <= p <= 15` values in the current stack (somewhat similarly to `ONLYTOPX`), with all the unused bottom values not discarded, but saved into continuation `c0` in the same way as `SETCONTARGS` does."
+RETURNVARARGS,,#ED10,cont_stack,ED10,RETURNVARARGS,p -,26+s”,"Similar to `RETURNARGS`, but with Integer `0 <= p <= 255` taken from the stack."
+SETCONTVARARGS,,#ED11,cont_stack,ED11,SETCONTVARARGS,x_1 x_2...x_r c r n - c',26+s”,"Similar to `SETCONTARGS`, but with `0 <= r <= 255` and `-1 <= n <= 255` taken from the stack."
+SETNUMVARARGS,,#ED12,cont_stack,ED12,SETNUMVARARGS,c n - c',26,"`-1 <= n <= 255`
+If `n=-1`, this operation does nothing (`c'=c`).
+Otherwise its action is similar to `[n] SETNUMARGS`, but with `n` taken from the stack."
+BLESS,,#ED1E,cont_create,ED1E,BLESS,s - c,26,"Transforms a _Slice_ `s` into a simple ordinary continuation `c`, with `c.code=s` and an empty stack and savelist."
+BLESSVARARGS,,#ED1F,cont_create,ED1F,BLESSVARARGS,x_1...x_r s r n - c,26+s”,Equivalent to `ROT` `BLESS` `ROTREV` `SETCONTVARARGS`.
+BLESSARGS,,#EE r:uint4 n:uint4,cont_create,EErn,[r] [n] BLESSARGS,x_1...x_r s - c,26,"`0 <= r <= 15`, `-1 <= n <= 14`
+Equivalent to `BLESS` `[r] [n] SETCONTARGS`.
+The value of `n` is represented inside the instruction by the 4-bit integer `n mod 16`."
+BLESSNUMARGS,BLESSARGS,#EE0 n:uint4,cont_create,EE0n,[n] BLESSNUMARGS,s - c,26,"Also transforms a _Slice_ `s` into a _Continuation_ `c`, but sets `c.nargs` to `0 <= n <= 14`."
+PUSHCTR,,#ED4 i:uint4,cont_registers,ED4i,"c[i] PUSHCTR
+c[i] PUSH",- x,26,"Pushes the current value of control register `c(i)`. If the control register is not supported in the current codepage, or if it does not have a value, an exception is triggered."
+PUSHROOT,PUSHCTR,#ED44,cont_registers,ED44,"c4 PUSHCTR
+c4 PUSH",- x,26,"Pushes the “global data root'' cell reference, thus enabling access to persistent smart-contract data."
+POPCTR,,#ED5 i:uint4,cont_registers,ED5i,"c[i] POPCTR
+c[i] POP",x - ,26,"Pops a value `x` from the stack and stores it into control register `c(i)`, if supported in the current codepage. Notice that if a control register accepts only values of a specific type, a type-checking exception may occur."
+POPROOT,POPCTR,#ED54,cont_registers,ED54,"c4 POPCTR
+c4 POP",x -,26,"Sets the “global data root'' cell reference, thus allowing modification of persistent smart-contract data."
+SETCONTCTR,,#ED6 i:uint4,cont_registers,ED6i,"c[i] SETCONT
+c[i] SETCONTCTR",x c - c',26,"Stores `x` into the savelist of continuation `c` as `c(i)`, and returns the resulting continuation `c'`. Almost all operations with continuations may be expressed in terms of `SETCONTCTR`, `POPCTR`, and `PUSHCTR`."
+SETRETCTR,,#ED7 i:uint4,cont_registers,ED7i,c[i] SETRETCTR,x - ,26,Equivalent to `c0 PUSHCTR` `c[i] SETCONTCTR` `c0 POPCTR`.
+SETALTCTR,,#ED8 i:uint4,cont_registers,ED8i,c[i] SETALTCTR,x - ,26,Equivalent to `c1 PUSHCTR` `c[i] SETCONTCTR` `c0 POPCTR`.
+POPSAVE,,#ED9 i:uint4,cont_registers,ED9i,"c[i] POPSAVE
+c[i] POPCTRSAVE",x -,26,"Similar to `c[i] POPCTR`, but also saves the old value of `c[i]` into continuation `c0`.
+Equivalent (up to exceptions) to `c[i] SAVECTR` `c[i] POPCTR`."
+SAVE,,#EDA i:uint4,cont_registers,EDAi,"c[i] SAVE
+c[i] SAVECTR",,26,"Saves the current value of `c(i)` into the savelist of continuation `c0`. If an entry for `c[i]` is already present in the savelist of `c0`, nothing is done. Equivalent to `c[i] PUSHCTR` `c[i] SETRETCTR`."
+SAVEALT,,#EDB i:uint4,cont_registers,EDBi,"c[i] SAVEALT
+c[i] SAVEALTCTR",,26,"Similar to `c[i] SAVE`, but saves the current value of `c[i]` into the savelist of `c1`, not `c0`."
+SAVEBOTH,,#EDC i:uint4,cont_registers,EDCi,"c[i] SAVEBOTH
+c[i] SAVEBOTHCTR",,26,Equivalent to `DUP` `c[i] SAVE` `c[i] SAVEALT`.
+PUSHCTRX,,#EDE0,cont_registers,EDE0,PUSHCTRX,i - x,26,"Similar to `c[i] PUSHCTR`, but with `i`, `0 <= i <= 255`, taken from the stack.
+Notice that this primitive is one of the few “exotic'' primitives, which are not polymorphic like stack manipulation primitives, and at the same time do not have well-defined types of parameters and return values, because the type of `x` depends on `i`."
+POPCTRX,,#EDE1,cont_registers,EDE1,POPCTRX,x i - ,26,"Similar to `c[i] POPCTR`, but with `0 <= i <= 255` from the stack."
+SETCONTCTRX,,#EDE2,cont_registers,EDE2,SETCONTCTRX,x c i - c',26,"Similar to `c[i] SETCONTCTR`, but with `0 <= i <= 255` from the stack."
+COMPOS,,#EDF0,cont_registers,EDF0,"COMPOS
+BOOLAND",c c' - c'',26,"Computes the composition `compose0(c, c’)`, which has the meaning of “perform `c`, and, if successful, perform `c'`'' (if `c` is a boolean circuit) or simply “perform `c`, then `c'`''. Equivalent to `SWAP` `c0 SETCONT`."
+COMPOSALT,,#EDF1,cont_registers,EDF1,"COMPOSALT
+BOOLOR",c c' - c'',26,"Computes the alternative composition `compose1(c, c’)`, which has the meaning of “perform `c`, and, if not successful, perform `c'`'' (if `c` is a boolean circuit). Equivalent to `SWAP` `c1 SETCONT`."
+COMPOSBOTH,,#EDF2,cont_registers,EDF2,COMPOSBOTH,c c' - c'',26,"Computes composition `compose1(compose0(c, c’), c’)`, which has the meaning of “compute boolean circuit `c`, then compute `c'`, regardless of the result of `c`''."
+ATEXIT,,#EDF3,cont_registers,EDF3,ATEXIT,c - ,26,"Sets `c0` to `compose0(c, c0)`. In other words, `c` will be executed before exiting current subroutine."
+,,,cont_registers,EDF3,"ATEXIT:<{ code }>
+<{ code }>ATEXIT",-,,Equivalent to `<{ code }> CONT` `ATEXIT`.
+ATEXITALT,,#EDF4,cont_registers,EDF4,ATEXITALT,c - ,26,"Sets `c1` to `compose1(c, c1)`. In other words, `c` will be executed before exiting current subroutine by its alternative return path."
+,,,cont_registers,EDF4,"ATEXITALT:<{ code }>
+<{ code }>ATEXITALT",-,,Equivalent to `<{ code }> CONT` `ATEXITALT`.
+SETEXITALT,,#EDF5,cont_registers,EDF5,SETEXITALT,c - ,26,"Sets `c1` to `compose1(compose0(c, c0), c1)`,
+In this way, a subsequent `RETALT` will first execute `c`, then transfer control to the original `c0`. This can be used, for instance, to exit from nested loops."
+THENRET,,#EDF6,cont_registers,EDF6,THENRET,c - c',26,"Computes `compose0(c, c0)`."
+THENRETALT,,#EDF7,cont_registers,EDF7,THENRETALT,c - c',26,"Computes `compose0(c, c1)`"
+INVERT,,#EDF8,cont_registers,EDF8,INVERT,-,26,Interchanges `c0` and `c1`.
+BOOLEVAL,,#EDF9,cont_registers,EDF9,BOOLEVAL,c - ?,26,"Performs `cc:=compose1(compose0(c, compose0(-1 PUSHINT, cc)), compose0(0 PUSHINT, cc))`. If `c` represents a boolean circuit, the net effect is to evaluate it and push either `-1` or `0` into the stack before continuing."
+SAMEALT,,#EDFA,cont_registers,EDFA,SAMEALT,-,26,Sets `c1` to `c0`. Equivalent to `c0 PUSHCTR` `c1 POPCTR`.
+SAMEALTSAVE,,#EDFB,cont_registers,EDFB,SAMEALTSAVE,-,26,"Sets `c1` to `c0`, but first saves the old value of `c1` into the savelist of `c0`.
+Equivalent to `c1 SAVE` `SAMEALT`."
+CALLDICT,,#F0 n:uint8,cont_dict,F0nn,"[nn] CALL
+[nn] CALLDICT",- nn,,"Calls the continuation in `c3`, pushing integer `0 <= nn <= 255` into its stack as an argument.
+Approximately equivalent to `[nn] PUSHINT` `c3 PUSHCTR` `EXECUTE`."
+CALLDICT_LONG,,#F12_ n:uint14,cont_dict,F12_n,"[n] CALL
+[n] CALLDICT",- n,,"For `0 <= n < 2^14`, an encoding of `[n] CALL` for larger values of `n`."
+JMPDICT,,#F16_ n:uint14,cont_dict,F16_n,[n] JMP, - n,,"Jumps to the continuation in `c3`, pushing integer `0 <= n < 2^14` as its argument.
+Approximately equivalent to `n PUSHINT` `c3 PUSHCTR` `JMPX`."
+PREPAREDICT,,#F1A_ n:uint14,cont_dict,F1A_n,"[n] PREPARE
+[n] PREPAREDICT", - n c,,"Equivalent to `n PUSHINT` `c3 PUSHCTR`, for `0 <= n < 2^14`.
+In this way, `[n] CALL` is approximately equivalent to `[n] PREPARE` `EXECUTE`, and `[n] JMP` is approximately equivalent to `[n] PREPARE` `JMPX`.
+One might use, for instance, `CALLXARGS` or `CALLCC` instead of `EXECUTE` here."
+THROW_SHORT,,#F22_ n:uint6,exceptions,F22_n,[n] THROW, - 0 n,76,"Throws exception `0 <= n <= 63` with parameter zero.
+In other words, it transfers control to the continuation in `c2`, pushing `0` and `n` into its stack, and discarding the old stack altogether."
+THROWIF_SHORT,,#F26_ n:uint6,exceptions,F26_n,[n] THROWIF,f - ,26/76,Throws exception `0 <= n <= 63` with parameter zero only if integer `f!=0`.
+THROWIFNOT_SHORT,,#F2A_ n:uint6,exceptions,F2A_n,[n] THROWIFNOT,f - ,26/76,Throws exception `0 <= n <= 63` with parameter zero only if integer `f=0`.
+THROW,,#F2C4_ n:uint11,exceptions,F2C4_n,[n] THROW,- 0 nn,84,"For `0 <= n < 2^11`, an encoding of `[n] THROW` for larger values of `n`."
+THROWARG,,#F2CC_ n:uint11,exceptions,F2CC_n,[n] THROWARG,x - x nn,84,"Throws exception `0 <= n < 2^11` with parameter `x`, by copying `x` and `n` into the stack of `c2` and transferring control to `c2`."
+THROWIF,,#F2D4_ n:uint11,exceptions,F2D4_n,[n] THROWIF,f - ,34/84,"For `0 <= n < 2^11`, an encoding of `[n] THROWIF` for larger values of `n`."
+THROWARGIF,,#F2DC_ n:uint11,exceptions,F2DC_n,[n] THROWARGIF,x f - ,34/84,Throws exception `0 <= nn < 2^11` with parameter `x` only if integer `f!=0`.
+THROWIFNOT,,#F2E4_ n:uint11,exceptions,F2E4_n,[n] THROWIFNOT,f - ,34/84,"For `0 <= n < 2^11`, an encoding of `[n] THROWIFNOT` for larger values of `n`."
+THROWARGIFNOT,,#F2EC_ n:uint11,exceptions,F2EC_n,[n] THROWARGIFNOT,x f - ,34/84,Throws exception `0 <= n < 2^11` with parameter `x` only if integer `f=0`.
+THROWANY,,#F2F0,exceptions,F2F0,THROWANY,n - 0 n,76,"Throws exception `0 <= n < 2^16` with parameter zero.
+Approximately equivalent to `ZERO` `SWAP` `THROWARGANY`."
+THROWARGANY,,#F2F1,exceptions,F2F1,THROWARGANY,x n - x n,76,"Throws exception `0 <= n < 2^16` with parameter `x`, transferring control to the continuation in `c2`.
+Approximately equivalent to `c2 PUSHCTR` `2 JMPXARGS`."
+THROWANYIF,,#F2F2,exceptions,F2F2,THROWANYIF,n f - ,26/76,Throws exception `0 <= n < 2^16` with parameter zero only if `f!=0`.
+THROWARGANYIF,,#F2F3,exceptions,F2F3,THROWARGANYIF,x n f - ,26/76,Throws exception `0 <= n<2^16` with parameter `x` only if `f!=0`.
+THROWANYIFNOT,,#F2F4,exceptions,F2F4,THROWANYIFNOT,n f - ,26/76,Throws exception `0 <= n<2^16` with parameter zero only if `f=0`.
+THROWARGANYIFNOT,,#F2F5,exceptions,F2F5,THROWARGANYIFNOT,x n f - ,26/76,Throws exception `0 <= n<2^16` with parameter `x` only if `f=0`.
+TRY,,#F2FF,exceptions,F2FF,TRY,c c' - ,26,"Sets `c2` to `c'`, first saving the old value of `c2` both into the savelist of `c'` and into the savelist of the current continuation, which is stored into `c.c0` and `c'.c0`. Then runs `c` similarly to `EXECUTE`. If `c` does not throw any exceptions, the original value of `c2` is automatically restored on return from `c`. If an exception occurs, the execution is transferred to `c'`, but the original value of `c2` is restored in the process, so that `c'` can re-throw the exception by `THROWANY` if it cannot handle it by itself."
+,,,exceptions,F2FF,TRY:<{ code1 }>CATCH<{ code2 }>,-,,Equivalent to `<{ code1 }> CONT` `<{ code2 }> CONT` `TRY`.
+TRYARGS,,#F3 p:uint4 r:uint4,exceptions,F3pr,[p] [r] TRYARGS,c c' - ,26,"Similar to `TRY`, but with `[p] [r] CALLXARGS` internally used instead of `EXECUTE`.
+In this way, all but the top `0 <= p <= 15` stack elements will be saved into current continuation's stack, and then restored upon return from either `c` or `c'`, with the top `0 <= r <= 15` values of the resulting stack of `c` or `c'` copied as return values."
+NEWDICT,NULL,#6D,dict_create,6D,NEWDICT, - D,18,"Returns a new empty dictionary.
+It is an alternative mnemonics for `PUSHNULL`."
+DICTEMPTY,ISNULL,#6E,dict_create,6E,DICTEMPTY,D - ?,18,"Checks whether dictionary `D` is empty, and returns `-1` or `0` accordingly.
+It is an alternative mnemonics for `ISNULL`."
+STDICTS,STSLICE,#CE,dict_serial,CE,"STDICTS
+",s b - b',18,"Stores a _Slice_-represented dictionary `s` into _Builder_ `b`.
+It is actually a synonym for `STSLICE`."
+STDICT,,#F400,dict_serial,F400,"STDICT
+STOPTREF",D b - b',26,"Stores dictionary `D` into _Builder_ `b`, returing the resulting _Builder_ `b'`.
+In other words, if `D` is a cell, performs `STONE` and `STREF`; if `D` is _Null_, performs `NIP` and `STZERO`; otherwise throws a type checking exception."
+SKIPDICT,,#F401,dict_serial,F401,"SKIPDICT
+SKIPOPTREF",s - s',26,Equivalent to `LDDICT` `NIP`.
+LDDICTS,,#F402,dict_serial,F402,LDDICTS,s - s' s'',26,"Loads (parses) a (_Slice_-represented) dictionary `s'` from _Slice_ `s`, and returns the remainder of `s` as `s''`.
+This is a “split function'' for all `HashmapE(n,X)` dictionary types."
+PLDDICTS,,#F403,dict_serial,F403,PLDDICTS,s - s',26,"Preloads a (_Slice_-represented) dictionary `s'` from _Slice_ `s`.
+Approximately equivalent to `LDDICTS` `DROP`."
+LDDICT,,#F404,dict_serial,F404,"LDDICT
+LDOPTREF",s - D s',26,"Loads (parses) a dictionary `D` from _Slice_ `s`, and returns the remainder of `s` as `s'`. May be applied to dictionaries or to values of arbitrary `(^Y)?` types."
+PLDDICT,,#F405,dict_serial,F405,"PLDDICT
+PLDOPTREF",s - D,26,"Preloads a dictionary `D` from _Slice_ `s`.
+Approximately equivalent to `LDDICT` `DROP`."
+LDDICTQ,,#F406,dict_serial,F406,LDDICTQ,s - D s' -1 or s 0,26,A quiet version of `LDDICT`.
+PLDDICTQ,,#F407,dict_serial,F407,PLDDICTQ,s - D -1 or 0,26,A quiet version of `PLDDICT`.
+DICTGET,,#F40A,dict_get,F40A,DICTGET,k D n - x -1 or 0,,"Looks up key `k` (represented by a _Slice_, the first `0 <= n <= 1023` data bits of which are used as a key) in dictionary `D` of type `HashmapE(n,X)` with `n`-bit keys.
+On success, returns the value found as a _Slice_ `x`."
+DICTGETREF,,#F40B,dict_get,F40B,DICTGETREF,k D n - c -1 or 0,,"Similar to `DICTGET`, but with a `LDREF` `ENDS` applied to `x` on success.
+This operation is useful for dictionaries of type `HashmapE(n,^Y)`."
+DICTIGET,,#F40C,dict_get,F40C,DICTIGET,i D n - x -1 or 0,,"Similar to `DICTGET`, but with a signed (big-endian) `n`-bit _Integer_ `i` as a key. If `i` does not fit into `n` bits, returns `0`. If `i` is a `NaN`, throws an integer overflow exception."
+DICTIGETREF,,#F40D,dict_get,F40D,DICTIGETREF,i D n - c -1 or 0,,Combines `DICTIGET` with `DICTGETREF`: it uses signed `n`-bit _Integer_ `i` as a key and returns a _Cell_ instead of a _Slice_ on success.
+DICTUGET,,#F40E,dict_get,F40E,DICTUGET,i D n - x -1 or 0,,"Similar to `DICTIGET`, but with _unsigned_ (big-endian) `n`-bit _Integer_ `i` used as a key."
+DICTUGETREF,,#F40F,dict_get,F40F,DICTUGETREF,i D n - c -1 or 0,,"Similar to `DICTIGETREF`, but with an unsigned `n`-bit _Integer_ key `i`."
+DICTSET,,#F412,dict_set,F412,DICTSET,x k D n - D',,"Sets the value associated with `n`-bit key `k` (represented by a _Slice_ as in `DICTGET`) in dictionary `D` (also represented by a _Slice_) to value `x` (again a _Slice_), and returns the resulting dictionary as `D'`."
+DICTSETREF,,#F413,dict_set,F413,DICTSETREF,c k D n - D',,"Similar to `DICTSET`, but with the value set to a reference to _Cell_ `c`."
+DICTISET,,#F414,dict_set,F414,DICTISET,x i D n - D',,"Similar to `DICTSET`, but with the key represented by a (big-endian) signed `n`-bit integer `i`. If `i` does not fit into `n` bits, a range check exception is generated."
+DICTISETREF,,#F415,dict_set,F415,DICTISETREF,c i D n - D',,"Similar to `DICTSETREF`, but with the key a signed `n`-bit integer as in `DICTISET`."
+DICTUSET,,#F416,dict_set,F416,DICTUSET,x i D n - D',,"Similar to `DICTISET`, but with `i` an _unsigned_ `n`-bit integer."
+DICTUSETREF,,#F417,dict_set,F417,DICTUSETREF,c i D n - D',,"Similar to `DICTISETREF`, but with `i` unsigned."
+DICTSETGET,,#F41A,dict_set,F41A,DICTSETGET,x k D n - D' y -1 or D' 0,,"Combines `DICTSET` with `DICTGET`: it sets the value corresponding to key `k` to `x`, but also returns the old value `y` associated with the key in question, if present."
+DICTSETGETREF,,#F41B,dict_set,F41B,DICTSETGETREF,c k D n - D' c' -1 or D' 0,,Combines `DICTSETREF` with `DICTGETREF` similarly to `DICTSETGET`.
+DICTISETGET,,#F41C,dict_set,F41C,DICTISETGET,x i D n - D' y -1 or D' 0,,"`DICTISETGET`, but with `i` a signed `n`-bit integer."
+DICTISETGETREF,,#F41D,dict_set,F41D,DICTISETGETREF,c i D n - D' c' -1 or D' 0,,"`DICTISETGETREF`, but with `i` a signed `n`-bit integer."
+DICTUSETGET,,#F41E,dict_set,F41E,DICTUSETGET,x i D n - D' y -1 or D' 0,,"`DICTISETGET`, but with `i` an unsigned `n`-bit integer."
+DICTUSETGETREF,,#F41F,dict_set,F41F,DICTUSETGETREF,c i D n - D' c' -1 or D' 0,,"`DICTISETGETREF`, but with `i` an unsigned `n`-bit integer."
+DICTREPLACE,,#F422,dict_set,F422,DICTREPLACE,x k D n - D' -1 or D 0,,"A _Replace_ operation, which is similar to `DICTSET`, but sets the value of key `k` in dictionary `D` to `x` only if the key `k` was already present in `D`."
+DICTREPLACEREF,,#F423,dict_set,F423,DICTREPLACEREF,c k D n - D' -1 or D 0,,A _Replace_ counterpart of `DICTSETREF`.
+DICTIREPLACE,,#F424,dict_set,F424,DICTIREPLACE,x i D n - D' -1 or D 0,,"`DICTREPLACE`, but with `i` a signed `n`-bit integer."
+DICTIREPLACEREF,,#F425,dict_set,F425,DICTIREPLACEREF,c i D n - D' -1 or D 0,,"`DICTREPLACEREF`, but with `i` a signed `n`-bit integer."
+DICTUREPLACE,,#F426,dict_set,F426,DICTUREPLACE,x i D n - D' -1 or D 0,,"`DICTREPLACE`, but with `i` an unsigned `n`-bit integer."
+DICTUREPLACEREF,,#F427,dict_set,F427,DICTUREPLACEREF,c i D n - D' -1 or D 0,,"`DICTREPLACEREF`, but with `i` an unsigned `n`-bit integer."
+DICTREPLACEGET,,#F42A,dict_set,F42A,DICTREPLACEGET,x k D n - D' y -1 or D 0,,"A _Replace_ counterpart of `DICTSETGET`: on success, also returns the old value associated with the key in question."
+DICTREPLACEGETREF,,#F42B,dict_set,F42B,DICTREPLACEGETREF,c k D n - D' c' -1 or D 0,,A _Replace_ counterpart of `DICTSETGETREF`.
+DICTIREPLACEGET,,#F42C,dict_set,F42C,DICTIREPLACEGET,x i D n - D' y -1 or D 0,,"`DICTREPLACEGET`, but with `i` a signed `n`-bit integer."
+DICTIREPLACEGETREF,,#F42D,dict_set,F42D,DICTIREPLACEGETREF,c i D n - D' c' -1 or D 0,,"`DICTREPLACEGETREF`, but with `i` a signed `n`-bit integer."
+DICTUREPLACEGET,,#F42E,dict_set,F42E,DICTUREPLACEGET,x i D n - D' y -1 or D 0,,"`DICTREPLACEGET`, but with `i` an unsigned `n`-bit integer."
+DICTUREPLACEGETREF,,#F42F,dict_set,F42F,DICTUREPLACEGETREF,c i D n - D' c' -1 or D 0,,"`DICTREPLACEGETREF`, but with `i` an unsigned `n`-bit integer."
+DICTADD,,#F432,dict_set,F432,DICTADD,x k D n - D' -1 or D 0,,"An _Add_ counterpart of `DICTSET`: sets the value associated with key `k` in dictionary `D` to `x`, but only if it is not already present in `D`."
+DICTADDREF,,#F433,dict_set,F433,DICTADDREF,c k D n - D' -1 or D 0,,An _Add_ counterpart of `DICTSETREF`.
+DICTIADD,,#F434,dict_set,F434,DICTIADD,x i D n - D' -1 or D 0,,"`DICTADD`, but with `i` a signed `n`-bit integer."
+DICTIADDREF,,#F435,dict_set,F435,DICTIADDREF,c i D n - D' -1 or D 0,,"`DICTADDREF`, but with `i` a signed `n`-bit integer."
+DICTUADD,,#F436,dict_set,F436,DICTUADD,x i D n - D' -1 or D 0,,"`DICTADD`, but with `i` an unsigned `n`-bit integer."
+DICTUADDREF,,#F437,dict_set,F437,DICTUADDREF,c i D n - D' -1 or D 0,,"`DICTADDREF`, but with `i` an unsigned `n`-bit integer."
+DICTADDGET,,#F43A,dict_set,F43A,DICTADDGET,x k D n - D' -1 or D y 0,,"An _Add_ counterpart of `DICTSETGET`: sets the value associated with key `k` in dictionary `D` to `x`, but only if key `k` is not already present in `D`. Otherwise, just returns the old value `y` without changing the dictionary."
+DICTADDGETREF,,#F43B,dict_set,F43B,DICTADDGETREF,c k D n - D' -1 or D c' 0,,An _Add_ counterpart of `DICTSETGETREF`.
+DICTIADDGET,,#F43C,dict_set,F43C,DICTIADDGET,x i D n - D' -1 or D y 0,,"`DICTADDGET`, but with `i` a signed `n`-bit integer."
+DICTIADDGETREF,,#F43D,dict_set,F43D,DICTIADDGETREF,c i D n - D' -1 or D c' 0,,"`DICTADDGETREF`, but with `i` a signed `n`-bit integer."
+DICTUADDGET,,#F43E,dict_set,F43E,DICTUADDGET,x i D n - D' -1 or D y 0,,"`DICTADDGET`, but with `i` an unsigned `n`-bit integer."
+DICTUADDGETREF,,#F43F,dict_set,F43F,DICTUADDGETREF,c i D n - D' -1 or D c' 0,,"`DICTADDGETREF`, but with `i` an unsigned `n`-bit integer."
+DICTSETB,,#F441,dict_set_builder,F441,DICTSETB,b k D n - D',,
+DICTISETB,,#F442,dict_set_builder,F442,DICTISETB,b i D n - D',,
+DICTUSETB,,#F443,dict_set_builder,F443,DICTUSETB,b i D n - D',,
+DICTSETGETB,,#F445,dict_set_builder,F445,DICTSETGETB,b k D n - D' y -1 or D' 0,,
+DICTISETGETB,,#F446,dict_set_builder,F446,DICTISETGETB,b i D n - D' y -1 or D' 0,,
+DICTUSETGETB,,#F447,dict_set_builder,F447,DICTUSETGETB,b i D n - D' y -1 or D' 0,,
+DICTREPLACEB,,#F449,dict_set_builder,F449,DICTREPLACEB,b k D n - D' -1 or D 0,,
+DICTIREPLACEB,,#F44A,dict_set_builder,F44A,DICTIREPLACEB,b i D n - D' -1 or D 0,,
+DICTUREPLACEB,,#F44B,dict_set_builder,F44B,DICTUREPLACEB,b i D n - D' -1 or D 0,,
+DICTREPLACEGETB,,#F44D,dict_set_builder,F44D,DICTREPLACEGETB,b k D n - D' y -1 or D 0,,
+DICTIREPLACEGETB,,#F44E,dict_set_builder,F44E,DICTIREPLACEGETB,b i D n - D' y -1 or D 0,,
+DICTUREPLACEGETB,,#F44F,dict_set_builder,F44F,DICTUREPLACEGETB,b i D n - D' y -1 or D 0,,
+DICTADDB,,#F451,dict_set_builder,F451,DICTADDB,b k D n - D' -1 or D 0,,
+DICTIADDB,,#F452,dict_set_builder,F452,DICTIADDB,b i D n - D' -1 or D 0,,
+DICTUADDB,,#F453,dict_set_builder,F453,DICTUADDB,b i D n - D' -1 or D 0,,
+DICTADDGETB,,#F455,dict_set_builder,F455,DICTADDGETB,b k D n - D' -1 or D y 0,,
+DICTIADDGETB,,#F456,dict_set_builder,F456,DICTIADDGETB,b i D n - D' -1 or D y 0,,
+DICTUADDGETB,,#F457,dict_set_builder,F457,DICTUADDGETB,b i D n - D' -1 or D y 0,,
+DICTDEL,,#F459,dict_delete,F459,DICTDEL,k D n - D' -1 or D 0,,"Deletes `n`-bit key, represented by a _Slice_ `k`, from dictionary `D`. If the key is present, returns the modified dictionary `D'` and the success flag `-1`. Otherwise, returns the original dictionary `D` and `0`."
+DICTIDEL,,#F45A,dict_delete,F45A,DICTIDEL,i D n - D' ?,,"A version of `DICTDEL` with the key represented by a signed `n`-bit _Integer_ `i`. If `i` does not fit into `n` bits, simply returns `D` `0` (“key not found, dictionary unmodified'')."
+DICTUDEL,,#F45B,dict_delete,F45B,DICTUDEL,i D n - D' ?,,"Similar to `DICTIDEL`, but with `i` an unsigned `n`-bit integer."
+DICTDELGET,,#F462,dict_delete,F462,DICTDELGET,k D n - D' x -1 or D 0,,"Deletes `n`-bit key, represented by a _Slice_ `k`, from dictionary `D`. If the key is present, returns the modified dictionary `D'`, the original value `x` associated with the key `k` (represented by a _Slice_), and the success flag `-1`. Otherwise, returns the original dictionary `D` and `0`."
+DICTDELGETREF,,#F463,dict_delete,F463,DICTDELGETREF,k D n - D' c -1 or D 0,,"Similar to `DICTDELGET`, but with `LDREF` `ENDS` applied to `x` on success, so that the value returned `c` is a _Cell_."
+DICTIDELGET,,#F464,dict_delete,F464,DICTIDELGET,i D n - D' x -1 or D 0,,"`DICTDELGET`, but with `i` a signed `n`-bit integer."
+DICTIDELGETREF,,#F465,dict_delete,F465,DICTIDELGETREF,i D n - D' c -1 or D 0,,"`DICTDELGETREF`, but with `i` a signed `n`-bit integer."
+DICTUDELGET,,#F466,dict_delete,F466,DICTUDELGET,i D n - D' x -1 or D 0,,"`DICTDELGET`, but with `i` an unsigned `n`-bit integer."
+DICTUDELGETREF,,#F467,dict_delete,F467,DICTUDELGETREF,i D n - D' c -1 or D 0,,"`DICTDELGETREF`, but with `i` an unsigned `n`-bit integer."
+DICTGETOPTREF,,#F469,dict_mayberef,F469,DICTGETOPTREF,k D n - c^?,,A variant of `DICTGETREF` that returns _Null_ instead of the value `c^?` if the key `k` is absent from dictionary `D`.
+DICTIGETOPTREF,,#F46A,dict_mayberef,F46A,DICTIGETOPTREF,i D n - c^?,,"`DICTGETOPTREF`, but with `i` a signed `n`-bit integer. If the key `i` is out of range, also returns _Null_."
+DICTUGETOPTREF,,#F46B,dict_mayberef,F46B,DICTUGETOPTREF,i D n - c^?,,"`DICTGETOPTREF`, but with `i` an unsigned `n`-bit integer. If the key `i` is out of range, also returns _Null_."
+DICTSETGETOPTREF,,#F46D,dict_mayberef,F46D,DICTSETGETOPTREF,c^? k D n - D' ~c^?,,"A variant of both `DICTGETOPTREF` and `DICTSETGETREF` that sets the value corresponding to key `k` in dictionary `D` to `c^?` (if `c^?` is _Null_, then the key is deleted instead), and returns the old value `~c^?` (if the key `k` was absent before, returns _Null_ instead)."
+DICTISETGETOPTREF,,#F46E,dict_mayberef,F46E,DICTISETGETOPTREF,c^? i D n - D' ~c^?,,"Similar to primitive `DICTSETGETOPTREF`, but using signed `n`-bit _Integer_ `i` as a key. If `i` does not fit into `n` bits, throws a range checking exception."
+DICTUSETGETOPTREF,,#F46F,dict_mayberef,F46F,DICTUSETGETOPTREF,c^? i D n - D' ~c^?,,"Similar to primitive `DICTSETGETOPTREF`, but using unsigned `n`-bit _Integer_ `i` as a key."
+PFXDICTSET,,#F470,dict_prefix,F470,PFXDICTSET,x k D n - D' -1 or D 0,,
+PFXDICTREPLACE,,#F471,dict_prefix,F471,PFXDICTREPLACE,x k D n - D' -1 or D 0,,
+PFXDICTADD,,#F472,dict_prefix,F472,PFXDICTADD,x k D n - D' -1 or D 0,,
+PFXDICTDEL,,#F473,dict_prefix,F473,PFXDICTDEL,k D n - D' -1 or D 0,,
+DICTGETNEXT,,#F474,dict_next,F474,DICTGETNEXT,k D n - x' k' -1 or 0,,"Computes the minimal key `k'` in dictionary `D` that is lexicographically greater than `k`, and returns `k'` (represented by a _Slice_) along with associated value `x'` (also represented by a _Slice_)."
+DICTGETNEXTEQ,,#F475,dict_next,F475,DICTGETNEXTEQ,k D n - x' k' -1 or 0,,"Similar to `DICTGETNEXT`, but computes the minimal key `k'` that is lexicographically greater than or equal to `k`."
+DICTGETPREV,,#F476,dict_next,F476,DICTGETPREV,k D n - x' k' -1 or 0,,"Similar to `DICTGETNEXT`, but computes the maximal key `k'` lexicographically smaller than `k`."
+DICTGETPREVEQ,,#F477,dict_next,F477,DICTGETPREVEQ,k D n - x' k' -1 or 0,,"Similar to `DICTGETPREV`, but computes the maximal key `k'` lexicographically smaller than or equal to `k`."
+DICTIGETNEXT,,#F478,dict_next,F478,DICTIGETNEXT,i D n - x' i' -1 or 0,,"Similar to `DICTGETNEXT`, but interprets all keys in dictionary `D` as big-endian signed `n`-bit integers, and computes the minimal key `i'` that is larger than _Integer_ `i` (which does not necessarily fit into `n` bits)."
+DICTIGETNEXTEQ,,#F479,dict_next,F479,DICTIGETNEXTEQ,i D n - x' i' -1 or 0,,"Similar to `DICTGETNEXTEQ`, but interprets keys as signed `n`-bit integers."
+DICTIGETPREV,,#F47A,dict_next,F47A,DICTIGETPREV,i D n - x' i' -1 or 0,,"Similar to `DICTGETPREV`, but interprets keys as signed `n`-bit integers."
+DICTIGETPREVEQ,,#F47B,dict_next,F47B,DICTIGETPREVEQ,i D n - x' i' -1 or 0,,"Similar to `DICTGETPREVEQ`, but interprets keys as signed `n`-bit integers."
+DICTUGETNEXT,,#F47C,dict_next,F47C,DICTUGETNEXT,i D n - x' i' -1 or 0,,"Similar to `DICTGETNEXT`, but interprets all keys in dictionary `D` as big-endian unsigned `n`-bit integers, and computes the minimal key `i'` that is larger than _Integer_ `i` (which does not necessarily fit into `n` bits, and is not necessarily non-negative)."
+DICTUGETNEXTEQ,,#F47D,dict_next,F47D,DICTUGETNEXTEQ,i D n - x' i' -1 or 0,,"Similar to `DICTGETNEXTEQ`, but interprets keys as unsigned `n`-bit integers."
+DICTUGETPREV,,#F47E,dict_next,F47E,DICTUGETPREV,i D n - x' i' -1 or 0,,"Similar to `DICTGETPREV`, but interprets keys as unsigned `n`-bit integers."
+DICTUGETPREVEQ,,#F47F,dict_next,F47F,DICTUGETPREVEQ,i D n - x' i' -1 or 0,,"Similar to `DICTGETPREVEQ`, but interprets keys a unsigned `n`-bit integers."
+DICTMIN,,#F482,dict_min,F482,DICTMIN,D n - x k -1 or 0,,"Computes the minimal key `k` (represented by a _Slice_ with `n` data bits) in dictionary `D`, and returns `k` along with the associated value `x`."
+DICTMINREF,,#F483,dict_min,F483,DICTMINREF,D n - c k -1 or 0,,"Similar to `DICTMIN`, but returns the only reference in the value as a _Cell_ `c`."
+DICTIMIN,,#F484,dict_min,F484,DICTIMIN,D n - x i -1 or 0,,"Similar to `DICTMIN`, but computes the minimal key `i` under the assumption that all keys are big-endian signed `n`-bit integers. Notice that the key and value returned may differ from those computed by `DICTMIN` and `DICTUMIN`."
+DICTIMINREF,,#F485,dict_min,F485,DICTIMINREF,D n - c i -1 or 0,,"Similar to `DICTIMIN`, but returns the only reference in the value."
+DICTUMIN,,#F486,dict_min,F486,DICTUMIN,D n - x i -1 or 0,,"Similar to `DICTMIN`, but returns the key as an unsigned `n`-bit _Integer_ `i`."
+DICTUMINREF,,#F487,dict_min,F487,DICTUMINREF,D n - c i -1 or 0,,"Similar to `DICTUMIN`, but returns the only reference in the value."
+DICTMAX,,#F48A,dict_min,F48A,DICTMAX,D n - x k -1 or 0,,"Computes the maximal key `k` (represented by a _Slice_ with `n` data bits) in dictionary `D`, and returns `k` along with the associated value `x`."
+DICTMAXREF,,#F48B,dict_min,F48B,DICTMAXREF,D n - c k -1 or 0,,"Similar to `DICTMAX`, but returns the only reference in the value."
+DICTIMAX,,#F48C,dict_min,F48C,DICTIMAX,D n - x i -1 or 0,,"Similar to `DICTMAX`, but computes the maximal key `i` under the assumption that all keys are big-endian signed `n`-bit integers. Notice that the key and value returned may differ from those computed by `DICTMAX` and `DICTUMAX`."
+DICTIMAXREF,,#F48D,dict_min,F48D,DICTIMAXREF,D n - c i -1 or 0,,"Similar to `DICTIMAX`, but returns the only reference in the value."
+DICTUMAX,,#F48E,dict_min,F48E,DICTUMAX,D n - x i -1 or 0,,"Similar to `DICTMAX`, but returns the key as an unsigned `n`-bit _Integer_ `i`."
+DICTUMAXREF,,#F48F,dict_min,F48F,DICTUMAXREF,D n - c i -1 or 0,,"Similar to `DICTUMAX`, but returns the only reference in the value."
+DICTREMMIN,,#F492,dict_min,F492,DICTREMMIN,D n - D' x k -1 or D 0,,"Computes the minimal key `k` (represented by a _Slice_ with `n` data bits) in dictionary `D`, removes `k` from the dictionary, and returns `k` along with the associated value `x` and the modified dictionary `D'`."
+DICTREMMINREF,,#F493,dict_min,F493,DICTREMMINREF,D n - D' c k -1 or D 0,,"Similar to `DICTREMMIN`, but returns the only reference in the value as a _Cell_ `c`."
+DICTIREMMIN,,#F494,dict_min,F494,DICTIREMMIN,D n - D' x i -1 or D 0,,"Similar to `DICTREMMIN`, but computes the minimal key `i` under the assumption that all keys are big-endian signed `n`-bit integers. Notice that the key and value returned may differ from those computed by `DICTREMMIN` and `DICTUREMMIN`."
+DICTIREMMINREF,,#F495,dict_min,F495,DICTIREMMINREF,D n - D' c i -1 or D 0,,"Similar to `DICTIREMMIN`, but returns the only reference in the value."
+DICTUREMMIN,,#F496,dict_min,F496,DICTUREMMIN,D n - D' x i -1 or D 0,,"Similar to `DICTREMMIN`, but returns the key as an unsigned `n`-bit _Integer_ `i`."
+DICTUREMMINREF,,#F497,dict_min,F497,DICTUREMMINREF,D n - D' c i -1 or D 0,,"Similar to `DICTUREMMIN`, but returns the only reference in the value."
+DICTREMMAX,,#F49A,dict_min,F49A,DICTREMMAX,D n - D' x k -1 or D 0,,"Computes the maximal key `k` (represented by a _Slice_ with `n` data bits) in dictionary `D`, removes `k` from the dictionary, and returns `k` along with the associated value `x` and the modified dictionary `D'`."
+DICTREMMAXREF,,#F49B,dict_min,F49B,DICTREMMAXREF,D n - D' c k -1 or D 0,,"Similar to `DICTREMMAX`, but returns the only reference in the value as a _Cell_ `c`."
+DICTIREMMAX,,#F49C,dict_min,F49C,DICTIREMMAX,D n - D' x i -1 or D 0,,"Similar to `DICTREMMAX`, but computes the minimal key `i` under the assumption that all keys are big-endian signed `n`-bit integers. Notice that the key and value returned may differ from those computed by `DICTREMMAX` and `DICTUREMMAX`."
+DICTIREMMAXREF,,#F49D,dict_min,F49D,DICTIREMMAXREF,D n - D' c i -1 or D 0,,"Similar to `DICTIREMMAX`, but returns the only reference in the value."
+DICTUREMMAX,,#F49E,dict_min,F49E,DICTUREMMAX,D n - D' x i -1 or D 0,,"Similar to `DICTREMMAX`, but returns the key as an unsigned `n`-bit _Integer_ `i`."
+DICTUREMMAXREF,,#F49F,dict_min,F49F,DICTUREMMAXREF,D n - D' c i -1 or D 0,,"Similar to `DICTUREMMAX`, but returns the only reference in the value."
+DICTIGETJMP,,#F4A0,dict_special,F4A0,DICTIGETJMP,i D n - ,,"Similar to `DICTIGET`, but with `x` `BLESS`ed into a continuation with a subsequent `JMPX` to it on success. On failure, does nothing. This is useful for implementing `switch`/`case` constructions."
+DICTUGETJMP,,#F4A1,dict_special,F4A1,DICTUGETJMP,i D n - ,,"Similar to `DICTIGETJMP`, but performs `DICTUGET` instead of `DICTIGET`."
+DICTIGETEXEC,,#F4A2,dict_special,F4A2,DICTIGETEXEC,i D n - ,,"Similar to `DICTIGETJMP`, but with `EXECUTE` instead of `JMPX`."
+DICTUGETEXEC,,#F4A3,dict_special,F4A3,DICTUGETEXEC,i D n - ,,"Similar to `DICTUGETJMP`, but with `EXECUTE` instead of `JMPX`."
+DICTPUSHCONST,,#F4A6_ d:^Cell n:uint10,dict_special,F4A6_n,[ref] [n] DICTPUSHCONST, - D n,34,"Pushes a non-empty constant dictionary `D` (as a `Cell^?`) along with its key length `0 <= n <= 1023`, stored as a part of the instruction. The dictionary itself is created from the first of remaining references of the current continuation. In this way, the complete `DICTPUSHCONST` instruction can be obtained by first serializing `xF4A4_`, then the non-empty dictionary itself (one `1` bit and a cell reference), and then the unsigned 10-bit integer `n` (as if by a `STU 10` instruction). An empty dictionary can be pushed by a `NEWDICT` primitive instead."
+PFXDICTGETQ,,#F4A8,dict_special,F4A8,PFXDICTGETQ,s D n - s' x s'' -1 or s 0,,"Looks up the unique prefix of _Slice_ `s` present in the prefix code dictionary represented by `Cell^?` `D` and `0 <= n <= 1023`. If found, the prefix of `s` is returned as `s'`, and the corresponding value (also a _Slice_) as `x`. The remainder of `s` is returned as a _Slice_ `s''`. If no prefix of `s` is a key in prefix code dictionary `D`, returns the unchanged `s` and a zero flag to indicate failure."
+PFXDICTGET,,#F4A9,dict_special,F4A9,PFXDICTGET,s D n - s' x s'',,"Similar to `PFXDICTGET`, but throws a cell deserialization failure exception on failure."
+PFXDICTGETJMP,,#F4AA,dict_special,F4AA,PFXDICTGETJMP,s D n - s' s'' or s,,"Similar to `PFXDICTGETQ`, but on success `BLESS`es the value `x` into a _Continuation_ and transfers control to it as if by a `JMPX`. On failure, returns `s` unchanged and continues execution."
+PFXDICTGETEXEC,,#F4AB,dict_special,F4AB,PFXDICTGETEXEC,s D n - s' s'',,"Similar to `PFXDICTGETJMP`, but `EXEC`utes the continuation found instead of jumping to it. On failure, throws a cell deserialization exception."
+PFXDICTCONSTGETJMP,,#F4AE_ d:^Cell n:uint10,dict_special,F4AE_n,"[ref] [n] PFXDICTCONSTGETJMP
+[ref] [n] PFXDICTSWITCH",s - s' s'' or s,,Combines `[n] DICTPUSHCONST` for `0 <= n <= 1023` with `PFXDICTGETJMP`.
+DICTIGETJMPZ,,#F4BC,dict_special,F4BC,DICTIGETJMPZ,i D n - i or nothing,,A variant of `DICTIGETJMP` that returns index `i` on failure.
+DICTUGETJMPZ,,#F4BD,dict_special,F4BD,DICTUGETJMPZ,i D n - i or nothing,,A variant of `DICTUGETJMP` that returns index `i` on failure.
+DICTIGETEXECZ,,#F4BE,dict_special,F4BE,DICTIGETEXECZ,i D n - i or nothing,,A variant of `DICTIGETEXEC` that returns index `i` on failure.
+DICTUGETEXECZ,,#F4BF,dict_special,F4BF,DICTUGETEXECZ,i D n - i or nothing,,A variant of `DICTUGETEXEC` that returns index `i` on failure.
+SUBDICTGET,,#F4B1,dict_sub,F4B1,SUBDICTGET,k l D n - D',,"Constructs a subdictionary consisting of all keys beginning with prefix `k` (represented by a _Slice_, the first `0 <= l <= n <= 1023` data bits of which are used as a key) of length `l` in dictionary `D` of type `HashmapE(n,X)` with `n`-bit keys. On success, returns the new subdictionary of the same type `HashmapE(n,X)` as a _Slice_ `D'`."
+SUBDICTIGET,,#F4B2,dict_sub,F4B2,SUBDICTIGET,x l D n - D',,"Variant of `SUBDICTGET` with the prefix represented by a signed big-endian `l`-bit _Integer_ `x`, where necessarily `l <= 257`."
+SUBDICTUGET,,#F4B3,dict_sub,F4B3,SUBDICTUGET,x l D n - D',,"Variant of `SUBDICTGET` with the prefix represented by an unsigned big-endian `l`-bit _Integer_ `x`, where necessarily `l <= 256`."
+SUBDICTRPGET,,#F4B5,dict_sub,F4B5,SUBDICTRPGET,k l D n - D',,"Similar to `SUBDICTGET`, but removes the common prefix `k` from all keys of the new dictionary `D'`, which becomes of type `HashmapE(n-l,X)`."
+SUBDICTIRPGET,,#F4B6,dict_sub,F4B6,SUBDICTIRPGET,x l D n - D',,"Variant of `SUBDICTRPGET` with the prefix represented by a signed big-endian `l`-bit _Integer_ `x`, where necessarily `l <= 257`."
+SUBDICTURPGET,,#F4B7,dict_sub,F4B7,SUBDICTURPGET,x l D n - D',,"Variant of `SUBDICTRPGET` with the prefix represented by an unsigned big-endian `l`-bit _Integer_ `x`, where necessarily `l <= 256`."
+ACCEPT,,#F800,app_gas,F800,ACCEPT,-,26,"Sets current gas limit `g_l` to its maximal allowed value `g_m`, and resets the gas credit `g_c` to zero, decreasing the value of `g_r` by `g_c` in the process.
+In other words, the current smart contract agrees to buy some gas to finish the current transaction. This action is required to process external messages, which bring no value (hence no gas) with themselves."
+SETGASLIMIT,,#F801,app_gas,F801,SETGASLIMIT,g - ,26,"Sets current gas limit `g_l` to the minimum of `g` and `g_m`, and resets the gas credit `g_c` to zero. If the gas consumed so far (including the present instruction) exceeds the resulting value of `g_l`, an (unhandled) out of gas exception is thrown before setting new gas limits. Notice that `SETGASLIMIT` with an argument `g >= 2^63-1` is equivalent to `ACCEPT`."
+COMMIT,,#F80F,app_gas,F80F,COMMIT,-,26,Commits the current state of registers `c4` (“persistent data'') and `c5` (“actions'') so that the current execution is considered “successful'' with the saved values even if an exception is thrown later.
+RANDU256,,#F810,app_rnd,F810,RANDU256,- x,26+|c7|+|c1_1|,"Generates a new pseudo-random unsigned 256-bit _Integer_ `x`. The algorithm is as follows: if `r` is the old value of the random seed, considered as a 32-byte array (by constructing the big-endian representation of an unsigned 256-bit integer), then its `sha512(r)` is computed; the first 32 bytes of this hash are stored as the new value `r'` of the random seed, and the remaining 32 bytes are returned as the next random value `x`."
+RAND,,#F811,app_rnd,F811,RAND,y - z,26+|c7|+|c1_1|,"Generates a new pseudo-random integer `z` in the range `0...y-1` (or `y...-1`, if `y<0`). More precisely, an unsigned random value `x` is generated as in `RAND256U`; then `z:=floor(x*y/2^256)` is computed.
+Equivalent to `RANDU256` `256 MULRSHIFT`."
+SETRAND,,#F814,app_rnd,F814,SETRAND,x - ,26+|c7|+|c1_1|,Sets the random seed to unsigned 256-bit _Integer_ `x`.
+ADDRAND,,#F815,app_rnd,F815,"ADDRAND
+RANDOMIZE",x - ,26,"Mixes unsigned 256-bit _Integer_ `x` into the random seed `r` by setting the random seed to `Sha` of the concatenation of two 32-byte strings: the first with the big-endian representation of the old seed `r`, and the second with the big-endian representation of `x`."
+GETPARAM,,#F82 i:uint4,app_config,F82i,[i] GETPARAM, - x,26,"Returns the `i`-th parameter from the _Tuple_ provided at `c7` for `0 <= i <= 15`. Equivalent to `c7 PUSHCTR` `FIRST` `[i] INDEX`.
+If one of these internal operations fails, throws an appropriate type checking or range checking exception."
+NOW,GETPARAM,#F823,app_config,F823,NOW, - x,26,"Returns the current Unix time as an _Integer_. If it is impossible to recover the requested value starting from `c7`, throws a type checking or range checking exception as appropriate.
+Equivalent to `3 GETPARAM`."
+BLOCKLT,GETPARAM,#F824,app_config,F824,BLOCKLT, - x,26,"Returns the starting logical time of the current block.
+Equivalent to `4 GETPARAM`."
+LTIME,GETPARAM,#F825,app_config,F825,LTIME, - x,26,"Returns the logical time of the current transaction.
+Equivalent to `5 GETPARAM`."
+RANDSEED,GETPARAM,#F826,app_config,F826,RANDSEED, - x,26,"Returns the current random seed as an unsigned 256-bit _Integer_.
+Equivalent to `6 GETPARAM`."
+BALANCE,GETPARAM,#F827,app_config,F827,BALANCE, - t,26,"Returns the remaining balance of the smart contract as a _Tuple_ consisting of an _Integer_ (the remaining Gram balance in nanograms) and a _Maybe Cell_ (a dictionary with 32-bit keys representing the balance of “extra currencies'').
+Equivalent to `7 GETPARAM`.
+Note that `RAW` primitives such as `SENDRAWMSG` do not update this field."
+MYADDR,GETPARAM,#F828,app_config,F828,MYADDR, - s,26,"Returns the internal address of the current smart contract as a _Slice_ with a `MsgAddressInt`. If necessary, it can be parsed further using primitives such as `PARSEMSGADDR` or `REWRITESTDADDR`.
+Equivalent to `8 GETPARAM`."
+CONFIGROOT,GETPARAM,#F829,app_config,F829,CONFIGROOT, - D,26,Returns the _Maybe Cell_ `D` with the current global configuration dictionary. Equivalent to `9 GETPARAM `.
+CONFIGDICT,,#F830,app_config,F830,CONFIGDICT, - D 32,26,"Returns the global configuration dictionary along with its key length (32).
+Equivalent to `CONFIGROOT` `32 PUSHINT`."
+CONFIGPARAM,,#F832,app_config,F832,CONFIGPARAM,i - c -1 or 0,,"Returns the value of the global configuration parameter with integer index `i` as a _Cell_ `c`, and a flag to indicate success.
+Equivalent to `CONFIGDICT` `DICTIGETREF`."
+CONFIGOPTPARAM,,#F833,app_config,F833,CONFIGOPTPARAM,i - c^?,,"Returns the value of the global configuration parameter with integer index `i` as a _Maybe Cell_ `c^?`.
+Equivalent to `CONFIGDICT` `DICTIGETOPTREF`."
+GETGLOBVAR,,#F840,app_global,F840,GETGLOBVAR,k - x,26,"Returns the `k`-th global variable for `0 <= k < 255`.
+Equivalent to `c7 PUSHCTR` `SWAP` `INDEXVARQ`."
+GETGLOB,,#F85_ k:(## 5) {1 <= k},app_global,F85_k,[k] GETGLOB, - x,26,"Returns the `k`-th global variable for `1 <= k <= 31`.
+Equivalent to `c7 PUSHCTR` `[k] INDEXQ`."
+SETGLOBVAR,,#F860,app_global,F860,SETGLOBVAR,x k - ,26+|c7’|,"Assigns `x` to the `k`-th global variable for `0 <= k < 255`.
+Equivalent to `c7 PUSHCTR` `ROTREV` `SETINDEXVARQ` `c7 POPCTR`."
+SETGLOB,,#F87_ k:(## 5) {1 <= k},app_global,F87_k,[k] SETGLOB,x - ,26+|c7’|,"Assigns `x` to the `k`-th global variable for `1 <= k <= 31`.
+Equivalent to `c7 PUSHCTR` `SWAP` `k SETINDEXQ` `c7 POPCTR`."
+HASHCU,,#F900,app_crypto,F900,HASHCU,c - x,26,Computes the representation hash of a _Cell_ `c` and returns it as a 256-bit unsigned integer `x`. Useful for signing and checking signatures of arbitrary entities represented by a tree of cells.
+HASHSU,,#F901,app_crypto,F901,HASHSU,s - x,526,Computes the hash of a _Slice_ `s` and returns it as a 256-bit unsigned integer `x`. The result is the same as if an ordinary cell containing only data and references from `s` had been created and its hash computed by `HASHCU`.
+SHA256U,,#F902,app_crypto,F902,SHA256U,s - x,26,"Computes `Sha` of the data bits of _Slice_ `s`. If the bit length of `s` is not divisible by eight, throws a cell underflow exception. The hash value is returned as a 256-bit unsigned integer `x`."
+CHKSIGNU,,#F910,app_crypto,F910,CHKSIGNU,h s k - ?,26,"Checks the Ed25519-signature `s` of a hash `h` (a 256-bit unsigned integer, usually computed as the hash of some data) using public key `k` (also represented by a 256-bit unsigned integer).
+The signature `s` must be a _Slice_ containing at least 512 data bits; only the first 512 bits are used. The result is `-1` if the signature is valid, `0` otherwise.
+Notice that `CHKSIGNU` is equivalent to `ROT` `NEWC` `256 STU` `ENDC` `ROTREV` `CHKSIGNS`, i.e., to `CHKSIGNS` with the first argument `d` set to 256-bit _Slice_ containing `h`. Therefore, if `h` is computed as the hash of some data, these data are hashed _twice_, the second hashing occurring inside `CHKSIGNS`."
+CHKSIGNS,,#F911,app_crypto,F911,CHKSIGNS,d s k - ?,26,"Checks whether `s` is a valid Ed25519-signature of the data portion of _Slice_ `d` using public key `k`, similarly to `CHKSIGNU`. If the bit length of _Slice_ `d` is not divisible by eight, throws a cell underflow exception. The verification of Ed25519 signatures is the standard one, with `Sha` used to reduce `d` to the 256-bit number that is actually signed."
+CDATASIZEQ,,#F940,app_misc,F940,CDATASIZEQ,c n - x y z -1 or 0,,"Recursively computes the count of distinct cells `x`, data bits `y`, and cell references `z` in the dag rooted at _Cell_ `c`, effectively returning the total storage used by this dag taking into account the identification of equal cells. The values of `x`, `y`, and `z` are computed by a depth-first traversal of this dag, with a hash table of visited cell hashes used to prevent visits of already-visited cells. The total count of visited cells `x` cannot exceed non-negative _Integer_ `n`; otherwise the computation is aborted before visiting the `(n+1)`-st cell and a zero is returned to indicate failure. If `c` is _Null_, returns `x=y=z=0`."
+CDATASIZE,,#F941,app_misc,F941,CDATASIZE,c n - x y z,,A non-quiet version of `CDATASIZEQ` that throws a cell overflow exception (8) on failure.
+SDATASIZEQ,,#F942,app_misc,F942,SDATASIZEQ,s n - x y z -1 or 0,,"Similar to `CDATASIZEQ`, but accepting a _Slice_ `s` instead of a _Cell_. The returned value of `x` does not take into account the cell that contains the slice `s` itself; however, the data bits and the cell references of `s` are accounted for in `y` and `z`."
+SDATASIZE,,#F943,app_misc,F943,SDATASIZE,s n - x y z,,A non-quiet version of `SDATASIZEQ` that throws a cell overflow exception (8) on failure.
+LDGRAMS,,#FA00,app_currency,FA00,"LDGRAMS
+LDVARUINT16",s - x s',26,"Loads (deserializes) a `Gram` or `VarUInteger 16` amount from _Slice_ `s`, and returns the amount as _Integer_ `x` along with the remainder `s'` of `s`. The expected serialization of `x` consists of a 4-bit unsigned big-endian integer `l`, followed by an `8l`-bit unsigned big-endian representation of `x`.
+The net effect is approximately equivalent to `4 LDU` `SWAP` `3 LSHIFT#` `LDUX`."
+LDVARINT16,,#FA01,app_currency,FA01,LDVARINT16,s - x s',26,"Similar to `LDVARUINT16`, but loads a _signed_ _Integer_ `x`.
+Approximately equivalent to `4 LDU` `SWAP` `3 LSHIFT#` `LDIX`."
+STGRAMS,,#FA02,app_currency,FA02,"STGRAMS
+STVARUINT16",b x - b',26,"Stores (serializes) an _Integer_ `x` in the range `0...2^120-1` into _Builder_ `b`, and returns the resulting _Builder_ `b'`. The serialization of `x` consists of a 4-bit unsigned big-endian integer `l`, which is the smallest integer `l>=0`, such that `x<2^(8l)`, followed by an `8l`-bit unsigned big-endian representation of `x`. If `x` does not belong to the supported range, a range check exception is thrown."
+STVARINT16,,#FA03,app_currency,FA03,STVARINT16,b x - b',26,"Similar to `STVARUINT16`, but serializes a _signed_ _Integer_ `x` in the range `-2^119...2^119-1`."
+LDMSGADDR,,#FA40,app_addr,FA40,LDMSGADDR,s - s' s'',26,"Loads from _Slice_ `s` the only prefix that is a valid `MsgAddress`, and returns both this prefix `s'` and the remainder `s''` of `s` as slices."
+LDMSGADDRQ,,#FA41,app_addr,FA41,LDMSGADDRQ,s - s' s'' -1 or s 0,26,"A quiet version of `LDMSGADDR`: on success, pushes an extra `-1`; on failure, pushes the original `s` and a zero."
+PARSEMSGADDR,,#FA42,app_addr,FA42,PARSEMSGADDR,s - t,26,"Decomposes _Slice_ `s` containing a valid `MsgAddress` into a _Tuple_ `t` with separate fields of this `MsgAddress`. If `s` is not a valid `MsgAddress`, a cell deserialization exception is thrown."
+PARSEMSGADDRQ,,#FA43,app_addr,FA43,PARSEMSGADDRQ,s - t -1 or 0,26,A quiet version of `PARSEMSGADDR`: returns a zero on error instead of throwing an exception.
+REWRITESTDADDR,,#FA44,app_addr,FA44,REWRITESTDADDR,s - x y,26,"Parses _Slice_ `s` containing a valid `MsgAddressInt` (usually a `msg_addr_std`), applies rewriting from the `anycast` (if present) to the same-length prefix of the address, and returns both the workchain `x` and the 256-bit address `y` as integers. If the address is not 256-bit, or if `s` is not a valid serialization of `MsgAddressInt`, throws a cell deserialization exception."
+REWRITESTDADDRQ,,#FA45,app_addr,FA45,REWRITESTDADDRQ,s - x y -1 or 0,26,A quiet version of primitive `REWRITESTDADDR`.
+REWRITEVARADDR,,#FA46,app_addr,FA46,REWRITEVARADDR,s - x s',26,"A variant of `REWRITESTDADDR` that returns the (rewritten) address as a _Slice_ `s`, even if it is not exactly 256 bit long (represented by a `msg_addr_var`)."
+REWRITEVARADDRQ,,#FA47,app_addr,FA47,REWRITEVARADDRQ,s - x s' -1 or 0,26,A quiet version of primitive `REWRITEVARADDR`.
+SENDRAWMSG,,#FB00,app_actions,FB00,SENDRAWMSG,c x - ,526,"Sends a raw message contained in _Cell `c`_, which should contain a correctly serialized object `Message X`, with the only exception that the source address is allowed to have dummy value `addr_none` (to be automatically replaced with the current smart-contract address), and `ihr_fee`, `fwd_fee`, `created_lt` and `created_at` fields can have arbitrary values (to be rewritten with correct values during the action phase of the current transaction). Integer parameter `x` contains the flags. Currently `x=0` is used for ordinary messages; `x=128` is used for messages that are to carry all the remaining balance of the current smart contract (instead of the value originally indicated in the message); `x=64` is used for messages that carry all the remaining value of the inbound message in addition to the value initially indicated in the new message (if bit 0 is not set, the gas fees are deducted from this amount); `x'=x+1` means that the sender wants to pay transfer fees separately; `x'=x+2` means that any errors arising while processing this message during the action phase should be ignored. Finally, `x'=x+32` means that the current account must be destroyed if its resulting balance is zero. This flag is usually employed together with `+128`."
+RAWRESERVE,,#FB02,app_actions,FB02,RAWRESERVE,x y - ,526,"Creates an output action which would reserve exactly `x` nanograms (if `y=0`), at most `x` nanograms (if `y=2`), or all but `x` nanograms (if `y=1` or `y=3`), from the remaining balance of the account. It is roughly equivalent to creating an outbound message carrying `x` nanograms (or `b-x` nanograms, where `b` is the remaining balance) to oneself, so that the subsequent output actions would not be able to spend more money than the remainder. Bit `+2` in `y` means that the external action does not fail if the specified amount cannot be reserved; instead, all remaining balance is reserved. Bit `+8` in `y` means `x:=-x` before performing any further actions. Bit `+4` in `y` means that `x` is increased by the original balance of the current account (before the compute phase), including all extra currencies, before performing any other checks and actions. Currently `x` must be a non-negative integer, and `y` must be in the range `0...15`."
+RAWRESERVEX,,#FB03,app_actions,FB03,RAWRESERVEX,x D y - ,526,"Similar to `RAWRESERVE`, but also accepts a dictionary `D` (represented by a _Cell_ or _Null_) with extra currencies. In this way currencies other than Grams can be reserved."
+SETCODE,,#FB04,app_actions,FB04,SETCODE,c - ,526,Creates an output action that would change this smart contract code to that given by _Cell_ `c`. Notice that this change will take effect only after the successful termination of the current run of the smart contract.
+SETLIBCODE,,#FB06,app_actions,FB06,SETLIBCODE,c x - ,526,"Creates an output action that would modify the collection of this smart contract libraries by adding or removing library with code given in _Cell_ `c`. If `x=0`, the library is actually removed if it was previously present in the collection (if not, this action does nothing). If `x=1`, the library is added as a private library, and if `x=2`, the library is added as a public library (and becomes available to all smart contracts if the current smart contract resides in the masterchain); if the library was present in the collection before, its public/private status is changed according to `x`. Values of `x` other than `0...2` are invalid."
+CHANGELIB,,#FB07,app_actions,FB07,CHANGELIB,h x - ,526,"Creates an output action similarly to `SETLIBCODE`, but instead of the library code accepts its hash as an unsigned 256-bit integer `h`. If `x!=0` and the library with hash `h` is absent from the library collection of this smart contract, this output action will fail."
+DEBUG,,#FE nn:(#<= 239),debug,FEnn,{nn} DEBUG,-,26,`0 <= nn < 240`
+DEBUGSTR,,#FEF n:(## 4) ssss:((n * 8 + 8) * Bit),debug,FEFnssss,"{string} DEBUGSTR
+{string} {x} DEBUGSTRI",-,26,"`0 <= n < 16`. Length of `ssss` is `n+1` bytes.
+`{string}` is a [string literal](https://github.com/Piterden/TON-docs/blob/master/Fift.%20A%20Brief%20Introduction.md#user-content-29-string-literals).
+`DEBUGSTR`: `ssss` is the given string.
+`DEBUGSTRI`: `ssss` is one-byte integer `0 <= x <= 255` followed by the given string."
+DUMPSTK,DEBUG,#FE00,debug,FE00,DUMPSTK,-,26,Dumps the stack (at most the top 255 values) and shows the total stack depth.
+DUMP,DEBUG,#FE2 i:uint4,debug,FE2i,s[i] DUMP,-,26,Dumps `s[i]`.
+SETCP,,#FF nn:(#<= 239),codepage,FFnn,[nn] SETCP,-,26,"Selects TVM codepage `0 <= nn < 240`. If the codepage is not supported, throws an invalid opcode exception."
+SETCP0,SETCP,#FF00,codepage,FF00,SETCP0,-,26,Selects TVM (test) codepage zero as described in this document.
+SETCP_SPECIAL,,#FFF z:(## 4) {1 <= z},codepage,FFFz,[z-16] SETCP,-,26,"Selects TVM codepage `z-16` for `1 <= z <= 15`. Negative codepages `-13...-1` are reserved for restricted versions of TVM needed to validate runs of TVM in other codepages. Negative codepage `-14` is reserved for experimental codepages, not necessarily compatible between different TVM implementations, and should be disabled in the production versions of TVM."
+SETCPX,,#FFF0,codepage,FFF0,SETCPX,c - ,26,Selects codepage `c` with `-2^15 <= c < 2^15` passed in the top of the stack.
diff --git a/versioned_docs/version-1.0.0/learn/tvm-instructions/instructions.md b/versioned_docs/version-1.0.0/learn/tvm-instructions/instructions.md
new file mode 100644
index 0000000000..e97560ffc9
--- /dev/null
+++ b/versioned_docs/version-1.0.0/learn/tvm-instructions/instructions.md
@@ -0,0 +1,956 @@
+# TVM Instructions
+
+:::caution advanced level
+This information is **very low level** and could be hard to understand for newcomers.
+So feel free to read about it later.
+:::
+
+## 1 Introduction
+This document provides a list of TVM instrucions, their opcodes and mnemonics.
+
+:::tip
+[**Here**](https://ton-blockchain.github.io/tvm.pdf) is a full description of TON Virtual Machine.
+:::
+
+Fift is a stack-based programming language designed to manage TON smart contracts. The Fift assembler is a Fift library that converts mnemonics of TVM instructions to their binary representation.
+
+A description of Fift, including the introduction to the Fift assembler, can be found [here](https://github.com/Piterden/TON-docs/blob/master/Fift.%20A%20Brief%20Introduction.md).
+
+This document specifies the corresponding mnemonic for each instruction. Note the following:
+
+1. Fift is a stack-based language, therefore all arguments of an instruction are written before it (e.g. [`5 PUSHINT`](#instr-pushint-4), [`s0 s4 XCHG`](#instr-xchg-ij)).
+2. Stack registers are denoted by `s0, s1, ..., s15`. Other stack registers (up to 255) are denoted by `i s()` (e.g. `100 s()`).
+3. Control registers are denoted by `c0, c1, ..., c15`.
+
+### 1.1 Gas prices
+The gas price of each instruction is specified in this document. The basic gas price of an instruction is `10 + b`, where `b` is the instruction length in bits. Some operations have additional fees:
+1. _Parsing cells_: Transforming a cell into a slice costs **100 gas units** if the cell is loading for the first time and **25** for subsequent loads during the same transaction. For such instructions, two gas prices are specified (e.g. [`CTOS`](#instr-ctos): `118/43`).
+2. _Cell creation_: **500 gas units**.
+3. _Throwing exceptions_: **50 gas units**. In this document the exception fee is only specified for an instruction if its primary purpose is to throw (e.g. [`THROWIF`](#instr-throwif-short), [`FITS`](#instr-fits)). If the instruction only throws in some cases, two gas prices are specified (e.g. [`FITS`](#instr-fits): `26/76`).
+4. _Tuple creation_: **1 gas unit** for every tuple element.
+5. _Implicit jumps_: **10 gas units** for an implicit jump, **5 gas units** for an implicit back jump. This fee is not a part of any instruction.
+6. _Moving stack elements between continuations_: **1 gas unit** per element, however first 32 elements moving is free.
+
+### 1.2 CSV table
+Machine-readable list of TVM instructions is available [here](https://github.com/ton-blockchain/blob/master/smart-contracts/tvm-instructions/instructions.csv).
+
+## 2 Stack manipulation primitives
+Here `0 <= i,j,k <= 15` if not stated otherwise.
+
+### 2.1 Basic stack manipulation primitives
+| xxxxxxx
Opcode | xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Fift syntax | xxxxxxxxxxxxxxxxx
Stack | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Description | xxxx
Gas |
+|:-|:-|:-|:-|:-|
+| **`00`** | `NOP` | _`-`_ | Does nothing. | `18` |
+| **`01`** | `SWAP` | _`x y - y x`_ | Same as [`s1 XCHG0`](#instr-xchg-0i). | `18` |
+| **`0i`** | `s[i] XCHG0` | | Interchanges `s0` with `s[i]`, `1 <= i <= 15`. | `18` |
+| **`10ij`** | `s[i] s[j] XCHG` | | Interchanges `s[i]` with `s[j]`, `1 <= i < j <= 15`. | `26` |
+| **`11ii`** | `s0 [ii] s() XCHG` | | Interchanges `s0` with `s[ii]`, `0 <= ii <= 255`. | `26` |
+| **`1i`** | `s1 s[i] XCHG` | | Interchanges `s1` with `s[i]`, `2 <= i <= 15`. | `18` |
+| **`2i`** | `s[i] PUSH` | | Pushes a copy of the old `s[i]` into the stack. | `18` |
+| **`20`** | `DUP` | _`x - x x`_ | Same as [`s0 PUSH`](#instr-push). | `18` |
+| **`21`** | `OVER` | _`x y - x y x`_ | Same as [`s1 PUSH`](#instr-push). | `18` |
+| **`3i`** | `s[i] POP` | | Pops the old `s0` value into the old `s[i]`. | `18` |
+| **`30`** | `DROP` | _`x -`_ | Same as [`s0 POP`](#instr-pop), discards the top-of-stack value. | `18` |
+| **`31`** | `NIP` | _`x y - y`_ | Same as [`s1 POP`](#instr-pop). | `18` |
+### 2.2 Complex stack manipulation primitives
+| xxxxxxx
Opcode | xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Fift syntax | xxxxxxxxxxxxxxxxx
Stack | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Description | xxxx
Gas |
+|:-|:-|:-|:-|:-|
+| **`4ijk`** | `s[i] s[j] s[k] XCHG3` | | Equivalent to [`s2 s[i] XCHG`](#instr-xchg-ij) [`s1 s[j] XCHG`](#instr-xchg-ij) [`s[k] XCHG0`](#instr-xchg-0i). | `26` |
+| **`50ij`** | `s[i] s[j] XCHG2` | | Equivalent to [`s1 s[i] XCHG`](#instr-xchg-ij) [`s[j] XCHG0`](#instr-xchg-0i). | `26` |
+| **`51ij`** | `s[i] s[j] XCPU` | | Equivalent to [`s[i] XCHG0`](#instr-xchg-0i) [`s[j] PUSH`](#instr-push). | `26` |
+| **`52ij`** | `s[i] s[j-1] PUXC` | | Equivalent to [`s[i] PUSH`](#instr-push) [`SWAP`](#instr-swap) [`s[j] XCHG0`](#instr-xchg-0i). | `26` |
+| **`53ij`** | `s[i] s[j] PUSH2` | | Equivalent to [`s[i] PUSH`](#instr-push) [`s[j+1] PUSH`](#instr-push). | `26` |
+| **`540ijk`** | `s[i] s[j] s[k] XCHG3_l` | | Long form of [`XCHG3`](#instr-xchg3). | `34` |
+| **`541ijk`** | `s[i] s[j] s[k] XC2PU` | | Equivalent to [`s[i] s[j] XCHG2`](#instr-xchg2) [`s[k] PUSH`](#instr-push). | `34` |
+| **`542ijk`** | `s[i] s[j] s[k-1] XCPUXC` | | Equivalent to [`s1 s[i] XCHG`](#instr-xchg-ij) [`s[j] s[k-1] PUXC`](#instr-puxc). | `34` |
+| **`543ijk`** | `s[i] s[j] s[k] XCPU2` | | Equivalent to [`s[i] XCHG0`](#instr-xchg-0i) [`s[j] s[k] PUSH2`](#instr-push2). | `34` |
+| **`544ijk`** | `s[i] s[j-1] s[k-1] PUXC2` | | Equivalent to [`s[i] PUSH`](#instr-push) [`s2 XCHG0`](#instr-xchg-0i) [`s[j] s[k] XCHG2`](#instr-xchg2). | `34` |
+| **`545ijk`** | `s[i] s[j-1] s[k-1] PUXCPU` | | Equivalent to [`s[i] s[j-1] PUXC`](#instr-puxc) [`s[k] PUSH`](#instr-push). | `34` |
+| **`546ijk`** | `s[i] s[j-1] s[k-2] PU2XC` | | Equivalent to [`s[i] PUSH`](#instr-push) [`SWAP`](#instr-swap) [`s[j] s[k-1] PUXC`](#instr-puxc). | `34` |
+| **`547ijk`** | `s[i] s[j] s[k] PUSH3` | | Equivalent to [`s[i] PUSH`](#instr-push) [`s[j+1] s[k+1] PUSH2`](#instr-push2). | `34` |
+| **`55ij`** | `[i+1] [j+1] BLKSWAP` | | Permutes two blocks `s[j+i+1] … s[j+1]` and `s[j] … s0`.
`0 <= i,j <= 15`
Equivalent to [`[i+1] [j+1] REVERSE`](#instr-reverse) [`[j+1] 0 REVERSE`](#instr-reverse) [`[i+j+2] 0 REVERSE`](#instr-reverse). | `26` |
+| **`5513`** | `ROT2`
`2ROT` | _`a b c d e f - c d e f a b`_ | Rotates the three topmost pairs of stack entries. | `26` |
+| **`550i`** | `[i+1] ROLL` | | Rotates the top `i+1` stack entries.
Equivalent to [`1 [i+1] BLKSWAP`](#instr-blkswap). | `26` |
+| **`55i0`** | `[i+1] -ROLL`
`[i+1] ROLLREV` | | Rotates the top `i+1` stack entries in the other direction.
Equivalent to [`[i+1] 1 BLKSWAP`](#instr-blkswap). | `26` |
+| **`56ii`** | `[ii] s() PUSH` | | Pushes a copy of the old `s[ii]` into the stack.
`0 <= ii <= 255` | `26` |
+| **`57ii`** | `[ii] s() POP` | | Pops the old `s0` value into the old `s[ii]`.
`0 <= ii <= 255` | `26` |
+| **`58`** | `ROT` | _`a b c - b c a`_ | Equivalent to [`1 2 BLKSWAP`](#instr-blkswap) or to [`s2 s1 XCHG2`](#instr-xchg2). | `18` |
+| **`59`** | `ROTREV`
`-ROT` | _`a b c - c a b`_ | Equivalent to [`2 1 BLKSWAP`](#instr-blkswap) or to [`s2 s2 XCHG2`](#instr-xchg2). | `18` |
+| **`5A`** | `SWAP2`
`2SWAP` | _`a b c d - c d a b`_ | Equivalent to [`2 2 BLKSWAP`](#instr-blkswap) or to [`s3 s2 XCHG2`](#instr-xchg2). | `18` |
+| **`5B`** | `DROP2`
`2DROP` | _`a b - `_ | Equivalent to [`DROP`](#instr-drop) [`DROP`](#instr-drop). | `18` |
+| **`5C`** | `DUP2`
`2DUP` | _`a b - a b a b`_ | Equivalent to [`s1 s0 PUSH2`](#instr-push2). | `18` |
+| **`5D`** | `OVER2`
`2OVER` | _`a b c d - a b c d a b`_ | Equivalent to [`s3 s2 PUSH2`](#instr-push2). | `18` |
+| **`5Eij`** | `[i+2] [j] REVERSE` | | Reverses the order of `s[j+i+1] … s[j]`. | `26` |
+| **`5F0i`** | `[i] BLKDROP` | | Equivalent to [`DROP`](#instr-drop) performed `i` times. | `26` |
+| **`5Fij`** | `[i] [j] BLKPUSH` | | Equivalent to `PUSH s(j)` performed `i` times.
`1 <= i <= 15`, `0 <= j <= 15`. | `26` |
+| **`60`** | `PICK`
`PUSHX` | | Pops integer `i` from the stack, then performs [`s[i] PUSH`](#instr-push). | `18` |
+| **`61`** | `ROLLX` | | Pops integer `i` from the stack, then performs [`1 [i] BLKSWAP`](#instr-blkswap). | `18` |
+| **`62`** | `-ROLLX`
`ROLLREVX` | | Pops integer `i` from the stack, then performs [`[i] 1 BLKSWAP`](#instr-blkswap). | `18` |
+| **`63`** | `BLKSWX` | | Pops integers `i`,`j` from the stack, then performs [`[i] [j] BLKSWAP`](#instr-blkswap). | `18` |
+| **`64`** | `REVX` | | Pops integers `i`,`j` from the stack, then performs [`[i] [j] REVERSE`](#instr-reverse). | `18` |
+| **`65`** | `DROPX` | | Pops integer `i` from the stack, then performs [`[i] BLKDROP`](#instr-blkdrop). | `18` |
+| **`66`** | `TUCK` | _`a b - b a b`_ | Equivalent to [`SWAP`](#instr-swap) [`OVER`](#instr-over) or to [`s1 s1 XCPU`](#instr-xcpu). | `18` |
+| **`67`** | `XCHGX` | | Pops integer `i` from the stack, then performs [`s[i] XCHG`](#instr-xchg-ij). | `18` |
+| **`68`** | `DEPTH` | _`- depth`_ | Pushes the current depth of the stack. | `18` |
+| **`69`** | `CHKDEPTH` | _`i -`_ | Pops integer `i` from the stack, then checks whether there are at least `i` elements, generating a stack underflow exception otherwise. | `18/58` |
+| **`6A`** | `ONLYTOPX` | | Pops integer `i` from the stack, then removes all but the top `i` elements. | `18` |
+| **`6B`** | `ONLYX` | | Pops integer `i` from the stack, then leaves only the bottom `i` elements. Approximately equivalent to [`DEPTH`](#instr-depth) [`SWAP`](#instr-swap) [`SUB`](#instr-sub) [`DROPX`](#instr-dropx). | `18` |
+| **`6Cij`** | `[i] [j] BLKDROP2` | | Drops `i` stack elements under the top `j` elements.
`1 <= i <= 15`, `0 <= j <= 15`
Equivalent to [`[i+j] 0 REVERSE`](#instr-reverse) [`[i] BLKDROP`](#instr-blkdrop) [`[j] 0 REVERSE`](#instr-reverse). | `26` |
+
+## 3 Tuple, List, and Null primitives
+| xxxxxxx
Opcode | xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Fift syntax | xxxxxxxxxxxxxxxxx
Stack | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Description | xxxx
Gas |
+|:-|:-|:-|:-|:-|
+| **`6D`** | `NULL`
`PUSHNULL` | _` - null`_ | Pushes the only value of type _Null_. | `18` |
+| **`6E`** | `ISNULL` | _`x - ?`_ | Checks whether `x` is a _Null_, and returns `-1` or `0` accordingly. | `18` |
+| **`6F0n`** | `[n] TUPLE` | _`x_1 ... x_n - t`_ | Creates a new _Tuple_ `t=(x_1, … ,x_n)` containing `n` values `x_1`,..., `x_n`.
`0 <= n <= 15` | `26+n` |
+| **`6F00`** | `NIL` | _`- t`_ | Pushes the only _Tuple_ `t=()` of length zero. | `26` |
+| **`6F01`** | `SINGLE` | _`x - t`_ | Creates a singleton `t:=(x)`, i.e., a _Tuple_ of length one. | `27` |
+| **`6F02`** | `PAIR`
`CONS` | _`x y - t`_ | Creates pair `t:=(x,y)`. | `28` |
+| **`6F03`** | `TRIPLE` | _`x y z - t`_ | Creates triple `t:=(x,y,z)`. | `29` |
+| **`6F1k`** | `[k] INDEX` | _`t - x`_ | Returns the `k`-th element of a _Tuple_ `t`.
`0 <= k <= 15`. | `26` |
+| **`6F10`** | `FIRST`
`CAR` | _`t - x`_ | Returns the first element of a _Tuple_. | `26` |
+| **`6F11`** | `SECOND`
`CDR` | _`t - y`_ | Returns the second element of a _Tuple_. | `26` |
+| **`6F12`** | `THIRD` | _`t - z`_ | Returns the third element of a _Tuple_. | `26` |
+| **`6F2n`** | `[n] UNTUPLE` | _`t - x_1 ... x_n`_ | Unpacks a _Tuple_ `t=(x_1,...,x_n)` of length equal to `0 <= n <= 15`.
If `t` is not a _Tuple_, or if `\|t\| != n`, a type check exception is thrown. | `26+n` |
+| **`6F21`** | `UNSINGLE` | _`t - x`_ | Unpacks a singleton `t=(x)`. | `27` |
+| **`6F22`** | `UNPAIR`
`UNCONS` | _`t - x y`_ | Unpacks a pair `t=(x,y)`. | `28` |
+| **`6F23`** | `UNTRIPLE` | _`t - x y z`_ | Unpacks a triple `t=(x,y,z)`. | `29` |
+| **`6F3k`** | `[k] UNPACKFIRST` | _`t - x_1 ... x_k`_ | Unpacks first `0 <= k <= 15` elements of a _Tuple_ `t`.
If `\|t\|`0 <= k <= 15`
If `k >= \|t\|`, throws a range check exception. | `26+\|t\|` |
+| **`6F50`** | `SETFIRST` | _`t x - t'`_ | Sets the first component of _Tuple_ `t` to `x` and returns the resulting _Tuple_ `t'`. | `26+\|t\|` |
+| **`6F51`** | `SETSECOND` | _`t x - t'`_ | Sets the second component of _Tuple_ `t` to `x` and returns the resulting _Tuple_ `t'`. | `26+\|t\|` |
+| **`6F52`** | `SETTHIRD` | _`t x - t'`_ | Sets the third component of _Tuple_ `t` to `x` and returns the resulting _Tuple_ `t'`. | `26+\|t\|` |
+| **`6F6k`** | `[k] INDEXQ` | _`t - x`_ | Returns the `k`-th element of a _Tuple_ `t`, where `0 <= k <= 15`. In other words, returns `x_{k+1}` if `t=(x_1,...,x_n)`. If `k>=n`, or if `t` is _Null_, returns a _Null_ instead of `x`. | `26` |
+| **`6F60`** | `FIRSTQ`
`CARQ` | _`t - x`_ | Returns the first element of a _Tuple_. | `26` |
+| **`6F61`** | `SECONDQ`
`CDRQ` | _`t - y`_ | Returns the second element of a _Tuple_. | `26` |
+| **`6F62`** | `THIRDQ` | _`t - z`_ | Returns the third element of a _Tuple_. | `26` |
+| **`6F7k`** | `[k] SETINDEXQ` | _`t x - t'`_ | Sets the `k`-th component of _Tuple_ `t` to `x`, where `0 <= k < 16`, and returns the resulting _Tuple_ `t'`.
If `\|t\| <= k`, first extends the original _Tuple_ to length `n’=k+1` by setting all new components to _Null_. If the original value of `t` is _Null_, treats it as an empty _Tuple_. If `t` is not _Null_ or _Tuple_, throws an exception. If `x` is _Null_ and either `\|t\| <= k` or `t` is _Null_, then always returns `t'=t` (and does not consume tuple creation gas). | `26+\|t’\|` |
+| **`6F70`** | `SETFIRSTQ` | _`t x - t'`_ | Sets the first component of _Tuple_ `t` to `x` and returns the resulting _Tuple_ `t'`. | `26+\|t’\|` |
+| **`6F71`** | `SETSECONDQ` | _`t x - t'`_ | Sets the second component of _Tuple_ `t` to `x` and returns the resulting _Tuple_ `t'`. | `26+\|t’\|` |
+| **`6F72`** | `SETTHIRDQ` | _`t x - t'`_ | Sets the third component of _Tuple_ `t` to `x` and returns the resulting _Tuple_ `t'`. | `26+\|t’\|` |
+| **`6F80`** | `TUPLEVAR` | _`x_1 ... x_n n - t`_ | Creates a new _Tuple_ `t` of length `n` similarly to [`TUPLE`](#instr-tuple), but with `0 <= n <= 255` taken from the stack. | `26+n` |
+| **`6F81`** | `INDEXVAR` | _`t k - x`_ | Similar to [`k INDEX`](#instr-index), but with `0 <= k <= 254` taken from the stack. | `26` |
+| **`6F82`** | `UNTUPLEVAR` | _`t n - x_1 ... x_n`_ | Similar to [`n UNTUPLE`](#instr-untuple), but with `0 <= n <= 255` taken from the stack. | `26+n` |
+| **`6F83`** | `UNPACKFIRSTVAR` | _`t n - x_1 ... x_n`_ | Similar to [`n UNPACKFIRST`](#instr-unpackfirst), but with `0 <= n <= 255` taken from the stack. | `26+n` |
+| **`6F84`** | `EXPLODEVAR` | _`t n - x_1 ... x_m m`_ | Similar to [`n EXPLODE`](#instr-explode), but with `0 <= n <= 255` taken from the stack. | `26+m` |
+| **`6F85`** | `SETINDEXVAR` | _`t x k - t'`_ | Similar to [`k SETINDEX`](#instr-setindex), but with `0 <= k <= 254` taken from the stack. | `26+\|t’\|` |
+| **`6F86`** | `INDEXVARQ` | _`t k - x`_ | Similar to [`n INDEXQ`](#instr-indexq), but with `0 <= k <= 254` taken from the stack. | `26` |
+| **`6F87`** | `SETINDEXVARQ` | _`t x k - t'`_ | Similar to [`k SETINDEXQ`](#instr-setindexq), but with `0 <= k <= 254` taken from the stack. | `26+\|t’\|` |
+| **`6F88`** | `TLEN` | _`t - n`_ | Returns the length of a _Tuple_. | `26` |
+| **`6F89`** | `QTLEN` | _`t - n or -1`_ | Similar to [`TLEN`](#instr-tlen), but returns `-1` if `t` is not a _Tuple_. | `26` |
+| **`6F8A`** | `ISTUPLE` | _`t - ?`_ | Returns `-1` or `0` depending on whether `t` is a _Tuple_. | `26` |
+| **`6F8B`** | `LAST` | _`t - x`_ | Returns the last element of a non-empty _Tuple_ `t`. | `26` |
+| **`6F8C`** | `TPUSH`
`COMMA` | _`t x - t'`_ | Appends a value `x` to a _Tuple_ `t=(x_1,...,x_n)`, but only if the resulting _Tuple_ `t'=(x_1,...,x_n,x)` is of length at most 255. Otherwise throws a type check exception. | `26+\|t’\|` |
+| **`6F8D`** | `TPOP` | _`t - t' x`_ | Detaches the last element `x=x_n` from a non-empty _Tuple_ `t=(x_1,...,x_n)`, and returns both the resulting _Tuple_ `t'=(x_1,...,x_{n-1})` and the original last element `x`. | `26+\|t’\|` |
+| **`6FA0`** | `NULLSWAPIF` | _`x - x or null x`_ | Pushes a _Null_ under the topmost _Integer_ `x`, but only if `x!=0`. | `26` |
+| **`6FA1`** | `NULLSWAPIFNOT` | _`x - x or null x`_ | Pushes a _Null_ under the topmost _Integer_ `x`, but only if `x=0`. May be used for stack alignment after quiet primitives such as [`PLDUXQ`](#instr-plduxq). | `26` |
+| **`6FA2`** | `NULLROTRIF` | _`x y - x y or null x y`_ | Pushes a _Null_ under the second stack entry from the top, but only if the topmost _Integer_ `y` is non-zero. | `26` |
+| **`6FA3`** | `NULLROTRIFNOT` | _`x y - x y or null x y`_ | Pushes a _Null_ under the second stack entry from the top, but only if the topmost _Integer_ `y` is zero. May be used for stack alignment after quiet primitives such as [`LDUXQ`](#instr-lduxq). | `26` |
+| **`6FA4`** | `NULLSWAPIF2` | _`x - x or null null x`_ | Pushes two nulls under the topmost _Integer_ `x`, but only if `x!=0`.
Equivalent to [`NULLSWAPIF`](#instr-nullswapif) [`NULLSWAPIF`](#instr-nullswapif). | `26` |
+| **`6FA5`** | `NULLSWAPIFNOT2` | _`x - x or null null x`_ | Pushes two nulls under the topmost _Integer_ `x`, but only if `x=0`.
Equivalent to [`NULLSWAPIFNOT`](#instr-nullswapifnot) [`NULLSWAPIFNOT`](#instr-nullswapifnot). | `26` |
+| **`6FA6`** | `NULLROTRIF2` | _`x y - x y or null null x y`_ | Pushes two nulls under the second stack entry from the top, but only if the topmost _Integer_ `y` is non-zero.
Equivalent to [`NULLROTRIF`](#instr-nullrotrif) [`NULLROTRIF`](#instr-nullrotrif). | `26` |
+| **`6FA7`** | `NULLROTRIFNOT2` | _`x y - x y or null null x y`_ | Pushes two nulls under the second stack entry from the top, but only if the topmost _Integer_ `y` is zero.
Equivalent to [`NULLROTRIFNOT`](#instr-nullrotrifnot) [`NULLROTRIFNOT`](#instr-nullrotrifnot). | `26` |
+| **`6FBij`** | `[i] [j] INDEX2` | _`t - x`_ | Recovers `x=(t_{i+1})_{j+1}` for `0 <= i,j <= 3`.
Equivalent to [`[i] INDEX`](#instr-index) [`[j] INDEX`](#instr-index). | `26` |
+| **`6FB4`** | `CADR` | _`t - x`_ | Recovers `x=(t_2)_1`. | `26` |
+| **`6FB5`** | `CDDR` | _`t - x`_ | Recovers `x=(t_2)_2`. | `26` |
+| **`6FE_ijk`** | `[i] [j] [k] INDEX3` | _`t - x`_ | Recovers `x=t_{i+1}_{j+1}_{k+1}`.
`0 <= i,j,k <= 3`
Equivalent to [`[i] [j] INDEX2`](#instr-index2) [`[k] INDEX`](#instr-index). | `26` |
+| **`6FD4`** | `CADDR` | _`t - x`_ | Recovers `x=t_2_2_1`. | `26` |
+| **`6FD5`** | `CDDDR` | _`t - x`_ | Recovers `x=t_2_2_2`. | `26` |
+
+## 4 Constant, or literal primitives
+### 4.1 Integer and boolean constants
+| xxxxxxx
Opcode | xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Fift syntax | xxxxxxxxxxxxxxxxx
Stack | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Description | xxxx
Gas |
+|:-|:-|:-|:-|:-|
+| **`7i`** | `[x] PUSHINT`
`[x] INT` | _`- x`_ | Pushes integer `x` into the stack. `-5 <= x <= 10`.
Here `i` equals four lower-order bits of `x` (`i=x mod 16`). | `18` |
+| **`70`** | `ZERO`
`FALSE` | _`- 0`_ | | `18` |
+| **`71`** | `ONE` | _`- 1`_ | | `18` |
+| **`72`** | `TWO` | _`- 2`_ | | `18` |
+| **`7A`** | `TEN` | _`- 10`_ | | `18` |
+| **`7F`** | `TRUE` | _`- -1`_ | | `18` |
+| **`80xx`** | `[xx] PUSHINT`
`[xx] INT` | _`- xx`_ | Pushes integer `xx`. `-128 <= xx <= 127`. | `26` |
+| **`81xxxx`** | `[xxxx] PUSHINT`
`[xxxx] INT` | _`- xxxx`_ | Pushes integer `xxxx`. `-2^15 <= xx < 2^15`. | `34` |
+| **`82lxxx`** | `[xxx] PUSHINT`
`[xxx] INT` | _`- xxx`_ | Pushes integer `xxx`.
_Details:_ 5-bit `0 <= l <= 30` determines the length `n=8l+19` of signed big-endian integer `xxx`.
The total length of this instruction is `l+4` bytes or `n+13=8l+32` bits. | `23` |
+| **`83xx`** | `[xx+1] PUSHPOW2` | _`- 2^(xx+1)`_ | (Quietly) pushes `2^(xx+1)` for `0 <= xx <= 255`.
`2^256` is a `NaN`. | `26` |
+| **`83FF`** | `PUSHNAN` | _`- NaN`_ | Pushes a `NaN`. | `26` |
+| **`84xx`** | `[xx+1] PUSHPOW2DEC` | _`- 2^(xx+1)-1`_ | Pushes `2^(xx+1)-1` for `0 <= xx <= 255`. | `26` |
+| **`85xx`** | `[xx+1] PUSHNEGPOW2` | _`- -2^(xx+1)`_ | Pushes `-2^(xx+1)` for `0 <= xx <= 255`. | `26` |
+### 4.2 Constant slices, continuations, cells, and references
+| xxxxxxx
Opcode | xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Fift syntax | xxxxxxxxxxxxxxxxx
Stack | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Description | xxxx
Gas |
+|:-|:-|:-|:-|:-|
+| **`88`** | `[ref] PUSHREF` | _`- c`_ | Pushes the reference `ref` into the stack.
_Details:_ Pushes the first reference of `cc.code` into the stack as a _Cell_ (and removes this reference from the current continuation). | `18` |
+| **`89`** | `[ref] PUSHREFSLICE` | _`- s`_ | Similar to [`PUSHREF`](#instr-pushref), but converts the cell into a _Slice_. | `118/43` |
+| **`8A`** | `[ref] PUSHREFCONT` | _`- cont`_ | Similar to [`PUSHREFSLICE`](#instr-pushrefslice), but makes a simple ordinary _Continuation_ out of the cell. | `118/43` |
+| **`8Bxsss`** | `[slice] PUSHSLICE`
`[slice] SLICE` | _`- s`_ | Pushes the slice `slice` into the stack.
_Details:_ Pushes the (prefix) subslice of `cc.code` consisting of its first `8x+4` bits and no references (i.e., essentially a bitstring), where `0 <= x <= 15`.
A completion tag is assumed, meaning that all trailing zeroes and the last binary one (if present) are removed from this bitstring.
If the original bitstring consists only of zeroes, an empty slice will be pushed. | `22` |
+| **`8Crxxssss`** | `[slice] PUSHSLICE`
`[slice] SLICE` | _`- s`_ | Pushes the slice `slice` into the stack.
_Details:_ Pushes the (prefix) subslice of `cc.code` consisting of its first `1 <= r+1 <= 4` references and up to first `8xx+1` bits of data, with `0 <= xx <= 31`.
A completion tag is also assumed. | `25` |
+| **`8Drxxsssss`** | `[slice] PUSHSLICE`
`[slice] SLICE` | _`- s`_ | Pushes the slice `slice` into the stack.
_Details:_ Pushes the subslice of `cc.code` consisting of `0 <= r <= 4` references and up to `8xx+6` bits of data, with `0 <= xx <= 127`.
A completion tag is assumed. | `28` |
+| | `x{} PUSHSLICE`
`x{ABCD1234} PUSHSLICE`
`b{01101} PUSHSLICE` | _`- s`_ | Examples of [`PUSHSLICE`](#instr-pushslice).
`x{}` is an empty slice. `x{...}` is a hexadecimal literal. `b{...}` is a binary literal.
More on slice literals [here](https://github.com/Piterden/TON-docs/blob/master/Fift.%20A%20Brief%20Introduction.md#user-content-51-slice-literals).
Note that the assembler can replace [`PUSHSLICE`](#instr-pushslice) with [`PUSHREFSLICE`](#instr-pushrefslice) in certain situations (e.g. if there’s not enough space in the current continuation). | |
+| | ` PUSHREF`
` PUSHREFSLICE` | _`- c/s`_ | Examples of [`PUSHREF`](#instr-pushref) and [`PUSHREFSLICE`](#instr-pushrefslice).
More on building cells in fift [here](https://github.com/Piterden/TON-docs/blob/master/Fift.%20A%20Brief%20Introduction.md#user-content-52-builder-primitives). | |
+| **`8F_rxxcccc`** | `[builder] PUSHCONT`
`[builder] CONT` | _`- c`_ | Pushes a continuation made from `builder`.
_Details:_ Pushes the simple ordinary continuation `cccc` made from the first `0 <= r <= 3` references and the first `0 <= xx <= 127` bytes of `cc.code`. | `26` |
+| **`9xccc`** | `[builder] PUSHCONT`
`[builder] CONT` | _`- c`_ | Pushes a continuation made from `builder`.
_Details:_ Pushes an `x`-byte continuation for `0 <= x <= 15`. | `18` |
+| | `<{ code }> PUSHCONT`
`<{ code }> CONT`
`CONT:<{ code }>` | _`- c`_ | Pushes a continuation with code `code`.
Note that the assembler can replace [`PUSHCONT`](#instr-pushcont) with [`PUSHREFCONT`](#instr-pushrefcont) in certain situations (e.g. if there’s not enough space in the current continuation). | |
+
+## 5 Arithmetic primitives
+### 5.1 Addition, subtraction, multiplication
+| xxxxxxx
Opcode | xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Fift syntax | xxxxxxxxxxxxxxxxx
Stack | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Description | xxxx
Gas |
+|:-|:-|:-|:-|:-|
+| **`A0`** | `ADD` | _`x y - x+y`_ | | `18` |
+| **`A1`** | `SUB` | _`x y - x-y`_ | | `18` |
+| **`A2`** | `SUBR` | _`x y - y-x`_ | Equivalent to [`SWAP`](#instr-swap) [`SUB`](#instr-sub). | `18` |
+| **`A3`** | `NEGATE` | _`x - -x`_ | Equivalent to [`-1 MULCONST`](#instr-mulconst) or to [`ZERO SUBR`](#instr-subr).
Notice that it triggers an integer overflow exception if `x=-2^256`. | `18` |
+| **`A4`** | `INC` | _`x - x+1`_ | Equivalent to [`1 ADDCONST`](#instr-addconst). | `18` |
+| **`A5`** | `DEC` | _`x - x-1`_ | Equivalent to [`-1 ADDCONST`](#instr-addconst). | `18` |
+| **`A6cc`** | `[cc] ADDCONST`
`[cc] ADDINT`
`[-cc] SUBCONST`
`[-cc] SUBINT` | _`x - x+cc`_ | `-128 <= cc <= 127`. | `26` |
+| **`A7cc`** | `[cc] MULCONST`
`[cc] MULINT` | _`x - x*cc`_ | `-128 <= cc <= 127`. | `26` |
+| **`A8`** | `MUL` | _`x y - x*y`_ | | `18` |
+### 5.2 Division
+| xxxxxxx
Opcode | xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Fift syntax | xxxxxxxxxxxxxxxxx
Stack | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Description | xxxx
Gas |
+|:-|:-|:-|:-|:-|
+| **`A9mscdf`** | | | This is the general encoding of division, with an optional pre-multiplication and an optional replacement of the division or multiplication by a shift. Variable fields are as follows:
`0 <= m <= 1` - Indicates whether there is pre-multiplication ([`MULDIV`](#instr-muldiv) and its variants), possibly replaced by a left shift.
`0 <= s <= 2` - Indicates whether either the multiplication or the division have been replaced by shifts: `s=0` - no replacement, `s=1` - division replaced by a right shift, `s=2` - multiplication replaced by a left shift (possible only for `m=1`).
`0 <= c <= 1` - Indicates whether there is a constant one-byte argument `tt` for the shift operator (if `s!=0`). For `s=0`, `c=0`. If `c=1`, then `0 <= tt <= 255`, and the shift is performed by `tt+1` bits. If `s!=0` and `c=0`, then the shift amount is provided to the instruction as a top-of-stack _Integer_ in range `0...256`.
`1 <= d <= 3` - Indicates which results of division are required: `1` - only the quotient, `2` - only the remainder, `3` - both.
`0 <= f <= 2` - Rounding mode: `0` - floor, `1` - nearest integer, `2` - ceiling.
All instructions below are variants of this. | `26` |
+| **`A904`** | `DIV` | _`x y - q`_ | `q=floor(x/y)`, `r=x-y*q` | `26` |
+| **`A905`** | `DIVR` | _`x y - q’`_ | `q’=round(x/y)`, `r’=x-y*q’` | `26` |
+| **`A906`** | `DIVC` | _`x y - q''`_ | `q’’=ceil(x/y)`, `r’’=x-y*q’’` | `26` |
+| **`A908`** | `MOD` | _`x y - r`_ | | `26` |
+| **`A90C`** | `DIVMOD` | _`x y - q r`_ | | `26` |
+| **`A90D`** | `DIVMODR` | _`x y - q' r'`_ | | `26` |
+| **`A90E`** | `DIVMODC` | _`x y - q'' r''`_ | | `26` |
+| **`A925`** | `RSHIFTR` | _`x y - round(x/2^y)`_ | | `26` |
+| **`A926`** | `RSHIFTC` | _`x y - ceil(x/2^y)`_ | | `34` |
+| **`A935tt`** | `[tt+1] RSHIFTR#` | _`x y - round(x/2^(tt+1))`_ | | `34` |
+| **`A936tt`** | `[tt+1] RSHIFTC#` | _`x y - ceil(x/2^(tt+1))`_ | | `34` |
+| **`A938tt`** | `[tt+1] MODPOW2#` | _`x - x mod 2^(tt+1)`_ | | `26` |
+| **`A98`** | `MULDIV` | _`x y z - q`_ | `q=floor(x*y/z)` | `26` |
+| **`A985`** | `MULDIVR` | _`x y z - q'`_ | `q'=round(x*y/z)` | `26` |
+| **`A98C`** | `MULDIVMOD` | _`x y z - q r`_ | `q=floor(x*y/z)`, `r=x*y-z*q` | `26` |
+| **`A9A4`** | `MULRSHIFT` | _`x y z - floor(x*y/2^z)`_ | `0 <= z <= 256` | `26` |
+| **`A9A5`** | `MULRSHIFTR` | _`x y z - round(x*y/2^z)`_ | `0 <= z <= 256` | `26` |
+| **`A9A6`** | `MULRSHIFTC` | _`x y z - ceil(x*y/2^z)`_ | `0 <= z <= 256` | `34` |
+| **`A9B4tt`** | `[tt+1] MULRSHIFT#` | _`x y - floor(x*y/2^(tt+1))`_ | | `34` |
+| **`A9B5tt`** | `[tt+1] MULRSHIFTR#` | _`x y - round(x*y/2^(tt+1))`_ | | `34` |
+| **`A9B6tt`** | `[tt+1] MULRSHIFTC#` | _`x y - ceil(x*y/2^(tt+1))`_ | | `26` |
+| **`A9C4`** | `LSHIFTDIV` | _`x y z - floor(2^z*x/y)`_ | `0 <= z <= 256` | `26` |
+| **`A9C5`** | `LSHIFTDIVR` | _`x y z - round(2^z*x/y)`_ | `0 <= z <= 256` | `26` |
+| **`A9C6`** | `LSHIFTDIVC` | _`x y z - ceil(2^z*x/y)`_ | `0 <= z <= 256` | `34` |
+| **`A9D4tt`** | `[tt+1] LSHIFT#DIV` | _`x y - floor(2^(tt+1)*x/y)`_ | | `34` |
+| **`A9D5tt`** | `[tt+1] LSHIFT#DIVR` | _`x y - round(2^(tt+1)*x/y)`_ | | `34` |
+| **`A9D6tt`** | `[tt+1] LSHIFT#DIVC` | _`x y - ceil(2^(tt+1)*x/y)`_ | | `26` |
+### 5.3 Shifts, logical operations
+| xxxxxxx
Opcode | xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Fift syntax | xxxxxxxxxxxxxxxxx
Stack | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Description | xxxx
Gas |
+|:-|:-|:-|:-|:-|
+| **`AAcc`** | `[cc+1] LSHIFT#` | _`x - x*2^(cc+1)`_ | `0 <= cc <= 255` | `26` |
+| **`ABcc`** | `[cc+1] RSHIFT#` | _`x - floor(x/2^(cc+1))`_ | `0 <= cc <= 255` | `18` |
+| **`AC`** | `LSHIFT` | _`x y - x*2^y`_ | `0 <= y <= 1023` | `18` |
+| **`AD`** | `RSHIFT` | _`x y - floor(x/2^y)`_ | `0 <= y <= 1023` | `18` |
+| **`AE`** | `POW2` | _`y - 2^y`_ | `0 <= y <= 1023`
Equivalent to [`ONE`](#instr-one) [`SWAP`](#instr-swap) [`LSHIFT`](#instr-lshift-var). | `18` |
+| **`B0`** | `AND` | _`x y - x&y`_ | Bitwise and of two signed integers `x` and `y`, sign-extended to infinity. | `18` |
+| **`B1`** | `OR` | _`x y - x\|y`_ | Bitwise or of two integers. | `18` |
+| **`B2`** | `XOR` | _`x y - x xor y`_ | Bitwise xor of two integers. | `18` |
+| **`B3`** | `NOT` | _`x - ~x`_ | Bitwise not of an integer. | `26` |
+| **`B4cc`** | `[cc+1] FITS` | _`x - x`_ | Checks whether `x` is a `cc+1`-bit signed integer for `0 <= cc <= 255` (i.e., whether `-2^cc <= x < 2^cc`).
If not, either triggers an integer overflow exception, or replaces `x` with a `NaN` (quiet version). | `26/76` |
+| **`B400`** | `CHKBOOL` | _`x - x`_ | Checks whether `x` is a “boolean value'' (i.e., either 0 or -1). | `26/76` |
+| **`B5cc`** | `[cc+1] UFITS` | _`x - x`_ | Checks whether `x` is a `cc+1`-bit unsigned integer for `0 <= cc <= 255` (i.e., whether `0 <= x < 2^(cc+1)`). | `26/76` |
+| **`B500`** | `CHKBIT` | _`x - x`_ | Checks whether `x` is a binary digit (i.e., zero or one). | `26/76` |
+| **`B600`** | `FITSX` | _`x c - x`_ | Checks whether `x` is a `c`-bit signed integer for `0 <= c <= 1023`. | `26/76` |
+| **`B601`** | `UFITSX` | _`x c - x`_ | Checks whether `x` is a `c`-bit unsigned integer for `0 <= c <= 1023`. | `26/76` |
+| **`B602`** | `BITSIZE` | _`x - c`_ | Computes smallest `c >= 0` such that `x` fits into a `c`-bit signed integer (`-2^(c-1) <= c < 2^(c-1)`). | `26` |
+| **`B603`** | `UBITSIZE` | _`x - c`_ | Computes smallest `c >= 0` such that `x` fits into a `c`-bit unsigned integer (`0 <= x < 2^c`), or throws a range check exception. | `26` |
+| **`B608`** | `MIN` | _`x y - x or y`_ | Computes the minimum of two integers `x` and `y`. | `26` |
+| **`B609`** | `MAX` | _`x y - x or y`_ | Computes the maximum of two integers `x` and `y`. | `26` |
+| **`B60A`** | `MINMAX`
`INTSORT2` | _`x y - x y or y x`_ | Sorts two integers. Quiet version of this operation returns two `NaN`s if any of the arguments are `NaN`s. | `26` |
+| **`B60B`** | `ABS` | _`x - \|x\|`_ | Computes the absolute value of an integer `x`. | `26` |
+### 5.4 Quiet arithmetic primitives
+Quiet operations return `NaN` instead of throwing exceptions if one of their arguments is a `NaN`, or in case of integer overflow.
+Quiet operations has a prefix `Q` as shown below. Another way to make an operation quiet is to add `QUIET` before it (i.e. one can write [`QUIET ADD`](#instr-add) instead of [`QADD`](#instr-qadd)).
+Quiet versions of integer comparison primitives are also available ([`QUIET SGN`](#instr-sgn), [`QUIET LESS`](#instr-less) etc).
+
+| xxxxxxx
Opcode | xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Fift syntax | xxxxxxxxxxxxxxxxx
Stack | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Description | xxxx
Gas |
+|:-|:-|:-|:-|:-|
+| **`B7A0`** | `QADD` | _`x y - x+y`_ | | `26` |
+| **`B7A1`** | `QSUB` | _`x y - x-y`_ | | `26` |
+| **`B7A2`** | `QSUBR` | _`x y - y-x`_ | | `26` |
+| **`B7A3`** | `QNEGATE` | _`x - -x`_ | | `26` |
+| **`B7A4`** | `QINC` | _`x - x+1`_ | | `26` |
+| **`B7A5`** | `QDEC` | _`x - x-1`_ | | `26` |
+| **`B7A8`** | `QMUL` | _`x y - x*y`_ | | `26` |
+| **`B7A904`** | `QDIV` | _`x y - q`_ | Division returns `NaN` if `y=0`. | `34` |
+| **`B7A905`** | `QDIVR` | _`x y - q’`_ | | `34` |
+| **`B7A906`** | `QDIVC` | _`x y - q''`_ | | `34` |
+| **`B7A908`** | `QMOD` | _`x y - r`_ | | `34` |
+| **`B7A90C`** | `QDIVMOD` | _`x y - q r`_ | | `34` |
+| **`B7A90D`** | `QDIVMODR` | _`x y - q' r'`_ | | `34` |
+| **`B7A90E`** | `QDIVMODC` | _`x y - q'' r''`_ | | `34` |
+| **`B7A985`** | `QMULDIVR` | _`x y z - q'`_ | | `34` |
+| **`B7A98C`** | `QMULDIVMOD` | _`x y z - q r`_ | | `34` |
+| **`B7AC`** | `QLSHIFT` | _`x y - x*2^y`_ | | `26` |
+| **`B7AD`** | `QRSHIFT` | _`x y - floor(x/2^y)`_ | | `26` |
+| **`B7AE`** | `QPOW2` | _`y - 2^y`_ | | `26` |
+| **`B7B0`** | `QAND` | _`x y - x&y`_ | | `26` |
+| **`B7B1`** | `QOR` | _`x y - x\|y`_ | | `26` |
+| **`B7B2`** | `QXOR` | _`x y - x xor y`_ | | `26` |
+| **`B7B3`** | `QNOT` | _`x - ~x`_ | | `26` |
+| **`B7B4cc`** | `[cc+1] QFITS` | _`x - x`_ | Replaces `x` with a `NaN` if x is not a `cc+1`-bit signed integer, leaves it intact otherwise. | `34` |
+| **`B7B5cc`** | `[cc+1] QUFITS` | _`x - x`_ | Replaces `x` with a `NaN` if x is not a `cc+1`-bit unsigned integer, leaves it intact otherwise. | `34` |
+| **`B7B600`** | `QFITSX` | _`x c - x`_ | Replaces `x` with a `NaN` if x is not a c-bit signed integer, leaves it intact otherwise. | `34` |
+| **`B7B601`** | `QUFITSX` | _`x c - x`_ | Replaces `x` with a `NaN` if x is not a c-bit unsigned integer, leaves it intact otherwise. | `34` |
+
+## 6 Comparison primitives
+### 6.1 Integer comparison
+| xxxxxxx
Opcode | xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Fift syntax | xxxxxxxxxxxxxxxxx
Stack | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Description | xxxx
Gas |
+|:-|:-|:-|:-|:-|
+| **`B8`** | `SGN` | _`x - sgn(x)`_ | Computes the sign of an integer `x`:
`-1` if `x<0`, `0` if `x=0`, `1` if `x>0`. | `18` |
+| **`B9`** | `LESS` | _`x y - xy`_ | | `18` |
+| **`BD`** | `NEQ` | _`x y - x!=y`_ | Equivalent to [`EQUAL`](#instr-equal) [`NOT`](#instr-not). | `18` |
+| **`BE`** | `GEQ` | _`x y - x>=y`_ | Equivalent to [`LESS`](#instr-less) [`NOT`](#instr-not). | `18` |
+| **`BF`** | `CMP` | _`x y - sgn(x-y)`_ | Computes the sign of `x-y`:
`-1` if `xy`.
No integer overflow can occur here unless `x` or `y` is a `NaN`. | `18` |
+| **`C0yy`** | `[yy] EQINT` | _`x - x=yy`_ | Returns `-1` if `x=yy`, `0` otherwise.
`-2^7 <= yy < 2^7`. | `26` |
+| **`C000`** | `ISZERO` | _`x - x=0`_ | Checks whether an integer is zero. Corresponds to Forth's `0=`. | `26` |
+| **`C1yy`** | `[yy] LESSINT`
`[yy-1] LEQINT` | _`x - x`-2^7 <= yy < 2^7`. | `26` |
+| **`C100`** | `ISNEG` | _`x - x<0`_ | Checks whether an integer is negative. Corresponds to Forth's `0<`. | `26` |
+| **`C101`** | `ISNPOS` | _`x - x<=0`_ | Checks whether an integer is non-positive. | `26` |
+| **`C2yy`** | `[yy] GTINT`
`[yy+1] GEQINT` | _`x - x>yy`_ | Returns `-1` if `x>yy`, `0` otherwise.
`-2^7 <= yy < 2^7`. | `26` |
+| **`C200`** | `ISPOS` | _`x - x>0`_ | Checks whether an integer is positive. Corresponds to Forth's `0>`. | `26` |
+| **`C2FF`** | `ISNNEG` | _`x - x >=0`_ | Checks whether an integer is non-negative. | `26` |
+| **`C3yy`** | `[yy] NEQINT` | _`x - x!=yy`_ | Returns `-1` if `x!=yy`, `0` otherwise.
`-2^7 <= yy < 2^7`. | `26` |
+| **`C4`** | `ISNAN` | _`x - x=NaN`_ | Checks whether `x` is a `NaN`. | `18` |
+| **`C5`** | `CHKNAN` | _`x - x`_ | Throws an arithmetic overflow exception if `x` is a `NaN`. | `18/68` |
+### 6.2 Other comparison
+Most of these "other comparison" primitives actually compare the data portions of _Slices_ as bitstrings (ignoring references if not stated otherwise).
+
+| xxxxxxx
Opcode | xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Fift syntax | xxxxxxxxxxxxxxxxx
Stack | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Description | xxxx
Gas |
+|:-|:-|:-|:-|:-|
+| **`C700`** | `SEMPTY` | _`s - ?`_ | Checks whether a _Slice_ `s` is empty (i.e., contains no bits of data and no cell references). | `26` |
+| **`C701`** | `SDEMPTY` | _`s - ?`_ | Checks whether _Slice_ `s` has no bits of data. | `26` |
+| **`C702`** | `SREMPTY` | _`s - ?`_ | Checks whether _Slice_ `s` has no references. | `26` |
+| **`C703`** | `SDFIRST` | _`s - ?`_ | Checks whether the first bit of _Slice_ `s` is a one. | `26` |
+| **`C704`** | `SDLEXCMP` | _`s s' - x`_ | Compares the data of `s` lexicographically with the data of `s'`, returning `-1`, 0, or 1 depending on the result. | `26` |
+| **`C705`** | `SDEQ` | _`s s' - ?`_ | Checks whether the data parts of `s` and `s'` coincide, equivalent to [`SDLEXCMP`](#instr-sdlexcmp) [`ISZERO`](#instr-iszero). | `26` |
+| **`C708`** | `SDPFX` | _`s s' - ?`_ | Checks whether `s` is a prefix of `s'`. | `26` |
+| **`C709`** | `SDPFXREV` | _`s s' - ?`_ | Checks whether `s'` is a prefix of `s`, equivalent to [`SWAP`](#instr-swap) [`SDPFX`](#instr-sdpfx). | `26` |
+| **`C70A`** | `SDPPFX` | _`s s' - ?`_ | Checks whether `s` is a proper prefix of `s'` (i.e., a prefix distinct from `s'`). | `26` |
+| **`C70B`** | `SDPPFXREV` | _`s s' - ?`_ | Checks whether `s'` is a proper prefix of `s`. | `26` |
+| **`C70C`** | `SDSFX` | _`s s' - ?`_ | Checks whether `s` is a suffix of `s'`. | `26` |
+| **`C70D`** | `SDSFXREV` | _`s s' - ?`_ | Checks whether `s'` is a suffix of `s`. | `26` |
+| **`C70E`** | `SDPSFX` | _`s s' - ?`_ | Checks whether `s` is a proper suffix of `s'`. | `26` |
+| **`C70F`** | `SDPSFXREV` | _`s s' - ?`_ | Checks whether `s'` is a proper suffix of `s`. | `26` |
+| **`C710`** | `SDCNTLEAD0` | _`s - n`_ | Returns the number of leading zeroes in `s`. | `26` |
+| **`C711`** | `SDCNTLEAD1` | _`s - n`_ | Returns the number of leading ones in `s`. | `26` |
+| **`C712`** | `SDCNTTRAIL0` | _`s - n`_ | Returns the number of trailing zeroes in `s`. | `26` |
+| **`C713`** | `SDCNTTRAIL1` | _`s - n`_ | Returns the number of trailing ones in `s`. | `26` |
+
+## 7 Cell primitives
+### 7.1 Cell serialization primitives
+| xxxxxxx
Opcode | xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Fift syntax | xxxxxxxxxxxxxxxxx
Stack | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Description | xxxx
Gas |
+|:-|:-|:-|:-|:-|
+| **`C8`** | `NEWC` | _`- b`_ | Creates a new empty _Builder_. | `18` |
+| **`C9`** | `ENDC` | _`b - c`_ | Converts a _Builder_ into an ordinary _Cell_. | `518` |
+| **`CAcc`** | `[cc+1] STI` | _`x b - b'`_ | Stores a signed `cc+1`-bit integer `x` into _Builder_ `b` for `0 <= cc <= 255`, throws a range check exception if `x` does not fit into `cc+1` bits. | `26` |
+| **`CBcc`** | `[cc+1] STU` | _`x b - b'`_ | Stores an unsigned `cc+1`-bit integer `x` into _Builder_ `b`. In all other respects it is similar to [`STI`](#instr-sti). | `26` |
+| **`CC`** | `STREF` | _`c b - b'`_ | Stores a reference to _Cell_ `c` into _Builder_ `b`. | `18` |
+| **`CD`** | `STBREFR`
`ENDCST` | _`b b'' - b`_ | Equivalent to [`ENDC`](#instr-endc) [`SWAP`](#instr-swap) [`STREF`](#instr-stref). | `518` |
+| **`CE`** | `STSLICE` | _`s b - b'`_ | Stores _Slice_ `s` into _Builder_ `b`. | `18` |
+| **`CF00`** | `STIX` | _`x b l - b'`_ | Stores a signed `l`-bit integer `x` into `b` for `0 <= l <= 257`. | `26` |
+| **`CF01`** | `STUX` | _`x b l - b'`_ | Stores an unsigned `l`-bit integer `x` into `b` for `0 <= l <= 256`. | `26` |
+| **`CF02`** | `STIXR` | _`b x l - b'`_ | Similar to [`STIX`](#instr-stix), but with arguments in a different order. | `26` |
+| **`CF03`** | `STUXR` | _`b x l - b'`_ | Similar to [`STUX`](#instr-stux), but with arguments in a different order. | `26` |
+| **`CF04`** | `STIXQ` | _`x b l - x b f or b' 0`_ | A quiet version of [`STIX`](#instr-stix). If there is no space in `b`, sets `b'=b` and `f=-1`.
If `x` does not fit into `l` bits, sets `b'=b` and `f=1`.
If the operation succeeds, `b'` is the new _Builder_ and `f=0`.
However, `0 <= l <= 257`, with a range check exception if this is not so. | `26` |
+| **`CF05`** | `STUXQ` | _`x b l - x b f or b' 0`_ | A quiet version of [`STUX`](#instr-stux). | `26` |
+| **`CF06`** | `STIXRQ` | _`b x l - b x f or b' 0`_ | A quiet version of [`STIXR`](#instr-stixr). | `26` |
+| **`CF07`** | `STUXRQ` | _`b x l - b x f or b' 0`_ | A quiet version of [`STUXR`](#instr-stuxr). | `26` |
+| **`CF08cc`** | `[cc+1] STI_l` | _`x b - b'`_ | A longer version of [`[cc+1] STI`](#instr-sti). | `34` |
+| **`CF09cc`** | `[cc+1] STU_l` | _`x b - b'`_ | A longer version of [`[cc+1] STU`](#instr-stu). | `34` |
+| **`CF0Acc`** | `[cc+1] STIR` | _`b x - b'`_ | Equivalent to [`SWAP`](#instr-swap) [`[cc+1] STI`](#instr-sti). | `34` |
+| **`CF0Bcc`** | `[cc+1] STUR` | _`b x - b'`_ | Equivalent to [`SWAP`](#instr-swap) [`[cc+1] STU`](#instr-stu). | `34` |
+| **`CF0Ccc`** | `[cc+1] STIQ` | _`x b - x b f or b' 0`_ | A quiet version of [`STI`](#instr-sti). | `34` |
+| **`CF0Dcc`** | `[cc+1] STUQ` | _`x b - x b f or b' 0`_ | A quiet version of [`STU`](#instr-stu). | `34` |
+| **`CF0Ecc`** | `[cc+1] STIRQ` | _`b x - b x f or b' 0`_ | A quiet version of [`STIR`](#instr-stir). | `34` |
+| **`CF0Fcc`** | `[cc+1] STURQ` | _`b x - b x f or b' 0`_ | A quiet version of [`STUR`](#instr-stur). | `34` |
+| **`CF10`** | `STREF_l` | _`c b - b'`_ | A longer version of [`STREF`](#instr-stref). | `26` |
+| **`CF11`** | `STBREF` | _`b' b - b''`_ | Equivalent to [`SWAP`](#instr-swap) [`STBREFR`](#instr-stbrefr). | `526` |
+| **`CF12`** | `STSLICE_l` | _`s b - b'`_ | A longer version of [`STSLICE`](#instr-stslice). | `26` |
+| **`CF13`** | `STB` | _`b' b - b''`_ | Appends all data from _Builder_ `b'` to _Builder_ `b`. | `26` |
+| **`CF14`** | `STREFR` | _`b c - b'`_ | Equivalent to [`SWAP`](#instr-swap) [`STREF`](#instr-stref). | `26` |
+| **`CF15`** | `STBREFR_l` | _`b b' - b''`_ | A longer encoding of [`STBREFR`](#instr-stbrefr). | `526` |
+| **`CF16`** | `STSLICER` | _`b s - b'`_ | Equivalent to [`SWAP`](#instr-swap) [`STSLICE`](#instr-stslice). | `26` |
+| **`CF17`** | `STBR`
`BCONCAT` | _`b b' - b''`_ | Concatenates two builders.
Equivalent to [`SWAP`](#instr-swap) [`STB`](#instr-stb). | `26` |
+| **`CF18`** | `STREFQ` | _`c b - c b -1 or b' 0`_ | Quiet version of [`STREF`](#instr-stref). | `26` |
+| **`CF19`** | `STBREFQ` | _`b' b - b' b -1 or b'' 0`_ | Quiet version of [`STBREF`](#instr-stbref). | `526` |
+| **`CF1A`** | `STSLICEQ` | _`s b - s b -1 or b' 0`_ | Quiet version of [`STSLICE`](#instr-stslice). | `26` |
+| **`CF1B`** | `STBQ` | _`b' b - b' b -1 or b'' 0`_ | Quiet version of [`STB`](#instr-stb). | `26` |
+| **`CF1C`** | `STREFRQ` | _`b c - b c -1 or b' 0`_ | Quiet version of [`STREFR`](#instr-strefr). | `26` |
+| **`CF1D`** | `STBREFRQ` | _`b b' - b b' -1 or b'' 0`_ | Quiet version of [`STBREFR`](#instr-stbrefr). | `526` |
+| **`CF1E`** | `STSLICERQ` | _`b s - b s -1 or b'' 0`_ | Quiet version of [`STSLICER`](#instr-stslicer). | `26` |
+| **`CF1F`** | `STBRQ`
`BCONCATQ` | _`b b' - b b' -1 or b'' 0`_ | Quiet version of [`STBR`](#instr-stbr). | `26` |
+| **`CF20`** | `[ref] STREFCONST` | _`b - b’`_ | Equivalent to [`PUSHREF`](#instr-pushref) [`STREFR`](#instr-strefr). | `26` |
+| **`CF21`** | `[ref] [ref] STREF2CONST` | _`b - b’`_ | Equivalent to [`STREFCONST`](#instr-strefconst) [`STREFCONST`](#instr-strefconst). | `26` |
+| **`CF23`** | | _`b x - c`_ | If `x!=0`, creates a _special_ or _exotic_ cell from _Builder_ `b`.
The type of the exotic cell must be stored in the first 8 bits of `b`.
If `x=0`, it is equivalent to [`ENDC`](#instr-endc). Otherwise some validity checks on the data and references of `b` are performed before creating the exotic cell. | `526` |
+| **`CF28`** | `STILE4` | _`x b - b'`_ | Stores a little-endian signed 32-bit integer. | `26` |
+| **`CF29`** | `STULE4` | _`x b - b'`_ | Stores a little-endian unsigned 32-bit integer. | `26` |
+| **`CF2A`** | `STILE8` | _`x b - b'`_ | Stores a little-endian signed 64-bit integer. | `26` |
+| **`CF2B`** | `STULE8` | _`x b - b'`_ | Stores a little-endian unsigned 64-bit integer. | `26` |
+| **`CF30`** | `BDEPTH` | _`b - x`_ | Returns the depth of _Builder_ `b`. If no cell references are stored in `b`, then `x=0`; otherwise `x` is one plus the maximum of depths of cells referred to from `b`. | `26` |
+| **`CF31`** | `BBITS` | _`b - x`_ | Returns the number of data bits already stored in _Builder_ `b`. | `26` |
+| **`CF32`** | `BREFS` | _`b - y`_ | Returns the number of cell references already stored in `b`. | `26` |
+| **`CF33`** | `BBITREFS` | _`b - x y`_ | Returns the numbers of both data bits and cell references in `b`. | `26` |
+| **`CF35`** | `BREMBITS` | _`b - x'`_ | Returns the number of data bits that can still be stored in `b`. | `26` |
+| **`CF36`** | `BREMREFS` | _`b - y'`_ | Returns the number of references that can still be stored in `b`. | `26` |
+| **`CF37`** | `BREMBITREFS` | _`b - x' y'`_ | Returns the numbers of both data bits and references that can still be stored in `b`. | `26` |
+| **`CF38cc`** | `[cc+1] BCHKBITS#` | _`b -`_ | Checks whether `cc+1` bits can be stored into `b`, where `0 <= cc <= 255`. | `34/84` |
+| **`CF39`** | `BCHKBITS` | _`b x - `_ | Checks whether `x` bits can be stored into `b`, `0 <= x <= 1023`. If there is no space for `x` more bits in `b`, or if `x` is not within the range `0...1023`, throws an exception. | `26/76` |
+| **`CF3A`** | `BCHKREFS` | _`b y - `_ | Checks whether `y` references can be stored into `b`, `0 <= y <= 7`. | `26/76` |
+| **`CF3B`** | `BCHKBITREFS` | _`b x y - `_ | Checks whether `x` bits and `y` references can be stored into `b`, `0 <= x <= 1023`, `0 <= y <= 7`. | `26/76` |
+| **`CF3Ccc`** | `[cc+1] BCHKBITSQ#` | _`b - ?`_ | Checks whether `cc+1` bits can be stored into `b`, where `0 <= cc <= 255`. | `34` |
+| **`CF3D`** | `BCHKBITSQ` | _`b x - ?`_ | Checks whether `x` bits can be stored into `b`, `0 <= x <= 1023`. | `26` |
+| **`CF3E`** | `BCHKREFSQ` | _`b y - ?`_ | Checks whether `y` references can be stored into `b`, `0 <= y <= 7`. | `26` |
+| **`CF3F`** | `BCHKBITREFSQ` | _`b x y - ?`_ | Checks whether `x` bits and `y` references can be stored into `b`, `0 <= x <= 1023`, `0 <= y <= 7`. | `26` |
+| **`CF40`** | `STZEROES` | _`b n - b'`_ | Stores `n` binary zeroes into _Builder_ `b`. | `26` |
+| **`CF41`** | `STONES` | _`b n - b'`_ | Stores `n` binary ones into _Builder_ `b`. | `26` |
+| **`CF42`** | `STSAME` | _`b n x - b'`_ | Stores `n` binary `x`es (`0 <= x <= 1`) into _Builder_ `b`. | `26` |
+| **`CFC0_xysss`** | `[slice] STSLICECONST` | _`b - b'`_ | Stores a constant subslice `sss`.
_Details:_ `sss` consists of `0 <= x <= 3` references and up to `8y+2` data bits, with `0 <= y <= 7`. Completion bit is assumed.
Note that the assembler can replace [`STSLICECONST`](#instr-stsliceconst) with [`PUSHSLICE`](#instr-pushslice) [`STSLICER`](#instr-stslicer) if the slice is too big. | `24` |
+| **`CF81`** | `STZERO` | _`b - b'`_ | Stores one binary zero. | `24` |
+| **`CF83`** | `STONE` | _`b - b'`_ | Stores one binary one. | `24` |
+### 7.2 Cell deserialization primitives
+| xxxxxxx
Opcode | xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Fift syntax | xxxxxxxxxxxxxxxxx
Stack | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Description | xxxx
Gas |
+|:-|:-|:-|:-|:-|
+| **`D0`** | `CTOS` | _`c - s`_ | Converts a _Cell_ into a _Slice_. Notice that `c` must be either an ordinary cell, or an exotic cell which is automatically _loaded_ to yield an ordinary cell `c'`, converted into a _Slice_ afterwards. | `118/43` |
+| **`D1`** | `ENDS` | _`s - `_ | Removes a _Slice_ `s` from the stack, and throws an exception if it is not empty. | `18/68` |
+| **`D2cc`** | `[cc+1] LDI` | _`s - x s'`_ | Loads (i.e., parses) a signed `cc+1`-bit integer `x` from _Slice_ `s`, and returns the remainder of `s` as `s'`. | `26` |
+| **`D3cc`** | `[cc+1] LDU` | _`s - x s'`_ | Loads an unsigned `cc+1`-bit integer `x` from _Slice_ `s`. | `26` |
+| **`D4`** | `LDREF` | _`s - c s'`_ | Loads a cell reference `c` from `s`. | `18` |
+| **`D5`** | `LDREFRTOS` | _`s - s' s''`_ | Equivalent to [`LDREF`](#instr-ldref) [`SWAP`](#instr-swap) [`CTOS`](#instr-ctos). | `118/43` |
+| **`D6cc`** | `[cc+1] LDSLICE` | _`s - s'' s'`_ | Cuts the next `cc+1` bits of `s` into a separate _Slice_ `s''`. | `26` |
+| **`D700`** | `LDIX` | _`s l - x s'`_ | Loads a signed `l`-bit (`0 <= l <= 257`) integer `x` from _Slice_ `s`, and returns the remainder of `s` as `s'`. | `26` |
+| **`D701`** | `LDUX` | _`s l - x s'`_ | Loads an unsigned `l`-bit integer `x` from (the first `l` bits of) `s`, with `0 <= l <= 256`. | `26` |
+| **`D702`** | `PLDIX` | _`s l - x`_ | Preloads a signed `l`-bit integer from _Slice_ `s`, for `0 <= l <= 257`. | `26` |
+| **`D703`** | `PLDUX` | _`s l - x`_ | Preloads an unsigned `l`-bit integer from `s`, for `0 <= l <= 256`. | `26` |
+| **`D704`** | `LDIXQ` | _`s l - x s' -1 or s 0`_ | Quiet version of [`LDIX`](#instr-ldix): loads a signed `l`-bit integer from `s` similarly to [`LDIX`](#instr-ldix), but returns a success flag, equal to `-1` on success or to `0` on failure (if `s` does not have `l` bits), instead of throwing a cell underflow exception. | `26` |
+| **`D705`** | `LDUXQ` | _`s l - x s' -1 or s 0`_ | Quiet version of [`LDUX`](#instr-ldux). | `26` |
+| **`D706`** | `PLDIXQ` | _`s l - x -1 or 0`_ | Quiet version of [`PLDIX`](#instr-pldix). | `26` |
+| **`D707`** | `PLDUXQ` | _`s l - x -1 or 0`_ | Quiet version of [`PLDUX`](#instr-pldux). | `26` |
+| **`D708cc`** | `[cc+1] LDI_l` | _`s - x s'`_ | A longer encoding for [`LDI`](#instr-ldi). | `34` |
+| **`D709cc`** | `[cc+1] LDU_l` | _`s - x s'`_ | A longer encoding for [`LDU`](#instr-ldu). | `34` |
+| **`D70Acc`** | `[cc+1] PLDI` | _`s - x`_ | Preloads a signed `cc+1`-bit integer from _Slice_ `s`. | `34` |
+| **`D70Bcc`** | `[cc+1] PLDU` | _`s - x`_ | Preloads an unsigned `cc+1`-bit integer from `s`. | `34` |
+| **`D70Ccc`** | `[cc+1] LDIQ` | _`s - x s' -1 or s 0`_ | A quiet version of [`LDI`](#instr-ldi). | `34` |
+| **`D70Dcc`** | `[cc+1] LDUQ` | _`s - x s' -1 or s 0`_ | A quiet version of [`LDU`](#instr-ldu). | `34` |
+| **`D70Ecc`** | `[cc+1] PLDIQ` | _`s - x -1 or 0`_ | A quiet version of [`PLDI`](#instr-pldi). | `34` |
+| **`D70Fcc`** | `[cc+1] PLDUQ` | _`s - x -1 or 0`_ | A quiet version of [`PLDU`](#instr-pldu). | `34` |
+| **`D714_c`** | `[32(c+1)] PLDUZ` | _`s - s x`_ | Preloads the first `32(c+1)` bits of _Slice_ `s` into an unsigned integer `x`, for `0 <= c <= 7`. If `s` is shorter than necessary, missing bits are assumed to be zero. This operation is intended to be used along with [`IFBITJMP`](#instr-ifbitjmp) and similar instructions. | `26` |
+| **`D718`** | `LDSLICEX` | _`s l - s'' s'`_ | Loads the first `0 <= l <= 1023` bits from _Slice_ `s` into a separate _Slice_ `s''`, returning the remainder of `s` as `s'`. | `26` |
+| **`D719`** | `PLDSLICEX` | _`s l - s''`_ | Returns the first `0 <= l <= 1023` bits of `s` as `s''`. | `26` |
+| **`D71A`** | `LDSLICEXQ` | _`s l - s'' s' -1 or s 0`_ | A quiet version of [`LDSLICEX`](#instr-ldslicex). | `26` |
+| **`D71B`** | `PLDSLICEXQ` | _`s l - s' -1 or 0`_ | A quiet version of [`LDSLICEXQ`](#instr-ldslicexq). | `26` |
+| **`D71Ccc`** | `[cc+1] LDSLICE_l` | _`s - s'' s'`_ | A longer encoding for [`LDSLICE`](#instr-ldslice). | `34` |
+| **`D71Dcc`** | `[cc+1] PLDSLICE` | _`s - s''`_ | Returns the first `0 < cc+1 <= 256` bits of `s` as `s''`. | `34` |
+| **`D71Ecc`** | `[cc+1] LDSLICEQ` | _`s - s'' s' -1 or s 0`_ | A quiet version of [`LDSLICE`](#instr-ldslice). | `34` |
+| **`D71Fcc`** | `[cc+1] PLDSLICEQ` | _`s - s'' -1 or 0`_ | A quiet version of [`PLDSLICE`](#instr-pldslice). | `34` |
+| **`D720`** | `SDCUTFIRST` | _`s l - s'`_ | Returns the first `0 <= l <= 1023` bits of `s`. It is equivalent to [`PLDSLICEX`](#instr-pldslicex). | `26` |
+| **`D721`** | `SDSKIPFIRST` | _`s l - s'`_ | Returns all but the first `0 <= l <= 1023` bits of `s`. It is equivalent to [`LDSLICEX`](#instr-ldslicex) [`NIP`](#instr-nip). | `26` |
+| **`D722`** | `SDCUTLAST` | _`s l - s'`_ | Returns the last `0 <= l <= 1023` bits of `s`. | `26` |
+| **`D723`** | `SDSKIPLAST` | _`s l - s'`_ | Returns all but the last `0 <= l <= 1023` bits of `s`. | `26` |
+| **`D724`** | `SDSUBSTR` | _`s l l' - s'`_ | Returns `0 <= l' <= 1023` bits of `s` starting from offset `0 <= l <= 1023`, thus extracting a bit substring out of the data of `s`. | `26` |
+| **`D726`** | `SDBEGINSX` | _`s s' - s''`_ | Checks whether `s` begins with (the data bits of) `s'`, and removes `s'` from `s` on success. On failure throws a cell deserialization exception. Primitive [`SDPFXREV`](#instr-sdpfxrev) can be considered a quiet version of [`SDBEGINSX`](#instr-sdbeginsx). | `26` |
+| **`D727`** | `SDBEGINSXQ` | _`s s' - s'' -1 or s 0`_ | A quiet version of [`SDBEGINSX`](#instr-sdbeginsx). | `26` |
+| **`D72A_xsss`** | `[slice] SDBEGINS` | _`s - s''`_ | Checks whether `s` begins with constant bitstring `sss` of length `8x+3` (with continuation bit assumed), where `0 <= x <= 127`, and removes `sss` from `s` on success. | `31` |
+| **`D72E_xsss`** | `[slice] SDBEGINSQ` | _`s - s'' -1 or s 0`_ | A quiet version of [`SDBEGINS`](#instr-sdbegins). | `31` |
+| **`D730`** | `SCUTFIRST` | _`s l r - s'`_ | Returns the first `0 <= l <= 1023` bits and first `0 <= r <= 4` references of `s`. | `26` |
+| **`D731`** | `SSKIPFIRST` | _`s l r - s'`_ | Returns all but the first `l` bits of `s` and `r` references of `s`. | `26` |
+| **`D732`** | `SCUTLAST` | _`s l r - s'`_ | Returns the last `0 <= l <= 1023` data bits and last `0 <= r <= 4` references of `s`. | `26` |
+| **`D733`** | `SSKIPLAST` | _`s l r - s'`_ | Returns all but the last `l` bits of `s` and `r` references of `s`. | `26` |
+| **`D734`** | `SUBSLICE` | _`s l r l' r' - s'`_ | Returns `0 <= l' <= 1023` bits and `0 <= r' <= 4` references from _Slice_ `s`, after skipping the first `0 <= l <= 1023` bits and first `0 <= r <= 4` references. | `26` |
+| **`D736`** | `SPLIT` | _`s l r - s' s''`_ | Splits the first `0 <= l <= 1023` data bits and first `0 <= r <= 4` references from `s` into `s'`, returning the remainder of `s` as `s''`. | `26` |
+| **`D737`** | `SPLITQ` | _`s l r - s' s'' -1 or s 0`_ | A quiet version of [`SPLIT`](#instr-split). | `26` |
+| **`D739`** | | _`c - s ?`_ | Transforms an ordinary or exotic cell into a _Slice_, as if it were an ordinary cell. A flag is returned indicating whether `c` is exotic. If that be the case, its type can later be deserialized from the first eight bits of `s`. | |
+| **`D73A`** | | _`c - c'`_ | Loads an exotic cell `c` and returns an ordinary cell `c'`. If `c` is already ordinary, does nothing. If `c` cannot be loaded, throws an exception. | |
+| **`D73B`** | | _`c - c' -1 or c 0`_ | Loads an exotic cell `c` and returns an ordinary cell `c'`. If `c` is already ordinary, does nothing. If `c` cannot be loaded, returns 0. | |
+| **`D741`** | `SCHKBITS` | _`s l - `_ | Checks whether there are at least `l` data bits in _Slice_ `s`. If this is not the case, throws a cell deserialisation (i.e., cell underflow) exception. | `26/76` |
+| **`D742`** | `SCHKREFS` | _`s r - `_ | Checks whether there are at least `r` references in _Slice_ `s`. | `26/76` |
+| **`D743`** | `SCHKBITREFS` | _`s l r - `_ | Checks whether there are at least `l` data bits and `r` references in _Slice_ `s`. | `26/76` |
+| **`D745`** | `SCHKBITSQ` | _`s l - ?`_ | Checks whether there are at least `l` data bits in _Slice_ `s`. | `26` |
+| **`D746`** | `SCHKREFSQ` | _`s r - ?`_ | Checks whether there are at least `r` references in _Slice_ `s`. | `26` |
+| **`D747`** | `SCHKBITREFSQ` | _`s l r - ?`_ | Checks whether there are at least `l` data bits and `r` references in _Slice_ `s`. | `26` |
+| **`D748`** | `PLDREFVAR` | _`s n - c`_ | Returns the `n`-th cell reference of _Slice_ `s` for `0 <= n <= 3`. | `26` |
+| **`D749`** | `SBITS` | _`s - l`_ | Returns the number of data bits in _Slice_ `s`. | `26` |
+| **`D74A`** | `SREFS` | _`s - r`_ | Returns the number of references in _Slice_ `s`. | `26` |
+| **`D74B`** | `SBITREFS` | _`s - l r`_ | Returns both the number of data bits and the number of references in `s`. | `26` |
+| **`D74E_n`** | `[n] PLDREFIDX` | _`s - c`_ | Returns the `n`-th cell reference of _Slice_ `s`, where `0 <= n <= 3`. | `26` |
+| **`D74C`** | `PLDREF` | _`s - c`_ | Preloads the first cell reference of a _Slice_. | `26` |
+| **`D750`** | `LDILE4` | _`s - x s'`_ | Loads a little-endian signed 32-bit integer. | `26` |
+| **`D751`** | `LDULE4` | _`s - x s'`_ | Loads a little-endian unsigned 32-bit integer. | `26` |
+| **`D752`** | `LDILE8` | _`s - x s'`_ | Loads a little-endian signed 64-bit integer. | `26` |
+| **`D753`** | `LDULE8` | _`s - x s'`_ | Loads a little-endian unsigned 64-bit integer. | `26` |
+| **`D754`** | `PLDILE4` | _`s - x`_ | Preloads a little-endian signed 32-bit integer. | `26` |
+| **`D755`** | `PLDULE4` | _`s - x`_ | Preloads a little-endian unsigned 32-bit integer. | `26` |
+| **`D756`** | `PLDILE8` | _`s - x`_ | Preloads a little-endian signed 64-bit integer. | `26` |
+| **`D757`** | `PLDULE8` | _`s - x`_ | Preloads a little-endian unsigned 64-bit integer. | `26` |
+| **`D758`** | `LDILE4Q` | _`s - x s' -1 or s 0`_ | Quietly loads a little-endian signed 32-bit integer. | `26` |
+| **`D759`** | `LDULE4Q` | _`s - x s' -1 or s 0`_ | Quietly loads a little-endian unsigned 32-bit integer. | `26` |
+| **`D75A`** | `LDILE8Q` | _`s - x s' -1 or s 0`_ | Quietly loads a little-endian signed 64-bit integer. | `26` |
+| **`D75B`** | `LDULE8Q` | _`s - x s' -1 or s 0`_ | Quietly loads a little-endian unsigned 64-bit integer. | `26` |
+| **`D75C`** | `PLDILE4Q` | _`s - x -1 or 0`_ | Quietly preloads a little-endian signed 32-bit integer. | `26` |
+| **`D75D`** | `PLDULE4Q` | _`s - x -1 or 0`_ | Quietly preloads a little-endian unsigned 32-bit integer. | `26` |
+| **`D75E`** | `PLDILE8Q` | _`s - x -1 or 0`_ | Quietly preloads a little-endian signed 64-bit integer. | `26` |
+| **`D75F`** | `PLDULE8Q` | _`s - x -1 or 0`_ | Quietly preloads a little-endian unsigned 64-bit integer. | `26` |
+| **`D760`** | `LDZEROES` | _`s - n s'`_ | Returns the count `n` of leading zero bits in `s`, and removes these bits from `s`. | `26` |
+| **`D761`** | `LDONES` | _`s - n s'`_ | Returns the count `n` of leading one bits in `s`, and removes these bits from `s`. | `26` |
+| **`D762`** | `LDSAME` | _`s x - n s'`_ | Returns the count `n` of leading bits equal to `0 <= x <= 1` in `s`, and removes these bits from `s`. | `26` |
+| **`D764`** | `SDEPTH` | _`s - x`_ | Returns the depth of _Slice_ `s`. If `s` has no references, then `x=0`; otherwise `x` is one plus the maximum of depths of cells referred to from `s`. | `26` |
+| **`D765`** | `CDEPTH` | _`c - x`_ | Returns the depth of _Cell_ `c`. If `c` has no references, then `x=0`; otherwise `x` is one plus the maximum of depths of cells referred to from `c`. If `c` is a _Null_ instead of a _Cell_, returns zero. | `26` |
+
+## 8 Continuation and control flow primitives
+### 8.1 Unconditional control flow primitives
+| xxxxxxx
Opcode | xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Fift syntax | xxxxxxxxxxxxxxxxx
Stack | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Description | xxxx
Gas |
+|:-|:-|:-|:-|:-|
+| **`D8`** | `EXECUTE`
`CALLX` | _`c - `_ | _Calls_, or _executes_, continuation `c`. | `18` |
+| **`D9`** | `JMPX` | _`c - `_ | _Jumps_, or transfers control, to continuation `c`.
The remainder of the previous current continuation `cc` is discarded. | `18` |
+| **`DApr`** | `[p] [r] CALLXARGS` | _`c - `_ | _Calls_ continuation `c` with `p` parameters and expecting `r` return values
`0 <= p <= 15`, `0 <= r <= 15` | `26` |
+| **`DB0p`** | `[p] -1 CALLXARGS` | _`c - `_ | _Calls_ continuation `c` with `0 <= p <= 15` parameters, expecting an arbitrary number of return values. | `26` |
+| **`DB1p`** | `[p] JMPXARGS` | _`c - `_ | _Jumps_ to continuation `c`, passing only the top `0 <= p <= 15` values from the current stack to it (the remainder of the current stack is discarded). | `26` |
+| **`DB2r`** | `[r] RETARGS` | | _Returns_ to `c0`, with `0 <= r <= 15` return values taken from the current stack. | `26` |
+| **`DB30`** | `RET`
`RETTRUE` | | _Returns_ to the continuation at `c0`. The remainder of the current continuation `cc` is discarded.
Approximately equivalent to [`c0 PUSHCTR`](#instr-pushctr) [`JMPX`](#instr-jmpx). | `26` |
+| **`DB31`** | `RETALT`
`RETFALSE` | | _Returns_ to the continuation at `c1`.
Approximately equivalent to [`c1 PUSHCTR`](#instr-pushctr) [`JMPX`](#instr-jmpx). | `26` |
+| **`DB32`** | `BRANCH`
`RETBOOL` | _`f - `_ | Performs [`RETTRUE`](#instr-ret) if integer `f!=0`, or [`RETFALSE`](#instr-retalt) if `f=0`. | `26` |
+| **`DB34`** | `CALLCC` | _`c - `_ | _Call with current continuation_, transfers control to `c`, pushing the old value of `cc` into `c`'s stack (instead of discarding it or writing it into new `c0`). | `26` |
+| **`DB35`** | `JMPXDATA` | _`c - `_ | Similar to [`CALLCC`](#instr-callcc), but the remainder of the current continuation (the old value of `cc`) is converted into a _Slice_ before pushing it into the stack of `c`. | `26` |
+| **`DB36pr`** | `[p] [r] CALLCCARGS` | _`c - `_ | Similar to [`CALLXARGS`](#instr-callxargs), but pushes the old value of `cc` (along with the top `0 <= p <= 15` values from the original stack) into the stack of newly-invoked continuation `c`, setting `cc.nargs` to `-1 <= r <= 14`. | `34` |
+| **`DB38`** | `CALLXVARARGS` | _`c p r - `_ | Similar to [`CALLXARGS`](#instr-callxargs), but takes `-1 <= p,r <= 254` from the stack. The next three operations also take `p` and `r` from the stack, both in the range `-1...254`. | `26` |
+| **`DB39`** | `RETVARARGS` | _`p r - `_ | Similar to [`RETARGS`](#instr-retargs). | `26` |
+| **`DB3A`** | `JMPXVARARGS` | _`c p r - `_ | Similar to [`JMPXARGS`](#instr-jmpxargs). | `26` |
+| **`DB3B`** | `CALLCCVARARGS` | _`c p r - `_ | Similar to [`CALLCCARGS`](#instr-callccargs). | `26` |
+| **`DB3C`** | `[ref] CALLREF` | | Equivalent to [`PUSHREFCONT`](#instr-pushrefcont) [`CALLX`](#instr-execute). | `126/51` |
+| **`DB3D`** | `[ref] JMPREF` | | Equivalent to [`PUSHREFCONT`](#instr-pushrefcont) [`JMPX`](#instr-jmpx). | `126/51` |
+| **`DB3E`** | `[ref] JMPREFDATA` | | Equivalent to [`PUSHREFCONT`](#instr-pushrefcont) [`JMPXDATA`](#instr-jmpxdata). | `126/51` |
+| **`DB3F`** | `RETDATA` | | Equivalent to [`c0 PUSHCTR`](#instr-pushctr) [`JMPXDATA`](#instr-jmpxdata). In this way, the remainder of the current continuation is converted into a _Slice_ and returned to the caller. | `26` |
+### 8.2 Conditional control flow primitives
+| xxxxxxx
Opcode | xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Fift syntax | xxxxxxxxxxxxxxxxx
Stack | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Description | xxxx
Gas |
+|:-|:-|:-|:-|:-|
+| **`DC`** | `IFRET`
`IFNOT:` | _`f - `_ | Performs a [`RET`](#instr-ret), but only if integer `f` is non-zero. If `f` is a `NaN`, throws an integer overflow exception. | `18` |
+| **`DD`** | `IFNOTRET`
`IF:` | _`f - `_ | Performs a [`RET`](#instr-ret), but only if integer `f` is zero. | `18` |
+| **`DE`** | `IF` | _`f c - `_ | Performs [`EXECUTE`](#instr-execute) for `c` (i.e., _executes_ `c`), but only if integer `f` is non-zero. Otherwise simply discards both values. | `18` |
+| **`DE`** | `IF:<{ code }>`
`<{ code }>IF` | _`f -`_ | Equivalent to [`<{ code }> CONT`](#instr-pushcont) [`IF`](#instr-if). | |
+| **`DF`** | `IFNOT` | _`f c - `_ | Executes continuation `c`, but only if integer `f` is zero. Otherwise simply discards both values. | `18` |
+| **`DF`** | `IFNOT:<{ code }>`
`<{ code }>IFNOT` | _`f -`_ | Equivalent to [`<{ code }> CONT`](#instr-pushcont) [`IFNOT`](#instr-ifnot). | |
+| **`E0`** | `IFJMP` | _`f c - `_ | Jumps to `c` (similarly to [`JMPX`](#instr-jmpx)), but only if `f` is non-zero. | `18` |
+| **`E0`** | `IFJMP:<{ code }>` | _`f -`_ | Equivalent to [`<{ code }> CONT`](#instr-pushcont) [`IFJMP`](#instr-ifjmp). | |
+| **`E1`** | `IFNOTJMP` | _`f c - `_ | Jumps to `c` (similarly to [`JMPX`](#instr-jmpx)), but only if `f` is zero. | `18` |
+| **`E1`** | `IFNOTJMP:<{ code }>` | _`f -`_ | Equivalent to [`<{ code }> CONT`](#instr-pushcont) [`IFNOTJMP`](#instr-ifnotjmp). | |
+| **`E2`** | `IFELSE` | _`f c c' - `_ | If integer `f` is non-zero, executes `c`, otherwise executes `c'`. Equivalent to [`CONDSELCHK`](#instr-condselchk) [`EXECUTE`](#instr-execute). | `18` |
+| **`E2`** | `IF:<{ code1 }>ELSE<{ code2 }>` | _`f -`_ | Equivalent to [`<{ code1 }> CONT`](#instr-pushcont) [`<{ code2 }> CONT`](#instr-pushcont) [`IFELSE`](#instr-ifelse). | |
+| **`E300`** | `[ref] IFREF` | _`f - `_ | Equivalent to [`PUSHREFCONT`](#instr-pushrefcont) [`IF`](#instr-if), with the optimization that the cell reference is not actually loaded into a _Slice_ and then converted into an ordinary _Continuation_ if `f=0`.
Gas consumption of this primitive depends on whether `f=0` and whether the reference was loaded before.
Similar remarks apply other primitives that accept a continuation as a reference. | `26/126/51` |
+| **`E301`** | `[ref] IFNOTREF` | _`f - `_ | Equivalent to [`PUSHREFCONT`](#instr-pushrefcont) [`IFNOT`](#instr-ifnot). | `26/126/51` |
+| **`E302`** | `[ref] IFJMPREF` | _`f - `_ | Equivalent to [`PUSHREFCONT`](#instr-pushrefcont) [`IFJMP`](#instr-ifjmp). | `26/126/51` |
+| **`E303`** | `[ref] IFNOTJMPREF` | _`f - `_ | Equivalent to [`PUSHREFCONT`](#instr-pushrefcont) [`IFNOTJMP`](#instr-ifnotjmp). | `26/126/51` |
+| **`E304`** | `CONDSEL` | _`f x y - x or y`_ | If integer `f` is non-zero, returns `x`, otherwise returns `y`. Notice that no type checks are performed on `x` and `y`; as such, it is more like a conditional stack operation. Roughly equivalent to [`ROT`](#instr-rot) [`ISZERO`](#instr-iszero) [`INC`](#instr-inc) [`ROLLX`](#instr-rollx) [`NIP`](#instr-nip). | `26` |
+| **`E305`** | `CONDSELCHK` | _`f x y - x or y`_ | Same as [`CONDSEL`](#instr-condsel), but first checks whether `x` and `y` have the same type. | `26` |
+| **`E308`** | `IFRETALT` | _`f -`_ | Performs [`RETALT`](#instr-retalt) if integer `f!=0`. | `26` |
+| **`E309`** | `IFNOTRETALT` | _`f -`_ | Performs [`RETALT`](#instr-retalt) if integer `f=0`. | `26` |
+| **`E30D`** | `[ref] IFREFELSE` | _`f c -`_ | Equivalent to [`PUSHREFCONT`](#instr-pushrefcont) [`SWAP`](#instr-swap) [`IFELSE`](#instr-ifelse), with the optimization that the cell reference is not actually loaded into a _Slice_ and then converted into an ordinary _Continuation_ if `f=0`. Similar remarks apply to the next two primitives: cells are converted into continuations only when necessary. | `26/126/51` |
+| **`E30E`** | `[ref] IFELSEREF` | _`f c -`_ | Equivalent to [`PUSHREFCONT`](#instr-pushrefcont) [`IFELSE`](#instr-ifelse). | `26/126/51` |
+| **`E30F`** | `[ref] [ref] IFREFELSEREF` | _`f -`_ | Equivalent to [`PUSHREFCONT`](#instr-pushrefcont) [`PUSHREFCONT`](#instr-pushrefcont) [`IFELSE`](#instr-ifelse). | `126/51` |
+| **`E39_n`** | `[n] IFBITJMP` | _`x c - x`_ | Checks whether bit `0 <= n <= 31` is set in integer `x`, and if so, performs [`JMPX`](#instr-jmpx) to continuation `c`. Value `x` is left in the stack. | `26` |
+| **`E3B_n`** | `[n] IFNBITJMP` | _`x c - x`_ | Jumps to `c` if bit `0 <= n <= 31` is not set in integer `x`. | `26` |
+| **`E3D_n`** | `[ref] [n] IFBITJMPREF` | _`x - x`_ | Performs a [`JMPREF`](#instr-jmpref) if bit `0 <= n <= 31` is set in integer `x`. | `126/51` |
+| **`E3F_n`** | `[ref] [n] IFNBITJMPREF` | _`x - x`_ | Performs a [`JMPREF`](#instr-jmpref) if bit `0 <= n <= 31` is not set in integer `x`. | `126/51` |
+### 8.3 Control flow primitives: loops
+| xxxxxxx
Opcode | xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Fift syntax | xxxxxxxxxxxxxxxxx
Stack | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Description | xxxx
Gas |
+|:-|:-|:-|:-|:-|
+| **`E4`** | `REPEAT` | _`n c - `_ | Executes continuation `c` `n` times, if integer `n` is non-negative. If `n>=2^31` or `n<-2^31`, generates a range check exception.
Notice that a [`RET`](#instr-ret) inside the code of `c` works as a `continue`, not as a `break`. One should use either alternative (experimental) loops or alternative [`RETALT`](#instr-retalt) (along with a [`SETEXITALT`](#instr-setexitalt) before the loop) to `break` out of a loop. | `18` |
+| **`E4`** | `REPEAT:<{ code }>`
`<{ code }>REPEAT` | _`n -`_ | Equivalent to [`<{ code }> CONT`](#instr-pushcont) [`REPEAT`](#instr-repeat). | |
+| **`E5`** | `REPEATEND`
`REPEAT:` | _`n - `_ | Similar to [`REPEAT`](#instr-repeat), but it is applied to the current continuation `cc`. | `18` |
+| **`E6`** | `UNTIL` | _`c - `_ | Executes continuation `c`, then pops an integer `x` from the resulting stack. If `x` is zero, performs another iteration of this loop. The actual implementation of this primitive involves an extraordinary continuation `ec_until` with its arguments set to the body of the loop (continuation `c`) and the original current continuation `cc`. This extraordinary continuation is then saved into the savelist of `c` as `c.c0` and the modified `c` is then executed. The other loop primitives are implemented similarly with the aid of suitable extraordinary continuations. | `18` |
+| **`E6`** | `UNTIL:<{ code }>`
`<{ code }>UNTIL` | _`-`_ | Equivalent to [`<{ code }> CONT`](#instr-pushcont) [`UNTIL`](#instr-until). | |
+| **`E7`** | `UNTILEND`
`UNTIL:` | _`-`_ | Similar to [`UNTIL`](#instr-until), but executes the current continuation `cc` in a loop. When the loop exit condition is satisfied, performs a [`RET`](#instr-ret). | `18` |
+| **`E8`** | `WHILE` | _`c' c - `_ | Executes `c'` and pops an integer `x` from the resulting stack. If `x` is zero, exists the loop and transfers control to the original `cc`. If `x` is non-zero, executes `c`, and then begins a new iteration. | `18` |
+| **`E8`** | `WHILE:<{ cond }>DO<{ code }>` | _`-`_ | Equivalent to [`<{ cond }> CONT`](#instr-pushcont) [`<{ code }> CONT`](#instr-pushcont) [`WHILE`](#instr-while). | |
+| **`E9`** | `WHILEEND` | _`c' - `_ | Similar to [`WHILE`](#instr-while), but uses the current continuation `cc` as the loop body. | `18` |
+| **`EA`** | `AGAIN` | _`c - `_ | Similar to [`REPEAT`](#instr-repeat), but executes `c` infinitely many times. A [`RET`](#instr-ret) only begins a new iteration of the infinite loop, which can be exited only by an exception, or a [`RETALT`](#instr-retalt) (or an explicit [`JMPX`](#instr-jmpx)). | `18` |
+| **`EA`** | `AGAIN:<{ code }>`
`<{ code }>AGAIN` | _`-`_ | Equivalent to [`<{ code }> CONT`](#instr-pushcont) [`AGAIN`](#instr-again). | |
+| **`EB`** | `AGAINEND`
`AGAIN:` | _`-`_ | Similar to [`AGAIN`](#instr-again), but performed with respect to the current continuation `cc`. | `18` |
+| **`E314`** | `REPEATBRK` | _`n c -`_ | Similar to [`REPEAT`](#instr-repeat), but also sets `c1` to the original `cc` after saving the old value of `c1` into the savelist of the original `cc`. In this way [`RETALT`](#instr-retalt) could be used to break out of the loop body. | `26` |
+| **`E314`** | `REPEATBRK:<{ code }>`
`<{ code }>REPEATBRK` | _`n -`_ | Equivalent to [`<{ code }> CONT`](#instr-pushcont) [`REPEATBRK`](#instr-repeatbrk). | |
+| **`E315`** | `REPEATENDBRK` | _`n -`_ | Similar to [`REPEATEND`](#instr-repeatend), but also sets `c1` to the original `c0` after saving the old value of `c1` into the savelist of the original `c0`. Equivalent to [`SAMEALTSAVE`](#instr-samealtsave) [`REPEATEND`](#instr-repeatend). | `26` |
+| **`E316`** | `UNTILBRK` | _`c -`_ | Similar to [`UNTIL`](#instr-until), but also modifies `c1` in the same way as [`REPEATBRK`](#instr-repeatbrk). | `26` |
+| **`E316`** | `UNTILBRK:<{ code }>` | _`-`_ | Equivalent to [`<{ code }> CONT`](#instr-pushcont) [`UNTILBRK`](#instr-untilbrk). | |
+| **`E317`** | `UNTILENDBRK`
`UNTILBRK:` | _`-`_ | Equivalent to [`SAMEALTSAVE`](#instr-samealtsave) [`UNTILEND`](#instr-untilend). | `26` |
+| **`E318`** | `WHILEBRK` | _`c' c -`_ | Similar to [`WHILE`](#instr-while), but also modifies `c1` in the same way as [`REPEATBRK`](#instr-repeatbrk). | `26` |
+| **`E318`** | `WHILEBRK:<{ cond }>DO<{ code }>` | _`-`_ | Equivalent to [`<{ cond }> CONT`](#instr-pushcont) [`<{ code }> CONT`](#instr-pushcont) [`WHILEBRK`](#instr-whilebrk). | |
+| **`E319`** | `WHILEENDBRK` | _`c -`_ | Equivalent to [`SAMEALTSAVE`](#instr-samealtsave) [`WHILEEND`](#instr-whileend). | `26` |
+| **`E31A`** | `AGAINBRK` | _`c -`_ | Similar to [`AGAIN`](#instr-again), but also modifies `c1` in the same way as [`REPEATBRK`](#instr-repeatbrk). | `26` |
+| **`E31A`** | `AGAINBRK:<{ code }>` | _`-`_ | Equivalent to [`<{ code }> CONT`](#instr-pushcont) [`AGAINBRK`](#instr-againbrk). | |
+| **`E31B`** | `AGAINENDBRK`
`AGAINBRK:` | _`-`_ | Equivalent to [`SAMEALTSAVE`](#instr-samealtsave) [`AGAINEND`](#instr-againend). | `26` |
+### 8.4 Manipulating the stack of continuations
+Here `s"` is the [fee for moving stack elements between continuations](#11-gas-prices). It is equal to the size of the resulting stack minus 32 (or 0 if the stack is smaller than 32).
+
+| xxxxxxx
Opcode | xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Fift syntax | xxxxxxxxxxxxxxxxx
Stack | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Description | xxxx
Gas |
+|:-|:-|:-|:-|:-|
+| **`ECrn`** | `[r] [n] SETCONTARGS` | _`x_1 x_2...x_r c - c'`_ | Similar to [`[r] -1 SETCONTARGS`](#instr-setcontargs-n), but sets `c.nargs` to the final size of the stack of `c'` plus `n`. In other words, transforms `c` into a _closure_ or a _partially applied function_, with `0 <= n <= 14` arguments missing. | `26+s”` |
+| **`EC0n`** | `[n] SETNUMARGS` | _`c - c'`_ | Sets `c.nargs` to `n` plus the current depth of `c`'s stack, where `0 <= n <= 14`. If `c.nargs` is already set to a non-negative value, does nothing. | `26` |
+| **`ECrF`** | `[r] -1 SETCONTARGS` | _`x_1 x_2...x_r c - c'`_ | Pushes `0 <= r <= 15` values `x_1...x_r` into the stack of (a copy of) the continuation `c`, starting with `x_1`. If the final depth of `c`'s stack turns out to be greater than `c.nargs`, a stack overflow exception is generated. | `26+s”` |
+| **`ED0p`** | `[p] RETURNARGS` | _`-`_ | Leaves only the top `0 <= p <= 15` values in the current stack (somewhat similarly to [`ONLYTOPX`](#instr-onlytopx)), with all the unused bottom values not discarded, but saved into continuation `c0` in the same way as [`SETCONTARGS`](#instr-setcontargs-n) does. | `26+s”` |
+| **`ED10`** | `RETURNVARARGS` | _`p -`_ | Similar to [`RETURNARGS`](#instr-returnargs), but with Integer `0 <= p <= 255` taken from the stack. | `26+s”` |
+| **`ED11`** | `SETCONTVARARGS` | _`x_1 x_2...x_r c r n - c'`_ | Similar to [`SETCONTARGS`](#instr-setcontargs-n), but with `0 <= r <= 255` and `-1 <= n <= 255` taken from the stack. | `26+s”` |
+| **`ED12`** | `SETNUMVARARGS` | _`c n - c'`_ | `-1 <= n <= 255`
If `n=-1`, this operation does nothing (`c'=c`).
Otherwise its action is similar to [`[n] SETNUMARGS`](#instr-setnumargs), but with `n` taken from the stack. | `26` |
+### 8.5 Creating simple continuations and closures
+| xxxxxxx
Opcode | xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Fift syntax | xxxxxxxxxxxxxxxxx
Stack | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Description | xxxx
Gas |
+|:-|:-|:-|:-|:-|
+| **`ED1E`** | `BLESS` | _`s - c`_ | Transforms a _Slice_ `s` into a simple ordinary continuation `c`, with `c.code=s` and an empty stack and savelist. | `26` |
+| **`ED1F`** | `BLESSVARARGS` | _`x_1...x_r s r n - c`_ | Equivalent to [`ROT`](#instr-rot) [`BLESS`](#instr-bless) [`ROTREV`](#instr-rotrev) [`SETCONTVARARGS`](#instr-setcontvarargs). | `26+s”` |
+| **`EErn`** | `[r] [n] BLESSARGS` | _`x_1...x_r s - c`_ | `0 <= r <= 15`, `-1 <= n <= 14`
Equivalent to [`BLESS`](#instr-bless) [`[r] [n] SETCONTARGS`](#instr-setcontargs-n).
The value of `n` is represented inside the instruction by the 4-bit integer `n mod 16`. | `26` |
+| **`EE0n`** | `[n] BLESSNUMARGS` | _`s - c`_ | Also transforms a _Slice_ `s` into a _Continuation_ `c`, but sets `c.nargs` to `0 <= n <= 14`. | `26` |
+### 8.6 Operations with continuation savelists and control registers
+| xxxxxxx
Opcode | xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Fift syntax | xxxxxxxxxxxxxxxxx
Stack | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Description | xxxx
Gas |
+|:-|:-|:-|:-|:-|
+| **`ED4i`** | `c[i] PUSHCTR`
`c[i] PUSH` | _`- x`_ | Pushes the current value of control register `c(i)`. If the control register is not supported in the current codepage, or if it does not have a value, an exception is triggered. | `26` |
+| **`ED44`** | `c4 PUSHCTR`
`c4 PUSH` | _`- x`_ | Pushes the “global data root'' cell reference, thus enabling access to persistent smart-contract data. | `26` |
+| **`ED5i`** | `c[i] POPCTR`
`c[i] POP` | _`x - `_ | Pops a value `x` from the stack and stores it into control register `c(i)`, if supported in the current codepage. Notice that if a control register accepts only values of a specific type, a type-checking exception may occur. | `26` |
+| **`ED54`** | `c4 POPCTR`
`c4 POP` | _`x -`_ | Sets the “global data root'' cell reference, thus allowing modification of persistent smart-contract data. | `26` |
+| **`ED6i`** | `c[i] SETCONT`
`c[i] SETCONTCTR` | _`x c - c'`_ | Stores `x` into the savelist of continuation `c` as `c(i)`, and returns the resulting continuation `c'`. Almost all operations with continuations may be expressed in terms of [`SETCONTCTR`](#instr-setcontctr), [`POPCTR`](#instr-popctr), and [`PUSHCTR`](#instr-pushctr). | `26` |
+| **`ED7i`** | `c[i] SETRETCTR` | _`x - `_ | Equivalent to [`c0 PUSHCTR`](#instr-pushctr) [`c[i] SETCONTCTR`](#instr-setcontctr) [`c0 POPCTR`](#instr-popctr). | `26` |
+| **`ED8i`** | `c[i] SETALTCTR` | _`x - `_ | Equivalent to [`c1 PUSHCTR`](#instr-pushctr) [`c[i] SETCONTCTR`](#instr-setcontctr) [`c0 POPCTR`](#instr-popctr). | `26` |
+| **`ED9i`** | `c[i] POPSAVE`
`c[i] POPCTRSAVE` | _`x -`_ | Similar to [`c[i] POPCTR`](#instr-popctr), but also saves the old value of `c[i]` into continuation `c0`.
Equivalent (up to exceptions) to [`c[i] SAVECTR`](#instr-save) [`c[i] POPCTR`](#instr-popctr). | `26` |
+| **`EDAi`** | `c[i] SAVE`
`c[i] SAVECTR` | | Saves the current value of `c(i)` into the savelist of continuation `c0`. If an entry for `c[i]` is already present in the savelist of `c0`, nothing is done. Equivalent to [`c[i] PUSHCTR`](#instr-pushctr) [`c[i] SETRETCTR`](#instr-setretctr). | `26` |
+| **`EDBi`** | `c[i] SAVEALT`
`c[i] SAVEALTCTR` | | Similar to [`c[i] SAVE`](#instr-save), but saves the current value of `c[i]` into the savelist of `c1`, not `c0`. | `26` |
+| **`EDCi`** | `c[i] SAVEBOTH`
`c[i] SAVEBOTHCTR` | | Equivalent to [`DUP`](#instr-dup) [`c[i] SAVE`](#instr-save) [`c[i] SAVEALT`](#instr-savealt). | `26` |
+| **`EDE0`** | `PUSHCTRX` | _`i - x`_ | Similar to [`c[i] PUSHCTR`](#instr-pushctr), but with `i`, `0 <= i <= 255`, taken from the stack.
Notice that this primitive is one of the few “exotic'' primitives, which are not polymorphic like stack manipulation primitives, and at the same time do not have well-defined types of parameters and return values, because the type of `x` depends on `i`. | `26` |
+| **`EDE1`** | `POPCTRX` | _`x i - `_ | Similar to [`c[i] POPCTR`](#instr-popctr), but with `0 <= i <= 255` from the stack. | `26` |
+| **`EDE2`** | `SETCONTCTRX` | _`x c i - c'`_ | Similar to [`c[i] SETCONTCTR`](#instr-setcontctr), but with `0 <= i <= 255` from the stack. | `26` |
+| **`EDF0`** | `COMPOS`
`BOOLAND` | _`c c' - c''`_ | Computes the composition `compose0(c, c’)`, which has the meaning of “perform `c`, and, if successful, perform `c'`'' (if `c` is a boolean circuit) or simply “perform `c`, then `c'`''. Equivalent to [`SWAP`](#instr-swap) [`c0 SETCONT`](#instr-setcontctr). | `26` |
+| **`EDF1`** | `COMPOSALT`
`BOOLOR` | _`c c' - c''`_ | Computes the alternative composition `compose1(c, c’)`, which has the meaning of “perform `c`, and, if not successful, perform `c'`'' (if `c` is a boolean circuit). Equivalent to [`SWAP`](#instr-swap) [`c1 SETCONT`](#instr-setcontctr). | `26` |
+| **`EDF2`** | `COMPOSBOTH` | _`c c' - c''`_ | Computes composition `compose1(compose0(c, c’), c’)`, which has the meaning of “compute boolean circuit `c`, then compute `c'`, regardless of the result of `c`''. | `26` |
+| **`EDF3`** | `ATEXIT` | _`c - `_ | Sets `c0` to `compose0(c, c0)`. In other words, `c` will be executed before exiting current subroutine. | `26` |
+| **`EDF3`** | `ATEXIT:<{ code }>`
`<{ code }>ATEXIT` | _`-`_ | Equivalent to [`<{ code }> CONT`](#instr-pushcont) [`ATEXIT`](#instr-atexit). | |
+| **`EDF4`** | `ATEXITALT` | _`c - `_ | Sets `c1` to `compose1(c, c1)`. In other words, `c` will be executed before exiting current subroutine by its alternative return path. | `26` |
+| **`EDF4`** | `ATEXITALT:<{ code }>`
`<{ code }>ATEXITALT` | _`-`_ | Equivalent to [`<{ code }> CONT`](#instr-pushcont) [`ATEXITALT`](#instr-atexitalt). | |
+| **`EDF5`** | `SETEXITALT` | _`c - `_ | Sets `c1` to `compose1(compose0(c, c0), c1)`,
In this way, a subsequent [`RETALT`](#instr-retalt) will first execute `c`, then transfer control to the original `c0`. This can be used, for instance, to exit from nested loops. | `26` |
+| **`EDF6`** | `THENRET` | _`c - c'`_ | Computes `compose0(c, c0)`. | `26` |
+| **`EDF7`** | `THENRETALT` | _`c - c'`_ | Computes `compose0(c, c1)` | `26` |
+| **`EDF8`** | `INVERT` | _`-`_ | Interchanges `c0` and `c1`. | `26` |
+| **`EDF9`** | `BOOLEVAL` | _`c - ?`_ | Performs `cc:=compose1(compose0(c, compose0(-1 PUSHINT, cc)), compose0(0 PUSHINT, cc))`. If `c` represents a boolean circuit, the net effect is to evaluate it and push either `-1` or `0` into the stack before continuing. | `26` |
+| **`EDFA`** | `SAMEALT` | _`-`_ | Sets `c1` to `c0`. Equivalent to [`c0 PUSHCTR`](#instr-pushctr) [`c1 POPCTR`](#instr-popctr). | `26` |
+| **`EDFB`** | `SAMEALTSAVE` | _`-`_ | Sets `c1` to `c0`, but first saves the old value of `c1` into the savelist of `c0`.
Equivalent to [`c1 SAVE`](#instr-save) [`SAMEALT`](#instr-samealt). | `26` |
+### 8.7 Dictionary subroutine calls and jumps
+| xxxxxxx
Opcode | xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Fift syntax | xxxxxxxxxxxxxxxxx
Stack | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Description | xxxx
Gas |
+|:-|:-|:-|:-|:-|
+| **`F0nn`** | `[nn] CALL`
`[nn] CALLDICT` | _`- nn`_ | Calls the continuation in `c3`, pushing integer `0 <= nn <= 255` into its stack as an argument.
Approximately equivalent to [`[nn] PUSHINT`](#instr-pushint-4) [`c3 PUSHCTR`](#instr-pushctr) [`EXECUTE`](#instr-execute). | |
+| **`F12_n`** | `[n] CALL`
`[n] CALLDICT` | _`- n`_ | For `0 <= n < 2^14`, an encoding of [`[n] CALL`](#instr-calldict) for larger values of `n`. | |
+| **`F16_n`** | `[n] JMP` | _` - n`_ | Jumps to the continuation in `c3`, pushing integer `0 <= n < 2^14` as its argument.
Approximately equivalent to [`n PUSHINT`](#instr-pushint-4) [`c3 PUSHCTR`](#instr-pushctr) [`JMPX`](#instr-jmpx). | |
+| **`F1A_n`** | `[n] PREPARE`
`[n] PREPAREDICT` | _` - n c`_ | Equivalent to [`n PUSHINT`](#instr-pushint-4) [`c3 PUSHCTR`](#instr-pushctr), for `0 <= n < 2^14`.
In this way, [`[n] CALL`](#instr-calldict) is approximately equivalent to [`[n] PREPARE`](#instr-preparedict) [`EXECUTE`](#instr-execute), and [`[n] JMP`](#instr-jmpdict) is approximately equivalent to [`[n] PREPARE`](#instr-preparedict) [`JMPX`](#instr-jmpx).
One might use, for instance, [`CALLXARGS`](#instr-callxargs) or [`CALLCC`](#instr-callcc) instead of [`EXECUTE`](#instr-execute) here. | |
+
+## 9 Exception generating and handling primitives
+| xxxxxxx
Opcode | xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Fift syntax | xxxxxxxxxxxxxxxxx
Stack | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Description | xxxx
Gas |
+|:-|:-|:-|:-|:-|
+| **`F22_n`** | `[n] THROW` | _` - 0 n`_ | Throws exception `0 <= n <= 63` with parameter zero.
In other words, it transfers control to the continuation in `c2`, pushing `0` and `n` into its stack, and discarding the old stack altogether. | `76` |
+| **`F26_n`** | `[n] THROWIF` | _`f - `_ | Throws exception `0 <= n <= 63` with parameter zero only if integer `f!=0`. | `26/76` |
+| **`F2A_n`** | `[n] THROWIFNOT` | _`f - `_ | Throws exception `0 <= n <= 63` with parameter zero only if integer `f=0`. | `26/76` |
+| **`F2C4_n`** | `[n] THROW` | _`- 0 nn`_ | For `0 <= n < 2^11`, an encoding of [`[n] THROW`](#instr-throw-short) for larger values of `n`. | `84` |
+| **`F2CC_n`** | `[n] THROWARG` | _`x - x nn`_ | Throws exception `0 <= n < 2^11` with parameter `x`, by copying `x` and `n` into the stack of `c2` and transferring control to `c2`. | `84` |
+| **`F2D4_n`** | `[n] THROWIF` | _`f - `_ | For `0 <= n < 2^11`, an encoding of [`[n] THROWIF`](#instr-throwif-short) for larger values of `n`. | `34/84` |
+| **`F2DC_n`** | `[n] THROWARGIF` | _`x f - `_ | Throws exception `0 <= nn < 2^11` with parameter `x` only if integer `f!=0`. | `34/84` |
+| **`F2E4_n`** | `[n] THROWIFNOT` | _`f - `_ | For `0 <= n < 2^11`, an encoding of [`[n] THROWIFNOT`](#instr-throwifnot-short) for larger values of `n`. | `34/84` |
+| **`F2EC_n`** | `[n] THROWARGIFNOT` | _`x f - `_ | Throws exception `0 <= n < 2^11` with parameter `x` only if integer `f=0`. | `34/84` |
+| **`F2F0`** | `THROWANY` | _`n - 0 n`_ | Throws exception `0 <= n < 2^16` with parameter zero.
Approximately equivalent to [`ZERO`](#instr-zero) [`SWAP`](#instr-swap) [`THROWARGANY`](#instr-throwargany). | `76` |
+| **`F2F1`** | `THROWARGANY` | _`x n - x n`_ | Throws exception `0 <= n < 2^16` with parameter `x`, transferring control to the continuation in `c2`.
Approximately equivalent to [`c2 PUSHCTR`](#instr-pushctr) [`2 JMPXARGS`](#instr-jmpxargs). | `76` |
+| **`F2F2`** | `THROWANYIF` | _`n f - `_ | Throws exception `0 <= n < 2^16` with parameter zero only if `f!=0`. | `26/76` |
+| **`F2F3`** | `THROWARGANYIF` | _`x n f - `_ | Throws exception `0 <= n<2^16` with parameter `x` only if `f!=0`. | `26/76` |
+| **`F2F4`** | `THROWANYIFNOT` | _`n f - `_ | Throws exception `0 <= n<2^16` with parameter zero only if `f=0`. | `26/76` |
+| **`F2F5`** | `THROWARGANYIFNOT` | _`x n f - `_ | Throws exception `0 <= n<2^16` with parameter `x` only if `f=0`. | `26/76` |
+| **`F2FF`** | `TRY` | _`c c' - `_ | Sets `c2` to `c'`, first saving the old value of `c2` both into the savelist of `c'` and into the savelist of the current continuation, which is stored into `c.c0` and `c'.c0`. Then runs `c` similarly to [`EXECUTE`](#instr-execute). If `c` does not throw any exceptions, the original value of `c2` is automatically restored on return from `c`. If an exception occurs, the execution is transferred to `c'`, but the original value of `c2` is restored in the process, so that `c'` can re-throw the exception by [`THROWANY`](#instr-throwany) if it cannot handle it by itself. | `26` |
+| **`F2FF`** | `TRY:<{ code1 }>CATCH<{ code2 }>` | _`-`_ | Equivalent to [`<{ code1 }> CONT`](#instr-pushcont) [`<{ code2 }> CONT`](#instr-pushcont) [`TRY`](#instr-try). | |
+| **`F3pr`** | `[p] [r] TRYARGS` | _`c c' - `_ | Similar to [`TRY`](#instr-try), but with [`[p] [r] CALLXARGS`](#instr-callxargs) internally used instead of [`EXECUTE`](#instr-execute).
In this way, all but the top `0 <= p <= 15` stack elements will be saved into current continuation's stack, and then restored upon return from either `c` or `c'`, with the top `0 <= r <= 15` values of the resulting stack of `c` or `c'` copied as return values. | `26` |
+
+## 10 Dictionary manipulation primitives
+Gas consumption of most of the dictionary operations is not fixed, it depends on the contents of the given dictionary.
+### 10.1 Dictionary creation
+| xxxxxxx
Opcode | xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Fift syntax | xxxxxxxxxxxxxxxxx
Stack | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Description | xxxx
Gas |
+|:-|:-|:-|:-|:-|
+| **`6D`** | `NEWDICT` | _` - D`_ | Returns a new empty dictionary.
It is an alternative mnemonics for [`PUSHNULL`](#instr-null). | `18` |
+| **`6E`** | `DICTEMPTY` | _`D - ?`_ | Checks whether dictionary `D` is empty, and returns `-1` or `0` accordingly.
It is an alternative mnemonics for [`ISNULL`](#instr-isnull). | `18` |
+### 10.2 Dictionary serialization and deserialization
+| xxxxxxx
Opcode | xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Fift syntax | xxxxxxxxxxxxxxxxx
Stack | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Description | xxxx
Gas |
+|:-|:-|:-|:-|:-|
+| **`CE`** | `STDICTS`
`` | _`s b - b'`_ | Stores a _Slice_-represented dictionary `s` into _Builder_ `b`.
It is actually a synonym for [`STSLICE`](#instr-stslice). | `18` |
+| **`F400`** | `STDICT`
`STOPTREF` | _`D b - b'`_ | Stores dictionary `D` into _Builder_ `b`, returing the resulting _Builder_ `b'`.
In other words, if `D` is a cell, performs [`STONE`](#instr-stone) and [`STREF`](#instr-stref); if `D` is _Null_, performs [`NIP`](#instr-nip) and [`STZERO`](#instr-stzero); otherwise throws a type checking exception. | `26` |
+| **`F401`** | `SKIPDICT`
`SKIPOPTREF` | _`s - s'`_ | Equivalent to [`LDDICT`](#instr-lddict) [`NIP`](#instr-nip). | `26` |
+| **`F402`** | `LDDICTS` | _`s - s' s''`_ | Loads (parses) a (_Slice_-represented) dictionary `s'` from _Slice_ `s`, and returns the remainder of `s` as `s''`.
This is a “split function'' for all `HashmapE(n,X)` dictionary types. | `26` |
+| **`F403`** | `PLDDICTS` | _`s - s'`_ | Preloads a (_Slice_-represented) dictionary `s'` from _Slice_ `s`.
Approximately equivalent to [`LDDICTS`](#instr-lddicts) [`DROP`](#instr-drop). | `26` |
+| **`F404`** | `LDDICT`
`LDOPTREF` | _`s - D s'`_ | Loads (parses) a dictionary `D` from _Slice_ `s`, and returns the remainder of `s` as `s'`. May be applied to dictionaries or to values of arbitrary `(^Y)?` types. | `26` |
+| **`F405`** | `PLDDICT`
`PLDOPTREF` | _`s - D`_ | Preloads a dictionary `D` from _Slice_ `s`.
Approximately equivalent to [`LDDICT`](#instr-lddict) [`DROP`](#instr-drop). | `26` |
+| **`F406`** | `LDDICTQ` | _`s - D s' -1 or s 0`_ | A quiet version of [`LDDICT`](#instr-lddict). | `26` |
+| **`F407`** | `PLDDICTQ` | _`s - D -1 or 0`_ | A quiet version of [`PLDDICT`](#instr-plddict). | `26` |
+### 10.3 Get dictionary operations
+| xxxxxxx
Opcode | xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Fift syntax | xxxxxxxxxxxxxxxxx
Stack | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Description | xxxx
Gas |
+|:-|:-|:-|:-|:-|
+| **`F40A`** | `DICTGET` | _`k D n - x -1 or 0`_ | Looks up key `k` (represented by a _Slice_, the first `0 <= n <= 1023` data bits of which are used as a key) in dictionary `D` of type `HashmapE(n,X)` with `n`-bit keys.
On success, returns the value found as a _Slice_ `x`. | |
+| **`F40B`** | `DICTGETREF` | _`k D n - c -1 or 0`_ | Similar to [`DICTGET`](#instr-dictget), but with a [`LDREF`](#instr-ldref) [`ENDS`](#instr-ends) applied to `x` on success.
This operation is useful for dictionaries of type `HashmapE(n,^Y)`. | |
+| **`F40C`** | `DICTIGET` | _`i D n - x -1 or 0`_ | Similar to [`DICTGET`](#instr-dictget), but with a signed (big-endian) `n`-bit _Integer_ `i` as a key. If `i` does not fit into `n` bits, returns `0`. If `i` is a `NaN`, throws an integer overflow exception. | |
+| **`F40D`** | `DICTIGETREF` | _`i D n - c -1 or 0`_ | Combines [`DICTIGET`](#instr-dictiget) with [`DICTGETREF`](#instr-dictgetref): it uses signed `n`-bit _Integer_ `i` as a key and returns a _Cell_ instead of a _Slice_ on success. | |
+| **`F40E`** | `DICTUGET` | _`i D n - x -1 or 0`_ | Similar to [`DICTIGET`](#instr-dictiget), but with _unsigned_ (big-endian) `n`-bit _Integer_ `i` used as a key. | |
+| **`F40F`** | `DICTUGETREF` | _`i D n - c -1 or 0`_ | Similar to [`DICTIGETREF`](#instr-dictigetref), but with an unsigned `n`-bit _Integer_ key `i`. | |
+### 10.4 Set/Replace/Add dictionary operations
+| xxxxxxx
Opcode | xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Fift syntax | xxxxxxxxxxxxxxxxx
Stack | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Description | xxxx
Gas |
+|:-|:-|:-|:-|:-|
+| **`F412`** | `DICTSET` | _`x k D n - D'`_ | Sets the value associated with `n`-bit key `k` (represented by a _Slice_ as in [`DICTGET`](#instr-dictget)) in dictionary `D` (also represented by a _Slice_) to value `x` (again a _Slice_), and returns the resulting dictionary as `D'`. | |
+| **`F413`** | `DICTSETREF` | _`c k D n - D'`_ | Similar to [`DICTSET`](#instr-dictset), but with the value set to a reference to _Cell_ `c`. | |
+| **`F414`** | `DICTISET` | _`x i D n - D'`_ | Similar to [`DICTSET`](#instr-dictset), but with the key represented by a (big-endian) signed `n`-bit integer `i`. If `i` does not fit into `n` bits, a range check exception is generated. | |
+| **`F415`** | `DICTISETREF` | _`c i D n - D'`_ | Similar to [`DICTSETREF`](#instr-dictsetref), but with the key a signed `n`-bit integer as in [`DICTISET`](#instr-dictiset). | |
+| **`F416`** | `DICTUSET` | _`x i D n - D'`_ | Similar to [`DICTISET`](#instr-dictiset), but with `i` an _unsigned_ `n`-bit integer. | |
+| **`F417`** | `DICTUSETREF` | _`c i D n - D'`_ | Similar to [`DICTISETREF`](#instr-dictisetref), but with `i` unsigned. | |
+| **`F41A`** | `DICTSETGET` | _`x k D n - D' y -1 or D' 0`_ | Combines [`DICTSET`](#instr-dictset) with [`DICTGET`](#instr-dictget): it sets the value corresponding to key `k` to `x`, but also returns the old value `y` associated with the key in question, if present. | |
+| **`F41B`** | `DICTSETGETREF` | _`c k D n - D' c' -1 or D' 0`_ | Combines [`DICTSETREF`](#instr-dictsetref) with [`DICTGETREF`](#instr-dictgetref) similarly to [`DICTSETGET`](#instr-dictsetget). | |
+| **`F41C`** | `DICTISETGET` | _`x i D n - D' y -1 or D' 0`_ | [`DICTISETGET`](#instr-dictisetget), but with `i` a signed `n`-bit integer. | |
+| **`F41D`** | `DICTISETGETREF` | _`c i D n - D' c' -1 or D' 0`_ | [`DICTISETGETREF`](#instr-dictisetgetref), but with `i` a signed `n`-bit integer. | |
+| **`F41E`** | `DICTUSETGET` | _`x i D n - D' y -1 or D' 0`_ | [`DICTISETGET`](#instr-dictisetget), but with `i` an unsigned `n`-bit integer. | |
+| **`F41F`** | `DICTUSETGETREF` | _`c i D n - D' c' -1 or D' 0`_ | [`DICTISETGETREF`](#instr-dictisetgetref), but with `i` an unsigned `n`-bit integer. | |
+| **`F422`** | `DICTREPLACE` | _`x k D n - D' -1 or D 0`_ | A _Replace_ operation, which is similar to [`DICTSET`](#instr-dictset), but sets the value of key `k` in dictionary `D` to `x` only if the key `k` was already present in `D`. | |
+| **`F423`** | `DICTREPLACEREF` | _`c k D n - D' -1 or D 0`_ | A _Replace_ counterpart of [`DICTSETREF`](#instr-dictsetref). | |
+| **`F424`** | `DICTIREPLACE` | _`x i D n - D' -1 or D 0`_ | [`DICTREPLACE`](#instr-dictreplace), but with `i` a signed `n`-bit integer. | |
+| **`F425`** | `DICTIREPLACEREF` | _`c i D n - D' -1 or D 0`_ | [`DICTREPLACEREF`](#instr-dictreplaceref), but with `i` a signed `n`-bit integer. | |
+| **`F426`** | `DICTUREPLACE` | _`x i D n - D' -1 or D 0`_ | [`DICTREPLACE`](#instr-dictreplace), but with `i` an unsigned `n`-bit integer. | |
+| **`F427`** | `DICTUREPLACEREF` | _`c i D n - D' -1 or D 0`_ | [`DICTREPLACEREF`](#instr-dictreplaceref), but with `i` an unsigned `n`-bit integer. | |
+| **`F42A`** | `DICTREPLACEGET` | _`x k D n - D' y -1 or D 0`_ | A _Replace_ counterpart of [`DICTSETGET`](#instr-dictsetget): on success, also returns the old value associated with the key in question. | |
+| **`F42B`** | `DICTREPLACEGETREF` | _`c k D n - D' c' -1 or D 0`_ | A _Replace_ counterpart of [`DICTSETGETREF`](#instr-dictsetgetref). | |
+| **`F42C`** | `DICTIREPLACEGET` | _`x i D n - D' y -1 or D 0`_ | [`DICTREPLACEGET`](#instr-dictreplaceget), but with `i` a signed `n`-bit integer. | |
+| **`F42D`** | `DICTIREPLACEGETREF` | _`c i D n - D' c' -1 or D 0`_ | [`DICTREPLACEGETREF`](#instr-dictreplacegetref), but with `i` a signed `n`-bit integer. | |
+| **`F42E`** | `DICTUREPLACEGET` | _`x i D n - D' y -1 or D 0`_ | [`DICTREPLACEGET`](#instr-dictreplaceget), but with `i` an unsigned `n`-bit integer. | |
+| **`F42F`** | `DICTUREPLACEGETREF` | _`c i D n - D' c' -1 or D 0`_ | [`DICTREPLACEGETREF`](#instr-dictreplacegetref), but with `i` an unsigned `n`-bit integer. | |
+| **`F432`** | `DICTADD` | _`x k D n - D' -1 or D 0`_ | An _Add_ counterpart of [`DICTSET`](#instr-dictset): sets the value associated with key `k` in dictionary `D` to `x`, but only if it is not already present in `D`. | |
+| **`F433`** | `DICTADDREF` | _`c k D n - D' -1 or D 0`_ | An _Add_ counterpart of [`DICTSETREF`](#instr-dictsetref). | |
+| **`F434`** | `DICTIADD` | _`x i D n - D' -1 or D 0`_ | [`DICTADD`](#instr-dictadd), but with `i` a signed `n`-bit integer. | |
+| **`F435`** | `DICTIADDREF` | _`c i D n - D' -1 or D 0`_ | [`DICTADDREF`](#instr-dictaddref), but with `i` a signed `n`-bit integer. | |
+| **`F436`** | `DICTUADD` | _`x i D n - D' -1 or D 0`_ | [`DICTADD`](#instr-dictadd), but with `i` an unsigned `n`-bit integer. | |
+| **`F437`** | `DICTUADDREF` | _`c i D n - D' -1 or D 0`_ | [`DICTADDREF`](#instr-dictaddref), but with `i` an unsigned `n`-bit integer. | |
+| **`F43A`** | `DICTADDGET` | _`x k D n - D' -1 or D y 0`_ | An _Add_ counterpart of [`DICTSETGET`](#instr-dictsetget): sets the value associated with key `k` in dictionary `D` to `x`, but only if key `k` is not already present in `D`. Otherwise, just returns the old value `y` without changing the dictionary. | |
+| **`F43B`** | `DICTADDGETREF` | _`c k D n - D' -1 or D c' 0`_ | An _Add_ counterpart of [`DICTSETGETREF`](#instr-dictsetgetref). | |
+| **`F43C`** | `DICTIADDGET` | _`x i D n - D' -1 or D y 0`_ | [`DICTADDGET`](#instr-dictaddget), but with `i` a signed `n`-bit integer. | |
+| **`F43D`** | `DICTIADDGETREF` | _`c i D n - D' -1 or D c' 0`_ | [`DICTADDGETREF`](#instr-dictaddgetref), but with `i` a signed `n`-bit integer. | |
+| **`F43E`** | `DICTUADDGET` | _`x i D n - D' -1 or D y 0`_ | [`DICTADDGET`](#instr-dictaddget), but with `i` an unsigned `n`-bit integer. | |
+| **`F43F`** | `DICTUADDGETREF` | _`c i D n - D' -1 or D c' 0`_ | [`DICTADDGETREF`](#instr-dictaddgetref), but with `i` an unsigned `n`-bit integer. | |
+### 10.5 Builder-accepting variants of Set dictionary operations
+The following primitives accept the new value as a _Builder_ `b` instead of a _Slice_ `x`.
+
+| xxxxxxx
Opcode | xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Fift syntax | xxxxxxxxxxxxxxxxx
Stack | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Description | xxxx
Gas |
+|:-|:-|:-|:-|:-|
+| **`F441`** | `DICTSETB` | _`b k D n - D'`_ | | |
+| **`F442`** | `DICTISETB` | _`b i D n - D'`_ | | |
+| **`F443`** | `DICTUSETB` | _`b i D n - D'`_ | | |
+| **`F445`** | `DICTSETGETB` | _`b k D n - D' y -1 or D' 0`_ | | |
+| **`F446`** | `DICTISETGETB` | _`b i D n - D' y -1 or D' 0`_ | | |
+| **`F447`** | `DICTUSETGETB` | _`b i D n - D' y -1 or D' 0`_ | | |
+| **`F449`** | `DICTREPLACEB` | _`b k D n - D' -1 or D 0`_ | | |
+| **`F44A`** | `DICTIREPLACEB` | _`b i D n - D' -1 or D 0`_ | | |
+| **`F44B`** | `DICTUREPLACEB` | _`b i D n - D' -1 or D 0`_ | | |
+| **`F44D`** | `DICTREPLACEGETB` | _`b k D n - D' y -1 or D 0`_ | | |
+| **`F44E`** | `DICTIREPLACEGETB` | _`b i D n - D' y -1 or D 0`_ | | |
+| **`F44F`** | `DICTUREPLACEGETB` | _`b i D n - D' y -1 or D 0`_ | | |
+| **`F451`** | `DICTADDB` | _`b k D n - D' -1 or D 0`_ | | |
+| **`F452`** | `DICTIADDB` | _`b i D n - D' -1 or D 0`_ | | |
+| **`F453`** | `DICTUADDB` | _`b i D n - D' -1 or D 0`_ | | |
+| **`F455`** | `DICTADDGETB` | _`b k D n - D' -1 or D y 0`_ | | |
+| **`F456`** | `DICTIADDGETB` | _`b i D n - D' -1 or D y 0`_ | | |
+| **`F457`** | `DICTUADDGETB` | _`b i D n - D' -1 or D y 0`_ | | |
+### 10.6 Delete dictionary operations
+| xxxxxxx
Opcode | xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Fift syntax | xxxxxxxxxxxxxxxxx
Stack | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Description | xxxx
Gas |
+|:-|:-|:-|:-|:-|
+| **`F459`** | `DICTDEL` | _`k D n - D' -1 or D 0`_ | Deletes `n`-bit key, represented by a _Slice_ `k`, from dictionary `D`. If the key is present, returns the modified dictionary `D'` and the success flag `-1`. Otherwise, returns the original dictionary `D` and `0`. | |
+| **`F45A`** | `DICTIDEL` | _`i D n - D' ?`_ | A version of [`DICTDEL`](#instr-dictdel) with the key represented by a signed `n`-bit _Integer_ `i`. If `i` does not fit into `n` bits, simply returns `D` `0` (“key not found, dictionary unmodified''). | |
+| **`F45B`** | `DICTUDEL` | _`i D n - D' ?`_ | Similar to [`DICTIDEL`](#instr-dictidel), but with `i` an unsigned `n`-bit integer. | |
+| **`F462`** | `DICTDELGET` | _`k D n - D' x -1 or D 0`_ | Deletes `n`-bit key, represented by a _Slice_ `k`, from dictionary `D`. If the key is present, returns the modified dictionary `D'`, the original value `x` associated with the key `k` (represented by a _Slice_), and the success flag `-1`. Otherwise, returns the original dictionary `D` and `0`. | |
+| **`F463`** | `DICTDELGETREF` | _`k D n - D' c -1 or D 0`_ | Similar to [`DICTDELGET`](#instr-dictdelget), but with [`LDREF`](#instr-ldref) [`ENDS`](#instr-ends) applied to `x` on success, so that the value returned `c` is a _Cell_. | |
+| **`F464`** | `DICTIDELGET` | _`i D n - D' x -1 or D 0`_ | [`DICTDELGET`](#instr-dictdelget), but with `i` a signed `n`-bit integer. | |
+| **`F465`** | `DICTIDELGETREF` | _`i D n - D' c -1 or D 0`_ | [`DICTDELGETREF`](#instr-dictdelgetref), but with `i` a signed `n`-bit integer. | |
+| **`F466`** | `DICTUDELGET` | _`i D n - D' x -1 or D 0`_ | [`DICTDELGET`](#instr-dictdelget), but with `i` an unsigned `n`-bit integer. | |
+| **`F467`** | `DICTUDELGETREF` | _`i D n - D' c -1 or D 0`_ | [`DICTDELGETREF`](#instr-dictdelgetref), but with `i` an unsigned `n`-bit integer. | |
+### 10.7 "Maybe reference" dictionary operations
+The following operations assume that a dictionary is used to store values `c?` of type _Maybe Cell_. The representation is as follows: if `c?` is a _Cell_ , it is stored as a value with no data bits and exactly one reference to this _Cell_. If `c?` is _Null_, then the corresponding key must be absent from the dictionary.
+
+| xxxxxxx
Opcode | xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Fift syntax | xxxxxxxxxxxxxxxxx
Stack | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Description | xxxx
Gas |
+|:-|:-|:-|:-|:-|
+| **`F469`** | `DICTGETOPTREF` | _`k D n - c^?`_ | A variant of [`DICTGETREF`](#instr-dictgetref) that returns _Null_ instead of the value `c^?` if the key `k` is absent from dictionary `D`. | |
+| **`F46A`** | `DICTIGETOPTREF` | _`i D n - c^?`_ | [`DICTGETOPTREF`](#instr-dictgetoptref), but with `i` a signed `n`-bit integer. If the key `i` is out of range, also returns _Null_. | |
+| **`F46B`** | `DICTUGETOPTREF` | _`i D n - c^?`_ | [`DICTGETOPTREF`](#instr-dictgetoptref), but with `i` an unsigned `n`-bit integer. If the key `i` is out of range, also returns _Null_. | |
+| **`F46D`** | `DICTSETGETOPTREF` | _`c^? k D n - D' ~c^?`_ | A variant of both [`DICTGETOPTREF`](#instr-dictgetoptref) and [`DICTSETGETREF`](#instr-dictsetgetref) that sets the value corresponding to key `k` in dictionary `D` to `c^?` (if `c^?` is _Null_, then the key is deleted instead), and returns the old value `~c^?` (if the key `k` was absent before, returns _Null_ instead). | |
+| **`F46E`** | `DICTISETGETOPTREF` | _`c^? i D n - D' ~c^?`_ | Similar to primitive [`DICTSETGETOPTREF`](#instr-dictsetgetoptref), but using signed `n`-bit _Integer_ `i` as a key. If `i` does not fit into `n` bits, throws a range checking exception. | |
+| **`F46F`** | `DICTUSETGETOPTREF` | _`c^? i D n - D' ~c^?`_ | Similar to primitive [`DICTSETGETOPTREF`](#instr-dictsetgetoptref), but using unsigned `n`-bit _Integer_ `i` as a key. | |
+### 10.8 Prefix code dictionary operations
+These are some basic operations for constructing prefix code dictionaries.
+These primitives are completely similar to their non-prefix code counterparts ([`DICTSET`](#instr-dictset) etc), with the obvious difference that even a _Set_ may fail in a prefix code dictionary, so a success flag must be returned by [`PFXDICTSET`](#instr-pfxdictset) as well.
+
+| xxxxxxx
Opcode | xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Fift syntax | xxxxxxxxxxxxxxxxx
Stack | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Description | xxxx
Gas |
+|:-|:-|:-|:-|:-|
+| **`F470`** | `PFXDICTSET` | _`x k D n - D' -1 or D 0`_ | | |
+| **`F471`** | `PFXDICTREPLACE` | _`x k D n - D' -1 or D 0`_ | | |
+| **`F472`** | `PFXDICTADD` | _`x k D n - D' -1 or D 0`_ | | |
+| **`F473`** | `PFXDICTDEL` | _`k D n - D' -1 or D 0`_ | | |
+### 10.9 Variants of GetNext and GetPrev operations
+| xxxxxxx
Opcode | xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Fift syntax | xxxxxxxxxxxxxxxxx
Stack | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Description | xxxx
Gas |
+|:-|:-|:-|:-|:-|
+| **`F474`** | `DICTGETNEXT` | _`k D n - x' k' -1 or 0`_ | Computes the minimal key `k'` in dictionary `D` that is lexicographically greater than `k`, and returns `k'` (represented by a _Slice_) along with associated value `x'` (also represented by a _Slice_). | |
+| **`F475`** | `DICTGETNEXTEQ` | _`k D n - x' k' -1 or 0`_ | Similar to [`DICTGETNEXT`](#instr-dictgetnext), but computes the minimal key `k'` that is lexicographically greater than or equal to `k`. | |
+| **`F476`** | `DICTGETPREV` | _`k D n - x' k' -1 or 0`_ | Similar to [`DICTGETNEXT`](#instr-dictgetnext), but computes the maximal key `k'` lexicographically smaller than `k`. | |
+| **`F477`** | `DICTGETPREVEQ` | _`k D n - x' k' -1 or 0`_ | Similar to [`DICTGETPREV`](#instr-dictgetprev), but computes the maximal key `k'` lexicographically smaller than or equal to `k`. | |
+| **`F478`** | `DICTIGETNEXT` | _`i D n - x' i' -1 or 0`_ | Similar to [`DICTGETNEXT`](#instr-dictgetnext), but interprets all keys in dictionary `D` as big-endian signed `n`-bit integers, and computes the minimal key `i'` that is larger than _Integer_ `i` (which does not necessarily fit into `n` bits). | |
+| **`F479`** | `DICTIGETNEXTEQ` | _`i D n - x' i' -1 or 0`_ | Similar to [`DICTGETNEXTEQ`](#instr-dictgetnexteq), but interprets keys as signed `n`-bit integers. | |
+| **`F47A`** | `DICTIGETPREV` | _`i D n - x' i' -1 or 0`_ | Similar to [`DICTGETPREV`](#instr-dictgetprev), but interprets keys as signed `n`-bit integers. | |
+| **`F47B`** | `DICTIGETPREVEQ` | _`i D n - x' i' -1 or 0`_ | Similar to [`DICTGETPREVEQ`](#instr-dictgetpreveq), but interprets keys as signed `n`-bit integers. | |
+| **`F47C`** | `DICTUGETNEXT` | _`i D n - x' i' -1 or 0`_ | Similar to [`DICTGETNEXT`](#instr-dictgetnext), but interprets all keys in dictionary `D` as big-endian unsigned `n`-bit integers, and computes the minimal key `i'` that is larger than _Integer_ `i` (which does not necessarily fit into `n` bits, and is not necessarily non-negative). | |
+| **`F47D`** | `DICTUGETNEXTEQ` | _`i D n - x' i' -1 or 0`_ | Similar to [`DICTGETNEXTEQ`](#instr-dictgetnexteq), but interprets keys as unsigned `n`-bit integers. | |
+| **`F47E`** | `DICTUGETPREV` | _`i D n - x' i' -1 or 0`_ | Similar to [`DICTGETPREV`](#instr-dictgetprev), but interprets keys as unsigned `n`-bit integers. | |
+| **`F47F`** | `DICTUGETPREVEQ` | _`i D n - x' i' -1 or 0`_ | Similar to [`DICTGETPREVEQ`](#instr-dictgetpreveq), but interprets keys a unsigned `n`-bit integers. | |
+### 10.10 GetMin, GetMax, RemoveMin, RemoveMax operations
+| xxxxxxx
Opcode | xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Fift syntax | xxxxxxxxxxxxxxxxx
Stack | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Description | xxxx
Gas |
+|:-|:-|:-|:-|:-|
+| **`F482`** | `DICTMIN` | _`D n - x k -1 or 0`_ | Computes the minimal key `k` (represented by a _Slice_ with `n` data bits) in dictionary `D`, and returns `k` along with the associated value `x`. | |
+| **`F483`** | `DICTMINREF` | _`D n - c k -1 or 0`_ | Similar to [`DICTMIN`](#instr-dictmin), but returns the only reference in the value as a _Cell_ `c`. | |
+| **`F484`** | `DICTIMIN` | _`D n - x i -1 or 0`_ | Similar to [`DICTMIN`](#instr-dictmin), but computes the minimal key `i` under the assumption that all keys are big-endian signed `n`-bit integers. Notice that the key and value returned may differ from those computed by [`DICTMIN`](#instr-dictmin) and [`DICTUMIN`](#instr-dictumin). | |
+| **`F485`** | `DICTIMINREF` | _`D n - c i -1 or 0`_ | Similar to [`DICTIMIN`](#instr-dictimin), but returns the only reference in the value. | |
+| **`F486`** | `DICTUMIN` | _`D n - x i -1 or 0`_ | Similar to [`DICTMIN`](#instr-dictmin), but returns the key as an unsigned `n`-bit _Integer_ `i`. | |
+| **`F487`** | `DICTUMINREF` | _`D n - c i -1 or 0`_ | Similar to [`DICTUMIN`](#instr-dictumin), but returns the only reference in the value. | |
+| **`F48A`** | `DICTMAX` | _`D n - x k -1 or 0`_ | Computes the maximal key `k` (represented by a _Slice_ with `n` data bits) in dictionary `D`, and returns `k` along with the associated value `x`. | |
+| **`F48B`** | `DICTMAXREF` | _`D n - c k -1 or 0`_ | Similar to [`DICTMAX`](#instr-dictmax), but returns the only reference in the value. | |
+| **`F48C`** | `DICTIMAX` | _`D n - x i -1 or 0`_ | Similar to [`DICTMAX`](#instr-dictmax), but computes the maximal key `i` under the assumption that all keys are big-endian signed `n`-bit integers. Notice that the key and value returned may differ from those computed by [`DICTMAX`](#instr-dictmax) and [`DICTUMAX`](#instr-dictumax). | |
+| **`F48D`** | `DICTIMAXREF` | _`D n - c i -1 or 0`_ | Similar to [`DICTIMAX`](#instr-dictimax), but returns the only reference in the value. | |
+| **`F48E`** | `DICTUMAX` | _`D n - x i -1 or 0`_ | Similar to [`DICTMAX`](#instr-dictmax), but returns the key as an unsigned `n`-bit _Integer_ `i`. | |
+| **`F48F`** | `DICTUMAXREF` | _`D n - c i -1 or 0`_ | Similar to [`DICTUMAX`](#instr-dictumax), but returns the only reference in the value. | |
+| **`F492`** | `DICTREMMIN` | _`D n - D' x k -1 or D 0`_ | Computes the minimal key `k` (represented by a _Slice_ with `n` data bits) in dictionary `D`, removes `k` from the dictionary, and returns `k` along with the associated value `x` and the modified dictionary `D'`. | |
+| **`F493`** | `DICTREMMINREF` | _`D n - D' c k -1 or D 0`_ | Similar to [`DICTREMMIN`](#instr-dictremmin), but returns the only reference in the value as a _Cell_ `c`. | |
+| **`F494`** | `DICTIREMMIN` | _`D n - D' x i -1 or D 0`_ | Similar to [`DICTREMMIN`](#instr-dictremmin), but computes the minimal key `i` under the assumption that all keys are big-endian signed `n`-bit integers. Notice that the key and value returned may differ from those computed by [`DICTREMMIN`](#instr-dictremmin) and [`DICTUREMMIN`](#instr-dicturemmin). | |
+| **`F495`** | `DICTIREMMINREF` | _`D n - D' c i -1 or D 0`_ | Similar to [`DICTIREMMIN`](#instr-dictiremmin), but returns the only reference in the value. | |
+| **`F496`** | `DICTUREMMIN` | _`D n - D' x i -1 or D 0`_ | Similar to [`DICTREMMIN`](#instr-dictremmin), but returns the key as an unsigned `n`-bit _Integer_ `i`. | |
+| **`F497`** | `DICTUREMMINREF` | _`D n - D' c i -1 or D 0`_ | Similar to [`DICTUREMMIN`](#instr-dicturemmin), but returns the only reference in the value. | |
+| **`F49A`** | `DICTREMMAX` | _`D n - D' x k -1 or D 0`_ | Computes the maximal key `k` (represented by a _Slice_ with `n` data bits) in dictionary `D`, removes `k` from the dictionary, and returns `k` along with the associated value `x` and the modified dictionary `D'`. | |
+| **`F49B`** | `DICTREMMAXREF` | _`D n - D' c k -1 or D 0`_ | Similar to [`DICTREMMAX`](#instr-dictremmax), but returns the only reference in the value as a _Cell_ `c`. | |
+| **`F49C`** | `DICTIREMMAX` | _`D n - D' x i -1 or D 0`_ | Similar to [`DICTREMMAX`](#instr-dictremmax), but computes the minimal key `i` under the assumption that all keys are big-endian signed `n`-bit integers. Notice that the key and value returned may differ from those computed by [`DICTREMMAX`](#instr-dictremmax) and [`DICTUREMMAX`](#instr-dicturemmax). | |
+| **`F49D`** | `DICTIREMMAXREF` | _`D n - D' c i -1 or D 0`_ | Similar to [`DICTIREMMAX`](#instr-dictiremmax), but returns the only reference in the value. | |
+| **`F49E`** | `DICTUREMMAX` | _`D n - D' x i -1 or D 0`_ | Similar to [`DICTREMMAX`](#instr-dictremmax), but returns the key as an unsigned `n`-bit _Integer_ `i`. | |
+| **`F49F`** | `DICTUREMMAXREF` | _`D n - D' c i -1 or D 0`_ | Similar to [`DICTUREMMAX`](#instr-dicturemmax), but returns the only reference in the value. | |
+### 10.11 Special Get dictionary and prefix code dictionary operations, and constant dictionaries
+| xxxxxxx
Opcode | xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Fift syntax | xxxxxxxxxxxxxxxxx
Stack | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Description | xxxx
Gas |
+|:-|:-|:-|:-|:-|
+| **`F4A0`** | `DICTIGETJMP` | _`i D n - `_ | Similar to [`DICTIGET`](#instr-dictiget), but with `x` [`BLESS`](#instr-bless)ed into a continuation with a subsequent [`JMPX`](#instr-jmpx) to it on success. On failure, does nothing. This is useful for implementing `switch`/`case` constructions. | |
+| **`F4A1`** | `DICTUGETJMP` | _`i D n - `_ | Similar to [`DICTIGETJMP`](#instr-dictigetjmp), but performs [`DICTUGET`](#instr-dictuget) instead of [`DICTIGET`](#instr-dictiget). | |
+| **`F4A2`** | `DICTIGETEXEC` | _`i D n - `_ | Similar to [`DICTIGETJMP`](#instr-dictigetjmp), but with [`EXECUTE`](#instr-execute) instead of [`JMPX`](#instr-jmpx). | |
+| **`F4A3`** | `DICTUGETEXEC` | _`i D n - `_ | Similar to [`DICTUGETJMP`](#instr-dictugetjmp), but with [`EXECUTE`](#instr-execute) instead of [`JMPX`](#instr-jmpx). | |
+| **`F4A6_n`** | `[ref] [n] DICTPUSHCONST` | _` - D n`_ | Pushes a non-empty constant dictionary `D` (as a `Cell^?`) along with its key length `0 <= n <= 1023`, stored as a part of the instruction. The dictionary itself is created from the first of remaining references of the current continuation. In this way, the complete [`DICTPUSHCONST`](#instr-dictpushconst) instruction can be obtained by first serializing `xF4A4_`, then the non-empty dictionary itself (one `1` bit and a cell reference), and then the unsigned 10-bit integer `n` (as if by a `STU 10` instruction). An empty dictionary can be pushed by a [`NEWDICT`](#instr-newdict) primitive instead. | `34` |
+| **`F4A8`** | `PFXDICTGETQ` | _`s D n - s' x s'' -1 or s 0`_ | Looks up the unique prefix of _Slice_ `s` present in the prefix code dictionary represented by `Cell^?` `D` and `0 <= n <= 1023`. If found, the prefix of `s` is returned as `s'`, and the corresponding value (also a _Slice_) as `x`. The remainder of `s` is returned as a _Slice_ `s''`. If no prefix of `s` is a key in prefix code dictionary `D`, returns the unchanged `s` and a zero flag to indicate failure. | |
+| **`F4A9`** | `PFXDICTGET` | _`s D n - s' x s''`_ | Similar to [`PFXDICTGET`](#instr-pfxdictget), but throws a cell deserialization failure exception on failure. | |
+| **`F4AA`** | `PFXDICTGETJMP` | _`s D n - s' s'' or s`_ | Similar to [`PFXDICTGETQ`](#instr-pfxdictgetq), but on success [`BLESS`](#instr-bless)es the value `x` into a _Continuation_ and transfers control to it as if by a [`JMPX`](#instr-jmpx). On failure, returns `s` unchanged and continues execution. | |
+| **`F4AB`** | `PFXDICTGETEXEC` | _`s D n - s' s''`_ | Similar to [`PFXDICTGETJMP`](#instr-pfxdictgetjmp), but `EXEC`utes the continuation found instead of jumping to it. On failure, throws a cell deserialization exception. | |
+| **`F4AE_n`** | `[ref] [n] PFXDICTCONSTGETJMP`
`[ref] [n] PFXDICTSWITCH` | _`s - s' s'' or s`_ | Combines [`[n] DICTPUSHCONST`](#instr-dictpushconst) for `0 <= n <= 1023` with [`PFXDICTGETJMP`](#instr-pfxdictgetjmp). | |
+| **`F4BC`** | `DICTIGETJMPZ` | _`i D n - i or nothing`_ | A variant of [`DICTIGETJMP`](#instr-dictigetjmp) that returns index `i` on failure. | |
+| **`F4BD`** | `DICTUGETJMPZ` | _`i D n - i or nothing`_ | A variant of [`DICTUGETJMP`](#instr-dictugetjmp) that returns index `i` on failure. | |
+| **`F4BE`** | `DICTIGETEXECZ` | _`i D n - i or nothing`_ | A variant of [`DICTIGETEXEC`](#instr-dictigetexec) that returns index `i` on failure. | |
+| **`F4BF`** | `DICTUGETEXECZ` | _`i D n - i or nothing`_ | A variant of [`DICTUGETEXEC`](#instr-dictugetexec) that returns index `i` on failure. | |
+### 10.12 SubDict dictionary operations
+| xxxxxxx
Opcode | xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Fift syntax | xxxxxxxxxxxxxxxxx
Stack | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Description | xxxx
Gas |
+|:-|:-|:-|:-|:-|
+| **`F4B1`** | `SUBDICTGET` | _`k l D n - D'`_ | Constructs a subdictionary consisting of all keys beginning with prefix `k` (represented by a _Slice_, the first `0 <= l <= n <= 1023` data bits of which are used as a key) of length `l` in dictionary `D` of type `HashmapE(n,X)` with `n`-bit keys. On success, returns the new subdictionary of the same type `HashmapE(n,X)` as a _Slice_ `D'`. | |
+| **`F4B2`** | `SUBDICTIGET` | _`x l D n - D'`_ | Variant of [`SUBDICTGET`](#instr-subdictget) with the prefix represented by a signed big-endian `l`-bit _Integer_ `x`, where necessarily `l <= 257`. | |
+| **`F4B3`** | `SUBDICTUGET` | _`x l D n - D'`_ | Variant of [`SUBDICTGET`](#instr-subdictget) with the prefix represented by an unsigned big-endian `l`-bit _Integer_ `x`, where necessarily `l <= 256`. | |
+| **`F4B5`** | `SUBDICTRPGET` | _`k l D n - D'`_ | Similar to [`SUBDICTGET`](#instr-subdictget), but removes the common prefix `k` from all keys of the new dictionary `D'`, which becomes of type `HashmapE(n-l,X)`. | |
+| **`F4B6`** | `SUBDICTIRPGET` | _`x l D n - D'`_ | Variant of [`SUBDICTRPGET`](#instr-subdictrpget) with the prefix represented by a signed big-endian `l`-bit _Integer_ `x`, where necessarily `l <= 257`. | |
+| **`F4B7`** | `SUBDICTURPGET` | _`x l D n - D'`_ | Variant of [`SUBDICTRPGET`](#instr-subdictrpget) with the prefix represented by an unsigned big-endian `l`-bit _Integer_ `x`, where necessarily `l <= 256`. | |
+
+## 11 Application-specific primitives
+### 11.1 Gas-related primitives
+| xxxxxxx
Opcode | xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Fift syntax | xxxxxxxxxxxxxxxxx
Stack | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Description | xxxx
Gas |
+|:-|:-|:-|:-|:-|
+| **`F800`** | `ACCEPT` | _`-`_ | Sets current gas limit `g_l` to its maximal allowed value `g_m`, and resets the gas credit `g_c` to zero, decreasing the value of `g_r` by `g_c` in the process.
In other words, the current smart contract agrees to buy some gas to finish the current transaction. This action is required to process external messages, which bring no value (hence no gas) with themselves. | `26` |
+| **`F801`** | `SETGASLIMIT` | _`g - `_ | Sets current gas limit `g_l` to the minimum of `g` and `g_m`, and resets the gas credit `g_c` to zero. If the gas consumed so far (including the present instruction) exceeds the resulting value of `g_l`, an (unhandled) out of gas exception is thrown before setting new gas limits. Notice that [`SETGASLIMIT`](#instr-setgaslimit) with an argument `g >= 2^63-1` is equivalent to [`ACCEPT`](#instr-accept). | `26` |
+| **`F80F`** | `COMMIT` | _`-`_ | Commits the current state of registers `c4` (“persistent data'') and `c5` (“actions'') so that the current execution is considered “successful'' with the saved values even if an exception is thrown later. | `26` |
+### 11.2 Pseudo-random number generator primitives
+| xxxxxxx
Opcode | xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Fift syntax | xxxxxxxxxxxxxxxxx
Stack | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Description | xxxx
Gas |
+|:-|:-|:-|:-|:-|
+| **`F810`** | `RANDU256` | _`- x`_ | Generates a new pseudo-random unsigned 256-bit _Integer_ `x`. The algorithm is as follows: if `r` is the old value of the random seed, considered as a 32-byte array (by constructing the big-endian representation of an unsigned 256-bit integer), then its `sha512(r)` is computed; the first 32 bytes of this hash are stored as the new value `r'` of the random seed, and the remaining 32 bytes are returned as the next random value `x`. | `26+\|c7\|+\|c1_1\|` |
+| **`F811`** | `RAND` | _`y - z`_ | Generates a new pseudo-random integer `z` in the range `0...y-1` (or `y...-1`, if `y<0`). More precisely, an unsigned random value `x` is generated as in `RAND256U`; then `z:=floor(x*y/2^256)` is computed.
Equivalent to [`RANDU256`](#instr-randu256) [`256 MULRSHIFT`](#instr-mulrshift-var). | `26+\|c7\|+\|c1_1\|` |
+| **`F814`** | `SETRAND` | _`x - `_ | Sets the random seed to unsigned 256-bit _Integer_ `x`. | `26+\|c7\|+\|c1_1\|` |
+| **`F815`** | `ADDRAND`
`RANDOMIZE` | _`x - `_ | Mixes unsigned 256-bit _Integer_ `x` into the random seed `r` by setting the random seed to `Sha` of the concatenation of two 32-byte strings: the first with the big-endian representation of the old seed `r`, and the second with the big-endian representation of `x`. | `26` |
+### 11.3 Configuration primitives
+| xxxxxxx
Opcode | xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Fift syntax | xxxxxxxxxxxxxxxxx
Stack | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Description | xxxx
Gas |
+|:-|:-|:-|:-|:-|
+| **`F82i`** | `[i] GETPARAM` | _` - x`_ | Returns the `i`-th parameter from the _Tuple_ provided at `c7` for `0 <= i <= 15`. Equivalent to [`c7 PUSHCTR`](#instr-pushctr) [`FIRST`](#instr-first) [`[i] INDEX`](#instr-index).
If one of these internal operations fails, throws an appropriate type checking or range checking exception. | `26` |
+| **`F823`** | `NOW` | _` - x`_ | Returns the current Unix time as an _Integer_. If it is impossible to recover the requested value starting from `c7`, throws a type checking or range checking exception as appropriate.
Equivalent to [`3 GETPARAM`](#instr-getparam). | `26` |
+| **`F824`** | `BLOCKLT` | _` - x`_ | Returns the starting logical time of the current block.
Equivalent to [`4 GETPARAM`](#instr-getparam). | `26` |
+| **`F825`** | `LTIME` | _` - x`_ | Returns the logical time of the current transaction.
Equivalent to [`5 GETPARAM`](#instr-getparam). | `26` |
+| **`F826`** | `RANDSEED` | _` - x`_ | Returns the current random seed as an unsigned 256-bit _Integer_.
Equivalent to [`6 GETPARAM`](#instr-getparam). | `26` |
+| **`F827`** | `BALANCE` | _` - t`_ | Returns the remaining balance of the smart contract as a _Tuple_ consisting of an _Integer_ (the remaining Gram balance in nanograms) and a _Maybe Cell_ (a dictionary with 32-bit keys representing the balance of “extra currencies'').
Equivalent to [`7 GETPARAM`](#instr-getparam).
Note that `RAW` primitives such as [`SENDRAWMSG`](#instr-sendrawmsg) do not update this field. | `26` |
+| **`F828`** | `MYADDR` | _` - s`_ | Returns the internal address of the current smart contract as a _Slice_ with a `MsgAddressInt`. If necessary, it can be parsed further using primitives such as [`PARSEMSGADDR`](#instr-parsemsgaddr) or [`REWRITESTDADDR`](#instr-rewritestdaddr).
Equivalent to [`8 GETPARAM`](#instr-getparam). | `26` |
+| **`F829`** | `CONFIGROOT` | _` - D`_ | Returns the _Maybe Cell_ `D` with the current global configuration dictionary. Equivalent to `9 GETPARAM `. | `26` |
+| **`F830`** | `CONFIGDICT` | _` - D 32`_ | Returns the global configuration dictionary along with its key length (32).
Equivalent to [`CONFIGROOT`](#instr-configroot) [`32 PUSHINT`](#instr-pushint-4). | `26` |
+| **`F832`** | `CONFIGPARAM` | _`i - c -1 or 0`_ | Returns the value of the global configuration parameter with integer index `i` as a _Cell_ `c`, and a flag to indicate success.
Equivalent to [`CONFIGDICT`](#instr-configdict) [`DICTIGETREF`](#instr-dictigetref). | |
+| **`F833`** | `CONFIGOPTPARAM` | _`i - c^?`_ | Returns the value of the global configuration parameter with integer index `i` as a _Maybe Cell_ `c^?`.
Equivalent to [`CONFIGDICT`](#instr-configdict) [`DICTIGETOPTREF`](#instr-dictigetoptref). | |
+### 11.4 Global variable primitives
+| xxxxxxx
Opcode | xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Fift syntax | xxxxxxxxxxxxxxxxx
Stack | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Description | xxxx
Gas |
+|:-|:-|:-|:-|:-|
+| **`F840`** | `GETGLOBVAR` | _`k - x`_ | Returns the `k`-th global variable for `0 <= k < 255`.
Equivalent to [`c7 PUSHCTR`](#instr-pushctr) [`SWAP`](#instr-swap) [`INDEXVARQ`](#instr-indexvarq). | `26` |
+| **`F85_k`** | `[k] GETGLOB` | _` - x`_ | Returns the `k`-th global variable for `1 <= k <= 31`.
Equivalent to [`c7 PUSHCTR`](#instr-pushctr) [`[k] INDEXQ`](#instr-indexq). | `26` |
+| **`F860`** | `SETGLOBVAR` | _`x k - `_ | Assigns `x` to the `k`-th global variable for `0 <= k < 255`.
Equivalent to [`c7 PUSHCTR`](#instr-pushctr) [`ROTREV`](#instr-rotrev) [`SETINDEXVARQ`](#instr-setindexvarq) [`c7 POPCTR`](#instr-popctr). | `26+\|c7’\|` |
+| **`F87_k`** | `[k] SETGLOB` | _`x - `_ | Assigns `x` to the `k`-th global variable for `1 <= k <= 31`.
Equivalent to [`c7 PUSHCTR`](#instr-pushctr) [`SWAP`](#instr-swap) [`k SETINDEXQ`](#instr-setindexq) [`c7 POPCTR`](#instr-popctr). | `26+\|c7’\|` |
+### 11.5 Hashing and cryptography primitives
+| xxxxxxx
Opcode | xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Fift syntax | xxxxxxxxxxxxxxxxx
Stack | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Description | xxxx
Gas |
+|:-|:-|:-|:-|:-|
+| **`F900`** | `HASHCU` | _`c - x`_ | Computes the representation hash of a _Cell_ `c` and returns it as a 256-bit unsigned integer `x`. Useful for signing and checking signatures of arbitrary entities represented by a tree of cells. | `26` |
+| **`F901`** | `HASHSU` | _`s - x`_ | Computes the hash of a _Slice_ `s` and returns it as a 256-bit unsigned integer `x`. The result is the same as if an ordinary cell containing only data and references from `s` had been created and its hash computed by [`HASHCU`](#instr-hashcu). | `526` |
+| **`F902`** | `SHA256U` | _`s - x`_ | Computes `Sha` of the data bits of _Slice_ `s`. If the bit length of `s` is not divisible by eight, throws a cell underflow exception. The hash value is returned as a 256-bit unsigned integer `x`. | `26` |
+| **`F910`** | `CHKSIGNU` | _`h s k - ?`_ | Checks the Ed25519-signature `s` of a hash `h` (a 256-bit unsigned integer, usually computed as the hash of some data) using public key `k` (also represented by a 256-bit unsigned integer).
The signature `s` must be a _Slice_ containing at least 512 data bits; only the first 512 bits are used. The result is `-1` if the signature is valid, `0` otherwise.
Notice that [`CHKSIGNU`](#instr-chksignu) is equivalent to [`ROT`](#instr-rot) [`NEWC`](#instr-newc) [`256 STU`](#instr-stu) [`ENDC`](#instr-endc) [`ROTREV`](#instr-rotrev) [`CHKSIGNS`](#instr-chksigns), i.e., to [`CHKSIGNS`](#instr-chksigns) with the first argument `d` set to 256-bit _Slice_ containing `h`. Therefore, if `h` is computed as the hash of some data, these data are hashed _twice_, the second hashing occurring inside [`CHKSIGNS`](#instr-chksigns). | `26` |
+| **`F911`** | `CHKSIGNS` | _`d s k - ?`_ | Checks whether `s` is a valid Ed25519-signature of the data portion of _Slice_ `d` using public key `k`, similarly to [`CHKSIGNU`](#instr-chksignu). If the bit length of _Slice_ `d` is not divisible by eight, throws a cell underflow exception. The verification of Ed25519 signatures is the standard one, with `Sha` used to reduce `d` to the 256-bit number that is actually signed. | `26` |
+### 11.6 Miscellaneous primitives
+| xxxxxxx
Opcode | xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Fift syntax | xxxxxxxxxxxxxxxxx
Stack | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Description | xxxx
Gas |
+|:-|:-|:-|:-|:-|
+| **`F940`** | `CDATASIZEQ` | _`c n - x y z -1 or 0`_ | Recursively computes the count of distinct cells `x`, data bits `y`, and cell references `z` in the dag rooted at _Cell_ `c`, effectively returning the total storage used by this dag taking into account the identification of equal cells. The values of `x`, `y`, and `z` are computed by a depth-first traversal of this dag, with a hash table of visited cell hashes used to prevent visits of already-visited cells. The total count of visited cells `x` cannot exceed non-negative _Integer_ `n`; otherwise the computation is aborted before visiting the `(n+1)`-st cell and a zero is returned to indicate failure. If `c` is _Null_, returns `x=y=z=0`. | |
+| **`F941`** | `CDATASIZE` | _`c n - x y z`_ | A non-quiet version of [`CDATASIZEQ`](#instr-cdatasizeq) that throws a cell overflow exception (8) on failure. | |
+| **`F942`** | `SDATASIZEQ` | _`s n - x y z -1 or 0`_ | Similar to [`CDATASIZEQ`](#instr-cdatasizeq), but accepting a _Slice_ `s` instead of a _Cell_. The returned value of `x` does not take into account the cell that contains the slice `s` itself; however, the data bits and the cell references of `s` are accounted for in `y` and `z`. | |
+| **`F943`** | `SDATASIZE` | _`s n - x y z`_ | A non-quiet version of [`SDATASIZEQ`](#instr-sdatasizeq) that throws a cell overflow exception (8) on failure. | |
+### 11.7 Currency manipulation primitives
+| xxxxxxx
Opcode | xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Fift syntax | xxxxxxxxxxxxxxxxx
Stack | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Description | xxxx
Gas |
+|:-|:-|:-|:-|:-|
+| **`FA00`** | `LDGRAMS`
`LDVARUINT16` | _`s - x s'`_ | Loads (deserializes) a `Gram` or `VarUInteger 16` amount from _Slice_ `s`, and returns the amount as _Integer_ `x` along with the remainder `s'` of `s`. The expected serialization of `x` consists of a 4-bit unsigned big-endian integer `l`, followed by an `8l`-bit unsigned big-endian representation of `x`.
The net effect is approximately equivalent to [`4 LDU`](#instr-ldu) [`SWAP`](#instr-swap) [`3 LSHIFT#`](#instr-lshift) [`LDUX`](#instr-ldux). | `26` |
+| **`FA01`** | `LDVARINT16` | _`s - x s'`_ | Similar to [`LDVARUINT16`](#instr-ldgrams), but loads a _signed_ _Integer_ `x`.
Approximately equivalent to [`4 LDU`](#instr-ldu) [`SWAP`](#instr-swap) [`3 LSHIFT#`](#instr-lshift) [`LDIX`](#instr-ldix). | `26` |
+| **`FA02`** | `STGRAMS`
`STVARUINT16` | _`b x - b'`_ | Stores (serializes) an _Integer_ `x` in the range `0...2^120-1` into _Builder_ `b`, and returns the resulting _Builder_ `b'`. The serialization of `x` consists of a 4-bit unsigned big-endian integer `l`, which is the smallest integer `l>=0`, such that `x<2^(8l)`, followed by an `8l`-bit unsigned big-endian representation of `x`. If `x` does not belong to the supported range, a range check exception is thrown. | `26` |
+| **`FA03`** | `STVARINT16` | _`b x - b'`_ | Similar to [`STVARUINT16`](#instr-stgrams), but serializes a _signed_ _Integer_ `x` in the range `-2^119...2^119-1`. | `26` |
+### 11.8 Message and address manipulation primitives
+| xxxxxxx
Opcode | xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Fift syntax | xxxxxxxxxxxxxxxxx
Stack | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Description | xxxx
Gas |
+|:-|:-|:-|:-|:-|
+| **`FA40`** | `LDMSGADDR` | _`s - s' s''`_ | Loads from _Slice_ `s` the only prefix that is a valid `MsgAddress`, and returns both this prefix `s'` and the remainder `s''` of `s` as slices. | `26` |
+| **`FA41`** | `LDMSGADDRQ` | _`s - s' s'' -1 or s 0`_ | A quiet version of [`LDMSGADDR`](#instr-ldmsgaddr): on success, pushes an extra `-1`; on failure, pushes the original `s` and a zero. | `26` |
+| **`FA42`** | `PARSEMSGADDR` | _`s - t`_ | Decomposes _Slice_ `s` containing a valid `MsgAddress` into a _Tuple_ `t` with separate fields of this `MsgAddress`. If `s` is not a valid `MsgAddress`, a cell deserialization exception is thrown. | `26` |
+| **`FA43`** | `PARSEMSGADDRQ` | _`s - t -1 or 0`_ | A quiet version of [`PARSEMSGADDR`](#instr-parsemsgaddr): returns a zero on error instead of throwing an exception. | `26` |
+| **`FA44`** | `REWRITESTDADDR` | _`s - x y`_ | Parses _Slice_ `s` containing a valid `MsgAddressInt` (usually a `msg_addr_std`), applies rewriting from the `anycast` (if present) to the same-length prefix of the address, and returns both the workchain `x` and the 256-bit address `y` as integers. If the address is not 256-bit, or if `s` is not a valid serialization of `MsgAddressInt`, throws a cell deserialization exception. | `26` |
+| **`FA45`** | `REWRITESTDADDRQ` | _`s - x y -1 or 0`_ | A quiet version of primitive [`REWRITESTDADDR`](#instr-rewritestdaddr). | `26` |
+| **`FA46`** | `REWRITEVARADDR` | _`s - x s'`_ | A variant of [`REWRITESTDADDR`](#instr-rewritestdaddr) that returns the (rewritten) address as a _Slice_ `s`, even if it is not exactly 256 bit long (represented by a `msg_addr_var`). | `26` |
+| **`FA47`** | `REWRITEVARADDRQ` | _`s - x s' -1 or 0`_ | A quiet version of primitive [`REWRITEVARADDR`](#instr-rewritevaraddr). | `26` |
+### 11.9 Outbound message and output action primitives
+| xxxxxxx
Opcode | xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Fift syntax | xxxxxxxxxxxxxxxxx
Stack | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Description | xxxx
Gas |
+|:-|:-|:-|:-|:-|
+| **`FB00`** | `SENDRAWMSG` | _`c x - `_ | Sends a raw message contained in _Cell `c`_, which should contain a correctly serialized object `Message X`, with the only exception that the source address is allowed to have dummy value `addr_none` (to be automatically replaced with the current smart-contract address), and `ihr_fee`, `fwd_fee`, `created_lt` and `created_at` fields can have arbitrary values (to be rewritten with correct values during the action phase of the current transaction). Integer parameter `x` contains the flags. Currently `x=0` is used for ordinary messages; `x=128` is used for messages that are to carry all the remaining balance of the current smart contract (instead of the value originally indicated in the message); `x=64` is used for messages that carry all the remaining value of the inbound message in addition to the value initially indicated in the new message (if bit 0 is not set, the gas fees are deducted from this amount); `x'=x+1` means that the sender wants to pay transfer fees separately; `x'=x+2` means that any errors arising while processing this message during the action phase should be ignored. Finally, `x'=x+32` means that the current account must be destroyed if its resulting balance is zero. This flag is usually employed together with `+128`. | `526` |
+| **`FB02`** | `RAWRESERVE` | _`x y - `_ | Creates an output action which would reserve exactly `x` nanograms (if `y=0`), at most `x` nanograms (if `y=2`), or all but `x` nanograms (if `y=1` or `y=3`), from the remaining balance of the account. It is roughly equivalent to creating an outbound message carrying `x` nanograms (or `b-x` nanograms, where `b` is the remaining balance) to oneself, so that the subsequent output actions would not be able to spend more money than the remainder. Bit `+2` in `y` means that the external action does not fail if the specified amount cannot be reserved; instead, all remaining balance is reserved. Bit `+8` in `y` means `x:=-x` before performing any further actions. Bit `+4` in `y` means that `x` is increased by the original balance of the current account (before the compute phase), including all extra currencies, before performing any other checks and actions. Currently `x` must be a non-negative integer, and `y` must be in the range `0...15`. | `526` |
+| **`FB03`** | `RAWRESERVEX` | _`x D y - `_ | Similar to [`RAWRESERVE`](#instr-rawreserve), but also accepts a dictionary `D` (represented by a _Cell_ or _Null_) with extra currencies. In this way currencies other than Grams can be reserved. | `526` |
+| **`FB04`** | `SETCODE` | _`c - `_ | Creates an output action that would change this smart contract code to that given by _Cell_ `c`. Notice that this change will take effect only after the successful termination of the current run of the smart contract. | `526` |
+| **`FB06`** | `SETLIBCODE` | _`c x - `_ | Creates an output action that would modify the collection of this smart contract libraries by adding or removing library with code given in _Cell_ `c`. If `x=0`, the library is actually removed if it was previously present in the collection (if not, this action does nothing). If `x=1`, the library is added as a private library, and if `x=2`, the library is added as a public library (and becomes available to all smart contracts if the current smart contract resides in the masterchain); if the library was present in the collection before, its public/private status is changed according to `x`. Values of `x` other than `0...2` are invalid. | `526` |
+| **`FB07`** | `CHANGELIB` | _`h x - `_ | Creates an output action similarly to [`SETLIBCODE`](#instr-setlibcode), but instead of the library code accepts its hash as an unsigned 256-bit integer `h`. If `x!=0` and the library with hash `h` is absent from the library collection of this smart contract, this output action will fail. | `526` |
+
+## 12 Debug primitives
+Opcodes beginning with `FE` are reserved for the debug primitives. These primitives have known fixed operation length, and behave as (multibyte) [`NOP`](#instr-nop) operations.
+
+However, when invoked in a TVM instance with debug mode enabled, these primitives can produce specific output into the text debug log of the TVM instance, never affecting the TVM state.
+
+[`DEBUG`](#instr-debug) and [`DEBUGSTR`](#instr-debugstr) are the two debug primitives, they cover all opcodes that start with `FE`.
+Other primitives listed here have opcodes from the same set. When debug is enabled, they have their specified effects. When debug is disabled, they behave as [`NOP`](#instr-nop).
+
+| xxxxxxx
Opcode | xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Fift syntax | xxxxxxxxxxxxxxxxx
Stack | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Description | xxxx
Gas |
+|:-|:-|:-|:-|:-|
+| **`FEnn`** | `{nn} DEBUG` | _`-`_ | `0 <= nn < 240` | `26` |
+| **`FEFnssss`** | `{string} DEBUGSTR`
`{string} {x} DEBUGSTRI` | _`-`_ | `0 <= n < 16`. Length of `ssss` is `n+1` bytes.
`{string}` is a [string literal](https://github.com/Piterden/TON-docs/blob/master/Fift.%20A%20Brief%20Introduction.md#user-content-29-string-literals).
[`DEBUGSTR`](#instr-debugstr): `ssss` is the given string.
[`DEBUGSTRI`](#instr-debugstr): `ssss` is one-byte integer `0 <= x <= 255` followed by the given string. | `26` |
+| **`FE00`** | `DUMPSTK` | _`-`_ | Dumps the stack (at most the top 255 values) and shows the total stack depth. | `26` |
+| **`FE2i`** | `s[i] DUMP` | _`-`_ | Dumps `s[i]`. | `26` |
+
+## 13 Codepage primitives
+| xxxxxxx
Opcode | xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Fift syntax | xxxxxxxxxxxxxxxxx
Stack | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Description | xxxx
Gas |
+|:-|:-|:-|:-|:-|
+| **`FFnn`** | `[nn] SETCP` | _`-`_ | Selects TVM codepage `0 <= nn < 240`. If the codepage is not supported, throws an invalid opcode exception. | `26` |
+| **`FF00`** | `SETCP0` | _`-`_ | Selects TVM (test) codepage zero as described in this document. | `26` |
+| **`FFFz`** | `[z-16] SETCP` | _`-`_ | Selects TVM codepage `z-16` for `1 <= z <= 15`. Negative codepages `-13...-1` are reserved for restricted versions of TVM needed to validate runs of TVM in other codepages. Negative codepage `-14` is reserved for experimental codepages, not necessarily compatible between different TVM implementations, and should be disabled in the production versions of TVM. | `26` |
+| **`FFF0`** | `SETCPX` | _`c - `_ | Selects codepage `c` with `-2^15 <= c < 2^15` passed in the top of the stack. | `26` |
+
diff --git a/versioned_docs/version-1.0.0/learn/tvm-instructions/tvm_exit_codes.md b/versioned_docs/version-1.0.0/learn/tvm-instructions/tvm_exit_codes.md
new file mode 100644
index 0000000000..db27648712
--- /dev/null
+++ b/versioned_docs/version-1.0.0/learn/tvm-instructions/tvm_exit_codes.md
@@ -0,0 +1,27 @@
+# TVM Exit codes
+
+TVM may exit with arbitrary 16-bit unsigned integer `exit_code`. `exit_code` higher than 1 are considered as _error codes_, thus exit with such code may cause transaction revert/bounce.
+
+## Standard exit codes
+* `0` - standard successful execution exit code
+* `1` - alternative successful execution exit code
+* `2` - stack underflow. Last op-code consume more elements than there are on stacks. 1
+* `3` - stack overflow. More values have been stored on a stack than
+allowed by this version of TVM
+* `4` - integer overflow. Integer does not fit into −2256 ≤ x < 2256 or a division by zero has occurred
+* `5` - integer out of expected range.
+* `6` - Invalid opcode. Instruction in unknown to current TVM version
+* `7` - Type check error. An argument to a primitive is of incorrect value type. 1
+* `8` - Cell overflow. Writing to builder is not possible since after operation there would be more than 1023 bits or 4 references.
+* `9` - Cell underflow. Read from slice primitive tried to read more bits or references than there are.
+* `10` - Dictionary error. Error during manipulation with dictionary (hashmaps).
+* `13` - Out of gas error. Thrown by TVM when the remaining gas becomes negative.
+* `32` - Action list is invalid. Set during action phase if c5 register after execution contains unparsable object.
+* `32` (the same as prev) - Method id not found. Returned by tonlib during attempt to execute non-existed get method.
+* `34` - Action is invalid or not supported. Set during action phase if current action can not be applied.
+* `37` - Not enough TONs. Message sends too much TON (or there is no enough TONs after deducting fees).
+* `38` - Not enough extra-currencies.
+
+1 If you encounter such exception in _func_ contract it most probably means a type error in `asm` declarations.
+
+
diff --git a/versioned_docs/version-1.0.0/learn/tvm-instructions/tvm_overview.md b/versioned_docs/version-1.0.0/learn/tvm-instructions/tvm_overview.md
new file mode 100644
index 0000000000..892357b644
--- /dev/null
+++ b/versioned_docs/version-1.0.0/learn/tvm-instructions/tvm_overview.md
@@ -0,0 +1,87 @@
+# TVM Overview
+
+
+
+All TON smart contracts are executed on their own TON Virtual Machine (TVM). TVM is built on the _stack principle_, which makes it efficient and easy to implement.
+
+This document provides bird's-eye overview of how TVM execute transactions.
+
+:::tip
+
+* There is also the detailed specification — [**whitepaper**](https://ton-blockchain.github.io/tvm.pdf)
+* Could be useful — [**TVM C++ implementation**](https://github.com/ton-blockchain/ton/tree/master/crypto/vm)
+
+:::
+
+## Transactions and phases
+When some event happens on the account in one of TON chains it causes a **transaction**. Most common event is "arrival of some message", but generally speaking there could be `tick-tock`, `merge`, `split` and other events.
+
+Each transaction consists of up to 5 phases.
+1. Storage phase - in that phase storage fees accrued by contract due to occupation of some space in chain state are calculated
+2. Credit phase - in that phase balance of contract with respect to (possible) incoming message value and collected storage fee are calculated
+3. Compute phase - in that phase TVM is executed (see below), result of TVM execution is aggregation of `exit_code`, `actions` (serialized list of actions), `gas_details`, `new_storage` and some others.
+4. Action phase - if compute phase was successful, in that phase `actions` from compute phase are processed. In particular actions may include sending of messages, update of smart contract code, update of libraries etc. Note that some actions may fail during processing (for instance we try to send message with more TONs than contract has), in that case the whole transaction may revert or this action may be scipped (it depends on the mode of the actions, in other words contract may send message in regime `send-or-revert` or in regime `try-send-if-no-ignore`).
+5. Bounce phase - if compute phase failed (it returned `exit_code >= 2`), in that phase _bounce message_ is formed for transactions initiated by incoming message.
+
+## Compute phase
+In that phase execution of TVM happens.
+
+### TVM state
+In any moment TVM state is fully determined by 6 state properties:
+* Stack (see below)
+* Control registers - (see below) speaking in simple terms up to 16 variables which may be directly set and read during execution
+* Current continuation - object which describe a sequence of instructions which is currently executed
+* Current codepage - speaking in simple terms version of TVM which is currently running
+* Gas limits - the set of 4 integer values the current gas limit gl, the maximal gas limit gm, the remaining gas gr, and the gas credit gc
+* Library context - the hashmap of libraries which can be called by TVM
+
+### TVM is stack machine
+TVM is last-input-first-output stack machine. There are 7 types of variables which may be stored in stack:
+* Integer - Signed 257-bit integers
+* Tuple - ordered collection of up to 255 elements having arbitrary value types, possibly distinct.
+* Null
+
+And four distinct flavours of cells:
+* Cell - basic (possible nested) opaque structure used by TON blockchain for storing all data
+* Slice - special object which allows to read from cell
+* Builder - special object which allows to create new cells
+* Continuation - special object which allows to use cell as source of TVM instructions
+
+### Control registers
+* `c0` — Contains the next continuation or return continuation (similar to the subroutine return address in conventional designs). This value must be a Continuation.
+* `c1` — Contains the alternative (return) continuation; this value must be a Continuation.
+* `c2` — Contains the exception handler. This value is a Continuation, invoked whenever an exception is triggered.
+* `c3` — Supporting register, contains the current dictionary, essentially a hashmap containing the code of all functions used in the program. This value must be a Continuation.
+* `c4` — Contains the root of persistent data, or simply the `data` section of the contract. This value is a Cell.
+* `c5` — Contains the output actions. This value is a Cell.
+* `c7` — Contains the root of temporary data. It is a Tuple.
+
+### Initialization of TVM
+So when transaction execution gets to Computation phase, TVM initialises and then executes commands (op-codes) from _Current continuation_ until there is no more commands to execute (and no continuation for return jumps).
+
+Detailed description of initialization can be find in [Ton-blockchain 4.4](https://ton-blockchain.github.io/tblkch.pdf).
+For ordinary transactions caused by message the initial state is as follows:
+* stack: 5 elements are put to the stack
+ * The balance of the smart contract (after crediting the value of the inbound message) is passed as an Integer amount of nanoTONs.
+ * The balance of inbound message `m` is passed as an Integer amount of nanoTONs.
+ * The inbound message is passed as a cell, which contains a serialized value of type Message X, where X is the type of the message body.
+ * The body of the inbound message, equal to the value of field body of `m`, is passed as a cell slice
+ * The function selector `s`, an Integer: `0` for tx caused by internal messages, `-1` for external, etc. Generally speaking it is the integer which tells what event caused transaction
+ * Current continuation : continuation converted from the `code` section of smart contract
+ * Registers initialise as follows: c0, c1, c2 and c3 are empty. c4 contain the cell from `data` section of smart contract. c5 contains empty list (it is serialized as cell which contain last action in list plus reference to prev one) of output actions. c7 is initialized as tuple with some basic blockchain context data such as time, global config, block_data, etc. See [Ton-blockchain 4.4.10](https://ton-blockchain.github.io/tblkch.pdf)
+ * Current codepage is set to default value (cp=0)
+ * Gas limits are initialized in accordance to Credit phase results
+ * Library context is initialized as result of merging this smart contract library collection, masterchain global library collection and incoming (if any) message library collection
+
+## TVM instructions
+
+The list of TVM instructions can be found here: [TVM instructions](/learn/tvm-instructions/instructions).
+
+### Result of TVM execution
+Besides of exit_code and consumed gas data, TVM indirectly outputs the following data:
+* c4 register - the cell which will be stored as new `data` of the smart-contract (if execution will not be reverted on this or later phases)
+* c5 register - (list of output actions) the cell with last action in the list and reference to the cell with prev action (recursively)
+
+All other register values will be neglected.
+
+Note, that since there is limitation on max cell-depth `<1024`, and particularly limitation on c4 and c5 depth `<=512`. Besides there is limitation on number of output actions in one tx `<=255`. If contract need to send more than that it may send message with request `continue_sending` to himself and send all necessary messages in a few subsequent transactions.
diff --git a/versioned_docs/version-1.0.0/participate/README.md b/versioned_docs/version-1.0.0/participate/README.md
new file mode 100644
index 0000000000..9173304f89
--- /dev/null
+++ b/versioned_docs/version-1.0.0/participate/README.md
@@ -0,0 +1,31 @@
+# Overview
+
+:::caution draft
+This is a concept article. We're still looking for someone experienced to write it.
+:::
+
+## Wallets
+
+To read more about wallets feel free to start in [WALLET APPS](/participate/wallets/apps) section.
+
+## Run a Node
+
+To read more about nodes feel free to start in [NODE TYPES](/participate/nodes/node-types) section.
+
+## Validators vs Nominators
+
+If you are familiar with cryptocurrencies, you must have heard about **validators** and **nominators**. These words often appear in crypto-related channels (our channel isn't an exception). Now, the time has come to find out who they are – the two major actors ruling the blockchain.
+
+### Validators
+
+First, let's speak about validators. A validator is a network node that helps keep the blockchain running by verifying (or validating) suggested blocks and allowing to record them in the blockchain.
+
+To become a validator, you must follow two requirements: have a high-performance server and obtain a serious amount of TON, 600,000, to make a stake. At the time of writing, there are 227 validators on TON.
+
+### Nominators
+
+It's evident that not everyone can afford to have hundreds of thousand Toncoin on their balance – that's why nominators come into play there. Simply put, the nominator is a user who lends his TON to validators. Every time the validator earns the reward by validating blocks, it is distributed between the involved participants.
+
+Some time ago, Ton Whales ran the first staking pool on TON with the minimum deposit of 50 TON. Later, TON Foundation launched the first open nominator pool. Now, users may stake Toncoin in a fully-decentralized way, starting with **10,000 TON**.
+
+_From [TON Community post](https://t.me/toncoin/543)._
\ No newline at end of file
diff --git a/versioned_docs/version-1.0.0/participate/explorers.md b/versioned_docs/version-1.0.0/participate/explorers.md
new file mode 100644
index 0000000000..90b8b0df9e
--- /dev/null
+++ b/versioned_docs/version-1.0.0/participate/explorers.md
@@ -0,0 +1,10 @@
+# Block explorers
+
+Right now you could find most of exploers in the Ton.app directory:
+* [https://ton.app/explorers](https://ton.app/explorers)
+
+In the future, we want to describe advantages and disadvantages of the most popular explorers here.
+
+:::caution draft
+This is a concept article. We're still looking for someone experienced to write it.
+:::
\ No newline at end of file
diff --git a/versioned_docs/version-1.0.0/participate/nodes/local-ton.md b/versioned_docs/version-1.0.0/participate/nodes/local-ton.md
new file mode 100644
index 0000000000..8a8d314a33
--- /dev/null
+++ b/versioned_docs/version-1.0.0/participate/nodes/local-ton.md
@@ -0,0 +1,11 @@
+# My Local TON
+
+![MyLocalTon](/img/docs/mylocalton.jpeg)
+
+Using **MyLocalTon** you can run your own TON blockchain even on your laptop.
+
+MyLocalTon has convenient UI and is cross-platform.
+
+[MyLocalTon binaries](https://github.com/neodiX42/MyLocalTon/releases)
+
+[MyLocalTon source code](https://github.com/neodiX42/MyLocalTon)
\ No newline at end of file
diff --git a/versioned_docs/version-1.0.0/participate/nodes/node-maintenance-and-security.md b/versioned_docs/version-1.0.0/participate/nodes/node-maintenance-and-security.md
new file mode 100644
index 0000000000..595cbdd288
--- /dev/null
+++ b/versioned_docs/version-1.0.0/participate/nodes/node-maintenance-and-security.md
@@ -0,0 +1,166 @@
+# TON Validator node maintenance and security
+
+## Introduction
+This guide provides some basic information on maintaining and securing TON Validator nodes.
+
+This document assumes that validator is installed using configuration and tools **[recommended by TON Foundation](../nodes/run-node)** but general concepts apply to other scenarios as well and can be useful for savvy sysadmin.
+
+## Maintenance
+### Database grooming
+TON node/validator keeps it's database under the path specified by `--db` flag of `validator-engine`, usually `/var/ton-work/db`, this directory is created and managed by the node but it is recommended to perform a database grooming / cleanup task once in a month to remove some artefacts.
+
+**Important**: You **must** stop validator process before performing the steps outlined below, failure to do that will likely cause database corruption.
+
+The procedure takes ~5 minutes to complete and will not cause major service disruption.
+
+#### Switch to root
+```sh
+sudo -s
+```
+#### Stop validator service
+```sh
+systemctl stop validator
+```
+#### Verify that validator is not running
+```sh
+systemctl status validator
+```
+#### Perform database cleanup
+```sh
+find /var/ton-work/db -name 'LOG.old*' -exec rm {} +
+rm -r /var/ton-work/db/files/packages/temp.archive.*
+```
+#### Start validator service
+```sh
+systemctl start validator
+```
+Verify that validator process is running by analysing the processes and log. Validator should re-sync with the network within few minutes.
+
+### Backups
+Easies and most efficient way to backup the validator is to copy crucial node configuration files, keys and mytonctrl settings:
+
+* Node configuration file: `/var/ton-work/db/config.json`
+* Node private keyring: `/var/ton-work/db/keyring`
+* Node public keys: `/var/ton-work/keys`
+* Mytonctrl configuration and wallets: `$HOME/.local/share/myton*` where $HOME is home directory of user you started installation of mytonctrl from. **OR** `/usr/local/bin/mytoncore` if you installed mytonctrl as root.
+
+This set is everything you need to perform recovery of your node from scratch.
+
+#### Snapshots
+Modern file systems such as ZFS offer snapshot functionality, most cloud providers also allow their customers to make snapshots of machines during which entire disk is preserved for future use.
+
+The problem with both methods is that you must stop node before performing a snapshot, failure to do so will most likely result in corrupt database with unexpected consequences. Many cloud providers also require you do power down the machine before performing a snapshot.
+
+Such stops should not be performed often, if you snapshot your node once a week then in the worst case scenario after recovery you will have a node with week old database and it will take your node more time to catch up with the network then to perform a new installation using mytonctrl "install from dump" feature (-d flag added during invocation of `install.sh` script).
+
+### Disaster recovery
+To perform recovery of your node on a new machine:
+
+#### Install mytonctrl / node
+For fastest node initialization add `-d` switch to invocation of installation script.
+
+#### Switch to root user
+```sh
+sudo -s
+```
+#### Stop mytoncore and validator processes
+```sh
+systemctl stop validator
+systemctl stop mytoncore
+```
+#### Apply backed up node configuration files
+* Node configuration file: `/var/ton-work/db/config.json`
+* Node private keyring: `/var/ton-work/db/keyring`
+* Node public keys: `/var/ton-work/keys`
+
+#### Set node IP address
+If your new node has a different IP address then you must edit node configuration file `/var/ton-work/db/config.json` and set the leaf `.addrs[0].ip` to **decimal** representation of new IP address. You can use **[this](https://github.com/sonofmom/ton-tools/blob/master/node/ip2dec.py)** python script to convert your IP to decimal.
+
+#### Ensure proper database permissions
+```sh
+chown -R validator:validator /var/ton-work/db
+```
+#### Apply backed up mytonctrl configuration files
+Replace `$HOME/.local/share/myton*` where $HOME is home directory of user you started installation of mytonctrl from with backed up content, make sure that the user is owner of all files you copy.
+
+#### Start mytoncore and validator processes
+```sh
+systemctl start validator
+systemctl start mytoncore
+```
+## Security
+### Host level security
+Host level security is huge topic that lies outside of the scope of this document, we do however advise to never install mytonctrl under root user, do use service account to ensure privilege separation.
+
+### Network level security
+TON validators are high value assets that should be protected against external threats, one of the first steps you should take is make your node as invisible as possible, this means locking down all network connections. On a validator node only UDP Port used for node operations should be exposed to the internet.
+
+#### Tools
+We will use **[ufw](https://help.ubuntu.com/community/UFW)** firewall interface as well as **[jq](https://github.com/stedolan/jq)** JSON command line processor.
+
+#### Management Networks
+As a node operator you need to retain full control and access to machine, in order to do this you need at least one fixed IP address or range.
+
+We also advise to setup a small "jumpstation" VPS with fixed IP Address that can be used by you to access your locked down machine(s) if you do not have fixed IP at home/office or to add alternative way to access secured machines should you lose your primary IP address.
+
+#### Install ufw and jq1
+```sh
+sudo apt install -y ufw jq
+```
+#### Basic lockdown of ufw ruleset
+```sh
+sudo ufw default deny incoming; sudo ufw default allow outgoing
+```
+#### Disable automated ICMP echo request accept
+```sh
+sudo sed -i 's/-A ufw-before-input -p icmp --icmp-type echo-request -j ACCEPT/#-A ufw-before-input -p icmp --icmp-type echo-request -j ACCEPT/g' /etc/ufw/before.rules
+```
+#### Enable all access from management network(s)
+```sh
+sudo ufw insert 1 allow from
+```
+repeat the above command for each management network / address.
+
+#### Expose node / validator UDP port to public
+```sh
+sudo ufw allow proto udp from any to any port `sudo jq -r '.addrs[0].port' /var/ton-work/db/config.json`
+```
+#### Doublecheck your management networks
+Important: before enabling firewall, please do doublecheck that you added correct management addresses!!
+
+#### Enable ufw firewall
+```sh
+sudo ufw enable
+```
+#### Checking status
+To check firewall status use following command:
+```sh
+ sudo ufw status numbered
+```
+Here is example output of locked down node with two management networks / addresses:
+
+```
+Status: active
+
+ To Action From
+ -- ------ ----
+[ 1] Anywhere ALLOW IN /28
+[ 2] Anywhere ALLOW IN /32
+[ 3] /udp ALLOW IN Anywhere
+[ 4] /udp (v6) ALLOW IN Anywhere (v6)
+```
+
+#### Expose LiteServer port
+```sh
+sudo ufw allow proto tcp from any to any port `sudo jq -r '.liteservers[0].port' /var/ton-work/db/config.json`
+```
+
+Please note that LiteServer port should not be exposed to public on a validator.
+
+#### More information on UFW
+See this excellent **[ufw tutorial](https://www.digitalocean.com/community/tutorials/ufw-essentials-common-firewall-rules-and-commands)** from Digital Ocean for more ufw magic.
+
+### IP Switch
+If you feel that your node is under attack then you should consider switching IP Address. The way to achieve the switch depends on your hosting provider you might preorder second address, clone your **stopped** VM into another instance or setup a new instance by performing **[disaster recovery](#disaster-recovery)** process.
+
+In any case, please do make sure that you **[set your new ip address](#set-node-ip)** in node configuration file!
diff --git a/versioned_docs/version-1.0.0/participate/nodes/node-types.md b/versioned_docs/version-1.0.0/participate/nodes/node-types.md
new file mode 100644
index 0000000000..8afeb70107
--- /dev/null
+++ b/versioned_docs/version-1.0.0/participate/nodes/node-types.md
@@ -0,0 +1,37 @@
+# TON Node Types
+
+There are different types of nodes in The Open Network:
+
+* **Lite clients**
+
+ Clients such as wallets that do not store the full state of the blockchain, but request what is needed from the full nodes.
+
+* **Full Node**
+
+ A node that is synchronized with the blockchain, stores the current state of the blockchain and the block history or part of the block history.
+
+ In a full node, you can enable one or more additional functionality:
+
+ * **Archive node**
+
+ A full node that stores the entire block history is called an archive node.
+
+ An archive node requires a lot of resources and is needed if you are making a blockchain explorer or something like that.
+
+ For most cases, you will be fine with a regular node that only stores the latest blocks and has significantly lower hardware requirements.
+
+ * **Liteserver**
+
+ If you enable an endpoint in a full node, then it starts to perform the functions of a lite server - it can receive and respond to requests from lite clients.
+
+ Using this node, your product can interact with the TON blockchain.
+
+ The TON Foundation supports a number of **public lite servers** that you can find in the global config ([mainnet](https://ton.org/global-config.json) and [testnet](https://ton-blockchain.github.io/testnet-global.config.json)).
+
+ These are endpoints available to everyone, for example, standard wallets connect to them.
+
+ * **Validator**
+
+ If you enable the validator functionality in the node and you have a sufficient number of Toncoins (stake), then the node will begin to participate in the process of validating new network blocks.
+
+ TON is a Proof-of-Stake blockchain, so validators keep the network running and are rewarded in Toncoins for doing so.
\ No newline at end of file
diff --git a/versioned_docs/version-1.0.0/participate/nodes/run-node.md b/versioned_docs/version-1.0.0/participate/nodes/run-node.md
new file mode 100644
index 0000000000..bfc7da8922
--- /dev/null
+++ b/versioned_docs/version-1.0.0/participate/nodes/run-node.md
@@ -0,0 +1,40 @@
+# Running your own Full Node/Validator
+
+To install and manage your own node, use **[mytonctrl](https://github.com/ton-blockchain/mytonctrl)** open source tool developed by TON Foundation.
+
+The majority of TON nodes use reliable and tested **mytonctrl**.
+
+## Installation
+
+[Setup Node/Validator video instruction](https://github.com/ton-blockchain/raw/master/nodes/setup_validator.mp4 ':include controls :type=video width=100% height=400px')
+
+Download and run the installation script.
+
+Ubuntu:
+```bash
+wget https://raw.githubusercontent.com/ton-blockchain/mytonctrl/master/scripts/install.sh
+sudo bash install.sh -m full
+```
+
+Debian:
+```bash
+wget https://raw.githubusercontent.com/ton-blockchain/mytonctrl/master/scripts/install.sh
+su root -c 'bash install.sh -m full'
+```
+
+Check the **mycontrol** installation procedure at:
+
+https://github.com/ton-blockchain/mytonctrl/blob/master/en/manual-ubuntu.md
+
+
+## Become a validator
+
+To use your full node as an endpoint, skip everything about the validator function. There is no need to send coins to your wallet.
+
+To become a validator, send Toncoins to your wallet.
+
+**mytonctrl** automatically joins validation from the next next election round.
+
+Check the manual here:
+
+https://github.com/ton-blockchain/mytonctrl/blob/master/en/manual-ubuntu.md
diff --git a/versioned_docs/version-1.0.0/participate/nodes/setup_validator.mp4 b/versioned_docs/version-1.0.0/participate/nodes/setup_validator.mp4
new file mode 100644
index 0000000000..85917cf7bf
Binary files /dev/null and b/versioned_docs/version-1.0.0/participate/nodes/setup_validator.mp4 differ
diff --git a/versioned_docs/version-1.0.0/participate/wallets/apps.md b/versioned_docs/version-1.0.0/participate/wallets/apps.md
new file mode 100644
index 0000000000..53870e12b3
--- /dev/null
+++ b/versioned_docs/version-1.0.0/participate/wallets/apps.md
@@ -0,0 +1,24 @@
+# Types of Wallet Apps
+
+:::caution draft
+This is a concept article. We're still looking for someone experienced to write it.
+:::
+
+## Overview
+
+This article describes wallets from development perspective.
+
+If you want to find a wallet to install open the [ton.org/wallets](https://ton.org/wallets).
+
+## Noncustodial wallets
+
+* [TON Wallet Chrome Extension](https://chrome.google.com/webstore/detail/ton-wallet/nphplpgoakhhjchkkhmiggakijnkhfnd) — one of the first wallets in TON ecosystem.
+* Tonkeeper
+* Tonhub
+
+In the future, we want to describe advantages and disadvantages of the most popular wallets and how to use them for everyday life or for development process.
+
+## Custodial wallets
+
+* @wallet — bot application to send and receive TON inside Telegram.
+* @cryptobot — telegram bot
\ No newline at end of file
diff --git a/versioned_docs/version-1.0.0/participate/wallets/contracts.md b/versioned_docs/version-1.0.0/participate/wallets/contracts.md
new file mode 100644
index 0000000000..77f2333501
--- /dev/null
+++ b/versioned_docs/version-1.0.0/participate/wallets/contracts.md
@@ -0,0 +1,10 @@
+# Types of Wallet Contracts
+
+:::caution draft
+This is a concept article. We're still looking for someone experienced to write it.
+:::
+
+In the future we want to describe the most important wallet smart contracts types here.
+
+Right now you could find most of the contracts here:
+* [https://github.com/ton-blockchain/ton/tree/master/crypto/smartcont](https://github.com/ton-blockchain/ton/tree/master/crypto/smartcont)
\ No newline at end of file
diff --git a/versioned_sidebars/version-1.0.0-sidebars.json b/versioned_sidebars/version-1.0.0-sidebars.json
new file mode 100644
index 0000000000..dfef342ddf
--- /dev/null
+++ b/versioned_sidebars/version-1.0.0-sidebars.json
@@ -0,0 +1,314 @@
+{
+ "learn": [
+ "learn/introduction",
+ {
+ "type": "html",
+ "value": "
"
+ },
+ {
+ "type": "html",
+ "value": ""
+ },
+ "learn/overviews/TON_blockchain_overview",
+ "learn/overviews/Cells",
+ {
+ "type": "category",
+ "label": "TON Virtual Machine (TVM)",
+ "items": [
+ "learn/tvm-instructions/tvm_overview",
+ "learn/tvm-instructions/tvm_exit_codes",
+ "learn/tvm-instructions/instructions"
+ ]
+ },
+ {
+ "type": "category",
+ "label": "Typed Language - Binary",
+ "items": [
+ "learn/overviews/TL-B",
+ "learn/overviews/TL-B_language"
+ ]
+ },
+ "learn/overviews/ADNL"
+ ],
+ "develop": [
+ "develop/getting-started",
+ {
+ "type": "html",
+ "value": "
"
+ },
+ {
+ "type": "html",
+ "value": ""
+ },
+ {
+ "type": "category",
+ "label": "Develop Smart Contracts",
+ "items": [
+ "develop/smart-contracts/README",
+ {
+ "type": "category",
+ "label": "Environment",
+ "items": [
+ "develop/installation",
+ "develop/tools/ide-plugins",
+ "develop/tools/testnet/README"
+ ]
+ },
+ {
+ "type": "category",
+ "label": "Choose Your SDK",
+ "items": [
+ "develop/smart-contracts/sdk/tonstarter",
+ "develop/smart-contracts/sdk/toncli"
+ ]
+ },
+ {
+ "type": "category",
+ "label": "Testing & Debugging",
+ "items": [
+ "develop/smart-contracts/testing/tonstarter",
+ "develop/smart-contracts/testing/toncli"
+ ]
+ },
+ {
+ "type": "category",
+ "label": "Deploying Contract",
+ "items": [
+ {
+ "type": "link",
+ "label": "Using tonstarter-contracts",
+ "href": "https://github.com/ton-defi-org/tonstarter-contracts"
+ },
+ {
+ "type": "link",
+ "label": "Using Online IDE",
+ "href": "https://glitch.com/edit/#!/remix/clone-from-repo?&REPO_URL=https%3A%2F%2Fgithub.com%2Fton-defi-org%2Ftonstarter-contracts.git"
+ },
+ {
+ "type": "link",
+ "label": "Using toncli",
+ "href": "https://github.com/disintar/toncli"
+ }
+ ]
+ },
+ {
+ "type": "category",
+ "label": "Best Practices",
+ "items": [
+ "develop/smart-contracts/guidelines",
+ "develop/smart-contracts/fees",
+ "develop/smart-contracts/messages",
+ "develop/smart-contracts/guidelines/internal-messages",
+ "develop/smart-contracts/guidelines/external-messages",
+ "develop/smart-contracts/guidelines/non-bouncable-messages",
+ "develop/smart-contracts/guidelines/get-methods",
+ "develop/smart-contracts/guidelines/accept",
+ "develop/smart-contracts/guidelines/processing",
+ "develop/smart-contracts/governance",
+ "develop/smart-contracts/guidelines/tips",
+ {
+ "type": "link",
+ "label": "How to shard your TON smart contract and why",
+ "href": "https://society.ton.org/how-to-shard-your-ton-smart-contract-and-why-studying-theanatomy-of-tons-jettons"
+ }
+ ]
+ },
+ {
+ "type": "link",
+ "label": "Coming from ETH and Solidity",
+ "href": "/learn/introduction#ethereum-to-ton"
+ }
+ ]
+ },
+ {
+ "type": "category",
+ "label": "Develop Web Apps & Bots",
+ "items": [
+ "develop/tools/README",
+ "develop/tools/apis/README",
+ {
+ "type": "category",
+ "label": "Best Practices",
+ "items": [
+ {
+ "type": "category",
+ "label": "Payment Processing",
+ "items": [
+ "develop/howto/payment-processing",
+ "develop/payment-processing/common",
+ "develop/payment-processing/deposits-single-wallet",
+ "develop/payment-processing/deposits-multi-wallet",
+ "develop/payment-processing/withdrawals"
+ ]
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "type": "html",
+ "value": "
"
+ },
+ {
+ "type": "html",
+ "value": ""
+ },
+ {
+ "type": "category",
+ "label": "FunC language",
+ "items": [
+ {
+ "type": "doc",
+ "id": "develop/func/overview"
+ },
+ {
+ "type": "category",
+ "label": "Documentation",
+ "items": [
+ "develop/func/types",
+ "develop/func/comments",
+ "develop/func/literals_identifiers",
+ "develop/func/functions",
+ "develop/func/global_variables",
+ "develop/func/compiler_directives",
+ "develop/func/statements",
+ "develop/func/builtins",
+ "develop/func/stdlib"
+ ]
+ }
+ ]
+ },
+ {
+ "type": "link",
+ "label": "TON Concepts",
+ "href": "/learn/introduction"
+ },
+ {
+ "type": "category",
+ "label": "TON Whitepapers",
+ "items": [
+ {
+ "type": "doc",
+ "label": "Overview",
+ "id": "learn/docs"
+ },
+ {
+ "type": "link",
+ "label": "TON",
+ "href": "https://ton-blockchain.github.io/ton.pdf"
+ },
+ {
+ "type": "link",
+ "label": "TON Virtual Machine",
+ "href": "https://ton-blockchain.github.io/tvm.pdf"
+ },
+ {
+ "type": "link",
+ "label": "TON Blockchain",
+ "href": "https://ton-blockchain.github.io/tblkch.pdf"
+ },
+ {
+ "type": "link",
+ "label": "Catchain Consensus Protocol",
+ "href": "https://ton-blockchain.github.io/catchain.pdf"
+ }
+ ]
+ },
+ {
+ "type": "category",
+ "label": "TON Services",
+ "items": [
+ "develop/web3/dns",
+ {
+ "type": "html",
+ "value": ""
+ },
+ {
+ "type": "html",
+ "value": ""
+ },
+ {
+ "type": "html",
+ "value": ""
+ }
+ ]
+ },
+ {
+ "type": "category",
+ "label": "Network Configs",
+ "items": [
+ {
+ "type": "link",
+ "label": "Mainnet config",
+ "href": "https://ton.org/global-config.json"
+ },
+ {
+ "type": "link",
+ "label": "Testnet config",
+ "href": "https://ton-blockchain.github.io/testnet-global.config.json"
+ }
+ ]
+ },
+ {
+ "type": "category",
+ "label": "Low Level Internals",
+ "items": [
+ "develop/howto/step-by-step",
+ "develop/howto/ton-sites",
+ "develop/howto/config-params",
+ "develop/howto/pow-givers"
+ ]
+ }
+ ],
+ "participate": [
+ "participate/README",
+ {
+ "type": "html",
+ "value": "
"
+ },
+ "participate/explorers",
+ {
+ "type": "category",
+ "label": "Setup Your Wallet",
+ "items": [
+ "participate/wallets/apps",
+ "participate/wallets/contracts",
+ {
+ "type": "link",
+ "label": "Wallet Contract Versions",
+ "href": "https://github.com/toncenter/tonweb/blob/master/src/contract/wallet/WalletSources.md"
+ }
+ ]
+ },
+ {
+ "type": "category",
+ "label": "Run a Node",
+ "items": [
+ "participate/nodes/node-types",
+ "participate/nodes/run-node",
+ "participate/nodes/node-maintenance-and-security",
+ "participate/nodes/local-ton"
+ ]
+ },
+ {
+ "type": "link",
+ "label": "Join in a Nominator Pool",
+ "href": "https://tonvalidators.org/"
+ },
+ {
+ "type": "link",
+ "label": "Run a Validator Node",
+ "href": "https://ton.org/validator"
+ }
+ ],
+ "contribute": [
+ {
+ "type": "category",
+ "label": "Become a Contributor",
+ "items": [
+ "contribute/README",
+ "contribute/maintainers"
+ ]
+ }
+ ]
+}
diff --git a/versions.json b/versions.json
new file mode 100644
index 0000000000..5e1abcd8a6
--- /dev/null
+++ b/versions.json
@@ -0,0 +1,3 @@
+[
+ "1.0.0"
+]