在我正在编写的虚拟机中,我希望能够以类似于以下伪代码的方式分派命令。
add: reg[memory[pc+1]] = reg[memory[pc+1]] + reg[memory[pc+2]]; pc += 2; goto done;
sub: reg[memory[pc+1]] = reg[memory[pc+1]] - reg[memory[pc+2]]; pc += 2; goto done;
cmp: /* Would take more space than simply x = x + y; */ goto done;
for(int pc = 0; memory[pc]