Previous 199869 Revisions Next

r33954 Friday 19th December, 2014 at 14:34:57 UTC by David Haywood
(nw)
[src/emu/cpu/arcompact]arcompactdasm_ops.c

trunk/src/emu/cpu/arcompact/arcompactdasm_ops.c
r242465r242466
452452   u =  ((op & 0x007f) >>0); \
453453   op &= ~0x007f; \
454454
455#define COMMON16_GET_s9 \
456   s =  ((op & 0x01ff) >>0); \
457   op &= ~0x01ff; \
458
455459// registers used in 16-bit opcodes hae a limited range
456460// and can only address registers r0-r3 and r12-r15
457461
r242465r242466
802806         else
803807         {
804808            if (ignore_dst == 1) { if (A) output += sprintf(output, "unused(%s)", regnames[A]); }
805            else { if (A != LIMM_REG) output += sprintf(output, "invalid(%s)", regnames[A]); } // mul operations expect A to be set to LIMM (no output)
809            else
810            {
811               if (A != LIMM_REG) output += sprintf(output, "invalid(%s)", regnames[A]);
812               else  output += sprintf(output, "<mulres>");
813            } // mul operations expect A to be set to LIMM (no output)
806814         }
807815      }
808816      else
r242465r242466
816824         else
817825         {
818826            if (ignore_dst == 1) { if (A) output += sprintf(output, "unused(%s)", regnames[A]); }
819            else { if (A != LIMM_REG) output += sprintf(output, "invalid(%s)", regnames[A]); } // mul operations expect A to be set to LIMM (no output)
827            else
828            {
829               if (A != LIMM_REG) output += sprintf(output, "invalid(%s)", regnames[A]);
830               else  output += sprintf(output, "<mulres>");
831            } // mul operations expect A to be set to LIMM (no output)
820832         }
821833
822834      }
r242465r242466
836848      else
837849      {
838850         if (ignore_dst == 1) { if (A) output += sprintf(output, "unused(%s)", regnames[A]); }
839         else { if (A != LIMM_REG) output += sprintf(output, "invalid(%s)", regnames[A]); } // mul operations expect A to be set to LIMM (no output)
851         else
852         {
853            if (A != LIMM_REG) output += sprintf(output, "invalid(%s)", regnames[A]);
854            else  output += sprintf(output, "<mulres>");
855         } // mul operations expect A to be set to LIMM (no output)
840856      }
841857   }
842858   else if (p == 2)
r242465r242466
17391755
17401756
17411757
1742int arcompact_handle0f_0x_helper_dasm(DASM_OPS_16, const char* optext)
1758int arcompact_handle0f_0x_helper_dasm(DASM_OPS_16, const char* optext, int nodst)
17431759{
17441760   int breg, creg;
17451761
r242465r242466
17491765   REG_16BIT_RANGE(breg);
17501766   REG_16BIT_RANGE(creg);
17511767
1768   if (nodst==0) print("%s %s <- %s", optext, regnames[breg], regnames[creg]);
1769   else if (nodst==1) print("%s <no dst>, %s, %s", optext, regnames[breg], regnames[creg]);
1770   else if (nodst==2) print("%s <mulres>, %s, %s", optext, regnames[breg], regnames[creg]);
17521771
1753   print("%s %s <- %s", optext, regnames[breg], regnames[creg]);
17541772   return 2;
17551773}
17561774
1757int arcompact_handle0f_02_dasm(DASM_OPS_16)  { return arcompact_handle0f_0x_helper_dasm(DASM_PARAMS, "SUB_S");}
1758int arcompact_handle0f_04_dasm(DASM_OPS_16)  { return arcompact_handle0f_0x_helper_dasm(DASM_PARAMS, "AND_S");  }
1759int arcompact_handle0f_05_dasm(DASM_OPS_16)  { return arcompact_handle0f_0x_helper_dasm(DASM_PARAMS, "OR_S");   }
1760int arcompact_handle0f_06_dasm(DASM_OPS_16)  { return arcompact_handle0f_0x_helper_dasm(DASM_PARAMS, "BIC_S");  }
1761int arcompact_handle0f_07_dasm(DASM_OPS_16)  { return arcompact_handle0f_0x_helper_dasm(DASM_PARAMS, "XOR_S");  }
1762int arcompact_handle0f_0b_dasm(DASM_OPS_16)  { return arcompact_handle0f_0x_helper_dasm(DASM_PARAMS, "TST_S");  }
1763int arcompact_handle0f_0d_dasm(DASM_OPS_16)  { return arcompact_handle0f_0x_helper_dasm(DASM_PARAMS, "SEXB_S"); }
1764int arcompact_handle0f_0e_dasm(DASM_OPS_16)  { return arcompact_handle0f_0x_helper_dasm(DASM_PARAMS, "SEXW_S"); }
1765int arcompact_handle0f_0f_dasm(DASM_OPS_16)  { return arcompact_handle0f_0x_helper_dasm(DASM_PARAMS, "EXTB_S"); }
1766int arcompact_handle0f_10_dasm(DASM_OPS_16)  { return arcompact_handle0f_0x_helper_dasm(DASM_PARAMS, "EXTW_S"); }
1767int arcompact_handle0f_11_dasm(DASM_OPS_16)  { return arcompact_handle0f_0x_helper_dasm(DASM_PARAMS, "ABS_S");  }
1768int arcompact_handle0f_12_dasm(DASM_OPS_16)  { return arcompact_handle0f_0x_helper_dasm(DASM_PARAMS, "NOT_S");  }
1769int arcompact_handle0f_13_dasm(DASM_OPS_16)  { return arcompact_handle0f_0x_helper_dasm(DASM_PARAMS, "NEG_S");  }
1770int arcompact_handle0f_14_dasm(DASM_OPS_16)  { return arcompact_handle0f_0x_helper_dasm(DASM_PARAMS, "ADD1_S"); }
1771int arcompact_handle0f_15_dasm(DASM_OPS_16)  { return arcompact_handle0f_0x_helper_dasm(DASM_PARAMS, "ADD2_S"); }
1772int arcompact_handle0f_16_dasm(DASM_OPS_16)  { return arcompact_handle0f_0x_helper_dasm(DASM_PARAMS, "ADD3_S"); }
1773int arcompact_handle0f_18_dasm(DASM_OPS_16)  { return arcompact_handle0f_0x_helper_dasm(DASM_PARAMS, "ASL_S");  }
1774int arcompact_handle0f_19_dasm(DASM_OPS_16)  { return arcompact_handle0f_0x_helper_dasm(DASM_PARAMS, "LSR_S");  }
1775int arcompact_handle0f_1a_dasm(DASM_OPS_16)  { return arcompact_handle0f_0x_helper_dasm(DASM_PARAMS, "ASR_S");  }
1776int arcompact_handle0f_1b_dasm(DASM_OPS_16)  { return arcompact_handle0f_0x_helper_dasm(DASM_PARAMS, "ASL1_S"); }
1777int arcompact_handle0f_1c_dasm(DASM_OPS_16)  { return arcompact_handle0f_0x_helper_dasm(DASM_PARAMS, "ASR1_S"); }
1778int arcompact_handle0f_1d_dasm(DASM_OPS_16)  { return arcompact_handle0f_0x_helper_dasm(DASM_PARAMS, "LSR1_S"); }
1775int arcompact_handle0f_02_dasm(DASM_OPS_16)  { return arcompact_handle0f_0x_helper_dasm(DASM_PARAMS, "SUB_S",0);  }
1776int arcompact_handle0f_04_dasm(DASM_OPS_16)  { return arcompact_handle0f_0x_helper_dasm(DASM_PARAMS, "AND_S",0);  }
1777int arcompact_handle0f_05_dasm(DASM_OPS_16)  { return arcompact_handle0f_0x_helper_dasm(DASM_PARAMS, "OR_S",0);   }
1778int arcompact_handle0f_06_dasm(DASM_OPS_16)  { return arcompact_handle0f_0x_helper_dasm(DASM_PARAMS, "BIC_S",0);  }
1779int arcompact_handle0f_07_dasm(DASM_OPS_16)  { return arcompact_handle0f_0x_helper_dasm(DASM_PARAMS, "XOR_S",0);  }
1780int arcompact_handle0f_0b_dasm(DASM_OPS_16)  { return arcompact_handle0f_0x_helper_dasm(DASM_PARAMS, "TST_S",1);  }
1781int arcompact_handle0f_0c_dasm(DASM_OPS_16)  { return arcompact_handle0f_0x_helper_dasm(DASM_PARAMS, "MUL64_S",2);  } // actual destination is special multiply registers
1782int arcompact_handle0f_0d_dasm(DASM_OPS_16)  { return arcompact_handle0f_0x_helper_dasm(DASM_PARAMS, "SEXB_S",0); }
1783int arcompact_handle0f_0e_dasm(DASM_OPS_16)  { return arcompact_handle0f_0x_helper_dasm(DASM_PARAMS, "SEXW_S",0); }
1784int arcompact_handle0f_0f_dasm(DASM_OPS_16)  { return arcompact_handle0f_0x_helper_dasm(DASM_PARAMS, "EXTB_S",0); }
1785int arcompact_handle0f_10_dasm(DASM_OPS_16)  { return arcompact_handle0f_0x_helper_dasm(DASM_PARAMS, "EXTW_S",0); }
1786int arcompact_handle0f_11_dasm(DASM_OPS_16)  { return arcompact_handle0f_0x_helper_dasm(DASM_PARAMS, "ABS_S",0);  }
1787int arcompact_handle0f_12_dasm(DASM_OPS_16)  { return arcompact_handle0f_0x_helper_dasm(DASM_PARAMS, "NOT_S",0);  }
1788int arcompact_handle0f_13_dasm(DASM_OPS_16)  { return arcompact_handle0f_0x_helper_dasm(DASM_PARAMS, "NEG_S",0);  }
1789int arcompact_handle0f_14_dasm(DASM_OPS_16)  { return arcompact_handle0f_0x_helper_dasm(DASM_PARAMS, "ADD1_S",0); }
1790int arcompact_handle0f_15_dasm(DASM_OPS_16)  { return arcompact_handle0f_0x_helper_dasm(DASM_PARAMS, "ADD2_S",0); }
1791int arcompact_handle0f_16_dasm(DASM_OPS_16)  { return arcompact_handle0f_0x_helper_dasm(DASM_PARAMS, "ADD3_S",0); }
1792int arcompact_handle0f_18_dasm(DASM_OPS_16)  { return arcompact_handle0f_0x_helper_dasm(DASM_PARAMS, "ASL_S",0);  }
1793int arcompact_handle0f_19_dasm(DASM_OPS_16)  { return arcompact_handle0f_0x_helper_dasm(DASM_PARAMS, "LSR_S",0);  }
1794int arcompact_handle0f_1a_dasm(DASM_OPS_16)  { return arcompact_handle0f_0x_helper_dasm(DASM_PARAMS, "ASR_S",0);  }
1795int arcompact_handle0f_1b_dasm(DASM_OPS_16)  { return arcompact_handle0f_0x_helper_dasm(DASM_PARAMS, "ASL1_S",0); }
1796int arcompact_handle0f_1c_dasm(DASM_OPS_16)  { return arcompact_handle0f_0x_helper_dasm(DASM_PARAMS, "ASR1_S",0); }
1797int arcompact_handle0f_1d_dasm(DASM_OPS_16)  { return arcompact_handle0f_0x_helper_dasm(DASM_PARAMS, "LSR1_S",0); }
17791798
1780int arcompact_handle0f_0c_dasm(DASM_OPS_16)  { print("MUL64_S mulres <- b * c  (%08x)", op); return 2;} // special
1781int arcompact_handle0f_1e_dasm(DASM_OPS_16)  { print("TRAP_S (%08x)", op); return 2;} // special
17821799
1800int arcompact_handle0f_1e_dasm(DASM_OPS_16)  // special
1801{ // 0111 1uuu uuu1 1110
1802   int u = (op & 0x07e0)>>5;
1803   print("TRAP_S %02x",u);
1804   return 2;
1805}
1806
17831807int arcompact_handle0f_1f_dasm(DASM_OPS_16)  // special
17841808{
1785   int bc = (op & 0x07e0)>>5; op &= ~0x07e0;
1809   int u = (op & 0x07e0)>>5; op &= ~0x07e0;
17861810
1787   if (bc == 0x003f)
1811   if (u == 0x003f)
17881812   {
17891813      print("BRK_S");
17901814   }
17911815   else
17921816   {
1793      print("<illegal BRK_S>");
1817      print("<illegal BRK_S %02x>",u);
17941818   }
17951819   return 2;
17961820}
r242465r242466
20232047   return 2;
20242048}
20252049
2026int arcompact_handle19_00_dasm(DASM_OPS_16)  { print("LD_S r0 <- m[GP + s11].long (%04x)",  op); return 2;}
2027int arcompact_handle19_01_dasm(DASM_OPS_16)  { print("LDB_S r0 <- m[GP + s9].byte (%04x)",  op); return 2;}
2028int arcompact_handle19_02_dasm(DASM_OPS_16)  { print("LDW_S r0 <- m[GP + s10].word (%04x)",  op); return 2;}
2029int arcompact_handle19_03_dasm(DASM_OPS_16)  { print("ADD_S r0 <- GP + s11 (%04x)",  op); return 2;}
20302050
2051int arcompact_handle19_0x_helper_dasm(DASM_OPS_16, const char* optext, int shift, int format)
2052{
2053   int s;
2054
2055   COMMON16_GET_s9;
2056   // todo, signed
2057   s <<= shift;
2058
2059
2060   output  += sprintf( output, "%s %s, ", optext, regnames[0]);
2061   if (format == 0)
2062   {
2063      output  += sprintf( output, "[GP, %03x]", s);
2064   }
2065   else
2066   {
2067      output  += sprintf( output, "GP, %03x", s);
2068   }
2069
2070   return 2;
2071}
2072
2073int arcompact_handle19_00_dasm(DASM_OPS_16)  { return arcompact_handle19_0x_helper_dasm(DASM_PARAMS, "LD_S", 2, 0); }
2074int arcompact_handle19_01_dasm(DASM_OPS_16)  { return arcompact_handle19_0x_helper_dasm(DASM_PARAMS, "LDB_S", 0, 0); }
2075int arcompact_handle19_02_dasm(DASM_OPS_16)  { return arcompact_handle19_0x_helper_dasm(DASM_PARAMS, "LDW_S", 1, 0);  }
2076int arcompact_handle19_03_dasm(DASM_OPS_16)  { return arcompact_handle19_0x_helper_dasm(DASM_PARAMS, "ADD_S", 2, 1); }
2077
20312078int arcompact_handle1a_dasm(DASM_OPS_16)
20322079{
2033   print("PCL Instr (%04x)", op);
2080   int breg, u;
2081   COMMON16_GET_breg;
2082   COMMON16_GET_u8;
2083   REG_16BIT_RANGE(breg);
2084
2085   print("MOV_S %s, [PCL, %03x]", regnames[breg], u*4);
2086
20342087   return 2;
20352088}
20362089


Previous 199869 Revisions Next


© 1997-2024 The MAME Team