From 8401c7227719912affee520fb7e3324a35d0f9f8 Mon Sep 17 00:00:00 2001 From: Ivan Vangelista Date: Sat, 10 Jul 2021 11:23:01 +0200 Subject: - cham24.cpp: added placeholder for missing MCU dump - xyonix.cpp: removed tagmap lookups, used logmacro --- src/mame/drivers/cham24.cpp | 3 + src/mame/drivers/xyonix.cpp | 143 ++++++++++++++++++++++++-------------------- 2 files changed, 82 insertions(+), 64 deletions(-) diff --git a/src/mame/drivers/cham24.cpp b/src/mame/drivers/cham24.cpp index ccb92b387df..83c4e811f3c 100644 --- a/src/mame/drivers/cham24.cpp +++ b/src/mame/drivers/cham24.cpp @@ -315,6 +315,9 @@ void cham24_state::cham24(machine_config &config) ROM_START( cham24 ) ROM_REGION(0x10000, "maincpu", ROMREGION_ERASE00) + ROM_REGION( 0x1000, "mcu", 0 ) + ROM_LOAD( "at89c51", 0x0000, 0x1000, NO_DUMP ) + ROM_REGION(0x100000, "user1", 0) ROM_LOAD( "24-2.u2", 0x000000, 0x100000, CRC(686e9d05) SHA1(a55b9850a4b47f1b4495710e71534ca0287b05ee) ) diff --git a/src/mame/drivers/xyonix.cpp b/src/mame/drivers/xyonix.cpp index 4308d390c03..6f9b63a142f 100644 --- a/src/mame/drivers/xyonix.cpp +++ b/src/mame/drivers/xyonix.cpp @@ -7,13 +7,13 @@ driver by David Haywood and Stephh Notes about the board: Ram is 2x 6264 (near Z80) and 1x 6264 near UM6845. Xtal is verified 16.000MHz, -I can also see another special chip . PHILKO PK8801. chip looks about the same as a -TMS3615 (though i have no idea what the chip actually is). its located next to the -prom, the 2x 256k roms, and the 1x 6264 ram. +I can also see another special chip. PHILKO PK8801. Chip looks about the same as a +TMS3615 (though I have no idea what the chip actually is). It's located next to the +PROM, the 2x 256k ROMs, and the 1x 6264 RAM. Dip SW is 1 x 8-position -on the PCB is an empty socket. written next to the socket is 68705P3. "oh no" you -say..... well, its unpopulated, so maybe it was never used? (another PCB was +On the PCB is an empty socket. Written next to the socket is 68705P3. "oh no" you +say..... well, it's unpopulated, so maybe it was never used? (another PCB was found with the 68705 populated) @@ -25,14 +25,26 @@ TODO: #include "emu.h" #include "cpu/z80/z80.h" -#include "video/mc6845.h" #include "sound/sn76496.h" +#include "video/mc6845.h" #include "screen.h" #include "speaker.h" #include "emupal.h" #include "tilemap.h" +// configurable logging +#define LOG_IO (1U << 1) + +//#define VERBOSE (LOG_GENERAL | LOG_IO) + +#include "logmacro.h" + +#define LOGIO(...) LOGMASKED(LOG_IO, __VA_ARGS__) + + +namespace { + class xyonix_state : public driver_device { public: @@ -42,8 +54,10 @@ public: m_crtc(*this, "crtc"), m_palette(*this, "palette"), m_gfxdecode(*this, "gfxdecode"), - m_gfx(*this, "gfx1"), - m_vidram(*this, "vidram") + m_tiles(*this, "tiles"), + m_vidram(*this, "vidram"), + m_dsw(*this, "DSW"), + m_player(*this, "P%u", 1U) { } void xyonix(machine_config &config); @@ -58,16 +72,19 @@ private: required_device m_crtc; required_device m_palette; required_device m_gfxdecode; - required_memory_region m_gfx; + required_region_ptr m_tiles; required_shared_ptr m_vidram; + required_ioport m_dsw; + required_ioport_array<2> m_player; + tilemap_t *m_tilemap; - int m_e0_data; - int m_credits; - int m_coins; - int m_prev_coin; + uint8_t m_e0_data; + uint8_t m_credits; + uint8_t m_coins; + uint8_t m_prev_coin; bool m_nmi_mask; DECLARE_WRITE_LINE_MEMBER(nmiclk_w); @@ -78,14 +95,14 @@ private: void vidram_w(offs_t offset, uint8_t data); TILE_GET_INFO_MEMBER(get_tile_info); - void xyonix_palette(palette_device &palette) const; + void palette(palette_device &palette) const; uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void handle_coins(int coin); void main_map(address_map &map); void port_map(address_map &map); -// MC6845_UPDATE_ROW(crtc_update_row); + [[maybe_unused]] MC6845_UPDATE_ROW(crtc_update_row); }; void xyonix_state::machine_start() @@ -120,18 +137,16 @@ void xyonix_state::nmiack_w(uint8_t data) m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); } -void xyonix_state::xyonix_palette(palette_device &palette) const +void xyonix_state::palette(palette_device &palette) const { const uint8_t *color_prom = memregion("proms")->base(); for (int i = 0; i < palette.entries(); i++) { - int bit0, bit1, bit2; - // red component - bit0 = BIT(color_prom[i], 0); - bit1 = BIT(color_prom[i], 1); - bit2 = BIT(color_prom[i], 2); + int bit0 = BIT(color_prom[i], 0); + int bit1 = BIT(color_prom[i], 1); + int bit2 = BIT(color_prom[i], 2); int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; // green component @@ -145,25 +160,24 @@ void xyonix_state::xyonix_palette(palette_device &palette) const bit1 = BIT(color_prom[i], 4); int const b = 0x4f * bit0 + 0xa8 * bit1; - palette.set_pen_color(i,rgb_t(r,g,b)); + palette.set_pen_color(i, rgb_t(r, g, b)); } } TILE_GET_INFO_MEMBER(xyonix_state::get_tile_info) { - int tileno; - int attr = m_vidram[tile_index+0x1000+1]; + int attr = m_vidram[tile_index + 0x1000 + 1]; - tileno = (m_vidram[tile_index+1] << 0) | ((attr & 0x0f) << 8); + int tileno = (m_vidram[tile_index + 1] << 0) | ((attr & 0x0f) << 8); - tileinfo.set(0,tileno,attr >> 4,0); + tileinfo.set(0, tileno, attr >> 4, 0); } void xyonix_state::vidram_w(offs_t offset, uint8_t data) { m_vidram[offset] = data; - m_tilemap->mark_tile_dirty((offset-1)&0x0fff); + m_tilemap->mark_tile_dirty((offset - 1) & 0x0fff); } void xyonix_state::video_start() @@ -177,9 +191,8 @@ uint32_t xyonix_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap return 0; } -#if 0 -// commented out because the tilemap renderer is much simpler +// not used because the tilemap renderer is much simpler MC6845_UPDATE_ROW( xyonix_state::crtc_update_row ) { @@ -194,7 +207,7 @@ MC6845_UPDATE_ROW( xyonix_state::crtc_update_row ) uint16_t tile = ((((attr & 0x0f) << 8) | code) << 3) | ra; // tile data (4 pixels with 4 bit color code) - uint16_t data = m_gfx->base()[0x8000 | tile] << 8 | m_gfx->base()[tile]; + uint16_t data = m_tiles[0x8000 | tile] << 8 | m_tiles[tile]; // draw 4 pixels bitmap.pix(y, i * 4 + 0) = pen[(attr & 0xf0) | bitswap<4>(data, 4, 0, 12, 8)]; @@ -203,7 +216,6 @@ MC6845_UPDATE_ROW( xyonix_state::crtc_update_row ) bitmap.pix(y, i * 4 + 3) = pen[(attr & 0xf0) | bitswap<4>(data, 7, 3, 15, 11)]; } } -#endif /* Inputs ********************************************************************/ @@ -217,28 +229,28 @@ void xyonix_state::handle_coins(int coin) if (coin & 1) // Coin 2 ! { - tmp = (ioport("DSW")->read() & 0xc0) >> 6; + tmp = (m_dsw->read() & 0xc0) >> 6; m_coins++; if (m_coins >= coinage_table[tmp][0]) { m_credits += coinage_table[tmp][1]; m_coins -= coinage_table[tmp][0]; } - machine().bookkeeping().coin_lockout_global_w(0); /* Unlock all coin slots */ - machine().bookkeeping().coin_counter_w(1,1); machine().bookkeeping().coin_counter_w(1,0); /* Count slot B */ + machine().bookkeeping().coin_lockout_global_w(0); // Unlock all coin slots + machine().bookkeeping().coin_counter_w(1, 1); machine().bookkeeping().coin_counter_w(1, 0); // Count slot B } if (coin & 2) // Coin 1 ! { - tmp = (ioport("DSW")->read() & 0x30) >> 4; + tmp = (m_dsw->read() & 0x30) >> 4; m_coins++; if (m_coins >= coinage_table[tmp][0]) { m_credits += coinage_table[tmp][1]; m_coins -= coinage_table[tmp][0]; } - machine().bookkeeping().coin_lockout_global_w(0); /* Unlock all coin slots */ - machine().bookkeeping().coin_counter_w(0,1); machine().bookkeeping().coin_counter_w(0,0); /* Count slot A */ + machine().bookkeeping().coin_lockout_global_w(0); // Unlock all coin slots + machine().bookkeeping().coin_counter_w(0, 1); machine().bookkeeping().coin_counter_w(0, 0); // Count slot A } if (m_credits >= 9) @@ -262,13 +274,13 @@ uint8_t xyonix_state::io_r() switch (m_e0_data) { - case 0x81 : - return ioport("P1")->read() & 0x7f; - case 0x82 : - return ioport("P2")->read() & 0x7f; + case 0x81: + return m_player[0]->read() & 0x7f; + case 0x82: + return m_player[1]->read() & 0x7f; case 0x91: - /* check coin inputs */ - coin = ((ioport("P1")->read() & 0x80) >> 7) | ((ioport("P2")->read() & 0x80) >> 6); + // check coin inputs + coin = ((m_player[0]->read() & 0x80) >> 7) | ((m_player[1]->read() & 0x80) >> 6); if (coin ^ m_prev_coin && coin != 3) { if (m_credits < 9) handle_coins(coin); @@ -276,30 +288,30 @@ uint8_t xyonix_state::io_r() m_prev_coin = coin; return m_credits; case 0x92: - return ((ioport("P1")->read() & 0x80) >> 7) | ((ioport("P2")->read() & 0x80) >> 6); - case 0xe0: /* reset? */ + return ((m_player[0]->read() & 0x80) >> 7) | ((m_player[1]->read() & 0x80) >> 6); + case 0xe0: // reset? m_coins = 0; m_credits = 0; return 0xff; case 0xe1: m_credits--; return 0xff; - case 0xfe: /* Dip Switches 1 to 4 */ - return ioport("DSW")->read() & 0x0f; - case 0xff: /* Dip Switches 5 to 8 */ - return ioport("DSW")->read() >> 4; + case 0xfe: // Dip Switches 1 to 4 + return m_dsw->read() & 0x0f; + case 0xff: // Dip Switches 5 to 8 + return m_dsw->read() >> 4; } } - //logerror ("xyonix_port_e0_r - PC = %04x - port = %02x\n", regPC, m_e0_data); - //popmessage("%02x",m_e0_data); + LOGIO("io_r - PC = %04x - port = %02x\n", regPC, m_e0_data); + //popmessage("%02x", m_e0_data); return 0xff; } void xyonix_state::io_w(uint8_t data) { - //logerror ("xyonix_port_e0_w %02x - PC = %04x\n", data, m_maincpu->pc()); + LOGIO("io_w %02x - PC = %04x\n", data, m_maincpu->pc()); m_e0_data = data; } @@ -309,13 +321,13 @@ void xyonix_state::main_map(address_map &map) { map(0x0000, 0xbfff).rom(); map(0xc000, 0xdfff).ram(); - map(0xe000, 0xffff).ram().w(FUNC(xyonix_state::vidram_w)).share("vidram"); + map(0xe000, 0xffff).ram().w(FUNC(xyonix_state::vidram_w)).share(m_vidram); } void xyonix_state::port_map(address_map &map) { map.global_mask(0xff); - map(0x20, 0x20).nopr().w("sn1", FUNC(sn76496_device::write)); /* SN76496 ready signal */ + map(0x20, 0x20).nopr().w("sn1", FUNC(sn76496_device::write)); // SN76496 ready signal map(0x21, 0x21).nopr().w("sn2", FUNC(sn76496_device::write)); map(0x40, 0x40).w(FUNC(xyonix_state::nmiack_w)); map(0x50, 0x50).w(FUNC(xyonix_state::irqack_w)); @@ -335,7 +347,7 @@ static INPUT_PORTS_START( xyonix ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) /* handled by xyonix_io_r() */ + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) // handled by io_r() PORT_START("P2") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) @@ -345,7 +357,7 @@ static INPUT_PORTS_START( xyonix ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 ) /* handled by xyonix_io_r() */ + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 ) // handled by io_r() PORT_START("DSW") PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) @@ -383,7 +395,7 @@ static const gfx_layout charlayout = }; static GFXDECODE_START( gfx_xyonix ) - GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 16 ) + GFXDECODE_ENTRY( "tiles", 0, charlayout, 0, 16 ) GFXDECODE_END @@ -391,13 +403,13 @@ GFXDECODE_END void xyonix_state::xyonix(machine_config &config) { - /* basic machine hardware */ - Z80(config, m_maincpu, 16000000 / 4); /* 4 MHz ? */ + // basic machine hardware + Z80(config, m_maincpu, 16000000 / 4); // 4 MHz ? m_maincpu->set_addrmap(AS_PROGRAM, &xyonix_state::main_map); m_maincpu->set_addrmap(AS_IO, &xyonix_state::port_map); - m_maincpu->set_periodic_int(FUNC(xyonix_state::irq0_line_assert), attotime::from_hz(4*60)); /* ?? controls music tempo */ + m_maincpu->set_periodic_int(FUNC(xyonix_state::irq0_line_assert), attotime::from_hz(4*60)); // ?? controls music tempo - /* video hardware */ + // video hardware screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); screen.set_raw(16_MHz_XTAL / 2, 508, 0, 320, 256, 0, 224); // 8 MHz? screen.set_screen_update(FUNC(xyonix_state::screen_update)); @@ -406,7 +418,7 @@ void xyonix_state::xyonix(machine_config &config) GFXDECODE(config, m_gfxdecode, "palette", gfx_xyonix); - PALETTE(config, "palette", FUNC(xyonix_state::xyonix_palette), 256); + PALETTE(config, "palette", FUNC(xyonix_state::palette), 256); MC6845(config, m_crtc, 16_MHz_XTAL / 8); // 2 MHz? m_crtc->set_screen("screen"); @@ -415,7 +427,7 @@ void xyonix_state::xyonix(machine_config &config) // m_crtc->set_update_row_callback(FUNC(xyonix_state::crtc_update_row)); m_crtc->out_vsync_callback().set(FUNC(xyonix_state::nmiclk_w)); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); SN76496(config, "sn1", 16000000/4).add_route(ALL_OUTPUTS, "mono", 1.0); @@ -431,7 +443,7 @@ ROM_START( xyonix ) ROM_REGION( 0x10000, "mcu", 0 ) ROM_LOAD( "mc68705p3s.e7", 0x00000, 0x780, BAD_DUMP CRC(f60cdd86) SHA1(e18cc598153b3e108942328ee9c5b9f83b034c41) ) // FIXED BITS (xxxxxx0x) - ROM_REGION( 0x10000, "gfx1", 0 ) + ROM_REGION( 0x10000, "tiles", 0 ) ROM_LOAD( "xyonix1.bin", 0x00000, 0x08000, CRC(3dfa9596) SHA1(52cdbbe18f83cea7248c29588ea3a18c4bb7984f) ) ROM_LOAD( "xyonix2.bin", 0x08000, 0x08000, CRC(db87343e) SHA1(62bc30cd65b2f8976cd73a0b349a9ccdb3faaad2) ) @@ -439,6 +451,9 @@ ROM_START( xyonix ) ROM_LOAD( "xyonix.pr", 0x0000, 0x0100, CRC(0012cfc9) SHA1(c7454107a1a8083a370b662c617117b769c0dc1c) ) ROM_END +} // Anonymous namespace + + /* GAME drivers **************************************************************/ GAME( 1989, xyonix, 0, xyonix, xyonix, xyonix_state, empty_init, ROT0, "Philko", "Xyonix", MACHINE_SUPPORTS_SAVE ) -- cgit v1.2.3