Previous 199869 Revisions Next

r34034 Tuesday 23rd December, 2014 at 16:04:12 UTC by David Haywood
arcompact - further (nw)
[src/emu/cpu/arcompact]arcompact.h arcompact_execute.c arcompactdasm_ops.c

trunk/src/emu/cpu/arcompact/arcompact.h
r242545r242546
153153//   ARCOMPACT_RETTYPE arcompact_handle04_04(OPS_32);
154154   ARCOMPACT_RETTYPE arcompact_handle04_05(OPS_32);
155155//   ARCOMPACT_RETTYPE arcompact_handle04_06(OPS_32);
156   ARCOMPACT_RETTYPE arcompact_handle04_07(OPS_32);
156//   ARCOMPACT_RETTYPE arcompact_handle04_07(OPS_32);
157157   ARCOMPACT_RETTYPE arcompact_handle04_08(OPS_32);
158158   ARCOMPACT_RETTYPE arcompact_handle04_09(OPS_32);
159159//   ARCOMPACT_RETTYPE arcompact_handle04_0a(OPS_32);
r242545r242546
161161   ARCOMPACT_RETTYPE arcompact_handle04_0c(OPS_32);
162162   ARCOMPACT_RETTYPE arcompact_handle04_0d(OPS_32);
163163   ARCOMPACT_RETTYPE arcompact_handle04_0e(OPS_32);
164   ARCOMPACT_RETTYPE arcompact_handle04_0f(OPS_32);
164//   ARCOMPACT_RETTYPE arcompact_handle04_0f(OPS_32);
165165   ARCOMPACT_RETTYPE arcompact_handle04_10(OPS_32);
166166   ARCOMPACT_RETTYPE arcompact_handle04_11(OPS_32);
167167   ARCOMPACT_RETTYPE arcompact_handle04_12(OPS_32);
r242545r242546
763763   ARCOMPACT_RETTYPE arcompact_handle19_0x_helper(OPS_16, const char* optext, int shift, int format);
764764   ARCOMPACT_RETTYPE arcompact_handle1e_0x_helper(OPS_16, const char* optext);
765765   ARCOMPACT_RETTYPE arcompact_handle1e_03_0x_helper(OPS_16, const char* optext);
766   ARCOMPACT_RETTYPE arcompact_handle1d_helper(OPS_16, const char* optext);
767766
768767   ARCOMPACT_RETTYPE get_insruction(OPS_32);
769768
770769   ARCOMPACT_HANDLER04_TYPE_PM(04_00);
771770   ARCOMPACT_HANDLER04_TYPE_PM(04_04);
772771   ARCOMPACT_HANDLER04_TYPE_PM(04_06);
772   ARCOMPACT_HANDLER04_TYPE_PM(04_07);
773773   ARCOMPACT_HANDLER04_TYPE_PM(04_0a);
774   ARCOMPACT_HANDLER04_TYPE_PM(04_0f);
774775   ARCOMPACT_HANDLER04_TYPE_PM(04_20);
775776
776777private:
trunk/src/emu/cpu/arcompact/arcompact_execute.c
r242545r242546
11791179      size = 8;
11801180   }
11811181
1182   arcompact_log("unimplemented %s %08x", optext, op);
1182   arcompact_log("unimplemented %s %08x (reg-reg)", optext, op);
11831183   return m_pc + (size>>0);
11841184}
11851185
r242545r242546
12961296ARCOMPACT_RETTYPE arcompact_device::arcompact_01_01_01_helper(OPS_32, const char* optext)
12971297{
12981298   int size = 4;
1299   arcompact_log("unimplemented %s %08x", optext, op);
1299   arcompact_log("unimplemented %s %08x (reg-imm)", optext, op);
13001300   return m_pc + (size>>0);
13011301}
13021302
r242545r242546
16571657}
16581658
16591659
1660#define SETUP_HANDLE04_0x_P00 \
1661   int size = 4; \
1662   UINT32 limm = 0; \
1663   int got_limm = 0; \
1664   \
1665   COMMON32_GET_breg; \
1666   COMMON32_GET_F; \
1667   COMMON32_GET_creg; \
1668   COMMON32_GET_areg; \
1669   \
1670   UINT32 b, c; \
1671   \
1672   if (breg == LIMM_REG) \
1673   { \
1674      GET_LIMM_32; \
1675      size = 8; \
1676      got_limm = 1; \
1677      b = limm; \
1678   } \
1679   else \
1680   { \
1681      b = m_regs[breg]; \
1682   } \
1683    \
1684   if (creg == LIMM_REG) \
1685   { \
1686      if (!got_limm) \
1687      { \
1688         GET_LIMM_32; \
1689         size = 8; \
1690      } \
1691      c = limm; \
1692   } \
1693   else \
1694   { \
1695      c = m_regs[creg]; \
1696   } \
1697   /* todo: is the limm, limm syntax valid? (it's pointless.) */ \
1698   /* todo: if areg = LIMM then there is no result (but since that register can never be read, I guess it doesn't matter if we store it there anyway?) */ \
1699
1700
1701
16601702ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_00_p00(OPS_32)
16611703{
1704   SETUP_HANDLE04_0x_P00
1705
1706   m_regs[areg] = b + c;
1707
1708   if (F)
1709   {
1710      arcompact_fatal("arcompact_handle04_00_p00 (ADD) (F set)\n"); // not yet supported
1711   }
1712
1713   return m_pc + (size >> 0);
1714}
1715
1716ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_00_p01(OPS_32)
1717{
16621718   int size = 4;
16631719   UINT32 limm = 0;
1664   int got_limm = 0;
1720//   int got_limm = 0;
16651721
16661722   COMMON32_GET_breg;
16671723   COMMON32_GET_F;
1668   COMMON32_GET_creg
1724   COMMON32_GET_u6
16691725   COMMON32_GET_areg
16701726
16711727   UINT32 b, c;
16721728
1729   // is having b as LIMM valid here? LIMM vs. fixed u6 value makes no sense
16731730   if (breg == LIMM_REG)
16741731   {
16751732      GET_LIMM_32;
16761733      size = 8;
1677      got_limm = 1;
1734//      got_limm = 1;
16781735      b = limm;
16791736   }
16801737   else
r242545r242546
16821739      b = m_regs[breg];
16831740   }
16841741
1685   if (creg == LIMM_REG)
1686   {
1687      if (!got_limm)
1688      {
1689         GET_LIMM_32;
1690         size = 8;
1691      }
1692      c = limm;
1693   }
1694   else
1695   {
1696      c = m_regs[creg];
1697   }
1742   c = u;
16981743
16991744   // todo: if areg = LIMM then there is no result (but since that register can never be read, I guess it doesn't matter if we store it there anyway?)
17001745   m_regs[areg] = b + c;
17011746
17021747   if (F)
17031748   {
1704      arcompact_fatal("arcompact_handle04_00_p00 (ADD) (F set)\n"); // not yet supported
1749      arcompact_fatal("arcompact_handle04_00_p01 (ADD) (F set)\n"); // not yet supported
17051750   }
17061751
17071752   return m_pc + (size >> 0);
17081753}
17091754
1710ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_00_p01(OPS_32)
1711{
1712   int size = 4;
1713   arcompact_fatal("arcompact_handle04_00_p01 (ADD)\n");
1714   return m_pc + (size >> 0);
1715}
1716
17171755ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_00_p10(OPS_32)
17181756{
17191757   int size = 4;
r242545r242546
17541792
17551793ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_04_p00(OPS_32)
17561794{
1795   SETUP_HANDLE04_0x_P00
1796
1797   m_regs[areg] = b & c;
1798
1799   if (F)
1800   {
1801      arcompact_fatal("arcompact_handle04_04_p00 (AND) (F set)\n"); // not yet supported
1802   }
1803
1804   return m_pc + (size >> 0);
1805}
1806
1807ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_04_p01(OPS_32)
1808{
17571809   int size = 4;
17581810   UINT32 limm = 0;
1759   int got_limm = 0;
1811//   int got_limm = 0;
17601812
17611813   COMMON32_GET_breg;
17621814   COMMON32_GET_F;
1763   COMMON32_GET_creg
1815   COMMON32_GET_u6
17641816   COMMON32_GET_areg
17651817
17661818   UINT32 b, c;
17671819
1820   // is having b as LIMM valid here? LIMM vs. fixed u6 value makes no sense
17681821   if (breg == LIMM_REG)
17691822   {
17701823      GET_LIMM_32;
17711824      size = 8;
1772      got_limm = 1;
1825//      got_limm = 1;
17731826      b = limm;
17741827   }
17751828   else
r242545r242546
17771830      b = m_regs[breg];
17781831   }
17791832
1780   if (creg == LIMM_REG)
1781   {
1782      if (!got_limm)
1783      {
1784         GET_LIMM_32;
1785         size = 8;
1786      }
1787      c = limm;
1788   }
1789   else
1790   {
1791      c = m_regs[creg];
1792   }
1793   // todo: is and a, limm, limm valid? (it's pointless.)
1833   c = u;
17941834
17951835   // todo: if areg = LIMM then there is no result (but since that register can never be read, I guess it doesn't matter if we store it there anyway?)
17961836   m_regs[areg] = b & c;
17971837
17981838   if (F)
17991839   {
1800      arcompact_fatal("arcompact_handle04_04_p00 (AND) (F set)\n"); // not yet supported
1840      arcompact_fatal("arcompact_handle04_04_p01 (AND) (F set)\n"); // not yet supported
18011841   }
18021842
1803   return m_pc + (size >> 0);}
1804
1805ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_04_p01(OPS_32)
1806{
1807   int size = 4;
1808   arcompact_fatal("arcompact_handle04_04_p01 (AND)\n");
18091843   return m_pc + (size >> 0);
18101844}
18111845
r242545r242546
18371871}
18381872
18391873
1840ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_06_p00(OPS_32)
1874// Bitwise AND Operation with Inverted Source
1875ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_06_p00(OPS_32) // BIC
18411876{
1842   int size = 4;
1843   arcompact_fatal("arcompact_handle04_06_p00 (BIC)\n");
1877   SETUP_HANDLE04_0x_P00
1878
1879   m_regs[areg] = b & (~c);
1880
1881   if (F)
1882   {
1883      arcompact_fatal("arcompact_handle04_06_p00 (BIC) (F set)\n"); // not yet supported
1884   }
1885
18441886   return m_pc + (size >> 0);
1845
18461887}
18471888
18481889ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_06_p01(OPS_32)
r242545r242546
18741915}
18751916
18761917
1877ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_07(OPS_32) 
1918
1919
1920// XOR
1921ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_07_p00(OPS_32) // XOR
18781922{
1879   return arcompact_handle04_helper(PARAMS, opcodes_04[0x07], /*"XOR"*/ 0,0);
1923   int size = 4;
1924   arcompact_fatal("arcompact_handle04_07_p00 (XOR)\n");
1925   return m_pc + (size >> 0);
18801926}
18811927
1928ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_07_p01(OPS_32)
1929{
1930   int size = 4;
1931   UINT32 limm = 0;
1932//   int got_limm = 0;
1933
1934   COMMON32_GET_breg;
1935   COMMON32_GET_F;
1936   COMMON32_GET_u6
1937   COMMON32_GET_areg
1938
1939   UINT32 b, c;
1940
1941   // is having b as LIMM valid here? LIMM vs. fixed u6 value makes no sense
1942   if (breg == LIMM_REG)
1943   {
1944      GET_LIMM_32;
1945      size = 8;
1946//      got_limm = 1;
1947      b = limm;
1948   }
1949   else
1950   {
1951      b = m_regs[breg];
1952   }
1953
1954   c = u;
1955
1956   // todo: if areg = LIMM then there is no result (but since that register can never be read, I guess it doesn't matter if we store it there anyway?)
1957   m_regs[areg] = b ^ c;
1958
1959   if (F)
1960   {
1961      arcompact_fatal("arcompact_handle04_07_p01 (XOR) (F set)\n"); // not yet supported
1962   }
1963
1964   return m_pc + (size >> 0);
1965}
1966
1967ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_07_p10(OPS_32)
1968{
1969   int size = 4;
1970   arcompact_fatal("arcompact_handle04_07_p10 (XOR)\n");
1971   return m_pc + (size >> 0);
1972}
1973
1974ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_07_p11_m0(OPS_32)
1975{
1976   int size = 4;
1977   arcompact_fatal("arcompact_handle04_07_p11_m0 (XOR)\n");
1978   return m_pc + (size >> 0);
1979}
1980
1981ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_07_p11_m1(OPS_32)
1982{
1983   int size = 4;
1984   arcompact_fatal("arcompact_handle04_07_p11_m1 (XOR)\n");
1985   return m_pc + (size >> 0);
1986}
1987
18821988ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_08(OPS_32) 
18831989{
18841990   return arcompact_handle04_helper(PARAMS, opcodes_04[0x08], /*"MAX"*/ 0,0);
r242545r242546
18901996}
18911997
18921998
1893ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_0a_p00(OPS_32)
1999ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_0a_p00(OPS_32) // MOV<f> b, c
18942000{
1895   // p00 formats not listed in appendix?
1896
18972001   int size = 4;
18982002   UINT32 limm = 0;
18992003   int got_limm = 0;
r242545r242546
19302034      // MOV   b <- c    0010 0RRR 0000 1010 0RRR cccc ccRR RRRR
19312035      // MOV.F b <- c    0010 0RRR 0000 1010 1RRR cccc ccRR RRRR
19322036
1933      arcompact_fatal("unimplemented MOV b <- c %08x", op);
2037      m_regs[breg] = m_regs[creg];
2038
2039      if (F)
2040      { // currently not supported
2041         arcompact_fatal("unimplemented MOV.F %08x", op);
2042      }
2043
2044      return m_pc + (size>>0);
19342045   }
19352046
19362047   return m_pc + (size>>0);
r242545r242546
19802091   return m_pc + (size >> 0);
19812092}
19822093
1983#if 0
1984ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_0a(OPS_32)
1985{
1986   return arcompact_handle04_helper(PARAMS, opcodes_04[0x0a], /*"MOV"*/ 1,0);
1987}
1988#endif
19892094
19902095ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_0b(OPS_32)
19912096{
r242545r242546
20072112   return arcompact_handle04_helper(PARAMS, opcodes_04[0x0e], /*"RSUB"*/ 0,0);
20082113}
20092114
2010ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_0f(OPS_32) 
2011{
2012   return arcompact_handle04_helper(PARAMS, opcodes_04[0x0f], /*"BSET"*/ 0,0);
2115
2116ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_0f_p00(OPS_32)
2117{
2118   SETUP_HANDLE04_0x_P00
2119
2120   m_regs[areg] = b | (1 << (c & 0x1f));
2121
2122   if (F)
2123   {
2124      arcompact_fatal("arcompact_handle04_06_p00 (BSET) (F set)\n"); // not yet supported
2125   }
2126
2127   return m_pc + (size >> 0);
20132128}
20142129
2130ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_0f_p01(OPS_32)
2131{
2132   int size = 4;
2133   arcompact_fatal("arcompact_handle04_0f_p01 (BSET)\n");
2134   return m_pc + (size >> 0);
2135}
2136
2137ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_0f_p10(OPS_32)
2138{
2139   int size = 4;
2140   arcompact_fatal("arcompact_handle04_0f_p10 (BSET)\n");
2141   return m_pc + (size >> 0);
2142}
2143
2144ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_0f_p11_m0(OPS_32)
2145{
2146   int size = 4;
2147   arcompact_fatal("arcompact_handle04_0f_p11_m0 (BSET)\n");
2148   return m_pc + (size >> 0);
2149}
2150
2151ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_0f_p11_m1(OPS_32)
2152{
2153   int size = 4;
2154   arcompact_fatal("arcompact_handle04_0f_p11_m1 (BSET)\n");
2155   return m_pc + (size >> 0);
2156}
2157
20152158ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_10(OPS_32) 
20162159{
20172160   return arcompact_handle04_helper(PARAMS, opcodes_04[0x10], /*"BCLR"*/ 0,0);
r242545r242546
27882931}
27892932
27902933ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_02(OPS_16)  { return arcompact_handle0f_0x_helper(PARAMS, "SUB_S",0);  }
2791ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_04(OPS_16)  { return arcompact_handle0f_0x_helper(PARAMS, "AND_S",0);  }
2934ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_04(OPS_16) // AND_S b <- b, c
2935{
2936   int breg, creg;
2937
2938   COMMON16_GET_breg;
2939   COMMON16_GET_creg;
2940
2941   REG_16BIT_RANGE(breg);
2942   REG_16BIT_RANGE(creg);
2943
2944   m_regs[breg] = m_regs[breg] & m_regs[creg];
2945
2946   return m_pc + (2 >> 0);
2947}
2948
27922949ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_05(OPS_16)  { return arcompact_handle0f_0x_helper(PARAMS, "OR_S",0);   }
27932950ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_06(OPS_16)  { return arcompact_handle0f_0x_helper(PARAMS, "BIC_S",0);  }
27942951ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_07(OPS_16)  { return arcompact_handle0f_0x_helper(PARAMS, "XOR_S",0);  }
r242545r242546
28072964   REG_16BIT_RANGE(breg);
28082965   REG_16BIT_RANGE(creg);
28092966
2810   m_regs[breg] = m_regs[creg] & 0xff;
2967   m_regs[breg] = m_regs[creg] & 0x000000ff;
28112968
28122969   return m_pc + (2 >> 0);
28132970
28142971}
28152972
2816ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_10(OPS_16)  { return arcompact_handle0f_0x_helper(PARAMS, "EXTW_S",0); }
2973ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_10(OPS_16) // EXTW_S
2974{
2975   int breg, creg;
2976
2977   COMMON16_GET_breg;
2978   COMMON16_GET_creg;
2979
2980   REG_16BIT_RANGE(breg);
2981   REG_16BIT_RANGE(creg);
2982
2983   m_regs[breg] = m_regs[creg] & 0x0000ffff;
2984
2985   return m_pc + (2 >> 0);
2986}
2987
28172988ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_11(OPS_16)  { return arcompact_handle0f_0x_helper(PARAMS, "ABS_S",0);  }
28182989ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_12(OPS_16)  { return arcompact_handle0f_0x_helper(PARAMS, "NOT_S",0);  }
28192990ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_13(OPS_16)  { return arcompact_handle0f_0x_helper(PARAMS, "NEG_S",0);  }
r242545r242546
28232994ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_18(OPS_16)  { return arcompact_handle0f_0x_helper(PARAMS, "ASL_S",0);  }
28242995ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_19(OPS_16)  { return arcompact_handle0f_0x_helper(PARAMS, "LSR_S",0);  }
28252996ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_1a(OPS_16)  { return arcompact_handle0f_0x_helper(PARAMS, "ASR_S",0);  }
2826ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_1b(OPS_16)  { return arcompact_handle0f_0x_helper(PARAMS, "ASL1_S",0); }
2997
2998ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_1b(OPS_16) //  ASL b, c asl 1   (can also be impleneted as b = c + c)
2999{
3000   int breg, creg;
3001
3002   COMMON16_GET_breg;
3003   COMMON16_GET_creg;
3004
3005   REG_16BIT_RANGE(breg);
3006   REG_16BIT_RANGE(creg);
3007
3008   m_regs[breg] = m_regs[creg] << 1;
3009
3010   return m_pc + (2 >> 0);
3011}
3012
28273013ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_1c(OPS_16)  { return arcompact_handle0f_0x_helper(PARAMS, "ASR1_S",0); }
28283014ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_1d(OPS_16)  { return arcompact_handle0f_0x_helper(PARAMS, "LSR1_S",0); }
28293015
r242545r242546
28853071
28863072ARCOMPACT_RETTYPE arcompact_device::arcompact_handle12(OPS_16)
28873073{
2888   return arcompact_handle_ld_helper(PARAMS, "LDW_S", 1, 0);
3074 // LDB_W c, [b, u6]
3075   int breg, creg, u;
3076
3077   COMMON16_GET_breg;
3078   COMMON16_GET_creg;
3079   COMMON16_GET_u5;
3080
3081   REG_16BIT_RANGE(breg);
3082   REG_16BIT_RANGE(creg);
3083
3084   u <<= 1;
3085   m_regs[creg] = READ16((m_regs[breg] + u) >> 1);
3086
3087   return m_pc + (2 >> 0);
28893088}
28903089
28913090ARCOMPACT_RETTYPE arcompact_device::arcompact_handle13(OPS_16)
r242545r242546
28933092   return arcompact_handle_ld_helper(PARAMS, "LDW_S.X", 1, 0);
28943093}
28953094
2896ARCOMPACT_RETTYPE arcompact_device::arcompact_handle14(OPS_16)
3095ARCOMPACT_RETTYPE arcompact_device::arcompact_handle14(OPS_16) // ST_S c, [b, u7]
28973096{
2898   return arcompact_handle_ld_helper(PARAMS, "ST_S", 2, 1);
3097   int breg, creg, u;
3098
3099   COMMON16_GET_breg;
3100   COMMON16_GET_creg;
3101   COMMON16_GET_u5;
3102
3103   REG_16BIT_RANGE(breg);
3104   REG_16BIT_RANGE(creg);
3105
3106   u <<= 2;
3107
3108   WRITE32((m_regs[breg] + u) >> 2, m_regs[creg]);
3109
3110   return m_pc + (2 >> 0);
28993111}
29003112
29013113ARCOMPACT_RETTYPE arcompact_device::arcompact_handle15(OPS_16)
r242545r242546
29033115   return arcompact_handle_ld_helper(PARAMS, "STB_S", 0, 1);
29043116}
29053117
2906ARCOMPACT_RETTYPE arcompact_device::arcompact_handle16(OPS_16)
3118ARCOMPACT_RETTYPE arcompact_device::arcompact_handle16(OPS_16) // STW_S c. [b, u6]
29073119{
2908   return arcompact_handle_ld_helper(PARAMS, "STW_S", 1, 1);
3120   int breg, creg, u;
3121
3122   COMMON16_GET_breg;
3123   COMMON16_GET_creg;
3124   COMMON16_GET_u5;
3125
3126   REG_16BIT_RANGE(breg);
3127   REG_16BIT_RANGE(creg);
3128
3129   u <<= 1;
3130
3131   WRITE16((m_regs[breg] + u) >> 1, m_regs[creg]);
3132
3133   return m_pc + (2 >> 0);
3134
29093135}
29103136
29113137
r242545r242546
29843210   return m_pc + (2 >> 0);
29853211}
29863212
2987ARCOMPACT_RETTYPE arcompact_device::arcompact_handle18_00(OPS_16)
3213ARCOMPACT_RETTYPE arcompact_device::arcompact_handle18_00(OPS_16)   // LD_S b, [SP, u7]
29883214{
2989   return arcompact_handle18_0x_helper(PARAMS, "LD_S", 0);
3215   int breg;
3216   UINT32 u;
3217
3218   COMMON16_GET_breg;
3219   COMMON16_GET_u5;
3220
3221   REG_16BIT_RANGE(breg);
3222
3223   UINT32 address = m_regs[REG_SP] + (u << 2);
3224
3225   m_regs[breg] = READ32(address >> 2);
3226
3227   return m_pc + (2 >> 0);
29903228}
29913229
29923230ARCOMPACT_RETTYPE arcompact_device::arcompact_handle18_01(OPS_16)
29933231{
2994   return arcompact_handle18_0x_helper(PARAMS, "LDB_S", 0);
3232   return arcompact_handle18_0x_helper(PARAMS, "LDB_S (SP)", 0);
29953233}
29963234
2997ARCOMPACT_RETTYPE arcompact_device::arcompact_handle18_02(OPS_16)
3235ARCOMPACT_RETTYPE arcompact_device::arcompact_handle18_02(OPS_16) // ST_S b, [SP, u7]
29983236{
2999   return arcompact_handle18_0x_helper(PARAMS, "ST_S", 1);
3237   int breg;
3238   UINT32 u;
3239
3240   COMMON16_GET_breg;
3241   COMMON16_GET_u5;
3242
3243   REG_16BIT_RANGE(breg);
3244
3245   UINT32 address = m_regs[REG_SP] + (u << 2);
3246
3247   WRITE32(address >> 2, m_regs[breg]);
3248
3249   return m_pc + (2 >> 0);
30003250}
30013251
30023252ARCOMPACT_RETTYPE arcompact_device::arcompact_handle18_03(OPS_16)
30033253{
3004   return arcompact_handle18_0x_helper(PARAMS, "STB_S", 1);
3254   return arcompact_handle18_0x_helper(PARAMS, "STB_S (SP)", 1);
30053255}
30063256
3007ARCOMPACT_RETTYPE arcompact_device::arcompact_handle18_04(OPS_16)
3257ARCOMPACT_RETTYPE arcompact_device::arcompact_handle18_04(OPS_16) // ADD_S b, SP, u7
30083258{
3009   return arcompact_handle18_0x_helper(PARAMS, "ADD_S", 1); // check format
3259   int breg;
3260   UINT32 u;
3261
3262   COMMON16_GET_breg;
3263   COMMON16_GET_u5;
3264
3265   REG_16BIT_RANGE(breg);
3266
3267   m_regs[breg] = m_regs[REG_SP] + (u << 2);
3268
3269   return m_pc + (2 >> 0);
30103270}
30113271
30123272// op bits remaining for 0x18_05_xx subgroups 0x001f
r242545r242546
31823442   return m_pc + (2 >> 0);
31833443}
31843444
3185ARCOMPACT_RETTYPE arcompact_device::arcompact_handle1d_helper(OPS_16, const char* optext)
3445
3446
3447ARCOMPACT_RETTYPE arcompact_device::arcompact_handle1d_00(OPS_16) // BREQ_S b,0,s8
31863448{
3187   arcompact_log("unimplemented %s %04x", optext, op);
3449   int breg;
3450   COMMON16_GET_breg;
3451   REG_16BIT_RANGE(breg);
3452
3453   if (!m_regs[breg])
3454   {
3455      int s = (op & 0x007f) >> 0;   op &= ~0x007f;
3456      if (s & 0x40) s = -0x40 + (s & 0x3f);
3457      UINT32 realaddress = PC_ALIGNED32 + (s * 2);
3458      //m_regs[REG_BLINK] = m_pc + (2 >> 0); // don't link
3459      return realaddress;
3460   }
3461
31883462   return m_pc + (2 >> 0);
31893463}
31903464
31913465
3192ARCOMPACT_RETTYPE arcompact_device::arcompact_handle1d_00(OPS_16) // BREQ b,0,s8
3466ARCOMPACT_RETTYPE arcompact_device::arcompact_handle1d_01(OPS_16) // BRNE_S b,0,s8
31933467{
31943468   int breg;
31953469   COMMON16_GET_breg;
31963470   REG_16BIT_RANGE(breg);
31973471
3198   if (!m_regs[breg])
3472   if (m_regs[breg])
31993473   {
32003474      int s = (op & 0x007f) >> 0;   op &= ~0x007f;
32013475      if (s & 0x40) s = -0x40 + (s & 0x3f);
r242545r242546
32083482}
32093483
32103484
3211ARCOMPACT_RETTYPE arcompact_device::arcompact_handle1d_01(OPS_16)  { return arcompact_handle1d_helper(PARAMS,"BRNE_S"); }
3212
3213
32143485ARCOMPACT_RETTYPE arcompact_device::arcompact_handle1e_0x_helper(OPS_16, const char* optext)
32153486{
32163487   arcompact_log("unimplemented %s %04x (1e_0x type)", optext, op);
trunk/src/emu/cpu/arcompact/arcompactdasm_ops.c
r242545r242546
457457   return size;
458458}
459459
460// like p00 but with 'u6' istead of C
460461int arcompact_handle04_p01_helper_dasm(DASM_OPS_32, const char* optext, int ignore_dst, int b_reserved)
461462{
463   //           PP
464   // 0010 0bbb 01ii iiii FBBB uuuu uuAA AAAA
462465   int size = 4;
463466   UINT32 limm = 0;
464   //int got_limm = 0;
467//   int got_limm = 0;
465468
466469   COMMON32_GET_breg;
467   COMMON32_GET_F
470   COMMON32_GET_F;
468471   COMMON32_GET_u6
469472   COMMON32_GET_areg
470473
r242545r242546
472475   output += sprintf(output, "%s", flagbit[F]);
473476   //   output  += sprintf( output, " p(%d)", p);
474477
475   if (!b_reserved)
478
479   if ((!b_reserved) && (breg == LIMM_REG))
476480   {
477      if (breg == LIMM_REG)
478      {
479         GET_LIMM_32;
480         size = 8;
481         //got_limm = 1;
482         output += sprintf(output, " 0x%08x ", limm);
481      GET_LIMM_32;
482      size = 8;
483//      got_limm = 1;
484   }
483485
484      }
485      else
486      {
487         output += sprintf(output, " %s, ", regnames[breg]);
488      }
486   // areg can be LIMM too, but in that case LIMM indicates 'no destination' rather than an actual LIMM value following
487
488   if (ignore_dst == 0)
489   {
490      if (areg != LIMM_REG)  output += sprintf(output, " %s <-", regnames[areg]);
491      else output += sprintf(output, " <no dst> <-");
489492   }
490   else
493   else if (ignore_dst == 1) // certain opcode types ignore the 'a' field entirely, it should be set to 0.
491494   {
492      if (breg) output += sprintf(output, "reserved(%s), ", regnames[breg]);
495      if (areg) output += sprintf(output, " <reserved %d> <-", areg);
493496   }
497   else if (ignore_dst == 2) // for multiply operations areg should always be set to LIMM
498   {
499      if (areg != LIMM_REG) output += sprintf(output, " <invalid %d> <-", areg);
500      else  output += sprintf(output, " <mulres> <-");
501   }
494502
495   output += sprintf(output, " 0x%02x ", u);
496   if (ignore_dst == 0)
503   if (!b_reserved)
497504   {
498      if (areg != LIMM_REG)  output += sprintf(output, "DST(%s)", regnames[areg]);
499      else output += sprintf(output, "<no dst>");
505      if (breg == LIMM_REG)
506         output += sprintf(output, " 0x%08x,", limm);
507      else
508         output += sprintf(output, " %s,", regnames[breg]);
500509   }
501510   else
502511   {
503      if (ignore_dst == 1) { if (areg) output += sprintf(output, "unused(%s)", regnames[areg]); }
504      else
505      {
506         if (areg != LIMM_REG) output += sprintf(output, "invalid(%s)", regnames[areg]);
507         else  output += sprintf(output, "<mulres>");
508      } // mul operations expect A to be set to LIMM (no output)
512      if (breg) output += sprintf(output, "<reserved %d>,", breg);
509513   }
514
515   output += sprintf(output, " 0x%02x", u);
516
510517   return size;
511518}
512519
r242545r242546
17161723
17171724// op bits remaining for 0x18_xx subgroups 0x071f
17181725
1719int arcompact_handle18_0x_helper_dasm(DASM_OPS_16, const char* optext, int st)
1726int arcompact_handle18_0x_helper_dasm(DASM_OPS_16, const char* optext, int st, int format)
17201727{
17211728   int breg, u;
17221729
r242545r242546
17281735   output  += sprintf( output, "%s %s ", optext, regnames[breg]);
17291736   if (st==1) output  += sprintf( output, "-> ");
17301737   else output  += sprintf( output, "<- ");
1731   output  += sprintf( output, "[SP, 0x%02x]", u*4);
17321738
1739   if (format==0) output  += sprintf( output, "[SP, 0x%02x]", u*4);
1740   else  output  += sprintf( output, "SP, 0x%02x", u*4);
1741
1742
17331743   return 2;
17341744}
17351745
17361746int arcompact_handle18_00_dasm(DASM_OPS_16)
17371747{
1738   return arcompact_handle18_0x_helper_dasm(DASM_PARAMS, "LD_S", 0);
1748   return arcompact_handle18_0x_helper_dasm(DASM_PARAMS, "LD_S", 0,0);
17391749}
17401750
17411751int arcompact_handle18_01_dasm(DASM_OPS_16)
17421752{
1743   return arcompact_handle18_0x_helper_dasm(DASM_PARAMS, "LDB_S", 0);
1753   return arcompact_handle18_0x_helper_dasm(DASM_PARAMS, "LDB_S", 0,0);
17441754}
17451755
17461756int arcompact_handle18_02_dasm(DASM_OPS_16)
17471757{
1748   return arcompact_handle18_0x_helper_dasm(DASM_PARAMS, "ST_S", 1);
1758   return arcompact_handle18_0x_helper_dasm(DASM_PARAMS, "ST_S", 1,0);
17491759}
17501760
17511761int arcompact_handle18_03_dasm(DASM_OPS_16)
17521762{
1753   return arcompact_handle18_0x_helper_dasm(DASM_PARAMS, "STB_S", 1);
1763   return arcompact_handle18_0x_helper_dasm(DASM_PARAMS, "STB_S", 1,0);
17541764}
17551765
17561766int arcompact_handle18_04_dasm(DASM_OPS_16)
17571767{
1758   return arcompact_handle18_0x_helper_dasm(DASM_PARAMS, "ADD_S", 1); // check format
1768   return arcompact_handle18_0x_helper_dasm(DASM_PARAMS, "ADD_S", 1,1); // check format
17591769}
17601770
17611771// op bits remaining for 0x18_05_xx subgroups 0x001f


Previous 199869 Revisions Next


© 1997-2024 The MAME Team