void EncodeCond( oc_jcond *oc ) { axp_ins opcode; int floating; floating = 0; if( oc->hdr.class & ATTR_FLOAT ) { floating = 1; } opcode = BranchOpcodes[ oc->cond - FIRST_COMPARISON ][ floating ]; doBranch( opcode, oc->handle, oc->index ); }
void EncodeCall( oc_handle *oc ) { doBranch( 0x34, oc->handle, AXP_RETURN_ADDR ); }
void execute(pruCPU *cpu) { aluInstruction inst; fmt2InstructionHeader fmt2Hdr; while(1) { int didBranch = 0; cgc_memcpy(&inst, (aluInstruction *)&cpu->code[cpu->pc], 4); switch(inst.opFmt) { case 0b000: switch(inst.aluOp) { case ADD: doAdd(cpu, inst); break; case ADC: doAdc(cpu, inst); break; case SUB: doSub(cpu, inst); break; case SUC: doSuc(cpu, inst); break; case LSL: doLsl(cpu, inst); break; case LSR: doLsr(cpu, inst); break; case RSB: doRsb(cpu, inst); break; case RSC: doRsc(cpu, inst); break; case AND: doAnd(cpu, inst); break; case OR: doOr(cpu, inst); break; case XOR: doXor(cpu, inst); break; case NOT: doNot(cpu, inst); break; case MIN: doMin(cpu, inst); break; case MAX: doMax(cpu, inst); break; case CLR: doClr(cpu, inst); break; case SET: doSet(cpu, inst); break; } break; case 0b001: cgc_memcpy(&fmt2Hdr, &inst, sizeof(fmt2Hdr)); switch(fmt2Hdr.subOp) { case JMP: case JAL: ; fmt2BranchInstruction fmt2Branch; cgc_memcpy(&fmt2Branch, &inst, 4); doBranch(cpu, fmt2Branch); didBranch = 1; break; case LDI: ; fmt2LdiInstruction fmt2Ldi; cgc_memcpy(&fmt2Ldi, &inst, 4); doLdi(cpu, fmt2Ldi); break; case LMBD: ; fmt2LmbdInstruction fmt2Lmbd; cgc_memcpy(&fmt2Lmbd, &inst, 4); doLmbd(cpu, fmt2Lmbd); break; case HALT: return; case SCAN: ; fmt2ScanInstruction fmt2Scan; cgc_memcpy(&fmt2Scan, &inst, 4); doScan(cpu, fmt2Scan); break; case SLP: case RESERVED_1: case RESERVED_2: case RESERVED_3: case RESERVED_4: case RESERVED_5: case RESERVED_6: case RESERVED_7: case RESERVED_8: case RESERVED_9: return; } break; case 0b11: ; fmtQatbInstruction qatbInstruction; cgc_memcpy(&qatbInstruction, &inst, 4); doQATB(cpu, qatbInstruction); default: return; } if(didBranch == 0) cpu->pc++; cpu->numExecuted++; if(cpu->numExecuted >= MAX_INSNS) return; } }
void EncodeJump( oc_handle *oc ) { doBranch( 0x30, oc->handle, AXP_ZERO_SINK ); }
static COLDFIRE_DISPATCH_FN(morphBCC) {doBranch(info->instruction, info->thisPC, False, info->instrSize, info->type, coldfire);}