void v60_device::v60WritePSW(UINT32 newval) { /* determine if we need to save / restore the stacks */ int updateStack = 0; /* if the interrupt state is changing, we definitely need to update */ if ((newval ^ PSW) & 0x10000000) updateStack = 1; /* if we are not in interrupt mode and the level is changing, we also must update */ else if (!(PSW & 0x10000000) && ((newval ^ PSW) & 0x03000000)) updateStack = 1; /* save the previous stack value */ if (updateStack) v60SaveStack(); /* set the new value and update the flags */ PSW = newval; _Z = (UINT8)(PSW & 1); _S = (UINT8)(PSW & 2); _OV = (UINT8)(PSW & 4); _CY = (UINT8)(PSW & 8); /* fetch the new stack value */ if (updateStack) v60ReloadStack(); }
static UINT32 opSTTASK(v60_state *cpustate) { int i; UINT32 adr; cpustate->modadd = cpustate->PC + 1; cpustate->moddim = 2; cpustate->amlength1 = ReadAM(cpustate); adr = cpustate->TR; v60WritePSW(cpustate, v60ReadPSW(cpustate) | 0x10000000); v60SaveStack(cpustate); cpustate->program->write_dword_unaligned(adr, cpustate->TKCW); adr += 4; if(cpustate->SYCW & 0x100) { cpustate->program->write_dword_unaligned(adr, cpustate->L0SP); adr += 4; } if(cpustate->SYCW & 0x200) { cpustate->program->write_dword_unaligned(adr, cpustate->L1SP); adr += 4; } if(cpustate->SYCW & 0x400) { cpustate->program->write_dword_unaligned(adr, cpustate->L2SP); adr += 4; } if(cpustate->SYCW & 0x800) { cpustate->program->write_dword_unaligned(adr, cpustate->L3SP); adr += 4; } // 31 registers supported, _not_ 32 for(i = 0; i < 31; i++) if(cpustate->amout & (1 << i)) { cpustate->program->write_dword_unaligned(adr, cpustate->reg[i]); adr += 4; } // #### Ignore the virtual addressing crap. return cpustate->amlength1 + 1; }
UINT32 opSTTASK(void) { int i; UINT32 adr; modAdd=PC + 1; modDim=2; amLength1 = ReadAM(); adr = TR; v60WritePSW(v60ReadPSW() | 0x10000000); v60SaveStack(); MemWrite32(adr, TKCW); adr += 4; if(SYCW & 0x100) { MemWrite32(adr, L0SP); adr += 4; } if(SYCW & 0x200) { MemWrite32(adr, L1SP); adr += 4; } if(SYCW & 0x400) { MemWrite32(adr, L2SP); adr += 4; } if(SYCW & 0x800) { MemWrite32(adr, L3SP); adr += 4; } /* 31 registers supported, _not_ 32 */ for(i=0; i<31; i++) if(amOut & (1<<i)) { MemWrite32(adr, v60.reg[i]); adr += 4; } /* #### Ignore the virtual addressing crap. */ return amLength1 + 1; }