Site Tools


Smart Card Solution

User Manual

JavaCard API Samples

Java Card Specification

Knowledge Sharing


7.5.18 dup_x

Duplicate top operand stack words and insert below





dup_x = 63 (0x3f)


…, wordN, …, wordM, …, word1 → …, wordM, …, word1, wordN, …, wordM, …, word1


The unsigned byte mn is used to construct two parameter values. The high nibble, (mn& 0xf0) » 4, is used as the value m. The low nibble, (mn& 0xf), is used as the value n. Permissible values for m are 1 through 4. Permissible values for n are 0 and m through m+4.

For positive values of n, the top m words on the operand stack are duplicated and the copied words are inserted n words down in the operand stack. When n equals 0, the top m words are copied and placed on top of the stack.

The dup_x instruction must not be used unless the ranges of words 1 through m and words m+1 through n each contain either a 16-bit data type, two 16-bit data types, a 32-bit data type, a 16-bit data type and a 32-bit data type (in either order), or two 32-bit data types.


Except for restrictions preserving the integrity of 32-bit data types, the dup_x instruction operates on untyped words, ignoring the types of data they contain.

If a virtual machine does not support the int data type, the permissible values for m are 1 or 2, and permissible values for n are 0 and m through m+2.

javacard/jcvm/7.5.18_dup_x.txt · Last modified: 2017/05/13 04:09 (external edit)