stack

package
v0.0.0-...-0de04ed Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 6, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DUP

type DUP struct{ base.NoOperandsInstruction }

DUP Duplicate the top operand stack value * 栈指令直接对操作数栈进行操作,共9条:pop和pop2指令将栈 顶变量弹出,dup系列指令复制栈顶变量,swap指令交换栈顶的两 个变量。 和其他类型的指令不同,栈指令并不关心变量类型。

栈指令的操作数就在栈中,直接进行栈相关操作即可获得,故继承 base.NoOperandsInstruction

func (*DUP) Execute

func (self *DUP) Execute(frame *rtda.Frame)

Execute

bottom -> top [...][c][b][a]

\_
  |
  V

[...][c][b][a][a]

type DUP2

type DUP2 struct{ base.NoOperandsInstruction }

DUP2 Duplicate the top one or two operand stack values

func (*DUP2) Execute

func (self *DUP2) Execute(frame *rtda.Frame)

Execute

bottom -> top [...][c][b][a]____

\____   |
     |  |
     V  V

[...][c][b][a][b][a]

type DUP2_X1

type DUP2_X1 struct{ base.NoOperandsInstruction }

DUP2_X1 Duplicate the top one or two operand stack values and insert two or three values down

func (*DUP2_X1) Execute

func (self *DUP2_X1) Execute(frame *rtda.Frame)

Execute

bottom -> top [...][c][b][a]

 _/ __/
|  |
V  V

[...][b][a][c][b][a]

type DUP2_X2

type DUP2_X2 struct{ base.NoOperandsInstruction }

DUP2_X2 Duplicate the top one or two operand stack values and insert two, three, or four values down

func (*DUP2_X2) Execute

func (self *DUP2_X2) Execute(frame *rtda.Frame)

Execute

bottom -> top [...][d][c][b][a]

 ____/ __/
|   __/
V  V

[...][b][a][d][c][b][a]

type DUP_X1

type DUP_X1 struct{ base.NoOperandsInstruction }

DUP_X1 Duplicate the top operand stack value and insert two values down

func (*DUP_X1) Execute

func (self *DUP_X1) Execute(frame *rtda.Frame)

Execute

bottom -> top [...][c][b][a]

 __/
|
V

[...][c][a][b][a]

type DUP_X2

type DUP_X2 struct{ base.NoOperandsInstruction }

DUP_X2 Duplicate the top operand stack value and insert two or three values down

func (*DUP_X2) Execute

func (self *DUP_X2) Execute(frame *rtda.Frame)

Execute

bottom -> top [...][c][b][a]

 _____/
|
V

[...][a][c][b][a]

type POP

type POP struct{ base.NoOperandsInstruction }

POP Pop the top operand stack value

func (*POP) Execute

func (self *POP) Execute(frame *rtda.Frame)

Execute

bottom -> top [...][c][b][a]

|
V

[...][c][b]

type POP2

type POP2 struct{ base.NoOperandsInstruction }

POP2 Pop the top one or two operand stack values

func (*POP2) Execute

func (self *POP2) Execute(frame *rtda.Frame)

Execute

bottom -> top [...][c][b][a]

|  |
V  V

[...][c]

type SWAP

type SWAP struct{ base.NoOperandsInstruction }

SWAP Swap the top two operand stack values

func (*SWAP) Execute

func (self *SWAP) Execute(frame *rtda.Frame)

Execute

bottom -> top [...][c][b][a]

 \/
 /\
V  V

[...][c][a][b]

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL