From d68363cf84cf46ab9f458abd162c10825c775e43 Mon Sep 17 00:00:00 2001 From: Ivan Vangelista Date: Mon, 2 Aug 2021 16:57:58 +0200 Subject: albazc.cpp, albazg.cpp, chanbara.cpp: made use of object finders and other minor cleanups --- src/mame/drivers/albazc.cpp | 130 +++++++++++++-------------- src/mame/drivers/albazg.cpp | 126 +++++++++++++++------------ src/mame/drivers/chanbara.cpp | 198 +++++++++++++++++++++--------------------- 3 files changed, 229 insertions(+), 225 deletions(-) diff --git a/src/mame/drivers/albazc.cpp b/src/mame/drivers/albazc.cpp index d5bdf523f19..6a89627d2e5 100644 --- a/src/mame/drivers/albazc.cpp +++ b/src/mame/drivers/albazc.cpp @@ -1,7 +1,6 @@ // license:BSD-3-Clause // copyright-holders:David Haywood, Stephane Humbert -/* Hanaroku - Alba ZC HW */ - +// Hanaroku - Alba ZC HW /* TODO: - colour decoding might not be perfect @@ -21,14 +20,14 @@ TODO: #include "screen.h" #include "speaker.h" +namespace { + class albazc_state : public driver_device { public: albazc_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), - m_spriteram1(*this, "spriteram1"), - m_spriteram2(*this, "spriteram2"), - m_spriteram3(*this, "spriteram3"), + m_spriteram(*this, "spriteram%u", 1U), m_maincpu(*this, "maincpu"), m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette"), @@ -38,21 +37,17 @@ public: void hanaroku(machine_config &config); private: - /* video-related */ - void hanaroku_out_0_w(uint8_t data); - void hanaroku_out_1_w(uint8_t data); - void hanaroku_out_2_w(uint8_t data); - void albazc_vregs_w(offs_t offset, uint8_t data); - virtual void video_start() override; - void albazc_palette(palette_device &palette) const; - uint32_t screen_update_hanaroku(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + // video-related + void out_0_w(uint8_t data); + void out_1_w(uint8_t data); + void out_2_w(uint8_t data); + void vregs_w(offs_t offset, uint8_t data); + void palette(palette_device &palette) const; + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); - void hanaroku_map(address_map &map); + void prg_map(address_map &map); - required_shared_ptr m_spriteram1; - required_shared_ptr m_spriteram2; - required_shared_ptr m_spriteram3; - uint8_t m_flip_bit; + required_shared_ptr_array m_spriteram; required_device m_maincpu; required_device m_gfxdecode; required_device m_palette; @@ -61,9 +56,9 @@ private: -/* video */ +// video -void albazc_state::albazc_palette(palette_device &palette) const +void albazc_state::palette(palette_device &palette) const { uint8_t const *const color_prom(memregion("proms")->base()); for (int i = 0; i < 0x200; i++) @@ -77,43 +72,36 @@ void albazc_state::albazc_palette(palette_device &palette) const } -void albazc_state::video_start() -{ -} - void albazc_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) { - int i; - - for (i = 511; i >= 0; i--) + for (int i = 511; i >= 0; i--) { - int code = m_spriteram1[i] | (m_spriteram2[i] << 8); - int color = (m_spriteram2[i + 0x200] & 0xf8) >> 3; + int code = m_spriteram[0][i] | (m_spriteram[1][i] << 8); + int color = (m_spriteram[1][i + 0x200] & 0xf8) >> 3; int flipx = 0; int flipy = 0; - int sx = m_spriteram1[i + 0x200] | ((m_spriteram2[i + 0x200] & 0x07) << 8); - int sy = 242 - m_spriteram3[i]; + int sx = m_spriteram[0][i + 0x200] | ((m_spriteram[1][i + 0x200] & 0x07) << 8); + int sy = 242 - m_spriteram[2][i]; - if (m_flip_bit) + if (flip_screen()) { sy = 242 - sy; flipx = !flipx; flipy = !flipy; } - m_gfxdecode->gfx(0)->transpen(bitmap,cliprect, code, color, flipx, flipy, - sx, sy, 0); + m_gfxdecode->gfx(0)->transpen(bitmap, cliprect, code, color, flipx, flipy, sx, sy, 0); } } -uint32_t albazc_state::screen_update_hanaroku(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +uint32_t albazc_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { bitmap.fill(0x1f0, cliprect); // ??? draw_sprites(bitmap, cliprect); return 0; } -void albazc_state::hanaroku_out_0_w(uint8_t data) +void albazc_state::out_0_w(uint8_t data) { /* bit description @@ -135,7 +123,7 @@ void albazc_state::hanaroku_out_0_w(uint8_t data) machine().bookkeeping().coin_counter_w(4, data & 0x80); } -void albazc_state::hanaroku_out_1_w(uint8_t data) +void albazc_state::out_1_w(uint8_t data) { /* bit description @@ -153,12 +141,12 @@ void albazc_state::hanaroku_out_1_w(uint8_t data) m_hopper->motor_w(BIT(data, 0)); } -void albazc_state::hanaroku_out_2_w(uint8_t data) +void albazc_state::out_2_w(uint8_t data) { // unused } -void albazc_state::albazc_vregs_w(offs_t offset, uint8_t data) +void albazc_state::vregs_w(offs_t offset, uint8_t data) { #ifdef UNUSED_FUNCTION { @@ -168,38 +156,34 @@ void albazc_state::albazc_vregs_w(offs_t offset, uint8_t data) } #endif - if(offset == 0) - { - /* core bug with this? */ - //flip_screen_set((data & 0x40) >> 6); - m_flip_bit = (data & 0x40) >> 6; - } + if (offset == 0) + flip_screen_set((data & 0x40) >> 6); } -/* main cpu */ +// main CPU -void albazc_state::hanaroku_map(address_map &map) +void albazc_state::prg_map(address_map &map) { map(0x0000, 0x7fff).rom(); - map(0x8000, 0x87ff).ram().share("spriteram1"); - map(0x9000, 0x97ff).ram().share("spriteram2"); - map(0xa000, 0xa1ff).ram().share("spriteram3"); + map(0x8000, 0x87ff).ram().share(m_spriteram[0]); + map(0x9000, 0x97ff).ram().share(m_spriteram[1]); + map(0xa000, 0xa1ff).ram().share(m_spriteram[2]); map(0xa200, 0xa2ff).nopw(); // ??? written once during P.O.S.T. - map(0xa300, 0xa304).w(FUNC(albazc_state::albazc_vregs_w)); // ??? + map(0xa300, 0xa304).w(FUNC(albazc_state::vregs_w)); // ??? map(0xb000, 0xb000).nopw(); // ??? always 0x40 - map(0xc000, 0xc3ff).ram(); // main ram + map(0xc000, 0xc3ff).ram(); // main RAM map(0xc400, 0xc4ff).ram().share("nvram"); map(0xd000, 0xd000).r("aysnd", FUNC(ay8910_device::data_r)); map(0xd000, 0xd001).w("aysnd", FUNC(ay8910_device::address_data_w)); - map(0xe000, 0xe000).portr("IN0").w(FUNC(albazc_state::hanaroku_out_0_w)); + map(0xe000, 0xe000).portr("IN0").w(FUNC(albazc_state::out_0_w)); map(0xe001, 0xe001).portr("IN1"); - map(0xe002, 0xe002).portr("IN2").w(FUNC(albazc_state::hanaroku_out_1_w)); - map(0xe004, 0xe004).portr("DSW3").w(FUNC(albazc_state::hanaroku_out_2_w)); + map(0xe002, 0xe002).portr("IN2").w(FUNC(albazc_state::out_1_w)); + map(0xe004, 0xe004).portr("DSW3").w(FUNC(albazc_state::out_2_w)); } static INPUT_PORTS_START( hanaroku ) - PORT_START("IN0") /* 0xe000 */ + PORT_START("IN0") // 0xe000 PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) // adds n credits depending on "Coinage" Dip Switch PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) // adds 5 credits PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP ) PORT_NAME("1/2 D-Up") @@ -209,7 +193,7 @@ static INPUT_PORTS_START( hanaroku ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 ) PORT_NAME("Play") PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 ) PORT_NAME("Start") - PORT_START("IN1") /* 0xe001 */ + PORT_START("IN1") // 0xe001 PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_HANAFUDA_A ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_HANAFUDA_B ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_HANAFUDA_C ) @@ -219,7 +203,7 @@ static INPUT_PORTS_START( hanaroku ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_HANAFUDA_YES ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_HANAFUDA_NO ) - PORT_START("IN2") /* 0xe002 */ + PORT_START("IN2") // 0xe002 PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MEMORY_RESET ) PORT_NAME("Data Clear") PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_TILT ) PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("hopper", ticket_dispenser_device, line_r) // "Medal In" @@ -228,10 +212,10 @@ static INPUT_PORTS_START( hanaroku ) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Ext In 2") PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("DSW1") /* 0xd000 - Port A */ + PORT_START("DSW1") // 0xd000 - Port A PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("DSW2") /* 0xd000 - Port B */ + PORT_START("DSW2") // 0xd000 - Port B PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("DSW3") /* 0xe004 */ @@ -272,37 +256,37 @@ static const gfx_layout hanaroku_charlayout = static GFXDECODE_START( gfx_hanaroku ) - GFXDECODE_ENTRY( "gfx1", 0, hanaroku_charlayout, 0, 32 ) + GFXDECODE_ENTRY( "tiles", 0, hanaroku_charlayout, 0, 32 ) GFXDECODE_END void albazc_state::hanaroku(machine_config &config) { - Z80(config, m_maincpu, 6000000); /* ? MHz */ - m_maincpu->set_addrmap(AS_PROGRAM, &albazc_state::hanaroku_map); + Z80(config, m_maincpu, 6000000); // ? MHz + m_maincpu->set_addrmap(AS_PROGRAM, &albazc_state::prg_map); m_maincpu->set_vblank_int("screen", FUNC(albazc_state::irq0_line_hold)); NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0); - TICKET_DISPENSER(config, m_hopper, attotime::from_msec(50), TICKET_MOTOR_ACTIVE_HIGH, TICKET_STATUS_ACTIVE_HIGH ); + TICKET_DISPENSER(config, m_hopper, attotime::from_msec(50), TICKET_MOTOR_ACTIVE_HIGH, TICKET_STATUS_ACTIVE_HIGH); - /* video hardware */ + // video hardware screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); screen.set_refresh_hz(60); screen.set_vblank_time(ATTOSECONDS_IN_USEC(0)); screen.set_size(64*8, 64*8); screen.set_visarea(0, 48*8-1, 2*8, 30*8-1); - screen.set_screen_update(FUNC(albazc_state::screen_update_hanaroku)); + screen.set_screen_update(FUNC(albazc_state::screen_update)); screen.set_palette(m_palette); GFXDECODE(config, m_gfxdecode, m_palette, gfx_hanaroku); - PALETTE(config, m_palette, FUNC(albazc_state::albazc_palette), 0x200); + PALETTE(config, m_palette, FUNC(albazc_state::palette), 0x200); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); - ay8910_device &aysnd(AY8910(config, "aysnd", 1500000)); /* ? MHz */ + ay8910_device &aysnd(AY8910(config, "aysnd", 1500000)); // ? MHz aysnd.port_a_read_callback().set_ioport("DSW1"); aysnd.port_b_read_callback().set_ioport("DSW2"); aysnd.add_route(ALL_OUTPUTS, "mono", 0.50); @@ -310,19 +294,21 @@ void albazc_state::hanaroku(machine_config &config) ROM_START( hanaroku ) - ROM_REGION( 0x10000, "maincpu", 0 ) /* z80 code */ + ROM_REGION( 0x10000, "maincpu", 0 ) // Z80 code ROM_LOAD( "zc5_1a.u02", 0x00000, 0x08000, CRC(9e3b62ce) SHA1(81aee570b67950c21ab3c8f9235dd383529b34d5) ) - ROM_REGION( 0x20000, "gfx1", 0 ) /* tiles */ + ROM_REGION( 0x20000, "tiles", 0 ) ROM_LOAD( "zc0_002.u14", 0x00000, 0x08000, CRC(76adab7f) SHA1(6efbe52ae4a1d15fe93bd05058546bf146a64154) ) ROM_LOAD( "zc0_003.u15", 0x08000, 0x08000, CRC(c208e64b) SHA1(0bc226c39331bb2e1d4d8f756199ceec85c28f28) ) ROM_LOAD( "zc0_004.u16", 0x10000, 0x08000, CRC(e8a46ee4) SHA1(09cac230c1c49cb282f540b1608ad33b1cc1a943) ) ROM_LOAD( "zc0_005.u17", 0x18000, 0x08000, CRC(7ad160a5) SHA1(c897fbe4a7c2a2f352333131dfd1a76e176f0ed8) ) - ROM_REGION( 0x0400, "proms", 0 ) /* colour */ + ROM_REGION( 0x0400, "proms", 0 ) // colour ROM_LOAD16_BYTE( "zc0_006.u21", 0x0000, 0x0200, CRC(8e8fbc30) SHA1(7075521bbd790c46c58d9e408b0d7d6a42ed00bc) ) ROM_LOAD16_BYTE( "zc0_007.u22", 0x0001, 0x0200, CRC(67225de1) SHA1(98322e71d93d247a67fb4e52edad6c6c32a603d8) ) ROM_END +} // Anonymous namespace + GAME( 1988, hanaroku, 0, hanaroku, hanaroku, albazc_state, empty_init, ROT0, "Alba", "Hanaroku", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_COLORS | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/albazg.cpp b/src/mame/drivers/albazg.cpp index 8b9e667694a..ddbcc00e944 100644 --- a/src/mame/drivers/albazg.cpp +++ b/src/mame/drivers/albazg.cpp @@ -46,7 +46,17 @@ PCB: #include "speaker.h" #include "tilemap.h" -#define MASTER_CLOCK XTAL(12'000'000) + +// configurable logging +#define LOG_PROTRAM (1U << 1) + +//#define VERBOSE (LOG_GENERAL | LOG_PROTRAM) + +#include "logmacro.h" + +#define LOGPROTRAM(...) LOGMASKED(LOG_PROTRAM, __VA_ARGS__) + +namespace { class albazg_state : public driver_device { @@ -56,49 +66,54 @@ public: m_cus_ram(*this, "cus_ram"), m_videoram(*this, "videoram"), m_colorram(*this, "colorram"), + m_rombank(*this, "rombank"), + m_in(*this, "IN%u", 0U), m_maincpu(*this, "maincpu"), m_gfxdecode(*this, "gfxdecode") { } virtual void yumefuda(machine_config &config); -private: +protected: virtual void machine_start() override; virtual void machine_reset() override; virtual void video_start() override; - void yumefuda_vram_w(offs_t offset, uint8_t data); - void yumefuda_cram_w(offs_t offset, uint8_t data); +private: + void vram_w(offs_t offset, uint8_t data); + void cram_w(offs_t offset, uint8_t data); uint8_t custom_ram_r(offs_t offset); void custom_ram_w(offs_t offset, uint8_t data); void prot_lock_w(uint8_t data); uint8_t mux_r(); void mux_w(uint8_t data); - void yumefuda_output_w(uint8_t data); - TILE_GET_INFO_MEMBER(y_get_bg_tile_info); - uint32_t screen_update_yumefuda(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + void output_w(uint8_t data); + TILE_GET_INFO_MEMBER(get_bg_tile_info); + uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); void main_map(address_map &map); void port_map(address_map &map); - /* memory pointers */ + // memory pointers required_shared_ptr m_cus_ram; required_shared_ptr m_videoram; required_shared_ptr m_colorram; + required_memory_bank m_rombank; - /* video-related */ + // video-related tilemap_t *m_bg_tilemap; - /* misc */ + // misc + required_ioport_array<7> m_in; uint8_t m_mux_data; - int m_bank; + uint8_t m_bank; uint8_t m_prot_lock; required_device m_maincpu; required_device m_gfxdecode; }; -TILE_GET_INFO_MEMBER(albazg_state::y_get_bg_tile_info) +TILE_GET_INFO_MEMBER(albazg_state::get_bg_tile_info) { int code = m_videoram[tile_index]; int color = m_colorram[tile_index]; @@ -112,10 +127,10 @@ TILE_GET_INFO_MEMBER(albazg_state::y_get_bg_tile_info) void albazg_state::video_start() { - m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(albazg_state::y_get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); + m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(albazg_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); } -uint32_t albazg_state::screen_update_yumefuda(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +uint32_t albazg_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); return 0; @@ -135,40 +150,40 @@ static const gfx_layout charlayout = }; static GFXDECODE_START( gfx_yumefuda ) - GFXDECODE_ENTRY( "gfx1", 0x0000, charlayout, 0, 8 ) + GFXDECODE_ENTRY( "tiles", 0x0000, charlayout, 0, 8 ) GFXDECODE_END -void albazg_state::yumefuda_vram_w(offs_t offset, uint8_t data) +void albazg_state::vram_w(offs_t offset, uint8_t data) { m_videoram[offset] = data; m_bg_tilemap->mark_tile_dirty(offset); } -void albazg_state::yumefuda_cram_w(offs_t offset, uint8_t data) +void albazg_state::cram_w(offs_t offset, uint8_t data) { m_colorram[offset] = data; m_bg_tilemap->mark_tile_dirty(offset); } -/*Custom RAM (Thrash Protection)*/ +// Custom RAM (Thrash Protection) uint8_t albazg_state::custom_ram_r(offs_t offset) { -// logerror("Custom RAM read at %02x PC = %x\n", offset + 0xaf80, m_maincpu->space(AS_PROGRAM).pc()); + LOGPROTRAM("Custom RAM read at %02x PC = %x\n", offset + 0xaf80, m_maincpu->pc()); return m_cus_ram[offset];// ^ 0x55; } void albazg_state::custom_ram_w(offs_t offset, uint8_t data) { -// logerror("Custom RAM write at %02x : %02x PC = %x\n", offset + 0xaf80, data, m_maincpu->space(AS_PROGRAM).pc()); - if(m_prot_lock) + LOGPROTRAM("Custom RAM write at %02x : %02x PC = %x\n", offset + 0xaf80, data, m_maincpu->pc()); + if (m_prot_lock) m_cus_ram[offset] = data; } -/*this might be used as NVRAM commands btw*/ +// this might be used as NVRAM commands btw void albazg_state::prot_lock_w(uint8_t data) { -// logerror("PC %04x Prot lock value written %02x\n", m_maincpu->space(AS_PROGRAM).pc(), data); + LOGPROTRAM("PC %04x Prot lock value written %02x\n", m_maincpu->pc(), data); m_prot_lock = data; } @@ -176,13 +191,13 @@ uint8_t albazg_state::mux_r() { switch(m_mux_data) { - case 0x00: return ioport("IN0")->read(); - case 0x01: return ioport("IN1")->read(); - case 0x02: return ioport("IN2")->read(); - case 0x04: return ioport("IN3")->read(); - case 0x08: return ioport("IN4")->read(); - case 0x10: return ioport("IN5")->read(); - case 0x20: return ioport("IN6")->read(); + case 0x00: return m_in[0]->read(); + case 0x01: return m_in[1]->read(); + case 0x02: return m_in[2]->read(); + case 0x04: return m_in[3]->read(); + case 0x08: return m_in[4]->read(); + case 0x10: return m_in[5]->read(); + case 0x20: return m_in[6]->read(); } return 0xff; @@ -190,22 +205,22 @@ uint8_t albazg_state::mux_r() void albazg_state::mux_w(uint8_t data) { - int new_bank = (data & 0xc0) >> 6; + uint8_t new_bank = (data & 0xc0) >> 6; //0x10000 "Learn Mode" //0x12000 gameplay //0x14000 bonus game //0x16000 ? - if( m_bank != new_bank) + if (m_bank != new_bank) { m_bank = new_bank; - membank("bank1")->set_entry(m_bank); + m_rombank->set_entry(m_bank); } m_mux_data = data & ~0xc0; } -void albazg_state::yumefuda_output_w(uint8_t data) +void albazg_state::output_w(uint8_t data) { machine().bookkeeping().coin_counter_w(0, ~data & 4); machine().bookkeeping().coin_counter_w(1, ~data & 2); @@ -220,14 +235,14 @@ void albazg_state::yumefuda_output_w(uint8_t data) void albazg_state::main_map(address_map &map) { map(0x0000, 0x7fff).rom(); - map(0x8000, 0x9fff).bankr("bank1"); + map(0x8000, 0x9fff).bankr(m_rombank); map(0xa7fc, 0xa7fc).w(FUNC(albazg_state::prot_lock_w)); map(0xa7ff, 0xa7ff).portw("EEPROMOUT"); - map(0xaf80, 0xafff).rw(FUNC(albazg_state::custom_ram_r), FUNC(albazg_state::custom_ram_w)).share("cus_ram"); + map(0xaf80, 0xafff).rw(FUNC(albazg_state::custom_ram_r), FUNC(albazg_state::custom_ram_w)).share(m_cus_ram); map(0xb000, 0xb07f).ram().w("palette", FUNC(palette_device::write8)).share("palette"); map(0xb080, 0xb0ff).ram().w("palette", FUNC(palette_device::write8_ext)).share("palette_ext"); - map(0xc000, 0xc3ff).ram().w(FUNC(albazg_state::yumefuda_vram_w)).share("videoram"); - map(0xd000, 0xd3ff).ram().w(FUNC(albazg_state::yumefuda_cram_w)).share("colorram"); + map(0xc000, 0xc3ff).ram().w(FUNC(albazg_state::vram_w)).share(m_videoram); + map(0xd000, 0xd3ff).ram().w(FUNC(albazg_state::cram_w)).share(m_colorram); map(0xe000, 0xffff).ram(); } @@ -291,7 +306,7 @@ static INPUT_PORTS_START( yumefuda ) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_HANAFUDA_F ) PORT_CONDITION("DSW2", 0x08, EQUALS, 0x00) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_HANAFUDA_E ) PORT_CONDITION("DSW2", 0x08, EQUALS, 0x00) - /* Some bits of these three are actually used if you use the Royal Panel type */ + // Some bits of these three are actually used if you use the Royal Panel type PORT_START("IN4") PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) @@ -310,11 +325,11 @@ static INPUT_PORTS_START( yumefuda ) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_93cxx_device, clk_write) PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_93cxx_device, di_write) - /* Unused, on the PCB there's just one bank */ + // Unused, on the PCB there's just one bank PORT_START("DSW1") PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - /*Added by translating the manual*/ + // Added by translating the manual PORT_START("DSW2") PORT_DIPNAME( 0x01, 0x01, "Learn Mode" )//SW Dip-Switches PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) @@ -346,7 +361,7 @@ void albazg_state::machine_start() { uint8_t *ROM = memregion("maincpu")->base(); - membank("bank1")->configure_entries(0, 4, &ROM[0x10000], 0x2000); + m_rombank->configure_entries(0, 4, &ROM[0x8000], 0x2000); save_item(NAME(m_mux_data)); save_item(NAME(m_bank)); @@ -362,8 +377,8 @@ void albazg_state::machine_reset() void albazg_state::yumefuda(machine_config &config) { - /* basic machine hardware */ - Z80(config, m_maincpu, MASTER_CLOCK/2); /* xtal is 12 Mhz, unknown divider*/ + // basic machine hardware + Z80(config, m_maincpu, 12_MHz_XTAL / 2); // unknown divider m_maincpu->set_addrmap(AS_PROGRAM, &albazg_state::main_map); m_maincpu->set_addrmap(AS_IO, &albazg_state::port_map); m_maincpu->set_vblank_int("screen", FUNC(albazg_state::irq0_line_hold)); @@ -377,15 +392,15 @@ void albazg_state::yumefuda(machine_config &config) ppi.in_pb_callback().set_ioport("SYSTEM"); ppi.in_pc_callback().set(FUNC(albazg_state::mux_r)); - /* video hardware */ + // video hardware screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); screen.set_refresh_hz(60); screen.set_vblank_time(ATTOSECONDS_IN_USEC(0)); screen.set_size(32*8, 32*8); screen.set_visarea_full(); - screen.set_screen_update(FUNC(albazg_state::screen_update_yumefuda)); + screen.set_screen_update(FUNC(albazg_state::screen_update)); - hd6845s_device &crtc(HD6845S(config, "crtc", MASTER_CLOCK/16)); /* hand tuned to get ~60 fps */ + hd6845s_device &crtc(HD6845S(config, "crtc", 12_MHz_XTAL / 16)); // hand tuned to get ~60 fps crtc.set_screen("screen"); crtc.set_show_border_area(false); crtc.set_char_width(8); @@ -394,13 +409,13 @@ void albazg_state::yumefuda(machine_config &config) PALETTE(config, "palette").set_format(palette_device::xRGB_555, 0x80); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); - ay8910_device &aysnd(AY8910(config, "aysnd", MASTER_CLOCK/16)); /* guessed to use the same xtal as the crtc */ + ay8910_device &aysnd(AY8910(config, "aysnd", 12_MHz_XTAL / 16)); // guessed to use the same xtal as the crtc aysnd.port_a_read_callback().set_ioport("DSW1"); aysnd.port_b_read_callback().set_ioport("DSW2"); - aysnd.port_a_write_callback().set(FUNC(albazg_state::yumefuda_output_w)); + aysnd.port_a_write_callback().set(FUNC(albazg_state::output_w)); aysnd.add_route(ALL_OUTPUTS, "mono", 0.50); } @@ -408,11 +423,11 @@ void albazg_state::yumefuda(machine_config &config) ROM_START( yumefuda ) - ROM_REGION( 0x18000, "maincpu", 0 ) /* code */ - ROM_LOAD("zg004y02.u43", 0x00000, 0x8000, CRC(974c543c) SHA1(56aeb318cb00445f133246dfddc8c24bb0c23f2d)) - ROM_LOAD("zg004y01.u42", 0x10000, 0x8000, CRC(ae99126b) SHA1(4ae2c1c804bbc505a013f5e3d98c0bfbb51b747a)) + ROM_REGION( 0x10000, "maincpu", 0 ) // code + ROM_LOAD("zg004y02.u43", 0x0000, 0x8000, CRC(974c543c) SHA1(56aeb318cb00445f133246dfddc8c24bb0c23f2d)) + ROM_LOAD("zg004y01.u42", 0x8000, 0x8000, CRC(ae99126b) SHA1(4ae2c1c804bbc505a013f5e3d98c0bfbb51b747a)) - ROM_REGION( 0x10000, "gfx1", 0 ) + ROM_REGION( 0x10000, "tiles", 0 ) ROM_LOAD("zg001006.u6", 0x0000, 0x4000, CRC(a5df443c) SHA1(a6c088a463c05e43a7b559c5d0afceddc88ef476)) ROM_LOAD("zg001005.u5", 0x4000, 0x4000, CRC(158b6cde) SHA1(3e335b7dc1bbae2edb02722025180f32ab91f69f)) ROM_LOAD("zg001004.u4", 0x8000, 0x4000, CRC(d8676435) SHA1(9b6df5378948f492717e1a4d9c833ddc5a9e8225)) @@ -422,4 +437,7 @@ ROM_START( yumefuda ) ROM_LOAD("zg1-007.u13", 0x000, 0x100, NO_DUMP ) //could be either PROM or PAL ROM_END +} // Anonymous namespace + + GAME( 1991, yumefuda, 0, yumefuda, yumefuda, albazg_state, empty_init, ROT0, "Alba", "Yumefuda [BET]", MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/chanbara.cpp b/src/mame/drivers/chanbara.cpp index adcfc0d7224..69a418dd6fa 100644 --- a/src/mame/drivers/chanbara.cpp +++ b/src/mame/drivers/chanbara.cpp @@ -46,8 +46,8 @@ Notes: TODO: - Support screen flipping for sprites - If you force-scroll an enemy off the screen rather than fight them, you'll get graphical - corruption (bad sprites) before a new enemy appears, does this happen on the PCB? - - BGM tempo is incorrect, but clocks are verfied above? ( see https://www.youtube.com/watch?v=pW9nhx1hcLM ) + corruption (bad sprites) before a new enemy appears, does this happen on the PCB? + - BGM tempo is incorrect, but clocks are verified above? ( see https://www.youtube.com/watch?v=pW9nhx1hcLM ) ****************************************************************************************/ @@ -60,16 +60,26 @@ TODO: #include "tilemap.h" +// configurable logging +#define LOG_AYOUTS (1U << 1) + +//#define VERBOSE (LOG_GENERAL | LOG_AYOUTS) + +#include "logmacro.h" + +#define LOGAYOUTS(...) LOGMASKED(LOG_AYOUTS, __VA_ARGS__) + +namespace { + class chanbara_state : public driver_device { public: chanbara_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), - m_videoram(*this, "videoram"), - m_colorram(*this, "colorram"), + m_videoram(*this, "videoram%u", 1U), + m_colorram(*this, "colorram%u", 1U), m_spriteram(*this, "spriteram"), - m_videoram2(*this, "videoram2"), - m_colorram2(*this, "colorram2"), + m_rombank(*this, "rombank"), m_maincpu(*this, "maincpu"), m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette") @@ -85,40 +95,36 @@ protected: virtual void video_start() override; private: - void chanbara_videoram_w(offs_t offset, uint8_t data); - void chanbara_colorram_w(offs_t offset, uint8_t data); - void chanbara_videoram2_w(offs_t offset, uint8_t data); - void chanbara_colorram2_w(offs_t offset, uint8_t data); - void chanbara_ay_out_0_w(uint8_t data); - void chanbara_ay_out_1_w(uint8_t data); + template void videoram_w(offs_t offset, uint8_t data); + template void colorram_w(offs_t offset, uint8_t data); + void ay_out_0_w(uint8_t data); + void ay_out_1_w(uint8_t data); TILE_GET_INFO_MEMBER(get_bg_tile_info); TILE_GET_INFO_MEMBER(get_bg2_tile_info); - void chanbara_palette(palette_device &palette) const; - uint32_t screen_update_chanbara(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void palette(palette_device &palette) const; + 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 chanbara_map(address_map &map); + void prg_map(address_map &map); - /* memory pointers */ - required_shared_ptr m_videoram; - required_shared_ptr m_colorram; + // memory pointers + required_shared_ptr_array m_videoram; + required_shared_ptr_array m_colorram; required_shared_ptr m_spriteram; - required_shared_ptr m_videoram2; - required_shared_ptr m_colorram2; + required_memory_bank m_rombank; - /* video-related */ - tilemap_t *m_bg_tilemap; - tilemap_t *m_bg2_tilemap; + // video-related + tilemap_t *m_bg_tilemap[2]; uint8_t m_scroll; uint8_t m_scrollhi; - /* devices */ + // devices required_device m_maincpu; required_device m_gfxdecode; required_device m_palette; }; -void chanbara_state::chanbara_palette(palette_device &palette) const +void chanbara_state::palette(palette_device &palette) const { uint8_t const *const color_prom = memregion("proms")->base(); @@ -132,55 +138,45 @@ void chanbara_state::chanbara_palette(palette_device &palette) const } } -void chanbara_state::chanbara_videoram_w(offs_t offset, uint8_t data) +template +void chanbara_state::videoram_w(offs_t offset, uint8_t data) { - m_videoram[offset] = data; - m_bg_tilemap->mark_tile_dirty(offset); + m_videoram[Which][offset] = data; + m_bg_tilemap[Which]->mark_tile_dirty(offset); } -void chanbara_state::chanbara_colorram_w(offs_t offset, uint8_t data) +template +void chanbara_state::colorram_w(offs_t offset, uint8_t data) { - m_colorram[offset] = data; - m_bg_tilemap->mark_tile_dirty(offset); -} - -void chanbara_state::chanbara_videoram2_w(offs_t offset, uint8_t data) -{ - m_videoram2[offset] = data; - m_bg2_tilemap->mark_tile_dirty(offset); -} - -void chanbara_state::chanbara_colorram2_w(offs_t offset, uint8_t data) -{ - m_colorram2[offset] = data; - m_bg2_tilemap->mark_tile_dirty(offset); + m_colorram[Which][offset] = data; + m_bg_tilemap[Which]->mark_tile_dirty(offset); } TILE_GET_INFO_MEMBER(chanbara_state::get_bg_tile_info) { - int code = m_videoram[tile_index] + ((m_colorram[tile_index] & 1) << 8); - int color = (m_colorram[tile_index] >> 1) & 0x1f; - //int flipy = (m_colorram[tile_index]) & 0x01; // not on this layer (although bit is used) + int code = m_videoram[0][tile_index] + ((m_colorram[0][tile_index] & 1) << 8); + int color = (m_colorram[0][tile_index] >> 1) & 0x1f; + //int flipy = (m_colorram[0][tile_index]) & 0x01; // not on this layer (although bit is used) tileinfo.set(0, code, color, 0); } TILE_GET_INFO_MEMBER(chanbara_state::get_bg2_tile_info) { - int code = m_videoram2[tile_index]; - int color = (m_colorram2[tile_index] >> 1) & 0x1f; - int flipy = (m_colorram2[tile_index]) & 0x01; + int code = m_videoram[1][tile_index]; + int color = (m_colorram[1][tile_index] >> 1) & 0x1f; + int flipy = (m_colorram[1][tile_index]) & 0x01; tileinfo.set(2, code, color, TILE_FLIPXY(flipy)); } void chanbara_state::video_start() { - m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(chanbara_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS,8, 8, 32, 32); - m_bg2_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(chanbara_state::get_bg2_tile_info)), TILEMAP_SCAN_ROWS,16, 16, 16, 32); - m_bg_tilemap->set_transparent_pen(0); - m_bg2_tilemap->set_transparent_pen(0); + m_bg_tilemap[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(chanbara_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); + m_bg_tilemap[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(chanbara_state::get_bg2_tile_info)), TILEMAP_SCAN_ROWS, 16, 16, 16, 32); + m_bg_tilemap[0]->set_transparent_pen(0); + m_bg_tilemap[1]->set_transparent_pen(0); } void chanbara_state::draw_sprites(screen_device &screen, bitmap_ind16& bitmap, const rectangle& cliprect) @@ -223,14 +219,14 @@ void chanbara_state::draw_sprites(screen_device &screen, bitmap_ind16& bitmap, c } } -uint32_t chanbara_state::screen_update_chanbara(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +uint32_t chanbara_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { screen.priority().fill(0, cliprect); - m_bg2_tilemap->set_scrolly(0, m_scroll | (m_scrollhi << 8)); - m_bg2_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0); // ensure bg pen for each tile gets drawn behind sprites - m_bg2_tilemap->draw(screen, bitmap, cliprect, 0, 1); - m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 2); + m_bg_tilemap[1]->set_scrolly(0, m_scroll | (m_scrollhi << 8)); + m_bg_tilemap[1]->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0); // ensure bg pen for each tile gets drawn behind sprites + m_bg_tilemap[1]->draw(screen, bitmap, cliprect, 0, 1); + m_bg_tilemap[0]->draw(screen, bitmap, cliprect, 0, 2); draw_sprites(screen, bitmap, cliprect); @@ -239,26 +235,26 @@ uint32_t chanbara_state::screen_update_chanbara(screen_device &screen, bitmap_in /***************************************************************************/ -void chanbara_state::chanbara_map(address_map &map) +void chanbara_state::prg_map(address_map &map) { map(0x0000, 0x07ff).ram(); - map(0x0800, 0x0bff).ram().w(FUNC(chanbara_state::chanbara_videoram_w)).share("videoram"); - map(0x0c00, 0x0fff).ram().w(FUNC(chanbara_state::chanbara_colorram_w)).share("colorram"); - map(0x1000, 0x10ff).ram().share("spriteram"); - map(0x1800, 0x19ff).ram().w(FUNC(chanbara_state::chanbara_videoram2_w)).share("videoram2"); - map(0x1a00, 0x1bff).ram().w(FUNC(chanbara_state::chanbara_colorram2_w)).share("colorram2"); + map(0x0800, 0x0bff).ram().w(FUNC(chanbara_state::videoram_w<0>)).share(m_videoram[0]); + map(0x0c00, 0x0fff).ram().w(FUNC(chanbara_state::colorram_w<0>)).share(m_colorram[0]); + map(0x1000, 0x10ff).ram().share(m_spriteram); + map(0x1800, 0x19ff).ram().w(FUNC(chanbara_state::videoram_w<1>)).share(m_videoram[1]); + map(0x1a00, 0x1bff).ram().w(FUNC(chanbara_state::colorram_w<1>)).share(m_colorram[1]); map(0x2000, 0x2000).portr("DSW1"); map(0x2001, 0x2001).portr("SYSTEM"); map(0x2002, 0x2002).portr("P2"); map(0x2003, 0x2003).portr("P1"); map(0x3800, 0x3801).rw("ymsnd", FUNC(ym2203_device::read), FUNC(ym2203_device::write)); - map(0x4000, 0x7fff).bankr("bank1"); + map(0x4000, 0x7fff).bankr(m_rombank); map(0x8000, 0xffff).rom(); } /***************************************************************************/ -/* verified from M6809 code */ +// verified from M6809 code static INPUT_PORTS_START( chanbara ) PORT_START ("DSW1") PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW1:1,2") @@ -271,13 +267,13 @@ static INPUT_PORTS_START( chanbara ) PORT_DIPSETTING( 0x0c, DEF_STR( 1C_1C ) ) PORT_DIPSETTING( 0x08, DEF_STR( 1C_2C ) ) PORT_DIPSETTING( 0x04, DEF_STR( 1C_3C ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:5") /* code at 0xedc0 */ + PORT_DIPNAME( 0x10, 0x10, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:5") // code at 0xedc0 PORT_DIPSETTING( 0x10, DEF_STR( Easy ) ) PORT_DIPSETTING( 0x00, DEF_STR( Hard ) ) PORT_DIPNAME( 0x20, 0x20, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:6") PORT_DIPSETTING( 0x00, "1" ) PORT_DIPSETTING( 0x20, "3" ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW1:7") /* table at 0xc249 (2 * 2 words) */ + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW1:7") // table at 0xc249 (2 * 2 words) PORT_DIPSETTING( 0x40, "50k and 70k" ) PORT_DIPSETTING( 0x00, DEF_STR( None ) ) PORT_DIPNAME( 0x80, 0x00, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW1:8") @@ -291,7 +287,7 @@ static INPUT_PORTS_START( chanbara ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE1 ) /* same coinage as COIN1 */ + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE1 ) // same coinage as COIN1 PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_VBLANK("screen") PORT_START ("P1") @@ -319,29 +315,29 @@ INPUT_PORTS_END static const gfx_layout tilelayout = { - 8,8, /* tile size */ - RGN_FRAC(1,2), /* number of tiles */ - 2, /* bits per pixel */ - { 0, 4 }, /* plane offsets */ - { RGN_FRAC(1,2)+0, RGN_FRAC(1,2)+1, RGN_FRAC(1,2)+2, RGN_FRAC(1,2)+3, 0,1,2,3 }, /* x offsets */ - { 0*8,1*8,2*8,3*8, 4*8, 5*8, 6*8, 7*8 }, /* y offsets */ - 8*8 /* offset to next tile */ + 8,8, // tile size + RGN_FRAC(1,2), // number of tiles + 2, // bits per pixel + { 0, 4 }, // plane offsets + { RGN_FRAC(1,2)+0, RGN_FRAC(1,2)+1, RGN_FRAC(1,2)+2, RGN_FRAC(1,2)+3, 0,1,2,3 }, // x offsets + { 0*8,1*8,2*8,3*8, 4*8, 5*8, 6*8, 7*8 }, // y offsets + 8*8 // offset to next tile }; static const gfx_layout tile16layout = { - 16,16, /* tile size */ - RGN_FRAC(1,4), /* number of tiles */ - 3, /* bits per pixel */ - { RGN_FRAC(1,2),0,4 }, /* plane offsets */ + 16,16, // tile size + RGN_FRAC(1,4), // number of tiles + 3, // bits per pixel + { RGN_FRAC(1,2),0,4 }, // plane offsets { 16*8+RGN_FRAC(1,4)+0,16*8+ RGN_FRAC(1,4)+1,16*8+ RGN_FRAC(1,4)+2,16*8+ RGN_FRAC(1,4)+3, 0,1,2,3, RGN_FRAC(1,4)+0, RGN_FRAC(1,4)+1, RGN_FRAC(1,4)+2, RGN_FRAC(1,4)+3, 16*8+0, 16*8+1, 16*8+2, 16*8+3, - }, /* x offsets */ - { 0*8,1*8,2*8,3*8, 4*8, 5*8, 6*8, 7*8,8*8,9*8,10*8,11*8,12*8,13*8,14*8,15*8 }, /* y offsets */ - 32*8 /* offset to next tile */ + }, // x offsets + { 0*8,1*8,2*8,3*8, 4*8, 5*8, 6*8, 7*8,8*8,9*8,10*8,11*8,12*8,13*8,14*8,15*8 }, // y offsets + 32*8 // offset to next tile }; @@ -367,24 +363,25 @@ GFXDECODE_END /***************************************************************************/ -void chanbara_state::chanbara_ay_out_0_w(uint8_t data) +void chanbara_state::ay_out_0_w(uint8_t data) { - //printf("chanbara_ay_out_0_w %02x\n",data); + LOGAYOUTS("ay_out_0_w %02x\n", data); m_scroll = data; } -void chanbara_state::chanbara_ay_out_1_w(uint8_t data) +void chanbara_state::ay_out_1_w(uint8_t data) { - //printf("chanbara_ay_out_1_w %02x\n",data); + LOGAYOUTS("ay_out_1_w %02x\n", data); m_scrollhi = data & 0x01; flip_screen_set(data & 0x02); - membank("bank1")->set_entry((data & 0x04) >> 2); + m_rombank->set_entry((data & 0x04) >> 2); - //if (data & 0xf8) printf("chanbara_ay_out_1_w unused bits set %02x\n", data & 0xf8); + if (data & 0xf8) + LOGAYOUTS("ay_out_1_w unused bits set %02x\n", data & 0xf8); } void chanbara_state::machine_start() @@ -402,7 +399,7 @@ void chanbara_state::machine_reset() void chanbara_state::chanbara(machine_config &config) { MC6809E(config, m_maincpu, XTAL(12'000'000)/8); - m_maincpu->set_addrmap(AS_PROGRAM, &chanbara_state::chanbara_map); + m_maincpu->set_addrmap(AS_PROGRAM, &chanbara_state::prg_map); /* video hardware */ @@ -413,19 +410,19 @@ void chanbara_state::chanbara(machine_config &config) // screen.set_visarea(0, 32*8-1, 2*8, 30*8-1); // DECO video CRTC screen.set_raw(XTAL(12'000'000)/2,384,0,256,272,16,240); - screen.set_screen_update(FUNC(chanbara_state::screen_update_chanbara)); + screen.set_screen_update(FUNC(chanbara_state::screen_update)); screen.set_palette(m_palette); GFXDECODE(config, m_gfxdecode, m_palette, gfx_chanbara); - PALETTE(config, m_palette, FUNC(chanbara_state::chanbara_palette), 256); + PALETTE(config, m_palette, FUNC(chanbara_state::palette), 256); SPEAKER(config, "mono").front_center(); ym2203_device &ymsnd(YM2203(config, "ymsnd", 12000000/8)); ymsnd.irq_handler().set_inputline(m_maincpu, 0); - ymsnd.port_a_write_callback().set(FUNC(chanbara_state::chanbara_ay_out_0_w)); - ymsnd.port_b_write_callback().set(FUNC(chanbara_state::chanbara_ay_out_1_w)); + ymsnd.port_a_write_callback().set(FUNC(chanbara_state::ay_out_0_w)); + ymsnd.port_b_write_callback().set(FUNC(chanbara_state::ay_out_1_w)); ymsnd.add_route(ALL_OUTPUTS, "mono", 1.0); } @@ -443,7 +440,7 @@ ROM_START( chanbara ) ROM_REGION( 0x08000, "gfx3", 0 ) // bg layer ROM_LOAD( "cp13.15h", 0x00000, 0x4000, CRC(2dc38c3d) SHA1(4bb1335b8285e91b51c28e74d8de11a8d6df0486) ) - /* rom cp14.13h is expanded at 0x4000 - 0x8000 */ + // ROM cp14.13h is expanded at 0x4000 - 0x8000 ROM_REGION( 0x08000, "gfx4", 0 ) ROM_LOAD( "cp14.13h", 0x00000, 0x2000, CRC(d31db368) SHA1(b62834137bfe4ac2013d2d16b0ead10bf2a2df83) ) @@ -462,9 +459,9 @@ ROM_START( chanbara ) ROM_LOAD( "cp09.4c", 0x28000, 0x4000, CRC(3f58b647) SHA1(4eb212667aedd7c397a4911ac7f1b542c5c0a70d) ) ROM_REGION( 0x0300, "proms", 0 ) - ROM_LOAD( "cp17.4k", 0x0000, 0x0100, CRC(cf03706e) SHA1(2dd2b29067f418ec590c56a38cc64d09d8dc8e09) ) /* red */ - ROM_LOAD( "cp16.5k", 0x0100, 0x0100, CRC(5fedc8ba) SHA1(8b685ce71d833fefb3e4502d1dd0cca96ba9162a) ) /* green */ - ROM_LOAD( "cp15.6k", 0x0200, 0x0100, CRC(655936eb) SHA1(762b419c0571fafd8e1c5e96d0d94999768ba325) ) /* blue */ + ROM_LOAD( "cp17.4k", 0x0000, 0x0100, CRC(cf03706e) SHA1(2dd2b29067f418ec590c56a38cc64d09d8dc8e09) ) // red + ROM_LOAD( "cp16.5k", 0x0100, 0x0100, CRC(5fedc8ba) SHA1(8b685ce71d833fefb3e4502d1dd0cca96ba9162a) ) // green + ROM_LOAD( "cp15.6k", 0x0200, 0x0100, CRC(655936eb) SHA1(762b419c0571fafd8e1c5e96d0d94999768ba325) ) // blue ROM_END @@ -482,7 +479,10 @@ void chanbara_state::init_chanbara() dst[i + 0x2000] = (src[i + 0x1000] & 0x0f) << 4; } - membank("bank1")->configure_entries(0, 2, &bg[0x0000], 0x4000); + m_rombank->configure_entries(0, 2, &bg[0x0000], 0x4000); } +} // Anonymous namespace + + GAME( 1985, chanbara, 0, chanbara, chanbara, chanbara_state, init_chanbara, ROT270, "Data East", "Chanbara", MACHINE_SUPPORTS_SAVE | MACHINE_NO_COCKTAIL ) -- cgit v1.2.3