Previous 199869 Revisions Next

r33914 Monday 15th December, 2014 at 21:54:19 UTC by David Haywood
more dasm improvements (nw)
[src/emu/cpu/arcompact]arcompactdasm_ops.c

trunk/src/emu/cpu/arcompact/arcompactdasm_ops.c
r242425r242426
215215   creg =  ((op & 0x00e0) >>5); \
216216   op &= ~0x00e0; \
217217
218#define COMMON16_GET_areg \
219   areg =  ((op & 0x0007) >>0); \
220   op &= ~0x0007; \
221
222#define COMMON16_GET_u3 \
223   u =  ((op & 0x0007) >>0); \
224   op &= ~0x0007; \
225
218226#define COMMON16_GET_u5 \
219227   u =  ((op & 0x001f) >>0); \
220228   op &= ~0x001f; \
r242425r242426
335343
336344   if ((b != LIMM_REG) && (c != LIMM_REG))
337345   {
338      print("%s%s %s %s %08x (%08x)", optext, delaybit[n], regnames[b], regnames[c], pc + (address * 2) + 4, op & ~0xf8fe800f);
346      print("%s%s %s, %s %08x (%08x)", optext, delaybit[n], regnames[b], regnames[c], pc + (address * 2) + 4, op & ~0xf8fe800f);
339347   }
340348   else
341349   {
r242425r242426
349357      }
350358      else if ((c == LIMM_REG) && (b != LIMM_REG))
351359      {
352         print("%s%s %s (%08x) %08x (%08x)", optext, delaybit[n], regnames[b], limm, pc + (address * 2) + 4, op & ~0xf8fe800f);
360         print("%s%s %s, (%08x) %08x (%08x)", optext, delaybit[n], regnames[b], limm, pc + (address * 2) + 4, op & ~0xf8fe800f);
353361      }
354362      else
355363      {
356364         // b and c are LIMM? invalid??
357         print("%s%s (%08x) (%08x) (illegal?) %08x (%08x)", optext, delaybit[n], limm, limm, pc + (address * 2) + 4, op & ~0xf8fe800f);
365         print("%s%s (%08x), (%08x) (illegal?) %08x (%08x)", optext, delaybit[n], limm, limm, pc + (address * 2) + 4, op & ~0xf8fe800f);
358366
359367      }
360368   }
r242425r242426
391399
392400   op &= ~0x07007fe0;
393401
394   print("%s%s %s %02x %08x (%08x)", optext, delaybit[n], regnames[b], u, pc + (address * 2) + 4, op & ~0xf8fe800f);
402   print("%s%s %s, 0x%02x %08x (%08x)", optext, delaybit[n], regnames[b], u, pc + (address * 2) + 4, op & ~0xf8fe800f);
395403   
396404   return size;
397405}
r242425r242426
442450   output  += sprintf( output, "%s", addressmode[a]);
443451   output  += sprintf( output, "%s", cachebit[D]);
444452   output  += sprintf( output, " ");
445   output  += sprintf( output, "%s, ", regnames[A]);
453   output  += sprintf( output, "%s <- ", regnames[A]);
446454   output  += sprintf( output, "[");
447455   if (breg == LIMM_REG) output  += sprintf( output, "(%08x), ", limm);
448456   else output  += sprintf( output, "%s, ", regnames[breg]);
449   output  += sprintf( output, "%d", sdat);
457   output  += sprintf( output, "%03x", sdat);
450458   output  += sprintf( output, "]");
451459
452460   return size;
r242425r242426
488496   output  += sprintf( output, "%s", cachebit[D]);
489497   output  += sprintf( output, " ");
490498
491   output  += sprintf( output, "%s, ", regnames[C]);
499   output  += sprintf( output, "[");
492500   if (breg == LIMM_REG) output  += sprintf( output, "(%08x), ", limm);
493501   else output  += sprintf( output, "%s, ", regnames[breg]);
494   output  += sprintf( output, "%d", sdat);
502   output  += sprintf( output, "%03x", sdat);
503   output  += sprintf( output, "] <- ");
495504
505   output  += sprintf( output, "%s", regnames[C]);
506
496507   if (R) output  += sprintf( output, "(reserved bit set)");
497508
498509
r242425r242426
978989
979990
980991
992int arcompact_handle0c_helper_dasm(char *output, offs_t pc, UINT16 op, const UINT8* oprom, const char* optext)
993{
994   int areg, breg, creg;
981995
996   COMMON16_GET_areg;
997   COMMON16_GET_breg;
998   COMMON16_GET_creg;
982999
1000   REG_16BIT_RANGE(areg);
1001   REG_16BIT_RANGE(breg);
1002   REG_16BIT_RANGE(creg);
9831003
1004
1005   print("%s %s <- [%s, %s]", optext, regnames[areg], regnames[breg], regnames[creg]);
1006   return 2;
1007}
1008
1009
9841010int arcompact_handle0c_00_dasm(DASM_OPS_16)
9851011{
986   int size = 2;
987   print("LD_S a <- m[b + c].long (%04x)", op);
988   return size;
1012   return arcompact_handle0c_helper_dasm(output, pc, op, oprom, "LD_S");
9891013}
9901014
9911015int arcompact_handle0c_01_dasm(DASM_OPS_16)
9921016{
993   int size = 2;
994   print("LDB_S a <- m[b + c].byte (%04x)", op);
995   return size;
1017   return arcompact_handle0c_helper_dasm(output, pc, op, oprom, "LDB_S");
9961018}
9971019
9981020int arcompact_handle0c_02_dasm(DASM_OPS_16)
9991021{
1000   int size = 2;
1001   print("LDW_S a <- m[b + c].word (%04x)", op);
1002   return size;
1022   return arcompact_handle0c_helper_dasm(output, pc, op, oprom, "LDW_S");
10031023}
10041024
10051025int arcompact_handle0c_03_dasm(DASM_OPS_16)
10061026{
1007   int size = 2;
1008   print("ADD_S a <- b + c (%04x)", op);
1009   return size;
1027   return arcompact_handle0c_helper_dasm(output, pc, op, oprom, "ADD_S");
10101028}
10111029
10121030
1031int arcompact_handle0d_helper_dasm(char *output, offs_t pc, UINT16 op, const UINT8* oprom, const char* optext)
1032{
1033   int u, breg, creg;
10131034
1035   COMMON16_GET_u3;
1036   COMMON16_GET_breg;
1037   COMMON16_GET_creg;
1038
1039   REG_16BIT_RANGE(breg);
1040   REG_16BIT_RANGE(creg);
1041
1042   print("%s %s <- [%s, 0x%02x]", optext, regnames[creg], regnames[breg], u);
1043   return 2;
1044}
1045
1046
10141047int arcompact_handle0d_00_dasm(DASM_OPS_16)
10151048{
1016   int size = 2;
1017   print("ADD_S c <- b + u3 (%04x)", op);
1018   return size;
1049   return arcompact_handle0d_helper_dasm(output, pc, op, oprom, "ADD_S");
10191050}
10201051
10211052int arcompact_handle0d_01_dasm(DASM_OPS_16)
10221053{
1023   int size = 2;
1024   print("SUB_S c <- b - u3 (%04x)", op);
1025   return size;
1054   return arcompact_handle0d_helper_dasm(output, pc, op, oprom, "SUB_S");
10261055}
10271056
10281057int arcompact_handle0d_02_dasm(DASM_OPS_16)
10291058{
1030   int size = 2;
1031   print("ASL_S c <- b asl u3 (%04x)", op);
1032   return size;
1059   return arcompact_handle0d_helper_dasm(output, pc, op, oprom, "ASL_S");
10331060}
10341061
10351062int arcompact_handle0d_03_dasm(DASM_OPS_16)
10361063{
1037   int size = 2;
1038   print("ASL_S c <- b asr u3 (%04x)", op);
1039   return size;
1064   return arcompact_handle0d_helper_dasm(output, pc, op, oprom, "ASR_S");
10401065}
10411066
10421067
r242425r242426
14071432   return 2;
14081433}
14091434
1435int arcompact_handle1d_helper_dasm(char *output, offs_t pc, UINT16 op, const UINT8* oprom, const char* optext)
1436{
1437   int breg;
1438   COMMON16_GET_breg;
1439   REG_16BIT_RANGE(breg);
14101440
1411int arcompact_handle1d_00_dasm(DASM_OPS_16)  { print("BREQ_S (%04x)",  op); return 2;}
1412int arcompact_handle1d_01_dasm(DASM_OPS_16)  { print("BRNE_S (%04x)",  op); return 2;}
1441   int s = (op & 0x007f) >> 0;   op &= ~0x007f;
1442   if (s & 0x40) s = -0x40 + (s & 0x3f);
14131443
1444   print("%s %s %08x", optext, regnames[breg], (pc&0xfffffffc) + s*2);
1445   return 2;
1446}
14141447
1415int arcompact_handle1e_00_dasm(DASM_OPS_16)  { print("B_S (%04x)",  op); return 2;}
1416int arcompact_handle1e_01_dasm(DASM_OPS_16)  { print("BEQ_S (%04x)",  op); return 2;}
1417int arcompact_handle1e_02_dasm(DASM_OPS_16)  { print("BNE_S (%04x)",  op); return 2;}
14181448
1419int arcompact_handle1e_03_00_dasm(DASM_OPS_16)  { print("BGT_S (%04x)",  op); return 2;}
1420int arcompact_handle1e_03_01_dasm(DASM_OPS_16)  { print("BGE_S (%04x)",  op); return 2;}
1421int arcompact_handle1e_03_02_dasm(DASM_OPS_16)  { print("BLT_S (%04x)",  op); return 2;}
1422int arcompact_handle1e_03_03_dasm(DASM_OPS_16)  { print("BLE_S (%04x)",  op); return 2;}
1423int arcompact_handle1e_03_04_dasm(DASM_OPS_16)  { print("BHI_S (%04x)",  op); return 2;}
1424int arcompact_handle1e_03_05_dasm(DASM_OPS_16)  { print("BHS_S (%04x)",  op); return 2;}
1425int arcompact_handle1e_03_06_dasm(DASM_OPS_16)  { print("BLO_S (%04x)",  op); return 2;}
1426int arcompact_handle1e_03_07_dasm(DASM_OPS_16)  { print("BLS_S (%04x)",  op); return 2;}
1449int arcompact_handle1d_00_dasm(DASM_OPS_16)  { return arcompact_handle1d_helper_dasm(output,pc,op,oprom,"BREQ_S"); }
1450int arcompact_handle1d_01_dasm(DASM_OPS_16)  { return arcompact_handle1d_helper_dasm(output,pc,op,oprom,"BRNE_S"); }
14271451
1452
1453int arcompact_handle1e_0x_helper_dasm(char *output, offs_t pc, UINT16 op, const UINT8* oprom, const char* optext)
1454{
1455   int s = (op & 0x01ff) >> 0;   op &= ~0x01ff;
1456   if (s & 0x100) s = -0x100 + (s & 0xff);
1457
1458   print("%s %08x", optext, (pc&0xfffffffc) + s*2);
1459   return 2;
1460}
1461
1462
1463
1464int arcompact_handle1e_00_dasm(DASM_OPS_16)  { return arcompact_handle1e_0x_helper_dasm(output, pc, op, oprom, "BL_S");  }
1465int arcompact_handle1e_01_dasm(DASM_OPS_16)  { return arcompact_handle1e_0x_helper_dasm(output, pc, op, oprom, "BEQ_S"); }
1466int arcompact_handle1e_02_dasm(DASM_OPS_16)  { return arcompact_handle1e_0x_helper_dasm(output, pc, op, oprom, "BNE_S"); }
1467
1468int arcompact_handle1e_03_0x_helper_dasm(char *output, offs_t pc, UINT16 op, const UINT8* oprom, const char* optext)
1469{
1470   int s = (op & 0x003f) >> 0;   op &= ~0x003f;
1471   if (s & 0x020) s = -0x20 + (s & 0x1f);
1472
1473   print("%s %08x", optext, (pc&0xfffffffc) + s*2);
1474   return 2;
1475}
1476
1477int arcompact_handle1e_03_00_dasm(DASM_OPS_16)  { return arcompact_handle1e_03_0x_helper_dasm(output, pc, op, oprom, "BGT_S"); }
1478int arcompact_handle1e_03_01_dasm(DASM_OPS_16)  { return arcompact_handle1e_03_0x_helper_dasm(output, pc, op, oprom, "BGE_S"); }
1479int arcompact_handle1e_03_02_dasm(DASM_OPS_16)  { return arcompact_handle1e_03_0x_helper_dasm(output, pc, op, oprom, "BLT_S"); }
1480int arcompact_handle1e_03_03_dasm(DASM_OPS_16)  { return arcompact_handle1e_03_0x_helper_dasm(output, pc, op, oprom, "BLE_S"); }
1481int arcompact_handle1e_03_04_dasm(DASM_OPS_16)  { return arcompact_handle1e_03_0x_helper_dasm(output, pc, op, oprom, "BHI_S"); }
1482int arcompact_handle1e_03_05_dasm(DASM_OPS_16)  { return arcompact_handle1e_03_0x_helper_dasm(output, pc, op, oprom, "BHS_S"); }
1483int arcompact_handle1e_03_06_dasm(DASM_OPS_16)  { return arcompact_handle1e_03_0x_helper_dasm(output, pc, op, oprom, "BLO_S"); }
1484int arcompact_handle1e_03_07_dasm(DASM_OPS_16)  { return arcompact_handle1e_03_0x_helper_dasm(output, pc, op, oprom, "BLS_S"); }
1485
14281486int arcompact_handle1f_dasm(DASM_OPS_16)
14291487{
1430   print("BL_S (%04x)", op);
1488   int s = (op & 0x07ff) >> 0;   op &= ~0x07ff;
1489   if (s & 0x400) s = -0x400 + (s & 0x3ff);
1490
1491   print("BL_S %08x", (pc&0xfffffffc) + (s*4));
14311492   return 2;
14321493}
14331494


Previous 199869 Revisions Next


© 1997-2024 The MAME Team