Hooked up i8255 in Kikiippatsu Mayumi-chan [Angelo Salese]

This commit is contained in:
Angelo Salese 2012-08-13 17:21:58 +00:00
parent b09c883af7
commit e9d2512ba7
2 changed files with 71 additions and 43 deletions

View File

@ -132,6 +132,8 @@ private:
template<typename _PixelType, int _Width> void mode_graphic5(const pen_t *pens, _PixelType *ln, int line);
template<typename _PixelType, int _Width> void mode_graphic6(const pen_t *pens, _PixelType *ln, int line);
template<typename _PixelType, int _Width> void mode_graphic7(const pen_t *pens, _PixelType *ln, int line);
template<typename _PixelType, int _Width> void mode_yae(const pen_t *pens, _PixelType *ln, int line);
template<typename _PixelType, int _Width> void mode_yjk(const pen_t *pens, _PixelType *ln, int line);
template<typename _PixelType, int _Width> void mode_unknown(const pen_t *pens, _PixelType *ln, int line);
template<typename _PixelType, int _Width> void default_draw_sprite(const pen_t *pens, _PixelType *ln, UINT8 *col);
template<typename _PixelType, int _Width> void graphic5_draw_sprite(const pen_t *pens, _PixelType *ln, UINT8 *col);

View File

