Previous 199869 Revisions Next

r20257 Monday 14th January, 2013 at 03:30:33 UTC by Andrew Gardner
DSP16 : Additional opcodes.  [Andrew Gardner]
[src/emu/cpu/dsp16]dsp16ops.c

trunk/src/emu/cpu/dsp16/dsp16ops.c
r20256r20257
4949{
5050   switch (CON)
5151   {
52      case 0x00: return (m_psw & 0x8000);
53      case 0x01: printf("UNIMPLEMENTED condition check @ PC 0x%04x\n", m_pc); return false;
54      case 0x02: printf("UNIMPLEMENTED condition check @ PC 0x%04x\n", m_pc); return false;
55      case 0x03: printf("UNIMPLEMENTED condition check @ PC 0x%04x\n", m_pc); return false;
56      case 0x04: printf("UNIMPLEMENTED condition check @ PC 0x%04x\n", m_pc); return false;
57      case 0x05: printf("UNIMPLEMENTED condition check @ PC 0x%04x\n", m_pc); return false;
58      case 0x06: printf("UNIMPLEMENTED condition check @ PC 0x%04x\n", m_pc); return false;
59      case 0x07: printf("UNIMPLEMENTED condition check @ PC 0x%04x\n", m_pc); return false;
60      case 0x08: printf("UNIMPLEMENTED condition check @ PC 0x%04x\n", m_pc); return false;
61      case 0x09: printf("UNIMPLEMENTED condition check @ PC 0x%04x\n", m_pc); return false;
62      case 0x0a: printf("UNIMPLEMENTED condition check @ PC 0x%04x\n", m_pc); return false;
63      case 0x0b: printf("UNIMPLEMENTED condition check @ PC 0x%04x\n", m_pc); return false;
64      case 0x0c: printf("UNIMPLEMENTED condition check @ PC 0x%04x\n", m_pc); return false;
65      case 0x0d: printf("UNIMPLEMENTED condition check @ PC 0x%04x\n", m_pc); return false;
66      case 0x0e: printf("UNIMPLEMENTED condition check @ PC 0x%04x\n", m_pc); return false;
67      case 0x0f: printf("UNIMPLEMENTED condition check @ PC 0x%04x\n", m_pc); return false;
68      case 0x10: printf("UNIMPLEMENTED condition check @ PC 0x%04x\n", m_pc); return false;
69      case 0x11: printf("UNIMPLEMENTED condition check @ PC 0x%04x\n", m_pc); return false;
52      case 0x00: return (m_psw & 0x8000);      // mi (negative result)
53      case 0x01: printf("UNIMPLEMENTED condition check @ PC 0x%04x\n", m_pc); return false;   // pl (positive result)
54      case 0x02: printf("UNIMPLEMENTED condition check @ PC 0x%04x\n", m_pc); return false;   // eq (result == 0)
55      case 0x03: printf("UNIMPLEMENTED condition check @ PC 0x%04x\n", m_pc); return false;   // ne (result != 0)
56      case 0x04: printf("UNIMPLEMENTED condition check @ PC 0x%04x\n", m_pc); return false;   // lvs (logical overflow set)
57      case 0x05: printf("UNIMPLEMENTED condition check @ PC 0x%04x\n", m_pc); return false;   // lvc (logical overflow clear)
58      case 0x06: printf("UNIMPLEMENTED condition check @ PC 0x%04x\n", m_pc); return false;   // mvs (math. overflow set)
59      case 0x07: printf("UNIMPLEMENTED condition check @ PC 0x%04x\n", m_pc); return false;   // mvc (math. overflow clear)
60      case 0x08: printf("UNIMPLEMENTED condition check @ PC 0x%04x\n", m_pc); return false;   // heads (random bit set)
61      case 0x09: printf("UNIMPLEMENTED condition check @ PC 0x%04x\n", m_pc); return false;   // tails (random bit clear)
62      case 0x0a: printf("UNIMPLEMENTED condition check @ PC 0x%04x\n", m_pc); return false;   // c0ge (counter0 >= 0)
63      case 0x0b: printf("UNIMPLEMENTED condition check @ PC 0x%04x\n", m_pc); return false;   // c0lt (counter0 < 0)
64      case 0x0c: printf("UNIMPLEMENTED condition check @ PC 0x%04x\n", m_pc); return false;   // c1ge (counter1 >= 0)
65      case 0x0d: printf("UNIMPLEMENTED condition check @ PC 0x%04x\n", m_pc); return false;   // c1lt (counter1 < 0)
66      case 0x0e: printf("UNIMPLEMENTED condition check @ PC 0x%04x\n", m_pc); return false;   // true (always)
67      case 0x0f: printf("UNIMPLEMENTED condition check @ PC 0x%04x\n", m_pc); return false;   // false (never)
68      case 0x10: printf("UNIMPLEMENTED condition check @ PC 0x%04x\n", m_pc); return false;   // gt (result > 0
69      case 0x11: printf("UNIMPLEMENTED condition check @ PC 0x%04x\n", m_pc); return false;   // le (result <= 0)
7070      default: logerror("Unrecognized condition at PC=0x%04x\n", m_pc); break;
7171   }
7272   return false;
r20256r20257
303303      }
304304      case 0x19: case 0x1b:
305305      {
306         // NEXT!
307306         // F1, y = a0|1, x = *pt++[i]  :  (page 3-48)
308         //const UINT8 Y = (op & 0x000f);
309         //const UINT8 X = (op & 0x0010) >> 4;
310         //const UINT8 S = (op & 0x0200) >> 9;
311         //const UINT8 D = (op & 0x0400) >> 10;
312         //const UINT8 F1 = (op & 0x01e0) >> 5;
307         const UINT8 Y = (op & 0x000f);
308         const UINT8 X = (op & 0x0010) >> 4;
309         const UINT8 S = (op & 0x0200) >> 9;
310         const UINT8 D = (op & 0x0400) >> 10;
311         const UINT8 F1 = (op & 0x01e0) >> 5;
312         bool useA1 = (opcode == 0x1b);
313         if (Y != 0x00) printf("Unknown opcode @ PC=0x%04x", m_pc);
314         m_y = (useA1) ? (m_a1 & 0xffffffff) : (m_a0 & 0xffffffff);      // TODO: What happens to Ax when it goes 32 bit (pc=3f & pc=47)?
315         executeF1Field(F1, D, S);
316         m_x = data_read(m_pt);                                 // TODO: EXM Pin & internal/external ROM?  Research.
317         switch (X)
318         {
319            case 0x00: m_pt++;      break;
320            case 0x01: m_pt += m_i; break;
321         }
322         cycles = 2;      // TODO: 1 if cached
323         pcAdvance = 1;
313324         break;
314325      }
315326      case 0x14:
r20256r20257
457468      // Format 6: Contitional Branch Qualifier/Software Interrupt (icall)
458469      case 0x1a:
459470      {
460         // if CON [goto/call/return]
461         //const UINT8 CON = (op & 0x001f);
471         // if CON [goto/call/return]  :  (page 3-22)
472         const UINT8 CON = (op & 0x001f);
473         bool conditionFulfilled = conditionTest(CON);
474         cycles = 3;               // TODO: This may need to interact with the next opcode to make sure it doesn't exceed 3?
475         switch (conditionFulfilled)
476         {
477            case true:  pcAdvance = 1; break;
478            case false: pcAdvance = 2; break;
479         }
462480         break;
463481      }
464482
465483      // Format 7: Data Move Group
466484      case 0x09: case 0x0b:
467485      {
468         // R = aS
469         //const UINT8 R = (op & 0x03f0) >> 4;
470         //const UINT8 S = (op & 0x1000) >> 12;
486         // TODO: Fix register pdxX (pc=338)
487         // R = aS  :  (page 3-29)
488         const UINT8 R = (op & 0x03f0) >> 4;
489         const UINT8 S = (op & 0x1000) >> 12;
490         void* destinationReg = registerFromRTable(R);
491         UINT64* sourceReg = (S) ? &m_a1 : &m_a0;
492         UINT16 sourceValue = (*sourceReg & U64(0x0ffff0000)) >> 16;
493         writeRegister(destinationReg, sourceValue);
494         cycles = 2;
495         pcAdvance = 1;
471496         break;
472497      }
473498      case 0x08:

Previous 199869 Revisions Next


© 1997-2024 The MAME Team