📄 virtualmachine.h
字号:
//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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -