mirror of
https://github.com/holub/mame
synced 2025-06-30 16:00:01 +03:00
m58.c: fixed 10yard save state problem, removed unneeded prefixes (nw)
This commit is contained in:
parent
65f54f1fd3
commit
9c54d546b1
@ -26,15 +26,15 @@
|
||||
|
||||
static ADDRESS_MAP_START( yard_map, AS_PROGRAM, 8, m58_state )
|
||||
AM_RANGE(0x0000, 0x5fff) AM_ROM
|
||||
AM_RANGE(0x8000, 0x8fff) AM_RAM_WRITE(yard_videoram_w) AM_SHARE("videoram")
|
||||
AM_RANGE(0x9000, 0x9fff) AM_WRITE(yard_scroll_panel_w)
|
||||
AM_RANGE(0x8000, 0x8fff) AM_RAM_WRITE(videoram_w) AM_SHARE("videoram")
|
||||
AM_RANGE(0x9000, 0x9fff) AM_WRITE(scroll_panel_w)
|
||||
AM_RANGE(0xc820, 0xc87f) AM_RAM AM_SHARE("spriteram")
|
||||
AM_RANGE(0xa000, 0xa000) AM_RAM AM_SHARE("scroll_x_low")
|
||||
AM_RANGE(0xa200, 0xa200) AM_RAM AM_SHARE("scroll_x_high")
|
||||
AM_RANGE(0xa400, 0xa400) AM_RAM AM_SHARE("scroll_y_low")
|
||||
AM_RANGE(0xa800, 0xa800) AM_RAM AM_SHARE("score_disable")
|
||||
AM_RANGE(0xd000, 0xd000) AM_DEVWRITE("irem_audio", irem_audio_device, cmd_w)
|
||||
AM_RANGE(0xd001, 0xd001) AM_WRITE(yard_flipscreen_w) /* + coin counters */
|
||||
AM_RANGE(0xd001, 0xd001) AM_WRITE(flipscreen_w) /* + coin counters */
|
||||
AM_RANGE(0xd000, 0xd000) AM_READ_PORT("IN0")
|
||||
AM_RANGE(0xd001, 0xd001) AM_READ_PORT("IN1")
|
||||
AM_RANGE(0xd002, 0xd002) AM_READ_PORT("IN2")
|
||||
@ -203,7 +203,7 @@ static MACHINE_CONFIG_START( yard, m58_state )
|
||||
|
||||
MCFG_SCREEN_ADD("screen", RASTER)
|
||||
MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK/3, 384, 0, 256, 282, 42, 266)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(m58_state, screen_update_yard)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(m58_state, screen_update)
|
||||
MCFG_SCREEN_PALETTE("palette")
|
||||
|
||||
/* sound hardware */
|
||||
|
@ -3,42 +3,47 @@ class m58_state : public driver_device
|
||||
public:
|
||||
m58_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag),
|
||||
m_videoram(*this, "videoram"),
|
||||
m_spriteram(*this, "spriteram"),
|
||||
m_yard_scroll_x_low(*this, "scroll_x_low"),
|
||||
m_yard_scroll_x_high(*this, "scroll_x_high"),
|
||||
m_yard_scroll_y_low(*this, "scroll_y_low"),
|
||||
m_yard_score_panel_disabled(*this, "score_disable"),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_gfxdecode(*this, "gfxdecode"),
|
||||
m_screen(*this, "screen"),
|
||||
m_palette(*this, "palette") { }
|
||||
|
||||
/* memory pointers */
|
||||
required_shared_ptr<UINT8> m_videoram;
|
||||
required_shared_ptr<UINT8> m_spriteram;
|
||||
|
||||
/* video-related */
|
||||
tilemap_t* m_bg_tilemap;
|
||||
|
||||
required_shared_ptr<UINT8> m_yard_scroll_x_low;
|
||||
required_shared_ptr<UINT8> m_yard_scroll_x_high;
|
||||
required_shared_ptr<UINT8> m_yard_scroll_y_low;
|
||||
required_shared_ptr<UINT8> m_yard_score_panel_disabled;
|
||||
bitmap_ind16 *m_scroll_panel_bitmap;
|
||||
DECLARE_WRITE8_MEMBER(yard_videoram_w);
|
||||
DECLARE_WRITE8_MEMBER(yard_scroll_panel_w);
|
||||
DECLARE_WRITE8_MEMBER(yard_flipscreen_w);
|
||||
DECLARE_DRIVER_INIT(yard85);
|
||||
TILE_GET_INFO_MEMBER(yard_get_bg_tile_info);
|
||||
TILEMAP_MAPPER_MEMBER(yard_tilemap_scan_rows);
|
||||
virtual void video_start();
|
||||
DECLARE_PALETTE_INIT(m58);
|
||||
UINT32 screen_update_yard(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect );
|
||||
void draw_panel( bitmap_ind16 &bitmap, const rectangle &cliprect );
|
||||
m_palette(*this, "palette"),
|
||||
m_videoram(*this, "videoram"),
|
||||
m_spriteram(*this, "spriteram"),
|
||||
m_scroll_x_low(*this, "scroll_x_low"),
|
||||
m_scroll_x_high(*this, "scroll_x_high"),
|
||||
m_scroll_y_low(*this, "scroll_y_low"),
|
||||
m_score_panel_disabled(*this, "score_disable") { }
|
||||
|
||||
/* devices */
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
required_device<screen_device> m_screen;
|
||||
required_device<palette_device> m_palette;
|
||||
|
||||
/* memory pointers */
|
||||
required_shared_ptr<UINT8> m_videoram;
|
||||
required_shared_ptr<UINT8> m_spriteram;
|
||||
required_shared_ptr<UINT8> m_scroll_x_low;
|
||||
required_shared_ptr<UINT8> m_scroll_x_high;
|
||||
required_shared_ptr<UINT8> m_scroll_y_low;
|
||||
required_shared_ptr<UINT8> m_score_panel_disabled;
|
||||
|
||||
/* video-related */
|
||||
tilemap_t* m_bg_tilemap;
|
||||
bitmap_ind16 m_scroll_panel_bitmap;
|
||||
|
||||
DECLARE_WRITE8_MEMBER(videoram_w);
|
||||
DECLARE_WRITE8_MEMBER(scroll_panel_w);
|
||||
DECLARE_WRITE8_MEMBER(flipscreen_w);
|
||||
|
||||
DECLARE_DRIVER_INIT(yard85);
|
||||
virtual void video_start();
|
||||
DECLARE_PALETTE_INIT(m58);
|
||||
|
||||
TILE_GET_INFO_MEMBER(get_bg_tile_info);
|
||||
TILEMAP_MAPPER_MEMBER(tilemap_scan_rows);
|
||||
|
||||
UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect );
|
||||
void draw_panel( bitmap_ind16 &bitmap, const rectangle &cliprect );
|
||||
};
|
||||
|
@ -102,14 +102,14 @@ PALETTE_INIT_MEMBER(m58_state, m58)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
WRITE8_MEMBER(m58_state::yard_videoram_w)
|
||||
WRITE8_MEMBER(m58_state::videoram_w)
|
||||
{
|
||||
m_videoram[offset] = data;
|
||||
m_bg_tilemap->mark_tile_dirty(offset / 2);
|
||||
}
|
||||
|
||||
|
||||
WRITE8_MEMBER(m58_state::yard_scroll_panel_w)
|
||||
WRITE8_MEMBER(m58_state::scroll_panel_w)
|
||||
{
|
||||
int sx,sy,i;
|
||||
|
||||
@ -128,7 +128,7 @@ WRITE8_MEMBER(m58_state::yard_scroll_panel_w)
|
||||
col = (data >> i) & 0x11;
|
||||
col = ((col >> 3) | col) & 3;
|
||||
|
||||
m_scroll_panel_bitmap->pix16(sy, sx + i) = RADAR_PALETTE_BASE + (sy & 0xfc) + col;
|
||||
m_scroll_panel_bitmap.pix16(sy, sx + i) = RADAR_PALETTE_BASE + (sy & 0xfc) + col;
|
||||
}
|
||||
}
|
||||
|
||||
@ -140,7 +140,7 @@ WRITE8_MEMBER(m58_state::yard_scroll_panel_w)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
TILE_GET_INFO_MEMBER(m58_state::yard_get_bg_tile_info)
|
||||
TILE_GET_INFO_MEMBER(m58_state::get_bg_tile_info)
|
||||
{
|
||||
int offs = tile_index * 2;
|
||||
int attr = m_videoram[offs + 1];
|
||||
@ -152,7 +152,7 @@ TILE_GET_INFO_MEMBER(m58_state::yard_get_bg_tile_info)
|
||||
}
|
||||
|
||||
|
||||
TILEMAP_MAPPER_MEMBER(m58_state::yard_tilemap_scan_rows)
|
||||
TILEMAP_MAPPER_MEMBER(m58_state::tilemap_scan_rows)
|
||||
{
|
||||
/* logical (col,row) -> memory offset */
|
||||
if (col >= 32)
|
||||
@ -175,11 +175,13 @@ void m58_state::video_start()
|
||||
int height = m_screen->height();
|
||||
const rectangle &visarea = m_screen->visible_area();
|
||||
|
||||
m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(m58_state::yard_get_bg_tile_info),this), tilemap_mapper_delegate(FUNC(m58_state::yard_tilemap_scan_rows),this), 8, 8, 64, 32);
|
||||
m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(m58_state::get_bg_tile_info),this), tilemap_mapper_delegate(FUNC(m58_state::tilemap_scan_rows),this), 8, 8, 64, 32);
|
||||
m_bg_tilemap->set_scrolldx(visarea.min_x, width - (visarea.max_x + 1));
|
||||
m_bg_tilemap->set_scrolldy(visarea.min_y - 8, height + 16 - (visarea.max_y + 1));
|
||||
|
||||
m_scroll_panel_bitmap = auto_bitmap_ind16_alloc(machine(), SCROLL_PANEL_WIDTH, height);
|
||||
//m_scroll_panel_bitmap = auto_bitmap_ind16_alloc(machine(), SCROLL_PANEL_WIDTH, height);
|
||||
m_screen->register_screen_bitmap(m_scroll_panel_bitmap);
|
||||
save_item(NAME(m_scroll_panel_bitmap));
|
||||
}
|
||||
|
||||
|
||||
@ -190,7 +192,7 @@ void m58_state::video_start()
|
||||
*
|
||||
*************************************/
|
||||
|
||||
WRITE8_MEMBER(m58_state::yard_flipscreen_w)
|
||||
WRITE8_MEMBER(m58_state::flipscreen_w)
|
||||
{
|
||||
/* screen flip is handled both by software and hardware */
|
||||
flip_screen_set((data & 0x01) ^ (~ioport("DSW2")->read() & 0x01));
|
||||
@ -265,7 +267,7 @@ void m58_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect )
|
||||
|
||||
void m58_state::draw_panel( bitmap_ind16 &bitmap, const rectangle &cliprect )
|
||||
{
|
||||
if (!*m_yard_score_panel_disabled)
|
||||
if (!*m_score_panel_disabled)
|
||||
{
|
||||
const rectangle clippanel(26*8, 32*8-1, 1*8, 31*8-1);
|
||||
const rectangle clippanelflip(0*8, 6*8-1, 1*8, 31*8-1);
|
||||
@ -278,7 +280,7 @@ void m58_state::draw_panel( bitmap_ind16 &bitmap, const rectangle &cliprect )
|
||||
clip.max_y += visarea.max_y + yoffs;
|
||||
clip &= cliprect;
|
||||
|
||||
copybitmap(bitmap, *m_scroll_panel_bitmap, flip_screen(), flip_screen(),
|
||||
copybitmap(bitmap, m_scroll_panel_bitmap, flip_screen(), flip_screen(),
|
||||
sx, visarea.min_y + yoffs, clip);
|
||||
}
|
||||
}
|
||||
@ -291,10 +293,10 @@ void m58_state::draw_panel( bitmap_ind16 &bitmap, const rectangle &cliprect )
|
||||
*
|
||||
*************************************/
|
||||
|
||||
UINT32 m58_state::screen_update_yard(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
UINT32 m58_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
m_bg_tilemap->set_scrollx(0, (*m_yard_scroll_x_high * 0x100) + *m_yard_scroll_x_low);
|
||||
m_bg_tilemap->set_scrolly(0, *m_yard_scroll_y_low);
|
||||
m_bg_tilemap->set_scrollx(0, (*m_scroll_x_high * 0x100) + *m_scroll_x_low);
|
||||
m_bg_tilemap->set_scrolly(0, *m_scroll_y_low);
|
||||
|
||||
m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
|
||||
draw_sprites(bitmap, cliprect);
|
||||
|
Loading…
Reference in New Issue
Block a user