@ -10,8 +10,9 @@
#include "cpu/z80/z80.h"
#include "sound/2203intf.h"
#include "machine/nvram.h"
#include "machine/i8255.h"
#define MCLK 10000000
#define MCLK XTAL_10MHz
class mayumi_state : public driver_device
@ -19,10 +20,13 @@ class mayumi_state : public driver_device
public:
mayumi_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag) ,
m_videoram(*this, "videoram"){ }
m_videoram(*this, "videoram"),
m_i8255(*this, "i8255")
{ }
/* memory pointers */
required_shared_ptr<UINT8> m_videoram;
required_device<i8255_device> m_i8255;
// UINT8 * m_nvram; // this currently uses generic nvram handlers
/* video-related */
@ -31,10 +35,12 @@ public:
/* misc */
int m_int_enable;
int m_input_sel;
UINT8 key_matrix_r(UINT8 offset);
DECLARE_WRITE8_MEMBER(mayumi_videoram_w);
DECLARE_WRITE8_MEMBER(bank_sel_w);
DECLARE_WRITE8_MEMBER(input_sel_w);
DECLARE_READ8_MEMBER(key_matrix_r);
DECLARE_READ8_MEMBER(key_matrix_1p_r);
DECLARE_READ8_MEMBER(key_matrix_2p_r);
};
@ -103,33 +109,6 @@ WRITE8_MEMBER(mayumi_state::bank_sel_w)
flip_screen_set(data & 2);
}
WRITE8_MEMBER(mayumi_state::input_sel_w)
{
m_input_sel = data;
}
READ8_MEMBER(mayumi_state::key_matrix_r)
{
int p, i, ret;
static const char *const keynames[2][5] =
{
{ "KEY5", "KEY6", "KEY7", "KEY8", "KEY9" },
{ "KEY0", "KEY1", "KEY2", "KEY3", "KEY4" }
};
ret = 0xff;
p = ~m_input_sel & 0x1f;
for (i = 0; i < 5; i++)
{
if (BIT(p, i))
ret &= ioport(keynames[offset][i])->read();
}
return ret;
}
/*************************************
*
* Address maps
@ -147,9 +126,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( mayumi_io_map, AS_IO, 8, mayumi_state )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x30, 0x30) AM_READ_PORT("IN0") AM_WRITE(bank_sel_w)
AM_RANGE(0xc0, 0xc0) AM_WRITE(input_sel_w)
AM_RANGE(0xc1, 0xc2) AM_READ(key_matrix_r) // 0xc0-c3 8255ppi
AM_RANGE(0xc3, 0xc3) AM_WRITENOP // 0xc0-c3 8255ppi
AM_RANGE(0xc0, 0xc3) AM_DEVREADWRITE("i8255", i8255_device, read, write)
AM_RANGE(0xd0, 0xd1) AM_DEVREADWRITE_LEGACY("ymsnd", ym2203_r, ym2203_w)
ADDRESS_MAP_END
@ -302,6 +279,54 @@ static INPUT_PORTS_START( mayumi )
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SERVICE4 ) // memory reset
INPUT_PORTS_END
WRITE8_MEMBER(mayumi_state::input_sel_w)
{
m_input_sel = data;
}
UINT8 mayumi_state::key_matrix_r(UINT8 offset)
{
int p, i, ret;
static const char *const keynames[2][5] =
{
{ "KEY0", "KEY1", "KEY2", "KEY3", "KEY4" },
{ "KEY5", "KEY6", "KEY7", "KEY8", "KEY9" }
};
ret = 0xff;
p = ~m_input_sel & 0x1f;
for (i = 0; i < 5; i++)
{
if (BIT(p, i))
ret &= ioport(keynames[offset][i])->read();
}
return ret;
}
READ8_MEMBER(mayumi_state::key_matrix_1p_r)
{
return key_matrix_r(0);
}
READ8_MEMBER(mayumi_state::key_matrix_2p_r)
{
return key_matrix_r(1);
}
static I8255_INTERFACE(mayumi_i8255_intf)
{
DEVCB_NULL,
DEVCB_DRIVER_MEMBER(mayumi_state,input_sel_w),
DEVCB_DRIVER_MEMBER(mayumi_state,key_matrix_2p_r),
DEVCB_NULL,
DEVCB_DRIVER_MEMBER(mayumi_state,key_matrix_1p_r),
DEVCB_NULL,
};
/*************************************
*
* Graphics definitions
@ -311,9 +336,9 @@ INPUT_PORTS_END
static const gfx_layout charlayout =
{
8,8, /* 8*8 characters */
8192, /* 8192 characters */
RGN_FRAC(1,3), /* 8192 characters */
3, /* 3 bits per pixel */
{0x20000*8,0x10000*8,0},
{ RGN_FRAC(0,3),RGN_FRAC(1,3),RGN_FRAC(2,3) },
{ STEP8(0,1) },
{ STEP8(0,8) },
8*8
@ -353,7 +378,7 @@ static MACHINE_START( mayumi )
mayumi_state *state = machine.driver_data<mayumi_state>();
UINT8 *ROM = state->memregion("maincpu")->base();
state->membank("bank1")->configure_entries(0, 4, &ROM[0x10000], 0x4000);
state->membank("bank1")->configure_entries(0, 4, &ROM[0x8000], 0x4000);
state->membank("bank1")->set_entry(0);
state->save_item(NAME(state->m_int_enable));
@ -379,6 +404,8 @@ static MACHINE_CONFIG_START( mayumi, mayumi_state )
MCFG_MACHINE_START( mayumi )
MCFG_MACHINE_RESET( mayumi )
MCFG_I8255_ADD( "i8255", mayumi_i8255_intf )
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
@ -414,15 +441,14 @@ MACHINE_CONFIG_END
*************************************/
ROM_START( mayumi )
ROM_REGION( 0x20000, "maincpu", 0 ) /* CPU */
ROM_REGION( 0x18000, "maincpu", 0 ) /* CPU */
ROM_LOAD( "my00.bin", 0x00000, 0x08000, CRC(33189e37) SHA1(cbf75f56360ef7da5b7b1207b58cd0d72bcaf207) )
ROM_LOAD( "my01.bin", 0x10000, 0x10000, CRC(5280fb39) SHA1(cee7653f4353031701ec1608881b37073b178d9f) ) // Banked
ROM_COPY( "maincpu", 0x10000, 0x08000, 0x4000 )
ROM_LOAD( "my01.bin", 0x08000, 0x10000, CRC(5280fb39) SHA1(cee7653f4353031701ec1608881b37073b178d9f) ) // Banked
ROM_REGION( 0x30000, "gfx1", 0 ) /* gfx */
ROM_LOAD( "my10.bin", 0x00000, 0x10000, CRC(3b4f4f97) SHA1(50bda1484e965f15630bd2e05861d74ddeb0d88e) )
ROM_LOAD( "my30.bin", 0x00000, 0x10000, CRC(7f22d53f) SHA1(f8e5874ba0fa003ba0d6a504b2169acdf1491484) )
ROM_LOAD( "my20.bin", 0x10000, 0x10000, CRC(18544029) SHA1(74bd8bb422db33bd7af08afbf9b801bd31a3f199) )
ROM_LOAD( "my30.bin", 0x20000, 0x10000, CRC(7f22d53f) SHA1(f8e5874ba0fa003ba0d6a504b2169acdf1491484) )
ROM_LOAD( "my10.bin", 0x20000, 0x10000, CRC(3b4f4f97) SHA1(50bda1484e965f15630bd2e05861d74ddeb0d88e) )
ROM_REGION( 0x0300, "proms", 0 ) /* color PROMs */
ROM_LOAD( "my-9m.bin", 0x0000, 0x0100, CRC(b18fd669) SHA1(e2b1477c1bc49994b0b652d63a2205363aab9a74) ) // R