virtualmachine.h

来自「这是一个linux下的Shell.有命令历史和命令提示」· C头文件 代码 · 共 55 行

H
55
字号
//The Virtual Machine is a virtual machine where  the program of programable  ///lover runconst int TEXT_SIZE      =  1024;const int STACK_SIZE     =  1024;const int GLOBL_SIZE =  1024;const char ADD             = 1;const char SUB             = 2;const char MUL             = 3;const char DIV             = 4;const char EQUAL           = 6;const char BELOV		   = 7;const char BELOWEQUAL	   = 8;	const char ABOVE           = 9;const char ABOVEEQUAL      = 10;const char CALL            = 11;const char RJMP			   = 12;const char JMP			   = 13;const char MOV			   = 14;class VirtualMachine{public:	VirtualMachine(void);	~VirtualMachine(void);	int run(void);private:	void stack_err(void);	void seg_err(void);	bool add(int, int);	bool sub(int, int);	bool mul(int, int);	bool div(int, int);	bool equal(int, int);	bool below(int, int);	bool belowequal(int, int);	bool above(int, int );	bool aboveequal(int, int);	bool isAddrLegal(int index);	int res_;	int pc_;	int bp_;	int sp_;	char text[TEXT_SIZE];	int stack[STACK_SIZE];	int globl[GLOBL_SIZE];	bool diverr;};

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?