mirror of
https://github.com/holub/mame
synced 2025-04-19 15:11:37 +03:00
pacland.c: configured banking (nw)
This commit is contained in:
parent
7e3d024724
commit
323028f4ec
@ -195,20 +195,27 @@ Notes:
|
||||
#include "cpu/m6800/m6800.h"
|
||||
#include "includes/pacland.h"
|
||||
|
||||
WRITE8_MEMBER(pacland_state::pacland_subreset_w)
|
||||
|
||||
void pacland_state::machine_start()
|
||||
{
|
||||
save_item(NAME(m_main_irq_mask));
|
||||
save_item(NAME(m_mcu_irq_mask));
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(pacland_state::subreset_w)
|
||||
{
|
||||
int bit = !BIT(offset,11);
|
||||
m_mcu->set_input_line(INPUT_LINE_RESET, bit ? CLEAR_LINE : ASSERT_LINE);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(pacland_state::pacland_flipscreen_w)
|
||||
WRITE8_MEMBER(pacland_state::flipscreen_w)
|
||||
{
|
||||
int bit = !BIT(offset,11);
|
||||
flip_screen_set(bit);
|
||||
}
|
||||
|
||||
|
||||
READ8_MEMBER(pacland_state::pacland_input_r)
|
||||
READ8_MEMBER(pacland_state::input_r)
|
||||
{
|
||||
int shift = 4 * (offset & 1);
|
||||
int port = offset & 2;
|
||||
@ -219,20 +226,20 @@ READ8_MEMBER(pacland_state::pacland_input_r)
|
||||
return r;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(pacland_state::pacland_coin_w)
|
||||
WRITE8_MEMBER(pacland_state::coin_w)
|
||||
{
|
||||
coin_lockout_global_w(machine(), data & 1);
|
||||
coin_counter_w(machine(), 0, ~data & 2);
|
||||
coin_counter_w(machine(), 1, ~data & 4);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(pacland_state::pacland_led_w)
|
||||
WRITE8_MEMBER(pacland_state::led_w)
|
||||
{
|
||||
set_led_status(machine(), 0, data & 0x08);
|
||||
set_led_status(machine(), 1, data & 0x10);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(pacland_state::pacland_irq_1_ctrl_w)
|
||||
WRITE8_MEMBER(pacland_state::irq_1_ctrl_w)
|
||||
{
|
||||
int bit = !BIT(offset, 11);
|
||||
m_main_irq_mask = bit;
|
||||
@ -240,7 +247,7 @@ WRITE8_MEMBER(pacland_state::pacland_irq_1_ctrl_w)
|
||||
m_maincpu->set_input_line(0, CLEAR_LINE);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(pacland_state::pacland_irq_2_ctrl_w)
|
||||
WRITE8_MEMBER(pacland_state::irq_2_ctrl_w)
|
||||
{
|
||||
int bit = !BIT(offset, 13);
|
||||
m_mcu_irq_mask = bit;
|
||||
@ -251,19 +258,19 @@ WRITE8_MEMBER(pacland_state::pacland_irq_2_ctrl_w)
|
||||
|
||||
|
||||
static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, pacland_state )
|
||||
AM_RANGE(0x0000, 0x0fff) AM_RAM_WRITE(pacland_videoram_w) AM_SHARE("videoram")
|
||||
AM_RANGE(0x1000, 0x1fff) AM_RAM_WRITE(pacland_videoram2_w) AM_SHARE("videoram2")
|
||||
AM_RANGE(0x0000, 0x0fff) AM_RAM_WRITE(videoram_w) AM_SHARE("videoram")
|
||||
AM_RANGE(0x1000, 0x1fff) AM_RAM_WRITE(videoram2_w) AM_SHARE("videoram2")
|
||||
AM_RANGE(0x2000, 0x37ff) AM_RAM AM_SHARE("spriteram")
|
||||
AM_RANGE(0x3800, 0x3801) AM_WRITE(pacland_scroll0_w)
|
||||
AM_RANGE(0x3a00, 0x3a01) AM_WRITE(pacland_scroll1_w)
|
||||
AM_RANGE(0x3c00, 0x3c00) AM_WRITE(pacland_bankswitch_w)
|
||||
AM_RANGE(0x3800, 0x3801) AM_WRITE(scroll0_w)
|
||||
AM_RANGE(0x3a00, 0x3a01) AM_WRITE(scroll1_w)
|
||||
AM_RANGE(0x3c00, 0x3c00) AM_WRITE(bankswitch_w)
|
||||
AM_RANGE(0x4000, 0x5fff) AM_ROMBANK("bank1")
|
||||
AM_RANGE(0x6800, 0x6bff) AM_DEVREADWRITE("namco", namco_cus30_device, namcos1_cus30_r, namcos1_cus30_w) /* PSG device, shared RAM */
|
||||
AM_RANGE(0x7000, 0x7fff) AM_WRITE(pacland_irq_1_ctrl_w)
|
||||
AM_RANGE(0x7000, 0x7fff) AM_WRITE(irq_1_ctrl_w)
|
||||
AM_RANGE(0x7800, 0x7fff) AM_READ(watchdog_reset_r)
|
||||
AM_RANGE(0x8000, 0xffff) AM_ROM
|
||||
AM_RANGE(0x8000, 0x8fff) AM_WRITE(pacland_subreset_w)
|
||||
AM_RANGE(0x9000, 0x9fff) AM_WRITE(pacland_flipscreen_w)
|
||||
AM_RANGE(0x8000, 0x8fff) AM_WRITE(subreset_w)
|
||||
AM_RANGE(0x9000, 0x9fff) AM_WRITE(flipscreen_w)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( mcu_map, AS_PROGRAM, 8, pacland_state )
|
||||
@ -271,10 +278,10 @@ static ADDRESS_MAP_START( mcu_map, AS_PROGRAM, 8, pacland_state )
|
||||
AM_RANGE(0x0080, 0x00ff) AM_RAM
|
||||
AM_RANGE(0x1000, 0x13ff) AM_DEVREADWRITE("namco", namco_cus30_device, namcos1_cus30_r, namcos1_cus30_w) /* PSG device, shared RAM */
|
||||
AM_RANGE(0x2000, 0x3fff) AM_WRITE(watchdog_reset_w) /* watchdog? */
|
||||
AM_RANGE(0x4000, 0x7fff) AM_WRITE(pacland_irq_2_ctrl_w)
|
||||
AM_RANGE(0x4000, 0x7fff) AM_WRITE(irq_2_ctrl_w)
|
||||
AM_RANGE(0x8000, 0xbfff) AM_ROM
|
||||
AM_RANGE(0xc000, 0xc7ff) AM_RAM
|
||||
AM_RANGE(0xd000, 0xd003) AM_READ(pacland_input_r)
|
||||
AM_RANGE(0xd000, 0xd003) AM_READ(input_r)
|
||||
AM_RANGE(0xf000, 0xffff) AM_ROM
|
||||
ADDRESS_MAP_END
|
||||
|
||||
@ -286,9 +293,9 @@ READ8_MEMBER(pacland_state::readFF)
|
||||
|
||||
static ADDRESS_MAP_START( mcu_port_map, AS_IO, 8, pacland_state )
|
||||
AM_RANGE(M6801_PORT1, M6801_PORT1) AM_READ_PORT("IN2")
|
||||
AM_RANGE(M6801_PORT1, M6801_PORT1) AM_WRITE(pacland_coin_w)
|
||||
AM_RANGE(M6801_PORT1, M6801_PORT1) AM_WRITE(coin_w)
|
||||
AM_RANGE(M6801_PORT2, M6801_PORT2) AM_READ(readFF) /* leds won't work otherwise */
|
||||
AM_RANGE(M6801_PORT2, M6801_PORT2) AM_WRITE(pacland_led_w)
|
||||
AM_RANGE(M6801_PORT2, M6801_PORT2) AM_WRITE(led_w)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
|
||||
@ -433,7 +440,7 @@ static MACHINE_CONFIG_START( pacland, pacland_state )
|
||||
/* video hardware */
|
||||
MCFG_SCREEN_ADD("screen", RASTER)
|
||||
MCFG_SCREEN_RAW_PARAMS(XTAL_49_152MHz/8, 384, 3*8, 39*8, 264, 2*8, 30*8)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(pacland_state, screen_update_pacland)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(pacland_state, screen_update)
|
||||
MCFG_SCREEN_PALETTE("palette")
|
||||
|
||||
MCFG_GFXDECODE_ADD("gfxdecode", "palette", pacland)
|
||||
|
@ -7,19 +7,16 @@ class pacland_state : public driver_device
|
||||
public:
|
||||
pacland_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag),
|
||||
m_videoram(*this, "videoram"),
|
||||
m_videoram2(*this, "videoram2"),
|
||||
m_spriteram(*this, "spriteram"),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_mcu(*this, "mcu"),
|
||||
m_cus30(*this, "namco"),
|
||||
m_gfxdecode(*this, "gfxdecode"),
|
||||
m_screen(*this, "screen"),
|
||||
m_palette(*this, "palette") { }
|
||||
m_palette(*this, "palette"),
|
||||
m_videoram(*this, "videoram"),
|
||||
m_videoram2(*this, "videoram2"),
|
||||
m_spriteram(*this, "spriteram") { }
|
||||
|
||||
required_shared_ptr<UINT8> m_videoram;
|
||||
required_shared_ptr<UINT8> m_videoram2;
|
||||
required_shared_ptr<UINT8> m_spriteram;
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<cpu_device> m_mcu;
|
||||
required_device<namco_cus30_device> m_cus30;
|
||||
@ -27,6 +24,10 @@ public:
|
||||
required_device<screen_device> m_screen;
|
||||
required_device<palette_device> m_palette;
|
||||
|
||||
required_shared_ptr<UINT8> m_videoram;
|
||||
required_shared_ptr<UINT8> m_videoram2;
|
||||
required_shared_ptr<UINT8> m_spriteram;
|
||||
|
||||
UINT8 m_palette_bank;
|
||||
const UINT8 *m_color_prom;
|
||||
tilemap_t *m_bg_tilemap;
|
||||
@ -37,26 +38,32 @@ public:
|
||||
UINT16 m_scroll1;
|
||||
UINT8 m_main_irq_mask;
|
||||
UINT8 m_mcu_irq_mask;
|
||||
DECLARE_WRITE8_MEMBER(pacland_subreset_w);
|
||||
DECLARE_WRITE8_MEMBER(pacland_flipscreen_w);
|
||||
DECLARE_READ8_MEMBER(pacland_input_r);
|
||||
DECLARE_WRITE8_MEMBER(pacland_coin_w);
|
||||
DECLARE_WRITE8_MEMBER(pacland_led_w);
|
||||
DECLARE_WRITE8_MEMBER(pacland_irq_1_ctrl_w);
|
||||
DECLARE_WRITE8_MEMBER(pacland_irq_2_ctrl_w);
|
||||
|
||||
DECLARE_WRITE8_MEMBER(subreset_w);
|
||||
DECLARE_WRITE8_MEMBER(flipscreen_w);
|
||||
DECLARE_READ8_MEMBER(input_r);
|
||||
DECLARE_WRITE8_MEMBER(coin_w);
|
||||
DECLARE_WRITE8_MEMBER(led_w);
|
||||
DECLARE_WRITE8_MEMBER(irq_1_ctrl_w);
|
||||
DECLARE_WRITE8_MEMBER(irq_2_ctrl_w);
|
||||
DECLARE_READ8_MEMBER(readFF);
|
||||
DECLARE_WRITE8_MEMBER(pacland_videoram_w);
|
||||
DECLARE_WRITE8_MEMBER(pacland_videoram2_w);
|
||||
DECLARE_WRITE8_MEMBER(pacland_scroll0_w);
|
||||
DECLARE_WRITE8_MEMBER(pacland_scroll1_w);
|
||||
DECLARE_WRITE8_MEMBER(pacland_bankswitch_w);
|
||||
DECLARE_WRITE8_MEMBER(videoram_w);
|
||||
DECLARE_WRITE8_MEMBER(videoram2_w);
|
||||
DECLARE_WRITE8_MEMBER(scroll0_w);
|
||||
DECLARE_WRITE8_MEMBER(scroll1_w);
|
||||
DECLARE_WRITE8_MEMBER(bankswitch_w);
|
||||
|
||||
TILE_GET_INFO_MEMBER(get_bg_tile_info);
|
||||
TILE_GET_INFO_MEMBER(get_fg_tile_info);
|
||||
|
||||
virtual void machine_start();
|
||||
virtual void video_start();
|
||||
DECLARE_PALETTE_INIT(pacland);
|
||||
UINT32 screen_update_pacland(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
|
||||
INTERRUPT_GEN_MEMBER(main_vblank_irq);
|
||||
INTERRUPT_GEN_MEMBER(mcu_vblank_irq);
|
||||
|
||||
UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
void switch_palette();
|
||||
void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int flip, int whichmask);
|
||||
void draw_fg(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int priority );
|
||||
|
@ -189,8 +189,6 @@ TILE_GET_INFO_MEMBER(pacland_state::get_fg_tile_info)
|
||||
|
||||
void pacland_state::video_start()
|
||||
{
|
||||
int color;
|
||||
|
||||
m_screen->register_screen_bitmap(m_fg_bitmap);
|
||||
m_fg_bitmap.fill(0xffff);
|
||||
|
||||
@ -204,13 +202,15 @@ void pacland_state::video_start()
|
||||
/* create one group per color code; for each group, set the transparency mask
|
||||
to correspond to the pens that are 0x7f or 0xff */
|
||||
assert(m_gfxdecode->gfx(0)->colors() <= TILEMAP_NUM_GROUPS);
|
||||
for (color = 0; color < m_gfxdecode->gfx(0)->colors(); color++)
|
||||
for (int color = 0; color < m_gfxdecode->gfx(0)->colors(); color++)
|
||||
{
|
||||
UINT32 mask = m_palette->transpen_mask(*m_gfxdecode->gfx(0), color, 0x7f);
|
||||
mask |= m_palette->transpen_mask(*m_gfxdecode->gfx(0), color, 0xff);
|
||||
m_fg_tilemap->set_transmask(color, mask, 0);
|
||||
}
|
||||
|
||||
membank("bank1")->configure_entries(0, 8, memregion("maincpu")->base() + 0x10000, 0x2000);
|
||||
|
||||
save_item(NAME(m_palette_bank));
|
||||
save_item(NAME(m_scroll0));
|
||||
save_item(NAME(m_scroll1));
|
||||
@ -224,35 +224,31 @@ void pacland_state::video_start()
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
WRITE8_MEMBER(pacland_state::pacland_videoram_w)
|
||||
WRITE8_MEMBER(pacland_state::videoram_w)
|
||||
{
|
||||
m_videoram[offset] = data;
|
||||
m_fg_tilemap->mark_tile_dirty(offset / 2);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(pacland_state::pacland_videoram2_w)
|
||||
WRITE8_MEMBER(pacland_state::videoram2_w)
|
||||
{
|
||||
m_videoram2[offset] = data;
|
||||
m_bg_tilemap->mark_tile_dirty(offset / 2);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(pacland_state::pacland_scroll0_w)
|
||||
WRITE8_MEMBER(pacland_state::scroll0_w)
|
||||
{
|
||||
m_scroll0 = data + 256 * offset;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(pacland_state::pacland_scroll1_w)
|
||||
WRITE8_MEMBER(pacland_state::scroll1_w)
|
||||
{
|
||||
m_scroll1 = data + 256 * offset;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(pacland_state::pacland_bankswitch_w)
|
||||
WRITE8_MEMBER(pacland_state::bankswitch_w)
|
||||
{
|
||||
int bankaddress;
|
||||
UINT8 *RAM = memregion("maincpu")->base();
|
||||
|
||||
bankaddress = 0x10000 + ((data & 0x07) << 13);
|
||||
membank("bank1")->set_base(&RAM[bankaddress]);
|
||||
membank("bank1")->set_entry(data & 0x07);
|
||||
|
||||
// pbc = data & 0x20;
|
||||
|
||||
@ -277,9 +273,8 @@ void pacland_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, co
|
||||
UINT8 *spriteram = m_spriteram + 0x780;
|
||||
UINT8 *spriteram_2 = spriteram + 0x800;
|
||||
UINT8 *spriteram_3 = spriteram_2 + 0x800;
|
||||
int offs;
|
||||
|
||||
for (offs = 0;offs < 0x80;offs += 2)
|
||||
for (int offs = 0;offs < 0x80;offs += 2)
|
||||
{
|
||||
static const int gfx_offs[2][2] =
|
||||
{
|
||||
@ -333,15 +328,13 @@ void pacland_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, co
|
||||
|
||||
void pacland_state::draw_fg(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int priority )
|
||||
{
|
||||
int y, x;
|
||||
|
||||
/* draw tilemap transparently over it; this will leave invalid pens (0xffff)
|
||||
anywhere where the fg_tilemap should be transparent; note that we assume
|
||||
the fg_bitmap has been pre-erased to 0xffff */
|
||||
m_fg_tilemap->draw(screen, m_fg_bitmap, cliprect, priority, 0);
|
||||
|
||||
/* now copy the fg_bitmap to the destination wherever the sprite pixel allows */
|
||||
for (y = cliprect.min_y; y <= cliprect.max_y; y++)
|
||||
for (int y = cliprect.min_y; y <= cliprect.max_y; y++)
|
||||
{
|
||||
const UINT8 *pri = &screen.priority().pix8(y);
|
||||
UINT16 *src = &m_fg_bitmap.pix16(y);
|
||||
@ -349,7 +342,7 @@ void pacland_state::draw_fg(screen_device &screen, bitmap_ind16 &bitmap, const r
|
||||
|
||||
/* only copy if the priority bitmap is 0 (no high priority sprite) and the
|
||||
source pixel is not the invalid pen; also clear to 0xffff when finished */
|
||||
for (x = cliprect.min_x; x <= cliprect.max_x; x++)
|
||||
for (int x = cliprect.min_x; x <= cliprect.max_x; x++)
|
||||
{
|
||||
UINT16 pix = src[x];
|
||||
if (pix != 0xffff)
|
||||
@ -363,12 +356,11 @@ void pacland_state::draw_fg(screen_device &screen, bitmap_ind16 &bitmap, const r
|
||||
}
|
||||
|
||||
|
||||
UINT32 pacland_state::screen_update_pacland(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
UINT32 pacland_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
int row;
|
||||
int flip = flip_screen();
|
||||
|
||||
for (row = 5; row < 29; row++)
|
||||
for (int row = 5; row < 29; row++)
|
||||
m_fg_tilemap->set_scrollx(row, m_scroll0 - (flip ? 7 : 0));
|
||||
m_bg_tilemap->set_scrollx(0, m_scroll1);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user