Previous 199869 Revisions Next

r33845 Friday 12th December, 2014 at 16:33:04 UTC by David Haywood
arcompact decoding (nw)
[src/emu/cpu/arcompact]arcompactdasm_ops.c

trunk/src/emu/cpu/arcompact/arcompactdasm_ops.c
r242356r242357
139139
140140   UINT8 condition = op & 0x0000001f;
141141
142   print("B(%s) %08x (%08x)", conditions[condition], pc + (address * 2) + 2, op & ~0xffffffdf);
142   print("B(%s) %08x (%08x)", conditions[condition], pc + (address * 2), op & ~0xffffffdf);
143143   return size;
144144}
145145
r242356r242357
153153   address |= ((op & 0x0000000f) >> 0) << 20;
154154   if (address & 0x800000) address = -(address & 0x7fffff);
155155
156   print("B %08x (%08x)", pc + (address * 2) + 2, op & ~0xffffffcf);
156   print("B %08x (%08x)", pc + (address * 2), op & ~0xffffffcf);
157157   return size;
158158}
159159
r242356r242357
169169
170170   UINT8 condition = op & 0x0000001f;
171171
172   print("BL(%s) %08x (%08x)", conditions[condition], pc + (address *2) + 2, op & ~0xffffffdf );
172   print("BL(%s) %08x (%08x)", conditions[condition], pc + (address *2), op & ~0xffffffdf );
173173   return size;
174174}
175175
r242356r242357
183183   address |=        ((op & 0x0000000f) >> 0) << 20;
184184   if (address & 0x800000) address = -(address&0x7fffff);   
185185
186   print("BL %08x (%08x)",  pc + (address *2) + 2, op & ~0xffffffcf );
186   print("BL %08x (%08x)",  pc + (address *2), op & ~0xffffffcf );
187187   return size;
188188}
189189
r242356r242357
208208int arcompact_handle01_01_01_0e_dasm(DASM_OPS_32)  { GET_01_01_01_BRANCH_ADDR;  print("BBIT0 (b & 1<<u6) == 0 (dst %08x) (%08x)", pc + (address * 2) + 4, op); return 4; }
209209int arcompact_handle01_01_01_0f_dasm(DASM_OPS_32)  { GET_01_01_01_BRANCH_ADDR;  print("BBIT1 (b & 1<<u6) != 0 (dst %08x) (%08x)", pc + (address * 2) + 4, op); return 4; }
210210
211#if 0
211
212212//#define EXPLICIT_EXTENSIONS
213213
214214static const char *datasize[0x4] =
r242356r242357
216216#ifdef EXPLICIT_EXTENSIONS
217217   /* 00 */ ".L", // Dword (default) (can use no extension, using .L to be explicit)
218218#else
219   /* 00 */ " ",// Dword (default)
219   /* 00 */ "",// Dword (default)
220220#endif
221221   /* 01 */ ".B", // Byte
222222   /* 02 */ ".W", // Word
r242356r242357
228228#ifdef EXPLICIT_EXTENSIONS
229229   /* 00 */ ".ZX", // Zero Extend (can use no extension, using .ZX to be explicit)
230230else
231   /* 00 */ " ", // Zero Extend
231   /* 00 */ "", // Zero Extend
232232#endif
233233   /* 01 */ ".X" // Sign Extend
234234};
r242356r242357
238238#ifdef EXPLICIT_EXTENSIONS
239239   /* 00 */ ".AN", // No Writeback (can use no extension, using .AN to be explicit)
240240#else
241   /* 00 */ " ", // No Writeback
241   /* 00 */ "", // No Writeback
242242#endif
243243   /* 01 */ ".AW", // Writeback pre memory access
244244   /* 02 */ ".AB", // Writeback post memory access
r242356r242357
250250#ifdef EXPLICIT_EXTENSIONS
251251   /* 00 */ ".EN", // Data Cache Enabled (can use no extension, using .EN to be explicit)
252252#else
253   /* 00 */ " ", // Data Cache Enabled
253   /* 00 */ "", // Data Cache Enabled
254254#endif
255255   /* 01 */ ".DI" // Direct to Memory (Cache Bypass)
256256};
257257
258static const char *flagbit[0x2] =
259{
260#ifdef EXPLICIT_EXTENSIONS
261   /* 00 */ ".NF", // Don't Set Flags (can use no extension, using .NF to be explicit)
262#else
263   /* 00 */ "", // Don't Set Flags
264#endif
265   /* 01 */ ".F" // Set Flags
266};
267
258268static const char *regnames[0x40] =
259269{
260270   /* 00 */ "r0",
r242356r242357
325335   /* 3e */ "r62(LIMM)", // use Long Immediate Data instead of register
326336   /* 3f */ "r63(PCL)"
327337};
328#endif
329338
339
330340int arcompact_handle02_dasm(DASM_OPS_32)
331341{
332342   // bitpos
r242356r242357
335345   // fields
336346   // 0001 0bbb ssss ssss SBBB DaaZ ZXAA AAAA
337347
338#if 0
339   int A = (op & 0x0000003f >> 0);  //op &= ~0x0000003f;
340   int X = (op & 0x00000040 >> 6);  //op &= ~0x00000040;
341   int Z = (op & 0x00000180 >> 7);  //op &= ~0x00000180;
342   int a = (op & 0x00000600 >> 9);  //op &= ~0x00000600;
343   int D = (op & 0x00000800 >> 11);// op &= ~0x00000800;
344   int B = (op & 0x00007000 >> 12);// op &= ~0x00007000;
345   int S = (op & 0x00008000 >> 15);// op &= ~0x00008000;
346   int s = (op & 0x00ff0000 >> 16);// op &= ~0x00ff0000;
347   int b = (op & 0x07000000 >> 24);// op &= ~0x07000000;
348348
349   int A = (op & 0x0000003f) >> 0;  //op &= ~0x0000003f;
350   int X = (op & 0x00000040) >> 6;  //op &= ~0x00000040;
351   int Z = (op & 0x00000180) >> 7;  //op &= ~0x00000180;
352   int a = (op & 0x00000600) >> 9;  //op &= ~0x00000600;
353   int D = (op & 0x00000800) >> 11;// op &= ~0x00000800;
354   int B = (op & 0x00007000) >> 12;// op &= ~0x00007000;
355   int S = (op & 0x00008000) >> 15;// op &= ~0x00008000;
356   int s = (op & 0x00ff0000) >> 16;// op &= ~0x00ff0000;
357   int b = (op & 0x07000000) >> 24;// op &= ~0x07000000;
358
349359   int breg = b | (B << 3);
350360   int sdat = s | (S << 8); // todo - signed
351#endif
352361
353
354362   output  += sprintf( output, "LD");
355//   output  += sprintf( output, "%s", datasize[Z]);
356//   output  += sprintf( output, "%s", dataextend[X]);
357//   output  += sprintf( output, "%s", addressmode[a]);
358//   output  += sprintf( output, "%s", cachebit[D]);
359//   output  += sprintf( output, " ");
360//   output  += sprintf( output, "%s, ", regnames[A]);
361//   output  += sprintf( output, "[");
362//   output  += sprintf( output, "%s(%d %d), ", regnames[breg], B, b);
363//   output  += sprintf( output, "%d", sdat);
364//   output  += sprintf( output, "]");
363   output  += sprintf( output, "%s", datasize[Z]);
364   output  += sprintf( output, "%s", dataextend[X]);
365   output  += sprintf( output, "%s", addressmode[a]);
366   output  += sprintf( output, "%s", cachebit[D]);
367   output  += sprintf( output, " ");
368   output  += sprintf( output, "%s, ", regnames[A]);
369   output  += sprintf( output, "[");
370   output  += sprintf( output, "%s, ", regnames[breg]);
371   output  += sprintf( output, "%d", sdat);
372   output  += sprintf( output, "]");
365373
366374   return 4;
367375}
r242356r242357
388396int arcompact_handle04_07_dasm(DASM_OPS_32)  { print("XOR (%08x)", op); return 4;}
389397int arcompact_handle04_08_dasm(DASM_OPS_32)  { print("MAX (%08x)", op); return 4;}
390398int arcompact_handle04_09_dasm(DASM_OPS_32)  { print("MIN (%08x)", op); return 4;}
391int arcompact_handle04_0a_dasm(DASM_OPS_32)  { print("MOV (%08x)", op); return 4;}
399
400int arcompact_handle04_0a_dasm(DASM_OPS_32)
401{
402   //           PP
403   // 0010 0bbb 00ii iiii FBBB CCCC CCAA AAAA
404   int size = 4;
405
406   int p = (op & 0x00c00000) >> 22; op &= ~0x00c00000;
407   int b = (op & 0x07000000) >> 24; op &= ~0x07000000;
408   int B = (op & 0x00007000) >> 12; op &= ~0x00007000;
409   int breg = b | (B << 3);
410   int F = (op & 0x00008000) >> 15;op &= ~0x00008000;
411
412   output  += sprintf( output, "MOV");
413   output  += sprintf( output, "%s", flagbit[F]);
414   output  += sprintf( output, " p(%d)", p);
415   output  += sprintf( output, " %s, ", regnames[breg]);
416
417   if (p == 0)
418   {
419      // 0010 0bbb 00ii iiii FBBB CCCC CCAA AAAA
420
421      int C = (op & 0x00000fc0) >> 6; op &= ~0x00000fc0;
422      int A = (op & 0x0000003f) >> 0; op &= ~0x0000003f;
423
424      if (C == LIMM_REG)
425      {
426         UINT32 limm;
427         GET_LIMM_32;
428         size = 8;   
429         output  += sprintf( output, "(%08x) A(%s)", limm, regnames[A]);
430      }
431      else
432      {
433         output  += sprintf( output, "C(%s) A(%s)", regnames[C], regnames[A]);
434      }
435   }
436   else if (p == 1)
437   {
438      // 0010 0bbb 00ii iiii FBBB UUUU UUAA AAAA
439      int U = (op & 0x00000fc0) >> 6; op &= ~0x00000fc0;
440      int A = (op & 0x0000003f) >> 0; op &= ~0x0000003f;
441
442      output  += sprintf( output, "U(%02x) A(%s)", U, regnames[A]);
443
444   }
445   else if (p == 2)
446   {
447      int S = (op & 0x00000fff) >> 0; op &= ~0x00000fff;
448      output  += sprintf( output, "S(%02x)", S);
449
450   }
451   else if (p == 3)
452   {
453      int M = (op & 0x00000020) >> 5; op &= ~0x00000020;
454      int Q = (op & 0x0000001f) >> 0; op &= ~0x0000001f;
455   
456      output  += sprintf( output, " M(%d)", M);
457      output  += sprintf( output, " Cond<%s> ", conditions[Q]);
458
459      if (M == 0)
460      {
461         int C = (op & 0x00000fc0) >> 6; op &= ~0x00000fc0;
462         output  += sprintf( output, "C(%s)", regnames[C]);
463
464      }
465      else if (M == 1)
466      {
467         int U = (op & 0x00000fc0) >> 6; op &= ~0x00000fc0;
468         output  += sprintf( output, "U(%02x)", U);
469
470      }
471
472   }
473
474   return size;
475}
476
477
392478int arcompact_handle04_0b_dasm(DASM_OPS_32)  { print("TST (%08x)", op); return 4;}
393479int arcompact_handle04_0c_dasm(DASM_OPS_32)  { print("CMP (%08x)", op); return 4;}
394480int arcompact_handle04_0d_dasm(DASM_OPS_32)  { print("RCMP (%08x)", op); return 4;}


Previous 199869 Revisions Next


© 1997-2024 The MAME Team