示例#1
0
void execute_program(void){
	initStack();
	unsigned i;
	while(pc <AVM_ENDING_PC){
		printf("____PC %d_____\n",pc);
		if(executionFinished) break;
		execute_cycle();
//		printf("STACK\n");
//		for(i=AVM_STACKSIZE-1;i>=top;i--){
  //           		printf("TYPE:%d VAL:%f---%d\n",stack[i].type,stack[i].data.numVal,i);}
//		puts("");
	}
//	for(i=AVM_STACKSIZE-1;i>top;i--){
//		printf("TYPE:%d VAL:%f\n",stack[i].type,stack[i].data.numVal);}
	puts("");
}
示例#2
0
extern void run_program(void *machine_p)
{
        assert(machine_p);

        UM_machine machine = (UM_machine) machine_p;

        while(true){
                /* stop running if halt instruction reached or if program 
                   counter has gone out of bounds */
                if(!execute_cycle(machine)){
                        break;
                }
        }

        free_machine(machine);
}