Previous 199869 Revisions Next

r20137 Wednesday 9th January, 2013 at 01:13:35 UTC by Andrew Gardner
dsp16: Two more opcodes.  Now for the fixed-point math enjoyment. (nw)
[src/emu/cpu/dsp16]dsp16ops.c

trunk/src/emu/cpu/dsp16/dsp16ops.c
r20136r20137
44// The YL register is the lower half of the 32 bit Y register
55void* dsp16_device::addressYL()
66{
7   return (((UINT8*)&m_y) + 2);
7   return (void*)(((UINT8*)&m_y) + 2);
88}
99
1010
r20136r20137
127127   {
128128      case 0x00: printf("UNIMPLEMENTED F1 operation @ PC 0x%04x\n", m_pc); break;
129129      case 0x01: printf("UNIMPLEMENTED F1 operation @ PC 0x%04x\n", m_pc); break;
130      case 0x02: m_p = (INT32)((INT16)m_x * (INT16)m_y); break;
130      case 0x02: m_p = (INT32)((INT16)m_x * (INT16)((m_y & 0xffff0000) >> 16)); break;
131131      case 0x03: printf("UNIMPLEMENTED F1 operation @ PC 0x%04x\n", m_pc); break;
132132      case 0x04: printf("UNIMPLEMENTED F1 operation @ PC 0x%04x\n", m_pc); break;
133133      case 0x05: printf("UNIMPLEMENTED F1 operation @ PC 0x%04x\n", m_pc); break;
r20136r20137
227227      }
228228      case 0x17:
229229      {
230         // F1, y[l] = Y
231         //const UINT8 Y = (op & 0x000f);
232         //const UINT8 X = (op & 0x0010) >> 4;
233         //const UINT8 S = (op & 0x0200) >> 9;
234         //const UINT8 D = (op & 0x0400) >> 10;
235         //const UINT8 F1 = (op & 0x01e0) >> 5;
230         // F1, y[l] = Y  :  (page 3-44)
231         const UINT8 Y = (op & 0x000f);
232         const UINT8 X = (op & 0x0010) >> 4;
233         const UINT8 S = (op & 0x0200) >> 9;
234         const UINT8 D = (op & 0x0400) >> 10;
235         const UINT8 F1 = (op & 0x01e0) >> 5;
236         executeF1Field(F1, D, S);
237         UINT16* sourceReg = (UINT16*)registerFromYFieldUpper(Y);
238         UINT16 sourceValue = data_read(*sourceReg);
239         switch (X)
240         {
241            case 0x00: writeRegister(addressYL(), sourceValue); break;
242            case 0x01: writeRegister(&m_y, sourceValue); break;
243            default: break;
244         }
245         executeYFieldPost(Y);
246         cycles = 1;
247         pcAdvance = 1;
236248         break;
237249      }
238250      case 0x1f:
r20136r20137
279291         break;
280292      }
281293
282      // Format 1a: Multiply/ALU Read/Write Group (major typo in docs on p3-51)
294      // Format 1a: Multiply/ALU Read/Write Group (TODO: Figure out major typo in docs on p3-51)
283295      case 0x07:
284296      {
285         // F1, At[1] = Y
286         //const UINT8 Y = (op & 0x000f);
287         //const UINT8 S = (op & 0x0200) >> 9;
288         //const UINT8 aT = (op & 0x0400) >> 10;
289         //const UINT8 F1 = (op & 0x01e0) >> 5;
297         // F1, At[1] = Y  :  (page 3-50)
298         const UINT8 Y = (op & 0x000f);
299         const UINT8 S = (op & 0x0200) >> 9;
300         const UINT8 aT = (op & 0x0400) >> 10;
301         const UINT8 F1 = (op & 0x01e0) >> 5;
302         executeF1Field(F1, !aT, S);
303         UINT64* destinationReg = NULL;
304         switch(aT)
305         {
306            case 0: destinationReg = &m_a1; break;
307            case 1: destinationReg = &m_a0; break;
308            default: break;
309         }
310         UINT16 sourceAddress = *((UINT16*)registerFromYFieldUpper(Y));
311         INT64 sourceValueSigned = (INT16)data_read(sourceAddress);
312         *destinationReg = sourceValueSigned & U64(0xffffffffff);
313         executeYFieldPost(Y);
314         cycles = 1;
315         pcAdvance = 1;
290316         break;
291317      }
292318

Previous 199869 Revisions Next


© 1997-2024 The MAME Team