trunk/src/emu/cpu/rsp/rspdrc.c
r241715 | r241716 | |
4686 | 4686 | INT32 s2 = (UINT32)(UINT16)w2; |
4687 | 4687 | INT32 r = s1 + s2; |
4688 | 4688 | |
4689 | | vres[i] = (INT16)r; |
| 4689 | vres[i] = (INT16)(r); |
4690 | 4690 | SET_ACCUM_L((INT16)r, i); |
4691 | 4691 | |
4692 | 4692 | if (r & 0xffff0000) |
r241715 | r241716 | |
4754 | 4754 | { |
4755 | 4755 | int op = m_rsp_state->arg0; |
4756 | 4756 | |
4757 | | |
4758 | 4757 | CLEAR_ZERO_FLAGS(); |
4759 | 4758 | CLEAR_CARRY_FLAGS(); |
4760 | 4759 | |
r241715 | r241716 | |
4789 | 4788 | } |
4790 | 4789 | #endif |
4791 | 4790 | |
| 4791 | // VADDB |
| 4792 | // |
| 4793 | // 31 25 24 20 15 10 5 0 |
| 4794 | // ------------------------------------------------------ |
| 4795 | // | 010010 | 1 | EEEE | SSSSS | TTTTT | DDDDD | 010110 | |
| 4796 | // ------------------------------------------------------ |
| 4797 | // |
| 4798 | // Adds two vector registers bytewise with rounding |
| 4799 | inline void rsp_device::ccfunc_rsp_vaddb_scalar() |
| 4800 | { |
| 4801 | const int op = m_rsp_state->arg0; |
| 4802 | const int round = (EL == 0) ? 0 : (1 << (EL - 1)); |
| 4803 | |
| 4804 | INT16 vres[8]; |
| 4805 | for (int i = 0; i < 8; i++) |
| 4806 | { |
| 4807 | UINT16 w1, w2; |
| 4808 | SCALAR_GET_VS1(w1, i); |
| 4809 | SCALAR_GET_VS2(w2, i); |
| 4810 | |
| 4811 | UINT8 hb1 = w1 >> 8; |
| 4812 | UINT8 lb1 = w1 & 0xff; |
| 4813 | UINT8 hb2 = w2 >> 8; |
| 4814 | UINT8 lb2 = w2 & 0xff; |
| 4815 | |
| 4816 | UINT16 hs = hb1 + hb2 + round; |
| 4817 | UINT16 ls = lb1 + lb2 + round; |
| 4818 | |
| 4819 | SET_ACCUM_L((hs << 8) | ls, i); |
| 4820 | |
| 4821 | hs >>= EL; |
| 4822 | if (hs > 255) |
| 4823 | { |
| 4824 | hs = 255; |
| 4825 | } |
| 4826 | else if (hs < 0) |
| 4827 | { |
| 4828 | hs = 0; |
| 4829 | } |
| 4830 | |
| 4831 | ls >>= EL; |
| 4832 | if (ls > 255) |
| 4833 | { |
| 4834 | ls = 255; |
| 4835 | } |
| 4836 | else if (ls < 0) |
| 4837 | { |
| 4838 | ls = 0; |
| 4839 | } |
| 4840 | |
| 4841 | vres[i] = 0; // VD writeback disabled on production hardware |
| 4842 | // vres[i] = (hs << 8) | ls; |
| 4843 | } |
| 4844 | WRITEBACK_RESULT(); |
| 4845 | } |
| 4846 | |
| 4847 | static void cfunc_rsp_vaddb_scalar(void *param) |
| 4848 | { |
| 4849 | ((rsp_device *)param)->ccfunc_rsp_vaddb_scalar(); |
| 4850 | } |
| 4851 | |
4792 | 4852 | #if USE_SIMD |
4793 | 4853 | // VSAW |
4794 | 4854 | // |
r241715 | r241716 | |
7720 | 7780 | #endif |
7721 | 7781 | return TRUE; |
7722 | 7782 | |
| 7783 | case 0x16: /* VADDB */ |
| 7784 | UML_MOV(block, mem(&m_rsp_state->arg0), desc->opptr.l[0]); // mov [arg0],desc->opptr.l |
| 7785 | UML_CALLC(block, cfunc_rsp_vaddb_scalar, this); |
| 7786 | return TRUE; |
| 7787 | |
| 7788 | case 0x17: /* VSUBB (reserved, functionally identical to VADDB) */ |
| 7789 | UML_MOV(block, mem(&m_rsp_state->arg0), desc->opptr.l[0]); // mov [arg0],desc->opptr.l |
| 7790 | UML_CALLC(block, cfunc_rsp_vaddb_scalar, this); |
| 7791 | return TRUE; |
| 7792 | |
| 7793 | case 0x18: /* VACCB (reserved, functionally identical to VADDB) */ |
| 7794 | UML_MOV(block, mem(&m_rsp_state->arg0), desc->opptr.l[0]); // mov [arg0],desc->opptr.l |
| 7795 | UML_CALLC(block, cfunc_rsp_vaddb_scalar, this); |
| 7796 | return TRUE; |
| 7797 | |
| 7798 | case 0x19: /* VSUCB (reserved, functionally identical to VADDB) */ |
| 7799 | UML_MOV(block, mem(&m_rsp_state->arg0), desc->opptr.l[0]); // mov [arg0],desc->opptr.l |
| 7800 | UML_CALLC(block, cfunc_rsp_vaddb_scalar, this); |
| 7801 | return TRUE; |
| 7802 | |
7723 | 7803 | case 0x1d: /* VSAW */ |
7724 | 7804 | UML_MOV(block, mem(&m_rsp_state->arg0), desc->opptr.l[0]); // mov [arg0],desc->opptr.l |
7725 | 7805 | UML_CALLC(block, cfunc_rsp_vsaw_simd, this); |
r241715 | r241716 | |
8065 | 8145 | UML_CALLC(block, cfunc_rsp_vsubc_scalar, this); |
8066 | 8146 | return TRUE; |
8067 | 8147 | |
| 8148 | case 0x16: /* VADDB */ |
| 8149 | UML_MOV(block, mem(&m_rsp_state->arg0), desc->opptr.l[0]); // mov [arg0],desc->opptr.l |
| 8150 | UML_CALLC(block, cfunc_rsp_vaddb_scalar, this); |
| 8151 | return TRUE; |
| 8152 | |
| 8153 | case 0x17: /* VSUBB (reserved, functionally identical to VADDB) */ |
| 8154 | UML_MOV(block, mem(&m_rsp_state->arg0), desc->opptr.l[0]); // mov [arg0],desc->opptr.l |
| 8155 | UML_CALLC(block, cfunc_rsp_vaddb_scalar, this); |
| 8156 | return TRUE; |
| 8157 | |
| 8158 | case 0x18: /* VACCB (reserved, functionally identical to VADDB) */ |
| 8159 | UML_MOV(block, mem(&m_rsp_state->arg0), desc->opptr.l[0]); // mov [arg0],desc->opptr.l |
| 8160 | UML_CALLC(block, cfunc_rsp_vaddb_scalar, this); |
| 8161 | return TRUE; |
| 8162 | |
| 8163 | case 0x19: /* VSUCB (reserved, functionally identical to VADDB) */ |
| 8164 | UML_MOV(block, mem(&m_rsp_state->arg0), desc->opptr.l[0]); // mov [arg0],desc->opptr.l |
| 8165 | UML_CALLC(block, cfunc_rsp_vaddb_scalar, this); |
| 8166 | return TRUE; |
| 8167 | |
8068 | 8168 | case 0x1d: /* VSAW */ |
8069 | 8169 | UML_MOV(block, mem(&m_rsp_state->arg0), desc->opptr.l[0]); // mov [arg0],desc->opptr.l |
8070 | 8170 | UML_CALLC(block, cfunc_rsp_vsaw_scalar, this); |