From 869f8d51e819b69109d1bfb20f2fa194db0a7d0a Mon Sep 17 00:00:00 2001 From: Ivan Vangelista Date: Wed, 6 Apr 2022 18:05:10 +0200 Subject: - contra.cpp: added hardware infos [Guru] - epos.cpp, ksayakyu.cpp: finder and other minor cleanups - whitestar.cpp: used finder instead of tag lookup for memory bank --- scripts/target/mame/arcade.lua | 4 - src/mame/drivers/contra.cpp | 121 +++++++++++++ src/mame/drivers/epos.cpp | 402 ++++++++++++++++++++++++++++++----------- src/mame/drivers/ksayakyu.cpp | 255 +++++++++++++++++++++++--- src/mame/drivers/whitestar.cpp | 16 +- src/mame/includes/epos.h | 70 ------- src/mame/includes/ksayakyu.h | 74 -------- src/mame/video/epos.cpp | 103 ----------- src/mame/video/ksayakyu.cpp | 134 -------------- 9 files changed, 658 insertions(+), 521 deletions(-) delete mode 100644 src/mame/includes/epos.h delete mode 100644 src/mame/includes/ksayakyu.h delete mode 100644 src/mame/video/epos.cpp delete mode 100644 src/mame/video/ksayakyu.cpp diff --git a/scripts/target/mame/arcade.lua b/scripts/target/mame/arcade.lua index 13c106c5fa9..a01de413bd5 100644 --- a/scripts/target/mame/arcade.lua +++ b/scripts/target/mame/arcade.lua @@ -4044,8 +4044,6 @@ files { MAME_DIR .. "src/mame/drivers/invqix.cpp", MAME_DIR .. "src/mame/drivers/jollyjgr.cpp", MAME_DIR .. "src/mame/drivers/ksayakyu.cpp", - MAME_DIR .. "src/mame/includes/ksayakyu.h", - MAME_DIR .. "src/mame/video/ksayakyu.cpp", MAME_DIR .. "src/mame/drivers/lgp.cpp", MAME_DIR .. "src/mame/drivers/lkage.cpp", MAME_DIR .. "src/mame/includes/lkage.h", @@ -4850,8 +4848,6 @@ files { MAME_DIR .. "src/mame/drivers/efdt.cpp", MAME_DIR .. "src/mame/drivers/electra.cpp", MAME_DIR .. "src/mame/drivers/epos.cpp", - MAME_DIR .. "src/mame/includes/epos.h", - MAME_DIR .. "src/mame/video/epos.cpp", MAME_DIR .. "src/mame/drivers/esd16.cpp", MAME_DIR .. "src/mame/includes/esd16.h", MAME_DIR .. "src/mame/video/esd16.cpp", diff --git a/src/mame/drivers/contra.cpp b/src/mame/drivers/contra.cpp index db1de4b2622..15dff5ebadf 100644 --- a/src/mame/drivers/contra.cpp +++ b/src/mame/drivers/contra.cpp @@ -16,8 +16,129 @@ Credits: 2008-07 Dip locations and factory settings verified with manual +*************************************************************************** + +Contra / Gryzor, Konami 1987 +Hardware info by Guru + +GX633 PWB302160 +|-------------------------------------------------------| +|CN1 LA4445 CN3 CN4 YM2151 68B09 633M03.18A | +| VOL 633I02.17A 63C09 | +|CN2 VOL 633E01.12A 007324 | +| 005924 LM324 YM3012 | +| | +| 8416 8464 | +| DIPSW1 24MHz 007452 | +|005273(x5) 3.579545MHz 007766 | +| DIPSW2 | +|J 633E04.7D 633E06.16D | +|A DIPSW3 |-----------| |-----------| | +|M | |5164 | |5164 | +|M | KONAMI | | KONAMI | | +|A|--------| | 007121 | | 007121 | | +| | | | | | | | +| | KONAMI | | | | | | +| | 007593 | |-----------| |-----------| | +| | | | +| | |633E05.7F 633E07.16F | +| |--------| 633E08.10G 4464 4464 633E10.18G 4464 4464| +| 633E09.12G 633E11.20G | +|-------------------------------------------------------| +Notes: + LA4445 - Sanyo LA4445 2-Channel (Stereo) 5.5W Audio Power Amplifier + 68B09 - 1.7897725MHz [3.579545/2] (audio CPU) + 63C09 - 3.000MHz [24/8] (main CPU) + YM2151 - Yamaha YM2151 FM Operator Type-M (OPM) sound chip. Clock input 3.579545MHz + YM3012 - Yamaha YM3012 2-Channel Serial Input Floating D/A Converter (DAC-MS). Clock input 1.7897725MHz [3.579545/2] + LM324 - Texas Instruments LM324 Quad Operational Amplifier + CN1 - 4-pin connector for additional composite sync output + CN2 - 4-pin connector for 2nd speaker for stereo audio output + CN3 - 4-pin connector for mono output selector \ with loopback plug connected to either CN3 or CN4 + CN4 - 4-pin connector for stereo output selector / + 8416 - Fujitsu MB8416 2kBx8-bit SRAM (sound program RAM) + 8464 - Fujitsu MB8464 8kBx8-bit SRAM (main program RAM) + 5164 - Sharp LH5164 or Fujitsu MB8464 8kBx8-bit SRAM (background RAM) + 4464 - NEC D4464 64kBx8-bit DRAM (sprite RAM) + 005273 - Konami custom resistor pack for controls/inputs + 005924 - Konami custom ceramic coin counter driver + 007766 - PAL16L8 marked '007766' at location 20D + 007121 - Konami custom sprite / background generator + 007324 - Resistor array package containing 8x 150 ohm resistors. The IC looks like a DIP16 logic chip + but with an epoxy top. The schematics show it connected to the 6309 data lines (D0-D7) and the + program ROM data lines (D0-D7). It is a simple resistor array. + 007452 - Konami custom chip + 007593 - Konami custom ceramic color mixer and RGB video DAC + Contains some logic and 2x 2kBx8-bit SRAMs for color RAM. + This IC also has 16x I/O lines but they are not connected on this PCB. + 633I02.17A - 27512 64kBx8-bit EPROM \ + 633M03.18A - 27512 64kBx8-bit EPROM / (main program) + 633E01.12A - 27256 32kBx8-bit EPROM (sound program) + 633E04.7D - \ + 633E05.7F - | + 633E06.16D - | 256kBx8-bit (2Mbit) DIP40 mask ROM (graphics) + 633E07.16F - / + 633E08.10G - MMI 63S141 256x4-bit Bipolar PROM, compatible with 82S129 (sprite lookup table) + 633E09.12G - MMI 63S141 256x4-bit Bipolar PROM, compatible with 82S129 (character lookup table) + 633E10.18G - MMI 63S141 256x4-bit Bipolar PROM, compatible with 82S129 (sprite lookup table) + 633E11.20G - MMI 63S141 256x4-bit Bipolar PROM, compatible with 82S129 (character lookup table) + DIPSW3 - 4-position DIP switch + DIPSW1/2 - 8-position DIP switch + + +Contra / Gryzor bootleg +Hardware info by Guru + +(no PCB number) +|-------------------------------------------------------------------------------------| +| C1182 51C64 51C64 51C64 51C64 51C64 G-4.A17| A +| VOL PAL16R6 51C64 51C64 51C64 51C64 51C64 4016 82S129.B15 G-5.B17| B +| |------------------| 82S129.C15 | C +| 18MHz PAL16R8| | G-6.D17| D +| | | | E +| |----SUB-BOARD-----| G-7.F17| F +| G-3.G2 PAL16R4 PAL16L8 G-8.G17| G +| PAL16R4 | H +|J G-2.J2 G-9.J17| J +|A 68B09(1) 6264 PAL16L8 G-10.K17| K +|M LM324 YM3012 4016 G-11.L17| L +|M DIPSW3 YM2151 G-12.M17| M +|A 68B09(2) PAL20L8 PAL20L8 | N +| G-13.P17| P +| DIPSW1 DIPSW2 G-1.P5 2063 2063 PAL16R8 G-14.Q17| Q +|14.31818MHz 2015 | R +| G-15.S17| S +| 82S129.T16 G-16.T17| T +| 82S129.U16 | U +| G-17.V17| V +| 6116 6116 G-18.W17| W +|-------------------------------------------------------------------------------------| + 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 + +Notes: + 68B09(1) - Motorola MC68B09EP CPU. Clock input 3.000MHz [18/6] + 68B09(2) - Motorola MC68B09EP CPU. Clock input 1.7897725MHz [14.31818/8] + YM3012 - Yamaha YM3012 2-Channel Serial Input Floating D/A Converter (DAC-MS). Clock input 1.7897725MHz [3.579545/2] + YM2151 - Yamaha YM2151 FM Operator Type-M (OPM) sound chip. Clock input 3.579545MHz [14.31818/4] + 51C64 - Hynix HY51C64 64kBx1-bit DRAM (sprite RAM). Total RAM is 80kBx8-bit whereas the original board has 128kBx8-bit DRAM (4x 4464 chips). + 6116 - HM6116 2kBx8-bit SRAM (color RAM). At power-on, this is tested as one RAM equivalent to the + internal 4kBx8-bit SRAM in the custom color mixer/RGB DAC at 1F on the original board. + 6264 - Hitachi HM6264 8kBx8-bit SRAM (main program RAM) + 2063 - Toshiba TMM2063 8kBx8-bit SRAM (background RAM front layer) + 4016 - NEC D4016 2kBx8-bit SRAM (background RAM back layer) + 2015 - Toshiba TMM2015 2kBx8-bit SRAM (sound program RAM) + C1182 - NEC C1182 Audio Power Amplifier + LM324 - Texas Instruments LM324 Quad Operational Amplifier + SUB-BOARD - Daughter board containing logic plugged into a DIP40 socket. Might be a re-implementation + of Konami 007452 custom chip modified to fit a DIP40 socket. + DIPSW3 - 4-position DIP switch + DIPSW1/2 - 8-position DIP switch + HSync - 15.35929kHz + VSync - 61.0208Hz + ***************************************************************************/ + #include "emu.h" #include "includes/konamipt.h" diff --git a/src/mame/drivers/epos.cpp b/src/mame/drivers/epos.cpp index 5e1be7e6b8c..38675d375eb 100644 --- a/src/mame/drivers/epos.cpp +++ b/src/mame/drivers/epos.cpp @@ -72,18 +72,210 @@ ***************************************************************************/ #include "emu.h" -#include "includes/epos.h" #include "cpu/z80/z80.h" #include "machine/i8255.h" -#include "machine/watchdog.h" #include "machine/nvram.h" +#include "machine/watchdog.h" #include "sound/ay8910.h" + +#include "emupal.h" #include "screen.h" #include "speaker.h" -void epos_state::dealer_decrypt_rom(offs_t offset, uint8_t data) +namespace { + +class epos_base_state : public driver_device +{ +public: + epos_base_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_videoram(*this, "videoram"), + m_maincpu(*this, "maincpu"), + m_palette(*this, "palette") + { } + +protected: + virtual void video_start() override; + virtual void video_reset() override; + + static void set_pal_color(palette_device &palette, uint8_t offset, uint8_t data); // TODO: convert to an RGB converter and set_format + + // memory pointers + required_shared_ptr m_videoram; + + // devices + required_device m_maincpu; + required_device m_palette; + + // video-related + uint8_t m_palette_bank = 0U; + + uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); +}; + +class tristar8000_state : public epos_base_state +{ +public: + tristar8000_state(const machine_config &mconfig, device_type type, const char *tag) : + epos_base_state(mconfig, type, tag), + m_leds(*this, "led%u", 0U) + { } + + void tristar8000(machine_config &config); + +protected: + virtual void machine_start() override { m_leds.resolve(); } + +private: + // I/O + output_finder<2> m_leds; + + void port_1_w(uint8_t data); + void palette(palette_device &palette) const; + + void io_map(address_map &map); + void prg_map(address_map &map); +}; + +class tristar9000_state : public epos_base_state +{ +public: + tristar9000_state(const machine_config &mconfig, device_type type, const char *tag) : + epos_base_state(mconfig, type, tag), + m_mainbank(*this, "mainbank%u", 1U), + m_inputs(*this, { "INPUTS", "INPUTS2" }), + m_dsw(*this, "DSW") + { } + + void tristar9000(machine_config &config); + + void init_tristar9000(); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + +private: + required_memory_bank_array<2> m_mainbank; + + required_ioport_array<2> m_inputs; + required_ioport m_dsw; + + // misc + uint8_t m_counter = 0; + uint8_t m_input_multiplex = 0; + bool m_ay_porta_multiplex = false; + + void decrypt_rom(offs_t offset, uint8_t data); + uint8_t i8255_porta_r(); + void i8255_portc_w(uint8_t data); + uint8_t ay_porta_mpx_r(); + void flip_screen_w(uint8_t data); + void pal_w(offs_t offset, uint8_t data); + void io_map(address_map &map); + void prg_map(address_map &map); +}; + + +// video + +/*************************************************************************** + + These games has one 32 byte palette PROM, connected to the RGB output this way: + + bit 7 -- 240 ohm resistor -- RED + -- 510 ohm resistor -- RED + -- 1 kohm resistor -- RED + -- 240 ohm resistor -- GREEN + -- 510 ohm resistor -- GREEN + -- 1 kohm resistor -- GREEN + -- 240 ohm resistor -- BLUE + bit 0 -- 510 ohm resistor -- BLUE + +***************************************************************************/ + +void tristar8000_state::palette(palette_device &palette) const +{ + uint8_t const *const color_prom = memregion("proms")->base(); + int const len = memregion("proms")->bytes(); + + for (offs_t i = 0; i < len; i++) + set_pal_color(palette, i, color_prom[i]); +} + +void epos_base_state::set_pal_color(palette_device &palette, uint8_t offset, uint8_t data) +{ + int bit0 = BIT(data, 7); + int bit1 = BIT(data, 6); + int bit2 = BIT(data, 5); + int const r = 0x92 * bit0 + 0x4a * bit1 + 0x23 * bit2; + + bit0 = BIT(data, 4); + bit1 = BIT(data, 3); + bit2 = BIT(data, 2); + int const g = 0x92 * bit0 + 0x4a * bit1 + 0x23 * bit2; + + bit0 = BIT(data, 1); + bit1 = BIT(data, 0); + int const b = 0xad * bit0 + 0x52 * bit1; + + palette.set_pen_color(offset, rgb_t(r, g, b)); +} + +// later (tristar 9000) games uses a dynamic palette instead of prom +void tristar9000_state::pal_w(offs_t offset, uint8_t data) +{ + set_pal_color(*m_palette, offset, data); +} + +void tristar8000_state::port_1_w(uint8_t data) +{ + /* D0 - start light #1 + D1 - start light #2 + D2 - coin counter + D3 - palette select + D4-D7 - unused + */ + + m_leds[0] = BIT(data, 0); + m_leds[1] = BIT(data, 1); + + machine().bookkeeping().coin_counter_w(0, (data >> 2) & 0x01); + + m_palette_bank = (data >> 3) & 0x01; +} + + +uint32_t epos_base_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + for (offs_t offs = 0; offs < m_videoram.bytes(); offs++) + { + uint8_t const data = m_videoram[offs]; + + int x = (offs % 136) * 2; + int y = (offs / 136); + + if (flip_screen()) + { + bitmap.pix(240 - y, 270 - x + 1) = m_palette->pen((m_palette_bank << 4) | (data & 0x0f)); + bitmap.pix(240 - y, 270 - x + 0) = m_palette->pen((m_palette_bank << 4) | (data >> 4)); + } + else + { + bitmap.pix(y, x + 0) = m_palette->pen((m_palette_bank << 4) | (data & 0x0f)); + bitmap.pix(y, x + 1) = m_palette->pen((m_palette_bank << 4) | (data >> 4)); + } + } + + return 0; +} + + +// machine + +void tristar9000_state::decrypt_rom(offs_t offset, uint8_t data) { if (offset & 0x04) m_counter = (m_counter + 1) & 0x03; @@ -92,7 +284,7 @@ void epos_state::dealer_decrypt_rom(offs_t offset, uint8_t data) //logerror("PC %08x: ctr=%04x\n",m_maincpu->pc(), m_counter); - membank("bank1")->set_entry(m_counter); + m_mainbank[0]->set_entry(m_counter); // is the 2nd bank changed by the counter or it always uses the 1st key? } @@ -104,19 +296,19 @@ void epos_state::dealer_decrypt_rom(offs_t offset, uint8_t data) * *************************************/ -void epos_state::epos_map(address_map &map) +void tristar8000_state::prg_map(address_map &map) { map(0x0000, 0x77ff).rom(); map(0x7800, 0x7fff).ram(); - map(0x8000, 0xffff).ram().share("videoram"); + map(0x8000, 0xffff).ram().share(m_videoram); } -void epos_state::dealer_map(address_map &map) +void tristar9000_state::prg_map(address_map &map) { - map(0x0000, 0x5fff).bankr("bank1"); - map(0x6000, 0x6fff).bankr("bank2"); + map(0x0000, 0x5fff).bankr(m_mainbank[0]); + map(0x6000, 0x6fff).bankr(m_mainbank[1]); map(0x7000, 0x7fff).ram().share("nvram"); - map(0x8000, 0xffff).ram().share("videoram"); + map(0x8000, 0xffff).ram().share(m_videoram); } @@ -126,29 +318,29 @@ void epos_state::dealer_map(address_map &map) * *************************************/ -void epos_state::epos_io_map(address_map &map) +void tristar8000_state::io_map(address_map &map) { map.global_mask(0xff); map(0x00, 0x00).portr("DSW").w("watchdog", FUNC(watchdog_timer_device::reset_w)); - map(0x01, 0x01).portr("SYSTEM").w(FUNC(epos_state::port_1_w)); + map(0x01, 0x01).portr("SYSTEM").w(FUNC(tristar8000_state::port_1_w)); map(0x02, 0x02).portr("INPUTS").w("aysnd", FUNC(ay8910_device::data_w)); map(0x03, 0x03).portr("UNK"); map(0x06, 0x06).w("aysnd", FUNC(ay8910_device::address_w)); } -void epos_state::dealer_io_map(address_map &map) +void tristar9000_state::io_map(address_map &map) { map.global_mask(0xff); - map(0x00, 0x0f).w(FUNC(epos_state::dealer_pal_w)); + map(0x00, 0x0f).w(FUNC(tristar9000_state::pal_w)); map(0x10, 0x13).rw("ppi8255", FUNC(i8255_device::read), FUNC(i8255_device::write)); - map(0x20, 0x24).w(FUNC(epos_state::dealer_decrypt_rom)); + map(0x20, 0x24).w(FUNC(tristar9000_state::decrypt_rom)); map(0x34, 0x34).w("aysnd", FUNC(ay8910_device::data_w)); map(0x38, 0x38).r("aysnd", FUNC(ay8910_device::data_r)); map(0x3c, 0x3c).w("aysnd", FUNC(ay8910_device::address_w)); map(0x40, 0x40).w("watchdog", FUNC(watchdog_timer_device::reset_w)); } -uint8_t epos_state::i8255_porta_r() +uint8_t tristar9000_state::i8255_porta_r() { uint8_t data = 0xff; @@ -166,18 +358,18 @@ uint8_t epos_state::i8255_porta_r() There's a separate ROM check for banked U04 at 30F3. It looks like dealer/revenger uses ppi8255 to control bankswitching. */ -void epos_state::i8255_portc_w(uint8_t data) +void tristar9000_state::i8255_portc_w(uint8_t data) { - membank("bank2")->set_entry(data & 0x01); + m_mainbank[1]->set_entry(data & 0x01); m_input_multiplex = (data >> 5) & 3; } -uint8_t epos_state::ay_porta_mpx_r() +uint8_t tristar9000_state::ay_porta_mpx_r() { - return (m_ay_porta_multiplex ? 0xFF : ioport("DSW")->read()); + return (m_ay_porta_multiplex ? 0xff : m_dsw->read()); } -void epos_state::flip_screen_w(uint8_t data) +void tristar9000_state::flip_screen_w(uint8_t data) { flip_screen_set(BIT(data, 7)); // bit 6: ay8910 port A/B multiplexer read @@ -230,8 +422,8 @@ static INPUT_PORTS_START( megadon ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START2 ) PORT_SERVICE_NO_TOGGLE(0x10, IP_ACTIVE_LOW) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_CUSTOM ) /* this has to be HI */ - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_CUSTOM ) /* this has to be HI */ + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_CUSTOM ) // this has to be HI + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_CUSTOM ) // this has to be HI PORT_START("INPUTS") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) @@ -280,8 +472,8 @@ static INPUT_PORTS_START( suprglob ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START2 ) PORT_SERVICE_NO_TOGGLE(0x10, IP_ACTIVE_LOW) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_CUSTOM ) /* this has to be LO */ - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_CUSTOM ) /* this has to be HI */ + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_CUSTOM ) // this has to be LO + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_CUSTOM ) // this has to be HI PORT_START("INPUTS") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) @@ -332,8 +524,8 @@ static INPUT_PORTS_START( igmo ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START2 ) PORT_SERVICE_NO_TOGGLE(0x10, IP_ACTIVE_LOW) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_CUSTOM ) /* this has to be HI */ - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_CUSTOM ) /* this has to be HI */ + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_CUSTOM ) // this has to be HI + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_CUSTOM ) // this has to be HI PORT_START("INPUTS") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) @@ -414,8 +606,8 @@ static INPUT_PORTS_START( eeekk ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START2 ) PORT_SERVICE_NO_TOGGLE(0x10, IP_ACTIVE_LOW) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_CUSTOM ) /* this has to be LO */ - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_CUSTOM ) /* this has to be LO */ + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_CUSTOM ) // this has to be LO + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_CUSTOM ) // this has to be LO PORT_START("INPUTS") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) @@ -511,97 +703,97 @@ INPUT_PORTS_END * *************************************/ -MACHINE_START_MEMBER(epos_state,epos) +void epos_base_state::video_start() { save_item(NAME(m_palette_bank)); +} + +void tristar9000_state::machine_start() +{ + uint8_t *rom = memregion("maincpu")->base(); + m_mainbank[0]->configure_entries(0, 4, &rom[0x0000], 0x10000); + m_mainbank[1]->configure_entries(0, 2, &rom[0x6000], 0x1000); + + m_mainbank[0]->set_entry(0); + m_mainbank[1]->set_entry(0); + save_item(NAME(m_counter)); save_item(NAME(m_input_multiplex)); save_item(NAME(m_ay_porta_multiplex)); } -void epos_state::machine_reset() +void epos_base_state::video_reset() { m_palette_bank = 0; - m_counter = 0; - m_input_multiplex = 3; - m_ay_porta_multiplex = 0; } - -MACHINE_START_MEMBER(epos_state,dealer) +void tristar9000_state::machine_reset() { - uint8_t *ROM = memregion("maincpu")->base(); - membank("bank1")->configure_entries(0, 4, &ROM[0x0000], 0x10000); - membank("bank2")->configure_entries(0, 2, &ROM[0x6000], 0x1000); - - membank("bank1")->set_entry(0); - membank("bank2")->set_entry(0); - - MACHINE_START_CALL_MEMBER(epos); + m_counter = 0; + m_input_multiplex = 3; + m_ay_porta_multiplex = 0; } -void epos_state::epos(machine_config &config) /* EPOS TRISTAR 8000 PCB */ +void tristar8000_state::tristar8000(machine_config &config) // EPOS TRISTAR 8000 PCB { - /* basic machine hardware */ - Z80(config, m_maincpu, XTAL(11'000'000)/4); /* 2.75 MHz schematics confirm 11MHz XTAL (see notes) */ - m_maincpu->set_addrmap(AS_PROGRAM, &epos_state::epos_map); - m_maincpu->set_addrmap(AS_IO, &epos_state::epos_io_map); - m_maincpu->set_vblank_int("screen", FUNC(epos_state::irq0_line_hold)); + // basic machine hardware + Z80(config, m_maincpu, XTAL(11'000'000) / 4); // 2.75 MHz schematics confirm 11MHz XTAL (see notes) + m_maincpu->set_addrmap(AS_PROGRAM, &tristar8000_state::prg_map); + m_maincpu->set_addrmap(AS_IO, &tristar8000_state::io_map); + m_maincpu->set_vblank_int("screen", FUNC(tristar8000_state::irq0_line_hold)); WATCHDOG_TIMER(config, "watchdog"); - /* 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(2500) /* not accurate */); + screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500)); // not accurate screen.set_size(272, 241); screen.set_visarea(0, 271, 0, 235); - screen.set_screen_update(FUNC(epos_state::screen_update)); + screen.set_screen_update(FUNC(tristar8000_state::screen_update)); - PALETTE(config, m_palette, FUNC(epos_state::epos_palette), 32); + PALETTE(config, m_palette, FUNC(tristar8000_state::palette), 32); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); - AY8912(config, "aysnd", XTAL(11'000'000)/16).add_route(ALL_OUTPUTS, "mono", 1.0); /* 0.6875 MHz, confirmed from schematics */ + AY8912(config, "aysnd", XTAL(11'000'000) / 16).add_route(ALL_OUTPUTS, "mono", 1.0); // 0.6875 MHz, confirmed from schematics } -void epos_state::dealer(machine_config &config) /* EPOS TRISTAR 9000 PCB */ +void tristar9000_state::tristar9000(machine_config &config) // EPOS TRISTAR 9000 PCB { - /* basic machine hardware */ - Z80(config, m_maincpu, XTAL(22'118'400)/8); /* 2.7648 MHz (measured) */ - m_maincpu->set_addrmap(AS_PROGRAM, &epos_state::dealer_map); - m_maincpu->set_addrmap(AS_IO, &epos_state::dealer_io_map); - m_maincpu->set_vblank_int("screen", FUNC(epos_state::irq0_line_hold)); + // basic machine hardware + Z80(config, m_maincpu, XTAL(22'118'400) / 8); // 2.7648 MHz (measured) + m_maincpu->set_addrmap(AS_PROGRAM, &tristar9000_state::prg_map); + m_maincpu->set_addrmap(AS_IO, &tristar9000_state::io_map); + m_maincpu->set_vblank_int("screen", FUNC(tristar9000_state::irq0_line_hold)); i8255_device &ppi(I8255A(config, "ppi8255")); - ppi.in_pa_callback().set(FUNC(epos_state::i8255_porta_r)); - ppi.out_pc_callback().set(FUNC(epos_state::i8255_portc_w)); + ppi.in_pa_callback().set(FUNC(tristar9000_state::i8255_porta_r)); + ppi.out_pc_callback().set(FUNC(tristar9000_state::i8255_portc_w)); NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0); - MCFG_MACHINE_START_OVERRIDE(epos_state,dealer) - // RAM-based palette instead of prom PALETTE(config, m_palette, palette_device::BLACK, 32); WATCHDOG_TIMER(config, "watchdog"); - /* 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(2500) /* not accurate */); + screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500)); // not accurate screen.set_size(272, 241); screen.set_visarea(0, 271, 0, 235); - screen.set_screen_update(FUNC(epos_state::screen_update)); + screen.set_screen_update(FUNC(tristar9000_state::screen_update)); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); - ay8910_device &aysnd(AY8910(config, "aysnd", XTAL(22'118'400)/32)); /* 0.6912 MHz (measured) */ + ay8910_device &aysnd(AY8910(config, "aysnd", XTAL(22'118'400) / 32)); // 0.6912 MHz (measured) aysnd.add_route(ALL_OUTPUTS, "mono", 1.0); - aysnd.port_a_read_callback().set(FUNC(epos_state::ay_porta_mpx_r)); + aysnd.port_a_read_callback().set(FUNC(tristar9000_state::ay_porta_mpx_r)); // port a writes? - aysnd.port_b_write_callback().set(FUNC(epos_state::flip_screen_w)); // flipscreen and ay port a multiplex control + aysnd.port_b_write_callback().set(FUNC(tristar9000_state::flip_screen_w)); // flipscreen and ay port a multiplex control } @@ -632,7 +824,7 @@ ROM_START( catapult ) ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "co3223.u10", 0x0000, 0x1000, CRC(50abcfd2) SHA1(13ce04addc7bcaa1ec6659da26b1c13ed9dc28f9) ) ROM_LOAD( "co3223.u09", 0x1000, 0x1000, CRC(fd5a9a1c) SHA1(512374e8450459537ba2cc41e7d0178052445316) ) - ROM_LOAD( "co3223.u08", 0x2000, 0x1000, BAD_DUMP CRC(4bfc36f3) SHA1(b916805eed40cfeff0c1b0cb3cdcbcc6e362a236) ) /* BADADDR xxxx-xxxxxxx */ + ROM_LOAD( "co3223.u08", 0x2000, 0x1000, BAD_DUMP CRC(4bfc36f3) SHA1(b916805eed40cfeff0c1b0cb3cdcbcc6e362a236) ) // BADADDR xxxx-xxxxxxx ROM_LOAD( "co3223.u07", 0x3000, 0x1000, CRC(4113bb99) SHA1(3cebb874dae211d75082209e913d4afa4f621de1) ) ROM_LOAD( "co3223.u06", 0x4000, 0x1000, CRC(966bb9f5) SHA1(1a217c6f7a88c58e0deae0290bc5ddd2789d18eb) ) ROM_LOAD( "co3223.u05", 0x5000, 0x1000, CRC(65f9fb9a) SHA1(63b616a736d9e39a8f2f76889fd7c5fe4128a966) ) @@ -795,10 +987,10 @@ Sound: AY-3-8910 0.691200 MHz [22.1184MHz/32] ROM_START( revngr84 ) ROM_REGION( 0x40000, "maincpu", 0 ) - ROM_LOAD( "u_1__revenger__r06254__=c=_epos_corp.m5l2764k.u1", 0x0000, 0x2000, CRC(308f231f) SHA1(cf06695601bd0387e4fcb64d9b34143323e98b07) ) /* labeled as "U 1 // REVENGER // R06254 // (C) EPOS CORP" (hand written R06254 over R06124) */ - ROM_LOAD( "u_2__revenger__r06254__=c=_epos_corp.m5l2764k.u2", 0x2000, 0x2000, CRC(e80bbfb4) SHA1(9302beaef8bbb7376b6a20e9ee5adbcf60d66dd8) ) /* labeled as "U 2 // REVENGER // R06254 // (C) EPOS CORP" (hand written R06254 over R06124) */ - ROM_LOAD( "u_3__revenger__r06254__=c=_epos_corp.m5l2764k.u3", 0x4000, 0x2000, CRC(d9270929) SHA1(a95034b5387a40e02f04bdfa79e1d8e65dad30fe) ) /* labeled as "U 3 // REVENGER // R06254 // (C) EPOS CORP" (hand written R06254 over R06124) */ - ROM_LOAD( "u_4__revenger__r06254__=c=_epos_corp.m5l2764k.u4", 0x6000, 0x2000, CRC(d6e6cfa8) SHA1(f10131bb2e9d088c7b6d6a5d5520073d78ad69cc) ) /* labeled as "U 4 // REVENGER // R06254 // (C) EPOS CORP" (hand written R06254 over R06124) */ + ROM_LOAD( "u_1__revenger__r06254__=c=_epos_corp.m5l2764k.u1", 0x0000, 0x2000, CRC(308f231f) SHA1(cf06695601bd0387e4fcb64d9b34143323e98b07) ) // labeled as "U 1 // REVENGER // R06254 // (C) EPOS CORP" (hand written R06254 over R06124) + ROM_LOAD( "u_2__revenger__r06254__=c=_epos_corp.m5l2764k.u2", 0x2000, 0x2000, CRC(e80bbfb4) SHA1(9302beaef8bbb7376b6a20e9ee5adbcf60d66dd8) ) // labeled as "U 2 // REVENGER // R06254 // (C) EPOS CORP" (hand written R06254 over R06124) + ROM_LOAD( "u_3__revenger__r06254__=c=_epos_corp.m5l2764k.u3", 0x4000, 0x2000, CRC(d9270929) SHA1(a95034b5387a40e02f04bdfa79e1d8e65dad30fe) ) // labeled as "U 3 // REVENGER // R06254 // (C) EPOS CORP" (hand written R06254 over R06124) + ROM_LOAD( "u_4__revenger__r06254__=c=_epos_corp.m5l2764k.u4", 0x6000, 0x2000, CRC(d6e6cfa8) SHA1(f10131bb2e9d088c7b6d6a5d5520073d78ad69cc) ) // labeled as "U 4 // REVENGER // R06254 // (C) EPOS CORP" (hand written R06254 over R06124) ROM_REGION( 0x0020, "proms", 0 ) ROM_LOAD( "dm74s288n.u60", 0x0000, 0x0020, CRC(be2b0641) SHA1(26982903b6d942af8e0a526412d8e01978d76420) ) // unknown purpose @@ -809,13 +1001,13 @@ ROM_END ROM_START( revenger ) ROM_REGION( 0x40000, "maincpu", 0 ) - // these roms probably had the same "U x // REVENGER // R06124 // (C) EPOS CORP" printed labels as the newer set above, but without the hand-penned "25" in r06254 written over the printed "12" of r06124 as above + // these ROMs probably had the same "U x // REVENGER // R06124 // (C) EPOS CORP" printed labels as the newer set above, but without the hand-penned "25" in r06254 written over the printed "12" of r06124 as above ROM_LOAD( "r06124.u1", 0x0000, 0x2000, BAD_DUMP CRC(fad1a2a5) SHA1(a31052c91fe67e2e90441abc40b6483f921ecfe3) ) ROM_LOAD( "r06124.u2", 0x2000, 0x2000, BAD_DUMP CRC(a8e0ee7b) SHA1(f6f78e8ce40eab07de461b364876c1eb4a78d96e) ) ROM_LOAD( "r06124.u3", 0x4000, 0x2000, BAD_DUMP CRC(cca414a5) SHA1(1c9dd3ff63d57e9452e63083cdbd7f5d693bb686) ) ROM_LOAD( "r06124.u4", 0x6000, 0x2000, BAD_DUMP CRC(0b81c303) SHA1(9022d18dec11312eb4bb471c22b563f5f897b4f7) ) - ROM_REGION( 0x0020, "proms", 0 ) /* this PROM not included in this dump, but assumed to be the same as above set */ + ROM_REGION( 0x0020, "proms", 0 ) // this PROM not included in this dump, but assumed to be the same as above set ROM_LOAD( "dm74s288n.u60", 0x0000, 0x0020, CRC(be2b0641) SHA1(26982903b6d942af8e0a526412d8e01978d76420) ) // unknown purpose ROM_REGION( 0x1000, "nvram", 0) @@ -824,32 +1016,32 @@ ROM_END ROM_START( beastf ) ROM_REGION( 0x40000, "maincpu", 0 ) - ROM_LOAD( "u_1__beastie__feastie__b09084.m5l2764k.u1", 0x0000, 0x2000, CRC(820d4019) SHA1(e953aaeeb626776dd86c521066b553d054ae4422) ) /* labeled as "U 1 // BEASTIE // FEASTIE // B09084" */ - ROM_LOAD( "u_2__beastie__feastie__b09084.m5l2764k.u2", 0x2000, 0x2000, CRC(967405d8) SHA1(dd763be909e6966521b01ee878df9cef865c3b30) ) /* labeled as "U 2 // BEASTIE // FEASTIE // B09084" */ - ROM_LOAD( "u_3__beastie__feastie__b09084.m5l2764k.u3", 0x4000, 0x2000, CRC(3edb5381) SHA1(14c236045e6df7a475c32222652860689d4f68ce) ) /* labeled as "U 3 // BEASTIE // FEASTIE // B09084" */ - ROM_LOAD( "u_4__beastie__feastie__b09084.m5l2764k.u4", 0x6000, 0x2000, CRC(c8cd9640) SHA1(72da881b903ead873cc3f4df27646d1ffdd63c1c) ) /* labeled as "U 4 // BEASTIE // FEASTIE // B09084" */ + ROM_LOAD( "u_1__beastie__feastie__b09084.m5l2764k.u1", 0x0000, 0x2000, CRC(820d4019) SHA1(e953aaeeb626776dd86c521066b553d054ae4422) ) // labeled as "U 1 // BEASTIE // FEASTIE // B09084" + ROM_LOAD( "u_2__beastie__feastie__b09084.m5l2764k.u2", 0x2000, 0x2000, CRC(967405d8) SHA1(dd763be909e6966521b01ee878df9cef865c3b30) ) // labeled as "U 2 // BEASTIE // FEASTIE // B09084" + ROM_LOAD( "u_3__beastie__feastie__b09084.m5l2764k.u3", 0x4000, 0x2000, CRC(3edb5381) SHA1(14c236045e6df7a475c32222652860689d4f68ce) ) // labeled as "U 3 // BEASTIE // FEASTIE // B09084" + ROM_LOAD( "u_4__beastie__feastie__b09084.m5l2764k.u4", 0x6000, 0x2000, CRC(c8cd9640) SHA1(72da881b903ead873cc3f4df27646d1ffdd63c1c) ) // labeled as "U 4 // BEASTIE // FEASTIE // B09084" ROM_REGION( 0x1000, "nvram", 0) ROM_LOAD( "beastf.nv", 0, 0x1000, CRC(98017b09) SHA1(0e2b2071bb47fc179d5bc36ef9431a9d2727d36a) ) ROM_END -void epos_state::init_dealer() +void tristar9000_state::init_tristar9000() { uint8_t *rom = memregion("maincpu")->base(); - /* Key 0 */ + // Key 0 for (int A = 0; A < 0x8000; A++) rom[A] = bitswap<8>(rom[A] ^ 0xbd, 2,6,4,0,5,7,1,3 ); - /* Key 1 */ + // Key 1 for (int A = 0; A < 0x8000; A++) rom[A + 0x10000] = bitswap<8>(rom[A], 7,5,4,6,3,2,1,0 ); - /* Key 2 */ + // Key 2 for (int A = 0; A < 0x8000; A++) rom[A + 0x20000] = bitswap<8>(rom[A] ^ 1, 7,6,5,4,3,0,2,1 ); - /* Key 3 */ + // Key 3 for (int A = 0; A < 0x8000; A++) rom[A + 0x30000] = bitswap<8>(rom[A] ^ 1, 7,5,4,6,3,0,2,1 ); @@ -872,6 +1064,8 @@ void epos_state::init_dealer() */ } +} // anonymous namespace + /************************************* * @@ -879,18 +1073,18 @@ void epos_state::init_dealer() * *************************************/ -/* EPOS TRISTAR 8000 PCB based */ -GAME( 1982, megadon, 0, epos, megadon, epos_state, empty_init, ROT270, "Epos Corporation (Photar Industries license)", "Megadon", MACHINE_SUPPORTS_SAVE ) -GAME( 1982, catapult, 0, epos, catapult, epos_state, empty_init, ROT270, "Epos Corporation", "Catapult", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) /* bad rom, hold f2 for test mode */ -GAME( 1983, suprglob, 0, epos, suprglob, epos_state, empty_init, ROT270, "Epos Corporation", "Super Glob", MACHINE_SUPPORTS_SAVE ) -GAME( 1983, theglob, suprglob, epos, suprglob, epos_state, empty_init, ROT270, "Epos Corporation", "The Glob", MACHINE_SUPPORTS_SAVE ) -GAME( 1983, theglob2, suprglob, epos, suprglob, epos_state, empty_init, ROT270, "Epos Corporation", "The Glob (earlier)", MACHINE_SUPPORTS_SAVE ) -GAME( 1983, theglob3, suprglob, epos, suprglob, epos_state, empty_init, ROT270, "Epos Corporation", "The Glob (set 3)", MACHINE_SUPPORTS_SAVE ) -GAME( 1984, igmo, 0, epos, igmo, epos_state, empty_init, ROT270, "Epos Corporation", "IGMO", MACHINE_SUPPORTS_SAVE ) -GAME( 1983, eeekk, 0, epos, eeekk, epos_state, empty_init, ROT270, "Epos Corporation", "Eeekk!", MACHINE_SUPPORTS_SAVE ) - -/* EPOS TRISTAR 9000 PCB based */ -GAME( 1984, dealer, 0, dealer, dealer, epos_state, init_dealer, ROT270, "Epos Corporation", "The Dealer", MACHINE_SUPPORTS_SAVE ) -GAME( 1984, revngr84, 0, dealer, beastf, epos_state, init_dealer, ROT270, "Epos Corporation", "Revenger '84 (newer)", MACHINE_SUPPORTS_SAVE ) -GAME( 1984, revenger, revngr84, dealer, beastf, epos_state, init_dealer, ROT270, "Epos Corporation", "Revenger '84 (older)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) -GAME( 1984, beastf, suprglob, dealer, beastf, epos_state, init_dealer, ROT270, "Epos Corporation", "Beastie Feastie", MACHINE_SUPPORTS_SAVE ) +// EPOS TRISTAR 8000 PCB based +GAME( 1982, megadon, 0, tristar8000, megadon, tristar8000_state, empty_init, ROT270, "Epos Corporation (Photar Industries license)", "Megadon", MACHINE_SUPPORTS_SAVE ) +GAME( 1982, catapult, 0, tristar8000, catapult, tristar8000_state, empty_init, ROT270, "Epos Corporation", "Catapult", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) // bad ROM, hold f2 for test mode +GAME( 1983, suprglob, 0, tristar8000, suprglob, tristar8000_state, empty_init, ROT270, "Epos Corporation", "Super Glob", MACHINE_SUPPORTS_SAVE ) +GAME( 1983, theglob, suprglob, tristar8000, suprglob, tristar8000_state, empty_init, ROT270, "Epos Corporation", "The Glob", MACHINE_SUPPORTS_SAVE ) +GAME( 1983, theglob2, suprglob, tristar8000, suprglob, tristar8000_state, empty_init, ROT270, "Epos Corporation", "The Glob (earlier)", MACHINE_SUPPORTS_SAVE ) +GAME( 1983, theglob3, suprglob, tristar8000, suprglob, tristar8000_state, empty_init, ROT270, "Epos Corporation", "The Glob (set 3)", MACHINE_SUPPORTS_SAVE ) +GAME( 1984, igmo, 0, tristar8000, igmo, tristar8000_state, empty_init, ROT270, "Epos Corporation", "IGMO", MACHINE_SUPPORTS_SAVE ) +GAME( 1983, eeekk, 0, tristar8000, eeekk, tristar8000_state, empty_init, ROT270, "Epos Corporation", "Eeekk!", MACHINE_SUPPORTS_SAVE ) + +// EPOS TRISTAR 9000 PCB based +GAME( 1984, dealer, 0, tristar9000, dealer, tristar9000_state, init_tristar9000, ROT270, "Epos Corporation", "The Dealer", MACHINE_SUPPORTS_SAVE ) +GAME( 1984, revngr84, 0, tristar9000, beastf, tristar9000_state, init_tristar9000, ROT270, "Epos Corporation", "Revenger '84 (newer)", MACHINE_SUPPORTS_SAVE ) +GAME( 1984, revenger, revngr84, tristar9000, beastf, tristar9000_state, init_tristar9000, ROT270, "Epos Corporation", "Revenger '84 (older)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) // bad dump +GAME( 1984, beastf, suprglob, tristar9000, beastf, tristar9000_state, init_tristar9000, ROT270, "Epos Corporation", "Beastie Feastie", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/ksayakyu.cpp b/src/mame/drivers/ksayakyu.cpp index 858bc0323a7..de2f2cea0f5 100644 --- a/src/mame/drivers/ksayakyu.cpp +++ b/src/mame/drivers/ksayakyu.cpp @@ -8,7 +8,7 @@ driver by Tomasz Slanina TODO: - sprite glitches (sometimes) .. missing vertical flip flag? <- (*) -- sound cpu int freq (timer ? $a010 writes ?) +- sound CPU int freq (timer ? $a010 writes ?) (*) this was caused by flip Y being hooked up as bit 6 in text videoram attribute. -AS @@ -65,17 +65,215 @@ SRAM: */ #include "emu.h" -#include "includes/ksayakyu.h" #include "cpu/z80/z80.h" +#include "machine/gen_latch.h" #include "sound/ay8910.h" #include "sound/dac.h" + +#include "emupal.h" #include "screen.h" #include "speaker.h" +#include "tilemap.h" + + +namespace { + +class ksayakyu_state : public driver_device +{ +public: + ksayakyu_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_mainbank(*this, "mainbank"), + m_maincpu(*this, "maincpu"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette"), + m_soundlatch(*this, "soundlatch") + { } + + void ksayakyu(machine_config &config); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + +private: + // memory pointers + required_shared_ptr m_videoram; + required_shared_ptr m_spriteram; + required_memory_bank m_mainbank; + + // devices + required_device m_maincpu; + required_device m_gfxdecode; + required_device m_palette; + required_device m_soundlatch; + + // video-related + tilemap_t *m_tilemap = nullptr; + tilemap_t *m_textmap = nullptr; + uint8_t m_video_ctrl = 0; + uint8_t m_flipscreen = 0; + + // misc + uint8_t m_sound_status = 0; + + void bank_select_w(uint8_t data); + void latch_w(uint8_t data); + uint8_t sound_status_r(); + void tomaincpu_w(uint8_t data); + uint8_t int_ack_r(); + void videoram_w(offs_t offset, uint8_t data); + void videoctrl_w(uint8_t data); + void dummy1_w(uint8_t data); + void dummy2_w(uint8_t data); + void dummy3_w(uint8_t data); + TILE_GET_INFO_MEMBER(get_tile_info); + TILE_GET_INFO_MEMBER(get_text_tile_info); + 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 maincpu_map(address_map &map); + void soundcpu_map(address_map &map); +}; + + +// video + +void ksayakyu_state::videoram_w(offs_t offset, uint8_t data) +{ + m_videoram[offset]=data; + m_textmap->mark_tile_dirty(offset >> 1); +} + +void ksayakyu_state::videoctrl_w(uint8_t data) +{ + /* + bits: + 76543210 + xx - ?? layers enable ? + x - screen flip + xx - ?? + xxx - scroll offset + + */ + m_video_ctrl = data; + + m_flipscreen = data & 4; + flip_screen_set(m_flipscreen); + m_tilemap->set_scrolly(0, (data & 0xe0) << 3); + if (m_flipscreen) + m_tilemap->set_flip((data & 2) ? TILEMAP_FLIPY : TILEMAP_FLIPX | TILEMAP_FLIPY); + else + m_tilemap->set_flip((data & 2) ? TILEMAP_FLIPX : 0); +} + +void ksayakyu_state::palette(palette_device &palette) const +{ + uint8_t const *const prom = memregion("proms")->base(); + for (int i = 0; i < 0x100; i++) + { + int const r = (prom[i] >> 0) & 0x07; + int const g = (prom[i] >> 3) & 0x07; + int const b = (prom[i] >> 6) & 0x03; -#define MAIN_CLOCK XTAL(18'432'000) + palette.set_pen_color(i, pal3bit(r), pal3bit(g), pal2bit(b)); + } +} +TILE_GET_INFO_MEMBER(ksayakyu_state::get_tile_info) +{ + int code = memregion("user1")->base()[tile_index]; + int attr = memregion("user1")->base()[tile_index + 0x2000]; + code += (attr & 3) << 8; + tileinfo.set(1, code, ((attr >> 2) & 0x0f) * 2, (attr & 0x80) ? TILE_FLIPX : 0); +} + +/* +x--- ---- flip bits +-y-- ---- unknown, used when runner slides (NOT flip Y!) +--cc cc-- color +---- --bb bank select +*/ +TILE_GET_INFO_MEMBER(ksayakyu_state::get_text_tile_info) +{ + int code = m_videoram[tile_index * 2 + 1]; + int attr = m_videoram[tile_index * 2]; + int flags = ((attr & 0x80) ? TILE_FLIPX : 0);// | ((attr & 0x40) ? TILE_FLIPY : 0); + int color = (attr & 0x3c) >> 2; + + code |= (attr & 3) << 8; + + tileinfo.set(0, code, color, flags); +} + +/* +[0] X--- ---- flip x + -ttt tttt tile number +[1] yyyy yyyy Y offset +[2] xxxx xxxx X offset +[3] +*/ + +void ksayakyu_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + const uint8_t *source = m_spriteram + m_spriteram.bytes() - 4; + const uint8_t *finish = m_spriteram; + + while (source >= finish) // is order correct ? + { + int sx = source[2]; + int sy = 240 - source[1]; + int attributes = source[3]; + int tile = source[0]; + int flipx = (tile & 0x80) ? 1 : 0; + int flipy = 0; + + gfx_element *gfx = m_gfxdecode->gfx(2); + + if (m_flipscreen) + { + sx = 240 - sx; + sy = 240 - sy; + flipx ^= 1; + flipy ^= 1; + } + + gfx->transpen(bitmap, cliprect, + tile & 0x7f, + (attributes & 0x78) >> 3, + flipx, flipy, + sx, sy, 0); + + source -= 4; + } +} + +void ksayakyu_state::video_start() +{ + m_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(ksayakyu_state::get_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32 * 8); + m_textmap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(ksayakyu_state::get_text_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); + m_textmap->set_transparent_pen(0); +} + +uint32_t ksayakyu_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + bitmap.fill(0, cliprect); + + if (m_video_ctrl & 1) + m_tilemap->draw(screen, bitmap, cliprect, 0, 0); + + m_textmap->draw(screen, bitmap, cliprect, 0, 0); + draw_sprites(bitmap, cliprect); + return 0; +} + +// machine void ksayakyu_state::bank_select_w(uint8_t data) { @@ -86,7 +284,7 @@ void ksayakyu_state::bank_select_w(uint8_t data) xxxxxxx - unused ? */ - membank("bank1")->set_entry(data & 0x01); + m_mainbank->set_entry(data & 0x01); } void ksayakyu_state::latch_w(uint8_t data) @@ -115,20 +313,20 @@ uint8_t ksayakyu_state::int_ack_r() void ksayakyu_state::maincpu_map(address_map &map) { map(0x0000, 0x3fff).rom(); - map(0x4000, 0x7fff).bankr("bank1"); + map(0x4000, 0x7fff).bankr(m_mainbank); map(0x8000, 0x9fff).rom(); map(0xa000, 0xa7ff).ram(); map(0xa800, 0xa800).portr("P1"); map(0xa801, 0xa801).portr("P2"); map(0xa802, 0xa802).portr("DSW"); - map(0xa803, 0xa803).nopr(); /* watchdog ? */ - map(0xa804, 0xa804).w(FUNC(ksayakyu_state::ksayakyu_videoctrl_w)); + map(0xa803, 0xa803).nopr(); // watchdog ? + map(0xa804, 0xa804).w(FUNC(ksayakyu_state::videoctrl_w)); map(0xa805, 0xa805).w(FUNC(ksayakyu_state::latch_w)); map(0xa806, 0xa806).r(FUNC(ksayakyu_state::sound_status_r)); map(0xa807, 0xa807).r(FUNC(ksayakyu_state::int_ack_r)); map(0xa808, 0xa808).w(FUNC(ksayakyu_state::bank_select_w)); - map(0xb000, 0xb7ff).ram().w(FUNC(ksayakyu_state::ksayakyu_videoram_w)).share("videoram"); - map(0xb800, 0xbfff).ram().share("spriteram"); + map(0xb000, 0xb7ff).ram().w(FUNC(ksayakyu_state::videoram_w)).share(m_videoram); + map(0xb800, 0xbfff).ram().share(m_spriteram); } void ksayakyu_state::soundcpu_map(address_map &map) @@ -233,17 +431,17 @@ static const gfx_layout spritelayout = }; static GFXDECODE_START( gfx_ksayakyu ) - GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 16 ) - GFXDECODE_ENTRY( "gfx3", 0, charlayout2, 0x80, 32 ) - GFXDECODE_ENTRY( "gfx2", 0, spritelayout, 0, 16 ) + GFXDECODE_ENTRY( "chars", 0, charlayout, 0, 16 ) + GFXDECODE_ENTRY( "tiles", 0, charlayout2, 0x80, 32 ) + GFXDECODE_ENTRY( "sprites", 0, spritelayout, 0, 16 ) GFXDECODE_END void ksayakyu_state::machine_start() { - uint8_t *ROM = memregion("maincpu")->base(); + uint8_t *rom = memregion("maincpu")->base(); - membank("bank1")->configure_entries(0, 2, &ROM[0x10000], 0x4000); + m_mainbank->configure_entries(0, 2, &rom[0x10000], 0x4000); save_item(NAME(m_sound_status)); save_item(NAME(m_video_ctrl)); @@ -259,41 +457,43 @@ void ksayakyu_state::machine_reset() void ksayakyu_state::ksayakyu(machine_config &config) { - /* basic machine hardware */ - Z80(config, m_maincpu, MAIN_CLOCK/8); //divider is guessed + constexpr XTAL MAIN_CLOCK = XTAL(18'432'000); + + // basic machine hardware + Z80(config, m_maincpu, MAIN_CLOCK / 8); //divider is guessed m_maincpu->set_addrmap(AS_PROGRAM, &ksayakyu_state::maincpu_map); - z80_device &audiocpu(Z80(config, "audiocpu", MAIN_CLOCK/8)); //divider is guessed, controls DAC tempo + z80_device &audiocpu(Z80(config, "audiocpu", MAIN_CLOCK / 8)); //divider is guessed, controls DAC tempo audiocpu.set_addrmap(AS_PROGRAM, &ksayakyu_state::soundcpu_map); audiocpu.set_periodic_int(FUNC(ksayakyu_state::irq0_line_hold), attotime::from_hz(60)); //guess, controls music tempo config.set_maximum_quantum(attotime::from_hz(60000)); - /* 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(256, 256); screen.set_visarea(0*8, 32*8-1, 2*8, 30*8-1); - screen.set_screen_update(FUNC(ksayakyu_state::screen_update_ksayakyu)); + screen.set_screen_update(FUNC(ksayakyu_state::screen_update)); screen.set_palette(m_palette); screen.screen_vblank().set_inputline(m_maincpu, 0, ASSERT_LINE); GFXDECODE(config, m_gfxdecode, m_palette, gfx_ksayakyu); - PALETTE(config, m_palette, FUNC(ksayakyu_state::ksayakyu_palette), 256); + PALETTE(config, m_palette, FUNC(ksayakyu_state::palette), 256); - /* sound hardware */ + // sound hardware SPEAKER(config, "speaker").front_center(); GENERIC_LATCH_8(config, m_soundlatch); - ay8910_device &ay1(AY8910(config, "ay1", MAIN_CLOCK/16)); //unknown clock + ay8910_device &ay1(AY8910(config, "ay1", MAIN_CLOCK / 16)); //unknown clock ay1.port_a_read_callback().set(m_soundlatch, FUNC(generic_latch_8_device::read)); ay1.port_b_write_callback().set(FUNC(ksayakyu_state::dummy1_w)); ay1.add_route(ALL_OUTPUTS, "speaker", 0.25); - ay8910_device &ay2(AY8910(config, "ay2", MAIN_CLOCK/16)); //unknown clock + ay8910_device &ay2(AY8910(config, "ay2", MAIN_CLOCK / 16)); //unknown clock ay2.port_a_write_callback().set(FUNC(ksayakyu_state::dummy2_w)); ay2.port_b_write_callback().set(FUNC(ksayakyu_state::dummy3_w)); ay2.add_route(ALL_OUTPUTS, "speaker", 0.25); @@ -315,17 +515,17 @@ ROM_START( ksayakyu ) ROM_LOAD( "6.5h", 0x4000, 0x2000, CRC(17986662) SHA1(81b65e381b923c5544f4708efef09f0894c716b2) ) ROM_LOAD( "5.5f", 0x6000, 0x2000, CRC(b0b21817) SHA1(da2a1a6865dbc335775fa2e0ad0fb899be95af03) ) - ROM_REGION( 0x6000, "gfx1", 0 ) + ROM_REGION( 0x6000, "chars", 0 ) ROM_LOAD( "9.3j", 0x0000, 0x2000, CRC(ef8411dd) SHA1(1dbc959d3aec9face19b2a5ae873ca34bfeff5cd) ) ROM_LOAD( "10.3k", 0x2000, 0x2000, CRC(1bdee573) SHA1(7b92a8133cb83404505d21f462e3ca6c85647dca) ) ROM_LOAD( "11.3l", 0x4000, 0x2000, CRC(c5859887) SHA1(41685fb8f8e7c44acd5e0e3ccc629e5f64a59fbd) ) - ROM_REGION( 0x6000, "gfx2", 0 ) + ROM_REGION( 0x6000, "sprites", 0 ) ROM_LOAD( "14.9j", 0x0000, 0x2000, CRC(982d06f0) SHA1(e107c56ee4f2695a790b8cec6d52337ba9d8b2ad) ) ROM_LOAD( "15.9k", 0x2000, 0x2000, CRC(dc126df9) SHA1(368efb36bf197e3eac23ef543e25e9f4efba785e) ) ROM_LOAD( "16.9m", 0x4000, 0x2000, CRC(574a172d) SHA1(7dee073b5c8ff5825062e30cff29343dc767daaa) ) - ROM_REGION( 0x4000, "gfx3", 0 ) + ROM_REGION( 0x4000, "tiles", 0 ) ROM_LOAD( "17.9n", 0x0000, 0x2000, CRC(a4c4e4ce) SHA1(f8b0a8dfab972e23f268c69fd9ef30fc80f62533) ) ROM_LOAD( "18.9r", 0x2000, 0x2000, CRC(9d75b104) SHA1(062884fdca9f705f555b828aff136d8f52fbf6eb) ) @@ -337,4 +537,7 @@ ROM_START( ksayakyu ) ROM_LOAD( "9f.bin", 0x0000, 0x0100, CRC(ff71b27f) SHA1(6aad2bd2be997595a05ddb81d24df8fe1435910b) ) ROM_END +} // anonymous namespace + + GAME( 1985, ksayakyu, 0, ksayakyu, ksayakyu, ksayakyu_state, empty_init, ORIENTATION_FLIP_Y, "Taito Corporation", "Kusayakyuu", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/whitestar.cpp b/src/mame/drivers/whitestar.cpp index e4da7d190f7..96e87b6b66e 100644 --- a/src/mame/drivers/whitestar.cpp +++ b/src/mame/drivers/whitestar.cpp @@ -86,20 +86,23 @@ public: , m_decobsmt(*this, "decobsmt") , m_decodmd(*this, "decodmd") , m_io_keyboard(*this, "X%d", 0U) + , m_mainbank(*this, "mainbank") { } void whitestar(machine_config &config); void whitestarm(machine_config &config); void goldcue(machine_config &config); +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + private: void bank_w(uint8_t data); void dmddata_w(uint8_t data); uint8_t switch_r(); void switch_w(uint8_t data); - virtual void machine_start() override; - virtual void machine_reset() override; INTERRUPT_GEN_MEMBER(whitestar_firq_interrupt); void whitestar_base_map(address_map &map); @@ -113,6 +116,7 @@ private: optional_device m_decobsmt; required_device m_decodmd; required_ioport_array<8> m_io_keyboard; + required_memory_bank m_mainbank; }; static INPUT_PORTS_START( whitestar ) @@ -231,7 +235,7 @@ void whitestar_state::whitestar_base_map(address_map &map) map(0x3600, 0x3600).w(FUNC(whitestar_state::dmddata_w)); map(0x3601, 0x3601).rw(m_decodmd, FUNC(decodmd_type2_device::ctrl_r), FUNC(decodmd_type2_device::ctrl_w)); map(0x3700, 0x3700).r(m_decodmd, FUNC(decodmd_type2_device::busy_r)); - map(0x4000, 0x7fff).bankr("bank1"); + map(0x4000, 0x7fff).bankr(m_mainbank); map(0x8000, 0xffff).rom().region("maincpu", 0x18000); } @@ -270,7 +274,7 @@ void whitestar_state::switch_w(uint8_t data) void whitestar_state::bank_w(uint8_t data) { - membank("bank1")->set_entry(data & 0x1f); + m_mainbank->set_entry(data & 0x1f); } // Whitestar automatically pulses the DMD IRQ line? DE hardware doesn't do that... @@ -283,8 +287,8 @@ void whitestar_state::dmddata_w(uint8_t data) void whitestar_state::machine_start() { - membank("bank1")->configure_entries(0, 32, memregion("maincpu")->base(), 0x4000); - membank("bank1")->set_entry(0); + m_mainbank->configure_entries(0, 32, memregion("maincpu")->base(), 0x4000); + m_mainbank->set_entry(0); genpin_class::machine_start(); //m_io_outputs.resolve(); diff --git a/src/mame/includes/epos.h b/src/mame/includes/epos.h deleted file mode 100644 index 0ed60aa42cb..00000000000 --- a/src/mame/includes/epos.h +++ /dev/null @@ -1,70 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Zsolt Vasvari -/************************************************************************* - - Epos games - -**************************************************************************/ -#ifndef MAME_INCLUDES_EPOS_H -#define MAME_INCLUDES_EPOS_H - -#pragma once - -#include "emupal.h" - -class epos_state : public driver_device -{ -public: - epos_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_videoram(*this, "videoram"), - m_inputs(*this, { "INPUTS", "INPUTS2" }), - m_maincpu(*this, "maincpu"), - m_palette(*this, "palette"), - m_leds(*this, "led%u", 0U) - { } - - void epos(machine_config &config); - void dealer(machine_config &config); - - void init_dealer(); - -protected: - virtual void machine_start() override { m_leds.resolve(); } - virtual void machine_reset() override; - -private: - void dealer_decrypt_rom(offs_t offset, uint8_t data); - void port_1_w(uint8_t data); - uint8_t i8255_porta_r(); - void i8255_portc_w(uint8_t data); - uint8_t ay_porta_mpx_r(); - void flip_screen_w(uint8_t data); - void dealer_pal_w(offs_t offset, uint8_t data); - DECLARE_MACHINE_START(epos); - DECLARE_MACHINE_START(dealer); - void epos_palette(palette_device &palette) const; - uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - static void set_pal_color(palette_device &palette, uint8_t offset, uint8_t data); // TODO: convert to an RGB converter and set_format - void dealer_io_map(address_map &map); - void dealer_map(address_map &map); - void epos_io_map(address_map &map); - void epos_map(address_map &map); - - /* memory pointers */ - required_shared_ptr m_videoram; - optional_ioport_array<2> m_inputs; - - /* video-related */ - uint8_t m_palette_bank = 0U; - - /* misc */ - int m_counter = 0; - int m_input_multiplex = 0; - bool m_ay_porta_multiplex = false; - required_device m_maincpu; - required_device m_palette; - output_finder<2> m_leds; -}; - -#endif // MAME_INCLUDES_EPOS_H diff --git a/src/mame/includes/ksayakyu.h b/src/mame/includes/ksayakyu.h deleted file mode 100644 index 3ac26f2ea9f..00000000000 --- a/src/mame/includes/ksayakyu.h +++ /dev/null @@ -1,74 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Tomasz Slanina - -/************************************************************************* - - Kusayakyuu - -*************************************************************************/ -#ifndef MAME_INCLUDES_KSAYAKYU_H -#define MAME_INCLUDES_KSAYAKYU_H - -#pragma once - -#include "machine/gen_latch.h" -#include "emupal.h" -#include "tilemap.h" - -class ksayakyu_state : public driver_device -{ -public: - ksayakyu_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_maincpu(*this, "maincpu"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette"), - m_soundlatch(*this, "soundlatch") - { } - - void ksayakyu(machine_config &config); - -protected: - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; - -private: - /* memory pointers */ - required_shared_ptr m_videoram; - required_shared_ptr m_spriteram; - - /* video-related */ - tilemap_t *m_tilemap = nullptr; - tilemap_t *m_textmap = nullptr; - int m_video_ctrl = 0; - int m_flipscreen = 0; - - /* misc */ - int m_sound_status = 0; - void bank_select_w(uint8_t data); - void latch_w(uint8_t data); - uint8_t sound_status_r(); - void tomaincpu_w(uint8_t data); - uint8_t int_ack_r(); - void ksayakyu_videoram_w(offs_t offset, uint8_t data); - void ksayakyu_videoctrl_w(uint8_t data); - void dummy1_w(uint8_t data); - void dummy2_w(uint8_t data); - void dummy3_w(uint8_t data); - TILE_GET_INFO_MEMBER(get_ksayakyu_tile_info); - TILE_GET_INFO_MEMBER(get_text_tile_info); - void ksayakyu_palette(palette_device &palette) const; - uint32_t screen_update_ksayakyu(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); - required_device m_maincpu; - required_device m_gfxdecode; - required_device m_palette; - required_device m_soundlatch; - void maincpu_map(address_map &map); - void soundcpu_map(address_map &map); -}; - -#endif // MAME_INCLUDES_KSAYAKYU_H diff --git a/src/mame/video/epos.cpp b/src/mame/video/epos.cpp deleted file mode 100644 index 886582a9a3e..00000000000 --- a/src/mame/video/epos.cpp +++ /dev/null @@ -1,103 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Zsolt Vasvari -/*************************************************************************** - - Epos games - -***************************************************************************/ - -#include "emu.h" -#include "includes/epos.h" - -/*************************************************************************** - - These games has one 32 byte palette PROM, connected to the RGB output this way: - - bit 7 -- 240 ohm resistor -- RED - -- 510 ohm resistor -- RED - -- 1 kohm resistor -- RED - -- 240 ohm resistor -- GREEN - -- 510 ohm resistor -- GREEN - -- 1 kohm resistor -- GREEN - -- 240 ohm resistor -- BLUE - bit 0 -- 510 ohm resistor -- BLUE - -***************************************************************************/ - -void epos_state::epos_palette(palette_device &palette) const -{ - uint8_t const *const color_prom = memregion("proms")->base(); - int const len = memregion("proms")->bytes(); - - for (offs_t i = 0; i < len; i++) - set_pal_color(palette, i, color_prom[i]); -} - -void epos_state::set_pal_color(palette_device &palette, uint8_t offset, uint8_t data) -{ - int bit0, bit1, bit2; - - bit0 = BIT(data, 7); - bit1 = BIT(data, 6); - bit2 = BIT(data, 5); - int const r = 0x92 * bit0 + 0x4a * bit1 + 0x23 * bit2; - - bit0 = BIT(data, 4); - bit1 = BIT(data, 3); - bit2 = BIT(data, 2); - int const g = 0x92 * bit0 + 0x4a * bit1 + 0x23 * bit2; - - bit0 = BIT(data, 1); - bit1 = BIT(data, 0); - int const b = 0xad * bit0 + 0x52 * bit1; - - palette.set_pen_color(offset, rgb_t(r, g, b)); -} - -// later (tristar 9000) games uses a dynamic palette instead of prom -void epos_state::dealer_pal_w(offs_t offset, uint8_t data) -{ - set_pal_color(*m_palette, offset, data); -} - -void epos_state::port_1_w(uint8_t data) -{ - /* D0 - start light #1 - D1 - start light #2 - D2 - coin counter - D3 - palette select - D4-D7 - unused - */ - - m_leds[0] = BIT(data, 0); - m_leds[1] = BIT(data, 1); - - machine().bookkeeping().coin_counter_w(0, (data >> 2) & 0x01); - - m_palette_bank = (data >> 3) & 0x01; -} - - -uint32_t epos_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - for (offs_t offs = 0; offs < m_videoram.bytes(); offs++) - { - uint8_t const data = m_videoram[offs]; - - int x = (offs % 136) * 2; - int y = (offs / 136); - - if (flip_screen()) - { - bitmap.pix(240 - y, 270 - x + 1) = m_palette->pen((m_palette_bank << 4) | (data & 0x0f)); - bitmap.pix(240 - y, 270 - x + 0) = m_palette->pen((m_palette_bank << 4) | (data >> 4)); - } - else - { - bitmap.pix(y, x + 0) = m_palette->pen((m_palette_bank << 4) | (data & 0x0f)); - bitmap.pix(y, x + 1) = m_palette->pen((m_palette_bank << 4) | (data >> 4)); - } - } - - return 0; -} diff --git a/src/mame/video/ksayakyu.cpp b/src/mame/video/ksayakyu.cpp deleted file mode 100644 index 8a28791ef20..00000000000 --- a/src/mame/video/ksayakyu.cpp +++ /dev/null @@ -1,134 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Tomasz Slanina -#include "emu.h" -#include "includes/ksayakyu.h" - - -void ksayakyu_state::ksayakyu_videoram_w(offs_t offset, uint8_t data) -{ - m_videoram[offset]=data; - m_textmap->mark_tile_dirty(offset >> 1); -} - -void ksayakyu_state::ksayakyu_videoctrl_w(uint8_t data) -{ - /* - bits: - 76543210 - xx - ?? layers enable ? - x - screen flip - xx - ?? - xxx - scroll offset - - */ - m_video_ctrl = data; - - m_flipscreen = data & 4; - flip_screen_set(m_flipscreen); - m_tilemap->set_scrolly(0, (data & 0xe0) << 3); - if(m_flipscreen) - m_tilemap->set_flip((data & 2) ? TILEMAP_FLIPY : TILEMAP_FLIPX | TILEMAP_FLIPY); - else - m_tilemap->set_flip((data & 2) ? TILEMAP_FLIPX : 0); -} - -void ksayakyu_state::ksayakyu_palette(palette_device &palette) const -{ - uint8_t const *const prom = memregion("proms")->base(); - - for (int i = 0; i < 0x100; i++) - { - int const r = (prom[i] >> 0) & 0x07; - int const g = (prom[i] >> 3) & 0x07; - int const b = (prom[i] >> 6) & 0x03; - - palette.set_pen_color(i, pal3bit(r), pal3bit(g), pal2bit(b)); - } -} - -TILE_GET_INFO_MEMBER(ksayakyu_state::get_ksayakyu_tile_info) -{ - int code = memregion("user1")->base()[tile_index]; - int attr = memregion("user1")->base()[tile_index + 0x2000]; - code += (attr & 3) << 8; - tileinfo.set(1, code, ((attr >> 2) & 0x0f) * 2, (attr & 0x80) ? TILE_FLIPX : 0); -} - -/* -x--- ---- flip bits --y-- ---- unknown, used when runner slides (NOT flip Y!) ---cc cc-- color ----- --bb bank select -*/ -TILE_GET_INFO_MEMBER(ksayakyu_state::get_text_tile_info) -{ - int code = m_videoram[tile_index * 2 + 1]; - int attr = m_videoram[tile_index * 2]; - int flags = ((attr & 0x80) ? TILE_FLIPX : 0);// | ((attr & 0x40) ? TILE_FLIPY : 0); - int color = (attr & 0x3c) >> 2; - - code |= (attr & 3) << 8; - - tileinfo.set(0, code, color, flags); -} - -/* -[0] X--- ---- flip x - -ttt tttt tile number -[1] yyyy yyyy Y offset -[2] xxxx xxxx X offset -[3] -*/ - -void ksayakyu_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) -{ - const uint8_t *source = m_spriteram + m_spriteram.bytes() - 4; - const uint8_t *finish = m_spriteram; - - while (source>=finish) /* is order correct ? */ - { - int sx = source[2]; - int sy = 240 - source[1]; - int attributes = source[3]; - int tile = source[0]; - int flipx = (tile & 0x80) ? 1 : 0; - int flipy = 0; - - gfx_element *gfx = m_gfxdecode->gfx(2); - - if (m_flipscreen) - { - sx = 240 - sx; - sy = 240 - sy; - flipx ^= 1; - flipy ^= 1; - } - - gfx->transpen(bitmap,cliprect, - tile & 0x7f, - (attributes & 0x78) >> 3, - flipx,flipy, - sx,sy,0 ); - - source -= 4; - } -} - -void ksayakyu_state::video_start() -{ - m_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(ksayakyu_state::get_ksayakyu_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32 * 8); - m_textmap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(ksayakyu_state::get_text_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); - m_textmap->set_transparent_pen(0); -} - -uint32_t ksayakyu_state::screen_update_ksayakyu(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - bitmap.fill(0, cliprect); - - if (m_video_ctrl & 1) - m_tilemap->draw(screen, bitmap, cliprect, 0, 0); - - m_textmap->draw(screen, bitmap, cliprect, 0, 0); - draw_sprites(bitmap, cliprect); - return 0; -} -- cgit v1.2.3