Previous 199869 Revisions Next

r34002 Sunday 21st December, 2014 at 21:57:14 UTC by David Haywood
arcompact: starts to read the 2 copyright strings in the bios for comparison (nw)
[src/emu/cpu/arcompact]arcompact.h arcompact_execute.c

trunk/src/emu/cpu/arcompact/arcompact.h
r242513r242514
788788   inline void WRITE32(UINT32 address, UINT32 data) { m_program->write_dword(address << 2, data); }
789789   inline UINT16 READ16(UINT32 address) { return m_program->read_word(address << 1); }
790790   inline void WRITE16(UINT32 address, UINT16 data){    m_program->write_word(address << 1, data); }
791   inline UINT8 READ8(UINT32 address) { return m_program->read_byte(address << 0); }
792   inline void WRITE8(UINT32 address, UINT8 data){    m_program->write_byte(address << 0, data); }
791793
792794   UINT32 m_regs[0x40];
793795
trunk/src/emu/cpu/arcompact/arcompact_execute.c
r242513r242514
12291229ARCOMPACT_RETTYPE arcompact_device::arcompact_handle03(OPS_32)
12301230{
12311231   int size = 4;
1232   //UINT32 limm = 0;
1232   UINT32 limm = 0;
12331233   int got_limm = 0;
1234   int S = (op & 0x00008000) >> 15;// op &= ~0x00008000;
1235   int s = (op & 0x00ff0000) >> 16;// op &= ~0x00ff0000;
1234   int S = (op & 0x00008000) >> 15;
1235   int s = (op & 0x00ff0000) >> 16;
12361236
12371237   COMMON32_GET_breg;
12381238   COMMON32_GET_creg;
12391239
12401240   if (S) s = -0x100 + s;
12411241
1242//   int R = (op & 0x00000001) >> 0; op &= ~0x00000001; // bit 0 is reserved
1243   int Z = (op & 0x00000006) >> 1; op &= ~0x00000006;
1244   int a = (op & 0x00000018) >> 3; op &= ~0x00000018;
1245//   int D = (op & 0x00000020) >> 5; op &= ~0x00000020; // we don't use the data cache currently
1242//   int R = (op & 0x00000001) >> 0; // bit 0 is reserved
1243   int Z = (op & 0x00000006) >> 1;
1244   int a = (op & 0x00000018) >> 3;
1245//   int D = (op & 0x00000020) >> 5; // we don't use the data cache currently
12461246
1247
1248   UINT32 address = m_regs[breg];
1249
12471250   if (breg == LIMM_REG)
12481251   {
1249      //GET_LIMM_32;
1252      GET_LIMM_32;
12501253      size = 8;
12511254      got_limm = 1;
1255
1256      address = limm;
12521257   }
12531258
1259   UINT32 writedata = m_regs[creg];
1260
12541261   if (creg == LIMM_REG)
12551262   {
12561263      if (!got_limm)
12571264      {
1258         //GET_LIMM_32;
1265         GET_LIMM_32;
12591266         size = 8;
12601267      }
1268
1269      writedata = limm;
12611270   }
1262   else
1271
1272   // are LIMM addresses with 's' offset non-0 ('a' mode 0 / 3) legal?
1273   // not mentioned in docs..
1274
1275   // address manipulation
1276   if ((a == 0) || (a == 1))
12631277   {
1264
1278      address = address + s;
12651279   }
1280   else if (a == 2)
1281   {
1282      //address = address;
1283   }
1284   else if (a == 3)
1285   {
1286      if (Z == 0)
1287         address = address + (s << 2);
1288      else if (Z==2)
1289         address = address + (s << 1);
1290      else // Z == 1 and Z == 3 are invalid here
1291         arcompact_fatal("illegal ST %08x (data size %d mode %d)", op, Z, a);
1292   }
12661293
1294   // write data
12671295   if (Z == 0)
12681296   {
1269      UINT32 address = m_regs[breg] + s;
1270
1271      WRITE32(address>>2, m_regs[creg]);
1297      WRITE32(address >> 2, writedata);
12721298   }
12731299   else if (Z == 1)
12741300   {
1275      arcompact_fatal("illegal ST %08x (data size %d mode %d)", op, Z, a);
1301      WRITE8(address >> 0, writedata);
12761302   }
12771303   else if (Z == 2)
12781304   {
1305      WRITE16(address >> 1, writedata);
1306   }
1307   else if (Z == 3)
1308   { // Z == 3 is always illegal
12791309      arcompact_fatal("illegal ST %08x (data size %d mode %d)", op, Z, a);
12801310   }
1281   else
1311
1312   // writeback / increment
1313   if ((a == 1) || (a == 2))
12821314   {
1283      arcompact_fatal("illegal ST %08x (data size %d mode %d)", op, Z, a);
1315      if (breg==limm)
1316         arcompact_fatal("illegal ST %08x (data size %d mode %d)", op, Z, a); // using the LIMM as the base register and an increment mode is illegal
1317
1318      m_regs[breg] = m_regs[breg] + s;
12841319   }
12851320
1286   // todo, handle 'a' increment modes
1287
12881321   return m_pc + (size>>0);
12891322
12901323}
r242513r242514
21122145
21132146ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0c_helper(OPS_16, const char* optext)
21142147{
2115   arcompact_log("unimplemented %s %04x", optext, op);
2148   arcompact_log("unimplemented %s %04x (0x0c group)", optext, op);
21162149   return m_pc + (2 >> 0);;
21172150}
21182151
r242513r242514
23152348
23162349ARCOMPACT_RETTYPE arcompact_device::arcompact_handle_ld_helper(OPS_16, const char* optext, int shift, int swap)
23172350{
2318   arcompact_log("unimplemented %s %04x", optext, op);
2351   arcompact_log("unimplemented %s %04x (ld/st group %d %d)", optext, op, shift, swap);
23192352   return m_pc + (2 >> 0);;
23202353}
23212354
23222355
23232356ARCOMPACT_RETTYPE arcompact_device::arcompact_handle10(OPS_16)
2324{
2325   return arcompact_handle_ld_helper(PARAMS, "LD_S", 2, 0);
2357{ // LD_S c, [b, u7]
2358   int breg, creg, u;
2359
2360   COMMON16_GET_breg;
2361   COMMON16_GET_creg;
2362   COMMON16_GET_u5;
2363
2364   REG_16BIT_RANGE(breg);
2365   REG_16BIT_RANGE(creg);
2366
2367   u <<= 2; // check
2368   m_regs[creg] = READ32((m_regs[breg] + u) >> 2);
2369
2370   return m_pc + (2 >> 0);
23262371}
23272372
23282373ARCOMPACT_RETTYPE arcompact_device::arcompact_handle11(OPS_16)
23292374{
2330   return arcompact_handle_ld_helper(PARAMS, "LDB_S", 0, 0);
2375 // LDB_S c, [b, u5]
2376   int breg, creg, u;
2377
2378   COMMON16_GET_breg;
2379   COMMON16_GET_creg;
2380   COMMON16_GET_u5;
2381
2382   REG_16BIT_RANGE(breg);
2383   REG_16BIT_RANGE(creg);
2384
2385//   u <<= 0; // check
2386   m_regs[creg] = READ8((m_regs[breg] + u) >> 0);
2387
2388   return m_pc + (2 >> 0);
23312389}
23322390
23332391ARCOMPACT_RETTYPE arcompact_device::arcompact_handle12(OPS_16)
r242513r242514
24042462
24052463ARCOMPACT_RETTYPE arcompact_device::arcompact_handle18_0x_helper(OPS_16, const char* optext, int st)
24062464{
2407   arcompact_log("unimplemented %s %04x", optext, op);
2465   arcompact_log("unimplemented %s %04x (0x18_0x group)", optext, op);
24082466   return m_pc + (2 >> 0);;
24092467}
24102468
r242513r242514
24882546
24892547ARCOMPACT_RETTYPE arcompact_device::arcompact_handle19_0x_helper(OPS_16, const char* optext, int shift, int format)
24902548{
2491   arcompact_log("unimplemented %s %04x", optext, op);
2549   arcompact_log("unimplemented %s %04x (0x19_0x group)", optext, op);
24922550   return m_pc + (2 >> 0);;
24932551}
24942552


Previous 199869 Revisions Next


© 1997-2024 The MAME Team