Example #1
0
static void saturn_instruction_8(void)
{
	int oper;

	switch(READ_OP()) {
	case 0:
		saturn_instruction_80();
		break;
	case 1:
		saturn_instruction_81();
		break;
	case 2: saturn_hst_clear_bits();break;
	case 3: saturn_hst_bits_cleared();break;
	case 4: saturn_st_clear_bit();break;
	case 5: saturn_st_set_bit();break;
	case 6: saturn_st_jump_bit_clear();break;
	case 7: saturn_st_jump_bit_set();break;
	case 8: saturn_p_not_equals(); break;
	case 9: saturn_p_equals(); break;
	case 0xa:
		switch(oper=READ_OP()) {
		case 0: case 1: case 2: case 3:
			saturn_equals(reg_left[oper&3] , BEGIN_A, COUNT_A, reg_right[oper&3]);
			break;
		case 4: case 5: case 6: case 7:
			saturn_not_equals(reg_left[oper&3] , BEGIN_A, COUNT_A, reg_right[oper&3]);
			break;
		case 8: case 9: case 0xa: case 0xb:
			saturn_equals_zero(A+(oper&3), BEGIN_A, COUNT_A);
			break;
		case 0xc: case 0xd: case 0xe: case 0xf:
			saturn_not_equals_zero(A+(oper&3), BEGIN_A, COUNT_A);
			break;
		}
		break;
	case 0xb:
		switch(oper=READ_OP()) {
		case 0: case 1: case 2: case 3:
			saturn_greater(reg_left[oper&3] , BEGIN_A, COUNT_A, reg_right[oper&3]);
			break;
		case 4: case 5: case 6: case 7:
			saturn_smaller(reg_left[oper&3] , BEGIN_A, COUNT_A, reg_right[oper&3]);
			break;
		case 8: case 9: case 0xa: case 0xb:
			saturn_greater_equals(reg_left[oper&3], BEGIN_A, COUNT_A, reg_right[oper&3]);
			break;
		case 0xc: case 0xd: case 0xe: case 0xf:
			saturn_smaller_equals(reg_left[oper&3], BEGIN_A, COUNT_A, reg_right[oper&3]);
			break;
		}
		break;
	case 0xc: saturn_jump((READ_OP_DIS16()+saturn.pc-4)&0xfffff,1);break;
	case 0xd: saturn_jump(READ_OP_ARG20(),1);break;
	case 0xe: saturn_call((READ_OP_DIS16()+saturn.pc)&0xfffff);break;
	case 0xf: saturn_call(READ_OP_ARG20());break;
	}
}
Example #2
0
static void saturn_instruction_9(saturn_state *cpustate)
{
	int adr, oper;

	switch(adr=READ_OP(cpustate)) {
	case 0:
		switch(oper=READ_OP(cpustate)) {
		case 0: case 1: case 2: case 3:
			saturn_equals(cpustate, reg_left[oper&3] , cpustate->p, 1, reg_right[oper&3]);
			break;
		case 4: case 5: case 6: case 7:
			saturn_not_equals(cpustate, reg_left[oper&3] ,cpustate->p, 1, reg_right[oper&3]);
			break;
		case 8: case 9: case 0xa: case 0xb:
			saturn_equals_zero(cpustate, A+(oper&3), cpustate->p, 1);
			break;
		case 0xc: case 0xd: case 0xe: case 0xf:
			saturn_not_equals_zero(cpustate, A+(oper&3), cpustate->p, 1);
			break;
		}
		break;
	case 1:
		switch(oper=READ_OP(cpustate)) {
		case 0: case 1: case 2: case 3:
			saturn_equals(cpustate, reg_left[oper&3] , 0, cpustate->p+1, reg_right[oper&3]);
			break;
		case 4: case 5: case 6: case 7:
			saturn_not_equals(cpustate, reg_left[oper&3] , 0, cpustate->p+1, reg_right[oper&3]);
			break;
		case 8: case 9: case 0xa: case 0xb:
			saturn_equals_zero(cpustate, A+(oper&3), 0, cpustate->p+1);
			break;
		case 0xc: case 0xd: case 0xe: case 0xf:
			saturn_not_equals_zero(cpustate, A+(oper&3), 0, cpustate->p+1);
			break;
		}
		break;
	case 2: case 3: case 4: case 5: case 6: case 7:
		switch(oper=READ_OP(cpustate)) {
		case 0: case 1: case 2: case 3:
			saturn_equals(cpustate, reg_left[oper&3] ,adr_a_begin[adr], adr_a_count[adr], reg_right[oper&3]);
			break;
		case 4: case 5: case 6: case 7:
			saturn_not_equals(cpustate, reg_left[oper&3] ,adr_a_begin[adr], adr_a_count[adr], reg_right[oper&3]);
			break;
		case 8: case 9: case 0xa: case 0xb:
			saturn_equals_zero(cpustate, A+(oper&3),adr_a_begin[adr], adr_a_count[adr]);
			break;
		case 0xc: case 0xd: case 0xe: case 0xf:
			saturn_not_equals_zero(cpustate, A+(oper&3) ,adr_a_begin[adr], adr_a_count[adr]);
			break;
		}
		break;
	case 8:
		switch(oper=READ_OP(cpustate)) {
		case 0: case 1: case 2: case 3:
			saturn_greater(cpustate, reg_left[oper&3] ,cpustate->p, 1, reg_right[oper&3]);
			break;
		case 4: case 5: case 6: case 7:
			saturn_smaller(cpustate, reg_left[oper&3] ,cpustate->p, 1, reg_right[oper&3]);
			break;
		case 8: case 9: case 0xa: case 0xb:
			saturn_greater_equals(cpustate, reg_left[oper&3] ,cpustate->p, 1, reg_right[oper&3]);
			break;
		case 0xc: case 0xd: case 0xe: case 0xf:
			saturn_smaller_equals(cpustate, reg_left[oper&3] ,cpustate->p, 1, reg_right[oper&3]);
			break;
		}
		break;
	case 9:
		switch(oper=READ_OP(cpustate)) {
		case 0: case 1: case 2: case 3:
			saturn_greater(cpustate, reg_left[oper&3] , 0, cpustate->p+1, reg_right[oper&3]);
			break;
		case 4: case 5: case 6: case 7:
			saturn_smaller(cpustate, reg_left[oper&3] , 0, cpustate->p+1, reg_right[oper&3]);
			break;
		case 8: case 9: case 0xa: case 0xb:
			saturn_greater_equals(cpustate, reg_left[oper&3], 0, cpustate->p+1, reg_right[oper&3]);
			break;
		case 0xc: case 0xd: case 0xe: case 0xf:
			saturn_smaller_equals(cpustate, reg_left[oper&3], 0, cpustate->p+1, reg_right[oper&3]);
			break;
		}
		break;
	case 0xa: case 0xb: case 0xc: case 0xd: case 0xe: case 0xf:
		switch(oper=READ_OP(cpustate)) {
		case 0: case 1: case 2: case 3:
			saturn_greater(cpustate, reg_left[oper&3] ,adr_b_begin[adr], adr_b_count[adr], reg_right[oper&3]);
			break;
		case 4: case 5: case 6: case 7:
			saturn_smaller(cpustate, reg_left[oper&3] ,adr_b_begin[adr], adr_b_count[adr], reg_right[oper&3]);
			break;
		case 8: case 9: case 0xa: case 0xb:
			saturn_greater_equals(cpustate, reg_left[oper&3] ,adr_b_begin[adr], adr_b_count[adr], reg_right[oper&3]);
			break;
		case 0xc: case 0xd: case 0xe: case 0xf:
			saturn_smaller_equals(cpustate, reg_left[oper&3] ,adr_b_begin[adr], adr_b_count[adr], reg_right[oper&3]);
			break;
		}
		break;
	}
}
Example #3
0
static void saturn_instruction_8(saturn_state *cpustate)
{
	int oper, adr;

	switch(READ_OP(cpustate)) {
	case 0:
		saturn_instruction_80(cpustate);
		break;
	case 1:
		saturn_instruction_81(cpustate);
		break;
	case 2: saturn_hst_clear_bits(cpustate);break;
	case 3: saturn_hst_bits_cleared(cpustate);break;
	case 4: saturn_st_clear_bit(cpustate);break;
	case 5: saturn_st_set_bit(cpustate);break;
	case 6: saturn_st_jump_bit_clear(cpustate);break;
	case 7: saturn_st_jump_bit_set(cpustate);break;
	case 8: saturn_p_not_equals(cpustate); break;
	case 9: saturn_p_equals(cpustate); break;
	case 0xa:
		switch(oper=READ_OP(cpustate)) {
		case 0: case 1: case 2: case 3:
			saturn_equals(cpustate, reg_left[oper&3] , BEGIN_A, COUNT_A, reg_right[oper&3]);
			break;
		case 4: case 5: case 6: case 7:
			saturn_not_equals(cpustate, reg_left[oper&3] , BEGIN_A, COUNT_A, reg_right[oper&3]);
			break;
		case 8: case 9: case 0xa: case 0xb:
			saturn_equals_zero(cpustate, A+(oper&3), BEGIN_A, COUNT_A);
			break;
		case 0xc: case 0xd: case 0xe: case 0xf:
			saturn_not_equals_zero(cpustate, A+(oper&3), BEGIN_A, COUNT_A);
			break;
		}
		break;
	case 0xb:
		switch(oper=READ_OP(cpustate)) {
		case 0: case 1: case 2: case 3:
			saturn_greater(cpustate, reg_left[oper&3] , BEGIN_A, COUNT_A, reg_right[oper&3]);
			break;
		case 4: case 5: case 6: case 7:
			saturn_smaller(cpustate, reg_left[oper&3] , BEGIN_A, COUNT_A, reg_right[oper&3]);
			break;
		case 8: case 9: case 0xa: case 0xb:
			saturn_greater_equals(cpustate, reg_left[oper&3], BEGIN_A, COUNT_A, reg_right[oper&3]);
			break;
		case 0xc: case 0xd: case 0xe: case 0xf:
			saturn_smaller_equals(cpustate, reg_left[oper&3], BEGIN_A, COUNT_A, reg_right[oper&3]);
			break;
		}
		break;
	case 0xc:
		adr=READ_OP_DIS16(cpustate);
		saturn_jump(cpustate, (adr+cpustate->pc-4)&0xfffff,1);
		break;
	case 0xd:
		adr=READ_OP_ARG20(cpustate);
		saturn_jump(cpustate, adr,1);
		break;
	case 0xe:
		adr=READ_OP_DIS16(cpustate);
		saturn_call(cpustate, (adr+cpustate->pc)&0xfffff);
		break;
	case 0xf:
		adr=READ_OP_ARG20(cpustate);
		saturn_call(cpustate, adr);
		break;
	}
}