N_INLINE static void take_branch(zbyte branch) { int o = branch & b00111111; if(!(branch & b01000000)) {/* Bit 6 clear means 'branch occupies two bytes'*/ o = (o << 8) + HIBYTE(PC); PC++; if(branch & b00100000) o = -((1 << 14) - o); } if(o == 0) mop_func_return(0); else if(o == 1) mop_func_return(1); else PC += o - 2; #ifndef FAST if(PC > game_size) { n_show_error(E_INSTR, "attempt to conditionally jump outside of story", o - 2); PC -= o - 2; return; } #endif /* printf("cjmp %x -> %x\n", oldPC, PC); */ }
void op_throw(void) { #ifndef FAST if(operand[1] > frame_count) { n_show_error(E_STACK, "attempting to throw away non-existent frames", operand[1]); return; } #endif if(operand[1] != 0) { frame_count = operand[1]; mop_func_return(operand[0]); } else { n_show_error(E_STACK, "attempting to throw away initial frame", operand[0]); } }
void op_rtrue(void) { mop_func_return(1); }
void op_rfalse(void) { mop_func_return(0); }
void op_ret(void) { mop_func_return(operand[0]); }
void op_ret_popped(void) { mop_func_return(stack_pop()); }