Previous 199869 Revisions Next

r34168 Friday 2nd January, 2015 at 15:19:56 UTC by David Haywood
arcompact wip (nw)
[src/emu/cpu/arcompact]arcompact.c arcompact.h arcompact_execute.c arcompact_make.py

trunk/src/emu/cpu/arcompact/arcompact.c
r242679r242680
2424
2525const device_type ARCA5 = &device_creator<arcompact_device>;
2626
27
28READ32_MEMBER( arcompact_device::arcompact_auxreg002_LPSTART_r) { return m_LP_START&0xfffffffe; }
29WRITE32_MEMBER(arcompact_device::arcompact_auxreg002_LPSTART_w) { m_LP_START = data&0xfffffffe; }
30READ32_MEMBER( arcompact_device::arcompact_auxreg003_LPEND_r) { return m_LP_END&0xfffffffe; }
31WRITE32_MEMBER(arcompact_device::arcompact_auxreg003_LPEND_w) { m_LP_END = data&0xfffffffe; }
32
2733static ADDRESS_MAP_START( arcompact_auxreg_map, AS_IO, 32, arcompact_device )
34   AM_RANGE(0x000000008, 0x00000000b) AM_READWRITE(arcompact_auxreg002_LPSTART_r, arcompact_auxreg002_LPSTART_w)
35   AM_RANGE(0x00000000c, 0x00000000f) AM_READWRITE(arcompact_auxreg003_LPEND_r, arcompact_auxreg003_LPEND_w)
2836ADDRESS_MAP_END
2937
38//#define AUX_SPACE_ADDRESS_WIDTH 34  // IO space is 32 bits of dwords, so 34-bits
39#define AUX_SPACE_ADDRESS_WIDTH 64 // but the MAME core requires us to use power of 2 values for >32
3040
3141arcompact_device::arcompact_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
3242   : cpu_device(mconfig, ARCA5, "ARCtangent-A5", tag, owner, clock, "arca5", __FILE__)
3343   , m_program_config("program", ENDIANNESS_LITTLE, 32, 32, 0) // some docs describe these as 'middle endian'?!
34   , m_io_config( "io", ENDIANNESS_LITTLE, 32, 34, 0, ADDRESS_MAP_NAME( arcompact_auxreg_map ) ) // IO space is 32 bits of dwords, so 34-bits
44   , m_io_config( "io", ENDIANNESS_LITTLE, 32, AUX_SPACE_ADDRESS_WIDTH, 0, ADDRESS_MAP_NAME( arcompact_auxreg_map ) )
3545{
3646}
3747
trunk/src/emu/cpu/arcompact/arcompact.h
r242679r242680
6060public:
6161   // construction/destruction
6262   arcompact_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
63   
64   DECLARE_READ32_MEMBER( arcompact_auxreg002_LPSTART_r);
65   DECLARE_WRITE32_MEMBER(arcompact_auxreg002_LPSTART_w);
66   DECLARE_READ32_MEMBER( arcompact_auxreg003_LPEND_r);
67   DECLARE_WRITE32_MEMBER(arcompact_auxreg003_LPEND_w);
6368
6469protected:
6570   // device-level overrides
r242679r242680
174179   ARCOMPACT_RETTYPE arcompact_handle04_1c(OPS_32);
175180   ARCOMPACT_RETTYPE arcompact_handle04_1d(OPS_32);
176181//  ARCOMPACT_RETTYPE arcompact_handle04_20(OPS_32);
177   ARCOMPACT_RETTYPE arcompact_handle04_21(OPS_32);
182//   ARCOMPACT_RETTYPE arcompact_handle04_21(OPS_32);
178183   ARCOMPACT_RETTYPE arcompact_handle04_22(OPS_32);
179184   ARCOMPACT_RETTYPE arcompact_handle04_23(OPS_32);
180185   ARCOMPACT_RETTYPE arcompact_handle04_28(OPS_32);
181186   ARCOMPACT_RETTYPE arcompact_handle04_29(OPS_32);
182   ARCOMPACT_RETTYPE arcompact_handle04_2a(OPS_32);
187//   ARCOMPACT_RETTYPE arcompact_handle04_2a(OPS_32);
183188//  ARCOMPACT_RETTYPE arcompact_handle04_2b(OPS_32);
184189   ARCOMPACT_RETTYPE arcompact_handle04_2f_00(OPS_32);
185190   ARCOMPACT_RETTYPE arcompact_handle04_2f_01(OPS_32);
r242679r242680
760765   ARCOMPACT_RETTYPE arcompact_handle19_0x_helper(OPS_16, const char* optext, int shift, int format);
761766   ARCOMPACT_RETTYPE arcompact_handle1e_0x_helper(OPS_16, const char* optext);
762767   ARCOMPACT_RETTYPE arcompact_handle1e_03_0x_helper(OPS_16, const char* optext);
768   
763769
770   UINT32 handle_jump_to_addr(int delay, int link, UINT32 address, UINT32 next_addr);
771   UINT32 handle_jump_to_register(int delay, int link, UINT32 reg, UINT32 next_addr, int flag);
772
764773   ARCOMPACT_RETTYPE get_insruction(OPS_32);
765774
766775   ARCOMPACT_HANDLER04_TYPE_PM(04_00);
r242679r242680
780789   ARCOMPACT_HANDLER04_TYPE_PM(04_18);
781790   ARCOMPACT_HANDLER04_TYPE_PM(04_19);
782791   ARCOMPACT_HANDLER04_TYPE_PM(04_20);
792   ARCOMPACT_HANDLER04_TYPE_PM(04_21);
793   ARCOMPACT_HANDLER04_TYPE_PM(04_2a);
783794   ARCOMPACT_HANDLER04_TYPE_PM(04_2b);
784795
785796   ARCOMPACT_HANDLER04_TYPE_PM(04_2f_02);
trunk/src/emu/cpu/arcompact/arcompact_execute.c
r242679r242680
11281128
11291129// handlers
11301130
1131UINT32 arcompact_device::handle_jump_to_addr(int delay, int link, UINT32 address, UINT32 next_addr)
1132{
1133   if (delay)
1134   {
1135      m_delayactive = 1;
1136      m_delayjump = address;
1137      if (link) m_delaylinks = 1;
1138      else m_delaylinks = 0;
1139      return next_addr;
1140   }
1141   else
1142   {
1143      if (link) m_regs[REG_BLINK] = next_addr;
1144      return address;
1145   }
11311146
1147}
11321148
1149UINT32 arcompact_device::handle_jump_to_register(int delay, int link, UINT32 reg, UINT32 next_addr, int flag)
1150{
1151   if (reg == LIMM_REG)
1152      arcompact_fatal("handle_jump_to_register called with LIMM register, call handle_jump_to_addr instead");
1153
1154   if ((reg == REG_ILINK1) || (reg == REG_ILINK2))
1155   {
1156      if (flag)
1157      {
1158         arcompact_fatal("jump to ILINK1/ILINK2 not supported");
1159         return next_addr;
1160      }
1161      else
1162      {
1163         arcompact_fatal("illegal jump to ILINK1/ILINK2 not supported"); // FLAG bit must be set
1164         return next_addr;
1165      }
1166   }
1167   else
1168   {
1169      if (flag)
1170      {
1171         arcompact_fatal("illegal jump (flag bit set)"); // FLAG bit must NOT be set
1172         return next_addr;
1173      }
1174      else
1175      {
1176         //arcompact_fatal("jump not supported");
1177         UINT32 target = m_regs[reg];
1178         return handle_jump_to_addr(delay, link, target, next_addr);
1179      }
1180   }
1181
1182   return 0;
1183}
1184
11331185ARCOMPACT_RETTYPE arcompact_device::arcompact_handle00_00(OPS_32)
11341186{
11351187   int size = 4;
r242679r242680
20282080}
20292081
20302082
2083ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_21_p00(OPS_32)
2084{
2085   int size = 4;
2086   UINT32 limm = 0;
2087   int got_limm = 0;
20312088
2032ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_21(OPS_32)
2089   COMMON32_GET_creg
2090   COMMON32_GET_F
2091
2092   if (creg == LIMM_REG)
2093   {
2094      if (!got_limm)
2095      {
2096         GET_LIMM_32;
2097         size = 8;
2098      }
2099
2100      handle_jump_to_addr(1,0,limm, m_pc + (size>>0));
2101   }
2102   else
2103   {
2104      return handle_jump_to_register(1,0,creg, m_pc + (size>>0), F); // delay, no link
2105   }
2106
2107   return m_pc + (size>>0);
2108}
2109
2110ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_21_p01(OPS_32)
20332111{
2034   return arcompact_handle04_helper(PARAMS, opcodes_04[0x21], /*"J.D"*/ 1,1);
2112   int size = 4;
2113   arcompact_log("unimplemented J.D (u6 type) %08x", op);
2114   return m_pc + (size>>0);
20352115}
20362116
2117ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_21_p10(OPS_32)
2118{
2119   int size = 4;
2120   arcompact_log("unimplemented J.D (s12 type) %08x", op);
2121   return m_pc + (size>>0);
2122}
2123
2124
2125ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_21_p11_m0(OPS_32) // Jcc.D   (no link, delay)
2126{
2127   int size = 4;
2128   UINT32 limm = 0;
2129   int got_limm = 0;
2130
2131   COMMON32_GET_creg
2132   COMMON32_GET_CONDITION;
2133   COMMON32_GET_F
2134
2135   //UINT32 c = 0;
2136
2137   if (creg == LIMM_REG)
2138   {
2139      if (!got_limm)
2140      {
2141         GET_LIMM_32;
2142         size = 8;
2143      }
2144
2145   //   c = limm;
2146
2147   }
2148   else
2149   {
2150      // opcode          iiii i--- ppII IIII F--- cccc ccmq qqqq
2151      // Jcc [c]         0010 0RRR 1110 0000 0RRR CCCC CC0Q QQQQ
2152      // no conditional links to ILINK1, ILINK2?
2153
2154   //   c = m_regs[creg];
2155   }
2156
2157   if (!check_condition(condition))
2158      return m_pc + (size>>0);
2159
2160   if (!F)
2161   {
2162      // if F isn't set then the destination can't be ILINK1 or ILINK2
2163
2164      if ((creg == REG_ILINK1) || (creg == REG_ILINK1))
2165      {
2166         arcompact_log("unimplemented Jcc.D (p11_m0 type, illegal) %08x", op);
2167      }
2168      else
2169      {
2170         arcompact_log("unimplemented Jcc.D (p11_m0 type, unimplemented) %08x", op);
2171      }
2172   }
2173
2174   if (F)
2175   {
2176      // if F is set then the destination MUST be ILINK1 or ILINK2
2177
2178      if ((creg == REG_ILINK1) || (creg == REG_ILINK1))
2179      {
2180         arcompact_log("unimplemented Jcc.D.F (p11_m0 type, unimplemented) %08x", op);
2181      }
2182      else
2183      {
2184         arcompact_log("unimplemented Jcc.D.F (p11_m0 type, illegal) %08x", op);
2185      }
2186   }
2187
2188
2189   return m_pc + (size>>0);
2190}
2191
2192ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_21_p11_m1(OPS_32)
2193{
2194   int size = 4;
2195   arcompact_log("unimplemented arcompact_handle04_21_p11_m1 J.D %08x (u6)", op);
2196   return m_pc + (size>>0);
2197}
2198
2199
2200
20372201ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_22(OPS_32)
20382202{
20392203   return arcompact_handle04_helper(PARAMS, opcodes_04[0x22], /*"JL"*/ 1,1);
r242679r242680
20952259}
20962260
20972261
2098ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_2a(OPS_32)  // Load FROM Auxiliary register TO register
2099{
2100   int size = 4;
2101//  UINT32 limm = 0;
2102   int got_limm = 0;
2103
2104   COMMON32_GET_p;
2105   //COMMON32_GET_breg;
2106
2107   if (p == 0)
2108   {
2109      COMMON32_GET_creg
2110
2111      if (creg == LIMM_REG)
2112      {
2113         if (!got_limm)
2114         {
2115            //GET_LIMM_32;
2116            size = 8;
2117         }
2118
2119      }
2120      else
2121      {
2122      }
2123   }
2124   else if (p == 1)
2125   {
2126   }
2127   else if (p == 2)
2128   {
2129   }
2130   else if (p == 3)
2131   {
2132   }
2133
2134   arcompact_log("unimplemented LR %08x", op);
2135   return m_pc + (size>>0);
2136}
2137
2138
21392262ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_29(OPS_32)
21402263{
21412264   // leapster bios uses formats for FLAG that are not defined, bug I guess work anyway (P modes 0 / 1)
trunk/src/emu/cpu/arcompact/arcompact_make.py
r242679r242680
244244        EmitGroup04_Flaghandler(f,funcname,opname,flagcondition,flaghandler)
245245        print >>f, "   return m_pc + (size >> 0);"
246246        print >>f, "}"
247        print >>f, ""
248        print >>f, ""
247    print >>f, ""
248    print >>f, ""
249249    # the mode 0x11 m0 handler   
250250    print >>f, "ARCOMPACT_RETTYPE arcompact_device::arcompact_handle%s_p11_m0(OPS_32)" % (funcname)
251251    if ignore_a == 2:
r242679r242680
283283        EmitGroup04_Flaghandler(f,funcname,opname,flagcondition,flaghandler)
284284        print >>f, "   return m_pc + (size >> 0);"
285285        print >>f, "}"
286        print >>f, ""
287        print >>f, ""
286    print >>f, ""
287    print >>f, ""
288288
289289
290290# xxx_S  c, b, u3  format opcodes (note c is destination)
r242679r242680
305305    print >>f, ""
306306    print >>f, "   return m_pc + (2 >> 0);"
307307    print >>f, "}"
308    print >>f, ""
309    print >>f, ""
308310
309311
310312# xxx_S b <- b,c format opcodes
r242679r242680
324326    print >>f, ""
325327    print >>f, "   return m_pc + (2 >> 0);"
326328    print >>f, "}"
329    print >>f, ""
330    print >>f, ""
327331
328332
329333#  xxx_S b, b, u5 format opcodes
r242679r242680
377381EmitGroup04(f, "04_18", "SUB2", "UINT32 result = b - (c << 2);",          "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags  )
378382EmitGroup04(f, "04_19", "SUB3", "UINT32 result = b - (c << 3);",          "m_regs[areg] = result;", "m_regs[breg] = result;", 0,0, -1, EmitGroup04_unsupported_Flags  )
379383
380EmitGroup04(f, "04_2b", "SR", "WRITEAUX(c,b);", "", "", 1,0, -1, EmitGroup04_unsupported_Flags  ) # this can't be conditional (todo)
384EmitGroup04(f, "04_2a", "LR", "m_regs[breg] = READAUX(c);", "", "", 1,1, -1, EmitGroup04_no_Flags  ) # this can't be conditional (todo)
385EmitGroup04(f, "04_2b", "SR", "WRITEAUX(c,b);", "", "", 1,0, -1, EmitGroup04_no_Flags  ) # this can't be conditional (todo)
381386
382387
383388


Previous 199869 Revisions Next


© 1997-2024 The MAME Team