and so we arrive at some code trying to set up hardware loops (nw)

This commit is contained in:
mamehaze 2014-12-24 14:56:17 +00:00
parent 44af5bcab7
commit fb31254e35
2 changed files with 96 additions and 13 deletions

View File

@ -80,7 +80,7 @@ void arcompact_device::execute_run()
int S_temp = (op & 0x0000003f) >> 0; \
int s_temp = (op & 0x00000fc0) >> 6; \
INT32 S = s_temp | (S_temp<<6); \
if (S & 0x800) S = -0x800 + (S&0x7ff) /* sign extend */ \
if (S & 0x800) S = -0x800 + (S&0x7ff); /* sign extend */ \
#define COMMON32_GET_CONDITION \
UINT8 condition = op & 0x0000001f;
@ -1784,6 +1784,35 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_helper(OPS_32, const char
/* 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?) */ \
#define SETUP_HANDLE04_0x_P10 \
int size = 4; \
UINT32 limm = 0; \
/* int got_limm = 0; */ \
\
COMMON32_GET_breg; \
COMMON32_GET_F; \
COMMON32_GET_s12; \
COMMON32_GET_areg; \
\
UINT32 b, c; \
\
/* is having b as LIMM valid here? LIMM vs. fixed u6 value makes no sense */ \
if (breg == LIMM_REG) \
{ \
GET_LIMM_32; \
size = 8; \
/* got_limm = 1; */ \
b = limm; \
} \
else \
{ \
b = m_regs[breg]; \
} \
\
c = (UINT32)S; \
\
/* 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?) */ \
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_00_p00(OPS_32)
{
@ -1880,8 +1909,14 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_04_p01(OPS_32)
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_04_p10(OPS_32)
{
int size = 4;
arcompact_fatal("arcompact_handle04_04_p10 (AND)\n");
SETUP_HANDLE04_0x_P10
m_regs[areg] = b & c;
if (F)
{
arcompact_fatal("arcompact_handle04_04_p10 (AND) (F set)\n"); // not yet supported
}
return m_pc + (size >> 0);
}
@ -1917,10 +1952,16 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_05_p00(OPS_32)
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_05_p01(OPS_32)
{
int size = 4;
arcompact_fatal("arcompact_handle04_05_p01 (OR)\n");
return m_pc + (size >> 0);
}
SETUP_HANDLE04_0x_P01
m_regs[areg] = b | c;
if (F)
{
arcompact_fatal("arcompact_handle04_05_p01 (OR) (F set)\n"); // not yet supported
}
return m_pc + (size >> 0);}
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_05_p10(OPS_32)
{
@ -2119,9 +2160,19 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_0a_p01(OPS_32)
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_0a_p10(OPS_32)
{
int size = 4;
arcompact_fatal("arcompact_handle04_0a_p10\n");
return m_pc + (size >> 0);
}
COMMON32_GET_breg;
COMMON32_GET_s12;
COMMON32_GET_F;
m_regs[breg] = S;
if (F)
{ // currently not supported
arcompact_fatal("unimplemented MOV.F b <- s12 %08x", op);
}
return m_pc + (size>>0);}
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle04_0a_p11_m0(OPS_32)
{
@ -3218,7 +3269,22 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_04(OPS_16) // AND_S b <-
return m_pc + (2 >> 0);
}
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_05(OPS_16) { return arcompact_handle0f_0x_helper(PARAMS, "OR_S",0); }
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_05(OPS_16) // OR_S b <- b,c
{
int breg, creg;
COMMON16_GET_breg;
COMMON16_GET_creg;
REG_16BIT_RANGE(breg);
REG_16BIT_RANGE(creg);
m_regs[breg] = m_regs[breg] | m_regs[creg];
return m_pc + (2 >> 0);
}
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_06(OPS_16) { return arcompact_handle0f_0x_helper(PARAMS, "BIC_S",0); }
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_07(OPS_16) { return arcompact_handle0f_0x_helper(PARAMS, "XOR_S",0); }
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle0f_0b(OPS_16) { return arcompact_handle0f_0x_helper(PARAMS, "TST_S",1); }
@ -3488,9 +3554,20 @@ ARCOMPACT_RETTYPE arcompact_device::arcompact_handle17_05(OPS_16)
return arcompact_handle_l7_0x_helper(PARAMS, "BCLR_S");
}
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle17_06(OPS_16)
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle17_06(OPS_16) // BMSK b,b,u5
{
return arcompact_handle_l7_0x_helper(PARAMS, "BSMK_S");
int breg, u;
COMMON16_GET_breg;
COMMON16_GET_u5;
REG_16BIT_RANGE(breg);
u &= 0x1f;
m_regs[breg] = m_regs[breg] | ((1 << (u + 1)) - 1);
return m_pc + (2 >> 0);
}
ARCOMPACT_RETTYPE arcompact_device::arcompact_handle17_07(OPS_16)

View File

@ -227,6 +227,11 @@ public:
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(leapster_cart);
DECLARE_DRIVER_INIT(leapster);
DECLARE_READ32_MEMBER(leapster_random_r)
{
return rand() | (rand()<<16); // there is a loop checking that this is above a certain value
}
protected:
required_device<cpu_device> m_maincpu;
required_device<generic_slot_device> m_cart;
@ -277,6 +282,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(0x0180D800, 0x0180D803) AM_READ(leapster_random_r)
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