mirror of
https://github.com/holub/mame
synced 2025-04-25 01:40:16 +03:00
chaknpop.c: enabled save state support, removed unneeded prefixes (nw)
This commit is contained in:
parent
6cd609036f
commit
e488210011
@ -143,19 +143,19 @@ WRITE8_MEMBER(chaknpop_state::coinlock_w)
|
||||
static ADDRESS_MAP_START( chaknpop_map, AS_PROGRAM, 8, chaknpop_state )
|
||||
AM_RANGE(0x0000, 0x7fff) AM_ROM
|
||||
AM_RANGE(0x8000, 0x87ff) AM_RAM AM_SHARE("mcu_ram")
|
||||
AM_RANGE(0x8800, 0x8800) AM_READWRITE(chaknpop_mcu_port_a_r, chaknpop_mcu_port_a_w)
|
||||
AM_RANGE(0x8801, 0x8801) AM_READWRITE(chaknpop_mcu_port_b_r, chaknpop_mcu_port_b_w)
|
||||
AM_RANGE(0x8802, 0x8802) AM_READWRITE(chaknpop_mcu_port_c_r, chaknpop_mcu_port_c_w)
|
||||
AM_RANGE(0x8800, 0x8800) AM_READWRITE(mcu_port_a_r, mcu_port_a_w)
|
||||
AM_RANGE(0x8801, 0x8801) AM_READWRITE(mcu_port_b_r, mcu_port_b_w)
|
||||
AM_RANGE(0x8802, 0x8802) AM_READWRITE(mcu_port_c_r, mcu_port_c_w)
|
||||
AM_RANGE(0x8804, 0x8805) AM_DEVREADWRITE("ay1", ay8910_device, data_r, address_data_w)
|
||||
AM_RANGE(0x8806, 0x8807) AM_DEVREADWRITE("ay2", ay8910_device, data_r, address_data_w)
|
||||
AM_RANGE(0x8808, 0x8808) AM_READ_PORT("DSWC")
|
||||
AM_RANGE(0x8809, 0x8809) AM_READ_PORT("P1")
|
||||
AM_RANGE(0x880a, 0x880a) AM_READ_PORT("SYSTEM")
|
||||
AM_RANGE(0x880b, 0x880b) AM_READ_PORT("P2")
|
||||
AM_RANGE(0x880c, 0x880c) AM_READWRITE(chaknpop_gfxmode_r, chaknpop_gfxmode_w)
|
||||
AM_RANGE(0x880c, 0x880c) AM_READWRITE(gfxmode_r, gfxmode_w)
|
||||
AM_RANGE(0x880d, 0x880d) AM_WRITE(coinlock_w) // coin lock out
|
||||
AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(chaknpop_txram_w) AM_SHARE("tx_ram") // TX tilemap
|
||||
AM_RANGE(0x9800, 0x983f) AM_RAM_WRITE(chaknpop_attrram_w) AM_SHARE("attr_ram") // Color attribute
|
||||
AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(txram_w) AM_SHARE("tx_ram") // TX tilemap
|
||||
AM_RANGE(0x9800, 0x983f) AM_RAM_WRITE(attrram_w) AM_SHARE("attr_ram") // Color attribute
|
||||
AM_RANGE(0x9840, 0x98ff) AM_RAM AM_SHARE("spr_ram") // sprite
|
||||
AM_RANGE(0xa000, 0xbfff) AM_ROM
|
||||
AM_RANGE(0xc000, 0xffff) AM_RAMBANK("bank1") // bitmap plane 1-4
|
||||
@ -362,7 +362,7 @@ static MACHINE_CONFIG_START( chaknpop, chaknpop_state )
|
||||
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
|
||||
MCFG_SCREEN_SIZE(32*8, 32*8)
|
||||
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(chaknpop_state, screen_update_chaknpop)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(chaknpop_state, screen_update)
|
||||
MCFG_SCREEN_PALETTE("palette")
|
||||
|
||||
MCFG_GFXDECODE_ADD("gfxdecode", "palette", chaknpop)
|
||||
@ -416,4 +416,4 @@ ROM_END
|
||||
|
||||
|
||||
/* ( YEAR NAME PARENT MACHINE INPUT INIT MONITOR COMPANY FULLNAME ) */
|
||||
GAME( 1983, chaknpop, 0, chaknpop, chaknpop, driver_device, 0, ROT0, "Taito Corporation", "Chack'n Pop", 0 )
|
||||
GAME( 1983, chaknpop, 0, chaknpop, chaknpop, driver_device, 0, ROT0, "Taito Corporation", "Chack'n Pop", GAME_SUPPORTS_SAVE )
|
||||
|
@ -8,13 +8,18 @@ class chaknpop_state : public driver_device
|
||||
public:
|
||||
chaknpop_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_gfxdecode(*this, "gfxdecode"),
|
||||
m_palette(*this, "palette"),
|
||||
m_mcu_ram(*this, "mcu_ram"),
|
||||
m_tx_ram(*this, "tx_ram"),
|
||||
m_attr_ram(*this, "attr_ram"),
|
||||
m_spr_ram(*this, "spr_ram"),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_gfxdecode(*this, "gfxdecode"),
|
||||
m_palette(*this, "palette") { }
|
||||
m_spr_ram(*this, "spr_ram") { }
|
||||
|
||||
/* devices */
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
required_device<palette_device> m_palette;
|
||||
|
||||
/* memory pointers */
|
||||
required_shared_ptr<UINT8> m_mcu_ram;
|
||||
@ -37,30 +42,31 @@ public:
|
||||
UINT8 m_gfxmode;
|
||||
UINT8 m_flip_x;
|
||||
UINT8 m_flip_y;
|
||||
|
||||
DECLARE_WRITE8_MEMBER(coinlock_w);
|
||||
DECLARE_READ8_MEMBER(chaknpop_mcu_port_a_r);
|
||||
DECLARE_READ8_MEMBER(chaknpop_mcu_port_b_r);
|
||||
DECLARE_READ8_MEMBER(chaknpop_mcu_port_c_r);
|
||||
DECLARE_WRITE8_MEMBER(chaknpop_mcu_port_a_w);
|
||||
DECLARE_WRITE8_MEMBER(chaknpop_mcu_port_b_w);
|
||||
DECLARE_WRITE8_MEMBER(chaknpop_mcu_port_c_w);
|
||||
DECLARE_READ8_MEMBER(chaknpop_gfxmode_r);
|
||||
DECLARE_WRITE8_MEMBER(chaknpop_gfxmode_w);
|
||||
DECLARE_WRITE8_MEMBER(chaknpop_txram_w);
|
||||
DECLARE_WRITE8_MEMBER(chaknpop_attrram_w);
|
||||
DECLARE_READ8_MEMBER(mcu_port_a_r);
|
||||
DECLARE_READ8_MEMBER(mcu_port_b_r);
|
||||
DECLARE_READ8_MEMBER(mcu_port_c_r);
|
||||
DECLARE_WRITE8_MEMBER(mcu_port_a_w);
|
||||
DECLARE_WRITE8_MEMBER(mcu_port_b_w);
|
||||
DECLARE_WRITE8_MEMBER(mcu_port_c_w);
|
||||
DECLARE_READ8_MEMBER(gfxmode_r);
|
||||
DECLARE_WRITE8_MEMBER(gfxmode_w);
|
||||
DECLARE_WRITE8_MEMBER(txram_w);
|
||||
DECLARE_WRITE8_MEMBER(attrram_w);
|
||||
DECLARE_WRITE8_MEMBER(unknown_port_1_w);
|
||||
DECLARE_WRITE8_MEMBER(unknown_port_2_w);
|
||||
TILE_GET_INFO_MEMBER(chaknpop_get_tx_tile_info);
|
||||
TILE_GET_INFO_MEMBER(get_tx_tile_info);
|
||||
|
||||
virtual void machine_start();
|
||||
virtual void machine_reset();
|
||||
virtual void video_start();
|
||||
DECLARE_PALETTE_INIT(chaknpop);
|
||||
UINT32 screen_update_chaknpop(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
|
||||
UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
void tx_tilemap_mark_all_dirty();
|
||||
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
|
||||
void draw_bitmap( bitmap_ind16 &bitmap, const rectangle &cliprect );
|
||||
void mcu_update_seed( UINT8 data );
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
required_device<palette_device> m_palette;
|
||||
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
void draw_bitmap(bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
|
||||
void mcu_update_seed(UINT8 data);
|
||||
};
|
||||
|
@ -63,27 +63,27 @@ void chaknpop_state::mcu_update_seed( UINT8 data )
|
||||
Memory handlers
|
||||
***************************************************************************/
|
||||
|
||||
READ8_MEMBER(chaknpop_state::chaknpop_mcu_port_a_r)
|
||||
READ8_MEMBER(chaknpop_state::mcu_port_a_r)
|
||||
{
|
||||
//logerror("%04x: MCU port_a read\n", space.device().safe_pc());
|
||||
return m_mcu_result;
|
||||
}
|
||||
|
||||
|
||||
READ8_MEMBER(chaknpop_state::chaknpop_mcu_port_b_r)
|
||||
READ8_MEMBER(chaknpop_state::mcu_port_b_r)
|
||||
{
|
||||
//logerror("%04x: MCU port_b read\n", space.device().safe_pc());
|
||||
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
READ8_MEMBER(chaknpop_state::chaknpop_mcu_port_c_r)
|
||||
READ8_MEMBER(chaknpop_state::mcu_port_c_r)
|
||||
{
|
||||
//logerror("%04x: MCU port_c read\n", space.device().safe_pc());
|
||||
return 0x00;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(chaknpop_state::chaknpop_mcu_port_a_w)
|
||||
WRITE8_MEMBER(chaknpop_state::mcu_port_a_w)
|
||||
{
|
||||
UINT8 mcu_command;
|
||||
|
||||
@ -131,12 +131,12 @@ WRITE8_MEMBER(chaknpop_state::chaknpop_mcu_port_a_w)
|
||||
}
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(chaknpop_state::chaknpop_mcu_port_b_w)
|
||||
WRITE8_MEMBER(chaknpop_state::mcu_port_b_w)
|
||||
{
|
||||
//logerror("%04x: MCU port_b write 0x%02x\n", space.device().safe_pc(), data);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(chaknpop_state::chaknpop_mcu_port_c_w)
|
||||
WRITE8_MEMBER(chaknpop_state::mcu_port_c_w)
|
||||
{
|
||||
//logerror("%04x: MCU port_c write 0x%02x\n", space.device().safe_pc(), data);
|
||||
}
|
||||
|
@ -25,9 +25,8 @@
|
||||
PALETTE_INIT_MEMBER(chaknpop_state, chaknpop)
|
||||
{
|
||||
const UINT8 *color_prom = memregion("proms")->base();
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 1024; i++)
|
||||
|
||||
for (int i = 0; i < 1024; i++)
|
||||
{
|
||||
int col, r, g, b;
|
||||
int bit0, bit1, bit2;
|
||||
@ -66,12 +65,12 @@ void chaknpop_state::tx_tilemap_mark_all_dirty()
|
||||
m_tx_tilemap->set_flip(m_flip_x | m_flip_y);
|
||||
}
|
||||
|
||||
READ8_MEMBER(chaknpop_state::chaknpop_gfxmode_r)
|
||||
READ8_MEMBER(chaknpop_state::gfxmode_r)
|
||||
{
|
||||
return m_gfxmode;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(chaknpop_state::chaknpop_gfxmode_w)
|
||||
WRITE8_MEMBER(chaknpop_state::gfxmode_w)
|
||||
{
|
||||
if (m_gfxmode != data)
|
||||
{
|
||||
@ -97,13 +96,13 @@ WRITE8_MEMBER(chaknpop_state::chaknpop_gfxmode_w)
|
||||
}
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(chaknpop_state::chaknpop_txram_w)
|
||||
WRITE8_MEMBER(chaknpop_state::txram_w)
|
||||
{
|
||||
m_tx_ram[offset] = data;
|
||||
m_tx_tilemap->mark_tile_dirty(offset);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(chaknpop_state::chaknpop_attrram_w)
|
||||
WRITE8_MEMBER(chaknpop_state::attrram_w)
|
||||
{
|
||||
if (m_attr_ram[offset] != data)
|
||||
{
|
||||
@ -123,7 +122,7 @@ WRITE8_MEMBER(chaknpop_state::chaknpop_attrram_w)
|
||||
* I'm not sure how to handle attributes about color
|
||||
*/
|
||||
|
||||
TILE_GET_INFO_MEMBER(chaknpop_state::chaknpop_get_tx_tile_info)
|
||||
TILE_GET_INFO_MEMBER(chaknpop_state::get_tx_tile_info)
|
||||
{
|
||||
int tile = m_tx_ram[tile_index];
|
||||
int tile_h_bank = (m_gfxmode & GFX_TX_BANK2) << 2; /* 0x00-0xff -> 0x200-0x2ff */
|
||||
@ -150,7 +149,7 @@ void chaknpop_state::video_start()
|
||||
UINT8 *RAM = memregion("maincpu")->base();
|
||||
|
||||
/* info offset type w h col row */
|
||||
m_tx_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(chaknpop_state::chaknpop_get_tx_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
|
||||
m_tx_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(chaknpop_state::get_tx_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
|
||||
|
||||
m_vram1 = &RAM[0x10000];
|
||||
m_vram2 = &RAM[0x12000];
|
||||
@ -175,10 +174,8 @@ void chaknpop_state::video_start()
|
||||
|
||||
void chaknpop_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
|
||||
{
|
||||
int offs;
|
||||
|
||||
/* Draw the sprites */
|
||||
for (offs = 0; offs < m_spr_ram.bytes(); offs += 4)
|
||||
for (int offs = 0; offs < m_spr_ram.bytes(); offs += 4)
|
||||
{
|
||||
int sx = m_spr_ram[offs + 3];
|
||||
int sy = 256 - 15 - m_spr_ram[offs];
|
||||
@ -246,7 +243,7 @@ void chaknpop_state::draw_bitmap( bitmap_ind16 &bitmap, const rectangle &cliprec
|
||||
}
|
||||
}
|
||||
|
||||
UINT32 chaknpop_state::screen_update_chaknpop(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
UINT32 chaknpop_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 0);
|
||||
draw_sprites(bitmap, cliprect);
|
||||
|
Loading…
Reference in New Issue
Block a user