summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--src/mame/konami/aliens.cpp396
-rw-r--r--src/mame/konami/aliens.h63
-rw-r--r--src/mame/konami/aliens_v.cpp70
-rw-r--r--src/mame/konami/battlnts.cpp297
-rw-r--r--src/mame/konami/battlnts.h54
-rw-r--r--src/mame/konami/battlnts_v.cpp50
-rw-r--r--src/mame/konami/finalizr.cpp321
-rw-r--r--src/mame/konami/finalizr.h82
-rw-r--r--src/mame/konami/finalizr_v.cpp231
-rw-r--r--src/mame/konami/gberet.cpp398
-rw-r--r--src/mame/konami/gberet.h136
-rw-r--r--src/mame/konami/gberet_v.cpp205
-rw-r--r--src/mame/konami/gyruss.cpp532
-rw-r--r--src/mame/konami/gyruss.h90
-rw-r--r--src/mame/konami/gyruss_v.cpp169
-rw-r--r--src/mame/konami/ironhors.cpp517
-rw-r--r--src/mame/konami/ironhors.h129
-rw-r--r--src/mame/konami/ironhors_v.cpp343
-rw-r--r--src/mame/konami/jailbrek.cpp341
-rw-r--r--src/mame/konami/jailbrek.h77
-rw-r--r--src/mame/konami/jailbrek_v.cpp119
21 files changed, 2227 insertions, 2393 deletions
diff --git a/src/mame/konami/aliens.cpp b/src/mame/konami/aliens.cpp
index d0dd005dd79..76c5c117761 100644
--- a/src/mame/konami/aliens.cpp
+++ b/src/mame/konami/aliens.cpp
@@ -1,8 +1,10 @@
// license:BSD-3-Clause
-// copyright-holders:Manuel Abadia
+// copyright-holders: Manuel Abadia
+
/***************************************************************************
Aliens (c) 1990 Konami Co. Ltd
+GX875 PCB
Preliminary driver by:
Manuel Abadia <emumanu+mame@gmail.com>
@@ -10,53 +12,164 @@ Preliminary driver by:
***************************************************************************/
#include "emu.h"
-#include "aliens.h"
+
+#include "k051960.h"
+#include "k052109.h"
#include "konamipt.h"
+#include "cpu/m6809/konami.h" // for the callback and the firq irq definition
#include "cpu/z80/z80.h"
+#include "machine/gen_latch.h"
#include "machine/watchdog.h"
+#include "sound/k007232.h"
#include "sound/ymopm.h"
+
#include "emupal.h"
+#include "screen.h"
#include "speaker.h"
-void aliens_state::aliens_coin_counter_w(uint8_t data)
+namespace {
+
+class aliens_state : public driver_device
{
- /* bits 0-1 = coin counters */
- machine().bookkeeping().coin_counter_w(0, data & 0x01);
- machine().bookkeeping().coin_counter_w(1, data & 0x02);
+public:
+ aliens_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
+ m_maincpu(*this, "maincpu"),
+ m_audiocpu(*this, "audiocpu"),
+ m_k007232(*this, "k007232"),
+ m_k052109(*this, "k052109"),
+ m_k051960(*this, "k051960"),
+ m_soundlatch(*this, "soundlatch"),
+ m_paletteram_view(*this, "paletteram_view"),
+ m_rombank(*this, "rombank")
+ { }
+
+ void aliens(machine_config &config);
+
+protected:
+ virtual void machine_start() override;
+
+private:
+ // devices
+ required_device<konami_cpu_device> m_maincpu;
+ required_device<cpu_device> m_audiocpu;
+ required_device<k007232_device> m_k007232;
+ required_device<k052109_device> m_k052109;
+ required_device<k051960_device> m_k051960;
+ required_device<generic_latch_8_device> m_soundlatch;
+
+ memory_view m_paletteram_view;
+ required_memory_bank m_rombank;
+
+ void coin_counter_w(uint8_t data);
+ uint8_t k052109_051960_r(offs_t offset);
+ void k052109_051960_w(offs_t offset, uint8_t data);
+ void snd_bankswitch_w(uint8_t data);
+ uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ void volume_callback(uint8_t data);
+ K052109_CB_MEMBER(tile_callback);
+ K051960_CB_MEMBER(sprite_callback);
+
+ void main_map(address_map &map);
+ void sound_map(address_map &map);
+};
+
+
+// video
+
+/***************************************************************************
- /* bit 5 = select work RAM or palette */
- m_bank0000->set_bank((data & 0x20) >> 5);
+ Callbacks for the K052109
- /* bit 6 = enable char ROM reading through the video RAM */
- m_k052109->set_rmrd_line((data & 0x40) ? ASSERT_LINE : CLEAR_LINE);
+***************************************************************************/
- /* other bits unknown */
-#if 0
+K052109_CB_MEMBER(aliens_state::tile_callback)
{
- char baf[40];
- sprintf(baf, "%02x", data);
- popmessage(baf);
+ *code |= ((*color & 0x3f) << 8) | (bank << 14);
+ *color = layer * 4 + ((*color & 0xc0) >> 6);
}
-#endif
+
+
+/***************************************************************************
+
+ Callbacks for the K051960
+
+***************************************************************************/
+
+K051960_CB_MEMBER(aliens_state::sprite_callback)
+{
+ enum { sprite_colorbase = 256 / 16 };
+
+ /* The PROM allows for mixed priorities, where sprites would have
+ priority over text but not on one or both of the other two planes. */
+ switch (*color & 0x70)
+ {
+ case 0x10: *priority = 0x00; break; // over ABF
+ case 0x00: *priority = GFX_PMASK_4; break; // over AB, not F
+ case 0x40: *priority = GFX_PMASK_4 | GFX_PMASK_2; break; // over A, not BF
+ case 0x20:
+ case 0x60: *priority = GFX_PMASK_4 | GFX_PMASK_2 | GFX_PMASK_1; break; // over -, not ABF
+ case 0x50: *priority = GFX_PMASK_2; break; // over AF, not B
+ case 0x30:
+ case 0x70: *priority = GFX_PMASK_2 | GFX_PMASK_1; break; // over F, not AB
+ }
+ *code |= (*color & 0x80) << 6;
+ *color = sprite_colorbase + (*color & 0x0f);
+ *shadow = 0; // shadows are not used by this game
}
-void aliens_state::aliens_sh_irqtrigger_w(uint8_t data)
+
+/***************************************************************************
+
+ Display refresh
+
+***************************************************************************/
+
+uint32_t aliens_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- m_soundlatch->write(data);
- m_audiocpu->set_input_line(0, HOLD_LINE);
+ m_k052109->tilemap_update();
+
+ screen.priority().fill(0, cliprect);
+ // The background color is always from layer 1
+ m_k052109->tilemap_draw(screen, bitmap, cliprect, 1, TILEMAP_DRAW_OPAQUE, 0);
+
+ m_k052109->tilemap_draw(screen, bitmap, cliprect, 1, 0, 1);
+ m_k052109->tilemap_draw(screen, bitmap, cliprect, 2, 0, 2);
+ m_k052109->tilemap_draw(screen, bitmap, cliprect, 0, 0, 4);
+
+ m_k051960->k051960_sprites_draw(bitmap, cliprect, screen.priority(), -1, -1);
+ return 0;
+}
+
+
+// machine
+
+void aliens_state::coin_counter_w(uint8_t data)
+{
+ // bits 0-1 = coin counters
+ machine().bookkeeping().coin_counter_w(0, data & 0x01);
+ machine().bookkeeping().coin_counter_w(1, data & 0x02);
+
+ // bit 5 = select work RAM or palette
+ m_paletteram_view.select((data & 0x20) >> 5);
+
+ // bit 6 = enable char ROM reading through the video RAM
+ m_k052109->set_rmrd_line((data & 0x40) ? ASSERT_LINE : CLEAR_LINE);
+
+ // other bits unknown
}
-void aliens_state::aliens_snd_bankswitch_w(uint8_t data)
+void aliens_state::snd_bankswitch_w(uint8_t data)
{
- /* b1: bank for chanel A */
- /* b0: bank for chanel B */
+ // b1: bank for channel A
+ // b0: bank for channel B
- int bank_A = BIT(data, 1);
- int bank_B = BIT(data, 0);
+ int const bank_a = BIT(data, 1);
+ int const bank_b = BIT(data, 0);
- m_k007232->set_bank(bank_A, bank_B);
+ m_k007232->set_bank(bank_a, bank_b);
}
@@ -85,34 +198,30 @@ void aliens_state::k052109_051960_w(offs_t offset, uint8_t data)
m_k051960->k051960_w(offset - 0x3c00, data);
}
-void aliens_state::aliens_map(address_map &map)
+void aliens_state::main_map(address_map &map)
{
- map(0x0000, 0x03ff).m(m_bank0000, FUNC(address_map_bank_device::amap8));
+ map(0x0000, 0x03ff).view(m_paletteram_view);
+ m_paletteram_view[0](0x0000, 0x03ff).ram();
+ m_paletteram_view[1](0x0000, 0x03ff).ram().w("palette", FUNC(palette_device::write8)).share("palette");
map(0x0400, 0x1fff).ram();
- map(0x2000, 0x3fff).bankr("rombank"); /* banked ROM */
+ map(0x2000, 0x3fff).bankr(m_rombank);
map(0x4000, 0x7fff).rw(FUNC(aliens_state::k052109_051960_r), FUNC(aliens_state::k052109_051960_w));
map(0x5f80, 0x5f80).portr("DSW3");
map(0x5f81, 0x5f81).portr("P1");
map(0x5f82, 0x5f82).portr("P2");
map(0x5f83, 0x5f83).portr("DSW2");
map(0x5f84, 0x5f84).portr("DSW1");
- map(0x5f88, 0x5f88).r("watchdog", FUNC(watchdog_timer_device::reset_r)).w(FUNC(aliens_state::aliens_coin_counter_w)); /* coin counters */
- map(0x5f8c, 0x5f8c).w(FUNC(aliens_state::aliens_sh_irqtrigger_w)); /* cause interrupt on audio CPU */
- map(0x8000, 0xffff).rom().region("maincpu", 0x28000); /* ROM e24_j02.bin */
-}
-
-void aliens_state::bank0000_map(address_map &map)
-{
- map(0x0000, 0x03ff).ram();
- map(0x0400, 0x07ff).ram().w("palette", FUNC(palette_device::write8)).share("palette");
+ map(0x5f88, 0x5f88).r("watchdog", FUNC(watchdog_timer_device::reset_r)).w(FUNC(aliens_state::coin_counter_w));
+ map(0x5f8c, 0x5f8c).w("soundlatch", FUNC(generic_latch_8_device::write)); // cause interrupt on audio CPU
+ map(0x8000, 0xffff).rom().region("maincpu", 0x28000); // ROM e24_j02.bin
}
-void aliens_state::aliens_sound_map(address_map &map)
+void aliens_state::sound_map(address_map &map)
{
- map(0x0000, 0x7fff).rom(); /* ROM g04_b03.bin */
- map(0x8000, 0x87ff).ram(); /* RAM */
+ map(0x0000, 0x7fff).rom(); // ROM g04_b03.bin
+ map(0x8000, 0x87ff).ram();
map(0xa000, 0xa001).rw("ymsnd", FUNC(ym2151_device::read), FUNC(ym2151_device::write));
- map(0xc000, 0xc000).r(m_soundlatch, FUNC(generic_latch_8_device::read));
+ map(0xc000, 0xc000).r("soundlatch", FUNC(generic_latch_8_device::read));
map(0xe000, 0xe00d).rw(m_k007232, FUNC(k007232_device::read), FUNC(k007232_device::write));
}
@@ -126,7 +235,7 @@ void aliens_state::aliens_sound_map(address_map &map)
static INPUT_PORTS_START( aliens )
PORT_START("DSW1")
KONAMI_COINAGE_LOC(DEF_STR( Free_Play ), "No Credits", SW1)
- /* "No Credits" = both coin slots open, but no effect on coin counters */
+ // "No Credits" = both coin slots open, but no effect on coin counters
PORT_START("DSW2")
PORT_DIPNAME( 0x03, 0x02, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW2:1,2")
@@ -134,9 +243,9 @@ static INPUT_PORTS_START( aliens )
PORT_DIPSETTING( 0x02, "2" )
PORT_DIPSETTING( 0x01, "3" )
PORT_DIPSETTING( 0x00, "5" )
- PORT_DIPUNUSED_DIPLOC( 0x0004, 0x0004, "SW2:3" ) /* Listed as "Unused" */
- PORT_DIPUNUSED_DIPLOC( 0x0008, 0x0008, "SW2:4" ) /* Listed as "Unused" */
- PORT_DIPUNUSED_DIPLOC( 0x0010, 0x0010, "SW2:5" ) /* Listed as "Unused" */
+ PORT_DIPUNUSED_DIPLOC( 0x0004, 0x0004, "SW2:3" ) // Listed as "Unused"
+ PORT_DIPUNUSED_DIPLOC( 0x0008, 0x0008, "SW2:4" ) // Listed as "Unused"
+ PORT_DIPUNUSED_DIPLOC( 0x0010, 0x0010, "SW2:5" ) // Listed as "Unused"
PORT_DIPNAME( 0x60, 0x40, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:6,7")
PORT_DIPSETTING( 0x60, DEF_STR( Easy ) )
PORT_DIPSETTING( 0x40, DEF_STR( Normal ) )
@@ -150,9 +259,9 @@ static INPUT_PORTS_START( aliens )
PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW3:1")
PORT_DIPSETTING( 0x01, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
- PORT_DIPUNUSED_DIPLOC( 0x02, 0x02, "SW3:2" ) /* Listed as "Unused" */
+ PORT_DIPUNUSED_DIPLOC( 0x02, 0x02, "SW3:2" ) // Listed as "Unused"
PORT_SERVICE_DIPLOC( 0x04, IP_ACTIVE_LOW, "SW3:3" )
- PORT_DIPUNUSED_DIPLOC( 0x08, 0x08, "SW3:4" ) /* Listed as "Unused" */
+ PORT_DIPUNUSED_DIPLOC( 0x08, 0x08, "SW3:4" ) // Listed as "Unused"
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
@@ -184,36 +293,24 @@ void aliens_state::machine_start()
m_rombank->set_entry(0);
}
-void aliens_state::machine_reset()
-{
- m_bank0000->set_bank(0);
-}
-
-void aliens_state::banking_callback(uint8_t data)
-{
- m_rombank->set_entry(data & 0x1f);
-}
-
void aliens_state::aliens(machine_config &config)
{
- /* basic machine hardware */
- KONAMI(config, m_maincpu, XTAL(24'000'000)/2/4); /* 052001 (verified on pcb) */
- m_maincpu->set_addrmap(AS_PROGRAM, &aliens_state::aliens_map);
- m_maincpu->line().set(FUNC(aliens_state::banking_callback));
+ // basic machine hardware
+ KONAMI(config, m_maincpu, XTAL(24'000'000) / 2 / 4); // 052001 (verified on PCB)
+ m_maincpu->set_addrmap(AS_PROGRAM, &aliens_state::main_map);
+ m_maincpu->line().set_membank(m_rombank).mask(0x1f);
- Z80(config, m_audiocpu, XTAL(3'579'545)); /* verified on pcb */
- m_audiocpu->set_addrmap(AS_PROGRAM, &aliens_state::aliens_sound_map);
-
- ADDRESS_MAP_BANK(config, "bank0000").set_map(&aliens_state::bank0000_map).set_options(ENDIANNESS_BIG, 8, 11, 0x400);
+ Z80(config, m_audiocpu, XTAL(3'579'545)); // verified on PCB
+ m_audiocpu->set_addrmap(AS_PROGRAM, &aliens_state::sound_map);
WATCHDOG_TIMER(config, "watchdog");
- /* video hardware */
+ // video hardware
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
- screen.set_raw(XTAL(24'000'000)/3, 528, 112, 400, 256, 16, 240); // measured 59.17
+ screen.set_raw(XTAL(24'000'000) / 3, 528, 112, 400, 256, 16, 240); // measured 59.17
// 6MHz dotclock is more realistic, however needs drawing updates. replace when ready
-// screen.set_raw(XTAL(24'000'000)/4, 396, hbend, hbstart, 256, 16, 240);
- screen.set_screen_update(FUNC(aliens_state::screen_update_aliens));
+// screen.set_raw(XTAL(24'000'000) / 4, 396, hbend, hbstart, 256, 16, 240);
+ screen.set_screen_update(FUNC(aliens_state::screen_update));
screen.set_palette("palette");
PALETTE(config, "palette").set_format(palette_device::xBGR_555, 512).enable_shadows();
@@ -229,17 +326,17 @@ void aliens_state::aliens(machine_config &config)
m_k051960->set_sprite_callback(FUNC(aliens_state::sprite_callback));
m_k051960->irq_handler().set_inputline(m_maincpu, KONAMI_IRQ_LINE);
- /* sound hardware */
+ // sound hardware
SPEAKER(config, "mono").front_center();
- GENERIC_LATCH_8(config, m_soundlatch);
+ GENERIC_LATCH_8(config, "soundlatch").data_pending_callback().set_inputline(m_audiocpu, 0);
- ym2151_device &ymsnd(YM2151(config, "ymsnd", XTAL(3'579'545))); /* verified on pcb */
- ymsnd.port_write_handler().set(FUNC(aliens_state::aliens_snd_bankswitch_w));
+ ym2151_device &ymsnd(YM2151(config, "ymsnd", XTAL(3'579'545))); // verified on PCB
+ ymsnd.port_write_handler().set(FUNC(aliens_state::snd_bankswitch_w));
ymsnd.add_route(0, "mono", 0.60);
ymsnd.add_route(1, "mono", 0.60);
- K007232(config, m_k007232, XTAL(3'579'545)); /* verified on pcb */
+ K007232(config, m_k007232, XTAL(3'579'545)); // verified on PCB
m_k007232->port_write().set(FUNC(aliens_state::volume_callback));
m_k007232->add_route(0, "mono", 0.20);
m_k007232->add_route(1, "mono", 0.20);
@@ -253,254 +350,257 @@ void aliens_state::aliens(machine_config &config)
***************************************************************************/
ROM_START( aliens )
- ROM_REGION( 0x30000, "maincpu", 0 ) /* code + banked roms */
+ ROM_REGION( 0x30000, "maincpu", 0 )
ROM_LOAD( "875_j01.c24", 0x00000, 0x20000, CRC(6a529cd6) SHA1(bff6dee33141d8ed2b2c28813cf49f52dceac364) )
ROM_LOAD( "875_j02.e24", 0x20000, 0x10000, CRC(56c20971) SHA1(af272e146705e97342466a208c64d823ebc83d83) )
ROM_REGION( 0x08000, "audiocpu", 0 )
ROM_LOAD( "875_b03.g04", 0x00000, 0x08000, CRC(1ac4d283) SHA1(2253f1f39c7edb6cef438b3d97f3af67a1f491ff) )
- ROM_REGION( 0x200000, "k052109", 0 ) /* tiles */
+ ROM_REGION( 0x200000, "k052109", 0 ) // tiles
ROM_LOAD32_WORD( "875b11.k13", 0x000000, 0x80000, CRC(89c5c885) SHA1(02a1581579b6ef816e04bec312a7b3ae7c7e84f8) )
ROM_LOAD32_WORD( "875b12.k19", 0x000002, 0x80000, CRC(ea6bdc17) SHA1(a7c22370f8adc5b479283f1ff831f493df78282f) )
ROM_LOAD32_WORD( "875b07.j13", 0x100000, 0x40000, CRC(e9c56d66) SHA1(1f58949d5391aef002a6e1ee7034e57bf99cee61) )
- /* second half empty */
+ // second half empty
ROM_LOAD32_WORD( "875b08.j19", 0x100002, 0x40000, CRC(f9387966) SHA1(470ecc4a5a3edd08d5e0ab10b0c590db1968fb0a) )
- /* second half empty */
+ // second half empty
- ROM_REGION( 0x200000, "k051960", 0 ) /* sprites */
+ ROM_REGION( 0x200000, "k051960", 0 ) // sprites
ROM_LOAD32_WORD( "875b10.k08", 0x000000, 0x80000, CRC(0b1035b1) SHA1(db04020761386e79249762cd1540208375c38c7f) )
ROM_LOAD32_WORD( "875b09.k02", 0x000002, 0x80000, CRC(e76b3c19) SHA1(6838e07460b3eaaeb129208ad0696c8019bd63d9) )
ROM_LOAD32_WORD( "875b06.j08", 0x100000, 0x40000, CRC(081a0566) SHA1(3a4aa14178fe76a030224743c9e9cd974e08bd79) )
- /* second half empty */
+ // second half empty
ROM_LOAD32_WORD( "875b05.j02", 0x100002, 0x40000, CRC(19a261f2) SHA1(b0518fad833b3e613e0201d5d9cab73dc5e78e1d) )
- /* second half empty */
+ // second half empty
ROM_REGION( 0x0100, "proms", 0 )
- ROM_LOAD( "821a08.h14", 0x0000, 0x0100, CRC(7da55800) SHA1(3826f73569c8ae0431510a355bdfa082152b74a5) ) /* priority encoder (not used) */
+ ROM_LOAD( "821a08.h14", 0x0000, 0x0100, CRC(7da55800) SHA1(3826f73569c8ae0431510a355bdfa082152b74a5) ) // priority encoder (not used)
- ROM_REGION( 0x40000, "k007232", 0 ) /* samples for 007232 */
+ ROM_REGION( 0x40000, "k007232", 0 ) // samples
ROM_LOAD( "875b04.e05", 0x00000, 0x40000, CRC(4e209ac8) SHA1(09d9eaae61bfd04bf318555ccd44d7371571d86d) )
ROM_END
ROM_START( aliens2 )
- ROM_REGION( 0x30000, "maincpu", 0 ) /* code + banked roms */
+ ROM_REGION( 0x30000, "maincpu", 0 )
ROM_LOAD( "875_n01.c24", 0x00000, 0x20000, CRC(106cf59c) SHA1(78622adc02055d31cd587c83b23a6cde30c9bc22) )
ROM_LOAD( "875_p02.e24", 0x20000, 0x10000, CRC(4edd707d) SHA1(02b39068e5fd99ecb5b35a586335b65a20fde490) )
ROM_REGION( 0x08000, "audiocpu", 0 )
ROM_LOAD( "875_b03.g04", 0x00000, 0x08000, CRC(1ac4d283) SHA1(2253f1f39c7edb6cef438b3d97f3af67a1f491ff) )
- ROM_REGION( 0x200000, "k052109", 0 ) /* tiles */
+ ROM_REGION( 0x200000, "k052109", 0 ) // tiles
ROM_LOAD32_WORD( "875b11.k13", 0x000000, 0x80000, CRC(89c5c885) SHA1(02a1581579b6ef816e04bec312a7b3ae7c7e84f8) )
ROM_LOAD32_WORD( "875b12.k19", 0x000002, 0x80000, CRC(ea6bdc17) SHA1(a7c22370f8adc5b479283f1ff831f493df78282f) )
ROM_LOAD32_WORD( "875b07.j13", 0x100000, 0x40000, CRC(e9c56d66) SHA1(1f58949d5391aef002a6e1ee7034e57bf99cee61) )
- /* second half empty */
+ // second half empty
ROM_LOAD32_WORD( "875b08.j19", 0x100002, 0x40000, CRC(f9387966) SHA1(470ecc4a5a3edd08d5e0ab10b0c590db1968fb0a) )
- /* second half empty */
+ // second half empty
- ROM_REGION( 0x200000, "k051960", 0 ) /* sprites */
+ ROM_REGION( 0x200000, "k051960", 0 ) // sprites
ROM_LOAD32_WORD( "875b10.k08", 0x000000, 0x80000, CRC(0b1035b1) SHA1(db04020761386e79249762cd1540208375c38c7f) )
ROM_LOAD32_WORD( "875b09.k02", 0x000002, 0x80000, CRC(e76b3c19) SHA1(6838e07460b3eaaeb129208ad0696c8019bd63d9) )
ROM_LOAD32_WORD( "875b06.j08", 0x100000, 0x40000, CRC(081a0566) SHA1(3a4aa14178fe76a030224743c9e9cd974e08bd79) )
- /* second half empty */
+ // second half empty
ROM_LOAD32_WORD( "875b05.j02", 0x100002, 0x40000, CRC(19a261f2) SHA1(b0518fad833b3e613e0201d5d9cab73dc5e78e1d) )
- /* second half empty */
+ // second half empty
ROM_REGION( 0x0100, "proms", 0 )
- ROM_LOAD( "821a08.h14", 0x0000, 0x0100, CRC(7da55800) SHA1(3826f73569c8ae0431510a355bdfa082152b74a5) ) /* priority encoder (not used) */
+ ROM_LOAD( "821a08.h14", 0x0000, 0x0100, CRC(7da55800) SHA1(3826f73569c8ae0431510a355bdfa082152b74a5) ) // priority encoder (not used)
- ROM_REGION( 0x40000, "k007232", 0 ) /* samples for 007232 */
+ ROM_REGION( 0x40000, "k007232", 0 ) // samples
ROM_LOAD( "875b04.e05", 0x00000, 0x40000, CRC(4e209ac8) SHA1(09d9eaae61bfd04bf318555ccd44d7371571d86d) )
ROM_END
ROM_START( aliens3 )
- ROM_REGION( 0x30000, "maincpu", 0 ) /* code + banked roms */
+ ROM_REGION( 0x30000, "maincpu", 0 )
ROM_LOAD( "875_c01.c24", 0x00000, 0x20000, CRC(3c0006fb) SHA1(e8730d50c358e7321dd676c74368fe44b9bbe5b2) )
- ROM_LOAD( "875_w3_2.e24", 0x20000, 0x10000, CRC(f917f7b5) SHA1(ab95ad40c82f11572bbaa03d76dae35f76bacf0c) ) /* Needs correct rom label */
+ ROM_LOAD( "875_w3_2.e24", 0x20000, 0x10000, CRC(f917f7b5) SHA1(ab95ad40c82f11572bbaa03d76dae35f76bacf0c) ) // Needs correct ROM label
ROM_REGION( 0x08000, "audiocpu", 0 )
ROM_LOAD( "875_b03.g04", 0x00000, 0x08000, CRC(1ac4d283) SHA1(2253f1f39c7edb6cef438b3d97f3af67a1f491ff) )
- ROM_REGION( 0x200000, "k052109", 0 ) /* tiles */
+ ROM_REGION( 0x200000, "k052109", 0 ) // tiles
ROM_LOAD32_WORD( "875b11.k13", 0x000000, 0x80000, CRC(89c5c885) SHA1(02a1581579b6ef816e04bec312a7b3ae7c7e84f8) )
ROM_LOAD32_WORD( "875b12.k19", 0x000002, 0x80000, CRC(ea6bdc17) SHA1(a7c22370f8adc5b479283f1ff831f493df78282f) )
ROM_LOAD32_WORD( "875b07.j13", 0x100000, 0x40000, CRC(e9c56d66) SHA1(1f58949d5391aef002a6e1ee7034e57bf99cee61) )
- /* second half empty */
+ // second half empty
ROM_LOAD32_WORD( "875b08.j19", 0x100002, 0x40000, CRC(f9387966) SHA1(470ecc4a5a3edd08d5e0ab10b0c590db1968fb0a) )
- /* second half empty */
+ // second half empty
- ROM_REGION( 0x200000, "k051960", 0 ) /* sprites */
+ ROM_REGION( 0x200000, "k051960", 0 ) // sprites
ROM_LOAD32_WORD( "875b10.k08", 0x000000, 0x80000, CRC(0b1035b1) SHA1(db04020761386e79249762cd1540208375c38c7f) )
ROM_LOAD32_WORD( "875b09.k02", 0x000002, 0x80000, CRC(e76b3c19) SHA1(6838e07460b3eaaeb129208ad0696c8019bd63d9) )
ROM_LOAD32_WORD( "875b06.j08", 0x100000, 0x40000, CRC(081a0566) SHA1(3a4aa14178fe76a030224743c9e9cd974e08bd79) )
- /* second half empty */
+ // second half empty
ROM_LOAD32_WORD( "875b05.j02", 0x100002, 0x40000, CRC(19a261f2) SHA1(b0518fad833b3e613e0201d5d9cab73dc5e78e1d) )
- /* second half empty */
+ // second half empty
ROM_REGION( 0x0100, "proms", 0 )
- ROM_LOAD( "821a08.h14", 0x0000, 0x0100, CRC(7da55800) SHA1(3826f73569c8ae0431510a355bdfa082152b74a5) ) /* priority encoder (not used) */
+ ROM_LOAD( "821a08.h14", 0x0000, 0x0100, CRC(7da55800) SHA1(3826f73569c8ae0431510a355bdfa082152b74a5) ) // priority encoder (not used)
- ROM_REGION( 0x40000, "k007232", 0 ) /* samples for 007232 */
+ ROM_REGION( 0x40000, "k007232", 0 ) // samples
ROM_LOAD( "875b04.e05", 0x00000, 0x40000, CRC(4e209ac8) SHA1(09d9eaae61bfd04bf318555ccd44d7371571d86d) )
ROM_END
ROM_START( aliens4 )
- ROM_REGION( 0x30000, "maincpu", 0 ) /* code + banked roms */
+ ROM_REGION( 0x30000, "maincpu", 0 )
ROM_LOAD( "875_c01.c24", 0x00000, 0x20000, CRC(3c0006fb) SHA1(e8730d50c358e7321dd676c74368fe44b9bbe5b2) )
ROM_LOAD( "875_d02.e24", 0x20000, 0x10000, CRC(1dc46780) SHA1(85dbd7c0fe5bfbf22274d9b4238588a2c48c535e) )
ROM_REGION( 0x08000, "audiocpu", 0 )
ROM_LOAD( "875_b03.g04", 0x00000, 0x08000, CRC(1ac4d283) SHA1(2253f1f39c7edb6cef438b3d97f3af67a1f491ff) )
- ROM_REGION( 0x200000, "k052109", 0 ) /* tiles */
+ ROM_REGION( 0x200000, "k052109", 0 ) // tiles
ROM_LOAD32_WORD( "875b11.k13", 0x000000, 0x80000, CRC(89c5c885) SHA1(02a1581579b6ef816e04bec312a7b3ae7c7e84f8) )
ROM_LOAD32_WORD( "875b12.k19", 0x000002, 0x80000, CRC(ea6bdc17) SHA1(a7c22370f8adc5b479283f1ff831f493df78282f) )
ROM_LOAD32_WORD( "875b07.j13", 0x100000, 0x40000, CRC(e9c56d66) SHA1(1f58949d5391aef002a6e1ee7034e57bf99cee61) )
- /* second half empty */
+ // second half empty
ROM_LOAD32_WORD( "875b08.j19", 0x100002, 0x40000, CRC(f9387966) SHA1(470ecc4a5a3edd08d5e0ab10b0c590db1968fb0a) )
- /* second half empty */
+ // second half empty
- ROM_REGION( 0x200000, "k051960", 0 ) /* sprites */
+ ROM_REGION( 0x200000, "k051960", 0 ) // sprites
ROM_LOAD32_WORD( "875b10.k08", 0x000000, 0x80000, CRC(0b1035b1) SHA1(db04020761386e79249762cd1540208375c38c7f) )
ROM_LOAD32_WORD( "875b09.k02", 0x000002, 0x80000, CRC(e76b3c19) SHA1(6838e07460b3eaaeb129208ad0696c8019bd63d9) )
ROM_LOAD32_WORD( "875b06.j08", 0x100000, 0x40000, CRC(081a0566) SHA1(3a4aa14178fe76a030224743c9e9cd974e08bd79) )
- /* second half empty */
+ // second half empty
ROM_LOAD32_WORD( "875b05.j02", 0x100002, 0x40000, CRC(19a261f2) SHA1(b0518fad833b3e613e0201d5d9cab73dc5e78e1d) )
- /* second half empty */
+ // second half empty
ROM_REGION( 0x0100, "proms", 0 )
- ROM_LOAD( "821a08.h14", 0x0000, 0x0100, CRC(7da55800) SHA1(3826f73569c8ae0431510a355bdfa082152b74a5) ) /* priority encoder (not used) */
+ ROM_LOAD( "821a08.h14", 0x0000, 0x0100, CRC(7da55800) SHA1(3826f73569c8ae0431510a355bdfa082152b74a5) ) // priority encoder (not used)
- ROM_REGION( 0x40000, "k007232", 0 ) /* samples for 007232 */
+ ROM_REGION( 0x40000, "k007232", 0 ) // samples
ROM_LOAD( "875b04.e05", 0x00000, 0x40000, CRC(4e209ac8) SHA1(09d9eaae61bfd04bf318555ccd44d7371571d86d) )
ROM_END
ROM_START( aliensu )
- ROM_REGION( 0x30000, "maincpu", 0 ) /* code + banked roms */
+ ROM_REGION( 0x30000, "maincpu", 0 )
ROM_LOAD( "875_n01.c24", 0x00000, 0x20000, CRC(106cf59c) SHA1(78622adc02055d31cd587c83b23a6cde30c9bc22) )
ROM_LOAD( "875_n02.e24", 0x20000, 0x10000, CRC(24dd612e) SHA1(35bceb3045cd0bd9d107312b371fb60dcf3f1272) )
ROM_REGION( 0x08000, "audiocpu", 0 )
ROM_LOAD( "875_b03.g04", 0x00000, 0x08000, CRC(1ac4d283) SHA1(2253f1f39c7edb6cef438b3d97f3af67a1f491ff) )
- ROM_REGION( 0x200000, "k052109", 0 ) /* tiles */
+ ROM_REGION( 0x200000, "k052109", 0 ) // tiles
ROM_LOAD32_WORD( "875b11.k13", 0x000000, 0x80000, CRC(89c5c885) SHA1(02a1581579b6ef816e04bec312a7b3ae7c7e84f8) )
ROM_LOAD32_WORD( "875b12.k19", 0x000002, 0x80000, CRC(ea6bdc17) SHA1(a7c22370f8adc5b479283f1ff831f493df78282f) )
ROM_LOAD32_WORD( "875b07.j13", 0x100000, 0x40000, CRC(e9c56d66) SHA1(1f58949d5391aef002a6e1ee7034e57bf99cee61) )
- /* second half empty */
+ // second half empty
ROM_LOAD32_WORD( "875b08.j19", 0x100002, 0x40000, CRC(f9387966) SHA1(470ecc4a5a3edd08d5e0ab10b0c590db1968fb0a) )
- /* second half empty */
+ // second half empty
- ROM_REGION( 0x200000, "k051960", 0 ) /* sprites */
+ ROM_REGION( 0x200000, "k051960", 0 ) // sprites
ROM_LOAD32_WORD( "875b10.k08", 0x000000, 0x80000, CRC(0b1035b1) SHA1(db04020761386e79249762cd1540208375c38c7f) )
ROM_LOAD32_WORD( "875b09.k02", 0x000002, 0x80000, CRC(e76b3c19) SHA1(6838e07460b3eaaeb129208ad0696c8019bd63d9) )
ROM_LOAD32_WORD( "875b06.j08", 0x100000, 0x40000, CRC(081a0566) SHA1(3a4aa14178fe76a030224743c9e9cd974e08bd79) )
- /* second half empty */
+ // second half empty
ROM_LOAD32_WORD( "875b05.j02", 0x100002, 0x40000, CRC(19a261f2) SHA1(b0518fad833b3e613e0201d5d9cab73dc5e78e1d) )
- /* second half empty */
+ // second half empty
ROM_REGION( 0x0100, "proms", 0 )
- ROM_LOAD( "821a08.h14", 0x0000, 0x0100, CRC(7da55800) SHA1(3826f73569c8ae0431510a355bdfa082152b74a5) ) /* priority encoder (not used) */
+ ROM_LOAD( "821a08.h14", 0x0000, 0x0100, CRC(7da55800) SHA1(3826f73569c8ae0431510a355bdfa082152b74a5) ) // priority encoder (not used)
- ROM_REGION( 0x40000, "k007232", 0 ) /* samples for 007232 */
+ ROM_REGION( 0x40000, "k007232", 0 ) // samples
ROM_LOAD( "875b04.e05", 0x00000, 0x40000, CRC(4e209ac8) SHA1(09d9eaae61bfd04bf318555ccd44d7371571d86d) )
ROM_END
ROM_START( aliensj )
- ROM_REGION( 0x30000, "maincpu", 0 ) /* code + banked roms */
+ ROM_REGION( 0x30000, "maincpu", 0 )
ROM_LOAD( "875_m01.c24", 0x00000, 0x20000, CRC(1663d3dc) SHA1(706bdf3daa3bda372d94263f3405d67a7ef8dc69) )
ROM_LOAD( "875_m02.e24", 0x20000, 0x10000, CRC(54a774e5) SHA1(b6413b2199f863cae1c6fcef766989162cd4b95e) )
ROM_REGION( 0x08000, "audiocpu", 0 )
ROM_LOAD( "875_k03.g04", 0x00000, 0x08000, CRC(bd86264d) SHA1(345fd666daf8a29ef314b14306c1a976cb159bed) )
- ROM_REGION( 0x200000, "k052109", 0 ) /* tiles */
+ ROM_REGION( 0x200000, "k052109", 0 ) // tiles
ROM_LOAD32_WORD( "875b11.k13", 0x000000, 0x80000, CRC(89c5c885) SHA1(02a1581579b6ef816e04bec312a7b3ae7c7e84f8) )
ROM_LOAD32_WORD( "875b12.k19", 0x000002, 0x80000, CRC(ea6bdc17) SHA1(a7c22370f8adc5b479283f1ff831f493df78282f) )
ROM_LOAD32_WORD( "875b07.j13", 0x100000, 0x40000, CRC(e9c56d66) SHA1(1f58949d5391aef002a6e1ee7034e57bf99cee61) )
- /* second half empty */
+ // second half empty
ROM_LOAD32_WORD( "875b08.j19", 0x100002, 0x40000, CRC(f9387966) SHA1(470ecc4a5a3edd08d5e0ab10b0c590db1968fb0a) )
- /* second half empty */
+ // second half empty
- ROM_REGION( 0x200000, "k051960", 0 ) /* sprites */
+ ROM_REGION( 0x200000, "k051960", 0 ) // sprites
ROM_LOAD32_WORD( "875b10.k08", 0x000000, 0x80000, CRC(0b1035b1) SHA1(db04020761386e79249762cd1540208375c38c7f) )
ROM_LOAD32_WORD( "875b09.k02", 0x000002, 0x80000, CRC(e76b3c19) SHA1(6838e07460b3eaaeb129208ad0696c8019bd63d9) )
ROM_LOAD32_WORD( "875b06.j08", 0x100000, 0x40000, CRC(081a0566) SHA1(3a4aa14178fe76a030224743c9e9cd974e08bd79) )
- /* second half empty */
+ // second half empty
ROM_LOAD32_WORD( "875b05.j02", 0x100002, 0x40000, CRC(19a261f2) SHA1(b0518fad833b3e613e0201d5d9cab73dc5e78e1d) )
- /* second half empty */
+ // second half empty
ROM_REGION( 0x0100, "proms", 0 )
- ROM_LOAD( "821a08.h14", 0x0000, 0x0100, CRC(7da55800) SHA1(3826f73569c8ae0431510a355bdfa082152b74a5) ) /* priority encoder (not used) */
+ ROM_LOAD( "821a08.h14", 0x0000, 0x0100, CRC(7da55800) SHA1(3826f73569c8ae0431510a355bdfa082152b74a5) ) // priority encoder (not used)
- ROM_REGION( 0x40000, "k007232", 0 ) /* samples for 007232 */
+ ROM_REGION( 0x40000, "k007232", 0 ) // samples
ROM_LOAD( "875b04.e05", 0x00000, 0x40000, CRC(4e209ac8) SHA1(09d9eaae61bfd04bf318555ccd44d7371571d86d) )
ROM_END
ROM_START( aliensj2 )
- ROM_REGION( 0x30000, "maincpu", 0 ) /* code + banked roms */
+ ROM_REGION( 0x30000, "maincpu", 0 )
ROM_LOAD( "875_m01.c24", 0x00000, 0x20000, CRC(1663d3dc) SHA1(706bdf3daa3bda372d94263f3405d67a7ef8dc69) )
- ROM_LOAD( "875_j2_2.e24", 0x20000, 0x10000, CRC(4bb84952) SHA1(ca40a7181f11d6c34c26b65f8d4a1d1df2c7fb48) ) /* Needs correct rom label */
+ ROM_LOAD( "875_j2_2.e24", 0x20000, 0x10000, CRC(4bb84952) SHA1(ca40a7181f11d6c34c26b65f8d4a1d1df2c7fb48) ) // Needs correct ROM label
ROM_REGION( 0x08000, "audiocpu", 0 )
ROM_LOAD( "875_k03.g04", 0x00000, 0x08000, CRC(bd86264d) SHA1(345fd666daf8a29ef314b14306c1a976cb159bed) )
- ROM_REGION( 0x200000, "k052109", 0 ) /* tiles */
+ ROM_REGION( 0x200000, "k052109", 0 ) // tiles
ROM_LOAD32_WORD( "875b11.k13", 0x000000, 0x80000, CRC(89c5c885) SHA1(02a1581579b6ef816e04bec312a7b3ae7c7e84f8) )
ROM_LOAD32_WORD( "875b12.k19", 0x000002, 0x80000, CRC(ea6bdc17) SHA1(a7c22370f8adc5b479283f1ff831f493df78282f) )
ROM_LOAD32_WORD( "875b07.j13", 0x100000, 0x40000, CRC(e9c56d66) SHA1(1f58949d5391aef002a6e1ee7034e57bf99cee61) )
- /* second half empty */
+ // second half empty
ROM_LOAD32_WORD( "875b08.j19", 0x100002, 0x40000, CRC(f9387966) SHA1(470ecc4a5a3edd08d5e0ab10b0c590db1968fb0a) )
- /* second half empty */
+ // second half empty
- ROM_REGION( 0x200000, "k051960", 0 ) /* sprites */
+ ROM_REGION( 0x200000, "k051960", 0 ) // sprites
ROM_LOAD32_WORD( "875b10.k08", 0x000000, 0x80000, CRC(0b1035b1) SHA1(db04020761386e79249762cd1540208375c38c7f) )
ROM_LOAD32_WORD( "875b09.k02", 0x000002, 0x80000, CRC(e76b3c19) SHA1(6838e07460b3eaaeb129208ad0696c8019bd63d9) )
ROM_LOAD32_WORD( "875b06.j08", 0x100000, 0x40000, CRC(081a0566) SHA1(3a4aa14178fe76a030224743c9e9cd974e08bd79) )
- /* second half empty */
+ // second half empty
ROM_LOAD32_WORD( "875b05.j02", 0x100002, 0x40000, CRC(19a261f2) SHA1(b0518fad833b3e613e0201d5d9cab73dc5e78e1d) )
- /* second half empty */
+ // second half empty
ROM_REGION( 0x0100, "proms", 0 )
- ROM_LOAD( "821a08.h14", 0x0000, 0x0100, CRC(7da55800) SHA1(3826f73569c8ae0431510a355bdfa082152b74a5) ) /* priority encoder (not used) */
+ ROM_LOAD( "821a08.h14", 0x0000, 0x0100, CRC(7da55800) SHA1(3826f73569c8ae0431510a355bdfa082152b74a5) ) // priority encoder (not used)
- ROM_REGION( 0x40000, "k007232", 0 ) /* samples for 007232 */
+ ROM_REGION( 0x40000, "k007232", 0 ) // samples
ROM_LOAD( "875b04.e05", 0x00000, 0x40000, CRC(4e209ac8) SHA1(09d9eaae61bfd04bf318555ccd44d7371571d86d) )
ROM_END
ROM_START( aliensa )
- ROM_REGION( 0x30000, "maincpu", 0 ) /* code + banked roms */
+ ROM_REGION( 0x30000, "maincpu", 0 )
ROM_LOAD( "875_m01.c24", 0x00000, 0x20000, CRC(1663d3dc) SHA1(706bdf3daa3bda372d94263f3405d67a7ef8dc69) )
ROM_LOAD( "875_r02.e24", 0x20000, 0x10000, CRC(973e4f11) SHA1(a4f65ef4c84b1dcac591dc348ebbb96d35ef5f93) )
ROM_REGION( 0x08000, "audiocpu", 0 )
ROM_LOAD( "875_k03.g04", 0x00000, 0x08000, CRC(bd86264d) SHA1(345fd666daf8a29ef314b14306c1a976cb159bed) )
- ROM_REGION( 0x200000, "k052109", 0 ) /* tiles */
+ ROM_REGION( 0x200000, "k052109", 0 ) // tiles
ROM_LOAD32_WORD( "875b11.k13", 0x000000, 0x80000, CRC(89c5c885) SHA1(02a1581579b6ef816e04bec312a7b3ae7c7e84f8) )
ROM_LOAD32_WORD( "875b12.k19", 0x000002, 0x80000, CRC(ea6bdc17) SHA1(a7c22370f8adc5b479283f1ff831f493df78282f) )
ROM_LOAD32_WORD( "875b07.j13", 0x100000, 0x40000, CRC(e9c56d66) SHA1(1f58949d5391aef002a6e1ee7034e57bf99cee61) )
- /* second half empty */
+ // second half empty
ROM_LOAD32_WORD( "875b08.j19", 0x100002, 0x40000, CRC(f9387966) SHA1(470ecc4a5a3edd08d5e0ab10b0c590db1968fb0a) )
- /* second half empty */
+ // second half empty
- ROM_REGION( 0x200000, "k051960", 0 ) /* sprites */
+ ROM_REGION( 0x200000, "k051960", 0 ) // sprites
ROM_LOAD32_WORD( "875b10.k08", 0x000000, 0x80000, CRC(0b1035b1) SHA1(db04020761386e79249762cd1540208375c38c7f) )
ROM_LOAD32_WORD( "875b09.k02", 0x000002, 0x80000, CRC(e76b3c19) SHA1(6838e07460b3eaaeb129208ad0696c8019bd63d9) )
ROM_LOAD32_WORD( "875b06.j08", 0x100000, 0x40000, CRC(081a0566) SHA1(3a4aa14178fe76a030224743c9e9cd974e08bd79) )
- /* second half empty */
+ // second half empty
ROM_LOAD32_WORD( "875b05.j02", 0x100002, 0x40000, CRC(19a261f2) SHA1(b0518fad833b3e613e0201d5d9cab73dc5e78e1d) )
- /* second half empty */
+ // second half empty
ROM_REGION( 0x0100, "proms", 0 )
- ROM_LOAD( "821a08.h14", 0x0000, 0x0100, CRC(7da55800) SHA1(3826f73569c8ae0431510a355bdfa082152b74a5) ) /* priority encoder (not used) */
+ ROM_LOAD( "821a08.h14", 0x0000, 0x0100, CRC(7da55800) SHA1(3826f73569c8ae0431510a355bdfa082152b74a5) ) // priority encoder (not used)
- ROM_REGION( 0x40000, "k007232", 0 ) /* samples for 007232 */
+ ROM_REGION( 0x40000, "k007232", 0 ) // samples
ROM_LOAD( "875b04.e05", 0x00000, 0x40000, CRC(4e209ac8) SHA1(09d9eaae61bfd04bf318555ccd44d7371571d86d) )
ROM_END
+} // anonymous namespace
+
+
/***************************************************************************
Game driver(s)
diff --git a/src/mame/konami/aliens.h b/src/mame/konami/aliens.h
deleted file mode 100644
index 4058cb8e817..00000000000
--- a/src/mame/konami/aliens.h
+++ /dev/null
@@ -1,63 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Manuel Abadia
-/*************************************************************************
-
- Aliens
-
-*************************************************************************/
-#ifndef MAME_INCLUDES_ALIENS_H
-#define MAME_INCLUDES_ALIENS_H
-
-#pragma once
-
-#include "cpu/m6809/konami.h" /* for the callback and the firq irq definition */
-#include "machine/bankdev.h"
-#include "machine/gen_latch.h"
-#include "sound/k007232.h"
-#include "k051960.h"
-#include "k052109.h"
-
-class aliens_state : public driver_device
-{
-public:
- aliens_state(const machine_config &mconfig, device_type type, const char *tag) :
- driver_device(mconfig, type, tag),
- m_maincpu(*this, "maincpu"),
- m_audiocpu(*this, "audiocpu"),
- m_bank0000(*this, "bank0000"),
- m_k007232(*this, "k007232"),
- m_k052109(*this, "k052109"),
- m_k051960(*this, "k051960"),
- m_soundlatch(*this, "soundlatch"),
- m_rombank(*this, "rombank")
- { }
-
- /* devices */
- required_device<konami_cpu_device> m_maincpu;
- required_device<cpu_device> m_audiocpu;
- required_device<address_map_bank_device> m_bank0000;
- required_device<k007232_device> m_k007232;
- required_device<k052109_device> m_k052109;
- required_device<k051960_device> m_k051960;
- required_device<generic_latch_8_device> m_soundlatch;
- required_memory_bank m_rombank;
-
- void aliens_coin_counter_w(uint8_t data);
- void aliens_sh_irqtrigger_w(uint8_t data);
- uint8_t k052109_051960_r(offs_t offset);
- void k052109_051960_w(offs_t offset, uint8_t data);
- void aliens_snd_bankswitch_w(uint8_t data);
- virtual void machine_start() override;
- virtual void machine_reset() override;
- uint32_t screen_update_aliens(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- void volume_callback(uint8_t data);
- K052109_CB_MEMBER(tile_callback);
- K051960_CB_MEMBER(sprite_callback);
- void banking_callback(uint8_t data);
- void aliens(machine_config &config);
- void aliens_map(address_map &map);
- void aliens_sound_map(address_map &map);
- void bank0000_map(address_map &map);
-};
-
-#endif // MAME_INCLUDES_ALIENS_H
diff --git a/src/mame/konami/aliens_v.cpp b/src/mame/konami/aliens_v.cpp
deleted file mode 100644
index 59e70a47d1f..00000000000
--- a/src/mame/konami/aliens_v.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Manuel Abadia
-
-#include "emu.h"
-#include "aliens.h"
-#include "screen.h"
-
-/***************************************************************************
-
- Callbacks for the K052109
-
-***************************************************************************/
-
-K052109_CB_MEMBER(aliens_state::tile_callback)
-{
- *code |= ((*color & 0x3f) << 8) | (bank << 14);
- *color = layer * 4 + ((*color & 0xc0) >> 6);
-}
-
-
-/***************************************************************************
-
- Callbacks for the K051960
-
-***************************************************************************/
-
-K051960_CB_MEMBER(aliens_state::sprite_callback)
-{
- enum { sprite_colorbase = 256 / 16 };
-
- /* The PROM allows for mixed priorities, where sprites would have */
- /* priority over text but not on one or both of the other two planes. */
- switch (*color & 0x70)
- {
- case 0x10: *priority = 0x00; break; /* over ABF */
- case 0x00: *priority = GFX_PMASK_4 ; break; /* over AB, not F */
- case 0x40: *priority = GFX_PMASK_4|GFX_PMASK_2 ; break; /* over A, not BF */
- case 0x20:
- case 0x60: *priority = GFX_PMASK_4|GFX_PMASK_2|GFX_PMASK_1; break; /* over -, not ABF */
- case 0x50: *priority = GFX_PMASK_2 ; break; /* over AF, not B */
- case 0x30:
- case 0x70: *priority = GFX_PMASK_2|GFX_PMASK_1; break; /* over F, not AB */
- }
- *code |= (*color & 0x80) << 6;
- *color = sprite_colorbase + (*color & 0x0f);
- *shadow = 0; /* shadows are not used by this game */
-}
-
-
-/***************************************************************************
-
- Display refresh
-
-***************************************************************************/
-
-uint32_t aliens_state::screen_update_aliens(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
-{
- m_k052109->tilemap_update();
-
- screen.priority().fill(0, cliprect);
- /* The background color is always from layer 1 */
- m_k052109->tilemap_draw(screen, bitmap, cliprect, 1, TILEMAP_DRAW_OPAQUE, 0);
-
- m_k052109->tilemap_draw(screen, bitmap, cliprect, 1, 0, 1);
- m_k052109->tilemap_draw(screen, bitmap, cliprect, 2, 0, 2);
- m_k052109->tilemap_draw(screen, bitmap, cliprect, 0, 0, 4);
-
- m_k051960->k051960_sprites_draw(bitmap, cliprect, screen.priority(), -1, -1);
- return 0;
-}
diff --git a/src/mame/konami/battlnts.cpp b/src/mame/konami/battlnts.cpp
index 9a1f5f87393..9c4eb3d60d8 100644
--- a/src/mame/konami/battlnts.cpp
+++ b/src/mame/konami/battlnts.cpp
@@ -13,7 +13,9 @@
***************************************************************************/
#include "emu.h"
-#include "battlnts.h"
+
+#include "k007342.h"
+#include "k007420.h"
#include "konamipt.h"
#include "cpu/m6809/hd6309.h"
@@ -21,10 +23,109 @@
#include "machine/gen_latch.h"
#include "machine/watchdog.h"
#include "sound/ymopl.h"
+
#include "screen.h"
#include "speaker.h"
+namespace {
+
+class battlnts_state : public driver_device
+{
+public:
+ battlnts_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
+ m_maincpu(*this, "maincpu"),
+ m_audiocpu(*this, "audiocpu"),
+ m_k007342(*this, "k007342"),
+ m_k007420(*this, "k007420"),
+ m_gfxdecode(*this, "gfxdecode"),
+ m_rombank(*this, "rombank")
+ { }
+
+ void battlnts(machine_config &config);
+
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
+private:
+ // video-related
+ uint16_t m_spritebank = 0;
+
+ // devices
+ required_device<cpu_device> m_maincpu;
+ required_device<cpu_device> m_audiocpu;
+ required_device<k007342_device> m_k007342;
+ required_device<k007420_device> m_k007420;
+ required_device<gfxdecode_device> m_gfxdecode;
+
+ required_memory_bank m_rombank;
+
+ void sh_irqtrigger_w(uint8_t data);
+ void bankswitch_w(uint8_t data);
+ void spritebank_w(uint8_t data);
+ uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ DECLARE_WRITE_LINE_MEMBER(vblank_irq);
+ K007342_CALLBACK_MEMBER(tile_callback);
+ K007420_CALLBACK_MEMBER(sprite_callback);
+
+ void main_map(address_map &map);
+ void sound_map(address_map &map);
+};
+
+
+// video
+
+/***************************************************************************
+
+ Callback for the K007342
+
+***************************************************************************/
+
+K007342_CALLBACK_MEMBER(battlnts_state::tile_callback)
+{
+ *code |= ((*color & 0x0f) << 9) | ((*color & 0x40) << 2);
+ *color = 0;
+}
+
+/***************************************************************************
+
+ Callback for the K007420
+
+***************************************************************************/
+
+K007420_CALLBACK_MEMBER(battlnts_state::sprite_callback)
+{
+ *code |= ((*color & 0xc0) << 2) | m_spritebank;
+ *code = (*code << 2) | ((*color & 0x30) >> 4);
+ *color = 0;
+}
+
+void battlnts_state::spritebank_w(uint8_t data)
+{
+ m_spritebank = 1024 * (data & 1);
+}
+
+/***************************************************************************
+
+ Screen Refresh
+
+***************************************************************************/
+
+uint32_t battlnts_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+{
+ m_k007342->tilemap_update();
+
+ m_k007342->tilemap_draw(screen, bitmap, cliprect, 0, TILEMAP_DRAW_OPAQUE ,0);
+ m_k007420->sprites_draw(bitmap, cliprect, m_gfxdecode->gfx(1));
+ m_k007342->tilemap_draw(screen, bitmap, cliprect, 0, 1 | TILEMAP_DRAW_OPAQUE ,0);
+ return 0;
+}
+
+
+// machine
+
/*************************************
*
* Memory handlers
@@ -37,21 +138,21 @@ WRITE_LINE_MEMBER(battlnts_state::vblank_irq)
m_maincpu->set_input_line(HD6309_IRQ_LINE, HOLD_LINE);
}
-void battlnts_state::battlnts_sh_irqtrigger_w(uint8_t data)
+void battlnts_state::sh_irqtrigger_w(uint8_t data)
{
m_audiocpu->set_input_line_and_vector(0, HOLD_LINE, 0xff); // Z80
}
-void battlnts_state::battlnts_bankswitch_w(uint8_t data)
+void battlnts_state::bankswitch_w(uint8_t data)
{
- /* bits 6 & 7 = bank number */
+ // bits 6 & 7 = bank number
m_rombank->set_entry((data & 0xc0) >> 6);
- /* bits 4 & 5 = coin counters */
+ // bits 4 & 5 = coin counters
machine().bookkeeping().coin_counter_w(0, data & 0x10);
machine().bookkeeping().coin_counter_w(1, data & 0x20);
- /* other bits unknown */
+ // other bits unknown
}
@@ -61,33 +162,33 @@ void battlnts_state::battlnts_bankswitch_w(uint8_t data)
*
*************************************/
-void battlnts_state::battlnts_map(address_map &map)
+void battlnts_state::main_map(address_map &map)
{
- map(0x0000, 0x1fff).rw(m_k007342, FUNC(k007342_device::read), FUNC(k007342_device::write)); /* Color RAM + Video RAM */
- map(0x2000, 0x21ff).rw(m_k007420, FUNC(k007420_device::read), FUNC(k007420_device::write)); /* Sprite RAM */
- map(0x2200, 0x23ff).rw(m_k007342, FUNC(k007342_device::scroll_r), FUNC(k007342_device::scroll_w)); /* Scroll RAM */
- map(0x2400, 0x24ff).ram().w("palette", FUNC(palette_device::write8)).share("palette");/* palette */
- map(0x2600, 0x2607).w(m_k007342, FUNC(k007342_device::vreg_w)); /* Video Registers */
+ map(0x0000, 0x1fff).rw(m_k007342, FUNC(k007342_device::read), FUNC(k007342_device::write)); // Color RAM + Video RAM
+ map(0x2000, 0x21ff).rw(m_k007420, FUNC(k007420_device::read), FUNC(k007420_device::write)); // Sprite RAM
+ map(0x2200, 0x23ff).rw(m_k007342, FUNC(k007342_device::scroll_r), FUNC(k007342_device::scroll_w)); // Scroll RAM
+ map(0x2400, 0x24ff).ram().w("palette", FUNC(palette_device::write8)).share("palette");
+ map(0x2600, 0x2607).w(m_k007342, FUNC(k007342_device::vreg_w));
map(0x2e00, 0x2e00).portr("DSW1");
map(0x2e01, 0x2e01).portr("P2");
map(0x2e02, 0x2e02).portr("P1");
- map(0x2e03, 0x2e03).portr("DSW3"); /* coinsw, testsw, startsw */
+ map(0x2e03, 0x2e03).portr("DSW3"); // coinsw, testsw, startsw
map(0x2e04, 0x2e04).portr("DSW2");
- map(0x2e08, 0x2e08).w(FUNC(battlnts_state::battlnts_bankswitch_w)); /* bankswitch control */
- map(0x2e0c, 0x2e0c).w(FUNC(battlnts_state::battlnts_spritebank_w)); /* sprite bank select */
+ map(0x2e08, 0x2e08).w(FUNC(battlnts_state::bankswitch_w));
+ map(0x2e0c, 0x2e0c).w(FUNC(battlnts_state::spritebank_w));
map(0x2e10, 0x2e10).w("watchdog", FUNC(watchdog_timer_device::reset_w));
- map(0x2e14, 0x2e14).w("soundlatch", FUNC(generic_latch_8_device::write)); /* sound code # */
- map(0x2e18, 0x2e18).w(FUNC(battlnts_state::battlnts_sh_irqtrigger_w)); /* cause interrupt on audio CPU */
- map(0x4000, 0x7fff).bankr("rombank"); /* banked ROM */
- map(0x8000, 0xffff).rom(); /* ROM 777e02.bin */
+ map(0x2e14, 0x2e14).w("soundlatch", FUNC(generic_latch_8_device::write));
+ map(0x2e18, 0x2e18).w(FUNC(battlnts_state::sh_irqtrigger_w)); // cause interrupt on audio CPU
+ map(0x4000, 0x7fff).bankr(m_rombank);
+ map(0x8000, 0xffff).rom(); // ROM 777e02.bin
}
-void battlnts_state::battlnts_sound_map(address_map &map)
+void battlnts_state::sound_map(address_map &map)
{
- map(0x0000, 0x7fff).rom(); /* ROM 777c01.rom */
- map(0x8000, 0x87ff).ram(); /* RAM */
- map(0xa000, 0xa001).rw("ym1", FUNC(ym3812_device::read), FUNC(ym3812_device::write)); /* YM3812 (chip 1) */
- map(0xc000, 0xc001).rw("ym2", FUNC(ym3812_device::read), FUNC(ym3812_device::write)); /* YM3812 (chip 2) */
+ map(0x0000, 0x7fff).rom(); // ROM 777c01.rom
+ map(0x8000, 0x87ff).ram();
+ map(0xa000, 0xa001).rw("ym1", FUNC(ym3812_device::read), FUNC(ym3812_device::write));
+ map(0xc000, 0xc001).rw("ym2", FUNC(ym3812_device::read), FUNC(ym3812_device::write));
map(0xe000, 0xe000).r("soundlatch", FUNC(generic_latch_8_device::read));
}
@@ -100,7 +201,7 @@ void battlnts_state::battlnts_sound_map(address_map &map)
static INPUT_PORTS_START( battlnts )
PORT_START("DSW1")
KONAMI_COINAGE_LOC(DEF_STR( Free_Play ), "No Coin B", SW1)
- /* "No Coin B" = coins produce sound, but no effect on coin counter */
+ // "No Coin B" = coins produce sound, but no effect on coin counter
PORT_START("DSW2")
PORT_DIPNAME( 0x03, 0x02, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW2:1,2")
@@ -184,30 +285,19 @@ INPUT_PORTS_END
static const gfx_layout charlayout =
{
- 8,8, /* 8 x 8 characters */
- 0x40000/32, /* 8192 characters */
- 4, /* 4bpp */
- { 0, 1, 2, 3 }, /* the four bitplanes are packed in one nibble */
+ 8,8, // 8 x 8 characters
+ 0x40000/32, // 8192 characters
+ 4, // 4bpp
+ { 0, 1, 2, 3 }, // the four bitplanes are packed in one nibble
{ 2*4, 3*4, 0*4, 1*4, 6*4, 7*4, 4*4, 5*4 },
{ 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 },
- 32*8 /* every character takes 32 consecutive bytes */
-};
-
-static const gfx_layout spritelayout =
-{
- 8,8, /* 8*8 sprites */
- 0x40000/32, /* 8192 sprites */
- 4, /* 4 bpp */
- { 0, 1, 2, 3 }, /* the four bitplanes are packed in one nibble */
- { 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4},
- { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 },
- 32*8 /* every sprite takes 32 consecutive bytes */
+ 32*8 // every character takes 32 consecutive bytes
};
static GFXDECODE_START( gfx_battlnts )
- GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 1 ) /* colors 0-15 */
- GFXDECODE_ENTRY( "gfx2", 0, spritelayout, 4*16, 1 ) /* colors 64-79 */
+ GFXDECODE_ENTRY( "tiles", 0, charlayout, 0, 1 ) // colors 0-15
+ GFXDECODE_ENTRY( "sprites", 0, gfx_8x8x4_packed_msb , 4*16, 1 ) // colors 64-79
GFXDECODE_END
@@ -219,9 +309,9 @@ GFXDECODE_END
void battlnts_state::machine_start()
{
- uint8_t *ROM = memregion("maincpu")->base();
+ uint8_t *rom = memregion("maincpu")->base();
- m_rombank->configure_entries(0, 4, &ROM[0x10000], 0x4000);
+ m_rombank->configure_entries(0, 4, &rom[0x10000], 0x4000);
save_item(NAME(m_spritebank));
}
@@ -233,22 +323,22 @@ void battlnts_state::machine_reset()
void battlnts_state::battlnts(machine_config &config)
{
- /* basic machine hardware */
- HD6309(config, m_maincpu, XTAL(24'000'000) / 2 /* 3000000*4? */);
- m_maincpu->set_addrmap(AS_PROGRAM, &battlnts_state::battlnts_map);
+ // basic machine hardware
+ HD6309(config, m_maincpu, XTAL(24'000'000) / 2); // 3'000'000 * 4?
+ m_maincpu->set_addrmap(AS_PROGRAM, &battlnts_state::main_map);
- Z80(config, m_audiocpu, XTAL(24'000'000) / 6 /* 3579545? */);
- m_audiocpu->set_addrmap(AS_PROGRAM, &battlnts_state::battlnts_sound_map);
+ Z80(config, m_audiocpu, XTAL(24'000'000) / 6); // 3579545?
+ m_audiocpu->set_addrmap(AS_PROGRAM, &battlnts_state::sound_map);
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(0));
screen.set_size(32*8, 32*8);
screen.set_visarea(0*8, 32*8-1, 2*8, 30*8-1);
- screen.set_screen_update(FUNC(battlnts_state::screen_update_battlnts));
+ screen.set_screen_update(FUNC(battlnts_state::screen_update));
screen.set_palette("palette");
screen.screen_vblank().set(FUNC(battlnts_state::vblank_irq));
@@ -257,15 +347,15 @@ void battlnts_state::battlnts(machine_config &config)
K007342(config, m_k007342, 0);
m_k007342->set_gfxnum(0);
- m_k007342->set_tile_callback(FUNC(battlnts_state::battlnts_tile_callback));
+ m_k007342->set_tile_callback(FUNC(battlnts_state::tile_callback));
m_k007342->set_gfxdecode_tag(m_gfxdecode);
K007420(config, m_k007420, 0);
m_k007420->set_bank_limit(0x3ff);
- m_k007420->set_sprite_callback(FUNC(battlnts_state::battlnts_sprite_callback));
+ m_k007420->set_sprite_callback(FUNC(battlnts_state::sprite_callback));
m_k007420->set_palette_tag("palette");
- /* sound hardware */
+ // sound hardware
SPEAKER(config, "mono").front_center();
GENERIC_LATCH_8(config, "soundlatch");
@@ -283,95 +373,96 @@ void battlnts_state::battlnts(machine_config &config)
*************************************/
ROM_START( battlnts )
- ROM_REGION( 0x20000, "maincpu", 0 ) /* code + banked roms */
- ROM_LOAD( "777_g02.7e", 0x08000, 0x08000, CRC(dbd8e17e) SHA1(586a22b714011c67a915c4a350ceca19ff875635) ) /* fixed ROM */
- ROM_LOAD( "777_g03.8e", 0x10000, 0x10000, CRC(7bd44fef) SHA1(308ec5246f5537b34e368535672ac687f456750a) ) /* banked ROM */
+ ROM_REGION( 0x20000, "maincpu", 0 )
+ ROM_LOAD( "777_g02.7e", 0x08000, 0x08000, CRC(dbd8e17e) SHA1(586a22b714011c67a915c4a350ceca19ff875635) ) // fixed ROM
+ ROM_LOAD( "777_g03.8e", 0x10000, 0x10000, CRC(7bd44fef) SHA1(308ec5246f5537b34e368535672ac687f456750a) ) // banked ROM
- ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for the sound CPU */
+ ROM_REGION( 0x10000, "audiocpu", 0 )
ROM_LOAD( "777_c01.10a", 0x00000, 0x08000, CRC(c21206e9) SHA1(7b133e04be67dc061a186ab0481d848b69b370d7) )
- ROM_REGION( 0x40000, "gfx1", 0 )
- ROM_LOAD( "777c04.13a", 0x00000, 0x40000, CRC(45d92347) SHA1(8537b4ccd0a80ea3260ef82fde177f1d65a49c03) ) /* tiles */
+ ROM_REGION( 0x40000, "tiles", 0 )
+ ROM_LOAD( "777c04.13a", 0x00000, 0x40000, CRC(45d92347) SHA1(8537b4ccd0a80ea3260ef82fde177f1d65a49c03) )
- ROM_REGION( 0x40000, "gfx2", 0 )
- ROM_LOAD( "777c05.13e", 0x00000, 0x40000, CRC(aeee778c) SHA1(fc58ada9c97361d13439b7b0918c947d48402445) ) /* sprites */
+ ROM_REGION( 0x40000, "sprites", 0 )
+ ROM_LOAD( "777c05.13e", 0x00000, 0x40000, CRC(aeee778c) SHA1(fc58ada9c97361d13439b7b0918c947d48402445) )
ROM_END
ROM_START( battlntsa )
- ROM_REGION( 0x20000, "maincpu", 0 ) /* code + banked roms */
- ROM_LOAD( "777_f02.7e", 0x08000, 0x08000, CRC(9f1dc5c1) SHA1(86ae471b276d90bbebb97747b673cd5c31ff9043) ) /* fixed ROM */
- ROM_LOAD( "777_f03.8e", 0x10000, 0x10000, CRC(040d00bf) SHA1(433afd38a80d79d6a95f2ef0b195a92688ace555) ) /* banked ROM */
+ ROM_REGION( 0x20000, "maincpu", 0 )
+ ROM_LOAD( "777_f02.7e", 0x08000, 0x08000, CRC(9f1dc5c1) SHA1(86ae471b276d90bbebb97747b673cd5c31ff9043) ) // fixed ROM
+ ROM_LOAD( "777_f03.8e", 0x10000, 0x10000, CRC(040d00bf) SHA1(433afd38a80d79d6a95f2ef0b195a92688ace555) ) // banked ROM
- ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for the sound CPU */
+ ROM_REGION( 0x10000, "audiocpu", 0 )
ROM_LOAD( "777_c01.10a", 0x00000, 0x08000, CRC(c21206e9) SHA1(7b133e04be67dc061a186ab0481d848b69b370d7) )
- ROM_REGION( 0x40000, "gfx1", 0 )
- ROM_LOAD( "777c04.13a", 0x00000, 0x40000, CRC(45d92347) SHA1(8537b4ccd0a80ea3260ef82fde177f1d65a49c03) ) /* tiles */
+ ROM_REGION( 0x40000, "tiles", 0 )
+ ROM_LOAD( "777c04.13a", 0x00000, 0x40000, CRC(45d92347) SHA1(8537b4ccd0a80ea3260ef82fde177f1d65a49c03) )
- ROM_REGION( 0x40000, "gfx2", 0 )
- ROM_LOAD( "777c05.13e", 0x00000, 0x40000, CRC(aeee778c) SHA1(fc58ada9c97361d13439b7b0918c947d48402445) ) /* sprites */
+ ROM_REGION( 0x40000, "sprites", 0 )
+ ROM_LOAD( "777c05.13e", 0x00000, 0x40000, CRC(aeee778c) SHA1(fc58ada9c97361d13439b7b0918c947d48402445) )
ROM_END
ROM_START( battlntsj )
- ROM_REGION( 0x20000, "maincpu", 0 ) /* code + banked roms */
- ROM_LOAD( "777_e02.7e", 0x08000, 0x08000, CRC(d631cfcb) SHA1(7787da0dd8cd218abc27204e517e04d7a1913a3b) ) /* fixed ROM */
- ROM_LOAD( "777_e03.8e", 0x10000, 0x10000, CRC(5ef1f4ef) SHA1(e3e6e1fc5a65328d94c23e2e76eef3504b70e58b) ) /* banked ROM */
+ ROM_REGION( 0x20000, "maincpu", 0 )
+ ROM_LOAD( "777_e02.7e", 0x08000, 0x08000, CRC(d631cfcb) SHA1(7787da0dd8cd218abc27204e517e04d7a1913a3b) ) // fixed ROM
+ ROM_LOAD( "777_e03.8e", 0x10000, 0x10000, CRC(5ef1f4ef) SHA1(e3e6e1fc5a65328d94c23e2e76eef3504b70e58b) ) // banked ROM
- ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for the sound CPU */
+ ROM_REGION( 0x10000, "audiocpu", 0 )
ROM_LOAD( "777_c01.10a", 0x00000, 0x08000, CRC(c21206e9) SHA1(7b133e04be67dc061a186ab0481d848b69b370d7) )
- ROM_REGION( 0x40000, "gfx1", 0 )
- ROM_LOAD( "777c04.13a", 0x00000, 0x40000, CRC(45d92347) SHA1(8537b4ccd0a80ea3260ef82fde177f1d65a49c03) ) /* tiles */
+ ROM_REGION( 0x40000, "tiles", 0 )
+ ROM_LOAD( "777c04.13a", 0x00000, 0x40000, CRC(45d92347) SHA1(8537b4ccd0a80ea3260ef82fde177f1d65a49c03) )
- ROM_REGION( 0x40000, "gfx2", 0 )
- ROM_LOAD( "777c05.13e", 0x00000, 0x40000, CRC(aeee778c) SHA1(fc58ada9c97361d13439b7b0918c947d48402445) ) /* sprites */
+ ROM_REGION( 0x40000, "sprites", 0 )
+ ROM_LOAD( "777c05.13e", 0x00000, 0x40000, CRC(aeee778c) SHA1(fc58ada9c97361d13439b7b0918c947d48402445) )
ROM_END
ROM_START( rackemup )
- ROM_REGION( 0x20000, "maincpu", 0 ) /* code + banked roms */
- ROM_LOAD( "765_l02.7e", 0x08000, 0x08000, CRC(3dfc48bd) SHA1(9ba98e9f27dd0a6efec145bea2a5ae7df8567437) ) /* fixed ROM */
- ROM_LOAD( "765_j03.8e", 0x10000, 0x10000, CRC(a13fd751) SHA1(27ec66835c85b7ac0221a813d38e9cca0d9be3b8) ) /* banked ROM */
+ ROM_REGION( 0x20000, "maincpu", 0 )
+ ROM_LOAD( "765_l02.7e", 0x08000, 0x08000, CRC(3dfc48bd) SHA1(9ba98e9f27dd0a6efec145bea2a5ae7df8567437) ) // fixed ROM
+ ROM_LOAD( "765_j03.8e", 0x10000, 0x10000, CRC(a13fd751) SHA1(27ec66835c85b7ac0221a813d38e9cca0d9be3b8) ) // banked ROM
- ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for the sound CPU */
+ ROM_REGION( 0x10000, "audiocpu", 0 )
ROM_LOAD( "765_j01.10a", 0x00000, 0x08000, CRC(77ae753e) SHA1(9e463a825d31bb79644b083d24b25670d96441c5) )
- ROM_REGION( 0x40000, "gfx1", 0 )
- ROM_LOAD( "765_l04.13a", 0x00000, 0x40000, CRC(d8fb9c64) SHA1(37dac643aa492ef1ecc29c5030bc7fe5226027a2) ) /* tiles */
+ ROM_REGION( 0x40000, "tiles", 0 )
+ ROM_LOAD( "765_l04.13a", 0x00000, 0x40000, CRC(d8fb9c64) SHA1(37dac643aa492ef1ecc29c5030bc7fe5226027a2) )
- ROM_REGION( 0x40000, "gfx2", 0 )
- ROM_LOAD( "765_l05.13e", 0x00000, 0x40000, CRC(1bb6855f) SHA1(251081564dfede8fa9a422081d58465fe5ca4ed1) ) /* sprites */
+ ROM_REGION( 0x40000, "sprites", 0 )
+ ROM_LOAD( "765_l05.13e", 0x00000, 0x40000, CRC(1bb6855f) SHA1(251081564dfede8fa9a422081d58465fe5ca4ed1) )
ROM_END
ROM_START( thehustl )
- ROM_REGION( 0x20000, "maincpu", 0 ) /* code + banked roms */
- ROM_LOAD( "765_m02.7e", 0x08000, 0x08000, CRC(934807b9) SHA1(84e13a5c1587ee28330f369f9a1180219edbda9d) ) /* fixed ROM */
- ROM_LOAD( "765_j03.8e", 0x10000, 0x10000, CRC(a13fd751) SHA1(27ec66835c85b7ac0221a813d38e9cca0d9be3b8) ) /* banked ROM */
+ ROM_REGION( 0x20000, "maincpu", 0 )
+ ROM_LOAD( "765_m02.7e", 0x08000, 0x08000, CRC(934807b9) SHA1(84e13a5c1587ee28330f369f9a1180219edbda9d) ) // fixed ROM
+ ROM_LOAD( "765_j03.8e", 0x10000, 0x10000, CRC(a13fd751) SHA1(27ec66835c85b7ac0221a813d38e9cca0d9be3b8) ) // banked ROM
- ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for the sound CPU */
+ ROM_REGION( 0x10000, "audiocpu", 0 )
ROM_LOAD( "765_j01.10a", 0x00000, 0x08000, CRC(77ae753e) SHA1(9e463a825d31bb79644b083d24b25670d96441c5) )
- ROM_REGION( 0x40000, "gfx1", 0 )
- ROM_LOAD( "765_e04.13a", 0x00000, 0x40000, CRC(08c2b72e) SHA1(02d9c690da839d6fee75fffdf66a4d3da35a0263) ) /* tiles */
+ ROM_REGION( 0x40000, "tiles", 0 )
+ ROM_LOAD( "765_e04.13a", 0x00000, 0x40000, CRC(08c2b72e) SHA1(02d9c690da839d6fee75fffdf66a4d3da35a0263) )
- ROM_REGION( 0x40000, "gfx2", 0 )
- ROM_LOAD( "765_e05.13e", 0x00000, 0x40000, CRC(ef044655) SHA1(c8272283eab8fc2899979da398819cb72c92a299) ) /* sprites */
+ ROM_REGION( 0x40000, "sprites", 0 )
+ ROM_LOAD( "765_e05.13e", 0x00000, 0x40000, CRC(ef044655) SHA1(c8272283eab8fc2899979da398819cb72c92a299) )
ROM_END
ROM_START( thehustlj )
- ROM_REGION( 0x20000, "maincpu", 0 ) /* code + banked roms */
- ROM_LOAD( "765_j02.7e", 0x08000, 0x08000, CRC(2ac14c75) SHA1(b88f6279ab88719f4207e28486a0022554668382) ) /* fixed ROM */
- ROM_LOAD( "765_j03.8e", 0x10000, 0x10000, CRC(a13fd751) SHA1(27ec66835c85b7ac0221a813d38e9cca0d9be3b8) ) /* banked ROM */
+ ROM_REGION( 0x20000, "maincpu", 0 )
+ ROM_LOAD( "765_j02.7e", 0x08000, 0x08000, CRC(2ac14c75) SHA1(b88f6279ab88719f4207e28486a0022554668382) ) // fixed ROM
+ ROM_LOAD( "765_j03.8e", 0x10000, 0x10000, CRC(a13fd751) SHA1(27ec66835c85b7ac0221a813d38e9cca0d9be3b8) ) // banked ROM
- ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for the sound CPU */
+ ROM_REGION( 0x10000, "audiocpu", 0 )
ROM_LOAD( "765_j01.10a", 0x00000, 0x08000, CRC(77ae753e) SHA1(9e463a825d31bb79644b083d24b25670d96441c5) )
- ROM_REGION( 0x40000, "gfx1", 0 )
- ROM_LOAD( "765_e04.13a", 0x00000, 0x40000, CRC(08c2b72e) SHA1(02d9c690da839d6fee75fffdf66a4d3da35a0263) ) /* tiles */
+ ROM_REGION( 0x40000, "tiles", 0 )
+ ROM_LOAD( "765_e04.13a", 0x00000, 0x40000, CRC(08c2b72e) SHA1(02d9c690da839d6fee75fffdf66a4d3da35a0263) )
- ROM_REGION( 0x40000, "gfx2", 0 )
- ROM_LOAD( "765_e05.13e", 0x00000, 0x40000, CRC(ef044655) SHA1(c8272283eab8fc2899979da398819cb72c92a299) ) /* sprites */
+ ROM_REGION( 0x40000, "sprites", 0 )
+ ROM_LOAD( "765_e05.13e", 0x00000, 0x40000, CRC(ef044655) SHA1(c8272283eab8fc2899979da398819cb72c92a299) )
ROM_END
+} // anonymous namespace
/*************************************
diff --git a/src/mame/konami/battlnts.h b/src/mame/konami/battlnts.h
deleted file mode 100644
index d27509f1aea..00000000000
--- a/src/mame/konami/battlnts.h
+++ /dev/null
@@ -1,54 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Manuel Abadia
-/*************************************************************************
-
- Konami Battlantis Hardware
-
-*************************************************************************/
-#ifndef MAME_INCLUDES_BATTLNTS_H
-#define MAME_INCLUDES_BATTLNTS_H
-
-#pragma once
-
-#include "k007342.h"
-#include "k007420.h"
-
-class battlnts_state : public driver_device
-{
-public:
- battlnts_state(const machine_config &mconfig, device_type type, const char *tag) :
- driver_device(mconfig, type, tag),
- m_maincpu(*this, "maincpu"),
- m_audiocpu(*this, "audiocpu"),
- m_k007342(*this, "k007342"),
- m_k007420(*this, "k007420"),
- m_gfxdecode(*this, "gfxdecode"),
- m_rombank(*this, "rombank")
- { }
-
- /* video-related */
- int m_spritebank = 0;
-
- /* devices */
- required_device<cpu_device> m_maincpu;
- required_device<cpu_device> m_audiocpu;
- required_device<k007342_device> m_k007342;
- required_device<k007420_device> m_k007420;
- required_device<gfxdecode_device> m_gfxdecode;
- required_memory_bank m_rombank;
-
- void battlnts_sh_irqtrigger_w(uint8_t data);
- void battlnts_bankswitch_w(uint8_t data);
- void battlnts_spritebank_w(uint8_t data);
- virtual void machine_start() override;
- virtual void machine_reset() override;
- uint32_t screen_update_battlnts(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- DECLARE_WRITE_LINE_MEMBER(vblank_irq);
- K007342_CALLBACK_MEMBER(battlnts_tile_callback);
- K007420_CALLBACK_MEMBER(battlnts_sprite_callback);
- void battlnts(machine_config &config);
- void battlnts_map(address_map &map);
- void battlnts_sound_map(address_map &map);
-};
-
-#endif // MAME_INCLUDES_BATTLNTS_H
diff --git a/src/mame/konami/battlnts_v.cpp b/src/mame/konami/battlnts_v.cpp
deleted file mode 100644
index a362c9d05c3..00000000000
--- a/src/mame/konami/battlnts_v.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Manuel Abadia
-#include "emu.h"
-#include "battlnts.h"
-
-/***************************************************************************
-
- Callback for the K007342
-
-***************************************************************************/
-
-K007342_CALLBACK_MEMBER(battlnts_state::battlnts_tile_callback)
-{
- *code |= ((*color & 0x0f) << 9) | ((*color & 0x40) << 2);
- *color = 0;
-}
-
-/***************************************************************************
-
- Callback for the K007420
-
-***************************************************************************/
-
-K007420_CALLBACK_MEMBER(battlnts_state::battlnts_sprite_callback)
-{
- *code |= ((*color & 0xc0) << 2) | m_spritebank;
- *code = (*code << 2) | ((*color & 0x30) >> 4);
- *color = 0;
-}
-
-void battlnts_state::battlnts_spritebank_w(uint8_t data)
-{
- m_spritebank = 1024 * (data & 1);
-}
-
-/***************************************************************************
-
- Screen Refresh
-
-***************************************************************************/
-
-uint32_t battlnts_state::screen_update_battlnts(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
-{
- m_k007342->tilemap_update();
-
- m_k007342->tilemap_draw(screen, bitmap, cliprect, 0, TILEMAP_DRAW_OPAQUE ,0);
- m_k007420->sprites_draw(bitmap, cliprect, m_gfxdecode->gfx(1));
- m_k007342->tilemap_draw(screen, bitmap, cliprect, 0, 1 | TILEMAP_DRAW_OPAQUE ,0);
- return 0;
-}
diff --git a/src/mame/konami/finalizr.cpp b/src/mame/konami/finalizr.cpp
index 17ec21cb9b6..6d82adc6fc9 100644
--- a/src/mame/konami/finalizr.cpp
+++ b/src/mame/konami/finalizr.cpp
@@ -1,5 +1,6 @@
// license:BSD-3-Clause
-// copyright-holders:Nicola Salmoria
+// copyright-holders: Nicola Salmoria
+
/***************************************************************************
Finalizer (GX523) (c) 1985 Konami
@@ -13,23 +14,314 @@ TODO:
***************************************************************************/
#include "emu.h"
-#include "finalizr.h"
+
+#include "konami1.h"
#include "konamipt.h"
#include "cpu/m6809/m6809.h"
+#include "cpu/mcs48/mcs48.h"
#include "machine/gen_latch.h"
-#include "konami1.h"
+#include "machine/timer.h"
#include "machine/watchdog.h"
#include "sound/dac.h"
#include "sound/sn76496.h"
+#include "video/resnet.h"
+#include "emupal.h"
#include "screen.h"
#include "speaker.h"
+#include "tilemap.h"
+
+
+namespace {
+
+class finalizr_state : public driver_device
+{
+public:
+ finalizr_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
+ m_maincpu(*this, "maincpu"),
+ m_audiocpu(*this, "audiocpu"),
+ m_gfxdecode(*this, "gfxdecode"),
+ m_palette(*this, "palette"),
+ m_scroll(*this, "scroll"),
+ m_colorram(*this, "colorram%u", 1U),
+ m_videoram(*this, "videoram%u", 1U),
+ m_spriteram(*this, "spriteram%u", 1U)
+ { }
+
+ void finalizr(machine_config &config);
+ void finalizrb(machine_config &config);
+
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+ virtual void video_start() override;
+
+private:
+ // devices
+ required_device<cpu_device> m_maincpu;
+ required_device<mcs48_cpu_device> m_audiocpu;
+ required_device<gfxdecode_device> m_gfxdecode;
+ required_device<palette_device> m_palette;
+
+ // memory pointers
+ required_shared_ptr<uint8_t> m_scroll;
+ required_shared_ptr_array<uint8_t, 2> m_colorram;
+ required_shared_ptr_array<uint8_t, 2> m_videoram;
+ required_shared_ptr_array<uint8_t, 2> m_spriteram;
+
+ // video-related
+ tilemap_t *m_fg_tilemap = nullptr;
+ tilemap_t *m_bg_tilemap = nullptr;
+ uint8_t m_spriterambank = 0U;
+ uint8_t m_charbank = 0U;
+
+ // misc
+ uint8_t m_nmi_enable = 0U;
+ uint8_t m_irq_enable = 0U;
+
+ void coin_w(uint8_t data);
+ void flipscreen_w(uint8_t data);
+ void sound_irq_w(uint8_t data);
+ void sound_irqen_w(uint8_t data);
+ DECLARE_READ_LINE_MEMBER(bootleg_t1_r);
+ void videoctrl_w(uint8_t data);
+ TILE_GET_INFO_MEMBER(get_bg_tile_info);
+ TILE_GET_INFO_MEMBER(get_fg_tile_info);
+ void palette(palette_device &palette) const;
+ void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
+ uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ TIMER_DEVICE_CALLBACK_MEMBER(scanline);
+ void main_map(address_map &map);
+ void sound_io_map(address_map &map);
+};
+
+
+// video
+
+
+/***************************************************************************
+
+ The palette PROMs are connected to the RGB output this way:
+
+ bit 7 -- 220 ohm resistor -- \
+ -- 470 ohm resistor -- | -- 470 ohm pulldown resistor -- GREEN
+ -- 1 kohm resistor -- |
+ -- 2.2 kohm resistor -- /
+ -- 220 ohm resistor -- \
+ -- 470 ohm resistor -- | -- 470 ohm pulldown resistor -- RED
+ -- 1 kohm resistor -- |
+ bit 0 -- 2.2 kohm resistor -- /
+
+
+ bit 3 -- 220 ohm resistor -- \
+ -- 470 ohm resistor -- | -- 470 ohm pulldown resistor -- BLUE
+ -- 1 kohm resistor -- |
+ bit 0 -- 2.2 kohm resistor -- /
+
+***************************************************************************/
+
+void finalizr_state::palette(palette_device &palette) const
+{
+ const uint8_t *color_prom = memregion("proms")->base();
+ static constexpr int resistances[4] = { 2200, 1000, 470, 220 };
+
+ // compute the color output resistor weights
+ double rweights[4], gweights[4], bweights[4];
+ compute_resistor_weights(0, 255, -1.0,
+ 4, &resistances[0], rweights, 470, 0,
+ 4, &resistances[0], gweights, 470, 0,
+ 4, &resistances[0], bweights, 470, 0);
+
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x20; i++)
+ {
+ int bit0, bit1, bit2, bit3;
+
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ bit3 = BIT(color_prom[i], 3);
+ int const r = combine_weights(rweights, bit0, bit1, bit2, bit3);
+
+ // green component
+ bit0 = BIT(color_prom[i], 4);
+ bit1 = BIT(color_prom[i], 5);
+ bit2 = BIT(color_prom[i], 6);
+ bit3 = BIT(color_prom[i], 7);
+ int const g = combine_weights(gweights, bit0, bit1, bit2, bit3);
+
+ // blue component
+ bit0 = BIT(color_prom[i + 0x20], 0);
+ bit1 = BIT(color_prom[i + 0x20], 1);
+ bit2 = BIT(color_prom[i + 0x20], 2);
+ bit3 = BIT(color_prom[i + 0x20], 3);
+ int const b = combine_weights(bweights, bit0, bit1, bit2, bit3);
+
+ palette.set_indirect_color(i, rgb_t(r, g, b));
+ }
+
+ // color_prom now points to the beginning of the lookup table
+ color_prom += 0x40;
+
+ for (int i = 0; i < 0x100; i++)
+ {
+ uint8_t const ctabentry = (color_prom[i] & 0x0f) | 0x10;
+ palette.set_pen_indirect(i, ctabentry);
+ }
+
+ for (int i = 0x100; i < 0x200; i++)
+ {
+ uint8_t const ctabentry = color_prom[i] & 0x0f;
+ palette.set_pen_indirect(i, ctabentry);
+ }
+}
+
+TILE_GET_INFO_MEMBER(finalizr_state::get_bg_tile_info)
+{
+ int const attr = m_colorram[0][tile_index];
+ int const code = m_videoram[0][tile_index] + ((attr & 0xc0) << 2) + (m_charbank << 10);
+ int const color = attr & 0x0f;
+ int const flags = TILE_FLIPYX((attr & 0x30) >> 4);
+
+ tileinfo.set(0, code, color, flags);
+}
+
+TILE_GET_INFO_MEMBER(finalizr_state::get_fg_tile_info)
+{
+ int const attr = m_colorram[1][tile_index];
+ int const code = m_videoram[1][tile_index] + ((attr & 0xc0) << 2);
+ int const color = attr & 0x0f;
+ int const flags = TILE_FLIPYX((attr & 0x30) >> 4);
+
+ tileinfo.set(0, code, color, flags);
+}
+
+void finalizr_state::video_start()
+{
+ m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(finalizr_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
+ m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(finalizr_state::get_fg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
+}
+
+/**************************************************************************/
+
+void finalizr_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
+{
+ gfx_element *gfx1 = m_gfxdecode->gfx(1);
+ gfx_element *gfx2 = m_gfxdecode->gfx(2);
+
+ uint8_t const *sr = m_spriterambank ? m_spriteram[1] : m_spriteram[0];
+
+ for (int offs = 0; offs <= m_spriteram[0].bytes() - 5; offs += 5)
+ {
+ int sx = 32 + 1 + sr[offs + 3] - ((sr[offs + 4] & 0x01) << 8);
+ int sy = sr[offs + 2];
+ int flipx = sr[offs + 4] & 0x20;
+ int flipy = sr[offs + 4] & 0x40;
+ int code = sr[offs] + ((sr[offs + 1] & 0x0f) << 8);
+ int const color = ((sr[offs + 1] & 0xf0) >> 4);
+
+// (sr[offs + 4] & 0x02) is used, meaning unknown
+
+ int const size = sr[offs + 4] & 0x1c;
+
+ if (size >= 0x10)
+ {
+ // 32x32
+ if (flip_screen())
+ {
+ sx = 256 - sx;
+ sy = 224 - sy;
+ flipx = !flipx;
+ flipy = !flipy;
+ }
+
+ gfx1->transpen(bitmap, cliprect, code + 0, color, flipx, flipy, flipx ? sx + 16 : sx, flipy ? sy + 16 : sy, 0);
+ gfx1->transpen(bitmap, cliprect, code + 1, color, flipx, flipy, flipx ? sx : sx + 16, flipy ? sy + 16 : sy, 0);
+ gfx1->transpen(bitmap, cliprect, code + 2, color, flipx, flipy, flipx ? sx + 16: sx , flipy ? sy : sy + 16, 0);
+ gfx1->transpen(bitmap, cliprect, code + 3, color, flipx, flipy, flipx ? sx : sx + 16, flipy ? sy : sy + 16, 0);
+ }
+ else
+ {
+ if (flip_screen())
+ {
+ sx = ((size & 0x08) ? 280: 272) - sx;
+ sy = ((size & 0x04) ? 248: 240) - sy;
+ flipx = !flipx;
+ flipy = !flipy;
+ }
+
+ if (size == 0x00)
+ {
+ // 16x16
+ gfx1->transpen(bitmap, cliprect, code, color, flipx, flipy, sx, sy, 0);
+ }
+ else
+ {
+ code = ((code & 0x3ff) << 2) | ((code & 0xc00) >> 10);
+
+ if (size == 0x04)
+ {
+ // 16x8
+ gfx2->transpen(bitmap, cliprect, code &~1, color, flipx, flipy, flipx ? sx + 8 : sx, sy, 0);
+ gfx2->transpen(bitmap, cliprect, code | 1, color, flipx, flipy, flipx ? sx : sx + 8, sy, 0);
+ }
+ else if (size == 0x08)
+ {
+ // 8x16
+ gfx2->transpen(bitmap, cliprect, code &~2, color, flipx, flipy, sx, flipy ? sy + 8 : sy, 0);
+ gfx2->transpen(bitmap, cliprect, code | 2, color, flipx, flipy, sx, flipy ? sy : sy + 8, 0);
+ }
+ else if (size == 0x0c)
+ {
+ // 8x8
+ gfx2->transpen(bitmap, cliprect, code, color, flipx, flipy, sx, sy, 0);
+ }
+ }
+ }
+ }
+}
+
+
+uint32_t finalizr_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+{
+ m_bg_tilemap->mark_all_dirty();
+ m_fg_tilemap->mark_all_dirty();
+
+ m_bg_tilemap->set_scrollx(0, *m_scroll - 32);
+ m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
+
+ draw_sprites(bitmap, cliprect);
+
+ // draw top status region
+ const rectangle &visarea = screen.visible_area();
+ rectangle clip = cliprect;
+
+ if (flip_screen())
+ {
+ clip.min_x = visarea.max_x - 31;
+ clip.max_x = visarea.max_x;
+ }
+ else
+ {
+ clip.min_x = visarea.min_x;
+ clip.max_x = visarea.min_x + 31;
+ }
+
+ m_fg_tilemap->draw(screen, bitmap, clip, 0, 0);
+
+ return 0;
+}
+
+// machine
+
TIMER_DEVICE_CALLBACK_MEMBER(finalizr_state::scanline)
{
- int scanline = param;
+ int const scanline = param;
if (scanline == 240 && m_irq_enable) // vblank irq
m_maincpu->set_input_line(M6809_IRQ_LINE, HOLD_LINE);
@@ -192,23 +484,10 @@ INPUT_PORTS_END
-static const gfx_layout spritelayout =
-{
- 16,16,
- RGN_FRAC(1,1),
- 4,
- { 0, 1, 2, 3 },
- { 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4,
- 32*8+0*4, 32*8+1*4, 32*8+2*4, 32*8+3*4, 32*8+4*4, 32*8+5*4, 32*8+6*4, 32*8+7*4 },
- { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32,
- 16*32, 17*32, 18*32, 19*32, 20*32, 21*32, 22*32, 23*32 },
- 32*32
-};
-
static GFXDECODE_START( gfx_finalizr )
- GFXDECODE_ENTRY( "gfx1", 0, gfx_8x8x4_packed_msb, 0, 16 )
- GFXDECODE_ENTRY( "gfx1", 0, spritelayout, 16*16, 16 )
- GFXDECODE_ENTRY( "gfx1", 0, gfx_8x8x4_packed_msb, 16*16, 16 ) // to handle 8x8 sprites
+ GFXDECODE_ENTRY( "gfx1", 0, gfx_8x8x4_packed_msb, 0, 16 )
+ GFXDECODE_ENTRY( "gfx1", 0, gfx_8x8x4_row_2x2_group_packed_msb, 16*16, 16 )
+ GFXDECODE_ENTRY( "gfx1", 0, gfx_8x8x4_packed_msb, 16*16, 16 ) // to handle 8x8 sprites
GFXDECODE_END
@@ -357,6 +636,8 @@ ROM_START( finalizrb )
ROM_LOAD( "523h12.10f", 0x0140, 0x0100, CRC(53166a2a) SHA1(6cdde206036df7176679711f7888d72acee27c8f) ) // sprites
ROM_END
+} // anonymous namespace
+
// YEAR NAME PARENT MACHINE INPUT CLASS INIT ROT COMPANY FULLNAME FLAGS
GAME( 1985, finalizr, 0, finalizr, finalizr, finalizr_state, empty_init, ROT90, "Konami", "Finalizer - Super Transformation (set 1)", MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/konami/finalizr.h b/src/mame/konami/finalizr.h
deleted file mode 100644
index 7980b4630fc..00000000000
--- a/src/mame/konami/finalizr.h
+++ /dev/null
@@ -1,82 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Nicola Salmoria
-/***************************************************************************
-
- Konami Finalizer
-
-***************************************************************************/
-
-#ifndef MAME_INCLUDES_FINALIZR_H
-#define MAME_INCLUDES_FINALIZR_H
-
-#pragma once
-
-#include "cpu/mcs48/mcs48.h"
-#include "machine/timer.h"
-
-#include "emupal.h"
-#include "tilemap.h"
-
-class finalizr_state : public driver_device
-{
-public:
- finalizr_state(const machine_config &mconfig, device_type type, const char *tag) :
- driver_device(mconfig, type, tag),
- m_maincpu(*this, "maincpu"),
- m_audiocpu(*this, "audiocpu"),
- m_gfxdecode(*this, "gfxdecode"),
- m_palette(*this, "palette"),
- m_scroll(*this, "scroll"),
- m_colorram(*this, "colorram%u", 1U),
- m_videoram(*this, "videoram%u", 1U),
- m_spriteram(*this, "spriteram%u", 1U)
- { }
-
- void finalizr(machine_config &config);
- void finalizrb(machine_config &config);
-
-protected:
- virtual void machine_start() override;
- virtual void machine_reset() override;
- virtual void video_start() override;
-
-private:
- // devices
- required_device<cpu_device> m_maincpu;
- required_device<mcs48_cpu_device> m_audiocpu;
- required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
-
- // memory pointers
- required_shared_ptr<uint8_t> m_scroll;
- required_shared_ptr_array<uint8_t, 2> m_colorram;
- required_shared_ptr_array<uint8_t, 2> m_videoram;
- required_shared_ptr_array<uint8_t, 2> m_spriteram;
-
- // video-related
- tilemap_t *m_fg_tilemap = nullptr;
- tilemap_t *m_bg_tilemap = nullptr;
- uint8_t m_spriterambank = 0U;
- uint8_t m_charbank = 0U;
-
- // misc
- uint8_t m_nmi_enable = 0U;
- uint8_t m_irq_enable = 0U;
-
- void coin_w(uint8_t data);
- void flipscreen_w(uint8_t data);
- void sound_irq_w(uint8_t data);
- void sound_irqen_w(uint8_t data);
- DECLARE_READ_LINE_MEMBER(bootleg_t1_r);
- void videoctrl_w(uint8_t data);
- TILE_GET_INFO_MEMBER(get_bg_tile_info);
- TILE_GET_INFO_MEMBER(get_fg_tile_info);
- void palette(palette_device &palette) const;
- void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
- uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- TIMER_DEVICE_CALLBACK_MEMBER(scanline);
- void main_map(address_map &map);
- void sound_io_map(address_map &map);
-};
-
-#endif // MAME_INCLUDES_FINALIZR_H
diff --git a/src/mame/konami/finalizr_v.cpp b/src/mame/konami/finalizr_v.cpp
deleted file mode 100644
index 2927703b487..00000000000
--- a/src/mame/konami/finalizr_v.cpp
+++ /dev/null
@@ -1,231 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Nicola Salmoria
-/***************************************************************************
-
- Konami Finalizer
-
- Functions to emulate the video hardware of the machine.
-
-***************************************************************************/
-
-#include "emu.h"
-#include "finalizr.h"
-#include "video/resnet.h"
-#include "screen.h"
-
-
-/***************************************************************************
-
- The palette PROMs are connected to the RGB output this way:
-
- bit 7 -- 220 ohm resistor -- \
- -- 470 ohm resistor -- | -- 470 ohm pulldown resistor -- GREEN
- -- 1 kohm resistor -- |
- -- 2.2 kohm resistor -- /
- -- 220 ohm resistor -- \
- -- 470 ohm resistor -- | -- 470 ohm pulldown resistor -- RED
- -- 1 kohm resistor -- |
- bit 0 -- 2.2 kohm resistor -- /
-
-
- bit 3 -- 220 ohm resistor -- \
- -- 470 ohm resistor -- | -- 470 ohm pulldown resistor -- BLUE
- -- 1 kohm resistor -- |
- bit 0 -- 2.2 kohm resistor -- /
-
-***************************************************************************/
-
-void finalizr_state::palette(palette_device &palette) const
-{
- const uint8_t *color_prom = memregion("proms")->base();
- static constexpr int resistances[4] = { 2200, 1000, 470, 220 };
-
- // compute the color output resistor weights
- double rweights[4], gweights[4], bweights[4];
- compute_resistor_weights(0, 255, -1.0,
- 4, &resistances[0], rweights, 470, 0,
- 4, &resistances[0], gweights, 470, 0,
- 4, &resistances[0], bweights, 470, 0);
-
- // create a lookup table for the palette
- for (int i = 0; i < 0x20; i++)
- {
- int bit0, bit1, bit2, bit3;
-
- // red component
- bit0 = BIT(color_prom[i], 0);
- bit1 = BIT(color_prom[i], 1);
- bit2 = BIT(color_prom[i], 2);
- bit3 = BIT(color_prom[i], 3);
- int const r = combine_weights(rweights, bit0, bit1, bit2, bit3);
-
- // green component
- bit0 = BIT(color_prom[i], 4);
- bit1 = BIT(color_prom[i], 5);
- bit2 = BIT(color_prom[i], 6);
- bit3 = BIT(color_prom[i], 7);
- int const g = combine_weights(gweights, bit0, bit1, bit2, bit3);
-
- // blue component
- bit0 = BIT(color_prom[i + 0x20], 0);
- bit1 = BIT(color_prom[i + 0x20], 1);
- bit2 = BIT(color_prom[i + 0x20], 2);
- bit3 = BIT(color_prom[i + 0x20], 3);
- int const b = combine_weights(bweights, bit0, bit1, bit2, bit3);
-
- palette.set_indirect_color(i, rgb_t(r, g, b));
- }
-
- // color_prom now points to the beginning of the lookup table
- color_prom += 0x40;
-
- for (int i = 0; i < 0x100; i++)
- {
- uint8_t const ctabentry = (color_prom[i] & 0x0f) | 0x10;
- palette.set_pen_indirect(i, ctabentry);
- }
-
- for (int i = 0x100; i < 0x200; i++)
- {
- uint8_t const ctabentry = color_prom[i] & 0x0f;
- palette.set_pen_indirect(i, ctabentry);
- }
-}
-
-TILE_GET_INFO_MEMBER(finalizr_state::get_bg_tile_info)
-{
- int attr = m_colorram[0][tile_index];
- int code = m_videoram[0][tile_index] + ((attr & 0xc0) << 2) + (m_charbank << 10);
- int color = attr & 0x0f;
- int flags = TILE_FLIPYX((attr & 0x30) >> 4);
-
- tileinfo.set(0, code, color, flags);
-}
-
-TILE_GET_INFO_MEMBER(finalizr_state::get_fg_tile_info)
-{
- int attr = m_colorram[1][tile_index];
- int code = m_videoram[1][tile_index] + ((attr & 0xc0) << 2);
- int color = attr & 0x0f;
- int flags = TILE_FLIPYX((attr & 0x30) >> 4);
-
- tileinfo.set(0, code, color, flags);
-}
-
-void finalizr_state::video_start()
-{
- m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(finalizr_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
- m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(finalizr_state::get_fg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
-}
-
-
-
-/**************************************************************************/
-
-void finalizr_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
-{
- gfx_element *gfx1 = m_gfxdecode->gfx(1);
- gfx_element *gfx2 = m_gfxdecode->gfx(2);
-
- uint8_t *sr = m_spriterambank ? m_spriteram[1] : m_spriteram[0];
-
- for (int offs = 0; offs <= m_spriteram[0].bytes() - 5; offs += 5)
- {
- int sx = 32 + 1 + sr[offs + 3] - ((sr[offs + 4] & 0x01) << 8);
- int sy = sr[offs + 2];
- int flipx = sr[offs + 4] & 0x20;
- int flipy = sr[offs + 4] & 0x40;
- int code = sr[offs] + ((sr[offs + 1] & 0x0f) << 8);
- int color = ((sr[offs + 1] & 0xf0) >> 4);
-
-// (sr[offs + 4] & 0x02) is used, meaning unknown
-
- int size = sr[offs + 4] & 0x1c;
-
- if (size >= 0x10)
- {
- // 32x32
- if (flip_screen())
- {
- sx = 256 - sx;
- sy = 224 - sy;
- flipx = !flipx;
- flipy = !flipy;
- }
-
- gfx1->transpen(bitmap, cliprect, code + 0, color, flipx, flipy, flipx ? sx + 16 : sx, flipy ? sy + 16 : sy, 0);
- gfx1->transpen(bitmap, cliprect, code + 1, color, flipx, flipy, flipx ? sx : sx + 16, flipy ? sy + 16 : sy, 0);
- gfx1->transpen(bitmap, cliprect, code + 2, color, flipx, flipy, flipx ? sx + 16: sx , flipy ? sy : sy + 16, 0);
- gfx1->transpen(bitmap, cliprect, code + 3, color, flipx, flipy, flipx ? sx : sx + 16, flipy ? sy : sy + 16, 0);
- }
- else
- {
- if (flip_screen())
- {
- sx = ((size & 0x08) ? 280: 272) - sx;
- sy = ((size & 0x04) ? 248: 240) - sy;
- flipx = !flipx;
- flipy = !flipy;
- }
-
- if (size == 0x00)
- {
- // 16x16
- gfx1->transpen(bitmap, cliprect, code, color, flipx, flipy, sx, sy, 0);
- }
- else
- {
- code = ((code & 0x3ff) << 2) | ((code & 0xc00) >> 10);
-
- if (size == 0x04)
- {
- // 16x8
- gfx2->transpen(bitmap, cliprect, code &~1, color, flipx, flipy, flipx ? sx + 8 : sx, sy, 0);
- gfx2->transpen(bitmap, cliprect, code | 1, color, flipx, flipy, flipx ? sx : sx + 8, sy, 0);
- }
- else if (size == 0x08)
- {
- // 8x16
- gfx2->transpen(bitmap, cliprect, code &~2, color, flipx, flipy, sx, flipy ? sy + 8 : sy, 0);
- gfx2->transpen(bitmap, cliprect, code | 2, color, flipx, flipy, sx, flipy ? sy : sy + 8, 0);
- }
- else if (size == 0x0c)
- {
- // 8x8
- gfx2->transpen(bitmap, cliprect, code, color, flipx, flipy, sx, sy, 0);
- }
- }
- }
- }
-}
-
-
-uint32_t finalizr_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
-{
- m_bg_tilemap->mark_all_dirty();
- m_fg_tilemap->mark_all_dirty();
-
- m_bg_tilemap->set_scrollx(0, *m_scroll - 32);
- m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
-
- draw_sprites(bitmap, cliprect);
-
- // draw top status region
- const rectangle &visarea = screen.visible_area();
- rectangle clip = cliprect;
-
- if (flip_screen())
- {
- clip.min_x = visarea.max_x - 31;
- clip.max_x = visarea.max_x;
- }
- else
- {
- clip.min_x = visarea.min_x;
- clip.max_x = visarea.min_x + 31;
- }
-
- m_fg_tilemap->draw(screen, bitmap, clip, 0, 0);
-
- return 0;
-}
diff --git a/src/mame/konami/gberet.cpp b/src/mame/konami/gberet.cpp
index b152ec06cb1..86628a67411 100644
--- a/src/mame/konami/gberet.cpp
+++ b/src/mame/konami/gberet.cpp
@@ -1,5 +1,6 @@
// license:BSD-3-Clause
-// copyright-holders:Nicola Salmoria
+// copyright-holders: Nicola Salmoria
+
/***************************************************************************
Green Beret
@@ -9,10 +10,10 @@
correct ROM naming information by Belgium Dump Team (17/06/2003)
Games supported:
- * Green Beret
- * Rush'n Attack (US)
+ * Green Beret (GX577)
+ * Rush'n Attack (US) (GX577)
* Green Beret (bootleg)
- * Mr. Goemon (Japan)
+ * Mr. Goemon (Japan) (GX621)
gberetb is a bootleg hacked to run on different hardware.
@@ -186,16 +187,345 @@ TBP24S10.A12 - 256x4-bit bipolar PROM (possibly also a color PROM)
***************************************************************************/
#include "emu.h"
-#include "gberet.h"
+
#include "konamipt.h"
#include "cpu/z80/z80.h"
+#include "machine/timer.h"
#include "machine/watchdog.h"
#include "sound/sn76496.h"
+#include "emupal.h"
#include "screen.h"
#include "speaker.h"
+#include "tilemap.h"
+
+
+namespace {
+
+class gberet_base_state : public driver_device
+{
+public:
+ gberet_base_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
+ m_colorram(*this, "colorram"),
+ m_videoram(*this, "videoram"),
+ m_spriteram(*this, "spriteram"),
+ m_maincpu(*this, "maincpu"),
+ m_gfxdecode(*this, "gfxdecode"),
+ m_palette(*this, "palette"),
+ m_sn(*this, "snsnd")
+ { }
+
+protected:
+ virtual void video_start() override;
+
+ // memory pointers
+ required_shared_ptr<uint8_t> m_colorram;
+ required_shared_ptr<uint8_t> m_videoram;
+ required_shared_ptr<uint8_t> m_spriteram;
+
+ // devices
+ required_device<cpu_device> m_maincpu;
+ required_device<gfxdecode_device> m_gfxdecode;
+ required_device<palette_device> m_palette;
+ required_device<sn76489a_device> m_sn;
+
+ // video-related
+ tilemap_t * m_bg_tilemap = nullptr;
+
+ // misc
+ void videoram_w(offs_t offset, uint8_t data);
+ void colorram_w(offs_t offset, uint8_t data);
+ TILE_GET_INFO_MEMBER(get_bg_tile_info);
+ void palette(palette_device &palette) const; // TODO: move down in gberet_state once the bootleg PROMs decoding is done
+};
+
+class gberet_state : public gberet_base_state
+{
+public:
+ gberet_state(const machine_config &mconfig, device_type type, const char *tag) :
+ gberet_base_state(mconfig, type, tag),
+ m_spriteram2(*this, "spriteram2"),
+ m_scrollram(*this, "scrollram"),
+ m_soundlatch(*this, "soundlatch")
+ { }
+
+ void gberet(machine_config &config);
+
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
+ void prg_map(address_map &map);
+
+private:
+ // memory pointers
+ required_shared_ptr<uint8_t> m_spriteram2;
+ required_shared_ptr<uint8_t> m_scrollram;
+ required_shared_ptr<uint8_t> m_soundlatch;
+
+ // video-related
+ uint8_t m_spritebank = 0U;
+
+ // misc
+ uint8_t m_interrupt_mask = 0U;
+ uint8_t m_interrupt_ticks = 0U;
+ void coin_counter_w(uint8_t data);
+ void flipscreen_w(uint8_t data);
+ void sound_w(uint8_t data);
+ void scroll_w(offs_t offset, uint8_t data);
+ void sprite_bank_w(uint8_t data);
+ uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ TIMER_DEVICE_CALLBACK_MEMBER(interrupt_tick);
+ void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
+};
+
+class mrgoemon_state : public gberet_state
+{
+public:
+ mrgoemon_state(const machine_config &mconfig, device_type type, const char *tag) :
+ gberet_state(mconfig, type, tag),
+ m_mainbank(*this, "mainbank")
+ { }
+ void mrgoemon(machine_config &config);
+
+protected:
+ virtual void machine_start() override;
+
+private:
+ // memory pointers
+ required_memory_bank m_mainbank;
+
+ void coin_counter_w(uint8_t data);
+ void prg_map(address_map &map);
+};
+
+class gberetb_state : public gberet_base_state
+{
+public:
+ gberetb_state(const machine_config &mconfig, device_type type, const char *tag) :
+ gberet_base_state(mconfig, type, tag)
+ { }
+
+ void gberetb(machine_config &config);
+
+private:
+ void flipscreen_w(uint8_t data);
+ uint8_t irq_ack_r();
+ void nmi_ack_w(uint8_t data);
+ void scroll_w(offs_t offset, uint8_t data);
+ uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
+ void prg_map(address_map &map);
+};
+
+
+// video
+
+/***************************************************************************
+
+ Convert the color PROMs into a more useable format.
+
+ Green Beret has a 32 bytes palette PROM and two 256 bytes color lookup table
+ PROMs (one for sprites, one for characters).
+ The palette PROM is connected to the RGB output, this way:
+
+ bit 7 -- 220 ohm resistor -- BLUE
+ -- 470 ohm resistor -- BLUE
+ -- 220 ohm resistor -- GREEN
+ -- 470 ohm resistor -- GREEN
+ -- 1 kohm resistor -- GREEN
+ -- 220 ohm resistor -- RED
+ -- 470 ohm resistor -- RED
+ bit 0 -- 1 kohm resistor -- RED
+
+***************************************************************************/
+
+void gberet_base_state::palette(palette_device &palette) const
+{
+ uint8_t const *color_prom = memregion("proms")->base();
+
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x20; i++)
+ {
+ // red component
+ 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
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ // blue component
+ bit0 = 0;
+ bit1 = BIT(color_prom[i], 6);
+ bit2 = BIT(color_prom[i], 7);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ palette.set_indirect_color(i, rgb_t(r, g, b));
+ }
+
+ // color_prom now points to the beginning of the lookup table
+ color_prom += 0x20;
+
+ for (int i = 0; i < 0x100; i++)
+ {
+ uint8_t const ctabentry = (color_prom[i] & 0x0f) | 0x10;
+ palette.set_pen_indirect(i, ctabentry);
+ }
+
+ for (int i = 0x100; i < 0x200; i++)
+ {
+ uint8_t const ctabentry = color_prom[i] & 0x0f;
+ palette.set_pen_indirect(i, ctabentry);
+ }
+}
+
+void gberet_base_state::videoram_w(offs_t offset, uint8_t data)
+{
+ m_videoram[offset] = data;
+ m_bg_tilemap->mark_tile_dirty(offset);
+}
+
+void gberet_base_state::colorram_w(offs_t offset, uint8_t data)
+{
+ m_colorram[offset] = data;
+ m_bg_tilemap->mark_tile_dirty(offset);
+}
+
+void gberet_state::scroll_w(offs_t offset, uint8_t data)
+{
+ m_scrollram[offset] = data;
+
+ int const scroll = m_scrollram[offset & 0x1f] | (m_scrollram[offset | 0x20] << 8);
+ m_bg_tilemap->set_scrollx(offset & 0x1f, scroll);
+}
+
+void gberet_state::sprite_bank_w(uint8_t data)
+{
+ m_spritebank = data;
+}
+
+TILE_GET_INFO_MEMBER(gberet_base_state::get_bg_tile_info)
+{
+ int const attr = m_colorram[tile_index];
+ int const code = m_videoram[tile_index] + ((attr & 0x40) << 2);
+ int const color = attr & 0x0f;
+ int const flags = TILE_FLIPYX((attr & 0x30) >> 4);
+
+ tileinfo.group = color;
+ tileinfo.category = (attr & 0x80) >> 7;
+
+ tileinfo.set(0, code, color, flags);
+}
+
+void gberet_base_state::video_start()
+{
+ m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(gberet_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
+ m_bg_tilemap->configure_groups(*m_gfxdecode->gfx(0), 0x10);
+ m_bg_tilemap->set_scroll_rows(32);
+}
+
+void gberet_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
+{
+ uint8_t *sr;
+
+ if (m_spritebank & 0x08)
+ sr = m_spriteram2;
+ else
+ sr = m_spriteram;
+
+ for (int offs = 0; offs < 0xc0; offs += 4)
+ {
+ if (sr[offs + 3])
+ {
+ int const attr = sr[offs + 1];
+ int const code = sr[offs + 0] + ((attr & 0x40) << 2);
+ int const color = attr & 0x0f;
+ int sx = sr[offs + 2] - 2 * (attr & 0x80);
+ int sy = sr[offs + 3];
+ int flipx = attr & 0x10;
+ int flipy = attr & 0x20;
+
+ if (flip_screen())
+ {
+ sx = 240 - sx;
+ sy = 240 - sy;
+ flipx = !flipx;
+ flipy = !flipy;
+ }
+
+ m_gfxdecode->gfx(1)->transmask(bitmap, cliprect, code, color, flipx, flipy, sx, sy,
+ m_palette->transpen_mask(*m_gfxdecode->gfx(1), color, 0));
+ }
+ }
+}
+
+uint32_t gberet_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+{
+ m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE | TILEMAP_DRAW_ALL_CATEGORIES, 0);
+ draw_sprites(bitmap, cliprect);
+ m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
+ return 0;
+}
+
+// Green Beret (bootleg)
+
+void gberetb_state::scroll_w(offs_t offset, uint8_t data)
+{
+ int scroll = data;
+
+ if (offset)
+ scroll |= 0x100;
+
+ for (offset = 6; offset < 29; offset++)
+ m_bg_tilemap->set_scrollx(offset, scroll + 64 - 8);
+}
+
+void gberetb_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
+{
+ for (int offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4)
+ {
+ if (m_spriteram[offs + 1])
+ {
+ int const attr = m_spriteram[offs + 3];
+ int const code = m_spriteram[offs] + ((attr & 0x40) << 2);
+ int const color = attr & 0x0f;
+ int sx = m_spriteram[offs + 2] - 2 * (attr & 0x80);
+ int sy = 240 - m_spriteram[offs + 1];
+ int flipx = attr & 0x10;
+ int flipy = attr & 0x20;
+
+ if (flip_screen())
+ {
+ sx = 240 - sx;
+ sy = 240 - sy;
+ flipx = !flipx;
+ flipy = !flipy;
+ }
+
+ m_gfxdecode->gfx(1)->transmask(bitmap, cliprect, code, color, flipx, flipy, sx, sy,
+ m_palette->transpen_mask(*m_gfxdecode->gfx(1), color, 0));
+ }
+ }
+}
+
+uint32_t gberetb_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+{
+ m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE | TILEMAP_DRAW_ALL_CATEGORIES, 0);
+ draw_sprites(bitmap, cliprect);
+ m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
+ return 0;
+}
+
+
+// machine
/*************************************
*
@@ -205,7 +535,7 @@ TBP24S10.A12 - 256x4-bit bipolar PROM (possibly also a color PROM)
TIMER_DEVICE_CALLBACK_MEMBER(gberet_state::interrupt_tick)
{
- uint8_t ticks_mask = ~m_interrupt_ticks & (m_interrupt_ticks + 1); // 0->1
+ uint8_t const ticks_mask = ~m_interrupt_ticks & (m_interrupt_ticks + 1); // 0->1
m_interrupt_ticks++;
// NMI on d0
@@ -248,7 +578,7 @@ void mrgoemon_state::coin_counter_w(uint8_t data)
void gberet_state::flipscreen_w(uint8_t data)
{
// bits 0/1/2 = interrupt enable
- uint8_t ack_mask = ~data & m_interrupt_mask; // 1->0
+ uint8_t const ack_mask = ~data & m_interrupt_mask; // 1->0
if (ack_mask & 1)
m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
@@ -428,30 +758,6 @@ INPUT_PORTS_END
*
*************************************/
-static const gfx_layout charlayout =
-{
- 8,8, // 8*8 characters
- 512, // 512 characters
- 4, // 4 bits per pixel
- { 0, 1, 2, 3 }, // the four bitplanes are packed in one nibble
- { 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4 },
- { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 },
- 32*8 // every char takes 8 consecutive bytes
-};
-
-static const gfx_layout spritelayout =
-{
- 16,16, // 16*16 sprites
- 512, // 512 sprites
- 4, // 4 bits per pixel
- { 0, 1, 2, 3 }, // the four bitplanes are packed in one nibble
- { 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4,
- 32*8+0*4, 32*8+1*4, 32*8+2*4, 32*8+3*4, 32*8+4*4, 32*8+5*4, 32*8+6*4, 32*8+7*4 },
- { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32,
- 64*8+0*32, 64*8+1*32, 64*8+2*32, 64*8+3*32, 64*8+4*32, 64*8+5*32, 64*8+6*32, 64*8+7*32 },
- 128*8 // every sprite takes 128 consecutive bytes
-};
-
static const gfx_layout gberetb_charlayout =
{
8,8, // 8*8 characters
@@ -477,13 +783,13 @@ static const gfx_layout gberetb_spritelayout =
};
static GFXDECODE_START( gfx_gberet )
- GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 16 )
- GFXDECODE_ENTRY( "gfx2", 0, spritelayout, 16*16, 16 )
+ GFXDECODE_ENTRY( "tiles", 0, gfx_8x8x4_packed_msb, 0, 16 )
+ GFXDECODE_ENTRY( "sprites", 0, gfx_8x8x4_row_2x2_group_packed_msb, 16*16, 16 )
GFXDECODE_END
static GFXDECODE_START( gfx_gberetb )
- GFXDECODE_ENTRY( "gfx1", 0, gberetb_charlayout, 0, 16 )
- GFXDECODE_ENTRY( "gfx2", 0, gberetb_spritelayout, 16*16, 16 )
+ GFXDECODE_ENTRY( "tiles", 0, gberetb_charlayout, 0, 16 )
+ GFXDECODE_ENTRY( "sprites", 0, gberetb_spritelayout, 16*16, 16 )
GFXDECODE_END
@@ -504,8 +810,8 @@ void mrgoemon_state::machine_start()
{
gberet_base_state::machine_start();
- uint8_t *ROM = memregion("maincpu")->base();
- m_mainbank->configure_entries(0, 8, &ROM[0xc000], 0x800);
+ uint8_t *rom = memregion("maincpu")->base();
+ m_mainbank->configure_entries(0, 8, &rom[0xc000], 0x800);
}
void gberet_state::machine_reset()
@@ -588,10 +894,10 @@ ROM_START( gberet )
ROM_LOAD( "577l02.8c", 0x4000, 0x4000, CRC(240836a5) SHA1(b76f3789f152198bf8a9a366378d664e683c6c9d) )
ROM_LOAD( "577l01.7c", 0x8000, 0x4000, CRC(41fa3e1f) SHA1(90d1463e16b0f52c01078be044ce3672d4acebff) )
- ROM_REGION( 0x04000, "gfx1", 0 )
+ ROM_REGION( 0x04000, "tiles", 0 )
ROM_LOAD( "577l07.3f", 0x00000, 0x4000, CRC(4da7bd1b) SHA1(54adba9ae086852902d78ab36039498aae50d7a9) )
- ROM_REGION( 0x10000, "gfx2", 0 )
+ ROM_REGION( 0x10000, "sprites", 0 )
ROM_LOAD( "577l06.5e", 0x00000, 0x4000, CRC(0f1cb0ca) SHA1(094004e70c05df8cd486d0854c258fa766e2925d) )
ROM_LOAD( "577l05.4e", 0x04000, 0x4000, CRC(523a8b66) SHA1(5f2bcf2b702fe05f8a022b6284cb2d0a5b5f222f) )
ROM_LOAD( "577l08.4f", 0x08000, 0x4000, CRC(883933a4) SHA1(b565842edf09feeb2c4ac44ad58331757586b6aa) )
@@ -609,10 +915,10 @@ ROM_START( rushatck )
ROM_LOAD( "577h02.8c", 0x4000, 0x4000, CRC(b5802806) SHA1(0e4698ecfb9eda916703165ea5d55516fdef5fe4) )
ROM_LOAD( "577h01.7c", 0x8000, 0x4000, CRC(da7c8f3d) SHA1(eb61eedee169f67db93407ad0fe8a195089b7e3a) )
- ROM_REGION( 0x04000, "gfx1", 0 )
+ ROM_REGION( 0x04000, "tiles", 0 )
ROM_LOAD( "577h07.3f", 0x00000, 0x4000, CRC(03f9815f) SHA1(209c76fd36d1b5672992c55e24d3cf77d4c5a0aa) )
- ROM_REGION( 0x10000, "gfx2", 0 )
+ ROM_REGION( 0x10000, "sprites", 0 )
ROM_LOAD( "577l06.5e", 0x00000, 0x4000, CRC(0f1cb0ca) SHA1(094004e70c05df8cd486d0854c258fa766e2925d) )
ROM_LOAD( "577h05.4e", 0x04000, 0x4000, CRC(9d028e8f) SHA1(4faa47152a6c1da0024bb03fbcf7baf0540e891e) )
ROM_LOAD( "577l08.4f", 0x08000, 0x4000, CRC(883933a4) SHA1(b565842edf09feeb2c4ac44ad58331757586b6aa) )
@@ -629,10 +935,10 @@ ROM_START( gberetb )
ROM_LOAD( "2-ic82.10g", 0x0000, 0x8000, CRC(6d6fb494) SHA1(0d01c86ed7a8962ee3e1056a8d41584ad1406f0f) )
ROM_LOAD( "3-ic81.10f", 0x8000, 0x4000, CRC(f1520a0a) SHA1(227b2d2e1fc0e81ae02e663a3089e7399612e3cf) )
- ROM_REGION( 0x04000, "gfx1", 0 )
+ ROM_REGION( 0x04000, "tiles", 0 )
ROM_LOAD( "1-ic92.12c", 0x00000, 0x4000, CRC(b0189c87) SHA1(29202978b07bf059b88bf206d8fafc80e0cdb6dc) )
- ROM_REGION( 0x10000, "gfx2", 0 )
+ ROM_REGION( 0x10000, "sprites", 0 )
ROM_LOAD( "7-1c8.2b", 0x00000, 0x4000, CRC(86334522) SHA1(f2907d136dbfdb92cbd550524b4453755f6244b6) )
ROM_LOAD( "6-ic9.2c", 0x04000, 0x4000, CRC(bda50d3e) SHA1(c6f5a15270a69464e977926d056b31dcec8b41c3) )
ROM_LOAD( "5-ic10.2d", 0x08000, 0x4000, CRC(6a7b3881) SHA1(795bfb1fbc11ceac687b15e98574feb650e2f674) )
@@ -654,10 +960,10 @@ ROM_START( mrgoemon )
ROM_LOAD( "621d01.10c", 0x00000, 0x8000, CRC(b2219c56) SHA1(274160be5dabbbfa61af71d92bddffbb56eadab6) )
ROM_LOAD( "621d02.12c", 0x08000, 0x8000, CRC(c3337a97) SHA1(6fd5f365b2624a37f252c202cd97877705b4a6c2) ) // 2nd half banked
- ROM_REGION( 0x04000, "gfx1", 0 )
+ ROM_REGION( 0x04000, "tiles", 0 )
ROM_LOAD( "621a05.6d", 0x00000, 0x4000, CRC(f0a6dfc5) SHA1(395024ebfff550b0da393096483196fb1152a077) )
- ROM_REGION( 0x10000, "gfx2", 0 )
+ ROM_REGION( 0x10000, "sprites", 0 )
ROM_LOAD( "621d03.4d", 0x00000, 0x8000, CRC(66f2b973) SHA1(7e906f258a5f4928f9615c6ea176efbca659b3a7) )
ROM_LOAD( "621d04.5d", 0x08000, 0x8000, CRC(47df6301) SHA1(e675c070e46993d3453c2ddadc49ec8b84cec854) )
@@ -667,6 +973,8 @@ ROM_START( mrgoemon )
ROM_LOAD( "621a07.6f", 0x0120, 0x0100, CRC(3980acdc) SHA1(f4e0bd74bccd77b84096c38bc70cf488a42d9562) ) // sprites
ROM_END
+} // anonymous namespace
+
/*************************************
*
diff --git a/src/mame/konami/gberet.h b/src/mame/konami/gberet.h
deleted file mode 100644
index 2f79b411006..00000000000
--- a/src/mame/konami/gberet.h
+++ /dev/null
@@ -1,136 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Nicola Salmoria
-/***************************************************************************
-
- Green Beret
-
-***************************************************************************/
-#ifndef MAME_INCLUDES_GBERET_H
-#define MAME_INCLUDES_GBERET_H
-
-#pragma once
-
-#include "machine/timer.h"
-#include "sound/sn76496.h"
-#include "emupal.h"
-#include "tilemap.h"
-
-class gberet_base_state : public driver_device
-{
-public:
- gberet_base_state(const machine_config &mconfig, device_type type, const char *tag) :
- driver_device(mconfig, type, tag),
- m_colorram(*this, "colorram"),
- m_videoram(*this, "videoram"),
- m_spriteram(*this, "spriteram"),
- m_maincpu(*this, "maincpu"),
- m_gfxdecode(*this, "gfxdecode"),
- m_palette(*this, "palette"),
- m_sn(*this, "snsnd")
- { }
-
-protected:
- virtual void video_start() override;
-
- // memory pointers
- required_shared_ptr<uint8_t> m_colorram;
- required_shared_ptr<uint8_t> m_videoram;
- required_shared_ptr<uint8_t> m_spriteram;
-
- // devices
- required_device<cpu_device> m_maincpu;
- required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
- required_device<sn76489a_device> m_sn;
-
- // video-related
- tilemap_t * m_bg_tilemap = nullptr;
-
- // misc
- void videoram_w(offs_t offset, uint8_t data);
- void colorram_w(offs_t offset, uint8_t data);
- TILE_GET_INFO_MEMBER(get_bg_tile_info);
- void palette(palette_device &palette) const; // TODO: move down in gberet_state once the bootleg PROMs decoding is done
-};
-
-class gberet_state : public gberet_base_state
-{
-public:
- gberet_state(const machine_config &mconfig, device_type type, const char *tag) :
- gberet_base_state(mconfig, type, tag),
- m_spriteram2(*this, "spriteram2"),
- m_scrollram(*this, "scrollram"),
- m_soundlatch(*this, "soundlatch")
- { }
-
- void gberet(machine_config &config);
-
-protected:
- virtual void machine_start() override;
- virtual void machine_reset() override;
-
- void prg_map(address_map &map);
-
-private:
- // memory pointers
- required_shared_ptr<uint8_t> m_spriteram2;
- required_shared_ptr<uint8_t> m_scrollram;
- required_shared_ptr<uint8_t> m_soundlatch;
-
- // video-related
- uint8_t m_spritebank = 0U;
-
- // misc
- uint8_t m_interrupt_mask = 0U;
- uint8_t m_interrupt_ticks = 0U;
- void coin_counter_w(uint8_t data);
- void flipscreen_w(uint8_t data);
- void sound_w(uint8_t data);
- void scroll_w(offs_t offset, uint8_t data);
- void sprite_bank_w(uint8_t data);
- uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- TIMER_DEVICE_CALLBACK_MEMBER(interrupt_tick);
- void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
-};
-
-class mrgoemon_state : public gberet_state
-{
-public:
- mrgoemon_state(const machine_config &mconfig, device_type type, const char *tag) :
- gberet_state(mconfig, type, tag),
- m_mainbank(*this, "mainbank")
- { }
-
- void mrgoemon(machine_config &config);
-
-protected:
- virtual void machine_start() override;
-
-private:
- // memory pointers
- required_memory_bank m_mainbank;
-
- void coin_counter_w(uint8_t data);
- void prg_map(address_map &map);
-};
-
-class gberetb_state : public gberet_base_state
-{
-public:
- gberetb_state(const machine_config &mconfig, device_type type, const char *tag) :
- gberet_base_state(mconfig, type, tag)
- { }
-
- void gberetb(machine_config &config);
-
-private:
- void flipscreen_w(uint8_t data);
- uint8_t irq_ack_r();
- void nmi_ack_w(uint8_t data);
- void scroll_w(offs_t offset, uint8_t data);
- uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
- void prg_map(address_map &map);
-};
-
-#endif // MAME_INCLUDES_GBERET_H
diff --git a/src/mame/konami/gberet_v.cpp b/src/mame/konami/gberet_v.cpp
deleted file mode 100644
index 4f113bc5616..00000000000
--- a/src/mame/konami/gberet_v.cpp
+++ /dev/null
@@ -1,205 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Nicola Salmoria
-#include "emu.h"
-#include "gberet.h"
-
-
-/***************************************************************************
-
- Convert the color PROMs into a more useable format.
-
- Green Beret has a 32 bytes palette PROM and two 256 bytes color lookup table
- PROMs (one for sprites, one for characters).
- The palette PROM is connected to the RGB output, this way:
-
- bit 7 -- 220 ohm resistor -- BLUE
- -- 470 ohm resistor -- BLUE
- -- 220 ohm resistor -- GREEN
- -- 470 ohm resistor -- GREEN
- -- 1 kohm resistor -- GREEN
- -- 220 ohm resistor -- RED
- -- 470 ohm resistor -- RED
- bit 0 -- 1 kohm resistor -- RED
-
-***************************************************************************/
-
-void gberet_base_state::palette(palette_device &palette) const
-{
- uint8_t const *color_prom = memregion("proms")->base();
-
- // create a lookup table for the palette
- for (int i = 0; i < 0x20; i++)
- {
- // red component
- 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
- bit0 = BIT(color_prom[i], 3);
- bit1 = BIT(color_prom[i], 4);
- bit2 = BIT(color_prom[i], 5);
- int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
-
- // blue component
- bit0 = 0;
- bit1 = BIT(color_prom[i], 6);
- bit2 = BIT(color_prom[i], 7);
- int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
-
- palette.set_indirect_color(i, rgb_t(r, g, b));
- }
-
- // color_prom now points to the beginning of the lookup table
- color_prom += 0x20;
-
- for (int i = 0; i < 0x100; i++)
- {
- uint8_t const ctabentry = (color_prom[i] & 0x0f) | 0x10;
- palette.set_pen_indirect(i, ctabentry);
- }
-
- for (int i = 0x100; i < 0x200; i++)
- {
- uint8_t const ctabentry = color_prom[i] & 0x0f;
- palette.set_pen_indirect(i, ctabentry);
- }
-}
-
-void gberet_base_state::videoram_w(offs_t offset, uint8_t data)
-{
- m_videoram[offset] = data;
- m_bg_tilemap->mark_tile_dirty(offset);
-}
-
-void gberet_base_state::colorram_w(offs_t offset, uint8_t data)
-{
- m_colorram[offset] = data;
- m_bg_tilemap->mark_tile_dirty(offset);
-}
-
-void gberet_state::scroll_w(offs_t offset, uint8_t data)
-{
- m_scrollram[offset] = data;
-
- int scroll = m_scrollram[offset & 0x1f] | (m_scrollram[offset | 0x20] << 8);
- m_bg_tilemap->set_scrollx(offset & 0x1f, scroll);
-}
-
-void gberet_state::sprite_bank_w(uint8_t data)
-{
- m_spritebank = data;
-}
-
-TILE_GET_INFO_MEMBER(gberet_base_state::get_bg_tile_info)
-{
- int attr = m_colorram[tile_index];
- int code = m_videoram[tile_index] + ((attr & 0x40) << 2);
- int color = attr & 0x0f;
- int flags = TILE_FLIPYX((attr & 0x30) >> 4);
-
- tileinfo.group = color;
- tileinfo.category = (attr & 0x80) >> 7;
-
- tileinfo.set(0, code, color, flags);
-}
-
-void gberet_base_state::video_start()
-{
- m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(gberet_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
- m_bg_tilemap->configure_groups(*m_gfxdecode->gfx(0), 0x10);
- m_bg_tilemap->set_scroll_rows(32);
-}
-
-void gberet_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
-{
- uint8_t *sr;
-
- if (m_spritebank & 0x08)
- sr = m_spriteram2;
- else
- sr = m_spriteram;
-
- for (int offs = 0; offs < 0xc0; offs += 4)
- {
- if (sr[offs + 3])
- {
- int attr = sr[offs + 1];
- int code = sr[offs + 0] + ((attr & 0x40) << 2);
- int color = attr & 0x0f;
- int sx = sr[offs + 2] - 2 * (attr & 0x80);
- int sy = sr[offs + 3];
- int flipx = attr & 0x10;
- int flipy = attr & 0x20;
-
- if (flip_screen())
- {
- sx = 240 - sx;
- sy = 240 - sy;
- flipx = !flipx;
- flipy = !flipy;
- }
-
- m_gfxdecode->gfx(1)->transmask(bitmap,cliprect, code, color, flipx, flipy, sx, sy,
- m_palette->transpen_mask(*m_gfxdecode->gfx(1), color, 0));
- }
- }
-}
-
-uint32_t gberet_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
-{
- m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE | TILEMAP_DRAW_ALL_CATEGORIES, 0);
- draw_sprites(bitmap, cliprect);
- m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
- return 0;
-}
-
-// Green Beret (bootleg)
-
-void gberetb_state::scroll_w(offs_t offset, uint8_t data)
-{
- int scroll = data;
-
- if (offset)
- scroll |= 0x100;
-
- for (offset = 6; offset < 29; offset++)
- m_bg_tilemap->set_scrollx(offset, scroll + 64 - 8);
-}
-
-void gberetb_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
-{
- for (int offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4)
- {
- if (m_spriteram[offs + 1])
- {
- int attr = m_spriteram[offs + 3];
- int code = m_spriteram[offs] + ((attr & 0x40) << 2);
- int color = attr & 0x0f;
- int sx = m_spriteram[offs + 2] - 2 * (attr & 0x80);
- int sy = 240 - m_spriteram[offs + 1];
- int flipx = attr & 0x10;
- int flipy = attr & 0x20;
-
- if (flip_screen())
- {
- sx = 240 - sx;
- sy = 240 - sy;
- flipx = !flipx;
- flipy = !flipy;
- }
-
- m_gfxdecode->gfx(1)->transmask(bitmap,cliprect, code, color, flipx, flipy, sx, sy,
- m_palette->transpen_mask(*m_gfxdecode->gfx(1), color, 0));
- }
- }
-}
-
-uint32_t gberetb_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
-{
- m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE | TILEMAP_DRAW_ALL_CATEGORIES, 0);
- draw_sprites(bitmap, cliprect);
- m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
- return 0;
-}
diff --git a/src/mame/konami/gyruss.cpp b/src/mame/konami/gyruss.cpp
index 30ccc0577e1..07608f3d645 100644
--- a/src/mame/konami/gyruss.cpp
+++ b/src/mame/konami/gyruss.cpp
@@ -1,5 +1,6 @@
// license:BSD-3-Clause
-// copyright-holders:Nicola Salmoria, Couriersud
+// copyright-holders: Nicola Salmoria, Couriersud
+
/***************************************************************************
Gyruss memory map (preliminary)
@@ -58,36 +59,269 @@ and 1 SFX channel controlled by an 8039:
***************************************************************************/
#include "emu.h"
-#include "gyruss.h"
+
+#include "konami1.h"
#include "konamipt.h"
#include "cpu/m6809/m6809.h"
+#include "cpu/mcs48/mcs48.h"
#include "cpu/z80/z80.h"
#include "machine/74259.h"
#include "machine/gen_latch.h"
-#include "konami1.h"
#include "sound/ay8910.h"
#include "sound/discrete.h"
+#include "video/resnet.h"
+#include "emupal.h"
+#include "screen.h"
#include "speaker.h"
+#include "tilemap.h"
-#define MASTER_CLOCK XTAL(18'432'000)
-#define SOUND_CLOCK XTAL(14'318'181)
+// configurable logging
+#define LOG_FILTER (1U << 1)
-// Video timing
-// PCB measured: H = 15.50khz V = 60.56hz, +/- 0.01hz
-// --> VTOTAL should be OK, HTOTAL not 100% certain
-#define PIXEL_CLOCK MASTER_CLOCK/3
+//#define VERBOSE (LOG_GENERAL | LOG_FILTER)
+
+#include "logmacro.h"
+
+#define LOGFILTER(...) LOGMASKED(LOG_FILTER, __VA_ARGS__)
+
+
+namespace {
+
+class gyruss_state : public driver_device
+{
+public:
+ gyruss_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
+ m_maincpu(*this, "maincpu"),
+ m_subcpu(*this, "sub"),
+ m_audiocpu(*this, "audiocpu"),
+ m_audiocpu_2(*this, "audio2"),
+ m_discrete(*this, "discrete"),
+ m_gfxdecode(*this, "gfxdecode"),
+ m_screen(*this, "screen"),
+ m_palette(*this, "palette"),
+ m_colorram(*this, "colorram"),
+ m_videoram(*this, "videoram"),
+ m_spriteram(*this, "spriteram")
+ { }
+
+ void gyruss(machine_config &config);
+
+ void init_gyruss();
+
+protected:
+ virtual void machine_start() override;
+ virtual void video_start() override;
+
+private:
+ // devices
+ required_device<cpu_device> m_maincpu;
+ required_device<cpu_device> m_subcpu;
+ required_device<cpu_device> m_audiocpu;
+ required_device<i8039_device> m_audiocpu_2;
+ required_device<discrete_sound_device> m_discrete;
+ required_device<gfxdecode_device> m_gfxdecode;
+ required_device<screen_device> m_screen;
+ required_device<palette_device> m_palette;
+
+ // memory pointers
+ required_shared_ptr<uint8_t> m_colorram;
+ required_shared_ptr<uint8_t> m_videoram;
+ required_shared_ptr<uint8_t> m_spriteram;
+
+ tilemap_t *m_tilemap = nullptr;
+ uint8_t m_master_nmi_mask = 0U;
+ uint8_t m_slave_irq_mask = 0U;
+ bool m_flipscreen = false;
+
+ void irq_clear_w(uint8_t data);
+ void sh_irqtrigger_w(uint8_t data);
+ void i8039_irq_w(uint8_t data);
+ DECLARE_WRITE_LINE_MEMBER(master_nmi_mask_w);
+ void slave_irq_mask_w(uint8_t data);
+ template <uint8_t Which> DECLARE_WRITE_LINE_MEMBER(coin_counter_w);
+ void spriteram_w(offs_t offset, uint8_t data);
+ uint8_t scanline_r();
+ DECLARE_WRITE_LINE_MEMBER(flipscreen_w);
+ uint8_t porta_r();
+ void dac_w(uint8_t data);
+ TILE_GET_INFO_MEMBER(get_tile_info);
+ void palette(palette_device &palette) const;
+ uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ DECLARE_WRITE_LINE_MEMBER(vblank_irq);
+ void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
+ template <uint8_t Which> void filter_w(uint8_t data);
+
+ void audio_cpu1_io_map(address_map &map);
+ void audio_cpu1_map(address_map &map);
+ void audio_cpu2_io_map(address_map &map);
+ void audio_cpu2_map(address_map &map);
+ void main_cpu1_map(address_map &map);
+ void main_cpu2_map(address_map &map);
+};
+
+
+// video
+
+/***************************************************************************
-#define HTOTAL 396
-#define HBEND 0
-#define HBSTART 256
+ Convert the color PROMs into a more useable format.
-#define VTOTAL 256
-#define VBEND 0+2*8
-#define VBSTART 224+2*8
+ Gyruss has one 32x8 palette PROM and two 256x4 lookup table PROMs
+ (one for characters, one for sprites).
+ The palette PROM is connected to the RGB output this way:
+ bit 7 -- 220 ohm resistor -- BLUE
+ -- 470 ohm resistor -- BLUE
+ -- 220 ohm resistor -- GREEN
+ -- 470 ohm resistor -- GREEN
+ -- 1 kohm resistor -- GREEN
+ -- 220 ohm resistor -- RED
+ -- 470 ohm resistor -- RED
+ bit 0 -- 1 kohm resistor -- RED
+
+***************************************************************************/
+
+void gyruss_state::palette(palette_device &palette) const
+{
+ const uint8_t *color_prom = memregion("proms")->base();
+ static constexpr int resistances_rg[3] = { 1000, 470, 220 };
+ static constexpr int resistances_b [2] = { 470, 220 };
+
+ // compute the color output resistor weights
+ double weights_rg[3], weights_b[2];
+ compute_resistor_weights(0, 255, -1.0,
+ 3, resistances_rg, weights_rg, 470, 0,
+ 2, resistances_b, weights_b, 470, 0,
+ 0, nullptr, nullptr, 0, 0);
+
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x20; 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 const r = combine_weights(weights_rg, bit0, bit1, bit2);
+
+ // green component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = combine_weights(weights_rg, bit0, bit1, bit2);
+
+ // blue component
+ bit0 = BIT(color_prom[i], 6);
+ bit1 = BIT(color_prom[i], 7);
+ int const b = combine_weights(weights_b, bit0, bit1);
+
+ palette.set_indirect_color(i, rgb_t(r, g, b));
+ }
+
+ // color_prom now points to the beginning of the lookup table
+ color_prom += 32;
+
+ // sprites map to the lower 16 palette entries
+ for (int i = 0; i < 0x100; i++)
+ {
+ uint8_t const ctabentry = color_prom[i] & 0x0f;
+ palette.set_pen_indirect(i, ctabentry);
+ }
+
+ // characters map to the upper 16 palette entries
+ for (int i = 0x100; i < 0x140; i++)
+ {
+ uint8_t const ctabentry = color_prom[i] & 0x0f;
+ palette.set_pen_indirect(i, ctabentry | 0x10);
+ }
+}
+
+
+
+void gyruss_state::spriteram_w(offs_t offset, uint8_t data)
+{
+// m_screen->update_now();
+ m_screen->update_partial(m_screen->vpos());
+ m_spriteram[offset] = data;
+}
+
+
+TILE_GET_INFO_MEMBER(gyruss_state::get_tile_info)
+{
+ int const code = ((m_colorram[tile_index] & 0x20) << 3) | m_videoram[tile_index];
+ int const color = m_colorram[tile_index] & 0x0f;
+ int const flags = TILE_FLIPYX(m_colorram[tile_index] >> 6);
+
+ tileinfo.group = (m_colorram[tile_index] & 0x10) ? 0 : 1;
+
+ tileinfo.set(2, code, color, flags);
+}
+
+
+void gyruss_state::video_start()
+{
+ m_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(gyruss_state::get_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
+ m_tilemap->set_transmask(0, 0x00, 0); // opaque
+ m_tilemap->set_transmask(1, 0x0f, 0); // transparent
+
+ save_item(NAME(m_flipscreen));
+}
+
+
+
+uint8_t gyruss_state::scanline_r()
+{
+ // reads 1V - 128V
+ return m_screen->vpos();
+}
+
+
+WRITE_LINE_MEMBER(gyruss_state::flipscreen_w)
+{
+ m_flipscreen = state;
+}
+
+
+void gyruss_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
+{
+ for (int offs = 0xbc; offs >= 0; offs -= 4)
+ {
+ int const x = m_spriteram[offs];
+ int const y = 241 - m_spriteram[offs + 3];
+
+ int const gfx_bank = m_spriteram[offs + 1] & 0x01;
+ int const code = ((m_spriteram[offs + 2] & 0x20) << 2) | (m_spriteram[offs + 1] >> 1);
+ int const color = m_spriteram[offs + 2] & 0x0f;
+ int const flip_x = ~m_spriteram[offs + 2] & 0x40;
+ int const flip_y = m_spriteram[offs + 2] & 0x80;
+
+ m_gfxdecode->gfx(gfx_bank)->transpen(bitmap, cliprect, code, color, flip_x, flip_y, x, y, 0);
+ }
+}
+
+
+uint32_t gyruss_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+{
+ if (cliprect.min_y == screen.visible_area().min_y)
+ {
+ machine().tilemap().mark_all_dirty();
+ machine().tilemap().set_flip_all(m_flipscreen ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0);
+ }
+
+ m_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
+ draw_sprites(bitmap, cliprect);
+ m_tilemap->draw(screen, bitmap, cliprect, 0, 0);
+
+ return 0;
+}
+
+
+// machine
/* The timer clock which feeds the upper 4 bits of */
/* AY-3-8910 port A is based on the same clock */
@@ -106,57 +340,47 @@ and 1 SFX channel controlled by an 8039:
/* Bit 3 comes from the QA output of the LS90 producing a sequence of */
/* 0, 0, 0, 0, 0, 1, 1, 1, 1, 1 */
-static const int gyruss_timer[10] =
+static const int timer[10] =
{
0x00, 0x01, 0x02, 0x03, 0x04, 0x09, 0x0a, 0x0b, 0x0a, 0x0d
};
-uint8_t gyruss_state::gyruss_portA_r()
+uint8_t gyruss_state::porta_r()
{
- return gyruss_timer[(m_audiocpu->total_cycles() / 1024) % 10];
+ return timer[(m_audiocpu->total_cycles() / 1024) % 10];
}
-void gyruss_state::gyruss_dac_w(uint8_t data)
+void gyruss_state::dac_w(uint8_t data)
{
m_discrete->write(NODE(16), data);
}
-void gyruss_state::gyruss_irq_clear_w(uint8_t data)
+void gyruss_state::irq_clear_w(uint8_t data)
{
m_audiocpu_2->set_input_line(0, CLEAR_LINE);
}
-void gyruss_state::filter_w(int chip, int data )
+template <uint8_t Which>
+void gyruss_state::filter_w(uint8_t data)
{
- //printf("chip %d - %02x\n", chip, data);
+ LOGFILTER("chip %d - %02x\n", Which, data);
for (int i = 0; i < 3; i++)
{
- /* low bit: 47000pF = 0.047uF */
- /* high bit: 220000pF = 0.22uF */
- m_discrete->write(NODE(3 * chip + i + 21), data & 3);
+ // low bit: 47000pF = 0.047uF
+ // high bit: 220000pF = 0.22uF
+ m_discrete->write(NODE(3 * Which + i + 21), data & 3);
data >>= 2;
}
}
-void gyruss_state::gyruss_filter0_w(uint8_t data)
-{
- filter_w(0, data);
-}
-
-void gyruss_state::gyruss_filter1_w(uint8_t data)
-{
- filter_w(1, data);
-}
-
-
-void gyruss_state::gyruss_sh_irqtrigger_w(uint8_t data)
+void gyruss_state::sh_irqtrigger_w(uint8_t data)
{
- /* writing to this register triggers IRQ on the sound CPU */
+ // writing to this register triggers IRQ on the sound CPU
m_audiocpu->set_input_line_and_vector(0, HOLD_LINE, 0xff); // Z80
}
-void gyruss_state::gyruss_i8039_irq_w(uint8_t data)
+void gyruss_state::i8039_irq_w(uint8_t data)
{
m_audiocpu_2->set_input_line(0, ASSERT_LINE);
}
@@ -175,25 +399,21 @@ void gyruss_state::slave_irq_mask_w(uint8_t data)
m_subcpu->set_input_line(0, CLEAR_LINE);
}
-WRITE_LINE_MEMBER(gyruss_state::coin_counter_1_w)
+template <uint8_t Which>
+WRITE_LINE_MEMBER(gyruss_state::coin_counter_w)
{
- machine().bookkeeping().coin_counter_w(0, state);
-}
-
-WRITE_LINE_MEMBER(gyruss_state::coin_counter_2_w)
-{
- machine().bookkeeping().coin_counter_w(1, state);
+ machine().bookkeeping().coin_counter_w(Which, state);
}
void gyruss_state::main_cpu1_map(address_map &map)
{
map(0x0000, 0x7fff).rom();
- map(0x8000, 0x83ff).ram().share("colorram");
- map(0x8400, 0x87ff).ram().share("videoram");
+ map(0x8000, 0x83ff).ram().share(m_colorram);
+ map(0x8400, 0x87ff).ram().share(m_videoram);
map(0x9000, 0x9fff).ram();
- map(0xa000, 0xa7ff).ram().share("share1");
- map(0xc000, 0xc000).portr("DSW2").nopw(); /* watchdog reset */
- map(0xc080, 0xc080).portr("SYSTEM").w(FUNC(gyruss_state::gyruss_sh_irqtrigger_w));
+ map(0xa000, 0xa7ff).ram().share("main_cpus");
+ map(0xc000, 0xc000).portr("DSW2").nopw(); // watchdog reset
+ map(0xc080, 0xc080).portr("SYSTEM").w(FUNC(gyruss_state::sh_irqtrigger_w));
map(0xc0a0, 0xc0a0).portr("P1");
map(0xc0c0, 0xc0c0).portr("P2");
map(0xc0e0, 0xc0e0).portr("DSW1");
@@ -203,12 +423,12 @@ void gyruss_state::main_cpu1_map(address_map &map)
void gyruss_state::main_cpu2_map(address_map &map)
{
- map(0x0000, 0x0000).r(FUNC(gyruss_state::gyruss_scanline_r));
+ map(0x0000, 0x0000).r(FUNC(gyruss_state::scanline_r));
map(0x2000, 0x2000).w(FUNC(gyruss_state::slave_irq_mask_w)).nopr();
map(0x4000, 0x403f).ram();
- map(0x4040, 0x40ff).ram().w(FUNC(gyruss_state::gyruss_spriteram_w)).share("spriteram");
+ map(0x4040, 0x40ff).ram().w(FUNC(gyruss_state::spriteram_w)).share(m_spriteram);
map(0x4100, 0x47ff).ram();
- map(0x6000, 0x67ff).ram().share("share1");
+ map(0x6000, 0x67ff).ram().share("main_cpus");
map(0xe000, 0xffff).rom();
}
@@ -237,7 +457,7 @@ void gyruss_state::audio_cpu1_io_map(address_map &map)
map(0x10, 0x10).w("ay5", FUNC(ay8910_device::address_w));
map(0x11, 0x11).r("ay5", FUNC(ay8910_device::data_r));
map(0x12, 0x12).w("ay5", FUNC(ay8910_device::data_w));
- map(0x14, 0x14).w(FUNC(gyruss_state::gyruss_i8039_irq_w));
+ map(0x14, 0x14).w(FUNC(gyruss_state::i8039_irq_w));
map(0x18, 0x18).w("soundlatch2", FUNC(generic_latch_8_device::write));
}
@@ -267,7 +487,7 @@ static INPUT_PORTS_START( gyruss )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_2WAY
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_2WAY
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* 1p shoot 2 - unused */
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) // 1p shoot 2 - unused
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
@@ -277,7 +497,7 @@ static INPUT_PORTS_START( gyruss )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_2WAY PORT_COCKTAIL
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_2WAY PORT_COCKTAIL
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* 2p shoot 2 - unused */
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) // 2p shoot 2 - unused
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
@@ -293,9 +513,9 @@ static INPUT_PORTS_START( gyruss )
PORT_DIPNAME( 0x04, 0x00, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW2:3")
PORT_DIPSETTING( 0x00, DEF_STR( Upright ) )
PORT_DIPSETTING( 0x04, DEF_STR( Cocktail ) )
- PORT_DIPNAME( 0x08, 0x08, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW2:4") /* tables at 0x1653 (15 bytes) or 0x4bf3 (13 bytes) */
- PORT_DIPSETTING( 0x08, "30k 90k 60k+" ) /* last bonus life at 810k : max. 14 bonus lives */
- PORT_DIPSETTING( 0x00, "40k 110k 70k+" ) /* last bonus life at 810k : max. 12 bonus lives */
+ PORT_DIPNAME( 0x08, 0x08, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW2:4") // tables at 0x1653 (15 bytes) or 0x4bf3 (13 bytes)
+ PORT_DIPSETTING( 0x08, "30k 90k 60k+" ) // last bonus life at 810k : max. 14 bonus lives
+ PORT_DIPSETTING( 0x00, "40k 110k 70k+" ) // last bonus life at 810k : max. 12 bonus lives
PORT_DIPNAME( 0x70, 0x30, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:5,6,7")
PORT_DIPSETTING( 0x70, "1 (Easiest)" )
PORT_DIPSETTING( 0x60, "2" )
@@ -320,10 +540,10 @@ static INPUT_PORTS_START( gyrussce )
PORT_INCLUDE( gyruss )
PORT_MODIFY("DSW2")
- PORT_DIPNAME( 0x08, 0x00, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW2:4") /* tables at 0x1653 (15 bytes) or 0x4bf3 (13 bytes) */
- PORT_DIPSETTING( 0x08, "50k 120k 70k+" ) /* last bonus life at 960k : max. 14 bonus lives */
- PORT_DIPSETTING( 0x00, "60k 140k 80k+" ) /* last bonus life at 940k : max. 12 bonus lives */
- PORT_DIPNAME( 0x70, 0x20, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:5,6,7") /* "Difficult" default setting according to Centuri manual */
+ PORT_DIPNAME( 0x08, 0x00, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW2:4") // tables at 0x1653 (15 bytes) or 0x4bf3 (13 bytes)
+ PORT_DIPSETTING( 0x08, "50k 120k 70k+" ) // last bonus life at 960k : max. 14 bonus lives
+ PORT_DIPSETTING( 0x00, "60k 140k 80k+" ) // last bonus life at 940k : max. 12 bonus lives
+ PORT_DIPNAME( 0x70, 0x20, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:5,6,7") // "Difficult" default setting according to Centuri manual
PORT_DIPSETTING( 0x70, "1 (Easiest)" )
PORT_DIPSETTING( 0x60, "2" )
PORT_DIPSETTING( 0x50, "3" )
@@ -337,67 +557,67 @@ INPUT_PORTS_END
static const gfx_layout charlayout =
{
- 8,8, /* 8*8 characters */
- 512, /* 512 characters */
- 2, /* 2 bits per pixel */
+ 8,8, // 8*8 characters
+ 512, // 512 characters
+ 2, // 2 bits per pixel
{ 4, 0 },
{ 0, 1, 2, 3, 8*8+0,8*8+1,8*8+2,8*8+3 },
{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
- 16*8 /* every char takes 16 consecutive bytes */
+ 16*8 // every char takes 16 consecutive bytes
};
static const gfx_layout spritelayout =
{
- 8,16, /* 8*16 sprites */
- 256, /* 256 sprites */
- 4, /* 4 bits per pixel */
+ 8,16, // 8*16 sprites
+ 256, // 256 sprites
+ 4, // 4 bits per pixel
{ 0x4000*8+4, 0x4000*8+0, 4, 0 },
{ 0, 1, 2, 3, 8*8, 8*8+1, 8*8+2, 8*8+3 },
{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
32*8, 33*8, 34*8, 35*8, 36*8, 37*8, 38*8, 39*8 },
- 64*8 /* every sprite takes 64 consecutive bytes */
+ 64*8 // every sprite takes 64 consecutive bytes
};
static GFXDECODE_START( gfx_gyruss )
- GFXDECODE_ENTRY( "gfx1", 0x0000, spritelayout, 0, 16 ) /* upper half */
- GFXDECODE_ENTRY( "gfx1", 0x0010, spritelayout, 0, 16 ) /* lower half */
- GFXDECODE_ENTRY( "gfx2", 0x0000, charlayout, 16*16, 16 )
+ GFXDECODE_ENTRY( "sprites", 0x0000, spritelayout, 0, 16 ) // upper half
+ GFXDECODE_ENTRY( "sprites", 0x0010, spritelayout, 0, 16 ) // lower half
+ GFXDECODE_ENTRY( "tiles", 0x0000, charlayout, 16*16, 16 )
GFXDECODE_END
static const discrete_mixer_desc konami_right_mixer_desc =
{DISC_MIXER_IS_RESISTOR,
{RES_K(2.2), RES_K(2.2), RES_K(2.2), RES_K(3.3)/3, RES_K(3.3)/3 },
- {0,0,0,0,0,0}, /* no variable resistors */
- {0,0,0,0,0,0}, /* no node capacitors */
+ {0,0,0,0,0,0}, // no variable resistors
+ {0,0,0,0,0,0}, // no node capacitors
0, 200,
CAP_U(0.1),
- CAP_U(1), /* DC - Removal, not in schematics */
+ CAP_U(1), // DC - Removal, not in schematics
0, 1};
static const discrete_mixer_desc konami_left_mixer_desc =
{DISC_MIXER_IS_RESISTOR,
{RES_K(2.2), RES_K(2.2), RES_K(2.2), RES_K(3.3)/3, RES_K(4.7) },
- {0,0,0,0,0,0}, /* no variable resistors */
- {0,0,0,0,0,0}, /* no node capacitors */
+ {0,0,0,0,0,0}, // no variable resistors
+ {0,0,0,0,0,0}, // no node capacitors
0, 200,
CAP_U(0.1),
- CAP_U(1), /* DC - Removal, not in schematics */
+ CAP_U(1), // DC - Removal, not in schematics
0, 1};
-static DISCRETE_SOUND_START( gyruss_sound_discrete )
+static DISCRETE_SOUND_START( sound_discrete )
- /* Chip 1 right */
+ // Chip 1 right
DISCRETE_INPUTX_STREAM(NODE_01, 0, 1.0, 0)
DISCRETE_INPUTX_STREAM(NODE_02, 1, 1.0, 0)
DISCRETE_INPUTX_STREAM(NODE_03, 2, 1.0, 0)
- /* Chip 2 left */
+ // Chip 2 left
DISCRETE_INPUTX_STREAM(NODE_04, 3, 1.0, 0)
DISCRETE_INPUTX_STREAM(NODE_05, 4, 1.0, 0)
DISCRETE_INPUTX_STREAM(NODE_06, 5, 1.0, 0)
- /* Chip 3 right */
+ // Chip 3 right
/* Outputs are tied together after 3.3k resistor on each channel.
* A/R + B/R + C/R = (A + B + C) / 3 * (1/(R/3))
*/
@@ -405,51 +625,51 @@ static DISCRETE_SOUND_START( gyruss_sound_discrete )
DISCRETE_INPUTX_STREAM(NODE_08, 7, 0.33, 0)
DISCRETE_INPUTX_STREAM(NODE_09, 8, 0.33, 0)
- /* Chip 4 right */
+ // Chip 4 right
DISCRETE_INPUTX_STREAM(NODE_10, 9, 0.33, 0)
DISCRETE_INPUTX_STREAM(NODE_11,10, 0.33, 0)
DISCRETE_INPUTX_STREAM(NODE_12,11, 0.33, 0)
- /* Chip 5 left */
+ // Chip 5 left
DISCRETE_INPUTX_STREAM(NODE_13,12, 0.33, 0)
DISCRETE_INPUTX_STREAM(NODE_14,13, 0.33, 0)
DISCRETE_INPUTX_STREAM(NODE_15,14, 0.33, 0)
- /* DAC left */
+ // DAC left
/* Output voltage depends on load. Datasheet gives 2.4 as minimum.
* This is in line with TTL, so 4V with no load seems adequate */
DISCRETE_INPUTX_DATA(NODE_16, 256.0 * 4.0 / 5.0, 0.0, 0.0)
- /* Chip 1 Filter enable */
+ // Chip 1 Filter enable
DISCRETE_INPUT_DATA(NODE_21)
DISCRETE_INPUT_DATA(NODE_22)
DISCRETE_INPUT_DATA(NODE_23)
- /* Chip 2 Filter enable */
+ // Chip 2 Filter enable
DISCRETE_INPUT_DATA(NODE_24)
DISCRETE_INPUT_DATA(NODE_25)
DISCRETE_INPUT_DATA(NODE_26)
- /* Chip 1 Filter */
+ // Chip 1 Filter
DISCRETE_RCFILTER_SW(NODE_31, 1, NODE_01, NODE_21, AY8910_INTERNAL_RESISTANCE+1000, CAP_U(0.047), CAP_U(0.22), 0, 0)
DISCRETE_RCFILTER_SW(NODE_32, 1, NODE_02, NODE_22, AY8910_INTERNAL_RESISTANCE+1000, CAP_U(0.047), CAP_U(0.22), 0, 0)
DISCRETE_RCFILTER_SW(NODE_33, 1, NODE_03, NODE_23, AY8910_INTERNAL_RESISTANCE+1000, CAP_U(0.047), CAP_U(0.22), 0, 0)
- /* Chip 2 Filter */
+ // Chip 2 Filter
DISCRETE_RCFILTER_SW(NODE_34, 1, NODE_04, NODE_24, AY8910_INTERNAL_RESISTANCE+1000, CAP_U(0.047), CAP_U(0.22), 0, 0)
DISCRETE_RCFILTER_SW(NODE_35, 1, NODE_05, NODE_25, AY8910_INTERNAL_RESISTANCE+1000, CAP_U(0.047), CAP_U(0.22), 0, 0)
DISCRETE_RCFILTER_SW(NODE_36, 1, NODE_06, NODE_26, AY8910_INTERNAL_RESISTANCE+1000, CAP_U(0.047), CAP_U(0.22), 0, 0)
- /* Chip 3 */
+ // Chip 3
DISCRETE_ADDER3(NODE_40, 1, NODE_07, NODE_08, NODE_09)
- /* Chip 4 */
+ // Chip 4
DISCRETE_ADDER3(NODE_41, 1, NODE_10, NODE_11, NODE_12)
- /* Chip 5 */
+ // Chip 5
DISCRETE_ADDER3(NODE_42, 1, NODE_13, NODE_14, NODE_15)
- /* right channel */
+ // right channel
DISCRETE_MIXER5(NODE_50, 1, NODE_31, NODE_32, NODE_33, NODE_40, NODE_41, &konami_right_mixer_desc)
- /* left channel */
+ // left channel
DISCRETE_MIXER5(NODE_51, 1, NODE_34, NODE_35, NODE_36, NODE_42, NODE_16, &konami_left_mixer_desc)
DISCRETE_OUTPUT(NODE_50, 11.0)
@@ -475,87 +695,103 @@ WRITE_LINE_MEMBER(gyruss_state::vblank_irq)
void gyruss_state::gyruss(machine_config &config)
{
- /* basic machine hardware */
- Z80(config, m_maincpu, MASTER_CLOCK/6); /* 3.072 MHz */
+ static constexpr XTAL MASTER_CLOCK = XTAL(18'432'000);
+ static constexpr XTAL SOUND_CLOCK = XTAL(14'318'181);
+
+// Video timing
+// PCB measured: H = 15.50khz V = 60.56hz, +/- 0.01hz
+// --> VTOTAL should be OK, HTOTAL not 100% certain
+ static constexpr XTAL PIXEL_CLOCK = MASTER_CLOCK / 3;
+
+ static constexpr int HTOTAL = 396;
+ static constexpr int HBEND = 0;
+ static constexpr int HBSTART = 256;
+
+ static constexpr int VTOTAL = 256;
+ static constexpr int VBEND = 0+2*8;
+ static constexpr int VBSTART = 224+2*8;
+
+ // basic machine hardware
+ Z80(config, m_maincpu, MASTER_CLOCK / 6); // 3.072 MHz
m_maincpu->set_addrmap(AS_PROGRAM, &gyruss_state::main_cpu1_map);
- KONAMI1(config, m_subcpu, MASTER_CLOCK/12); /* 1.536 MHz */
+ KONAMI1(config, m_subcpu, MASTER_CLOCK / 12); // 1.536 MHz
m_subcpu->set_addrmap(AS_PROGRAM, &gyruss_state::main_cpu2_map);
- Z80(config, m_audiocpu, SOUND_CLOCK/4); /* 3.579545 MHz */
+ Z80(config, m_audiocpu, SOUND_CLOCK / 4); // 3.579545 MHz
m_audiocpu->set_addrmap(AS_PROGRAM, &gyruss_state::audio_cpu1_map);
m_audiocpu->set_addrmap(AS_IO, &gyruss_state::audio_cpu1_io_map);
I8039(config, m_audiocpu_2, XTAL(8'000'000));
m_audiocpu_2->set_addrmap(AS_PROGRAM, &gyruss_state::audio_cpu2_map);
m_audiocpu_2->set_addrmap(AS_IO, &gyruss_state::audio_cpu2_io_map);
- m_audiocpu_2->p1_out_cb().set(FUNC(gyruss_state::gyruss_dac_w));
- m_audiocpu_2->p2_out_cb().set(FUNC(gyruss_state::gyruss_irq_clear_w));
+ m_audiocpu_2->p1_out_cb().set(FUNC(gyruss_state::dac_w));
+ m_audiocpu_2->p2_out_cb().set(FUNC(gyruss_state::irq_clear_w));
config.set_maximum_quantum(attotime::from_hz(6000));
ls259_device &mainlatch(LS259(config, "mainlatch")); // 3C
mainlatch.q_out_cb<0>().set(FUNC(gyruss_state::master_nmi_mask_w));
- mainlatch.q_out_cb<2>().set(FUNC(gyruss_state::coin_counter_1_w));
- mainlatch.q_out_cb<3>().set(FUNC(gyruss_state::coin_counter_2_w));
+ mainlatch.q_out_cb<2>().set(FUNC(gyruss_state::coin_counter_w<0>));
+ mainlatch.q_out_cb<3>().set(FUNC(gyruss_state::coin_counter_w<1>));
mainlatch.q_out_cb<5>().set(FUNC(gyruss_state::flipscreen_w));
- /* video hardware */
+ // video hardware
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_raw(PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND, VBSTART);
- m_screen->set_screen_update(FUNC(gyruss_state::screen_update_gyruss));
+ m_screen->set_screen_update(FUNC(gyruss_state::screen_update));
m_screen->set_palette(m_palette);
m_screen->screen_vblank().set(FUNC(gyruss_state::vblank_irq));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_gyruss);
- PALETTE(config, m_palette, FUNC(gyruss_state::gyruss_palette), 16*4+16*16, 32);
+ PALETTE(config, m_palette, FUNC(gyruss_state::palette), 16*4+16*16, 32);
- /* sound hardware */
+ // sound hardware
SPEAKER(config, "lspeaker").front_left();
SPEAKER(config, "rspeaker").front_right();
GENERIC_LATCH_8(config, "soundlatch");
GENERIC_LATCH_8(config, "soundlatch2");
- ay8910_device &ay1(AY8910(config, "ay1", SOUND_CLOCK/8));
+ ay8910_device &ay1(AY8910(config, "ay1", SOUND_CLOCK / 8));
ay1.set_flags(AY8910_DISCRETE_OUTPUT);
ay1.set_resistors_load(RES_K(3.3), RES_K(3.3), RES_K(3.3));
- ay1.port_b_write_callback().set(FUNC(gyruss_state::gyruss_filter0_w));
+ ay1.port_b_write_callback().set(FUNC(gyruss_state::filter_w<0>));
ay1.add_route(0, "discrete", 1.0, 0);
ay1.add_route(1, "discrete", 1.0, 1);
ay1.add_route(2, "discrete", 1.0, 2);
- ay8910_device &ay2(AY8910(config, "ay2", SOUND_CLOCK/8));
+ ay8910_device &ay2(AY8910(config, "ay2", SOUND_CLOCK / 8));
ay2.set_flags(AY8910_DISCRETE_OUTPUT);
ay2.set_resistors_load(RES_K(3.3), RES_K(3.3), RES_K(3.3));
- ay2.port_b_write_callback().set(FUNC(gyruss_state::gyruss_filter1_w));
+ ay2.port_b_write_callback().set(FUNC(gyruss_state::filter_w<1>));
ay2.add_route(0, "discrete", 1.0, 3);
ay2.add_route(1, "discrete", 1.0, 4);
ay2.add_route(2, "discrete", 1.0, 5);
- ay8910_device &ay3(AY8910(config, "ay3", SOUND_CLOCK/8));
+ ay8910_device &ay3(AY8910(config, "ay3", SOUND_CLOCK / 8));
ay3.set_flags(AY8910_DISCRETE_OUTPUT);
ay3.set_resistors_load(RES_K(3.3), RES_K(3.3), RES_K(3.3));
- ay3.port_a_read_callback().set(FUNC(gyruss_state::gyruss_portA_r));
+ ay3.port_a_read_callback().set(FUNC(gyruss_state::porta_r));
ay3.add_route(0, "discrete", 1.0, 6);
ay3.add_route(1, "discrete", 1.0, 7);
ay3.add_route(2, "discrete", 1.0, 8);
- ay8910_device &ay4(AY8910(config, "ay4", SOUND_CLOCK/8));
+ ay8910_device &ay4(AY8910(config, "ay4", SOUND_CLOCK / 8));
ay4.set_flags(AY8910_DISCRETE_OUTPUT);
ay4.set_resistors_load(RES_K(3.3), RES_K(3.3), RES_K(3.3));
ay4.add_route(0, "discrete", 1.0, 9);
ay4.add_route(1, "discrete", 1.0, 10);
ay4.add_route(2, "discrete", 1.0, 11);
- ay8910_device &ay5(AY8910(config, "ay5", SOUND_CLOCK/8));
+ ay8910_device &ay5(AY8910(config, "ay5", SOUND_CLOCK / 8));
ay5.set_flags(AY8910_DISCRETE_OUTPUT);
ay5.set_resistors_load(RES_K(3.3), RES_K(3.3), RES_K(3.3));
ay5.add_route(0, "discrete", 1.0, 12);
ay5.add_route(1, "discrete", 1.0, 13);
ay5.add_route(2, "discrete", 1.0, 14);
- DISCRETE(config, m_discrete, gyruss_sound_discrete);
+ DISCRETE(config, m_discrete, sound_discrete);
m_discrete->add_route(0, "rspeaker", 1.0);
m_discrete->add_route(1, "lspeaker", 1.0);
}
@@ -587,22 +823,22 @@ ROM_START( gyruss )
ROM_LOAD( "gyrussk.2a", 0x2000, 0x2000, CRC(ba498115) SHA1(9cd1f42898cc590f39ba7cb3c975b0b3d3062eba) )
// 4000-5fff: Empty socket, not populated
- ROM_REGION( 0x1000, "audio2", 0 ) /* 8039 */
+ ROM_REGION( 0x1000, "audio2", 0 ) // 8039
ROM_LOAD( "gyrussk.3a", 0x0000, 0x1000, CRC(3f9b5dea) SHA1(6e807da02c2885b18e8cc2199f12f6be9040bf75) )
- ROM_REGION( 0x8000, "gfx1", 0 )
+ ROM_REGION( 0x8000, "sprites", 0 )
ROM_LOAD( "gyrussk.6", 0x0000, 0x2000, CRC(c949db10) SHA1(fcb8bcbd2bdd751fecb322a33c8a92fb6f07a7ab) )
ROM_LOAD( "gyrussk.5", 0x2000, 0x2000, CRC(4f22411a) SHA1(763bcd039f8c1838a0d7da7d4dadc14a26e25596) )
ROM_LOAD( "gyrussk.8", 0x4000, 0x2000, CRC(47cd1fbc) SHA1(8203c4ff0b1cd7b4dbc708e300bfeac1e7366e09) )
ROM_LOAD( "gyrussk.7", 0x6000, 0x2000, CRC(8e8d388c) SHA1(8f2928d71c02aba977d67575d6e34d69bda2b9d4) )
- ROM_REGION( 0x2000, "gfx2", 0 )
+ ROM_REGION( 0x2000, "tiles", 0 )
ROM_LOAD( "gyrussk.4", 0x0000, 0x2000, CRC(27d8329b) SHA1(564ff945465a23d93a93137ad277298770dfa06a) )
ROM_REGION( 0x0220, "proms", 0 )
- ROM_LOAD( "gyrussk.pr3", 0x0000, 0x0020, CRC(98782db3) SHA1(b891e43b25187faca8002919ccb44d744daa3594) ) /* palette */
- ROM_LOAD( "gyrussk.pr1", 0x0020, 0x0100, CRC(7ed057de) SHA1(c04069ae1e2c62f9b3048844cd8cf5e1b03b7d3c) ) /* sprite lookup table */
- ROM_LOAD( "gyrussk.pr2", 0x0120, 0x0100, CRC(de823a81) SHA1(1af94b2a6a319a89b238a5076a2867f1cfd279b0) ) /* character lookup table */
+ ROM_LOAD( "gyrussk.pr3", 0x0000, 0x0020, CRC(98782db3) SHA1(b891e43b25187faca8002919ccb44d744daa3594) ) // palette
+ ROM_LOAD( "gyrussk.pr1", 0x0020, 0x0100, CRC(7ed057de) SHA1(c04069ae1e2c62f9b3048844cd8cf5e1b03b7d3c) ) // sprite lookup table
+ ROM_LOAD( "gyrussk.pr2", 0x0120, 0x0100, CRC(de823a81) SHA1(1af94b2a6a319a89b238a5076a2867f1cfd279b0) ) // character lookup table
ROM_END
ROM_START( gyrussce )
@@ -625,25 +861,25 @@ ROM_START( gyrussce )
ROM_LOAD( "gy-12.8a", 0x2000, 0x2000, CRC(ba498115) SHA1(9cd1f42898cc590f39ba7cb3c975b0b3d3062eba) )
// 4000-5fff: Empty socket, not populated
- ROM_REGION( 0x1000, "audio2", 0 ) /* 8039 */
+ ROM_REGION( 0x1000, "audio2", 0 ) // 8039
ROM_LOAD( "gy-13.11h", 0x0000, 0x1000, CRC(3f9b5dea) SHA1(6e807da02c2885b18e8cc2199f12f6be9040bf75) )
- ROM_REGION( 0x8000, "gfx1", 0 )
+ ROM_REGION( 0x8000, "sprites", 0 )
ROM_LOAD( "gy-10.9d", 0x0000, 0x2000, CRC(c949db10) SHA1(fcb8bcbd2bdd751fecb322a33c8a92fb6f07a7ab) )
ROM_LOAD( "gy-9.8d", 0x2000, 0x2000, CRC(4f22411a) SHA1(763bcd039f8c1838a0d7da7d4dadc14a26e25596) )
ROM_LOAD( "gy-8.7d", 0x4000, 0x2000, CRC(47cd1fbc) SHA1(8203c4ff0b1cd7b4dbc708e300bfeac1e7366e09) )
ROM_LOAD( "gy-7.6d", 0x6000, 0x2000, CRC(8e8d388c) SHA1(8f2928d71c02aba977d67575d6e34d69bda2b9d4) )
- ROM_REGION( 0x2000, "gfx2", 0 )
+ ROM_REGION( 0x2000, "tiles", 0 )
ROM_LOAD( "gy-6.1g", 0x0000, 0x2000, CRC(27d8329b) SHA1(564ff945465a23d93a93137ad277298770dfa06a) )
ROM_REGION( 0x0220, "proms", 0 )
- ROM_LOAD( "gyrussk.pr3", 0x0000, 0x0020, CRC(98782db3) SHA1(b891e43b25187faca8002919ccb44d744daa3594) ) /* palette */
- ROM_LOAD( "gyrussk.pr1", 0x0020, 0x0100, CRC(7ed057de) SHA1(c04069ae1e2c62f9b3048844cd8cf5e1b03b7d3c) ) /* sprite lookup table */
- ROM_LOAD( "gyrussk.pr2", 0x0120, 0x0100, CRC(de823a81) SHA1(1af94b2a6a319a89b238a5076a2867f1cfd279b0) ) /* character lookup table */
+ ROM_LOAD( "gyrussk.pr3", 0x0000, 0x0020, CRC(98782db3) SHA1(b891e43b25187faca8002919ccb44d744daa3594) ) // palette
+ ROM_LOAD( "gyrussk.pr1", 0x0020, 0x0100, CRC(7ed057de) SHA1(c04069ae1e2c62f9b3048844cd8cf5e1b03b7d3c) ) // sprite lookup table
+ ROM_LOAD( "gyrussk.pr2", 0x0120, 0x0100, CRC(de823a81) SHA1(1af94b2a6a319a89b238a5076a2867f1cfd279b0) ) // character lookup table
ROM_END
-ROM_START( gyrussb ) /* PCB has stickers stating "TAITO (NEW ZEALAND) LTD" */
+ROM_START( gyrussb ) // PCB has stickers stating "TAITO (NEW ZEALAND) LTD"
ROM_REGION( 0x8000, "maincpu", 0 )
ROM_LOAD( "1.bin", 0x0000, 0x2000, CRC(6bc21c10) SHA1(9d44f766398b9994f90edb2ffb272b4f22564854) ) // minor code patch / redirection
ROM_LOAD( "2.bin", 0x2000, 0x2000, CRC(a4ec03e4) SHA1(08c33ad7fcc2ad5e5787a1050284e3f8164f4618) )
@@ -658,22 +894,22 @@ ROM_START( gyrussb ) /* PCB has stickers stating "TAITO (NEW ZEALAND) LTD" */
ROM_LOAD( "12.bin", 0x2000, 0x2000, CRC(ba498115) SHA1(9cd1f42898cc590f39ba7cb3c975b0b3d3062eba) )
// 4000-5fff: Empty socket, not populated
- ROM_REGION( 0x1000, "audio2", 0 ) /* 8039 */
+ ROM_REGION( 0x1000, "audio2", 0 ) // 8039
ROM_LOAD( "13.bin", 0x0000, 0x1000, CRC(3f9b5dea) SHA1(6e807da02c2885b18e8cc2199f12f6be9040bf75) )
- ROM_REGION( 0x8000, "gfx1", 0 )
+ ROM_REGION( 0x8000, "sprites", 0 )
ROM_LOAD( "6.bin", 0x0000, 0x2000, CRC(c949db10) SHA1(fcb8bcbd2bdd751fecb322a33c8a92fb6f07a7ab) )
ROM_LOAD( "5.bin", 0x2000, 0x2000, CRC(4f22411a) SHA1(763bcd039f8c1838a0d7da7d4dadc14a26e25596) )
ROM_LOAD( "8.bin", 0x4000, 0x2000, CRC(47cd1fbc) SHA1(8203c4ff0b1cd7b4dbc708e300bfeac1e7366e09) )
ROM_LOAD( "7.bin", 0x6000, 0x2000, CRC(8e8d388c) SHA1(8f2928d71c02aba977d67575d6e34d69bda2b9d4) )
- ROM_REGION( 0x2000, "gfx2", 0 )
+ ROM_REGION( 0x2000, "tiles", 0 )
ROM_LOAD( "4.bin", 0x0000, 0x2000, CRC(27d8329b) SHA1(564ff945465a23d93a93137ad277298770dfa06a) )
ROM_REGION( 0x0220, "proms", 0 )
- ROM_LOAD( "gyrussk.pr3", 0x0000, 0x0020, CRC(98782db3) SHA1(b891e43b25187faca8002919ccb44d744daa3594) ) /* palette */
- ROM_LOAD( "gyrussk.pr1", 0x0020, 0x0100, CRC(7ed057de) SHA1(c04069ae1e2c62f9b3048844cd8cf5e1b03b7d3c) ) /* sprite lookup table */
- ROM_LOAD( "gyrussk.pr2", 0x0120, 0x0100, CRC(de823a81) SHA1(1af94b2a6a319a89b238a5076a2867f1cfd279b0) ) /* character lookup table */
+ ROM_LOAD( "gyrussk.pr3", 0x0000, 0x0020, CRC(98782db3) SHA1(b891e43b25187faca8002919ccb44d744daa3594) ) // palette
+ ROM_LOAD( "gyrussk.pr1", 0x0020, 0x0100, CRC(7ed057de) SHA1(c04069ae1e2c62f9b3048844cd8cf5e1b03b7d3c) ) // sprite lookup table
+ ROM_LOAD( "gyrussk.pr2", 0x0120, 0x0100, CRC(de823a81) SHA1(1af94b2a6a319a89b238a5076a2867f1cfd279b0) ) // character lookup table
ROM_END
ROM_START( venus )
@@ -691,26 +927,28 @@ ROM_START( venus )
ROM_LOAD( "gyrussk.2a", 0x2000, 0x2000, CRC(ba498115) SHA1(9cd1f42898cc590f39ba7cb3c975b0b3d3062eba) )
// 4000-5fff: Empty socket, not populated
- ROM_REGION( 0x1000, "audio2", 0 ) /* 8039 */
+ ROM_REGION( 0x1000, "audio2", 0 ) // 8039
ROM_LOAD( "gyrussk.3a", 0x0000, 0x1000, CRC(3f9b5dea) SHA1(6e807da02c2885b18e8cc2199f12f6be9040bf75) )
- ROM_REGION( 0x8000, "gfx1", 0 )
+ ROM_REGION( 0x8000, "sprites", 0 )
ROM_LOAD( "gyrussk.6", 0x0000, 0x2000, CRC(c949db10) SHA1(fcb8bcbd2bdd751fecb322a33c8a92fb6f07a7ab) )
ROM_LOAD( "gyrussk.5", 0x2000, 0x2000, CRC(4f22411a) SHA1(763bcd039f8c1838a0d7da7d4dadc14a26e25596) )
ROM_LOAD( "gyrussk.8", 0x4000, 0x2000, CRC(47cd1fbc) SHA1(8203c4ff0b1cd7b4dbc708e300bfeac1e7366e09) )
ROM_LOAD( "gyrussk.7", 0x6000, 0x2000, CRC(8e8d388c) SHA1(8f2928d71c02aba977d67575d6e34d69bda2b9d4) )
- ROM_REGION( 0x2000, "gfx2", 0 )
+ ROM_REGION( 0x2000, "tiles", 0 )
ROM_LOAD( "gyrussk.4", 0x0000, 0x2000, CRC(27d8329b) SHA1(564ff945465a23d93a93137ad277298770dfa06a) )
ROM_REGION( 0x0220, "proms", 0 )
- ROM_LOAD( "gyrussk.pr3", 0x0000, 0x0020, CRC(98782db3) SHA1(b891e43b25187faca8002919ccb44d744daa3594) ) /* palette */
- ROM_LOAD( "gyrussk.pr1", 0x0020, 0x0100, CRC(7ed057de) SHA1(c04069ae1e2c62f9b3048844cd8cf5e1b03b7d3c) ) /* sprite lookup table */
- ROM_LOAD( "gyrussk.pr2", 0x0120, 0x0100, CRC(de823a81) SHA1(1af94b2a6a319a89b238a5076a2867f1cfd279b0) ) /* character lookup table */
+ ROM_LOAD( "gyrussk.pr3", 0x0000, 0x0020, CRC(98782db3) SHA1(b891e43b25187faca8002919ccb44d744daa3594) ) // palette
+ ROM_LOAD( "gyrussk.pr1", 0x0020, 0x0100, CRC(7ed057de) SHA1(c04069ae1e2c62f9b3048844cd8cf5e1b03b7d3c) ) // sprite lookup table
+ ROM_LOAD( "gyrussk.pr2", 0x0120, 0x0100, CRC(de823a81) SHA1(1af94b2a6a319a89b238a5076a2867f1cfd279b0) ) // character lookup table
ROM_END
+} // anonymous namespace
+
-GAME( 1983, gyruss, 0, gyruss, gyruss, gyruss_state, empty_init, ROT90, "Konami", "Gyruss", MACHINE_SUPPORTS_SAVE )
-GAME( 1983, gyrussce, gyruss, gyruss, gyrussce, gyruss_state, empty_init, ROT90, "Konami (Centuri license)", "Gyruss (Centuri)", MACHINE_SUPPORTS_SAVE )
-GAME( 1983, gyrussb, gyruss, gyruss, gyruss, gyruss_state, empty_init, ROT90, "bootleg?", "Gyruss (bootleg?)", MACHINE_SUPPORTS_SAVE ) /* Supposed Taito NZ license, but (c) Konami */
-GAME( 1983, venus, gyruss, gyruss, gyruss, gyruss_state, empty_init, ROT90, "bootleg", "Venus (bootleg of Gyruss)", MACHINE_SUPPORTS_SAVE )
+GAME( 1983, gyruss, 0, gyruss, gyruss, gyruss_state, empty_init, ROT90, "Konami", "Gyruss", MACHINE_SUPPORTS_SAVE )
+GAME( 1983, gyrussce, gyruss, gyruss, gyrussce, gyruss_state, empty_init, ROT90, "Konami (Centuri license)", "Gyruss (Centuri)", MACHINE_SUPPORTS_SAVE )
+GAME( 1983, gyrussb, gyruss, gyruss, gyruss, gyruss_state, empty_init, ROT90, "bootleg?", "Gyruss (bootleg?)", MACHINE_SUPPORTS_SAVE ) // Supposed Taito NZ license, but (c) Konami
+GAME( 1983, venus, gyruss, gyruss, gyruss, gyruss_state, empty_init, ROT90, "bootleg", "Venus (bootleg of Gyruss)", MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/konami/gyruss.h b/src/mame/konami/gyruss.h
deleted file mode 100644
index 3182ac4afc9..00000000000
--- a/src/mame/konami/gyruss.h
+++ /dev/null
@@ -1,90 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Nicola Salmoria, Couriersud
-/*************************************************************************
-
- Gyruss
-
-*************************************************************************/
-#ifndef MAME_INCLUDES_GYRUSS_H
-#define MAME_INCLUDES_GYRUSS_H
-
-#pragma once
-
-#include "cpu/mcs48/mcs48.h"
-#include "sound/discrete.h"
-#include "emupal.h"
-#include "screen.h"
-#include "tilemap.h"
-
-class gyruss_state : public driver_device
-{
-public:
- gyruss_state(const machine_config &mconfig, device_type type, const char *tag) :
- driver_device(mconfig, type, tag),
- m_maincpu(*this, "maincpu"),
- m_subcpu(*this, "sub"),
- m_audiocpu(*this, "audiocpu"),
- m_audiocpu_2(*this, "audio2"),
- m_discrete(*this, "discrete"),
- m_colorram(*this, "colorram"),
- m_videoram(*this, "videoram"),
- m_spriteram(*this, "spriteram"),
- m_gfxdecode(*this, "gfxdecode"),
- m_screen(*this, "screen"),
- m_palette(*this, "palette")
- { }
-
- void gyruss(machine_config &config);
-
- void init_gyruss();
-
-private:
- /* devices/memory pointers */
- required_device<cpu_device> m_maincpu;
- required_device<cpu_device> m_subcpu;
- required_device<cpu_device> m_audiocpu;
- required_device<i8039_device> m_audiocpu_2;
- required_device<discrete_sound_device> m_discrete;
- required_shared_ptr<uint8_t> m_colorram;
- required_shared_ptr<uint8_t> m_videoram;
- required_shared_ptr<uint8_t> m_spriteram;
- required_device<gfxdecode_device> m_gfxdecode;
- required_device<screen_device> m_screen;
- required_device<palette_device> m_palette;
-
- tilemap_t *m_tilemap = nullptr;
- uint8_t m_master_nmi_mask = 0U;
- uint8_t m_slave_irq_mask = 0U;
- bool m_flipscreen = false;
-
- void gyruss_irq_clear_w(uint8_t data);
- void gyruss_sh_irqtrigger_w(uint8_t data);
- void gyruss_i8039_irq_w(uint8_t data);
- DECLARE_WRITE_LINE_MEMBER(master_nmi_mask_w);
- void slave_irq_mask_w(uint8_t data);
- DECLARE_WRITE_LINE_MEMBER(coin_counter_1_w);
- DECLARE_WRITE_LINE_MEMBER(coin_counter_2_w);
- void gyruss_spriteram_w(offs_t offset, uint8_t data);
- uint8_t gyruss_scanline_r();
- DECLARE_WRITE_LINE_MEMBER(flipscreen_w);
- uint8_t gyruss_portA_r();
- void gyruss_dac_w(uint8_t data);
- void gyruss_filter0_w(uint8_t data);
- void gyruss_filter1_w(uint8_t data);
- TILE_GET_INFO_MEMBER(gyruss_get_tile_info);
- virtual void machine_start() override;
- virtual void video_start() override;
- void gyruss_palette(palette_device &palette) const;
- uint32_t screen_update_gyruss(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- DECLARE_WRITE_LINE_MEMBER(vblank_irq);
- void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
- void filter_w(int chip, int data );
- void audio_cpu1_io_map(address_map &map);
- void audio_cpu1_map(address_map &map);
- void audio_cpu2_io_map(address_map &map);
- void audio_cpu2_map(address_map &map);
- void main_cpu1_map(address_map &map);
- void main_cpu2_map(address_map &map);
-};
-
-#endif // MAME_INCLUDES_GYRUSS_H
diff --git a/src/mame/konami/gyruss_v.cpp b/src/mame/konami/gyruss_v.cpp
deleted file mode 100644
index 076d7b5029c..00000000000
--- a/src/mame/konami/gyruss_v.cpp
+++ /dev/null
@@ -1,169 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Nicola Salmoria
-/***************************************************************************
-
- video.c
-
- Functions to emulate the video hardware of the machine.
-
-***************************************************************************/
-
-#include "emu.h"
-#include "video/resnet.h"
-#include "gyruss.h"
-
-/***************************************************************************
-
- Convert the color PROMs into a more useable format.
-
- Gyruss has one 32x8 palette PROM and two 256x4 lookup table PROMs
- (one for characters, one for sprites).
- The palette PROM is connected to the RGB output this way:
-
- bit 7 -- 220 ohm resistor -- BLUE
- -- 470 ohm resistor -- BLUE
- -- 220 ohm resistor -- GREEN
- -- 470 ohm resistor -- GREEN
- -- 1 kohm resistor -- GREEN
- -- 220 ohm resistor -- RED
- -- 470 ohm resistor -- RED
- bit 0 -- 1 kohm resistor -- RED
-
-***************************************************************************/
-
-void gyruss_state::gyruss_palette(palette_device &palette) const
-{
- const uint8_t *color_prom = memregion("proms")->base();
- static constexpr int resistances_rg[3] = { 1000, 470, 220 };
- static constexpr int resistances_b [2] = { 470, 220 };
-
- // compute the color output resistor weights
- double weights_rg[3], weights_b[2];
- compute_resistor_weights(0, 255, -1.0,
- 3, resistances_rg, weights_rg, 470, 0,
- 2, resistances_b, weights_b, 470, 0,
- 0, nullptr, nullptr, 0, 0);
-
- // create a lookup table for the palette
- for (int i = 0; i < 0x20; 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 const r = combine_weights(weights_rg, bit0, bit1, bit2);
-
- // green component
- bit0 = BIT(color_prom[i], 3);
- bit1 = BIT(color_prom[i], 4);
- bit2 = BIT(color_prom[i], 5);
- int const g = combine_weights(weights_rg, bit0, bit1, bit2);
-
- // blue component
- bit0 = BIT(color_prom[i], 6);
- bit1 = BIT(color_prom[i], 7);
- int const b = combine_weights(weights_b, bit0, bit1);
-
- palette.set_indirect_color(i, rgb_t(r, g, b));
- }
-
- // color_prom now points to the beginning of the lookup table
- color_prom += 32;
-
- // sprites map to the lower 16 palette entries
- for (int i = 0; i < 0x100; i++)
- {
- uint8_t const ctabentry = color_prom[i] & 0x0f;
- palette.set_pen_indirect(i, ctabentry);
- }
-
- // characters map to the upper 16 palette entries
- for (int i = 0x100; i < 0x140; i++)
- {
- uint8_t const ctabentry = color_prom[i] & 0x0f;
- palette.set_pen_indirect(i, ctabentry | 0x10);
- }
-}
-
-
-
-void gyruss_state::gyruss_spriteram_w(offs_t offset, uint8_t data)
-{
-// m_screen->update_now();
- m_screen->update_partial(m_screen->vpos());
- m_spriteram[offset] = data;
-}
-
-
-TILE_GET_INFO_MEMBER(gyruss_state::gyruss_get_tile_info)
-{
- int code = ((m_colorram[tile_index] & 0x20) << 3) | m_videoram[tile_index];
- int color = m_colorram[tile_index] & 0x0f;
- int flags = TILE_FLIPYX(m_colorram[tile_index] >> 6);
-
- tileinfo.group = (m_colorram[tile_index] & 0x10) ? 0 : 1;
-
- tileinfo.set(2, code, color, flags);
-}
-
-
-void gyruss_state::video_start()
-{
- m_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(gyruss_state::gyruss_get_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
- m_tilemap->set_transmask(0, 0x00, 0); // opaque
- m_tilemap->set_transmask(1, 0x0f, 0); // transparent
-
- save_item(NAME(m_flipscreen));
-}
-
-
-
-uint8_t gyruss_state::gyruss_scanline_r()
-{
- /* reads 1V - 128V */
- return m_screen->vpos();
-}
-
-
-WRITE_LINE_MEMBER(gyruss_state::flipscreen_w)
-{
- m_flipscreen = state;
-}
-
-
-void gyruss_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
-{
- int offs;
-
- for (offs = 0xbc; offs >= 0; offs -= 4)
- {
- int x = m_spriteram[offs];
- int y = 241 - m_spriteram[offs + 3];
-
- int gfx_bank = m_spriteram[offs + 1] & 0x01;
- int code = ((m_spriteram[offs + 2] & 0x20) << 2) | ( m_spriteram[offs + 1] >> 1);
- int color = m_spriteram[offs + 2] & 0x0f;
- int flip_x = ~m_spriteram[offs + 2] & 0x40;
- int flip_y = m_spriteram[offs + 2] & 0x80;
-
- m_gfxdecode->gfx(gfx_bank)->transpen(bitmap,cliprect, code, color, flip_x, flip_y, x, y, 0);
- }
-}
-
-
-uint32_t gyruss_state::screen_update_gyruss(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
-{
- if (cliprect.min_y == screen.visible_area().min_y)
- {
- machine().tilemap().mark_all_dirty();
- machine().tilemap().set_flip_all(m_flipscreen ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0);
- }
-
- m_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
- draw_sprites(bitmap, cliprect);
- m_tilemap->draw(screen, bitmap, cliprect, 0, 0);
-
- return 0;
-}
diff --git a/src/mame/konami/ironhors.cpp b/src/mame/konami/ironhors.cpp
index 75c3e612b99..21604147498 100644
--- a/src/mame/konami/ironhors.cpp
+++ b/src/mame/konami/ironhors.cpp
@@ -1,22 +1,489 @@
// license:BSD-3-Clause
-// copyright-holders:Mirko Buffoni, Couriersud
+// copyright-holders: Mirko Buffoni, Couriersud
+
/***************************************************************************
IronHorse
+ GX560
driver by Mirko Buffoni
***************************************************************************/
#include "emu.h"
-#include "ironhors.h"
+
#include "konamipt.h"
#include "cpu/m6809/m6809.h"
#include "cpu/z80/z80.h"
+#include "machine/gen_latch.h"
+#include "machine/timer.h"
+#include "sound/discrete.h"
#include "sound/ymopn.h"
+#include "video/resnet.h"
+
+#include "emupal.h"
+#include "screen.h"
#include "speaker.h"
+#include "tilemap.h"
+
+
+// configurable logging
+#define LOG_PALETTEBANK (1U << 1)
+
+//#define VERBOSE (LOG_GENERAL | LOG_PALETTEBANK)
+
+#include "logmacro.h"
+
+#define LOGPALETTEBANK(...) LOGMASKED(LOG_PALETTEBANK, __VA_ARGS__)
+
+
+namespace {
+
+class ironhors_base_state : public driver_device
+{
+public:
+ ironhors_base_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
+ m_maincpu(*this, "maincpu"),
+ m_soundcpu(*this, "soundcpu"),
+ m_gfxdecode(*this, "gfxdecode"),
+ m_palette(*this, "palette"),
+ m_screen(*this, "screen"),
+ m_soundlatch(*this, "soundlatch"),
+ m_disc_ih(*this, "disc_ih"),
+ m_interrupt_enable(*this, "int_enable"),
+ m_scroll(*this, "scroll"),
+ m_colorram(*this, "colorram"),
+ m_videoram(*this, "videoram"),
+ m_spriteram(*this, "spriteram%u", 1U)
+ { }
+
+ void base(machine_config &config);
+
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
+ void sh_irqtrigger_w(uint8_t data);
+ void videoram_w(offs_t offset, uint8_t data);
+ void colorram_w(offs_t offset, uint8_t data);
+ void charbank_w(uint8_t data);
+ void palettebank_w(uint8_t data);
+ void flipscreen_w(uint8_t data);
+ void filter_w(uint8_t data);
+
+ void palette(palette_device &palette) const;
+
+ // devices
+ required_device<cpu_device> m_maincpu;
+ required_device<cpu_device> m_soundcpu;
+ required_device<gfxdecode_device> m_gfxdecode;
+ required_device<palette_device> m_palette;
+ required_device<screen_device> m_screen;
+ required_device<generic_latch_8_device> m_soundlatch;
+ required_device<discrete_device> m_disc_ih;
+
+ // memory pointers
+ required_shared_ptr<uint8_t> m_interrupt_enable;
+ required_shared_ptr<uint8_t> m_scroll;
+ required_shared_ptr<uint8_t> m_colorram;
+ required_shared_ptr<uint8_t> m_videoram;
+ required_shared_ptr_array<uint8_t, 2> m_spriteram;
+
+ // video-related
+ tilemap_t *m_bg_tilemap = nullptr;
+ uint8_t m_palettebank = 0U;
+ uint8_t m_charbank = 0U;
+ uint8_t m_spriterambank = 0U;
+};
+
+class ironhors_state : public ironhors_base_state
+{
+public:
+ ironhors_state(const machine_config &mconfig, device_type type, const char *tag) :
+ ironhors_base_state(mconfig, type, tag)
+ { }
+
+ void ironhors(machine_config &config);
+
+protected:
+ virtual void video_start() override;
+
+private:
+ uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+
+ TIMER_DEVICE_CALLBACK_MEMBER(scanline_tick);
+
+ void master_map(address_map &map);
+ void slave_map(address_map &map);
+ void slave_io_map(address_map &map);
+
+ void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
+
+ TILE_GET_INFO_MEMBER(get_bg_tile_info);
+};
+
+class farwest_state : public ironhors_base_state
+{
+public:
+ farwest_state(const machine_config &mconfig, device_type type, const char *tag) :
+ ironhors_base_state(mconfig, type, tag)
+ { }
+
+ void farwest(machine_config &config);
+
+protected:
+ virtual void video_start() override;
+
+private:
+ uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+
+ TIMER_DEVICE_CALLBACK_MEMBER(scanline_tick);
+ void master_map(address_map &map);
+ void slave_map(address_map &map);
+
+ void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
+
+ TILE_GET_INFO_MEMBER(get_bg_tile_info);
+};
+
+
+// video
+
+/***************************************************************************
+
+ Convert the color PROMs into a more useable format.
+
+***************************************************************************/
+
+void ironhors_base_state::palette(palette_device &palette) const
+{
+ const uint8_t *color_prom = memregion("proms")->base();
+ static constexpr int resistances[4] = { 2000, 1000, 470, 220 };
+
+ // compute the color output resistor weights
+ double rweights[4], gweights[4], bweights[4];
+ compute_resistor_weights(0, 255, -1.0,
+ 4, resistances, rweights, 1000, 0,
+ 4, resistances, gweights, 1000, 0,
+ 4, resistances, bweights, 1000, 0);
+
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x100; i++)
+ {
+ int bit0, bit1, bit2, bit3;
+
+ // red component
+ bit0 = BIT(color_prom[i | 0x000], 0);
+ bit1 = BIT(color_prom[i | 0x000], 1);
+ bit2 = BIT(color_prom[i | 0x000], 2);
+ bit3 = BIT(color_prom[i | 0x000], 3);
+ int const r = combine_weights(rweights, bit0, bit1, bit2, bit3);
+
+ // green component
+ bit0 = BIT(color_prom[i | 0x100], 0);
+ bit1 = BIT(color_prom[i | 0x100], 1);
+ bit2 = BIT(color_prom[i | 0x100], 2);
+ bit3 = BIT(color_prom[i | 0x100], 3);
+ int const g = combine_weights(gweights, bit0, bit1, bit2, bit3);
+
+ // blue component
+ bit0 = BIT(color_prom[i | 0x200], 0);
+ bit1 = BIT(color_prom[i | 0x200], 1);
+ bit2 = BIT(color_prom[i | 0x200], 2);
+ bit3 = BIT(color_prom[i | 0x200], 3);
+ int const b = combine_weights(bweights, bit0, bit1, bit2, bit3);
+
+ palette.set_indirect_color(i, rgb_t(r, g, b));
+ }
+
+ // color_prom now points to the beginning of the lookup table
+ color_prom += 0x300;
+
+ // characters use colors 0x10-0x1f of each 0x20 color bank, while sprites use colors 0-0x0f
+ for (int i = 0; i < 0x200; i++)
+ {
+ for (int j = 0; j < 8; j++)
+ {
+ uint8_t const ctabentry = (j << 5) | ((~i & 0x100) >> 4) | (color_prom[i] & 0x0f);
+ palette.set_pen_indirect(((i & 0x100) << 3) | (j << 8) | (i & 0xff), ctabentry);
+ }
+ }
+}
+
+void ironhors_base_state::videoram_w(offs_t offset, uint8_t data)
+{
+ m_videoram[offset] = data;
+ m_bg_tilemap->mark_tile_dirty(offset);
+}
+
+void ironhors_base_state::colorram_w(offs_t offset, uint8_t data)
+{
+ m_colorram[offset] = data;
+ m_bg_tilemap->mark_tile_dirty(offset);
+}
+
+void ironhors_base_state::charbank_w(uint8_t data)
+{
+ if (m_charbank != (data & 0x03))
+ {
+ m_charbank = data & 0x03;
+ machine().tilemap().mark_all_dirty();
+ }
+
+ m_spriterambank = data & 0x08;
+
+ // other bits unknown
+}
+
+void ironhors_base_state::palettebank_w(uint8_t data)
+{
+ if (m_palettebank != (data & 0x07))
+ {
+ m_palettebank = data & 0x07;
+ machine().tilemap().mark_all_dirty();
+ }
+
+ machine().bookkeeping().coin_counter_w(0, data & 0x10);
+ machine().bookkeeping().coin_counter_w(1, data & 0x20);
+
+ // bit 6 unknown - set after game over
+
+ if (data & 0x88)
+ LOGPALETTEBANK("palettebank_w %02x", data);
+}
+
+void ironhors_base_state::flipscreen_w(uint8_t data)
+{
+ if (flip_screen() != (~data & 0x08))
+ {
+ flip_screen_set(~data & 0x08);
+ machine().tilemap().mark_all_dirty();
+ }
+
+ // other bits are used too, but unknown
+}
+
+TILE_GET_INFO_MEMBER(ironhors_state::get_bg_tile_info)
+{
+ int const code = m_videoram[tile_index] + ((m_colorram[tile_index] & 0x40) << 2) +
+ ((m_colorram[tile_index] & 0x20) << 4) + (m_charbank << 10);
+ int const color = (m_colorram[tile_index] & 0x0f) + 16 * m_palettebank;
+ int const flags = ((m_colorram[tile_index] & 0x10) ? TILE_FLIPX : 0) |
+ ((m_colorram[tile_index] & 0x20) ? TILE_FLIPY : 0);
+
+ tileinfo.set(0, code, color, flags);
+}
+
+void ironhors_state::video_start()
+{
+ m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(ironhors_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
+
+ m_bg_tilemap->set_scroll_rows(32);
+}
+
+void ironhors_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
+{
+ uint8_t *sr;
+
+ if (m_spriterambank != 0)
+ sr = m_spriteram[0];
+ else
+ sr = m_spriteram[1];
+
+ for (int offs = 0; offs < m_spriteram[0].bytes(); offs += 5)
+ {
+ int sx = sr[offs + 3];
+ int sy = sr[offs + 2];
+ int flipx = sr[offs + 4] & 0x20;
+ int flipy = sr[offs + 4] & 0x40;
+ int const code = (sr[offs] << 2) + ((sr[offs + 1] & 0x03) << 10) + ((sr[offs + 1] & 0x0c) >> 2);
+ int const color = ((sr[offs + 1] & 0xf0) >> 4) + 16 * m_palettebank;
+ // int mod = flip_screen() ? -8 : 8;
+
+ if (flip_screen())
+ {
+ sx = 240 - sx;
+ sy = 240 - sy;
+ flipx = !flipx;
+ flipy = !flipy;
+ }
+
+ switch (sr[offs + 4] & 0x0c)
+ {
+ case 0x00: // 16x16
+ m_gfxdecode->gfx(1)->transpen(bitmap, cliprect,
+ code / 4,
+ color,
+ flipx, flipy,
+ sx, sy, 0);
+ break;
+
+ case 0x04: // 16x8
+ {
+ if (flip_screen()) sy += 8; // this fixes the train wheels' position
+
+ m_gfxdecode->gfx(2)->transpen(bitmap, cliprect,
+ code & ~1,
+ color,
+ flipx, flipy,
+ flipx ? sx + 8 : sx, sy, 0);
+ m_gfxdecode->gfx(2)->transpen(bitmap, cliprect,
+ code | 1,
+ color,
+ flipx, flipy,
+ flipx ? sx : sx + 8, sy, 0);
+ }
+ break;
+
+ case 0x08: // 8x16
+ {
+ m_gfxdecode->gfx(2)->transpen(bitmap, cliprect,
+ code & ~2,
+ color,
+ flipx, flipy,
+ sx, flipy ? sy + 8 : sy, 0);
+ m_gfxdecode->gfx(2)->transpen(bitmap, cliprect,
+ code | 2,
+ color,
+ flipx, flipy,
+ sx, flipy ? sy : sy + 8, 0);
+ }
+ break;
+
+ case 0x0c: // 8x8
+ {
+ m_gfxdecode->gfx(2)->transpen(bitmap, cliprect,
+ code,
+ color,
+ flipx, flipy,
+ sx, sy, 0);
+ }
+ break;
+ }
+ }
+}
+
+uint32_t ironhors_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+{
+ for (int row = 0; row < 32; row++)
+ m_bg_tilemap->set_scrollx(row, m_scroll[row]);
+
+ m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
+ draw_sprites(bitmap, cliprect);
+ return 0;
+}
+
+TILE_GET_INFO_MEMBER(farwest_state::get_bg_tile_info)
+{
+ int const code = m_videoram[tile_index] + ((m_colorram[tile_index] & 0x40) << 2) +
+ ((m_colorram[tile_index] & 0x20) << 4) + (m_charbank << 10);
+ int const color = (m_colorram[tile_index] & 0x0f) + 16 * m_palettebank;
+ int const flags = 0;//((m_colorram[tile_index] & 0x10) ? TILE_FLIPX : 0) | ((m_colorram[tile_index] & 0x20) ? TILE_FLIPY : 0);
+
+ tileinfo.set(0, code, color, flags);
+}
+
+void farwest_state::video_start()
+{
+ m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(farwest_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
+
+ m_bg_tilemap->set_scroll_rows(32);
+}
+
+void farwest_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
+{
+ uint8_t *sr = m_spriteram[1];
+ uint8_t *sr2 = m_spriteram[0];
+
+ for (int offs = 0; offs < m_spriteram[0].bytes(); offs += 4)
+ {
+ int sx = sr[offs + 2];
+ int sy = sr[offs + 1];
+ int flipx = sr[offs + 3] & 0x20;
+ int flipy = sr[offs + 3] & 0x40;
+ int const code = (sr[offs] << 2) + ((sr2[offs] & 0x03) << 10) + ((sr2[offs] & 0x0c) >> 2);
+ int const color = ((sr2[offs] & 0xf0) >> 4) + 16 * m_palettebank;
+
+ // int mod = flip_screen() ? -8 : 8;
+
+// if (flip_screen())
+ {
+ // sx = 240 - sx;
+ sy = 240 - sy;
+ // flipx = !flipx;
+ // flipy = !flipy;
+ }
+
+ switch (sr[offs + 3] & 0x0c)
+ {
+ case 0x00: // 16x16
+ m_gfxdecode->gfx(1)->transpen(bitmap, cliprect,
+ code / 4,
+ color,
+ flipx, flipy,
+ sx, sy, 0);
+ break;
+
+ case 0x04: // 16x8
+ {
+ if (flip_screen()) sy += 8; // this fixes the train wheels' position
+
+ m_gfxdecode->gfx(2)->transpen(bitmap, cliprect,
+ code & ~1,
+ color,
+ flipx, flipy,
+ flipx ? sx + 8 : sx, sy, 0);
+ m_gfxdecode->gfx(2)->transpen(bitmap, cliprect,
+ code | 1,
+ color,
+ flipx, flipy,
+ flipx ? sx : sx + 8, sy, 0);
+ }
+ break;
+
+ case 0x08: // 8x16
+ {
+ m_gfxdecode->gfx(2)->transpen(bitmap, cliprect,
+ code & ~2,
+ color,
+ flipx, flipy,
+ sx, flipy ? sy + 8 : sy, 0);
+ m_gfxdecode->gfx(2)->transpen(bitmap, cliprect,
+ code | 2,
+ color,
+ flipx, flipy,
+ sx, flipy ? sy : sy + 8, 0);
+ }
+ break;
+
+ case 0x0c: // 8x8
+ {
+ m_gfxdecode->gfx(2)->transpen(bitmap, cliprect,
+ code,
+ color,
+ flipx, flipy,
+ sx, sy, 0);
+ }
+ break;
+ }
+ }
+}
+
+uint32_t farwest_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+{
+ for (int row = 0; row < 32; row++)
+ m_bg_tilemap->set_scrollx(row, m_scroll[row]);
+
+ m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
+ draw_sprites(bitmap, cliprect);
+ return 0;
+}
+
+
+// machine
/*************************************
*
@@ -26,7 +493,7 @@
TIMER_DEVICE_CALLBACK_MEMBER(ironhors_state::scanline_tick)
{
- int scanline = param;
+ int const scanline = param;
if (scanline == 240 && (m_screen->frame_number() & 1) == 0)
{
@@ -232,9 +699,9 @@ static const gfx_layout ironhors_spritelayout =
};
static GFXDECODE_START( gfx_ironhors )
- GFXDECODE_ENTRY( "gfx1", 0, gfx_8x8x4_packed_msb, 0, 16*8 )
- GFXDECODE_ENTRY( "gfx1", 0, ironhors_spritelayout, 16*8*16, 16*8 )
- GFXDECODE_ENTRY( "gfx1", 0, gfx_8x8x4_packed_msb, 16*8*16, 16*8 ) // to handle 8x8 sprites
+ GFXDECODE_ENTRY( "gfx", 0, gfx_8x8x4_packed_msb, 0, 16*8 )
+ GFXDECODE_ENTRY( "gfx", 0, ironhors_spritelayout, 16*8*16, 16*8 )
+ GFXDECODE_ENTRY( "gfx", 0, gfx_8x8x4_packed_msb, 16*8*16, 16*8 ) // to handle 8x8 sprites
GFXDECODE_END
@@ -274,9 +741,9 @@ static const gfx_layout farwest_spritelayout2 =
};
static GFXDECODE_START( gfx_farwest )
- GFXDECODE_ENTRY( "gfx1", 0, farwest_charlayout, 0, 16*8 )
- GFXDECODE_ENTRY( "gfx2", 0, farwest_spritelayout, 16*8*16, 16*8 )
- GFXDECODE_ENTRY( "gfx2", 0, farwest_spritelayout2,16*8*16, 16*8 ) // to handle 8x8 sprites
+ GFXDECODE_ENTRY( "tiles", 0, farwest_charlayout, 0, 16*8 )
+ GFXDECODE_ENTRY( "sprites", 0, farwest_spritelayout, 16*8*16, 16*8 )
+ GFXDECODE_ENTRY( "sprites", 0, farwest_spritelayout2,16*8*16, 16*8 ) // to handle 8x8 sprites
GFXDECODE_END
@@ -369,7 +836,7 @@ These clocks make the emulation run too fast.
void ironhors_base_state::base(machine_config &config)
{
// basic machine hardware
- MC6809E(config, m_maincpu, 18432000/6); // 3.072 MHz??? mod by Shingo Suzuki 1999/10/15
+ MC6809E(config, m_maincpu, 18'432'000 / 6); // 3.072 MHz??? mod by Shingo Suzuki 1999/10/15
// video hardware
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
@@ -377,7 +844,7 @@ void ironhors_base_state::base(machine_config &config)
// m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(0));
// m_screen->set_size(32*8, 32*8);
// m_screen->set_visarea(1*8, 31*8-1, 2*8, 30*8-1);
- m_screen->set_raw(18432000/4,296,8,256-8,255,16,240); // pixel clock is a guesswork
+ m_screen->set_raw(18'432'000 / 4, 296, 8, 256 - 8, 255, 16, 240); // pixel clock is a guesswork
m_screen->set_palette(m_palette);
PALETTE(config, m_palette, FUNC(ironhors_state::palette), 16*8*16+16*8*16, 256);
@@ -387,7 +854,7 @@ void ironhors_base_state::base(machine_config &config)
GENERIC_LATCH_8(config, m_soundlatch);
- ym2203_device &ym2203(YM2203(config, "ym2203", 18432000/6));
+ ym2203_device &ym2203(YM2203(config, "ym2203", 18'432'000 / 6));
ym2203.port_a_write_callback().set(FUNC(ironhors_state::filter_w));
ym2203.add_route(0, "disc_ih", 1.0, 0);
ym2203.add_route(1, "disc_ih", 1.0, 1);
@@ -404,7 +871,7 @@ void ironhors_state::ironhors(machine_config &config)
m_maincpu->set_addrmap(AS_PROGRAM, &ironhors_state::master_map);
TIMER(config, "scantimer").configure_scanline(FUNC(ironhors_state::scanline_tick), "screen", 0, 1);
- Z80(config, m_soundcpu, 18432000/6); // 3.072 MHz
+ Z80(config, m_soundcpu, 18'432'000 / 6); // 3.072 MHz
m_soundcpu->set_addrmap(AS_PROGRAM, &ironhors_state::slave_map);
m_soundcpu->set_addrmap(AS_IO, &ironhors_state::slave_io_map);
@@ -415,7 +882,7 @@ void ironhors_state::ironhors(machine_config &config)
TIMER_DEVICE_CALLBACK_MEMBER(farwest_state::scanline_tick)
{
- int scanline = param;
+ int const scanline = param;
if ((scanline % 2) == 1)
{
@@ -436,7 +903,7 @@ void farwest_state::farwest(machine_config &config)
m_maincpu->set_addrmap(AS_PROGRAM, &farwest_state::master_map);
TIMER(config, "scantimer").configure_scanline(FUNC(farwest_state::scanline_tick), "screen", 0, 1);
- Z80(config, m_soundcpu, 18432000/6); // 3.072 MHz
+ Z80(config, m_soundcpu, 18'432'000 / 6); // 3.072 MHz
m_soundcpu->set_addrmap(AS_PROGRAM, &farwest_state::slave_map);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_farwest);
@@ -462,7 +929,7 @@ ROM_START( ironhors )
ROM_REGION( 0x10000, "soundcpu", 0 )
ROM_LOAD( "560_h01.10c", 0x0000, 0x4000, CRC(2b17930f) SHA1(be7b21f050f6b74c75a33c9284455bbed5b03c63) )
- ROM_REGION( 0x20000, "gfx1", 0 )
+ ROM_REGION( 0x20000, "gfx", 0 )
ROM_LOAD16_BYTE( "560_h06.08f", 0x00000, 0x8000, CRC(f21d8c93) SHA1(4245fff5360e10441e11d0d207d510e5c317bb0e) )
ROM_LOAD16_BYTE( "560_h05.07f", 0x00001, 0x8000, CRC(60107859) SHA1(ab59b6be155d36811a37dc873abbd97cd0a4120d) )
ROM_LOAD16_BYTE( "560_h07.09f", 0x10000, 0x8000, CRC(c761ec73) SHA1(78266c9ff3ea74a59fd3ce84afb4f8a1164c8bba) )
@@ -484,7 +951,7 @@ ROM_START( ironhorsh )
ROM_REGION( 0x10000, "soundcpu", 0 )
ROM_LOAD( "10c_h01.bin", 0x0000, 0x4000, CRC(2b17930f) SHA1(be7b21f050f6b74c75a33c9284455bbed5b03c63) )
- ROM_REGION( 0x20000, "gfx1", 0 )
+ ROM_REGION( 0x20000, "gfx", 0 )
ROM_LOAD16_BYTE( "08f_h06.bin", 0x00000, 0x8000, CRC(f21d8c93) SHA1(4245fff5360e10441e11d0d207d510e5c317bb0e) )
ROM_LOAD16_BYTE( "07f_h05.bin", 0x00001, 0x8000, CRC(60107859) SHA1(ab59b6be155d36811a37dc873abbd97cd0a4120d) )
ROM_LOAD16_BYTE( "09f_h07.bin", 0x10000, 0x8000, CRC(c761ec73) SHA1(78266c9ff3ea74a59fd3ce84afb4f8a1164c8bba) )
@@ -506,7 +973,7 @@ ROM_START( dairesya )
ROM_REGION( 0x10000, "soundcpu", 0 )
ROM_LOAD( "560-j01.10c", 0x0000, 0x4000, CRC(a203b223) SHA1(fd19ae55bda467a09151539be6dce3791c28f18a) )
- ROM_REGION( 0x20000, "gfx1", 0 )
+ ROM_REGION( 0x20000, "gfx", 0 )
ROM_LOAD16_BYTE( "560-j06.8f", 0x00000, 0x8000, CRC(a6e8248d) SHA1(7df653bb3a2257c249c3cf2c3f4f324d687a6b39) )
ROM_LOAD16_BYTE( "560-j05.7f", 0x00001, 0x8000, CRC(f75893d4) SHA1(dc71b912d9bf5104dc633f687c52043df37852f0) )
ROM_LOAD16_BYTE( "560-k07.9f", 0x10000, 0x8000, CRC(c8a1b840) SHA1(753b6fcbb4b28bbb63a392cdef90568734eac9bd) )
@@ -521,7 +988,7 @@ ROM_START( dairesya )
ROM_END
ROM_START( farwest )
- ROM_REGION( 0x12000, "maincpu", 0 ) // 64k for code + 8k for extra ROM
+ ROM_REGION( 0x12000, "maincpu", 0 )
ROM_LOAD( "ironhors.008", 0x04000, 0x4000, CRC(b1c8246c) SHA1(4ceb098bb0b4efcbe50bb4b23bd27a60dabf2b3e) )
ROM_LOAD( "ironhors.009", 0x08000, 0x8000, CRC(ea34ecfc) SHA1(8c7f12e76d2b9eb592ebf1bfd3e16a6b130da8e5) )
ROM_LOAD( "ironhors.007", 0x00000, 0x2000, CRC(471182b7) SHA1(48ff58cbbf971b257e8099ec331397cf73dc8325) ) // don't know what this is for
@@ -529,11 +996,11 @@ ROM_START( farwest )
ROM_REGION( 0x10000, "soundcpu", 0 )
ROM_LOAD( "ironhors.010", 0x0000, 0x4000, CRC(a28231a6) SHA1(617e8fdf8129081c6a1bbbf140837a375a51da72) )
- ROM_REGION( 0x10000, "gfx1", 0 )
+ ROM_REGION( 0x10000, "tiles", 0 )
ROM_LOAD( "ironhors.005", 0x00000, 0x8000, CRC(f77e5b83) SHA1(6c72732dc96c1652713b2aba6f0a2410f9457818) )
ROM_LOAD( "ironhors.006", 0x08000, 0x8000, CRC(7bbc0b51) SHA1(9b4890f2d20a8ddf5ba3f4325df070509252e06e) )
- ROM_REGION( 0x10000, "gfx2", 0 )
+ ROM_REGION( 0x10000, "sprites", 0 )
ROM_LOAD( "ironhors.001", 0x00000, 0x4000, CRC(a8fc21d3) SHA1(1e898aaccad1919bbacf8d7957f5a0761df20767) )
ROM_LOAD( "ironhors.002", 0x04000, 0x4000, CRC(9c1e5593) SHA1(7d41d2224f0653e09d8728ccdec2df60f549e36e) )
ROM_LOAD( "ironhors.003", 0x08000, 0x4000, CRC(3a0bf799) SHA1(b34d5c7edda06b8a579d6d390511781a43ffce83) )
@@ -547,6 +1014,8 @@ ROM_START( farwest )
ROM_LOAD( "ironcol.005", 0x0400, 0x0100, CRC(15077b9c) SHA1(c7fe24e3d481150452ff774f3908510db9e28367) ) // sprite lookup table
ROM_END
+} // anonymous namespace
+
/*************************************
*
@@ -554,7 +1023,7 @@ ROM_END
*
*************************************/
// versions are taken from the letters on the program ROMs' labels
-GAME( 1986, ironhors, 0, ironhors, ironhors, ironhors_state, empty_init, ROT0, "Konami", "Iron Horse (version K)", MACHINE_SUPPORTS_SAVE )
-GAME( 1986, ironhorsh, ironhors, ironhors, ironhors, ironhors_state, empty_init, ROT0, "Konami", "Iron Horse (version H)", MACHINE_SUPPORTS_SAVE )
+GAME( 1986, ironhors, 0, ironhors, ironhors, ironhors_state, empty_init, ROT0, "Konami", "Iron Horse (version K)", MACHINE_SUPPORTS_SAVE )
+GAME( 1986, ironhorsh, ironhors, ironhors, ironhors, ironhors_state, empty_init, ROT0, "Konami", "Iron Horse (version H)", MACHINE_SUPPORTS_SAVE )
GAME( 1986, dairesya, ironhors, ironhors, dairesya, ironhors_state, empty_init, ROT0, "Konami (Kawakusu license)", "Dai Ressya Goutou (Japan, version K)", MACHINE_SUPPORTS_SAVE )
-GAME( 1986, farwest, ironhors, farwest, ironhors, farwest_state, empty_init, ROT0, "bootleg?", "Far West", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE )
+GAME( 1986, farwest, ironhors, farwest, ironhors, farwest_state, empty_init, ROT0, "bootleg?", "Far West", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/konami/ironhors.h b/src/mame/konami/ironhors.h
deleted file mode 100644
index a1a6b42da6e..00000000000
--- a/src/mame/konami/ironhors.h
+++ /dev/null
@@ -1,129 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Mirko Buffoni, Couriersud
-/*************************************************************************
-
- IronHorse
-
-*************************************************************************/
-#ifndef MAME_INCLUDES_IRONHORS_H
-#define MAME_INCLUDES_IRONHORS_H
-
-#pragma once
-
-#include "machine/gen_latch.h"
-#include "machine/timer.h"
-#include "sound/discrete.h"
-#include "emupal.h"
-#include "screen.h"
-#include "tilemap.h"
-
-class ironhors_base_state : public driver_device
-{
-public:
- ironhors_base_state(const machine_config &mconfig, device_type type, const char *tag) :
- driver_device(mconfig, type, tag),
- m_maincpu(*this, "maincpu"),
- m_soundcpu(*this, "soundcpu"),
- m_gfxdecode(*this, "gfxdecode"),
- m_palette(*this, "palette"),
- m_screen(*this, "screen"),
- m_soundlatch(*this, "soundlatch"),
- m_disc_ih(*this, "disc_ih"),
- m_interrupt_enable(*this, "int_enable"),
- m_scroll(*this, "scroll"),
- m_colorram(*this, "colorram"),
- m_videoram(*this, "videoram"),
- m_spriteram(*this, "spriteram%u", 1U)
- { }
-
- void base(machine_config &config);
-
-protected:
- virtual void machine_start() override;
- virtual void machine_reset() override;
-
- void sh_irqtrigger_w(uint8_t data);
- void videoram_w(offs_t offset, uint8_t data);
- void colorram_w(offs_t offset, uint8_t data);
- void charbank_w(uint8_t data);
- void palettebank_w(uint8_t data);
- void flipscreen_w(uint8_t data);
- void filter_w(uint8_t data);
-
- void palette(palette_device &palette) const;
-
- // devices
- required_device<cpu_device> m_maincpu;
- required_device<cpu_device> m_soundcpu;
- required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
- required_device<screen_device> m_screen;
- required_device<generic_latch_8_device> m_soundlatch;
- required_device<discrete_device> m_disc_ih;
-
- // memory pointers
- required_shared_ptr<uint8_t> m_interrupt_enable;
- required_shared_ptr<uint8_t> m_scroll;
- required_shared_ptr<uint8_t> m_colorram;
- required_shared_ptr<uint8_t> m_videoram;
- required_shared_ptr_array<uint8_t, 2> m_spriteram;
-
- // video-related
- tilemap_t *m_bg_tilemap = nullptr;
- uint8_t m_palettebank = 0U;
- uint8_t m_charbank = 0U;
- uint8_t m_spriterambank = 0U;
-};
-
-class ironhors_state : public ironhors_base_state
-{
-public:
- ironhors_state(const machine_config &mconfig, device_type type, const char *tag) :
- ironhors_base_state(mconfig, type, tag)
- { }
-
- void ironhors(machine_config &config);
-
-protected:
- virtual void video_start() override;
-
-private:
- uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
-
- TIMER_DEVICE_CALLBACK_MEMBER(scanline_tick);
-
- void master_map(address_map &map);
- void slave_map(address_map &map);
- void slave_io_map(address_map &map);
-
- void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
-
- TILE_GET_INFO_MEMBER(get_bg_tile_info);
-};
-
-class farwest_state : public ironhors_base_state
-{
-public:
- farwest_state(const machine_config &mconfig, device_type type, const char *tag) :
- ironhors_base_state(mconfig, type, tag)
- { }
-
- void farwest(machine_config &config);
-
-protected:
- virtual void video_start() override;
-
-private:
- uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
-
- TIMER_DEVICE_CALLBACK_MEMBER(scanline_tick);
-
- void master_map(address_map &map);
- void slave_map(address_map &map);
-
- void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
-
- TILE_GET_INFO_MEMBER(get_bg_tile_info);
-};
-
-#endif // MAME_INCLUDES_IRONHORS_H
diff --git a/src/mame/konami/ironhors_v.cpp b/src/mame/konami/ironhors_v.cpp
deleted file mode 100644
index 039bab309dd..00000000000
--- a/src/mame/konami/ironhors_v.cpp
+++ /dev/null
@@ -1,343 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Mirko Buffoni
-/***************************************************************************
-
- ironhors.cpp
-
- Functions to emulate the video hardware of the machine.
-
-***************************************************************************/
-
-#include "emu.h"
-#include "video/resnet.h"
-#include "ironhors.h"
-
-/***************************************************************************
-
- Convert the color PROMs into a more useable format.
-
-***************************************************************************/
-
-void ironhors_base_state::palette(palette_device &palette) const
-{
- const uint8_t *color_prom = memregion("proms")->base();
- static constexpr int resistances[4] = { 2000, 1000, 470, 220 };
-
- // compute the color output resistor weights
- double rweights[4], gweights[4], bweights[4];
- compute_resistor_weights(0, 255, -1.0,
- 4, resistances, rweights, 1000, 0,
- 4, resistances, gweights, 1000, 0,
- 4, resistances, bweights, 1000, 0);
-
- // create a lookup table for the palette
- for (int i = 0; i < 0x100; i++)
- {
- int bit0, bit1, bit2, bit3;
-
- // red component
- bit0 = BIT(color_prom[i | 0x000], 0);
- bit1 = BIT(color_prom[i | 0x000], 1);
- bit2 = BIT(color_prom[i | 0x000], 2);
- bit3 = BIT(color_prom[i | 0x000], 3);
- int const r = combine_weights(rweights, bit0, bit1, bit2, bit3);
-
- // green component
- bit0 = BIT(color_prom[i | 0x100], 0);
- bit1 = BIT(color_prom[i | 0x100], 1);
- bit2 = BIT(color_prom[i | 0x100], 2);
- bit3 = BIT(color_prom[i | 0x100], 3);
- int const g = combine_weights(gweights, bit0, bit1, bit2, bit3);
-
- // blue component
- bit0 = BIT(color_prom[i | 0x200], 0);
- bit1 = BIT(color_prom[i | 0x200], 1);
- bit2 = BIT(color_prom[i | 0x200], 2);
- bit3 = BIT(color_prom[i | 0x200], 3);
- int const b = combine_weights(bweights, bit0, bit1, bit2, bit3);
-
- palette.set_indirect_color(i, rgb_t(r, g, b));
- }
-
- // color_prom now points to the beginning of the lookup table
- color_prom += 0x300;
-
- // characters use colors 0x10-0x1f of each 0x20 color bank, while sprites use colors 0-0x0f
- for (int i = 0; i < 0x200; i++)
- {
- for (int j = 0; j < 8; j++)
- {
- uint8_t const ctabentry = (j << 5) | ((~i & 0x100) >> 4) | (color_prom[i] & 0x0f);
- palette.set_pen_indirect(((i & 0x100) << 3) | (j << 8) | (i & 0xff), ctabentry);
- }
- }
-}
-
-void ironhors_base_state::videoram_w(offs_t offset, uint8_t data)
-{
- m_videoram[offset] = data;
- m_bg_tilemap->mark_tile_dirty(offset);
-}
-
-void ironhors_base_state::colorram_w(offs_t offset, uint8_t data)
-{
- m_colorram[offset] = data;
- m_bg_tilemap->mark_tile_dirty(offset);
-}
-
-void ironhors_base_state::charbank_w(uint8_t data)
-{
- if (m_charbank != (data & 0x03))
- {
- m_charbank = data & 0x03;
- machine().tilemap().mark_all_dirty();
- }
-
- m_spriterambank = data & 0x08;
-
- // other bits unknown
-}
-
-void ironhors_base_state::palettebank_w(uint8_t data)
-{
- if (m_palettebank != (data & 0x07))
- {
- m_palettebank = data & 0x07;
- machine().tilemap().mark_all_dirty();
- }
-
- machine().bookkeeping().coin_counter_w(0, data & 0x10);
- machine().bookkeeping().coin_counter_w(1, data & 0x20);
-
- // bit 6 unknown - set after game over
-
- if (data & 0x88)
- popmessage("palettebank_w %02x",data);
-}
-
-void ironhors_base_state::flipscreen_w(uint8_t data)
-{
- if (flip_screen() != (~data & 0x08))
- {
- flip_screen_set(~data & 0x08);
- machine().tilemap().mark_all_dirty();
- }
-
- // other bits are used too, but unknown
-}
-
-TILE_GET_INFO_MEMBER(ironhors_state::get_bg_tile_info)
-{
- int code = m_videoram[tile_index] + ((m_colorram[tile_index] & 0x40) << 2) +
- ((m_colorram[tile_index] & 0x20) << 4) + (m_charbank << 10);
- int color = (m_colorram[tile_index] & 0x0f) + 16 * m_palettebank;
- int flags = ((m_colorram[tile_index] & 0x10) ? TILE_FLIPX : 0) |
- ((m_colorram[tile_index] & 0x20) ? TILE_FLIPY : 0);
-
- tileinfo.set(0, code, color, flags);
-}
-
-void ironhors_state::video_start()
-{
- m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(ironhors_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
-
- m_bg_tilemap->set_scroll_rows(32);
-}
-
-void ironhors_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
-{
- uint8_t *sr;
-
- if (m_spriterambank != 0)
- sr = m_spriteram[0];
- else
- sr = m_spriteram[1];
-
- for (int offs = 0; offs < m_spriteram[0].bytes(); offs += 5)
- {
- int sx = sr[offs + 3];
- int sy = sr[offs + 2];
- int flipx = sr[offs + 4] & 0x20;
- int flipy = sr[offs + 4] & 0x40;
- int code = (sr[offs] << 2) + ((sr[offs + 1] & 0x03) << 10) + ((sr[offs + 1] & 0x0c) >> 2);
- int color = ((sr[offs + 1] & 0xf0) >> 4) + 16 * m_palettebank;
- // int mod = flip_screen() ? -8 : 8;
-
- if (flip_screen())
- {
- sx = 240 - sx;
- sy = 240 - sy;
- flipx = !flipx;
- flipy = !flipy;
- }
-
- switch (sr[offs + 4] & 0x0c)
- {
- case 0x00: // 16x16
- m_gfxdecode->gfx(1)->transpen(bitmap,cliprect,
- code/4,
- color,
- flipx,flipy,
- sx,sy,0);
- break;
-
- case 0x04: // 16x8
- {
- if (flip_screen()) sy += 8; // this fixes the train wheels' position
-
- m_gfxdecode->gfx(2)->transpen(bitmap,cliprect,
- code & ~1,
- color,
- flipx,flipy,
- flipx?sx+8:sx,sy,0);
- m_gfxdecode->gfx(2)->transpen(bitmap,cliprect,
- code | 1,
- color,
- flipx,flipy,
- flipx?sx:sx+8,sy,0);
- }
- break;
-
- case 0x08: // 8x16
- {
- m_gfxdecode->gfx(2)->transpen(bitmap,cliprect,
- code & ~2,
- color,
- flipx,flipy,
- sx,flipy?sy+8:sy,0);
- m_gfxdecode->gfx(2)->transpen(bitmap,cliprect,
- code | 2,
- color,
- flipx,flipy,
- sx,flipy?sy:sy+8,0);
- }
- break;
-
- case 0x0c: // 8x8
- {
- m_gfxdecode->gfx(2)->transpen(bitmap,cliprect,
- code,
- color,
- flipx,flipy,
- sx,sy,0);
- }
- break;
- }
- }
-}
-
-uint32_t ironhors_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
-{
- for (int row = 0; row < 32; row++)
- m_bg_tilemap->set_scrollx(row, m_scroll[row]);
-
- m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
- draw_sprites(bitmap, cliprect);
- return 0;
-}
-
-TILE_GET_INFO_MEMBER(farwest_state::get_bg_tile_info)
-{
- int code = m_videoram[tile_index] + ((m_colorram[tile_index] & 0x40) << 2) +
- ((m_colorram[tile_index] & 0x20) << 4) + (m_charbank << 10);
- int color = (m_colorram[tile_index] & 0x0f) + 16 * m_palettebank;
- int flags = 0;//((m_colorram[tile_index] & 0x10) ? TILE_FLIPX : 0) | ((m_colorram[tile_index] & 0x20) ? TILE_FLIPY : 0);
-
- tileinfo.set(0, code, color, flags);
-}
-
-void farwest_state::video_start()
-{
- m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(farwest_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
-
- m_bg_tilemap->set_scroll_rows(32);
-}
-
-void farwest_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
-{
- uint8_t *sr = m_spriteram[1];
- uint8_t *sr2 = m_spriteram[0];
-
- for (int offs = 0; offs < m_spriteram[0].bytes(); offs += 4)
- {
- int sx = sr[offs + 2];
- int sy = sr[offs + 1];
- int flipx = sr[offs + 3] & 0x20;
- int flipy = sr[offs + 3] & 0x40;
- int code = (sr[offs] << 2) + ((sr2[offs] & 0x03) << 10) + ((sr2[offs] & 0x0c) >> 2);
- int color = ((sr2[offs] & 0xf0) >> 4) + 16 * m_palettebank;
-
- // int mod = flip_screen() ? -8 : 8;
-
-// if (flip_screen())
- {
- // sx = 240 - sx;
- sy = 240 - sy;
- // flipx = !flipx;
- // flipy = !flipy;
- }
-
- switch (sr[offs + 3] & 0x0c)
- {
- case 0x00: // 16x16
- m_gfxdecode->gfx(1)->transpen(bitmap,cliprect,
- code/4,
- color,
- flipx,flipy,
- sx,sy,0);
- break;
-
- case 0x04: // 16x8
- {
- if (flip_screen()) sy += 8; // this fixes the train wheels' position
-
- m_gfxdecode->gfx(2)->transpen(bitmap,cliprect,
- code & ~1,
- color,
- flipx,flipy,
- flipx?sx+8:sx,sy,0);
- m_gfxdecode->gfx(2)->transpen(bitmap,cliprect,
- code | 1,
- color,
- flipx,flipy,
- flipx?sx:sx+8,sy,0);
- }
- break;
-
- case 0x08: // 8x16
- {
- m_gfxdecode->gfx(2)->transpen(bitmap,cliprect,
- code & ~2,
- color,
- flipx,flipy,
- sx,flipy?sy+8:sy,0);
- m_gfxdecode->gfx(2)->transpen(bitmap,cliprect,
- code | 2,
- color,
- flipx,flipy,
- sx,flipy?sy:sy+8,0);
- }
- break;
-
- case 0x0c: // 8x8
- {
- m_gfxdecode->gfx(2)->transpen(bitmap,cliprect,
- code,
- color,
- flipx,flipy,
- sx,sy,0);
- }
- break;
- }
- }
-}
-
-uint32_t farwest_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
-{
- for (int row = 0; row < 32; row++)
- m_bg_tilemap->set_scrollx(row, m_scroll[row]);
-
- m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
- draw_sprites(bitmap, cliprect);
- return 0;
-}
diff --git a/src/mame/konami/jailbrek.cpp b/src/mame/konami/jailbrek.cpp
index 31fc43c93e8..806e03d5185 100644
--- a/src/mame/konami/jailbrek.cpp
+++ b/src/mame/konami/jailbrek.cpp
@@ -1,5 +1,6 @@
// license:BSD-3-Clause
-// copyright-holders:Ernesto Corvi
+// copyright-holders: Ernesto Corvi
+
/***************************************************************************
Jailbreak - (c) 1986 Konami
@@ -86,17 +87,199 @@ Notes:
***************************************************************************/
#include "emu.h"
-#include "jailbrek.h"
-#include "konamipt.h"
+
#include "konami1.h"
+#include "konamipt.h"
#include "cpu/m6809/m6809.h"
#include "machine/watchdog.h"
#include "sound/sn76496.h"
+#include "sound/vlm5030.h"
+#include "emupal.h"
#include "screen.h"
#include "speaker.h"
+#include "tilemap.h"
+
+
+namespace {
+
+class jailbrek_state : public driver_device
+{
+public:
+ jailbrek_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
+ m_colorram(*this, "colorram"),
+ m_videoram(*this, "videoram"),
+ m_spriteram(*this, "spriteram"),
+ m_scroll_x(*this, "scroll_x"),
+ m_scroll_dir(*this, "scroll_dir"),
+ m_maincpu(*this, "maincpu"),
+ m_vlm(*this, "vlm"),
+ m_gfxdecode(*this, "gfxdecode"),
+ m_palette(*this, "palette")
+ { }
+
+ void jailbrek(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<uint8_t> m_colorram;
+ required_shared_ptr<uint8_t> m_videoram;
+ required_shared_ptr<uint8_t> m_spriteram;
+ required_shared_ptr<uint8_t> m_scroll_x;
+ required_shared_ptr<uint8_t> m_scroll_dir;
+
+ // devices
+ required_device<cpu_device> m_maincpu;
+ required_device<vlm5030_device> m_vlm;
+ required_device<gfxdecode_device> m_gfxdecode;
+ required_device<palette_device> m_palette;
+
+ // video-related
+ tilemap_t *m_bg_tilemap = nullptr;
+
+ // misc
+ uint8_t m_irq_enable = 0U;
+ uint8_t m_nmi_enable = 0U;
+
+ void ctrl_w(uint8_t data);
+ void coin_w(uint8_t data);
+ void videoram_w(offs_t offset, uint8_t data);
+ void colorram_w(offs_t offset, uint8_t data);
+ uint8_t speech_r();
+ void speech_w(uint8_t data);
+ TILE_GET_INFO_MEMBER(get_bg_tile_info);
+ void palette(palette_device &palette) const;
+ uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ DECLARE_WRITE_LINE_MEMBER(vblank_irq);
+ INTERRUPT_GEN_MEMBER(interrupt_nmi);
+ void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
+
+ void prg_map(address_map &map);
+ void vlm_map(address_map &map);
+};
+
+
+// video
+void jailbrek_state::palette(palette_device &palette) const
+{
+ const uint8_t *color_prom = memregion("proms")->base();
+
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x20; i++)
+ {
+ int const r = pal4bit(color_prom[i + 0x00] >> 0);
+ int const g = pal4bit(color_prom[i + 0x00] >> 4);
+ int const b = pal4bit(color_prom[i + 0x20] >> 0);
+
+ palette.set_indirect_color(i, rgb_t(r, g, b));
+ }
+
+ // color_prom now points to the beginning of the lookup table
+ color_prom += 0x40;
+
+ for (int i = 0; i < 0x100; i++)
+ {
+ uint8_t const ctabentry = (color_prom[i] & 0x0f) | 0x10;
+ palette.set_pen_indirect(i, ctabentry);
+ }
+
+ for (int i = 0x100; i < 0x200; i++)
+ {
+ uint8_t const ctabentry = color_prom[i] & 0x0f;
+ palette.set_pen_indirect(i, ctabentry);
+ }
+}
+
+void jailbrek_state::videoram_w(offs_t offset, uint8_t data)
+{
+ m_videoram[offset] = data;
+ m_bg_tilemap->mark_tile_dirty(offset);
+}
+
+void jailbrek_state::colorram_w(offs_t offset, uint8_t data)
+{
+ m_colorram[offset] = data;
+ m_bg_tilemap->mark_tile_dirty(offset);
+}
+
+TILE_GET_INFO_MEMBER(jailbrek_state::get_bg_tile_info)
+{
+ int const attr = m_colorram[tile_index];
+ int const code = m_videoram[tile_index] + ((attr & 0xc0) << 2);
+ int const color = attr & 0x0f;
+
+ tileinfo.set(0, code, color, 0);
+}
+
+void jailbrek_state::video_start()
+{
+ m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(jailbrek_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
+}
+
+void jailbrek_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
+{
+ for (int i = 0; i < m_spriteram.bytes(); i += 4)
+ {
+ int const attr = m_spriteram[i + 1]; // attributes = ?tyxcccc
+ int const code = m_spriteram[i] + ((attr & 0x40) << 2);
+ int const color = attr & 0x0f;
+ int flipx = attr & 0x10;
+ int flipy = attr & 0x20;
+ int sx = m_spriteram[i + 2] - ((attr & 0x80) << 1);
+ int sy = m_spriteram[i + 3];
+
+ if (flip_screen())
+ {
+ sx = 240 - sx;
+ sy = 240 - sy;
+ flipx = !flipx;
+ flipy = !flipy;
+ }
+
+ m_gfxdecode->gfx(1)->transmask(bitmap, cliprect, code, color, flipx, flipy,
+ sx, sy,
+ m_palette->transpen_mask(*m_gfxdecode->gfx(1), color, 0));
+ }
+}
+
+uint32_t jailbrek_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+{
+ // added support for vertical scrolling (credits). 23/1/2002 -BR
+ // bit 2 appears to be horizontal/vertical scroll control
+ if (m_scroll_dir[0] & 0x04)
+ {
+ m_bg_tilemap->set_scroll_cols(32);
+ m_bg_tilemap->set_scroll_rows(1);
+ m_bg_tilemap->set_scrollx(0, 0);
+
+ for (int i = 0; i < 32; i++)
+ m_bg_tilemap->set_scrolly(i, ((m_scroll_x[i + 32] << 8) + m_scroll_x[i]));
+ }
+ else
+ {
+ m_bg_tilemap->set_scroll_rows(32);
+ m_bg_tilemap->set_scroll_cols(1);
+ m_bg_tilemap->set_scrolly(0, 0);
+
+ for (int i = 0; i < 32; i++)
+ m_bg_tilemap->set_scrollx(i, ((m_scroll_x[i + 32] << 8) + m_scroll_x[i]));
+ }
+
+ m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
+ draw_sprites(bitmap, cliprect);
+ return 0;
+}
+
+
+// machine
void jailbrek_state::ctrl_w(uint8_t data)
{
@@ -131,33 +314,33 @@ uint8_t jailbrek_state::speech_r()
void jailbrek_state::speech_w(uint8_t data)
{
- /* bit 0 could be latch direction like in yiear */
+ // bit 0 could be latch direction like in yiear
m_vlm->st((data >> 1) & 1);
m_vlm->rst((data >> 2) & 1);
}
-void jailbrek_state::jailbrek_map(address_map &map)
+void jailbrek_state::prg_map(address_map &map)
{
- map(0x0000, 0x07ff).ram().w(FUNC(jailbrek_state::colorram_w)).share("colorram");
- map(0x0800, 0x0fff).ram().w(FUNC(jailbrek_state::videoram_w)).share("videoram");
- map(0x1000, 0x10bf).ram().share("spriteram");
- map(0x10c0, 0x14ff).ram(); /* ??? */
- map(0x1500, 0x1fff).ram(); /* work ram */
- map(0x2000, 0x203f).ram().share("scroll_x");
- map(0x2040, 0x2040).nopw(); /* ??? */
- map(0x2041, 0x2041).nopw(); /* ??? */
- map(0x2042, 0x2042).ram().share("scroll_dir"); /* bit 2 = scroll direction */
- map(0x2043, 0x2043).nopw(); /* ??? */
- map(0x2044, 0x2044).w(FUNC(jailbrek_state::ctrl_w)); /* irq, nmi enable, screen flip */
+ map(0x0000, 0x07ff).ram().w(FUNC(jailbrek_state::colorram_w)).share(m_colorram);
+ map(0x0800, 0x0fff).ram().w(FUNC(jailbrek_state::videoram_w)).share(m_videoram);
+ map(0x1000, 0x10bf).ram().share(m_spriteram);
+ map(0x10c0, 0x14ff).ram(); // ???
+ map(0x1500, 0x1fff).ram(); // work RAM
+ map(0x2000, 0x203f).ram().share(m_scroll_x);
+ map(0x2040, 0x2040).nopw(); // ???
+ map(0x2041, 0x2041).nopw(); // ???
+ map(0x2042, 0x2042).ram().share(m_scroll_dir); // bit 2 = scroll direction
+ map(0x2043, 0x2043).nopw(); // ???
+ map(0x2044, 0x2044).w(FUNC(jailbrek_state::ctrl_w)); // irq, nmi enable, screen flip
map(0x3000, 0x3000).w(FUNC(jailbrek_state::coin_w));
map(0x3100, 0x3100).portr("DSW2").w("snsnd", FUNC(sn76489a_device::write));
- map(0x3200, 0x3200).portr("DSW3").nopw(); /* mirror of the previous? */
+ map(0x3200, 0x3200).portr("DSW3").nopw(); // mirror of the previous?
map(0x3300, 0x3300).portr("SYSTEM").w("watchdog", FUNC(watchdog_timer_device::reset_w));
map(0x3301, 0x3301).portr("P1");
map(0x3302, 0x3302).portr("P2");
map(0x3303, 0x3303).portr("DSW1");
- map(0x4000, 0x4000).w(FUNC(jailbrek_state::speech_w)); /* speech pins */
- map(0x5000, 0x5000).w(m_vlm, FUNC(vlm5030_device::data_w)); /* speech data */
+ map(0x4000, 0x4000).w(FUNC(jailbrek_state::speech_w)); // speech pins
+ map(0x5000, 0x5000).w(m_vlm, FUNC(vlm5030_device::data_w)); // speech data
map(0x6000, 0x6000).r(FUNC(jailbrek_state::speech_r));
map(0x8000, 0xffff).rom();
}
@@ -171,21 +354,21 @@ void jailbrek_state::vlm_map(address_map &map)
static INPUT_PORTS_START( jailbrek )
- PORT_START("SYSTEM") /* $3300 */
+ PORT_START("SYSTEM") // $3300
KONAMI8_SYSTEM_10
PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
- PORT_START("P1") /* $3301 */
+ PORT_START("P1") // $3301
KONAMI8_B12_UNK(1) // button1 = shoot, button2 = select
- PORT_START("P2") /* $3302 */
+ PORT_START("P2") // $3302
KONAMI8_B12_UNK(2)
- PORT_START("DSW1") /* $3303 */
+ PORT_START("DSW1") // $3303
KONAMI_COINAGE_LOC(DEF_STR( Free_Play ), "Invalid", SW1)
- /* "Invalid" = both coin slots disabled */
+ // "Invalid" = both coin slots disabled
- PORT_START("DSW2") /* $3100 */
+ PORT_START("DSW2") // $3100
PORT_DIPNAME( 0x03, 0x01, DEF_STR( Lives ) ) PORT_DIPLOCATION( "SW2:1,2" )
PORT_DIPSETTING( 0x03, "1" )
PORT_DIPSETTING( 0x02, "2" )
@@ -207,7 +390,7 @@ static INPUT_PORTS_START( jailbrek )
PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
- PORT_START("DSW3") /* $3200 */
+ PORT_START("DSW3") // $3200
PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION( "SW3:1" )
PORT_DIPSETTING( 0x01, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
@@ -219,33 +402,9 @@ static INPUT_PORTS_START( jailbrek )
INPUT_PORTS_END
-static const gfx_layout charlayout =
-{
- 8,8, /* 8*8 characters */
- 1024, /* 1024 characters */
- 4, /* 4 bits per pixel */
- { 0, 1, 2, 3 }, /* the four bitplanes are packed in one nibble */
- { 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4 },
- { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 },
- 32*8 /* every char takes 32 consecutive bytes */
-};
-
-static const gfx_layout spritelayout =
-{
- 16,16, /* 16*16 sprites */
- 512, /* 512 sprites */
- 4, /* 4 bits per pixel */
- { 0, 1, 2, 3 }, /* the bitplanes are packed in one nibble */
- { 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4,
- 32*8+0*4, 32*8+1*4, 32*8+2*4, 32*8+3*4, 32*8+4*4, 32*8+5*4, 32*8+6*4, 32*8+7*4 },
- { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32,
- 16*32, 17*32, 18*32, 19*32, 20*32, 21*32, 22*32, 23*32 },
- 128*8 /* every sprite takes 128 consecutive bytes */
-};
-
static GFXDECODE_START( gfx_jailbrek )
- GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 16 ) /* characters */
- GFXDECODE_ENTRY( "gfx2", 0, spritelayout, 16*16, 16 ) /* sprites */
+ GFXDECODE_ENTRY( "tiles", 0, gfx_8x8x4_packed_msb, 0, 16 )
+ GFXDECODE_ENTRY( "sprites", 0, gfx_8x8x4_row_2x2_group_packed_msb, 16*16, 16 )
GFXDECODE_END
@@ -263,27 +422,30 @@ void jailbrek_state::machine_reset()
void jailbrek_state::jailbrek(machine_config &config)
{
- /* basic machine hardware */
- KONAMI1(config, m_maincpu, MASTER_CLOCK/12); // the bootleg uses a standard M6809 with separate decryption logic
- m_maincpu->set_addrmap(AS_PROGRAM, &jailbrek_state::jailbrek_map);
- m_maincpu->set_periodic_int(FUNC(jailbrek_state::interrupt_nmi), attotime::from_hz(500)); /* ? */
+ static constexpr XTAL MASTER_CLOCK = XTAL(18'432'000);
+ static constexpr XTAL VOICE_CLOCK = XTAL(3'579'545);
+
+ // basic machine hardware
+ KONAMI1(config, m_maincpu, MASTER_CLOCK / 12); // the bootleg uses a standard M6809 with separate decryption logic
+ m_maincpu->set_addrmap(AS_PROGRAM, &jailbrek_state::prg_map);
+ m_maincpu->set_periodic_int(FUNC(jailbrek_state::interrupt_nmi), attotime::from_hz(500)); // ?
WATCHDOG_TIMER(config, "watchdog");
- /* video hardware */
+ // video hardware
GFXDECODE(config, m_gfxdecode, m_palette, gfx_jailbrek);
- PALETTE(config, m_palette, FUNC(jailbrek_state::jailbrek_palette), 512, 32);
+ PALETTE(config, m_palette, FUNC(jailbrek_state::palette), 512, 32);
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
- screen.set_raw(MASTER_CLOCK/3, 396, 8, 248, 256, 16, 240);
+ screen.set_raw(MASTER_CLOCK / 3, 396, 8, 248, 256, 16, 240);
screen.set_screen_update(FUNC(jailbrek_state::screen_update));
screen.set_palette(m_palette);
screen.screen_vblank().set(FUNC(jailbrek_state::vblank_irq));
- /* sound hardware */
+ // sound hardware
SPEAKER(config, "mono").front_center();
- SN76489A(config, "snsnd", MASTER_CLOCK/12).add_route(ALL_OUTPUTS, "mono", 1.0);
+ SN76489A(config, "snsnd", MASTER_CLOCK / 12).add_route(ALL_OUTPUTS, "mono", 1.0);
VLM5030(config, m_vlm, VOICE_CLOCK);
m_vlm->add_route(ALL_OUTPUTS, "mono", 1.0);
@@ -298,8 +460,8 @@ void jailbrek_state::jailbrek(machine_config &config)
***************************************************************************/
/*
- Check if the rom used for the speech is not a 2764, but a 27128. If a
- 27128 is used then the data is stored in the upper half of the eprom.
+ Check if the ROM used for the speech is not a 2764, but a 27128. If a
+ 27128 is used then the data is stored in the upper half of the EPROM.
(The schematics and board refer to a 2764, but all the boards I have seen
use a 27128. According to the schematics pin 26 is tied high so if a 2764
is used then the pin is ignored, but if a 27128 is used then pin 26
@@ -311,23 +473,23 @@ ROM_START( jailbrek )
ROM_LOAD( "507p03.11d", 0x8000, 0x4000, CRC(a0b88dfd) SHA1(f999e382b9d3b812fca41f4d0da3ea692fef6b19) )
ROM_LOAD( "507p02.9d", 0xc000, 0x4000, CRC(444b7d8e) SHA1(c708b67c2d249448dae9a3d10c24d13ba6849597) )
- ROM_REGION( 0x08000, "gfx1", 0 )
- ROM_LOAD( "507l08.4f", 0x0000, 0x4000, CRC(e3b7a226) SHA1(c19a02a2def65648bf198fccec98ebbd2fc7c0fb) ) /* characters */
+ ROM_REGION( 0x08000, "tiles", 0 )
+ ROM_LOAD( "507l08.4f", 0x0000, 0x4000, CRC(e3b7a226) SHA1(c19a02a2def65648bf198fccec98ebbd2fc7c0fb) )
ROM_LOAD( "507j09.5f", 0x4000, 0x4000, CRC(504f0912) SHA1(b51a45dd5506bccdf0061dd6edd7f49ac86ed0f8) )
- ROM_REGION( 0x10000, "gfx2", 0 )
- ROM_LOAD( "507j04.3e", 0x0000, 0x4000, CRC(0d269524) SHA1(a10ddb405e884bfec521a3c7a29d22f63e535b59) ) /* sprites */
+ ROM_REGION( 0x10000, "sprites", 0 )
+ ROM_LOAD( "507j04.3e", 0x0000, 0x4000, CRC(0d269524) SHA1(a10ddb405e884bfec521a3c7a29d22f63e535b59) )
ROM_LOAD( "507j05.4e", 0x4000, 0x4000, CRC(27d4f6f4) SHA1(c42c064dbd7c5cf0b1d99651367e0bee1728a5b0) )
ROM_LOAD( "507j06.5e", 0x8000, 0x4000, CRC(717485cb) SHA1(22609489186dcb3d7cd49b7ddfdc6f04d0739354) )
ROM_LOAD( "507j07.3f", 0xc000, 0x4000, CRC(e933086f) SHA1(c0fd1e8d23c0f7e14c0b75f629448034420cf8ef) )
ROM_REGION( 0x0240, "proms", 0 )
- ROM_LOAD( "507j10.1f", 0x0000, 0x0020, CRC(f1909605) SHA1(91eaa865375b3bc052897732b64b1ff7df3f78f6) ) /* red & green */
- ROM_LOAD( "507j11.2f", 0x0020, 0x0020, CRC(f70bb122) SHA1(bf77990260e8346faa3d3481718cbe46a4a27150) ) /* blue */
- ROM_LOAD( "507j13.7f", 0x0040, 0x0100, CRC(d4fe5c97) SHA1(972e9dab6c53722545dd3a43e3ada7921e88708b) ) /* char lookup */
- ROM_LOAD( "507j12.6f", 0x0140, 0x0100, CRC(0266c7db) SHA1(a8f21e86e6d974c9bfd92a147689d0e7316d66e2) ) /* sprites lookup */
+ ROM_LOAD( "507j10.1f", 0x0000, 0x0020, CRC(f1909605) SHA1(91eaa865375b3bc052897732b64b1ff7df3f78f6) ) // red & green
+ ROM_LOAD( "507j11.2f", 0x0020, 0x0020, CRC(f70bb122) SHA1(bf77990260e8346faa3d3481718cbe46a4a27150) ) // blue
+ ROM_LOAD( "507j13.7f", 0x0040, 0x0100, CRC(d4fe5c97) SHA1(972e9dab6c53722545dd3a43e3ada7921e88708b) ) // char lookup
+ ROM_LOAD( "507j12.6f", 0x0140, 0x0100, CRC(0266c7db) SHA1(a8f21e86e6d974c9bfd92a147689d0e7316d66e2) ) // sprites lookup
- ROM_REGION( 0x4000, "vlm", 0 ) /* speech rom */
+ ROM_REGION( 0x4000, "vlm", 0 ) // speech
ROM_LOAD( "507l01.8c", 0x0000, 0x4000, CRC(0c8a3605) SHA1(d886b66d3861c3a90a1825ccf5bf0011831ca366) ) // same data in both halves
ROM_END
@@ -336,23 +498,23 @@ ROM_START( manhatan )
ROM_LOAD( "507n03.11d", 0x8000, 0x4000, CRC(e5039f7e) SHA1(0f12484ed40444d978e0405c27bdd027ae2e2a0b) )
ROM_LOAD( "507n02.9d", 0xc000, 0x4000, CRC(143cc62c) SHA1(9520dbb1b6f1fa439e03d4caa9bed96ef8f805f2) )
- ROM_REGION( 0x08000, "gfx1", 0 )
- ROM_LOAD( "507j08.4f", 0x0000, 0x4000, CRC(175e1b49) SHA1(4cfe982cdf7729bd05c6da803480571876320bf6) ) /* characters */
+ ROM_REGION( 0x08000, "tiles", 0 )
+ ROM_LOAD( "507j08.4f", 0x0000, 0x4000, CRC(175e1b49) SHA1(4cfe982cdf7729bd05c6da803480571876320bf6) )
ROM_LOAD( "507j09.5f", 0x4000, 0x4000, CRC(504f0912) SHA1(b51a45dd5506bccdf0061dd6edd7f49ac86ed0f8) )
- ROM_REGION( 0x10000, "gfx2", 0 )
- ROM_LOAD( "507j04.3e", 0x0000, 0x4000, CRC(0d269524) SHA1(a10ddb405e884bfec521a3c7a29d22f63e535b59) ) /* sprites */
+ ROM_REGION( 0x10000, "sprites", 0 )
+ ROM_LOAD( "507j04.3e", 0x0000, 0x4000, CRC(0d269524) SHA1(a10ddb405e884bfec521a3c7a29d22f63e535b59) )
ROM_LOAD( "507j05.4e", 0x4000, 0x4000, CRC(27d4f6f4) SHA1(c42c064dbd7c5cf0b1d99651367e0bee1728a5b0) )
ROM_LOAD( "507j06.5e", 0x8000, 0x4000, CRC(717485cb) SHA1(22609489186dcb3d7cd49b7ddfdc6f04d0739354) )
ROM_LOAD( "507j07.3f", 0xc000, 0x4000, CRC(e933086f) SHA1(c0fd1e8d23c0f7e14c0b75f629448034420cf8ef) )
ROM_REGION( 0x0240, "proms", 0 )
- ROM_LOAD( "507j10.1f", 0x0000, 0x0020, CRC(f1909605) SHA1(91eaa865375b3bc052897732b64b1ff7df3f78f6) ) /* red & green */
- ROM_LOAD( "507j11.2f", 0x0020, 0x0020, CRC(f70bb122) SHA1(bf77990260e8346faa3d3481718cbe46a4a27150) ) /* blue */
- ROM_LOAD( "507j13.7f", 0x0040, 0x0100, CRC(d4fe5c97) SHA1(972e9dab6c53722545dd3a43e3ada7921e88708b) ) /* char lookup */
- ROM_LOAD( "507j12.6f", 0x0140, 0x0100, CRC(0266c7db) SHA1(a8f21e86e6d974c9bfd92a147689d0e7316d66e2) ) /* sprites lookup */
+ ROM_LOAD( "507j10.1f", 0x0000, 0x0020, CRC(f1909605) SHA1(91eaa865375b3bc052897732b64b1ff7df3f78f6) ) // red & green
+ ROM_LOAD( "507j11.2f", 0x0020, 0x0020, CRC(f70bb122) SHA1(bf77990260e8346faa3d3481718cbe46a4a27150) ) // blue
+ ROM_LOAD( "507j13.7f", 0x0040, 0x0100, CRC(d4fe5c97) SHA1(972e9dab6c53722545dd3a43e3ada7921e88708b) ) // char lookup
+ ROM_LOAD( "507j12.6f", 0x0140, 0x0100, CRC(0266c7db) SHA1(a8f21e86e6d974c9bfd92a147689d0e7316d66e2) ) // sprites lookup
- ROM_REGION( 0x4000, "vlm", 0 ) /* speech rom */
+ ROM_REGION( 0x4000, "vlm", 0 ) // speech
ROM_LOAD( "507p01.8c", 0x2000, 0x2000, CRC(973fa351) SHA1(ac360d05ed4d03334e00c80e70d5ae939d93af5f) ) // top half is blank
ROM_CONTINUE( 0x0000, 0x2000 )
ROM_END
@@ -425,20 +587,20 @@ ROM_START( jailbrekb )
ROM_REGION( 0x10000, "maincpu", 0 )
ROM_LOAD( "1.k6", 0x8000, 0x8000, CRC(df0e8fc7) SHA1(62e59dbb3941ed8af365e96906315318d9aee060) )
- ROM_REGION( 0x08000, "gfx1", 0 ) /* characters */
+ ROM_REGION( 0x08000, "tiles", 0 )
ROM_LOAD( "3.h6", 0x0000, 0x8000, CRC(bf67a8ff) SHA1(9aca8de7e2c2cc0ff9fe3f316a9300574df4ff06) )
- ROM_REGION( 0x10000, "gfx2", 0 ) /* sprites */
+ ROM_REGION( 0x10000, "sprites", 0 )
ROM_LOAD( "5.f6", 0x0000, 0x8000, CRC(081d2eea) SHA1(dae66b2607d1a56e72e9cb456bdb3c0c21337d6c) )
ROM_LOAD( "4.g6", 0x8000, 0x8000, CRC(e34b93b8) SHA1(fb6ed12ab017ac1e5006165f435cf0ed95a49c17) )
ROM_REGION( 0x0240, "proms", 0 )
- ROM_LOAD( "prom.j2", 0x0000, 0x0020, CRC(f1909605) SHA1(91eaa865375b3bc052897732b64b1ff7df3f78f6) ) /* red & green */
- ROM_LOAD( "prom.i2", 0x0020, 0x0020, CRC(f70bb122) SHA1(bf77990260e8346faa3d3481718cbe46a4a27150) ) /* blue */
- ROM_LOAD( "prom.d6", 0x0040, 0x0100, CRC(d4fe5c97) SHA1(972e9dab6c53722545dd3a43e3ada7921e88708b) ) /* char lookup */
- ROM_LOAD( "prom.e6", 0x0140, 0x0100, CRC(0266c7db) SHA1(a8f21e86e6d974c9bfd92a147689d0e7316d66e2) ) /* sprites lookup */
+ ROM_LOAD( "prom.j2", 0x0000, 0x0020, CRC(f1909605) SHA1(91eaa865375b3bc052897732b64b1ff7df3f78f6) ) // red & green
+ ROM_LOAD( "prom.i2", 0x0020, 0x0020, CRC(f70bb122) SHA1(bf77990260e8346faa3d3481718cbe46a4a27150) ) // blue
+ ROM_LOAD( "prom.d6", 0x0040, 0x0100, CRC(d4fe5c97) SHA1(972e9dab6c53722545dd3a43e3ada7921e88708b) ) // char lookup
+ ROM_LOAD( "prom.e6", 0x0140, 0x0100, CRC(0266c7db) SHA1(a8f21e86e6d974c9bfd92a147689d0e7316d66e2) ) // sprites lookup
- ROM_REGION( 0x2000, "vlm", 0 ) /* speech rom */
+ ROM_REGION( 0x2000, "vlm", 0 ) // speech
ROM_LOAD( "2.i6", 0x0000, 0x2000, CRC(d91d15e3) SHA1(475fe50aafbf8f2fb79880ef0e2c25158eda5270) )
ROM_REGION( 0x800, "plds", 0 )
@@ -448,6 +610,9 @@ ROM_START( jailbrekb )
ROM_LOAD( "pal16l8.k8", 0x600, 0x104, CRC(38783f49) SHA1(101621b378bb9b5faad7d8e3acdbaa42b5045d45) )
ROM_END
+} // anonymous namespace
+
+
GAME( 1986, jailbrek, 0, jailbrek, jailbrek, jailbrek_state, empty_init, ROT0, "Konami", "Jail Break", MACHINE_SUPPORTS_SAVE )
GAME( 1986, jailbrekb, jailbrek, jailbrek, jailbrek, jailbrek_state, empty_init, ROT0, "bootleg", "Jail Break (bootleg)", MACHINE_SUPPORTS_SAVE )
GAME( 1986, manhatan, jailbrek, jailbrek, jailbrek, jailbrek_state, empty_init, ROT0, "Konami", "Manhattan 24 Bunsyo (Japan)", MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/konami/jailbrek.h b/src/mame/konami/jailbrek.h
deleted file mode 100644
index 8293de3da0a..00000000000
--- a/src/mame/konami/jailbrek.h
+++ /dev/null
@@ -1,77 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Ernesto Corvi
-/***************************************************************************
-
- Jailbreak
-
-***************************************************************************/
-#ifndef MAME_INCLUDES_JAILBREK_H
-#define MAME_INCLUDES_JAILBREK_H
-
-#pragma once
-
-#include "sound/vlm5030.h"
-#include "emupal.h"
-#include "tilemap.h"
-
-#define MASTER_CLOCK XTAL(18'432'000)
-#define VOICE_CLOCK XTAL(3'579'545)
-
-class jailbrek_state : public driver_device
-{
-public:
- jailbrek_state(const machine_config &mconfig, device_type type, const char *tag) :
- driver_device(mconfig, type, tag),
- m_colorram(*this, "colorram"),
- m_videoram(*this, "videoram"),
- m_spriteram(*this, "spriteram"),
- m_scroll_x(*this, "scroll_x"),
- m_scroll_dir(*this, "scroll_dir"),
- m_maincpu(*this, "maincpu"),
- m_vlm(*this, "vlm"),
- m_gfxdecode(*this, "gfxdecode"),
- m_palette(*this, "palette")
- { }
-
- void jailbrek(machine_config &config);
-
-private:
- /* memory pointers */
- required_shared_ptr<uint8_t> m_colorram;
- required_shared_ptr<uint8_t> m_videoram;
- required_shared_ptr<uint8_t> m_spriteram;
- required_shared_ptr<uint8_t> m_scroll_x;
- required_shared_ptr<uint8_t> m_scroll_dir;
-
- /* devices */
- required_device<cpu_device> m_maincpu;
- required_device<vlm5030_device> m_vlm;
- required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
-
- /* video-related */
- tilemap_t *m_bg_tilemap = nullptr;
-
- /* misc */
- uint8_t m_irq_enable = 0U;
- uint8_t m_nmi_enable = 0U;
- void ctrl_w(uint8_t data);
- void coin_w(uint8_t data);
- void videoram_w(offs_t offset, uint8_t data);
- void colorram_w(offs_t offset, uint8_t data);
- uint8_t speech_r();
- void speech_w(uint8_t data);
- TILE_GET_INFO_MEMBER(get_bg_tile_info);
- virtual void machine_start() override;
- virtual void machine_reset() override;
- virtual void video_start() override;
- void jailbrek_palette(palette_device &palette) const;
- uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- DECLARE_WRITE_LINE_MEMBER(vblank_irq);
- INTERRUPT_GEN_MEMBER(interrupt_nmi);
- void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
- void jailbrek_map(address_map &map);
- void vlm_map(address_map &map);
-};
-
-#endif // MAME_INCLUDES_JAILBREK_H
diff --git a/src/mame/konami/jailbrek_v.cpp b/src/mame/konami/jailbrek_v.cpp
deleted file mode 100644
index 92001a443ab..00000000000
--- a/src/mame/konami/jailbrek_v.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Ernesto Corvi
-#include "emu.h"
-#include "jailbrek.h"
-
-void jailbrek_state::jailbrek_palette(palette_device &palette) const
-{
- const uint8_t *color_prom = memregion("proms")->base();
-
- // create a lookup table for the palette
- for (int i = 0; i < 0x20; i++)
- {
- int const r = pal4bit(color_prom[i + 0x00] >> 0);
- int const g = pal4bit(color_prom[i + 0x00] >> 4);
- int const b = pal4bit(color_prom[i + 0x20] >> 0);
-
- palette.set_indirect_color(i, rgb_t(r, g, b));
- }
-
- // color_prom now points to the beginning of the lookup table
- color_prom += 0x40;
-
- for (int i = 0; i < 0x100; i++)
- {
- uint8_t const ctabentry = (color_prom[i] & 0x0f) | 0x10;
- palette.set_pen_indirect(i, ctabentry);
- }
-
- for (int i = 0x100; i < 0x200; i++)
- {
- uint8_t const ctabentry = color_prom[i] & 0x0f;
- palette.set_pen_indirect(i, ctabentry);
- }
-}
-
-void jailbrek_state::videoram_w(offs_t offset, uint8_t data)
-{
- m_videoram[offset] = data;
- m_bg_tilemap->mark_tile_dirty(offset);
-}
-
-void jailbrek_state::colorram_w(offs_t offset, uint8_t data)
-{
- m_colorram[offset] = data;
- m_bg_tilemap->mark_tile_dirty(offset);
-}
-
-TILE_GET_INFO_MEMBER(jailbrek_state::get_bg_tile_info)
-{
- int attr = m_colorram[tile_index];
- int code = m_videoram[tile_index] + ((attr & 0xc0) << 2);
- int color = attr & 0x0f;
-
- tileinfo.set(0, code, color, 0);
-}
-
-void jailbrek_state::video_start()
-{
- m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(jailbrek_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
-}
-
-void jailbrek_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
-{
- uint8_t *spriteram = m_spriteram;
- int i;
-
- for (i = 0; i < m_spriteram.bytes(); i += 4)
- {
- int attr = spriteram[i + 1]; // attributes = ?tyxcccc
- int code = spriteram[i] + ((attr & 0x40) << 2);
- int color = attr & 0x0f;
- int flipx = attr & 0x10;
- int flipy = attr & 0x20;
- int sx = spriteram[i + 2] - ((attr & 0x80) << 1);
- int sy = spriteram[i + 3];
-
- if (flip_screen())
- {
- sx = 240 - sx;
- sy = 240 - sy;
- flipx = !flipx;
- flipy = !flipy;
- }
-
- m_gfxdecode->gfx(1)->transmask(bitmap,cliprect, code, color, flipx, flipy,
- sx, sy,
- m_palette->transpen_mask(*m_gfxdecode->gfx(1), color, 0));
- }
-}
-
-uint32_t jailbrek_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
-{
- int i;
-
- // added support for vertical scrolling (credits). 23/1/2002 -BR
- // bit 2 appears to be horizontal/vertical scroll control
- if (m_scroll_dir[0] & 0x04)
- {
- m_bg_tilemap->set_scroll_cols(32);
- m_bg_tilemap->set_scroll_rows(1);
- m_bg_tilemap->set_scrollx(0, 0);
-
- for (i = 0; i < 32; i++)
- m_bg_tilemap->set_scrolly(i, ((m_scroll_x[i + 32] << 8) + m_scroll_x[i]));
- }
- else
- {
- m_bg_tilemap->set_scroll_rows(32);
- m_bg_tilemap->set_scroll_cols(1);
- m_bg_tilemap->set_scrolly(0, 0);
-
- for (i = 0; i < 32; i++)
- m_bg_tilemap->set_scrollx(i, ((m_scroll_x[i + 32] << 8) + m_scroll_x[i]));
- }
-
- m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
- draw_sprites(bitmap, cliprect);
- return 0;
-}