void v60_device::v60_do_irq(int vector) { UINT32 oldPSW = v60_update_psw_for_exception(1, 0); // Push PC and PSW onto the stack SP-=4; m_program->write_dword_unaligned(SP, oldPSW); SP-=4; m_program->write_dword_unaligned(SP, PC); // Jump to vector for user interrupt PC = GETINTVECT(vector); }
static UINT32 opTRAP(v60_state *cpustate) { UINT32 oldPSW; cpustate->modadd = cpustate->PC + 1; cpustate->moddim = 0; // Read the operand cpustate->amlength1 = ReadAM(cpustate); // Normalize the flags NORMALIZEFLAGS(cpustate); switch ((cpustate->amout >> 4) & 0xF) { case 0: if (!cpustate->_OV) return cpustate->amlength1 + 1; else break; case 1: if (cpustate->_OV) return cpustate->amlength1 + 1; else break; case 2: if (!cpustate->_CY) return cpustate->amlength1 + 1; else break; case 3: if (cpustate->_CY) return cpustate->amlength1 + 1; else break; case 4: if (!cpustate->_Z) return cpustate->amlength1 + 1; else break; case 5: if (cpustate->_Z) return cpustate->amlength1 + 1; else break; case 6: if (!(cpustate->_CY | cpustate->_Z)) return cpustate->amlength1 + 1; else break; case 7: if ((cpustate->_CY | cpustate->_Z)) return cpustate->amlength1 + 1; else break; case 8: if (!cpustate->_S) return cpustate->amlength1 + 1; else break; case 9: if (cpustate->_S) return cpustate->amlength1 + 1; else break; case 10: break; case 11: return cpustate->amlength1 + 1; case 12: if (!(cpustate->_S^cpustate->_OV)) return cpustate->amlength1 + 1; else break; case 13: if ((cpustate->_S^cpustate->_OV)) return cpustate->amlength1 + 1; else break; case 14: if (!((cpustate->_S^cpustate->_OV)|cpustate->_Z)) return cpustate->amlength1 + 1; else break; case 15: if (((cpustate->_S^cpustate->_OV)|cpustate->_Z)) return cpustate->amlength1 + 1; else break; } oldPSW = v60_update_psw_for_exception(cpustate, 0, 0); // Issue the software trap with interrupts cpustate->SP -= 4; cpustate->program->write_dword_unaligned(cpustate->SP, EXCEPTION_CODE_AND_SIZE(0x3000 + 0x100 * (cpustate->amout & 0xF), 4)); cpustate->SP -= 4; cpustate->program->write_dword_unaligned(cpustate->SP, oldPSW); cpustate->SP -= 4; cpustate->program->write_dword_unaligned(cpustate->SP, cpustate->PC + cpustate->amlength1 + 1); cpustate->PC = GETINTVECT(cpustate, 48 + (cpustate->amout & 0xF)); return 0; }
UINT32 opTRAP(void) { UINT32 oldPSW; modAdd=PC + 1; modDim=0; /* Read the operand */ amLength1=ReadAM(); /* Normalize the flags */ NORMALIZEFLAGS(); switch ((amOut >> 4) & 0xF) { case 0: if (!_OV) return amLength1+1; else break; case 1: if (_OV) return amLength1+1; else break; case 2: if (!_CY) return amLength1+1; else break; case 3: if (_CY) return amLength1+1; else break; case 4: if (!_Z) return amLength1+1; else break; case 5: if (_Z) return amLength1+1; else break; case 6: if (!(_CY | _Z)) return amLength1+1; else break; case 7: if ((_CY | _Z)) return amLength1+1; else break; case 8: if (!_S) return amLength1+1; else break; case 9: if (_S) return amLength1+1; else break; case 10: break; case 11: return amLength1+1; case 12: if (!(_S^_OV)) return amLength1+1; else break; case 13: if ((_S^_OV)) return amLength1+1; else break; case 14: if (!((_S^_OV)|_Z)) return amLength1+1; else break; case 15: if (((_S^_OV)|_Z)) return amLength1+1; else break; } oldPSW = v60_update_psw_for_exception(0, 0); /* Issue the software trap with interrupts */ SP -= 4; MemWrite32(SP, EXCEPTION_CODE_AND_SIZE(0x3000 + 0x100 * (amOut&0xF), 4)); SP -= 4; MemWrite32(SP, oldPSW); SP -= 4; MemWrite32(SP, PC + amLength1 + 1); PC = GETINTVECT(48 + (amOut&0xF)); ChangePC(PC); return 0; }