diff options
author | mamehaze <mamehaze@users.noreply.github.com> | 2014-12-21 17:42:42 +0000 |
---|---|---|
committer | mamehaze <mamehaze@users.noreply.github.com> | 2014-12-21 17:42:42 +0000 |
commit | 464e61334b2d695b51df8d5d4dd33f41f29ec701 (patch) | |
tree | 8c9a0bcfa1136b2293141368bdac9b28a36059cf | |
parent | c0b0586d7c657f0f372c446a9e8cf7265237f627 (diff) |
couple more ops (nw)
-rw-r--r-- | src/emu/cpu/arcompact/arcompact_common.h | 3 | ||||
-rw-r--r-- | src/emu/cpu/arcompact/arcompact_execute.c | 91 | ||||
-rw-r--r-- | src/emu/cpu/arcompact/arcompactdasm_ops.c | 16 | ||||
-rw-r--r-- | src/mess/drivers/leapster.c | 1 |
4 files changed, 92 insertions, 19 deletions
diff --git a/src/emu/cpu/arcompact/arcompact_common.h b/src/emu/cpu/arcompact/arcompact_common.h index 1fd68144b58..8b7c4912cdf 100644 --- a/src/emu/cpu/arcompact/arcompact_common.h +++ b/src/emu/cpu/arcompact/arcompact_common.h @@ -15,4 +15,5 @@ extern const char *delaybit[0x2]; extern const char *regnames[0x40]; extern const char *opcodes_04[0x40]; -#define REG_BLINK (0x1f) // 31 +#define REG_BLINK (0x1f) // r31 +#define REG_SP (0x1c) // r28 diff --git a/src/emu/cpu/arcompact/arcompact_execute.c b/src/emu/cpu/arcompact/arcompact_execute.c index cf0c0fc602d..da2b5c3f786 100644 --- a/src/emu/cpu/arcompact/arcompact_execute.c +++ b/src/emu/cpu/arcompact/arcompact_execute.c @@ -120,6 +120,9 @@ void arcompact_device::execute_run() limm = (READ16((m_pc + 4) >> 1) << 16); \ limm |= READ16((m_pc + 6) >> 1); \ +#define GET_LIMM_16 \ + limm = (READ16((m_pc + 2) >> 1) << 16); \ + limm |= READ16((m_pc + 4) >> 1); \ #define PC_ALIGNED32 \ @@ -1228,10 +1231,19 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle03(OPS_32) int size = 4; //UINT32 limm = 0; int got_limm = 0; + int S = (op & 0x00008000) >> 15;// op &= ~0x00008000; + int s = (op & 0x00ff0000) >> 16;// op &= ~0x00ff0000; COMMON32_GET_breg; COMMON32_GET_creg; + if (S) s = -0x100 + s; + +// int R = (op & 0x00000001) >> 0; op &= ~0x00000001; // bit 0 is reserved + int Z = (op & 0x00000006) >> 1; op &= ~0x00000006; + int a = (op & 0x00000018) >> 3; op &= ~0x00000018; +// int D = (op & 0x00000020) >> 5; op &= ~0x00000020; // we don't use the data cache currently + if (breg == LIMM_REG) { //GET_LIMM_32; @@ -1252,7 +1264,27 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle03(OPS_32) } - arcompact_log("unimplemented ST %08x", op); + if (Z == 0) + { + UINT32 address = m_regs[breg] + s; + + WRITE32(address>>2, m_regs[creg]); + } + else if (Z == 1) + { + arcompact_fatal("illegal ST %08x (data size %d mode %d)", op, Z, a); + } + else if (Z == 2) + { + arcompact_fatal("illegal ST %08x (data size %d mode %d)", op, Z, a); + } + else + { + arcompact_fatal("illegal ST %08x (data size %d mode %d)", op, Z, a); + } + + // todo, handle 'a' increment modes + return m_pc + (size>>0); } @@ -1846,7 +1878,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_2b(OPS_32) // Store TO A { } - arcompact_log("unimplemented ST %08x", op); + arcompact_log("unimplemented SR %08x", op); return m_pc + (size>>0); } @@ -2164,9 +2196,36 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0e_00(OPS_16) return arcompact_handle0e_0x_helper(PARAMS, "ADD_S", 0); } -ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0e_01(OPS_16) +// 16-bit MOV with extended register range +ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0e_01(OPS_16) // MOV_S b <- h { - return arcompact_handle0e_0x_helper(PARAMS, "MOV_S", 0); + int h,breg; + int size = 2; + + GROUP_0e_GET_h; + COMMON16_GET_breg; + REG_16BIT_RANGE(breg); + + if (h == LIMM_REG) + { + // opcode iiii ibbb hhhI Ihhh + // MOV_S b, limm 0111 0bbb 1100 1111 [LIMM] (h == LIMM) + + UINT32 limm; + GET_LIMM_16; + size = 6; + + m_regs[breg] = limm; + + } + else + { + // opcode iiii ibbb hhhI Ihhh + // MOV_S b,h 0111 0bbb hhh0 1HHH + m_regs[breg] = m_regs[h]; + } + + return m_pc+ (size>>0); } ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0e_02(OPS_16) @@ -2176,7 +2235,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0e_02(OPS_16) ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0e_03(OPS_16) { - return arcompact_handle0e_0x_helper(PARAMS, "MOV_S", 1); + return arcompact_handle0e_0x_helper(PARAMS, "MOV_S (0e_03 type)", 1); } @@ -2403,15 +2462,27 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle18_06_11(OPS_16) // op bits remaining for 0x18_07_xx subgroups 0x0700 ARCOMPACT_RETTYPE arcompact_device::arcompact_handle18_07_01(OPS_16) { - arcompact_log("unimplemented PUSH_S %04x", op); - return m_pc + (2 >> 0);; + int breg; + COMMON16_GET_breg; + REG_16BIT_RANGE(breg); + + m_regs[REG_SP] -= 4; + + WRITE32(m_regs[REG_SP] >> 2, m_regs[breg]); + + return m_pc + (2 >> 0); } ARCOMPACT_RETTYPE arcompact_device::arcompact_handle18_07_11(OPS_16) { - arcompact_log("unimplemented PUSH_S [BLINK] %04x", op); - return m_pc + (2 >> 0);; + // breg bits are reserved + + m_regs[REG_SP] -= 4; + + WRITE32(m_regs[REG_SP] >> 2, m_regs[REG_BLINK]); + + return m_pc + (2 >> 0); } @@ -2434,7 +2505,7 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle1a(OPS_16) ARCOMPACT_RETTYPE arcompact_device::arcompact_handle1b(OPS_16) { - arcompact_log("unimplemented MOV_S %04x", op); + arcompact_log("unimplemented MOV_S (1b type) %04x", op); return m_pc + (2 >> 0);; } diff --git a/src/emu/cpu/arcompact/arcompactdasm_ops.c b/src/emu/cpu/arcompact/arcompactdasm_ops.c index a3a2b2fbd0e..5872ed78068 100644 --- a/src/emu/cpu/arcompact/arcompactdasm_ops.c +++ b/src/emu/cpu/arcompact/arcompactdasm_ops.c @@ -1476,13 +1476,13 @@ int arcompact_handle0e_0x_helper_dasm(DASM_OPS_16, const char* optext, int revop UINT32 limm; GET_LIMM; size = 6; - if (!revop) print("%s %s, (%08x) (%04x)", optext, regnames[breg], limm, op); - else print("%s (%08x), %s (%04x)", optext, limm, regnames[breg], op); + if (!revop) print("%s %s <- 0x%08x", optext, regnames[breg], limm); + else print("%s 0x%08x <- %s", optext, limm, regnames[breg]); } else { - if (!revop) print("%s %s, %s (%04x)", optext, regnames[breg], regnames[h], op); - else print("%s %s, %s (%04x)", optext, regnames[h], regnames[breg], op); + if (!revop) print("%s %s <- %s", optext, regnames[breg], regnames[h]); + else print("%s %s <- %s", optext, regnames[h], regnames[breg]); } @@ -1792,8 +1792,8 @@ int arcompact_handle18_05_01_dasm(DASM_OPS_16) // op bits remaining for 0x18_06_xx subgroups 0x0700 int arcompact_handle18_06_01_dasm(DASM_OPS_16) { - int breg = (op & 0x0700) >> 8; - op &= ~0x0700; // all bits now used + int breg; + COMMON16_GET_breg REG_16BIT_RANGE(breg) print("POP_S %s", regnames[breg]); @@ -1817,8 +1817,8 @@ int arcompact_handle18_06_11_dasm(DASM_OPS_16) // op bits remaining for 0x18_07_xx subgroups 0x0700 int arcompact_handle18_07_01_dasm(DASM_OPS_16) { - int breg = (op & 0x0700) >> 8; - op &= ~0x0700; // all bits now used + int breg; + COMMON16_GET_breg REG_16BIT_RANGE(breg) print("PUSH_S %s", regnames[breg]); diff --git a/src/mess/drivers/leapster.c b/src/mess/drivers/leapster.c index 27f0e970e4f..f90268d2568 100644 --- a/src/mess/drivers/leapster.c +++ b/src/mess/drivers/leapster.c @@ -277,6 +277,7 @@ void leapster_state::machine_reset() static ADDRESS_MAP_START( leapster_map, AS_PROGRAM, 32, leapster_state ) AM_RANGE(0x00000000, 0x001fffff) AM_ROM AM_MIRROR(0x40000000) // pointers in the bios region seem to be to the 40xxxxxx region, either we mirror there or something (real bios?) is acutally missing + AM_RANGE(0x03000000, 0x030007ff) AM_RAM // puts stack here, writes a pointer @ 0x03000000 on startup // AM_RANGE(0x80000000, 0x807fffff) AM_ROMBANK("cartrom") // game ROM pointers are all to the 80xxxxxx region, so I assume it maps here - installed if a cart is present ADDRESS_MAP_END |