A method is proposed for virtual enlargement of the stack of a portable data
carrier
allowing reloading of executable program code. To permit the execution of programs
requiring a larger stack than that physically present, the stack is segmented into
at least two stack segments and their fill state monitored. When complete occupation
of a segment is recognized, the oldest stack segment is swapped out to a further
storage medium. The further storage medium is a nonvolatile read-write memory that
can be a slower memory compared to the stack. When sufficient memory space is available
in the stack again, the swapped out segment is returned. The method includes managing
a destination address of each stack segment swapped out to the non-volatile read-write
memory in a register in a volatile read-write memory.