Yet Another Virtual Machine - Stack Instructions

Back to index

PUSH8, PUSH16, PUSH32, PUSH64

OPCODE: 00000

InstructionValue for X
PUSH81
PUSH162
PUSH324
PUSH648
PUSH16 0xDEAD

PUSH16 (1 00000 01)0xDE0xAD

STACK HEAD (SP = 2)
0xAD
0xDE
STACK BASE

Source code

POP8, POP16, POP32, POP64

OPCODE: 00001

InstructionValue for X
POP81
POP162
POP324
POP648
PUSH16 0xDEAD
POP8

PUSH16 (1 00000 01)0xDE0xAD
POP8 (0 00001 00)

STACK HEAD (SP = 1)
0xDE
STACK BASE

Source code

SWAP8, SWAP16, SWAP32, SWAP64

OPCODE: 00010

InstructionValue for X
SWAP81
SWAP162
SWAP324
SWAP648
PUSH16 0xDEAD
PUSH16 0xBEEF
SWAP16

PUSH16 (1 00000 01)0xDE0xAD
PUSH16 (1 00000 01)0xBE0xEF
SWAP16 (0 00010 01)

STACK HEAD (SP = 4)
0xAD
0xDE
0xEF
0xBE
STACK BASE

Source code

TUCK8, TUCK16, TUCK32, TUCK64

OPCODE: 00011

InstructionValue for X
TUCK81
TUCK162
TUCK324
TUCK648
PUSH16 0xDEAD
TUCK8

PUSH16 (1 00000 01)0xDE0xAD
TUCK8 (0 00011 00)

STACK HEAD (SP = 3)
0xAD
0xDE
0xAD
STACK BASE

Source code

Back to index