mirror of
https://github.com/holub/mame
synced 2025-04-25 09:50:04 +03:00
blmbycar.cpp : Cleanups/Updates (#3977)
Cleanup duplicates, ACCESSING_BITS, runtime tag lookups Fix memory map, Sound output(Both chip and PCB can't support stereo output) blmbycar.h : Use private:
This commit is contained in:
parent
d987469554
commit
4a0813afa5
@ -46,12 +46,9 @@ Check game speed, it depends on a bit we toggle..
|
||||
|
||||
/* The top 64k of samples are banked (16 banks total) */
|
||||
|
||||
WRITE16_MEMBER(blmbycar_state::okibank_w)
|
||||
WRITE8_MEMBER(blmbycar_state::okibank_w)
|
||||
{
|
||||
if (ACCESSING_BITS_0_7)
|
||||
{
|
||||
membank("okibank")->set_entry(data & 0x0f);
|
||||
}
|
||||
m_okibank->set_entry(data & 0x0f);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
@ -64,20 +61,16 @@ WRITE16_MEMBER(blmbycar_state::okibank_w)
|
||||
|
||||
/* Preliminary potentiometric wheel support */
|
||||
|
||||
WRITE16_MEMBER(blmbycar_state::blmbycar_pot_wheel_reset_w)
|
||||
WRITE8_MEMBER(blmbycar_state::blmbycar_pot_wheel_reset_w)
|
||||
{
|
||||
if (ACCESSING_BITS_0_7)
|
||||
m_pot_wheel = ioport("POT_WHEEL")->read() & 0xff;
|
||||
m_pot_wheel = m_pot_wheel_io->read() & 0xff;
|
||||
}
|
||||
|
||||
WRITE16_MEMBER(blmbycar_state::blmbycar_pot_wheel_shift_w)
|
||||
WRITE8_MEMBER(blmbycar_state::blmbycar_pot_wheel_shift_w)
|
||||
{
|
||||
if (ACCESSING_BITS_0_7)
|
||||
{
|
||||
if ( ((m_old_val & 0xff) == 0xff) && ((data & 0xff) == 0) )
|
||||
m_pot_wheel <<= 1;
|
||||
m_old_val = data;
|
||||
}
|
||||
if ( ((m_old_val & 0xff) == 0xff) && ((data & 0xff) == 0) )
|
||||
m_pot_wheel <<= 1;
|
||||
m_old_val = data;
|
||||
}
|
||||
|
||||
READ16_MEMBER(blmbycar_state::blmbycar_pot_wheel_r)
|
||||
@ -90,7 +83,23 @@ READ16_MEMBER(blmbycar_state::blmbycar_pot_wheel_r)
|
||||
|
||||
READ16_MEMBER(blmbycar_state::blmbycar_opt_wheel_r)
|
||||
{
|
||||
return ((ioport("OPT_WHEEL")->read() & 0xff) << 8) | 0xff;
|
||||
return ((m_opt_wheel_io->read() & 0xff) << 8) | 0xff;
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
|
||||
Video Handling
|
||||
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
template<int Layer>
|
||||
WRITE16_MEMBER(blmbycar_state::vram_w)
|
||||
{
|
||||
COMBINE_DATA(&m_vram[Layer][offset]);
|
||||
m_tilemap[Layer]->mark_tile_dirty(offset / 2);
|
||||
}
|
||||
|
||||
|
||||
@ -105,10 +114,9 @@ READ16_MEMBER(blmbycar_state::blmbycar_opt_wheel_r)
|
||||
void blmbycar_state::common_map(address_map &map)
|
||||
{
|
||||
map(0x000000, 0x0fffff).rom();
|
||||
map(0xfec000, 0xfeffff).ram();
|
||||
map(0x100000, 0x103fff).writeonly(); // ???
|
||||
map(0x104000, 0x105fff).ram().w(FUNC(blmbycar_state::vram_1_w)).share("vram_1"); // Layer 1
|
||||
map(0x106000, 0x107fff).ram().w(FUNC(blmbycar_state::vram_0_w)).share("vram_0"); // Layer 0
|
||||
map(0x104000, 0x105fff).ram().w(FUNC(blmbycar_state::vram_w<1>)).share("vram_1"); // Layer 1
|
||||
map(0x106000, 0x107fff).ram().w(FUNC(blmbycar_state::vram_w<0>)).share("vram_0"); // Layer 0
|
||||
map(0x108000, 0x10bfff).writeonly(); // ???
|
||||
map(0x10c000, 0x10c003).writeonly().share("scroll_1"); // Scroll 1
|
||||
map(0x10c004, 0x10c007).writeonly().share("scroll_0"); // Scroll 0
|
||||
@ -118,8 +126,9 @@ void blmbycar_state::common_map(address_map &map)
|
||||
map(0x444000, 0x445fff).writeonly().share("spriteram");// Sprites (size?)
|
||||
map(0x700000, 0x700001).portr("DSW");
|
||||
map(0x700002, 0x700003).portr("P1_P2");
|
||||
map(0x70000c, 0x70000d).w(FUNC(blmbycar_state::okibank_w)); // Sound
|
||||
map(0x70000d, 0x70000d).w(FUNC(blmbycar_state::okibank_w)); // Sound
|
||||
map(0x70000f, 0x70000f).rw("oki", FUNC(okim6295_device::read), FUNC(okim6295_device::write)); // Sound
|
||||
map(0xfec000, 0xfeffff).ram();
|
||||
}
|
||||
|
||||
void blmbycar_state::blmbycar_map(address_map &map)
|
||||
@ -130,8 +139,10 @@ void blmbycar_state::blmbycar_map(address_map &map)
|
||||
map(0x700006, 0x700007).portr("UNK");
|
||||
map(0x700008, 0x700009).r(FUNC(blmbycar_state::blmbycar_pot_wheel_r)); // Wheel (potentiometer)
|
||||
map(0x70000a, 0x70000b).nopw(); // ? Wheel
|
||||
map(0x70006a, 0x70006b).nopr().w(FUNC(blmbycar_state::blmbycar_pot_wheel_reset_w)); // Wheel (potentiometer)
|
||||
map(0x70007a, 0x70007b).nopr().w(FUNC(blmbycar_state::blmbycar_pot_wheel_shift_w)); //
|
||||
map(0x70006a, 0x70006b).nopr(); // Wheel (potentiometer)
|
||||
map(0x70006b, 0x70006b).w(FUNC(blmbycar_state::blmbycar_pot_wheel_reset_w)); // Wheel (potentiometer)
|
||||
map(0x70007a, 0x70007b).nopr(); //
|
||||
map(0x70007b, 0x70007b).w(FUNC(blmbycar_state::blmbycar_pot_wheel_shift_w)); //
|
||||
}
|
||||
|
||||
READ16_MEMBER(blmbycar_state::waterball_unk_r)
|
||||
@ -344,7 +355,7 @@ MACHINE_START_MEMBER(blmbycar_state,blmbycar)
|
||||
save_item(NAME(m_pot_wheel));
|
||||
save_item(NAME(m_old_val));
|
||||
|
||||
membank("okibank")->configure_entries(0, 16, memregion("oki")->base(), 0x10000);
|
||||
m_okibank->configure_entries(0, 16, memregion("oki")->base(), 0x10000);
|
||||
}
|
||||
|
||||
MACHINE_RESET_MEMBER(blmbycar_state,blmbycar)
|
||||
@ -379,13 +390,11 @@ MACHINE_CONFIG_START(blmbycar_state::blmbycar)
|
||||
MCFG_PALETTE_FORMAT(xxxxBBBBRRRRGGGG)
|
||||
|
||||
/* sound hardware */
|
||||
SPEAKER(config, "lspeaker").front_left();
|
||||
SPEAKER(config, "rspeaker").front_right();
|
||||
SPEAKER(config, "mono").front_center();
|
||||
|
||||
MCFG_DEVICE_ADD("oki", OKIM6295, XTAL(1'000'000), okim6295_device::PIN7_HIGH) // clock frequency & pin 7 not verified
|
||||
MCFG_DEVICE_ADDRESS_MAP(0, blmbycar_oki_map)
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0)
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0)
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
|
||||
@ -393,7 +402,7 @@ MACHINE_START_MEMBER(blmbycar_state,watrball)
|
||||
{
|
||||
save_item(NAME(m_retvalue));
|
||||
|
||||
membank("okibank")->configure_entries(0, 16, memregion("oki")->base(), 0x10000);
|
||||
m_okibank->configure_entries(0, 16, memregion("oki")->base(), 0x10000);
|
||||
}
|
||||
|
||||
MACHINE_RESET_MEMBER(blmbycar_state,watrball)
|
||||
@ -524,6 +533,6 @@ void blmbycar_state::init_blmbycar()
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
GAME( 1994, blmbycar, 0, blmbycar, blmbycar, blmbycar_state, init_blmbycar, ROT0, "ABM & Gecas", "Blomby Car", MACHINE_SUPPORTS_SAVE )
|
||||
GAME( 1994, blmbycaru, blmbycar, blmbycar, blmbycar, blmbycar_state, empty_init, ROT0, "ABM & Gecas", "Blomby Car (not encrypted)", MACHINE_SUPPORTS_SAVE )
|
||||
GAME( 1994, blmbycar, 0, blmbycar, blmbycar, blmbycar_state, init_blmbycar, ROT0, "ABM & Gecas", "Blomby Car (Version 1P0)", MACHINE_SUPPORTS_SAVE )
|
||||
GAME( 1994, blmbycaru, blmbycar, blmbycar, blmbycar, blmbycar_state, empty_init, ROT0, "ABM & Gecas", "Blomby Car (Version 1P0, not encrypted)", MACHINE_SUPPORTS_SAVE )
|
||||
GAME( 1996, watrball, 0, watrball, watrball, blmbycar_state, empty_init, ROT0, "ABM", "Water Balls", MACHINE_SUPPORTS_SAVE )
|
||||
|
@ -11,56 +11,63 @@
|
||||
class blmbycar_state : public driver_device
|
||||
{
|
||||
public:
|
||||
blmbycar_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag),
|
||||
blmbycar_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_vram_1(*this, "vram_1"),
|
||||
m_vram_0(*this, "vram_0"),
|
||||
m_scroll_1(*this, "scroll_1"),
|
||||
m_scroll_0(*this, "scroll_0"),
|
||||
m_spriteram(*this, "spriteram") { }
|
||||
m_vram(*this, "vram_%u", 0U),
|
||||
m_scroll(*this, "scroll_%u", 0U),
|
||||
m_spriteram(*this, "spriteram"),
|
||||
m_okibank(*this, "okibank"),
|
||||
m_pot_wheel_io(*this, "POT_WHEEL"),
|
||||
m_opt_wheel_io(*this, "OPT_WHEEL")
|
||||
{
|
||||
}
|
||||
|
||||
void watrball(machine_config &config);
|
||||
void blmbycar(machine_config &config);
|
||||
|
||||
void init_blmbycar();
|
||||
|
||||
private:
|
||||
/* devices */
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
required_device<palette_device> m_palette;
|
||||
|
||||
/* memory pointers */
|
||||
required_shared_ptr<uint16_t> m_vram_1;
|
||||
required_shared_ptr<uint16_t> m_vram_0;
|
||||
required_shared_ptr<uint16_t> m_scroll_1;
|
||||
required_shared_ptr<uint16_t> m_scroll_0;
|
||||
required_shared_ptr_array<uint16_t, 2> m_vram;
|
||||
required_shared_ptr_array<uint16_t, 2> m_scroll;
|
||||
required_shared_ptr<uint16_t> m_spriteram;
|
||||
|
||||
required_memory_bank m_okibank;
|
||||
optional_ioport m_pot_wheel_io;
|
||||
optional_ioport m_opt_wheel_io;
|
||||
|
||||
/* video-related */
|
||||
tilemap_t *m_tilemap_0;
|
||||
tilemap_t *m_tilemap_1;
|
||||
tilemap_t *m_tilemap[2];
|
||||
|
||||
/* input-related */
|
||||
uint8_t m_pot_wheel; // blmbycar
|
||||
int m_old_val; // blmbycar
|
||||
uint8_t m_old_val; // blmbycar
|
||||
int m_retvalue; // waterball
|
||||
|
||||
// common
|
||||
DECLARE_WRITE16_MEMBER(okibank_w);
|
||||
DECLARE_WRITE16_MEMBER(vram_0_w);
|
||||
DECLARE_WRITE16_MEMBER(vram_1_w);
|
||||
DECLARE_WRITE8_MEMBER(okibank_w);
|
||||
template<int Layer> DECLARE_WRITE16_MEMBER(vram_w);
|
||||
|
||||
// blmbycar
|
||||
DECLARE_WRITE16_MEMBER(blmbycar_pot_wheel_reset_w);
|
||||
DECLARE_WRITE16_MEMBER(blmbycar_pot_wheel_shift_w);
|
||||
DECLARE_WRITE8_MEMBER(blmbycar_pot_wheel_reset_w);
|
||||
DECLARE_WRITE8_MEMBER(blmbycar_pot_wheel_shift_w);
|
||||
DECLARE_READ16_MEMBER(blmbycar_pot_wheel_r);
|
||||
DECLARE_READ16_MEMBER(blmbycar_opt_wheel_r);
|
||||
|
||||
// waterball
|
||||
DECLARE_READ16_MEMBER(waterball_unk_r);
|
||||
|
||||
TILE_GET_INFO_MEMBER(get_tile_info_0);
|
||||
TILE_GET_INFO_MEMBER(get_tile_info_1);
|
||||
template<int Layer> TILE_GET_INFO_MEMBER(get_tile_info);
|
||||
|
||||
void init_blmbycar();
|
||||
virtual void video_start() override;
|
||||
DECLARE_MACHINE_START(blmbycar);
|
||||
DECLARE_MACHINE_RESET(blmbycar);
|
||||
@ -69,8 +76,6 @@ public:
|
||||
|
||||
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
void draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect );
|
||||
void watrball(machine_config &config);
|
||||
void blmbycar(machine_config &config);
|
||||
void blmbycar_map(address_map &map);
|
||||
void blmbycar_oki_map(address_map &map);
|
||||
void common_map(address_map &map);
|
||||
|
@ -54,10 +54,11 @@ Note: if MAME_DEBUG is defined, pressing Z with:
|
||||
#define DIM_NX (0x40)
|
||||
#define DIM_NY (0x20)
|
||||
|
||||
TILE_GET_INFO_MEMBER(blmbycar_state::get_tile_info_0)
|
||||
template<int Layer>
|
||||
TILE_GET_INFO_MEMBER(blmbycar_state::get_tile_info)
|
||||
{
|
||||
uint16_t code = m_vram_0[tile_index * 2 + 0];
|
||||
uint16_t attr = m_vram_0[tile_index * 2 + 1];
|
||||
uint16_t code = m_vram[Layer][tile_index * 2 + 0];
|
||||
uint16_t attr = m_vram[Layer][tile_index * 2 + 1];
|
||||
SET_TILE_INFO_MEMBER(0,
|
||||
code,
|
||||
attr & 0x1f,
|
||||
@ -66,32 +67,6 @@ TILE_GET_INFO_MEMBER(blmbycar_state::get_tile_info_0)
|
||||
tileinfo.category = (attr >> 5) & 1;
|
||||
}
|
||||
|
||||
TILE_GET_INFO_MEMBER(blmbycar_state::get_tile_info_1)
|
||||
{
|
||||
uint16_t code = m_vram_1[tile_index * 2 + 0];
|
||||
uint16_t attr = m_vram_1[tile_index * 2 + 1];
|
||||
SET_TILE_INFO_MEMBER(0,
|
||||
code,
|
||||
attr & 0x1f,
|
||||
TILE_FLIPYX((attr >> 6) & 3));
|
||||
|
||||
tileinfo.category = (attr >> 5) & 1;
|
||||
}
|
||||
|
||||
|
||||
WRITE16_MEMBER(blmbycar_state::vram_0_w)
|
||||
{
|
||||
COMBINE_DATA(&m_vram_0[offset]);
|
||||
m_tilemap_0->mark_tile_dirty(offset / 2);
|
||||
}
|
||||
|
||||
WRITE16_MEMBER(blmbycar_state::vram_1_w)
|
||||
{
|
||||
COMBINE_DATA(&m_vram_1[offset]);
|
||||
m_tilemap_1->mark_tile_dirty(offset / 2);
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
|
||||
@ -102,15 +77,15 @@ WRITE16_MEMBER(blmbycar_state::vram_1_w)
|
||||
|
||||
void blmbycar_state::video_start()
|
||||
{
|
||||
m_tilemap_0 = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(blmbycar_state::get_tile_info_0),this), TILEMAP_SCAN_ROWS, 16, 16, DIM_NX, DIM_NY );
|
||||
m_tilemap_1 = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(blmbycar_state::get_tile_info_1),this), TILEMAP_SCAN_ROWS, 16, 16, DIM_NX, DIM_NY );
|
||||
m_tilemap[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(blmbycar_state::get_tile_info<0>),this), TILEMAP_SCAN_ROWS, 16, 16, DIM_NX, DIM_NY );
|
||||
m_tilemap[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(blmbycar_state::get_tile_info<1>),this), TILEMAP_SCAN_ROWS, 16, 16, DIM_NX, DIM_NY );
|
||||
|
||||
m_tilemap_0->set_scroll_rows(1);
|
||||
m_tilemap_0->set_scroll_cols(1);
|
||||
m_tilemap[0]->set_scroll_rows(1);
|
||||
m_tilemap[0]->set_scroll_cols(1);
|
||||
|
||||
m_tilemap_1->set_scroll_rows(1);
|
||||
m_tilemap_1->set_scroll_cols(1);
|
||||
m_tilemap_1->set_transparent_pen(0);
|
||||
m_tilemap[1]->set_scroll_rows(1);
|
||||
m_tilemap[1]->set_scroll_cols(1);
|
||||
m_tilemap[1]->set_transparent_pen(0);
|
||||
}
|
||||
|
||||
|
||||
@ -197,11 +172,11 @@ uint32_t blmbycar_state::screen_update(screen_device &screen, bitmap_ind16 &bitm
|
||||
{
|
||||
int i, layers_ctrl = -1;
|
||||
|
||||
m_tilemap_0->set_scrolly(0, m_scroll_0[0]);
|
||||
m_tilemap_0->set_scrollx(0, m_scroll_0[1]);
|
||||
m_tilemap[0]->set_scrolly(0, m_scroll[0][0]);
|
||||
m_tilemap[0]->set_scrollx(0, m_scroll[0][1]);
|
||||
|
||||
m_tilemap_1->set_scrolly(0, m_scroll_1[0] + 1);
|
||||
m_tilemap_1->set_scrollx(0, m_scroll_1[1] + 5);
|
||||
m_tilemap[1]->set_scrolly(0, m_scroll[1][0] + 1);
|
||||
m_tilemap[1]->set_scrollx(0, m_scroll[1][1] + 5);
|
||||
|
||||
#ifdef MAME_DEBUG
|
||||
if (machine().input().code_pressed(KEYCODE_Z))
|
||||
@ -220,13 +195,13 @@ if (machine().input().code_pressed(KEYCODE_Z))
|
||||
|
||||
if (layers_ctrl & 1)
|
||||
for (i = 0; i <= 1; i++)
|
||||
m_tilemap_0->draw(screen, bitmap, cliprect, i, i);
|
||||
m_tilemap[0]->draw(screen, bitmap, cliprect, i, i);
|
||||
else
|
||||
bitmap.fill(0, cliprect);
|
||||
|
||||
if (layers_ctrl & 2)
|
||||
for (i = 0; i <= 1; i++)
|
||||
m_tilemap_1->draw(screen, bitmap, cliprect, i, i);
|
||||
m_tilemap[1]->draw(screen, bitmap, cliprect, i, i);
|
||||
|
||||
if (layers_ctrl & 8)
|
||||
draw_sprites(screen, bitmap, cliprect);
|
||||
|
Loading…
Reference in New Issue
Block a user