summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
author Ivan Vangelista <mesgnet@yahoo.it>2022-04-12 12:57:32 +0200
committer Ivan Vangelista <mesgnet@yahoo.it>2022-04-12 12:57:32 +0200
commitce68a1d711a952a815833856b00bd7a00e28bb1f (patch)
treef1c82268744bd4f2403538bf509f0e33242541d6 /src
parent492b0e0df23dd663c9c1ff844377f717eb23c894 (diff)
New working clones
------------------ Blood Storm (v2.21) [coolmod] angelkds.cpp, crgolf.cpp: finders and other small cleanups
Diffstat (limited to 'src')
-rw-r--r--src/mame/drivers/angelkds.cpp479
-rw-r--r--src/mame/drivers/crgolf.cpp495
-rw-r--r--src/mame/drivers/itech32.cpp54
-rw-r--r--src/mame/includes/angelkds.h87
-rw-r--r--src/mame/includes/crgolf.h95
-rw-r--r--src/mame/mame.lst9
-rw-r--r--src/mame/video/angelkds.cpp265
-rw-r--r--src/mame/video/crgolf.cpp131
8 files changed, 758 insertions, 857 deletions
diff --git a/src/mame/drivers/angelkds.cpp b/src/mame/drivers/angelkds.cpp
index 28f85df65de..2503b7248af 100644
--- a/src/mame/drivers/angelkds.cpp
+++ b/src/mame/drivers/angelkds.cpp
@@ -18,15 +18,16 @@ for details on this encryption scheme
*/
-/* started 23/01/2002 */
+// started 23/01/2002
-/* notes / todo:
+/* notes / TODO:
-Unknown Reads / Writes
-Whats the Prom for? nothing important?
-the progress sprite on the side of the screen re-appears at the bottom when you get
-to the top, but the wrap-around is needed for other things, actual game bug?
-Angel Kids service mode doesn't seem to work, did it ever?
+* Unknown Reads / Writes
+* Whats the PROM for? nothing important?
+ the progress sprite on the side of the screen re-appears at the bottom when you get
+ to the top, but the wrap-around is needed for other things, actual game bug?
+* Angel Kids service mode doesn't seem to work, did it ever?
+* Enable / disable tilemap bits might be wrong
*/
@@ -126,30 +127,279 @@ Dumped by Chackn
#include "emu.h"
-#include "includes/angelkds.h"
+
+#include "machine/segacrp2_device.h"
#include "cpu/z80/z80.h"
#include "machine/i8255.h"
-#include "machine/segacrp2_device.h"
#include "sound/ymopn.h"
#include "emupal.h"
#include "screen.h"
#include "speaker.h"
+#include "tilemap.h"
+
+
+namespace {
+
+class angelkds_state : public driver_device
+{
+public:
+ angelkds_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
+ m_bgvideoram(*this, "bgvideoram%u", 0U),
+ m_txvideoram(*this, "txvideoram"),
+ m_spriteram(*this, "spriteram"),
+ m_decrypted_opcodes(*this, "decrypted_opcodes"),
+ m_mainbank(*this, "mainbank"),
+ m_maincpu(*this, "maincpu"),
+ m_audiocpu(*this, "audiocpu"),
+ m_gfxdecode(*this, "gfxdecode")
+ { }
+
+ void angelkds(machine_config &config);
+ void spcpostn(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_array<uint8_t, 2> m_bgvideoram;
+ required_shared_ptr<uint8_t> m_txvideoram;
+ required_shared_ptr<uint8_t> m_spriteram;
+ optional_shared_ptr<uint8_t> m_decrypted_opcodes;
+ required_memory_bank m_mainbank;
+
+ // devices
+ required_device<cpu_device> m_maincpu;
+ required_device<cpu_device> m_audiocpu;
+ required_device<gfxdecode_device> m_gfxdecode;
+
+ tilemap_t *m_tx_tilemap = nullptr;
+ tilemap_t *m_bg_tilemap[2]{};
+ uint8_t m_txbank = 0;
+ uint8_t m_bgbank[2]{};
+
+ uint8_t m_sound[4]{};
+ uint8_t m_sound2[4]{};
+ uint8_t m_layer_ctrl = 0;
+
+ void cpu_bank_w(uint8_t data);
+ void main_sound_w(offs_t offset, uint8_t data);
+ uint8_t main_sound_r(offs_t offset);
+ void audio_sound_w(offs_t offset, uint8_t data);
+ uint8_t audio_sound_r(offs_t offset);
+ void txvideoram_w(offs_t offset, uint8_t data);
+ void txbank_w(uint8_t data);
+ template <uint8_t Which> void bgvideoram_w(offs_t offset, uint8_t data);
+ template <uint8_t Which> void bgbank_w(uint8_t data);
+ template <uint8_t Which> void bgscroll_w(uint8_t data);
+ void layer_ctrl_w(uint8_t data);
+ TILE_GET_INFO_MEMBER(get_tx_tile_info);
+ template <uint8_t Which> TILE_GET_INFO_MEMBER(get_bg_tile_info);
+ uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int enable_n);
+
+ void decrypted_opcodes_map(address_map &map);
+ void main_map(address_map &map);
+ void main_portmap(address_map &map);
+ void sound_map(address_map &map);
+ void sound_portmap(address_map &map);
+};
+
+
+// video
+
+// Text Layer Tilemap
+
+TILE_GET_INFO_MEMBER(angelkds_state::get_tx_tile_info)
+{
+ int tileno = m_txvideoram[tile_index] + (m_txbank * 0x100);
+ tileinfo.set(0, tileno, 0, 0);
+}
+
+void angelkds_state::txvideoram_w(offs_t offset, uint8_t data)
+{
+ m_txvideoram[offset] = data;
+ m_tx_tilemap->mark_tile_dirty(offset);
+}
+
+void angelkds_state::txbank_w(uint8_t data)
+{
+ if (m_txbank != data)
+ {
+ m_txbank = data;
+ m_tx_tilemap->mark_all_dirty();
+ }
+}
+
+// Top (0) and Bottom (1) Half Background Tilemap
+
+template <uint8_t Which>
+TILE_GET_INFO_MEMBER(angelkds_state::get_bg_tile_info)
+{
+ int tileno = m_bgvideoram[Which][tile_index];
+
+ tileno += m_bgbank[Which] * 0x100 ;
+ tileinfo.set(Which + 1, tileno, Which, 0);
+}
+
+template <uint8_t Which>
+void angelkds_state::bgvideoram_w(offs_t offset, uint8_t data)
+{
+ m_bgvideoram[Which][offset] = data;
+ m_bg_tilemap[Which]->mark_tile_dirty(offset);
+}
+
+template <uint8_t Which>
+void angelkds_state::bgbank_w(uint8_t data)
+{
+ if (m_bgbank[Which] != data)
+ {
+ m_bgbank[Which] = data;
+ m_bg_tilemap[Which]->mark_all_dirty();
+ }
+}
+
+template <uint8_t Which>
+void angelkds_state::bgscroll_w(uint8_t data)
+{
+ m_bg_tilemap[Which]->set_scrollx(0, data);
+}
+
+void angelkds_state::layer_ctrl_w(uint8_t data)
+{
+ m_layer_ctrl = data;
+}
+/* Sprites
-/*** CPU Banking
+the sprites are similar to the tilemaps in the sense that there is
+a split down the middle of the screen
*/
-void angelkds_state::angelkds_cpu_bank_write(uint8_t data)
+void angelkds_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int enable_n)
{
- membank("bank1")->set_entry(data & 0x0f); // shall we check (data & 0x0f) < # of available banks (8 or 10 resp.)?
+ const uint8_t *source = m_spriteram + 0x100 - 4;
+ const uint8_t *finish = m_spriteram;
+ gfx_element *gfx = m_gfxdecode->gfx(3);
+
+ while (source >= finish)
+ {
+ /*
+
+ nnnn nnnn - EeFf B?cc - yyyy yyyy - xxxx xxxx
+
+ n = sprite number
+ E = Sprite Enabled in Top Half of Screen
+ e = Sprite Enabled in Bottom Half of Screen
+ F = Flip Y
+ f = Flip X
+ B = Tile Bank
+ ? = unknown, nothing / unused? recheck
+ c = color
+ y = Y position
+ x = X position
+
+ */
+ uint16_t tile_no = source[0];
+ uint8_t attr = source[1];
+ uint8_t ypos = source[2];
+ uint8_t xpos = source[3];
+
+ uint8_t enable = attr & 0xc0;
+ uint8_t flipx = (attr & 0x10) >> 4;
+ uint8_t flipy = (attr & 0x20) >> 5;
+ uint8_t bank = attr & 0x08;
+ uint8_t color = attr & 0x03;
+
+ if (bank)
+ tile_no += 0x100;
+
+ ypos = 0xff - ypos;
+
+ if (enable & enable_n)
+ {
+ gfx->transpen(bitmap, cliprect, tile_no, color * 4, flipx, flipy, xpos, ypos, 15);
+ // wraparound
+ if (xpos > 240)
+ gfx->transpen(bitmap, cliprect, tile_no, color * 4, flipx, flipy, xpos - 256, ypos, 15);
+ // wraparound
+ if (ypos > 240)
+ {
+ gfx->transpen(bitmap, cliprect, tile_no, color * 4, flipx, flipy, xpos, ypos - 256, 15);
+ // wraparound
+ if (xpos > 240)
+ gfx->transpen(bitmap, cliprect, tile_no, color * 4, flipx, flipy, xpos - 256, ypos - 256, 15);
+ }
+ }
+
+ source -= 0x04;
+ }
+}
+
+
+// Video Start & Update
+
+void angelkds_state::video_start()
+{
+ m_tx_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(angelkds_state::get_tx_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
+ m_tx_tilemap->set_transparent_pen(0);
+
+ m_bg_tilemap[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(angelkds_state::get_bg_tile_info<1>)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
+ m_bg_tilemap[1]->set_transparent_pen(15);
+
+ m_bg_tilemap[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(angelkds_state::get_bg_tile_info<0>)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
+ m_bg_tilemap[0]->set_transparent_pen(15);
+}
+
+// enable bits are uncertain
+
+uint32_t angelkds_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+{
+ const rectangle &visarea = screen.visible_area();
+ rectangle clip;
+
+ bitmap.fill(0x3f, cliprect); // is there a register controlling the colour?, we currently use the last colour of the tx palette
+
+ // draw top of screen
+ clip.set(8 * 0, 8 * 16 - 1, visarea.min_y, visarea.max_y);
+
+ if ((m_layer_ctrl & 0x80) == 0x00)
+ m_bg_tilemap[0]->draw(screen, bitmap, clip, 0, 0);
+
+ draw_sprites(bitmap, clip, 0x80);
+
+ if ((m_layer_ctrl & 0x20) == 0x00)
+ m_tx_tilemap->draw(screen, bitmap, clip, 0, 0);
+
+ // draw bottom of screen
+ clip.set(8 * 16, 8 * 32 - 1, visarea.min_y, visarea.max_y);
+
+ if ((m_layer_ctrl & 0x40) == 0x00)
+ m_bg_tilemap[1]->draw(screen, bitmap, clip, 0, 0);
+
+ draw_sprites(bitmap, clip, 0x40);
+
+ if ((m_layer_ctrl & 0x20) == 0x00)
+ m_tx_tilemap->draw(screen, bitmap, clip, 0, 0);
+
+ return 0;
}
+// machine
+// CPU Banking
+void angelkds_state::cpu_bank_w(uint8_t data)
+{
+ m_mainbank->set_entry(data & 0x0f); // shall we check (data & 0x0f) < # of available banks (8 or 10 resp.)?
+}
/*** Memory Structures
@@ -171,27 +421,27 @@ contain a level.
void angelkds_state::main_map(address_map &map)
{
map(0x0000, 0x7fff).rom();
- map(0x8000, 0xbfff).bankr("bank1");
+ map(0x8000, 0xbfff).bankr(m_mainbank);
map(0xc000, 0xdfff).ram();
- map(0xe000, 0xe3ff).ram().w(FUNC(angelkds_state::angelkds_bgtopvideoram_w)).share("bgtopvideoram"); /* Top Half of Screen */
- map(0xe400, 0xe7ff).ram().w(FUNC(angelkds_state::angelkds_bgbotvideoram_w)).share("bgbotvideoram"); /* Bottom Half of Screen */
- map(0xe800, 0xebff).ram().w(FUNC(angelkds_state::angelkds_txvideoram_w)).share("txvideoram");
- map(0xec00, 0xecff).ram().share("spriteram");
+ map(0xe000, 0xe3ff).ram().w(FUNC(angelkds_state::bgvideoram_w<0>)).share(m_bgvideoram[0]); // Top Half of Screen
+ map(0xe400, 0xe7ff).ram().w(FUNC(angelkds_state::bgvideoram_w<1>)).share(m_bgvideoram[1]); // Bottom Half of Screen
+ map(0xe800, 0xebff).ram().w(FUNC(angelkds_state::txvideoram_w)).share(m_txvideoram);
+ map(0xec00, 0xecff).ram().share(m_spriteram);
map(0xed00, 0xedff).ram().w("palette", FUNC(palette_device::write8)).share("palette");
map(0xee00, 0xeeff).ram().w("palette", FUNC(palette_device::write8_ext)).share("palette_ext");
map(0xef00, 0xefff).ram();
- map(0xf000, 0xf000).w(FUNC(angelkds_state::angelkds_bgtopbank_write));
- map(0xf001, 0xf001).w(FUNC(angelkds_state::angelkds_bgtopscroll_write));
- map(0xf002, 0xf002).w(FUNC(angelkds_state::angelkds_bgbotbank_write));
- map(0xf003, 0xf003).w(FUNC(angelkds_state::angelkds_bgbotscroll_write));
- map(0xf004, 0xf004).w(FUNC(angelkds_state::angelkds_txbank_write));
- map(0xf005, 0xf005).w(FUNC(angelkds_state::angelkds_layer_ctrl_write));
+ map(0xf000, 0xf000).w(FUNC(angelkds_state::bgbank_w<0>));
+ map(0xf001, 0xf001).w(FUNC(angelkds_state::bgscroll_w<0>));
+ map(0xf002, 0xf002).w(FUNC(angelkds_state::bgbank_w<1>));
+ map(0xf003, 0xf003).w(FUNC(angelkds_state::bgscroll_w<1>));
+ map(0xf004, 0xf004).w(FUNC(angelkds_state::txbank_w));
+ map(0xf005, 0xf005).w(FUNC(angelkds_state::layer_ctrl_w));
}
void angelkds_state::decrypted_opcodes_map(address_map &map)
{
- map(0x0000, 0x7fff).rom().share("decrypted_opcodes");
- map(0x8000, 0xbfff).bankr("bank1");
+ map(0x0000, 0x7fff).rom().share(m_decrypted_opcodes);
+ map(0x8000, 0xbfff).bankr(m_mainbank);
}
void angelkds_state::main_portmap(address_map &map)
@@ -202,16 +452,16 @@ void angelkds_state::main_portmap(address_map &map)
map(0x40, 0x43).rw("ppi8255_0", FUNC(i8255_device::read), FUNC(i8255_device::write));
map(0x80, 0x83).rw("ppi8255_1", FUNC(i8255_device::read), FUNC(i8255_device::write));
- map(0xc0, 0xc3).rw(FUNC(angelkds_state::angelkds_main_sound_r), FUNC(angelkds_state::angelkds_main_sound_w)); // 02 various points
+ map(0xc0, 0xc3).rw(FUNC(angelkds_state::main_sound_r), FUNC(angelkds_state::main_sound_w)); // 02 various points
}
-/* sub cpu */
+// audio CPU
-void angelkds_state::sub_map(address_map &map)
+void angelkds_state::sound_map(address_map &map)
{
map(0x0000, 0x7fff).rom();
map(0x8000, 0x87ff).ram();
@@ -220,16 +470,16 @@ void angelkds_state::sub_map(address_map &map)
map(0xaaac, 0xaaac).nopr();
}
-void angelkds_state::sub_portmap(address_map &map)
+void angelkds_state::sound_portmap(address_map &map)
{
map.global_mask(0xff);
map(0x00, 0x01).rw("ym1", FUNC(ym2203_device::read), FUNC(ym2203_device::write));
map(0x40, 0x41).rw("ym2", FUNC(ym2203_device::read), FUNC(ym2203_device::write));
- map(0x80, 0x83).rw(FUNC(angelkds_state::angelkds_sub_sound_r), FUNC(angelkds_state::angelkds_sub_sound_w)); // spcpostn
+ map(0x80, 0x83).rw(FUNC(angelkds_state::audio_sound_r), FUNC(angelkds_state::audio_sound_w)); // spcpostn
}
-/* Input Ports */
+// Input Ports
#define ANGELDSK_PLAYERS_INPUT( player ) \
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_UP ) PORT_PLAYER(player) PORT_8WAY \
@@ -249,18 +499,18 @@ static INPUT_PORTS_START( angelkds )
Joystick Test: Set SW1:1-7 ON & SW1:8 OFF (A:Free Play & B:3C_1C), hold test switch and reboot.
Joystick Test Coin_A & Coin_B seem to be switched, only works when setting A to 3C_1C and B to Free Play.
*/
- PORT_START("I40") /* inport $40 */
+ PORT_START("I40") // inport $40
PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:1,2,3,4")
PORT_DIPSETTING( 0x70, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x80, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x90, DEF_STR( 2C_1C ) )
-// PORT_DIPSETTING( 0x60, DEF_STR( 2C_1C ) )
-// PORT_DIPSETTING( 0x50, DEF_STR( 2C_1C ) )
-// PORT_DIPSETTING( 0x40, DEF_STR( 2C_1C ) )
+ PORT_DIPSETTING( 0x60, DEF_STR( 2C_1C ) )
+ PORT_DIPSETTING( 0x50, DEF_STR( 2C_1C ) )
+ PORT_DIPSETTING( 0x40, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0xf0, DEF_STR( 1C_1C ) )
-// PORT_DIPSETTING( 0x30, DEF_STR( 1C_1C ) )
-// PORT_DIPSETTING( 0x20, DEF_STR( 1C_1C ) )
-// PORT_DIPSETTING( 0x10, DEF_STR( 1C_1C ) )
+ PORT_DIPSETTING( 0x30, DEF_STR( 1C_1C ) )
+ PORT_DIPSETTING( 0x20, DEF_STR( 1C_1C ) )
+ PORT_DIPSETTING( 0x10, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0xe0, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0xd0, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0xc0, DEF_STR( 1C_4C ) )
@@ -272,13 +522,13 @@ static INPUT_PORTS_START( angelkds )
PORT_DIPSETTING( 0x07, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x08, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x09, DEF_STR( 2C_1C ) )
-// PORT_DIPSETTING( 0x06, DEF_STR( 2C_1C ) )
-// PORT_DIPSETTING( 0x05, DEF_STR( 2C_1C ) )
-// PORT_DIPSETTING( 0x04, DEF_STR( 2C_1C ) )
+ PORT_DIPSETTING( 0x06, DEF_STR( 2C_1C ) )
+ PORT_DIPSETTING( 0x05, DEF_STR( 2C_1C ) )
+ PORT_DIPSETTING( 0x04, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x0f, DEF_STR( 1C_1C ) )
-// PORT_DIPSETTING( 0x03, DEF_STR( 1C_1C ) )
-// PORT_DIPSETTING( 0x02, DEF_STR( 1C_1C ) )
-// PORT_DIPSETTING( 0x01, DEF_STR( 1C_1C ) )
+ PORT_DIPSETTING( 0x03, DEF_STR( 1C_1C ) )
+ PORT_DIPSETTING( 0x02, DEF_STR( 1C_1C ) )
+ PORT_DIPSETTING( 0x01, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x0e, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x0d, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x0c, DEF_STR( 1C_4C ) )
@@ -286,7 +536,7 @@ static INPUT_PORTS_START( angelkds )
PORT_DIPSETTING( 0x0a, DEF_STR( 1C_6C ) )
PORT_DIPSETTING( 0x00, DEF_STR( Free_Play ) )
- PORT_START("I41") /* inport $41 */
+ PORT_START("I41") // inport $41
PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW2:1")
PORT_DIPSETTING( 0x00, DEF_STR( Upright ) )
PORT_DIPSETTING( 0x01, DEF_STR( Cocktail ) )
@@ -303,14 +553,14 @@ static INPUT_PORTS_START( angelkds )
PORT_DIPSETTING( 0x20, "4" )
PORT_DIPSETTING( 0x10, "5" )
PORT_DIPSETTING( 0x00, "99 (Cheat)" )
- PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:7,8") /* Stored at 0xc023 */
+ PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:7,8") // Stored at 0xc023
PORT_DIPSETTING( 0xc0, DEF_STR( Very_Easy ) )
PORT_DIPSETTING( 0x40, DEF_STR( Easy ) )
PORT_DIPSETTING( 0x80, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x00, DEF_STR( Very_Hard ) )
- PORT_START("I80") /* inport $80 */
+ PORT_START("I80") // inport $80
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
@@ -320,16 +570,16 @@ static INPUT_PORTS_START( angelkds )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
- PORT_START("I81") /* inport $81 */
+ PORT_START("I81") // inport $81
ANGELDSK_PLAYERS_INPUT( 1 )
- PORT_START("I82") /* inport $82 */
+ PORT_START("I82") // inport $82
ANGELDSK_PLAYERS_INPUT( 2 )
INPUT_PORTS_END
static INPUT_PORTS_START( spcpostn )
- PORT_START("I40") /* inport $40 */
+ PORT_START("I40") // inport $40
PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:1,2,3,4")
PORT_DIPSETTING( 0x02, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x05, DEF_STR( 3C_1C ) )
@@ -365,7 +615,7 @@ static INPUT_PORTS_START( spcpostn )
PORT_DIPSETTING( 0xa0, DEF_STR( 1C_6C ) )
PORT_DIPSETTING( 0x90, DEF_STR( 1C_7C ) )
- PORT_START("I41") /* inport $41 */
+ PORT_START("I41") // inport $41
PORT_DIPNAME( 0x01, 0x01, DEF_STR(Allow_Continue ) ) PORT_DIPLOCATION("SW2:1")
PORT_DIPSETTING( 0x01, DEF_STR( No ) )
PORT_DIPSETTING( 0x00, DEF_STR( Yes ) )
@@ -385,9 +635,9 @@ static INPUT_PORTS_START( spcpostn )
PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:7")
PORT_DIPSETTING( 0x40, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
- PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW2:8" ) /* Listed as "Unused" */
+ PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW2:8" ) // Listed as "Unused"
- PORT_START("I80") /* inport $80 */
+ PORT_START("I80") // inport $80
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
@@ -397,7 +647,7 @@ static INPUT_PORTS_START( spcpostn )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
- PORT_START("I81") /* inport $81 */
+ PORT_START("I81") // inport $81
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_8WAY
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_8WAY
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_8WAY
@@ -407,7 +657,7 @@ static INPUT_PORTS_START( spcpostn )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_PLAYER(1) // probably unused
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_PLAYER(1) // probably unused
- PORT_START("I82") /* inport $82 */
+ PORT_START("I82") // inport $82
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_8WAY
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_8WAY
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_8WAY
@@ -419,36 +669,36 @@ static INPUT_PORTS_START( spcpostn )
INPUT_PORTS_END
-/*** Sound Hardware
+/* Sound Hardware
-todo: verify / correct things
+TODO: verify / correct things
seems a bit strange are all the addresses really
sound related ?
*/
-void angelkds_state::angelkds_main_sound_w(offs_t offset, uint8_t data)
+void angelkds_state::main_sound_w(offs_t offset, uint8_t data)
{
m_sound[offset] = data;
}
-uint8_t angelkds_state::angelkds_main_sound_r(offs_t offset)
+uint8_t angelkds_state::main_sound_r(offs_t offset)
{
return m_sound2[offset];
}
-void angelkds_state::angelkds_sub_sound_w(offs_t offset, uint8_t data)
+void angelkds_state::audio_sound_w(offs_t offset, uint8_t data)
{
m_sound2[offset] = data;
}
-uint8_t angelkds_state::angelkds_sub_sound_r(offs_t offset)
+uint8_t angelkds_state::audio_sound_r(offs_t offset)
{
return m_sound[offset];
}
-/*** Graphics Decoding
+/* Graphics Decoding
all the 8x8 tiles are in one format, the 16x16 sprites in another
@@ -466,15 +716,15 @@ static const gfx_layout angelkds_spritelayout =
};
static GFXDECODE_START( gfx_angelkds )
- GFXDECODE_ENTRY( "gfx1", 0, gfx_8x8x4_packed_msb, 0x30, 1 )
- GFXDECODE_ENTRY( "gfx3", 0, gfx_8x8x4_packed_msb, 0, 16 )
- GFXDECODE_ENTRY( "gfx4", 0, gfx_8x8x4_packed_msb, 0, 16 )
- GFXDECODE_ENTRY( "gfx2", 0, angelkds_spritelayout, 0x20, 0x0d )
+ GFXDECODE_ENTRY( "chars", 0, gfx_8x8x4_packed_msb, 0x30, 1 )
+ GFXDECODE_ENTRY( "bgtiles_top", 0, gfx_8x8x4_packed_msb, 0, 16 )
+ GFXDECODE_ENTRY( "bgtiles_bottom", 0, gfx_8x8x4_packed_msb, 0, 16 )
+ GFXDECODE_ENTRY( "sprites", 0, angelkds_spritelayout, 0x20, 0x0d )
GFXDECODE_END
-/*** Machine Driver
+/* Machine Driver
- 2 x z80 (one for game, one for sound)
+ 2 x Z80 (one for game, one for sound)
2 x YM2203 (for sound)
all fairly straightforward
@@ -483,19 +733,19 @@ GFXDECODE_END
void angelkds_state::machine_start()
{
+ uint8_t *rom = memregion("banked_roms")->base();
+ m_mainbank->configure_entries(0, 16, &rom[0x0000], 0x4000);
+
save_item(NAME(m_layer_ctrl));
save_item(NAME(m_txbank));
- save_item(NAME(m_bgbotbank));
- save_item(NAME(m_bgtopbank));
+ save_item(NAME(m_bgbank));
save_item(NAME(m_sound));
save_item(NAME(m_sound2));
}
void angelkds_state::machine_reset()
{
- int i;
-
- for (i = 0; i < 4; i++)
+ for (int i = 0; i < 4; i++)
{
m_sound[i] = 0;
m_sound2[i] = 0;
@@ -503,8 +753,7 @@ void angelkds_state::machine_reset()
m_layer_ctrl = 0;
m_txbank = 0;
- m_bgbotbank = 0;
- m_bgtopbank = 0;
+ m_bgbank[0] = m_bgbank[1] = 0;
}
void angelkds_state::angelkds(machine_config &config)
@@ -514,15 +763,15 @@ void angelkds_state::angelkds(machine_config &config)
m_maincpu->set_addrmap(AS_IO, &angelkds_state::main_portmap);
m_maincpu->set_vblank_int("screen", FUNC(angelkds_state::irq0_line_hold));
- Z80(config, m_subcpu, XTAL(4'000'000));
- m_subcpu->set_addrmap(AS_PROGRAM, &angelkds_state::sub_map);
- m_subcpu->set_addrmap(AS_IO, &angelkds_state::sub_portmap);
+ Z80(config, m_audiocpu, XTAL(4'000'000));
+ m_audiocpu->set_addrmap(AS_PROGRAM, &angelkds_state::sound_map);
+ m_audiocpu->set_addrmap(AS_IO, &angelkds_state::sound_portmap);
i8255_device &ppi0(I8255A(config, "ppi8255_0"));
ppi0.in_pa_callback().set_ioport("I40");
ppi0.in_pb_callback().set_ioport("I41");
- ppi0.in_pc_callback().set(FUNC(angelkds_state::angeklds_ff_r)); // or left inputs don't work
- ppi0.out_pc_callback().set(FUNC(angelkds_state::angelkds_cpu_bank_write));
+ ppi0.in_pc_callback().set_constant(0xff); // or left inputs don't work
+ ppi0.out_pc_callback().set(FUNC(angelkds_state::cpu_bank_w));
i8255_device &ppi1(I8255A(config, "ppi8255_1"));
ppi1.in_pa_callback().set_ioport("I80");
@@ -531,13 +780,13 @@ void angelkds_state::angelkds(machine_config &config)
config.set_maximum_quantum(attotime::from_hz(6000));
- /* 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, 1*8, 31*8-1);
- screen.set_screen_update(FUNC(angelkds_state::screen_update_angelkds));
+ screen.set_screen_update(FUNC(angelkds_state::screen_update));
screen.set_palette("palette");
GFXDECODE(config, m_gfxdecode, "palette", gfx_angelkds);
@@ -546,7 +795,7 @@ void angelkds_state::angelkds(machine_config &config)
SPEAKER(config, "mono").front_center();
ym2203_device &ym1(YM2203(config, "ym1", XTAL(4'000'000)));
- ym1.irq_handler().set_inputline(m_subcpu, 0);
+ ym1.irq_handler().set_inputline(m_audiocpu, 0);
ym1.add_route(0, "mono", 0.65);
ym1.add_route(1, "mono", 0.65);
ym1.add_route(2, "mono", 0.65);
@@ -563,7 +812,7 @@ void angelkds_state::spcpostn(machine_config &config)
{
angelkds(config);
- /* encryption */
+ // encryption
sega_317_0005_device &maincpu(SEGA_317_0005(config.replace(), m_maincpu, XTAL(6'000'000)));
maincpu.set_addrmap(AS_PROGRAM, &angelkds_state::main_map);
maincpu.set_addrmap(AS_IO, &angelkds_state::main_portmap);
@@ -572,43 +821,31 @@ void angelkds_state::spcpostn(machine_config &config)
maincpu.set_decrypted_tag(m_decrypted_opcodes);
}
-/*** Rom Loading
-
- "maincpu" for the main code
- "user1" for the banked data
- "sub" for the sound cpu code
- "gfx1" for the 8x8 Txt Layer Tiles
- "gfx2" for the 16x16 Sprites
- "gfx3" for the 8x8 Bg Layer Tiles (top tilemap)
- "gfx4" for the 8x8 Bg Layer Tiles (bottom tilemap)
- "proms" for the Prom (same between games)
-
-*/
ROM_START( angelkds )
- /* Nasco X090-PC-A (Sega 837-6600) */
+ // Nasco X090-PC-A (Sega 837-6600)
ROM_REGION( 0x8000, "maincpu", 0 )
ROM_LOAD( "epr-11428.c10", 0x00000, 0x08000, CRC(90daacd2) SHA1(7e50ad1cbed0c1e6bad04ef1611cad25538c905f) )
- ROM_REGION( 0x40000, "user1", 0 ) /* Banked Code */
+ ROM_REGION( 0x40000, "banked_roms", 0 )
ROM_LOAD( "epr-11424.c1", 0x00000, 0x08000, CRC(b55997f6) SHA1(7ed746becac1851f39591f1fdbeff64aa97d6206) )
ROM_LOAD( "epr-11425.c2", 0x08000, 0x08000, CRC(299359de) SHA1(f531dd3bfe6f64e9e043cb4f85d5657455241dc7) )
ROM_LOAD( "epr-11426.c3", 0x10000, 0x08000, CRC(5fad8bd3) SHA1(4d865342eb10dcfb779eee4ac1e159bb9ec140cb) )
ROM_LOAD( "epr-11427.c4", 0x18000, 0x08000, CRC(ef920c74) SHA1(81c0fbe4ace5441e4cd99ba423e0190cc541da31) )
- ROM_REGION( 0x10000, "sub", 0 )
+ ROM_REGION( 0x10000, "audiocpu", 0 )
ROM_LOAD( "epr-11429.d4", 0x00000, 0x08000, CRC(0ca50a66) SHA1(cccb081b447419138b1ebd309e7f291e392a44d5) )
- /* Nasco X090-PC-B */
- ROM_REGION( 0x08000, "gfx1", 0 )
+ // Nasco X090-PC-B
+ ROM_REGION( 0x08000, "chars", 0 )
ROM_LOAD( "epr-11446", 0x00000, 0x08000, CRC(45052470) SHA1(c2312a9f814d6dbe42aa465147a04a2bd9b2aa1b) )
- ROM_REGION( 0x10000, "gfx2", 0 )
+ ROM_REGION( 0x10000, "sprites", 0 )
ROM_LOAD( "epr-11447.f7", 0x08000, 0x08000, CRC(b3afc5b3) SHA1(376d527f60e9044f18d19a5535bca77606efbd4c) )
ROM_LOAD( "epr-11448.h7", 0x00000, 0x08000, CRC(05dab626) SHA1(73feaca6e23c673a7d8c9e972714b20bd8f2d51e) )
- /* both tilemaps on angelkds use the same gfx */
- ROM_REGION( 0x40000, "gfx3", 0 )
+ // both tilemaps on angelkds use the same GFX
+ ROM_REGION( 0x40000, "bgtiles_top", 0 )
ROM_LOAD( "epr-11437", 0x00000, 0x08000, CRC(a520b628) SHA1(2b51f59e760e740e5e6b06dad61bbc23fc84a72b) )
ROM_LOAD( "epr-11436", 0x08000, 0x08000, CRC(469ab216) SHA1(8223f072a6f9135ff84841c95410368bcea073d8) )
ROM_LOAD( "epr-11435", 0x10000, 0x08000, CRC(b0f8c245) SHA1(882e27eaceac46c397fdae8427a082caa7d6b7dc) )
@@ -618,7 +855,7 @@ ROM_START( angelkds )
ROM_LOAD( "epr-11431", 0x30000, 0x08000, CRC(ac2025af) SHA1(2aba145df3ccdb1a7f0fec524bd2de3f9aab4161) )
ROM_LOAD( "epr-11430", 0x38000, 0x08000, CRC(d640f89e) SHA1(38fb67bcb2a3d1ad614fc62e42f22a66bc757137) )
- ROM_REGION( 0x40000, "gfx4", 0 )
+ ROM_REGION( 0x40000, "bgtiles_bottom", 0 )
ROM_LOAD( "epr-11445", 0x00000, 0x08000, CRC(a520b628) SHA1(2b51f59e760e740e5e6b06dad61bbc23fc84a72b) )
ROM_LOAD( "epr-11444", 0x08000, 0x08000, CRC(469ab216) SHA1(8223f072a6f9135ff84841c95410368bcea073d8) )
ROM_LOAD( "epr-11443", 0x10000, 0x08000, CRC(b0f8c245) SHA1(882e27eaceac46c397fdae8427a082caa7d6b7dc) )
@@ -633,34 +870,34 @@ ROM_START( angelkds )
ROM_END
ROM_START( spcpostn )
- /* X090-PC-A 171-5383 (Sega 834-6089 SPACE POSITION) */
- ROM_REGION( 0x8000, "maincpu", 0 ) /* D317-0005 (NEC Z80 Custom) */
- ROM_LOAD( "epr-10125.c10", 0x00000, 0x08000, CRC(bffd38c6) SHA1(af02907124343ddecd21439d25f1ebb81ef9f51a) ) /* encrypted */
+ // X090-PC-A 171-5383 (Sega 834-6089 SPACE POSITION)
+ ROM_REGION( 0x8000, "maincpu", 0 ) // D317-0005 (NEC Z80 Custom)
+ ROM_LOAD( "epr-10125.c10", 0x00000, 0x08000, CRC(bffd38c6) SHA1(af02907124343ddecd21439d25f1ebb81ef9f51a) ) // encrypted
- ROM_REGION( 0x40000, "user1", 0 ) /* Banked Code */
+ ROM_REGION( 0x40000, "banked_roms", 0 )
ROM_LOAD( "epr-10120.c1", 0x00000, 0x08000, CRC(d6399f99) SHA1(4c7d19a8798e5a10b688bf793ca74f5170fd9b51) )
ROM_LOAD( "epr-10121.c2", 0x08000, 0x08000, CRC(d4861560) SHA1(74d28c36a08880abbd3c398cc3e990e8986caccb) )
ROM_LOAD( "epr-10122.c3", 0x10000, 0x08000, CRC(7a1bff1b) SHA1(e1bda8430fd632c1813dd78e0f210a358e1b0d2f) )
ROM_LOAD( "epr-10123.c4", 0x18000, 0x08000, CRC(6aed2925) SHA1(75848c8086c460b72494da2367f592d7d5dcf9f1) )
ROM_LOAD( "epr-10124.c5", 0x20000, 0x08000, CRC(a1d7ae6b) SHA1(ec81fecf63e0515cae2077e2623262227adfdf37) )
- ROM_REGION( 0x10000, "sub", 0 ) /* NEC D780C-1 */
+ ROM_REGION( 0x10000, "audiocpu", 0 ) // NEC D780C-1
ROM_LOAD( "epr-10126.d4", 0x00000, 0x08000, CRC(ab17f852) SHA1(dc0db427ddb4df97bb40dfb6fc65cb9354a6b9ad) )
- /* X090-PC-B 171-5384 */
- ROM_REGION( 0x08000, "gfx1", 0 )
+ // X090-PC-B 171-5384
+ ROM_REGION( 0x08000, "chars", 0 )
ROM_LOAD( "epr-10133.17", 0x00000, 0x08000, CRC(642e6609) SHA1(2dfb4cc66f89543b55ed2a5b914e2c9304e821ca) )
- ROM_REGION( 0x10000, "gfx2", 0 )
+ ROM_REGION( 0x10000, "sprites", 0 )
ROM_LOAD( "epr-10134.18", 0x08000, 0x08000, CRC(c674ff88) SHA1(9f240910a1ffb7c9e09d2326de280e6a5dd84565) )
ROM_LOAD( "epr-10135.19", 0x00000, 0x08000, CRC(0685c4fa) SHA1(6950d9ad9ec13236cf24e83e87adb62aa53af7bb) )
- ROM_REGION( 0x30000, "gfx3", 0 )
+ ROM_REGION( 0x30000, "bgtiles_top", 0 )
ROM_LOAD( "epr-10130.14", 0x10000, 0x08000, CRC(b68fcb36) SHA1(3943dd550b13f2911d56d8dad675410da79196e6) )
ROM_LOAD( "epr-10131.15", 0x08000, 0x08000, CRC(de223817) SHA1(1860db0a19c926fcfaabe676cb57fff38c4df8e6) )
ROM_LOAD( "epr-10132.16", 0x00000, 0x08000, CRC(2df8b1bd) SHA1(cad8befa3f2c158d2aa74073066ccd2b54e68825) )
- ROM_REGION( 0x18000, "gfx4", 0 )
+ ROM_REGION( 0x18000, "bgtiles_bottom", 0 )
ROM_LOAD( "epr-10127.06", 0x10000, 0x08000, CRC(b68fcb36) SHA1(3943dd550b13f2911d56d8dad675410da79196e6) )
ROM_LOAD( "epr-10128.07", 0x08000, 0x08000, CRC(de223817) SHA1(1860db0a19c926fcfaabe676cb57fff38c4df8e6) )
ROM_LOAD( "epr-10129.08", 0x00000, 0x08000, CRC(a6f21023) SHA1(8d573446a2d3d3428409707d0c59b118d1463131) )
@@ -669,14 +906,8 @@ ROM_START( spcpostn )
ROM_LOAD( "63s081n.u5", 0x00, 0x20, CRC(36b98627) SHA1(d2d54d92d1d47e7cc85104989ee421ce5d80a42a) )
ROM_END
-
-void angelkds_state::init_angelkds()
-{
- uint8_t *RAM = memregion("user1")->base();
- membank("bank1")->configure_entries(0, 16, &RAM[0x0000], 0x4000);
-}
-
+} // anonymous namespace
-GAME( 1988, angelkds, 0, angelkds, angelkds, angelkds_state, init_angelkds, ROT90, "Sega / Nasco?", "Angel Kids (Japan)" , MACHINE_SUPPORTS_SAVE) /* Nasco not displayed but 'Exa Planning' is */
-GAME( 1986, spcpostn, 0, spcpostn, spcpostn, angelkds_state, init_angelkds, ROT90, "Sega / Nasco", "Space Position (Japan)" , MACHINE_SUPPORTS_SAVE) /* encrypted */
+GAME( 1988, angelkds, 0, angelkds, angelkds, angelkds_state, empty_init, ROT90, "Sega / Nasco?", "Angel Kids (Japan)" , MACHINE_SUPPORTS_SAVE) // Nasco not displayed but 'Exa Planning' is
+GAME( 1986, spcpostn, 0, spcpostn, spcpostn, angelkds_state, empty_init, ROT90, "Sega / Nasco", "Space Position (Japan)" , MACHINE_SUPPORTS_SAVE) // encrypted
diff --git a/src/mame/drivers/crgolf.cpp b/src/mame/drivers/crgolf.cpp
index 2f9c163f68a..9e762c05d95 100644
--- a/src/mame/drivers/crgolf.cpp
+++ b/src/mame/drivers/crgolf.cpp
@@ -75,7 +75,7 @@
| YUVO CO., LTD |
|-----------------------------------------------
- next to rom M-GF_A10.12K
+ next to ROM M-GF_A10.12K
the box must contain at least a Z80
DASM Notes:
@@ -84,23 +84,255 @@ tries to see if $612c onward has a "MASTERJ" string on it, resets itself
otherwise.
During irq routines it also checks if bit 7 is active for $640a-$6415,
modifies this area if condition is true.
-Neither of above matches what we have in the rom data banks, so it's either
+Neither of above matches what we have in the ROM data banks, so it's either
protected or a snippet should do the aforementioned string copy.
***************************************************************************/
#include "emu.h"
-#include "includes/crgolf.h"
#include "cpu/z80/z80.h"
#include "machine/74259.h"
#include "machine/gen_latch.h"
#include "sound/ay8910.h"
#include "sound/msm5205.h"
+
+#include "emupal.h"
#include "screen.h"
#include "speaker.h"
+namespace {
+
+class crgolf_state : public driver_device
+{
+public:
+ crgolf_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_palette(*this, "palette"),
+ m_videoram(*this, "vram%u", 0U, 0x6000U, ENDIANNESS_LITTLE),
+ m_mainbank(*this, "mainbank"),
+ m_stick(*this, "STICK%u", 0U),
+ m_ioport(*this, { "IN0", "IN1", "P1", "P2", "DSW", "UNUSED0", "UNUSED1" })
+ { }
+
+ void crgolf(machine_config &config);
+
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
+ // devices
+ required_device<cpu_device> m_maincpu;
+ required_device<cpu_device> m_audiocpu;
+ required_device<palette_device> m_palette;
+
+ void sound_map(address_map &map);
+
+private:
+ // memory pointers
+ memory_share_array_creator<uint8_t, 2> m_videoram;
+ required_memory_bank m_mainbank;
+
+ required_ioport_array<2> m_stick;
+ required_ioport_array<7> m_ioport;
+
+ bool m_color_select = false;
+ bool m_screen_flip = false;
+ bool m_screen_enable[2] = { false, false };
+
+ // misc
+ uint8_t m_port_select = 0U;
+
+ void rom_bank_select_w(uint8_t data);
+ uint8_t switch_input_r();
+ uint8_t analog_input_r();
+ void switch_input_select_w(uint8_t data);
+ void unknown_w(uint8_t data);
+ DECLARE_WRITE_LINE_MEMBER(color_select_w);
+ DECLARE_WRITE_LINE_MEMBER(screen_flip_w);
+ DECLARE_WRITE_LINE_MEMBER(screen_select_w);
+ template <uint8_t Which> DECLARE_WRITE_LINE_MEMBER(screen_enable_w);
+ void palette(palette_device &palette) const;
+ uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ void main_map(address_map &map);
+};
+
+class crgolfhi_state : public crgolf_state
+{
+public:
+ crgolfhi_state(const machine_config &mconfig, device_type type, const char *tag) :
+ crgolf_state(mconfig, type, tag),
+ m_adpcm_rom(*this, "adpcm"),
+ m_msm(*this, "msm")
+ { }
+
+ void crgolfhi(machine_config &config);
+
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
+private:
+ // memory pointers
+ required_region_ptr<uint8_t> m_adpcm_rom;
+
+ // devices
+ required_device<msm5205_device> m_msm;
+
+ // misc
+ uint16_t m_sample_offset = 0U;
+ uint8_t m_sample_count = 0U;
+
+ void sample_w(offs_t offset, uint8_t data);
+ DECLARE_WRITE_LINE_MEMBER(vck_callback);
+
+ void sound_map(address_map &map);
+};
+
+class mastrglf_state : public crgolfhi_state
+{
+public:
+ mastrglf_state(const machine_config &mconfig, device_type type, const char *tag) :
+ crgolfhi_state(mconfig, type, tag)
+ { }
+
+ void mastrglf(machine_config &config);
+
+private:
+ uint8_t unk_sound_02_r();
+ uint8_t unk_sound_05_r();
+ uint8_t unk_sound_07_r();
+ void unk_sound_0c_w(uint8_t data);
+ void palette(palette_device &palette) const;
+ void main_io_map(address_map &map);
+ void main_prg_map(address_map &map);
+ void sound_io_map(address_map &map);
+ void sound_prg_map(address_map &map);
+};
+
+// video
+
+
+/*************************************
+ *
+ * Video startup
+ *
+ *************************************/
+
+void crgolf_state::palette(palette_device &palette) const
+{
+ uint8_t const *const prom = memregion("proms")->base();
+ static constexpr uint8_t NUM_PENS = 0x20;
+
+ for (offs_t offs = 0; offs < NUM_PENS; offs++)
+ {
+ uint8_t const data = prom[offs];
+
+ // red component
+ int bit0 = BIT(data, 0);
+ int bit1 = BIT(data, 1);
+ int bit2 = BIT(data, 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ // green component
+ bit0 = BIT(data, 3);
+ bit1 = BIT(data, 4);
+ bit2 = BIT(data, 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ // blue component
+ bit0 = BIT(data, 6);
+ bit1 = BIT(data, 7);
+ int const b = 0x4f * bit0 + 0xa8 * bit1;
+
+ m_palette->set_pen_color(offs, r, g, b);
+ }
+}
+
+void mastrglf_state::palette(palette_device &palette) const
+{
+ // TODO: once PROMs are dumped
+}
+
+/*************************************
+ *
+ * Video update
+ *
+ *************************************/
+
+uint32_t crgolf_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+{
+ int flip = m_screen_flip;
+ static constexpr uint16_t VIDEORAM_SIZE = 0x2000 * 3;
+
+ // for each byte in the video RAM
+ for (offs_t offs = 0; offs < VIDEORAM_SIZE / 3; offs++)
+ {
+ uint8_t y = (offs & 0x1fe0) >> 5;
+ uint8_t x = (offs & 0x001f) << 3;
+
+ uint8_t data_a0 = m_videoram[0][0x2000 | offs];
+ uint8_t data_a1 = m_videoram[0][0x0000 | offs];
+ uint8_t data_a2 = m_videoram[0][0x4000 | offs];
+ uint8_t data_b0 = m_videoram[1][0x2000 | offs];
+ uint8_t data_b1 = m_videoram[1][0x0000 | offs];
+ uint8_t data_b2 = m_videoram[1][0x4000 | offs];
+
+ if (flip)
+ {
+ y = ~y;
+ x = ~x;
+ }
+
+ // for each pixel in the byte
+ for (int i = 0; i < 8; i++)
+ {
+ offs_t color;
+ uint8_t data_b = 0;
+ uint8_t data_a = 0;
+
+ if (!m_screen_enable[0])
+ data_a = ((data_a0 & 0x80) >> 7) | ((data_a1 & 0x80) >> 6) | ((data_a2 & 0x80) >> 5);
+
+ if (!m_screen_enable[1])
+ data_b = ((data_b0 & 0x80) >> 7) | ((data_b1 & 0x80) >> 6) | ((data_b2 & 0x80) >> 5);
+
+ // screen A has priority over B
+ if (data_a)
+ color = data_a;
+ else
+ color = data_b | 0x08;
+
+ // add HI bit if enabled
+ if (m_color_select)
+ color = color | 0x10;
+
+ bitmap.pix(y, x) = color;
+
+ // next pixel
+ data_a0 = data_a0 << 1;
+ data_a1 = data_a1 << 1;
+ data_a2 = data_a2 << 1;
+ data_b0 = data_b0 << 1;
+ data_b1 = data_b1 << 1;
+ data_b2 = data_b2 << 1;
+
+ if (flip)
+ x = x - 1;
+ else
+ x = x + 1;
+ }
+ }
+
+ return 0;
+}
+
+
+// machine
+
/*************************************
*
* ROM banking
@@ -109,35 +341,44 @@ protected or a snippet should do the aforementioned string copy.
void crgolf_state::rom_bank_select_w(uint8_t data)
{
- membank("bank1")->set_entry(data & 15);
+ m_mainbank->set_entry(data & 15); // TODO: mastrglf has more banks
}
void crgolf_state::machine_start()
{
- if (membank("bank1"))
- {
- uint32_t size = memregion("maindata")->bytes();
+ uint32_t size = memregion("maindata")->bytes();
- /* configure the banking */
- membank("bank1")->configure_entries(0, size/0x2000, memregion("maindata")->base(), 0x2000);
- membank("bank1")->set_entry(0);
- }
+ // configure the banking
+ m_mainbank->configure_entries(0, size / 0x2000, memregion("maindata")->base(), 0x2000);
+ m_mainbank->set_entry(0);
+ membank("vrambank")->configure_entry(0, m_videoram[0]);
+ membank("vrambank")->configure_entry(1, m_videoram[1]);
- /* register for save states */
+ // register for save states
save_item(NAME(m_port_select));
- save_item(NAME(m_sample_offset));
- save_item(NAME(m_sample_count));
save_item(NAME(m_color_select));
save_item(NAME(m_screen_flip));
- save_item(NAME(m_screena_enable));
- save_item(NAME(m_screenb_enable));
+ save_item(NAME(m_screen_enable));
}
+void crgolfhi_state::machine_start()
+{
+ crgolf_state::machine_start();
+
+ save_item(NAME(m_sample_offset));
+ save_item(NAME(m_sample_count));
+}
void crgolf_state::machine_reset()
{
m_port_select = 0;
+}
+
+void crgolfhi_state::machine_reset()
+{
+ crgolf_state::machine_reset();
+
m_sample_offset = 0;
m_sample_count = 0;
}
@@ -151,27 +392,21 @@ void crgolf_state::machine_reset()
uint8_t crgolf_state::switch_input_r()
{
- static const char *const portnames[] = { "IN0", "IN1", "P1", "P2", "DSW", "UNUSED0", "UNUSED1" };
-
- return ioport(portnames[m_port_select])->read();
+ return m_ioport[m_port_select]->read();
}
uint8_t crgolf_state::analog_input_r()
{
- return ((ioport("STICK0")->read() >> 4) | (ioport("STICK1")->read() & 0xf0)) ^ 0x88;
+ return ((m_stick[0]->read() >> 4) | (m_stick[1]->read() & 0xf0)) ^ 0x88;
}
void crgolf_state::switch_input_select_w(uint8_t data)
{
- if (!(data & 0x40)) m_port_select = 6;
- if (!(data & 0x20)) m_port_select = 5;
- if (!(data & 0x10)) m_port_select = 4;
- if (!(data & 0x08)) m_port_select = 3;
- if (!(data & 0x04)) m_port_select = 2;
- if (!(data & 0x02)) m_port_select = 1;
- if (!(data & 0x01)) m_port_select = 0;
+ for (int i = 6; i >= 0; i--)
+ if (!(BIT(data, i)))
+ m_port_select = i;
}
@@ -188,23 +423,23 @@ void crgolf_state::unknown_w(uint8_t data)
*
*************************************/
-WRITE_LINE_MEMBER(crgolf_state::vck_callback)
+WRITE_LINE_MEMBER(crgolfhi_state::vck_callback)
{
- /* only play back if we have data remaining */
+ // only play back if we have data remaining
if (m_sample_count != 0xff)
{
- uint8_t data = memregion("adpcm")->base()[m_sample_offset >> 1];
+ uint8_t data = m_adpcm_rom[m_sample_offset >> 1];
- /* write the next nibble and advance */
+ // write the next nibble and advance
m_msm->data_w((data >> (4 * (~m_sample_offset & 1))) & 0x0f);
m_sample_offset++;
- /* every 256 clocks, we decrement the length */
+ // every 256 clocks, we decrement the length
if (!(m_sample_offset & 0xff))
{
m_sample_count--;
- /* if we hit 0xff, automatically turn off playback */
+ // if we hit 0xff, automatically turn off playback
if (m_sample_count == 0xff)
m_msm->reset_w(1);
}
@@ -212,26 +447,26 @@ WRITE_LINE_MEMBER(crgolf_state::vck_callback)
}
-void crgolf_state::crgolfhi_sample_w(offs_t offset, uint8_t data)
+void crgolfhi_state::sample_w(offs_t offset, uint8_t data)
{
switch (offset)
{
- /* offset 0 holds the MSM5205 in reset */
+ // offset 0 holds the MSM5205 in reset
case 0:
m_msm->reset_w(1);
break;
- /* offset 1 is the length/256 nibbles */
+ // offset 1 is the length/256 nibbles
case 1:
m_sample_count = data;
break;
- /* offset 2 is the offset/256 nibbles */
+ // offset 2 is the offset/256 nibbles
case 2:
m_sample_offset = data << 8;
break;
- /* offset 3 turns on playback */
+ // offset 3 turns on playback
case 3:
m_msm->reset_w(0);
break;
@@ -251,21 +486,10 @@ WRITE_LINE_MEMBER(crgolf_state::screen_flip_w)
}
-WRITE_LINE_MEMBER(crgolf_state::screen_select_w)
-{
- m_vrambank->set_bank(state);
-}
-
-
-WRITE_LINE_MEMBER(crgolf_state::screena_enable_w)
+template <uint8_t Which>
+WRITE_LINE_MEMBER(crgolf_state::screen_enable_w)
{
- m_screena_enable = state;
-}
-
-
-WRITE_LINE_MEMBER(crgolf_state::screenb_enable_w)
-{
- m_screenb_enable = state;
+ m_screen_enable[Which] = state;
}
@@ -280,18 +504,12 @@ void crgolf_state::main_map(address_map &map)
{
map(0x0000, 0x3fff).rom();
map(0x4000, 0x5fff).ram();
- map(0x6000, 0x7fff).bankr("bank1");
+ map(0x6000, 0x7fff).bankr(m_mainbank);
map(0x8000, 0x8007).w("mainlatch", FUNC(ls259_device::write_d0));
map(0x8800, 0x8800).r("soundlatch2", FUNC(generic_latch_8_device::read));
map(0x8800, 0x8800).w("soundlatch1", FUNC(generic_latch_8_device::write));
map(0x9000, 0x9000).w(FUNC(crgolf_state::rom_bank_select_w));
- map(0xa000, 0xffff).m(m_vrambank, FUNC(address_map_bank_device::amap8));
-}
-
-void crgolf_state::vrambank_map(address_map &map)
-{
- map(0x0000, 0x5fff).ram().share("vrama");
- map(0x8000, 0xdfff).ram().share("vramb");
+ map(0xa000, 0xffff).bankrw("vrambank");
}
@@ -313,24 +531,28 @@ void crgolf_state::sound_map(address_map &map)
map(0xe003, 0xe003).w("soundlatch2", FUNC(generic_latch_8_device::write));
}
+void crgolfhi_state::sound_map(address_map &map)
+{
+ crgolf_state::sound_map(map);
+ map(0xa000, 0xa003).w(FUNC(crgolfhi_state::sample_w));
+}
-
-void crgolf_state::mastrglf_map(address_map &map)
+void mastrglf_state::main_prg_map(address_map &map)
{
map(0x0000, 0x3fff).rom();
- map(0x4000, 0x5fff).bankr("bank1");
+ map(0x4000, 0x5fff).bankr("mainbank");
map(0x6000, 0x8fff).ram(); // maybe RAM and ROM here?
map(0x9000, 0x9fff).ram();
- map(0xa000, 0xffff).m(m_vrambank, FUNC(address_map_bank_device::amap8));
+ map(0xa000, 0xffff).bankrw("vrambank");
}
-void crgolf_state::mastrglf_io(address_map &map)
+void mastrglf_state::main_io_map(address_map &map)
{
map.global_mask(0xff);
map(0x00, 0x07).w("mainlatch", FUNC(ls259_device::write_d0));
@@ -341,43 +563,43 @@ void crgolf_state::mastrglf_io(address_map &map)
-void crgolf_state::mastrglf_submap(address_map &map)
+void mastrglf_state::sound_prg_map(address_map &map)
{
map(0x0000, 0x7fff).rom();
map(0x8000, 0x87ff).ram();
}
-uint8_t crgolf_state::unk_sub_02_r()
+uint8_t mastrglf_state::unk_sound_02_r()
{
return 0x00;
}
-uint8_t crgolf_state::unk_sub_05_r()
+uint8_t mastrglf_state::unk_sound_05_r()
{
return 0x00;
}
-uint8_t crgolf_state::unk_sub_07_r()
+uint8_t mastrglf_state::unk_sound_07_r()
{
return 0x00;
}
-void crgolf_state::unk_sub_0c_w(uint8_t data)
+void mastrglf_state::unk_sound_0c_w(uint8_t data)
{
}
-void crgolf_state::mastrglf_subio(address_map &map)
+void mastrglf_state::sound_io_map(address_map &map)
{
map.global_mask(0xff);
map(0x00, 0x00).r("soundlatch1", FUNC(generic_latch_8_device::read)).nopw();
- map(0x02, 0x02).r(FUNC(crgolf_state::unk_sub_02_r));
- map(0x05, 0x05).r(FUNC(crgolf_state::unk_sub_05_r));
+ map(0x02, 0x02).r(FUNC(mastrglf_state::unk_sound_02_r));
+ map(0x05, 0x05).r(FUNC(mastrglf_state::unk_sound_05_r));
map(0x06, 0x06).nopr();
- map(0x07, 0x07).r(FUNC(crgolf_state::unk_sub_07_r));
+ map(0x07, 0x07).r(FUNC(mastrglf_state::unk_sound_07_r));
map(0x08, 0x08).w("soundlatch2", FUNC(generic_latch_8_device::write));
- map(0x0c, 0x0c).w(FUNC(crgolf_state::unk_sub_0c_w));
+ map(0x0c, 0x0c).w(FUNC(mastrglf_state::unk_sound_0c_w));
map(0x10, 0x11).w("aysnd", FUNC(ay8910_device::address_data_w));
}
@@ -390,12 +612,12 @@ void crgolf_state::mastrglf_subio(address_map &map)
*************************************/
static INPUT_PORTS_START( crgolf )
- PORT_START("IN0") /* CREDIT */
+ PORT_START("IN0") // CREDIT
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SERVICE1 )
PORT_BIT( 0xfc, IP_ACTIVE_HIGH, IPT_UNUSED )
- PORT_START("IN1") /* SELECT */
+ PORT_START("IN1") // SELECT
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START1 )
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START2 )
@@ -404,24 +626,24 @@ static INPUT_PORTS_START( crgolf )
PORT_BIT( 0xe0, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_START("P1")
- PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(1) /* club select */
- PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) /* backward address */
- PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(1) /* forward address */
- PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(1) /* open stance */
- PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(1) /* closed stance */
- PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) /* direction left */
- PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) /* direction right */
- PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) /* shot switch */
+ PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(1) // club select
+ PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) // backward address
+ PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(1) // forward address
+ PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(1) // open stance
+ PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(1) // closed stance
+ PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) // direction left
+ PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) // direction right
+ PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) // shot switch
PORT_START("P2")
- PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_COCKTAIL /* club select */
- PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_COCKTAIL /* backward address */
- PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_COCKTAIL /* forward address */
- PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_COCKTAIL /* open stance */
- PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_COCKTAIL /* closed stance */
- PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_COCKTAIL /* direction left */
- PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_COCKTAIL /* direction right */
- PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_COCKTAIL /* shot switch */
+ PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_COCKTAIL // club select
+ PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_COCKTAIL // backward address
+ PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_COCKTAIL // forward address
+ PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_COCKTAIL // open stance
+ PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_COCKTAIL // closed stance
+ PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_COCKTAIL // direction left
+ PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_COCKTAIL // direction right
+ PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_COCKTAIL // shot switch
PORT_START("DSW")
PORT_DIPNAME( 0x01, 0x00, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW:2")
@@ -488,12 +710,14 @@ INPUT_PORTS_END
void crgolf_state::crgolf(machine_config &config)
{
- /* basic machine hardware */
- Z80(config, m_maincpu, MASTER_CLOCK/3/2);
+ static constexpr XTAL MASTER_CLOCK = XTAL(18'432'000);
+
+ // basic machine hardware
+ Z80(config, m_maincpu, MASTER_CLOCK / 3 / 2);
m_maincpu->set_addrmap(AS_PROGRAM, &crgolf_state::main_map);
m_maincpu->set_vblank_int("screen", FUNC(crgolf_state::irq0_line_hold));
- Z80(config, m_audiocpu, MASTER_CLOCK/3/2);
+ Z80(config, m_audiocpu, MASTER_CLOCK / 3 / 2);
m_audiocpu->set_addrmap(AS_PROGRAM, &crgolf_state::sound_map);
m_audiocpu->set_vblank_int("screen", FUNC(crgolf_state::irq0_line_hold));
@@ -502,56 +726,55 @@ void crgolf_state::crgolf(machine_config &config)
ls259_device &mainlatch(LS259(config, "mainlatch")); // 1H
mainlatch.q_out_cb<3>().set(FUNC(crgolf_state::color_select_w));
mainlatch.q_out_cb<4>().set(FUNC(crgolf_state::screen_flip_w));
- mainlatch.q_out_cb<5>().set(FUNC(crgolf_state::screen_select_w));
- mainlatch.q_out_cb<6>().set(FUNC(crgolf_state::screenb_enable_w));
- mainlatch.q_out_cb<7>().set(FUNC(crgolf_state::screena_enable_w));
+ mainlatch.q_out_cb<5>().set_membank("vrambank");
+ mainlatch.q_out_cb<6>().set(FUNC(crgolf_state::screen_enable_w<1>));
+ mainlatch.q_out_cb<7>().set(FUNC(crgolf_state::screen_enable_w<0>));
GENERIC_LATCH_8(config, "soundlatch1").data_pending_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI);
GENERIC_LATCH_8(config, "soundlatch2").data_pending_callback().set_inputline(m_maincpu, INPUT_LINE_NMI);
- /* stride is technically 0x6000, but powers of 2 makes the memory map / address masking cleaner. */
- ADDRESS_MAP_BANK(config, "vrambank").set_map(&crgolf_state::vrambank_map).set_options(ENDIANNESS_LITTLE, 8, 16, 0x8000);
-
- PALETTE(config, m_palette, FUNC(crgolf_state::crgolf_palette), 0x20);
+ PALETTE(config, m_palette, FUNC(crgolf_state::palette), 0x20);
- /* video hardware */
+ // video hardware
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
screen.set_refresh_hz(60);
- screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500)); /* not accurate */
+ screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500)); // not accurate
screen.set_size(256, 256);
screen.set_visarea(0, 255, 8, 247);
- screen.set_screen_update(FUNC(crgolf_state::screen_update_crgolf));
+ screen.set_screen_update(FUNC(crgolf_state::screen_update));
screen.set_palette(m_palette);
- /* sound hardware */
+ // sound hardware
SPEAKER(config, "mono").front_center();
- AY8910(config, "aysnd", MASTER_CLOCK/3/2/2).add_route(ALL_OUTPUTS, "mono", 1.0);
+ AY8910(config, "aysnd", MASTER_CLOCK / 3 / 2 / 2).add_route(ALL_OUTPUTS, "mono", 1.0);
}
-void crgolf_state::crgolfhi(machine_config &config)
+void crgolfhi_state::crgolfhi(machine_config &config)
{
crgolf(config);
+ m_audiocpu->set_addrmap(AS_PROGRAM, &crgolfhi_state::sound_map);
+
MSM5205(config, m_msm, 384000);
- m_msm->vck_legacy_callback().set(FUNC(crgolf_state::vck_callback));
+ m_msm->vck_legacy_callback().set(FUNC(crgolfhi_state::vck_callback));
m_msm->set_prescaler_selector(msm5205_device::S64_4B);
m_msm->add_route(ALL_OUTPUTS, "mono", 1.0);
}
-void crgolf_state::mastrglf(machine_config &config)
+void mastrglf_state::mastrglf(machine_config &config)
{
crgolfhi(config);
- /* basic machine hardware */
- m_maincpu->set_addrmap(AS_PROGRAM, &crgolf_state::mastrglf_map);
- m_maincpu->set_addrmap(AS_IO, &crgolf_state::mastrglf_io);
- m_maincpu->set_vblank_int("screen", FUNC(crgolf_state::irq0_line_hold));
+ // basic machine hardware
+ m_maincpu->set_addrmap(AS_PROGRAM, &mastrglf_state::main_prg_map);
+ m_maincpu->set_addrmap(AS_IO, &mastrglf_state::main_io_map);
+ m_maincpu->set_vblank_int("screen", FUNC(mastrglf_state::irq0_line_hold));
- m_audiocpu->set_addrmap(AS_PROGRAM, &crgolf_state::mastrglf_submap);
- m_audiocpu->set_addrmap(AS_IO, &crgolf_state::mastrglf_subio);
- m_audiocpu->set_vblank_int("screen", FUNC(crgolf_state::irq0_line_hold));
+ m_audiocpu->set_addrmap(AS_PROGRAM, &mastrglf_state::sound_prg_map);
+ m_audiocpu->set_addrmap(AS_IO, &mastrglf_state::sound_io_map);
+ m_audiocpu->set_vblank_int("screen", FUNC(mastrglf_state::irq0_line_hold));
- PALETTE(config.replace(), m_palette, FUNC(crgolf_state::mastrglf_palette), 0x100);
+ PALETTE(config.replace(), m_palette, FUNC(mastrglf_state::palette), 0x100);
}
@@ -588,7 +811,7 @@ ROM_START( crgolf ) // 834-5419-04
ROM_LOAD( "pr5877.1s", 0x0000, 0x0020, CRC(f880b95d) SHA1(5ad0ee39e2b9befaf3895ec635d5865b7b1e562b) )
ROM_REGION( 0x0200, "plds", 0 ) // pal16l8
- ROM_LOAD( "cg.3e.bin", 0x0000, 0x0104, CRC(beef5560) SHA1(cd7462dea015151cf29029e2275e10b949537cd2) ) /* PAL is read protected */
+ ROM_LOAD( "cg.3e.bin", 0x0000, 0x0104, CRC(beef5560) SHA1(cd7462dea015151cf29029e2275e10b949537cd2) ) // PAL is read protected
ROM_END
ROM_START( crgolfa ) // 834-5419-03
@@ -618,7 +841,7 @@ ROM_START( crgolfa ) // 834-5419-03
ROM_LOAD( "pr5877.1s", 0x0000, 0x0020, CRC(f880b95d) SHA1(5ad0ee39e2b9befaf3895ec635d5865b7b1e562b) )
ROM_REGION( 0x0200, "plds", 0 ) // pal16l8
- ROM_LOAD( "cg.3e.bin", 0x0000, 0x0104, CRC(beef5560) SHA1(cd7462dea015151cf29029e2275e10b949537cd2) ) /* PAL is read protected */
+ ROM_LOAD( "cg.3e.bin", 0x0000, 0x0104, CRC(beef5560) SHA1(cd7462dea015151cf29029e2275e10b949537cd2) ) // PAL is read protected
ROM_END
@@ -766,21 +989,7 @@ ROM_START( mastrglf )
ROM_LOAD( "tbp24s10n.2", 0x0200, 0x0100, NO_DUMP )
ROM_END
-
-
-
-
-/*************************************
- *
- * Game-specific init
- *
- *************************************/
-
-void crgolf_state::init_crgolfhi()
-{
- m_audiocpu->space(AS_PROGRAM).install_write_handler(0xa000, 0xa003, write8sm_delegate(*this, FUNC(crgolf_state::crgolfhi_sample_w)));
-}
-
+} // anonymous namespace
/*************************************
@@ -789,11 +998,11 @@ void crgolf_state::init_crgolfhi()
*
*************************************/
-GAME( 1984, crgolf, 0, crgolf, crgolf, crgolf_state, empty_init, ROT0, "Nasco Japan", "Crowns Golf (834-5419-04)", MACHINE_SUPPORTS_SAVE )
-GAME( 1984, crgolfa, crgolf, crgolf, crgolfa, crgolf_state, empty_init, ROT0, "Nasco Japan", "Crowns Golf (834-5419-03)", MACHINE_SUPPORTS_SAVE )
-GAME( 1984, crgolfb, crgolf, crgolf, crgolfb, crgolf_state, empty_init, ROT0, "Nasco Japan", "Crowns Golf (set 3)", MACHINE_SUPPORTS_SAVE )
-GAME( 1984, crgolfc, crgolf, crgolf, crgolfb, crgolf_state, empty_init, ROT0, "Nasco Japan", "Champion Golf", MACHINE_SUPPORTS_SAVE )
-GAME( 1984, crgolfbt, crgolf, crgolf, crgolfb, crgolf_state, empty_init, ROT0, "bootleg", "Champion Golf (bootleg)", MACHINE_SUPPORTS_SAVE )
-GAME( 1985, crgolfhi, 0, crgolfhi, crgolfa, crgolf_state, init_crgolfhi, ROT0, "Nasco Japan", "Crowns Golf in Hawaii", MACHINE_SUPPORTS_SAVE )
+GAME( 1984, crgolf, 0, crgolf, crgolf, crgolf_state, empty_init, ROT0, "Nasco Japan", "Crowns Golf (834-5419-04)", MACHINE_SUPPORTS_SAVE )
+GAME( 1984, crgolfa, crgolf, crgolf, crgolfa, crgolf_state, empty_init, ROT0, "Nasco Japan", "Crowns Golf (834-5419-03)", MACHINE_SUPPORTS_SAVE )
+GAME( 1984, crgolfb, crgolf, crgolf, crgolfb, crgolf_state, empty_init, ROT0, "Nasco Japan", "Crowns Golf (set 3)", MACHINE_SUPPORTS_SAVE )
+GAME( 1984, crgolfc, crgolf, crgolf, crgolfb, crgolf_state, empty_init, ROT0, "Nasco Japan", "Champion Golf", MACHINE_SUPPORTS_SAVE )
+GAME( 1984, crgolfbt, crgolf, crgolf, crgolfb, crgolf_state, empty_init, ROT0, "bootleg", "Champion Golf (bootleg)", MACHINE_SUPPORTS_SAVE )
+GAME( 1985, crgolfhi, 0, crgolfhi, crgolfa, crgolfhi_state, empty_init, ROT0, "Nasco Japan", "Crowns Golf in Hawaii", MACHINE_SUPPORTS_SAVE )
-GAME( 1985, mastrglf, 0, mastrglf, crgolf, crgolf_state, empty_init, ROT0, "Nasco", "Master's Golf", MACHINE_NOT_WORKING | MACHINE_UNEMULATED_PROTECTION )
+GAME( 1985, mastrglf, 0, mastrglf, crgolf, mastrglf_state, empty_init, ROT0, "Nasco", "Master's Golf", MACHINE_NOT_WORKING | MACHINE_UNEMULATED_PROTECTION )
diff --git a/src/mame/drivers/itech32.cpp b/src/mame/drivers/itech32.cpp
index 7f789945267..b04ae9feb27 100644
--- a/src/mame/drivers/itech32.cpp
+++ b/src/mame/drivers/itech32.cpp
@@ -2206,7 +2206,44 @@ ROM_START( bloodstm )
ROM_LOAD16_BYTE( "bssrom2.bin", 0x300000, 0x40000, CRC(8aee1e77) SHA1(f949fa89ee7d59f457ce89c72d461cecd0cface3) )
ROM_END
-ROM_START( bloodstm22 )
+ROM_START( bloodstm221 ) // this board had generic stickers
+ ROM_REGION16_BE( 0x80000, "user1", 0 )
+ ROM_LOAD16_BYTE( "bld00_v21.u83", 0x00000, 0x40000, CRC(01907aec) SHA1(a954366f2374c0836140e3b75a55ff47e4cfa645) )
+ ROM_LOAD16_BYTE( "bld01_v21.u88", 0x00001, 0x40000, CRC(eeae123e) SHA1(9fdd53d6651cac16402a9c3fe0ae15c9b1baa0db) )
+
+ ROM_REGION( 0x28000, "soundcpu", 0 )
+ ROM_LOAD( "bldsnd_v10.u17", 0x10000, 0x18000, CRC(dddeedbb) SHA1(f8ea786836630fc44bba968845fd2cb42cd81592) )
+ ROM_CONTINUE( 0x08000, 0x08000 )
+
+ ROM_REGION( 0x880000, "gfx1", 0 )
+ ROM_LOAD32_BYTE( "bsgrom0.bin", 0x000000, 0x080000, CRC(4e10b8c1) SHA1(b80f7dbf32faa97829c735da6dc0ee424dc9ecec) )
+ ROM_LOAD32_BYTE( "bsgrom5.bin", 0x000001, 0x080000, CRC(6333b6ce) SHA1(53b884e09d198f8f53449bd011ba743c28b2c934) )
+ ROM_LOAD32_BYTE( "bsgrom10.bin", 0x000002, 0x080000, CRC(a972a65c) SHA1(7772c2e0aaa0b3183c6287125b95fd1cd0c3775a) )
+ ROM_LOAD32_BYTE( "bsgrom15.bin", 0x000003, 0x080000, CRC(9a8f54aa) SHA1(3a2f99c28324ba1fcfb652bdc596d94c90637b72) )
+ ROM_LOAD32_BYTE( "bsgrom1.bin", 0x200000, 0x080000, CRC(10abf660) SHA1(e5b28ee12972abbcd883d702f496feae62d19e07) )
+ ROM_LOAD32_BYTE( "bsgrom6.bin", 0x200001, 0x080000, CRC(06a260d5) SHA1(f506b799bbb5d4465a4ab564cfd276877b8a52e9) )
+ ROM_LOAD32_BYTE( "bsgrom11.bin", 0x200002, 0x080000, CRC(f2cab3c7) SHA1(eecb1f2f8a3f3b1663a51c343e28e1b2078da5f4) )
+ ROM_LOAD32_BYTE( "bsgrom16.bin", 0x200003, 0x080000, CRC(403aef7b) SHA1(0a2a61480cddd020bfbad01c6c328dfa6760bddd) )
+ ROM_LOAD32_BYTE( "bsgrom2.bin", 0x400000, 0x080000, CRC(488200b1) SHA1(ae25bb5e9a836ae362d88de4e392ff46ff93c636) )
+ ROM_LOAD32_BYTE( "bsgrom7.bin", 0x400001, 0x080000, CRC(5bb19727) SHA1(fd8aa73ff0606ac86f054794f6abc42f99b4f856) )
+ ROM_LOAD32_BYTE( "bsgrom12.bin", 0x400002, 0x080000, CRC(b10d674f) SHA1(f5c713480deac44b86173ca9ac3aeea8a4d2ac85) )
+ ROM_LOAD32_BYTE( "bsgrom17.bin", 0x400003, 0x080000, CRC(7119df7e) SHA1(67acb0525f21d5cd174528fb0fa72c7101deb5eb) )
+ ROM_LOAD32_BYTE( "bsgrom3.bin", 0x600000, 0x080000, CRC(2378792e) SHA1(8cf1040a86ce7b6be3f56d144d4a17b7a888a648) )
+ ROM_LOAD32_BYTE( "bsgrom8.bin", 0x600001, 0x080000, CRC(3640ca2e) SHA1(1fbc8306c7310ab23d40887c16f80e2dc3d730f8) )
+ ROM_LOAD32_BYTE( "bsgrom13.bin", 0x600002, 0x080000, CRC(bd4a071d) SHA1(f25483591659d7424a4c62d0093fa56e5d337bf3) )
+ ROM_LOAD32_BYTE( "bsgrom18.bin", 0x600003, 0x080000, CRC(12959bb8) SHA1(f74d407004ccbf461f749672e4e57a5f0b6b549f) )
+ ROM_FILL( 0x800000, 0x080000, 0xff )
+
+ ROM_REGION16_BE( 0x400000, "ensoniq.0", ROMREGION_ERASE00 )
+ ROM_LOAD16_BYTE( "ensoniq.2m", 0x000000, 0x200000, CRC(9fdc4825) SHA1(71e5255c66d9010be7e6f27916b605441fc53839) )
+
+ ROM_REGION16_BE( 0x400000, "ensoniq.2", ROMREGION_ERASE00 )
+ ROM_LOAD16_BYTE( "bssrom0.bin", 0x000000, 0x80000, CRC(ee4570c8) SHA1(73dd292224bf182770b3cc2d90eb52b7d7b24378) )
+ ROM_LOAD16_BYTE( "bssrom1.bin", 0x100000, 0x80000, CRC(b0f32ec5) SHA1(666f904b31cdef12cbf1dbb43a7d3ff7c2903260) )
+ ROM_LOAD16_BYTE( "bssrom2.bin", 0x300000, 0x40000, CRC(8aee1e77) SHA1(f949fa89ee7d59f457ce89c72d461cecd0cface3) )
+ROM_END
+
+ROM_START( bloodstm220 )
ROM_REGION16_BE( 0x80000, "user1", 0 )
ROM_LOAD16_BYTE( "bld00_v22.u83", 0x00000, 0x40000, CRC(904e9208) SHA1(12e96027724b905140250db969130d90b1afec83) ) /* Labeled BLD00 V2.2 (U83) */
ROM_LOAD16_BYTE( "bld01_v22.u88", 0x00001, 0x40000, CRC(78336a7b) SHA1(76002ce4a2d83ceae10d9c9c123013832a081150) ) /* Labeled BLD01 V2.2 (U88) */
@@ -2243,7 +2280,7 @@ ROM_START( bloodstm22 )
ROM_LOAD16_BYTE( "bssrom2.bin", 0x300000, 0x40000, CRC(8aee1e77) SHA1(f949fa89ee7d59f457ce89c72d461cecd0cface3) )
ROM_END
-ROM_START( bloodstm21 )
+ROM_START( bloodstm210 )
ROM_REGION16_BE( 0x80000, "user1", 0 )
ROM_LOAD16_BYTE( "bld00_v21.u83", 0x00000, 0x40000, CRC(71215c8e) SHA1(ee0f94c3a2619d7e3cc1ba5e1888a97b0c75a3ae) ) /* Labeled BLD00 V2.1 (U83) */
ROM_LOAD16_BYTE( "bld01_v21.u88", 0x00001, 0x40000, CRC(da403da6) SHA1(0f09f38ae932acb4ddbb6323bce58be7284cb24b) ) /* Labeled BLD01 V2.1 (U88) */
@@ -2280,7 +2317,7 @@ ROM_START( bloodstm21 )
ROM_LOAD16_BYTE( "bssrom2.bin", 0x300000, 0x40000, CRC(8aee1e77) SHA1(f949fa89ee7d59f457ce89c72d461cecd0cface3) )
ROM_END
-ROM_START( bloodstm11 )
+ROM_START( bloodstm110 )
ROM_REGION16_BE( 0x80000, "user1", 0 )
ROM_LOAD16_BYTE( "bld00_v11.u83", 0x00000, 0x40000, CRC(4fff8f9b) SHA1(90f450497935322b0082a70e10abf758fc441dd0) ) /* Labeled BLD00 V1.1 (U83) */
ROM_LOAD16_BYTE( "bld01_v11.u88", 0x00001, 0x40000, CRC(59ce23ea) SHA1(6aa02fff07f5ec6dff4f6db9ea7878a722079f81) ) /* Labeled BLD01 V1.1 (U88) */
@@ -2317,7 +2354,7 @@ ROM_START( bloodstm11 )
ROM_LOAD16_BYTE( "bssrom2.bin", 0x300000, 0x40000, CRC(8aee1e77) SHA1(f949fa89ee7d59f457ce89c72d461cecd0cface3) )
ROM_END
-ROM_START( bloodstm10 )
+ROM_START( bloodstm104 )
ROM_REGION16_BE( 0x80000, "user1", 0 )
ROM_LOAD16_BYTE( "bld00_v10.u83", 0x00000, 0x40000, CRC(a0982119) SHA1(7a55f662db062488714b42aedea56eea3b80aed5) ) /* Labeled BLD00 V1.0 (U83) */
ROM_LOAD16_BYTE( "bld01_v10.u88", 0x00001, 0x40000, CRC(65800339) SHA1(379e57bd2c31180fa077b9a6e9fcffacde95280c) ) /* Labeled BLD01 V1.0 (U88) */
@@ -5094,10 +5131,11 @@ GAME( 1993, hardyard11, hardyard, bloodstm, hardyard, itech32_state, init_har
GAME( 1993, hardyard10, hardyard, bloodstm, hardyard, itech32_state, init_hardyard, ROT0, "Strata/Incredible Technologies", "Hard Yardage (v1.00)", MACHINE_SUPPORTS_SAVE )
GAME( 1994, bloodstm, 0, bloodstm, bloodstm, itech32_state, init_bloodstm, ROT0, "Strata/Incredible Technologies", "Blood Storm (v2.22)", MACHINE_SUPPORTS_SAVE )
-GAME( 1994, bloodstm22, bloodstm, bloodstm, bloodstm, itech32_state, init_bloodstm, ROT0, "Strata/Incredible Technologies", "Blood Storm (v2.20)", MACHINE_SUPPORTS_SAVE )
-GAME( 1994, bloodstm21, bloodstm, bloodstm, bloodstm, itech32_state, init_bloodstm, ROT0, "Strata/Incredible Technologies", "Blood Storm (v2.10)", MACHINE_SUPPORTS_SAVE )
-GAME( 1994, bloodstm11, bloodstm, bloodstm, bloodstm, itech32_state, init_bloodstm, ROT0, "Strata/Incredible Technologies", "Blood Storm (v1.10)", MACHINE_SUPPORTS_SAVE )
-GAME( 1994, bloodstm10, bloodstm, bloodstm, bloodstm, itech32_state, init_bloodstm, ROT0, "Strata/Incredible Technologies", "Blood Storm (v1.04)", MACHINE_SUPPORTS_SAVE )
+GAME( 1994, bloodstm221, bloodstm, bloodstm, bloodstm, itech32_state, init_bloodstm, ROT0, "Strata/Incredible Technologies", "Blood Storm (v2.21)", MACHINE_SUPPORTS_SAVE )
+GAME( 1994, bloodstm220, bloodstm, bloodstm, bloodstm, itech32_state, init_bloodstm, ROT0, "Strata/Incredible Technologies", "Blood Storm (v2.20)", MACHINE_SUPPORTS_SAVE )
+GAME( 1994, bloodstm210, bloodstm, bloodstm, bloodstm, itech32_state, init_bloodstm, ROT0, "Strata/Incredible Technologies", "Blood Storm (v2.10)", MACHINE_SUPPORTS_SAVE )
+GAME( 1994, bloodstm110, bloodstm, bloodstm, bloodstm, itech32_state, init_bloodstm, ROT0, "Strata/Incredible Technologies", "Blood Storm (v1.10)", MACHINE_SUPPORTS_SAVE )
+GAME( 1994, bloodstm104, bloodstm, bloodstm, bloodstm, itech32_state, init_bloodstm, ROT0, "Strata/Incredible Technologies", "Blood Storm (v1.04)", MACHINE_SUPPORTS_SAVE )
GAME( 1994, pairs, 0, bloodstm, pairs, itech32_state, init_bloodstm, ROT0, "Strata/Incredible Technologies", "Pairs (V1.2, 09/30/94)", MACHINE_SUPPORTS_SAVE )
GAME( 1994, pairsa, pairs, bloodstm, pairs, itech32_state, init_bloodstm, ROT0, "Strata/Incredible Technologies", "Pairs (V1, 09/07/94)", MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/includes/angelkds.h b/src/mame/includes/angelkds.h
deleted file mode 100644
index 14b89813b2d..00000000000
--- a/src/mame/includes/angelkds.h
+++ /dev/null
@@ -1,87 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:David Haywood
-/*************************************************************************
-
- Angel Kids
-
-*************************************************************************/
-#ifndef MAME_INCLUDES_ANGELKDS_H
-#define MAME_INCLUDES_ANGELKDS_H
-
-#pragma once
-
-#include "tilemap.h"
-
-class angelkds_state : public driver_device
-{
-public:
- angelkds_state(const machine_config &mconfig, device_type type, const char *tag) :
- driver_device(mconfig, type, tag),
- m_bgtopvideoram(*this, "bgtopvideoram"),
- m_bgbotvideoram(*this, "bgbotvideoram"),
- m_txvideoram(*this, "txvideoram"),
- m_spriteram(*this, "spriteram"),
- m_subcpu(*this, "sub"),
- m_maincpu(*this, "maincpu"),
- m_gfxdecode(*this, "gfxdecode"),
- m_decrypted_opcodes(*this, "decrypted_opcodes")
- { }
-
- void init_angelkds();
- void angelkds(machine_config &config);
- void spcpostn(machine_config &config);
-
-private:
- /* memory pointers */
- required_shared_ptr<uint8_t> m_bgtopvideoram;
- required_shared_ptr<uint8_t> m_bgbotvideoram;
- required_shared_ptr<uint8_t> m_txvideoram;
- required_shared_ptr<uint8_t> m_spriteram;
-
- tilemap_t *m_tx_tilemap = nullptr;
- tilemap_t *m_bgbot_tilemap = nullptr;
- tilemap_t *m_bgtop_tilemap = nullptr;
- int m_txbank = 0;
- int m_bgbotbank = 0;
- int m_bgtopbank = 0;
-
- uint8_t m_sound[4]{};
- uint8_t m_sound2[4]{};
- uint8_t m_layer_ctrl = 0;
-
- /* devices */
- required_device<cpu_device> m_subcpu;
- uint8_t angeklds_ff_r() { return 0xff; }
- void angelkds_cpu_bank_write(uint8_t data);
- void angelkds_main_sound_w(offs_t offset, uint8_t data);
- uint8_t angelkds_main_sound_r(offs_t offset);
- void angelkds_sub_sound_w(offs_t offset, uint8_t data);
- uint8_t angelkds_sub_sound_r(offs_t offset);
- void angelkds_txvideoram_w(offs_t offset, uint8_t data);
- void angelkds_txbank_write(uint8_t data);
- void angelkds_bgtopvideoram_w(offs_t offset, uint8_t data);
- void angelkds_bgtopbank_write(uint8_t data);
- void angelkds_bgtopscroll_write(uint8_t data);
- void angelkds_bgbotvideoram_w(offs_t offset, uint8_t data);
- void angelkds_bgbotbank_write(uint8_t data);
- void angelkds_bgbotscroll_write(uint8_t data);
- void angelkds_layer_ctrl_write(uint8_t data);
- TILE_GET_INFO_MEMBER(get_tx_tile_info);
- TILE_GET_INFO_MEMBER(get_bgtop_tile_info);
- TILE_GET_INFO_MEMBER(get_bgbot_tile_info);
- virtual void machine_start() override;
- virtual void machine_reset() override;
- virtual void video_start() override;
- uint32_t screen_update_angelkds(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int enable_n);
- required_device<cpu_device> m_maincpu;
- required_device<gfxdecode_device> m_gfxdecode;
- optional_shared_ptr<uint8_t> m_decrypted_opcodes;
- void decrypted_opcodes_map(address_map &map);
- void main_map(address_map &map);
- void main_portmap(address_map &map);
- void sub_map(address_map &map);
- void sub_portmap(address_map &map);
-};
-
-#endif // MAME_INCLUDES_ANGELKDS_H
diff --git a/src/mame/includes/crgolf.h b/src/mame/includes/crgolf.h
deleted file mode 100644
index 7ca2a74cd47..00000000000
--- a/src/mame/includes/crgolf.h
+++ /dev/null
@@ -1,95 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Aaron Giles
-/*************************************************************************
-
- Kitco Crowns Golf hardware
-
-**************************************************************************/
-#ifndef MAME_INCLUDES_CRGOLF_H
-#define MAME_INCLUDES_CRGOLF_H
-
-#pragma once
-
-#include "sound/msm5205.h"
-#include "machine/bankdev.h"
-#include "emupal.h"
-
-#define MASTER_CLOCK XTAL(18'432'000)
-
-
-class crgolf_state : public driver_device
-{
-public:
- crgolf_state(const machine_config &mconfig, device_type type, const char *tag) :
- driver_device(mconfig, type, tag),
-
- m_videoram_a(*this, "vrama"),
- m_videoram_b(*this, "vramb"),
-
- m_vrambank(*this, "vrambank"),
- m_maincpu(*this, "maincpu"),
- m_audiocpu(*this, "audiocpu"),
- m_msm(*this, "msm"),
- m_palette(*this, "palette")
- { }
-
- void crgolfhi(machine_config &config);
- void crgolf(machine_config &config);
- void crgolf_video(machine_config &config);
- void mastrglf(machine_config &config);
- void init_crgolfhi();
-
-private:
-
- /* memory pointers */
- required_shared_ptr<uint8_t> m_videoram_a;
- required_shared_ptr<uint8_t> m_videoram_b;
-
- bool m_color_select = false;
- bool m_screen_flip = false;
- bool m_screena_enable = false;
- bool m_screenb_enable = false;
-
- /* misc */
- uint8_t m_port_select = 0U;
- uint16_t m_sample_offset = 0U;
- uint8_t m_sample_count = 0U;
-
- /* devices */
- required_device<address_map_bank_device> m_vrambank;
- required_device<cpu_device> m_maincpu;
- required_device<cpu_device> m_audiocpu;
- optional_device<msm5205_device> m_msm;
- required_device<palette_device> m_palette;
- void rom_bank_select_w(uint8_t data);
- uint8_t switch_input_r();
- uint8_t analog_input_r();
- void switch_input_select_w(uint8_t data);
- void unknown_w(uint8_t data);
- DECLARE_WRITE_LINE_MEMBER(color_select_w);
- DECLARE_WRITE_LINE_MEMBER(screen_flip_w);
- DECLARE_WRITE_LINE_MEMBER(screen_select_w);
- DECLARE_WRITE_LINE_MEMBER(screena_enable_w);
- DECLARE_WRITE_LINE_MEMBER(screenb_enable_w);
- void crgolfhi_sample_w(offs_t offset, uint8_t data);
- uint8_t unk_sub_02_r();
- uint8_t unk_sub_05_r();
- uint8_t unk_sub_07_r();
- void unk_sub_0c_w(uint8_t data);
- virtual void machine_start() override;
- virtual void machine_reset() override;
- void crgolf_palette(palette_device &palette) const;
- void mastrglf_palette(palette_device &palette) const;
- uint32_t screen_update_crgolf(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- void get_pens( pen_t *pens );
- DECLARE_WRITE_LINE_MEMBER(vck_callback);
- void main_map(address_map &map);
- void mastrglf_io(address_map &map);
- void mastrglf_map(address_map &map);
- void mastrglf_subio(address_map &map);
- void mastrglf_submap(address_map &map);
- void sound_map(address_map &map);
- void vrambank_map(address_map &map);
-};
-
-#endif // MAME_INCLUDES_CRGOLF_H
diff --git a/src/mame/mame.lst b/src/mame/mame.lst
index f9abec3259a..2773f7d2abb 100644
--- a/src/mame/mame.lst
+++ b/src/mame/mame.lst
@@ -17540,10 +17540,11 @@ virtpool //
@source:itech32.cpp
bloodstm // (c) 1994 Strata/Incredible Technologies
-bloodstm10 // (c) 1994 Strata/Incredible Technologies
-bloodstm11 // (c) 1994 Strata/Incredible Technologies
-bloodstm21 // (c) 1994 Strata/Incredible Technologies
-bloodstm22 // (c) 1994 Strata/Incredible Technologies
+bloodstm104 // (c) 1994 Strata/Incredible Technologies
+bloodstm110 // (c) 1994 Strata/Incredible Technologies
+bloodstm210 // (c) 1994 Strata/Incredible Technologies
+bloodstm220 // (c) 1994 Strata/Incredible Technologies
+bloodstm221 // (c) 1994 Strata/Incredible Technologies
drivedge // (c) 1994 Strata/Incredible Technologies
gt2k // (c) 2000 Incredible Technologies
gt2kp100 // (c) 2000 Incredible Technologies
diff --git a/src/mame/video/angelkds.cpp b/src/mame/video/angelkds.cpp
deleted file mode 100644
index 13e72c78934..00000000000
--- a/src/mame/video/angelkds.cpp
+++ /dev/null
@@ -1,265 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:David Haywood
-/* video/angelkds.c - see drivers/angelkds.c for more info */
-
-/* graphical issues
-
-enable / disable tilemap bits might be wrong
-
-*/
-
-#include "emu.h"
-#include "includes/angelkds.h"
-#include "screen.h"
-
-
-/*** Text Layer Tilemap
-
-*/
-
-TILE_GET_INFO_MEMBER(angelkds_state::get_tx_tile_info)
-{
- int tileno;
-
- tileno = m_txvideoram[tile_index] + (m_txbank * 0x100);
- tileinfo.set(0, tileno, 0, 0);
-}
-
-void angelkds_state::angelkds_txvideoram_w(offs_t offset, uint8_t data)
-{
- m_txvideoram[offset] = data;
- m_tx_tilemap->mark_tile_dirty(offset);
-}
-
-void angelkds_state::angelkds_txbank_write(uint8_t data)
-{
- if (m_txbank != data)
- {
- m_txbank = data;
- m_tx_tilemap->mark_all_dirty();
- }
-}
-
-/*** Top Half Background Tilemap
-
-*/
-
-TILE_GET_INFO_MEMBER(angelkds_state::get_bgtop_tile_info)
-{
- int tileno;
-
- tileno = m_bgtopvideoram[tile_index];
-
- tileno += m_bgtopbank * 0x100 ;
- tileinfo.set(1, tileno, 0, 0);
-}
-
-void angelkds_state::angelkds_bgtopvideoram_w(offs_t offset, uint8_t data)
-{
- m_bgtopvideoram[offset] = data;
- m_bgtop_tilemap->mark_tile_dirty(offset);
-}
-
-void angelkds_state::angelkds_bgtopbank_write(uint8_t data)
-{
- if (m_bgtopbank != data)
- {
- m_bgtopbank = data;
- m_bgtop_tilemap->mark_all_dirty();
- }
-}
-
-void angelkds_state::angelkds_bgtopscroll_write(uint8_t data)
-{
- m_bgtop_tilemap->set_scrollx(0, data);
-}
-
-/*** Bottom Half Background Tilemap
-
-*/
-
-TILE_GET_INFO_MEMBER(angelkds_state::get_bgbot_tile_info)
-{
- int tileno;
-
- tileno = m_bgbotvideoram[tile_index];
-
- tileno += m_bgbotbank * 0x100 ;
- tileinfo.set(2, tileno, 1, 0);
-}
-
-void angelkds_state::angelkds_bgbotvideoram_w(offs_t offset, uint8_t data)
-{
- m_bgbotvideoram[offset] = data;
- m_bgbot_tilemap->mark_tile_dirty(offset);
-}
-
-
-void angelkds_state::angelkds_bgbotbank_write(uint8_t data)
-{
- if (m_bgbotbank != data)
- {
- m_bgbotbank = data;
- m_bgbot_tilemap->mark_all_dirty();
- }
-}
-
-void angelkds_state::angelkds_bgbotscroll_write(uint8_t data)
-{
- m_bgbot_tilemap->set_scrollx(0, data);
-}
-
-
-void angelkds_state::angelkds_layer_ctrl_write(uint8_t data)
-{
- m_layer_ctrl = data;
-}
-
-/*** Sprites
-
-the sprites are similar to the tilemaps in the sense that there is
-a split down the middle of the screen
-
-*/
-
-void angelkds_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int enable_n)
-{
- const uint8_t *source = m_spriteram + 0x100 - 4;
- const uint8_t *finish = m_spriteram;
- gfx_element *gfx = m_gfxdecode->gfx(3);
-
- while (source >= finish)
- {
- /*
-
- nnnn nnnn - EeFf B?cc - yyyy yyyy - xxxx xxxx
-
- n = sprite number
- E = Sprite Enabled in Top Half of Screen
- e = Sprite Enabled in Bottom Half of Screen
- F = Flip Y
- f = Flip X
- B = Tile Bank
- ? = unknown, nothing / unused? recheck
- c = color
- y = Y position
- x = X position
-
- */
- uint16_t tile_no = source[0];
- uint8_t attr = source[1];
- uint8_t ypos = source[2];
- uint8_t xpos = source[3];
-
- uint8_t enable = attr & 0xc0;
- uint8_t flipx = (attr & 0x10) >> 4;
- uint8_t flipy = (attr & 0x20) >> 5;
- uint8_t bank = attr & 0x08;
- uint8_t color = attr & 0x03;
-
- if (bank)
- tile_no += 0x100;
-
- ypos = 0xff - ypos;
-
- if (enable & enable_n)
- {
- gfx->transpen(
- bitmap,
- cliprect,
- tile_no,
- color*4,
- flipx,flipy,
- xpos,ypos,15
- );
- /* wraparound */
- if (xpos > 240)
-
- gfx->transpen(
- bitmap,
- cliprect,
- tile_no,
- color*4,
- flipx,flipy,
- xpos-256,ypos,15
- );
- /* wraparound */
- if (ypos > 240)
- {
- gfx->transpen(
- bitmap,
- cliprect,
- tile_no,
- color*4,
- flipx,flipy,
- xpos,ypos-256,15
- );
- /* wraparound */
- if (xpos > 240)
-
- gfx->transpen(
- bitmap,
- cliprect,
- tile_no,
- color*4,
- flipx,flipy,
- xpos-256,ypos-256,15
- );
- }
- }
-
- source -= 0x04;
- }
-
-}
-
-
-/*** Video Start & Update
-
-*/
-
-void angelkds_state::video_start()
-{
- m_tx_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(angelkds_state::get_tx_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
- m_tx_tilemap->set_transparent_pen(0);
-
- m_bgbot_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(angelkds_state::get_bgbot_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
- m_bgbot_tilemap->set_transparent_pen(15);
-
- m_bgtop_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(angelkds_state::get_bgtop_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
- m_bgtop_tilemap->set_transparent_pen(15);
-}
-
-/* enable bits are uncertain */
-
-uint32_t angelkds_state::screen_update_angelkds(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
-{
- const rectangle &visarea = screen.visible_area();
- rectangle clip;
-
- bitmap.fill(0x3f, cliprect); /* is there a register controlling the colour?, we currently use the last colour of the tx palette */
-
- /* draw top of screen */
- clip.set(8*0, 8*16-1, visarea.min_y, visarea.max_y);
-
- if ((m_layer_ctrl & 0x80) == 0x00)
- m_bgtop_tilemap->draw(screen, bitmap, clip, 0, 0);
-
- draw_sprites(bitmap, clip, 0x80);
-
- if ((m_layer_ctrl & 0x20) == 0x00)
- m_tx_tilemap->draw(screen, bitmap, clip, 0, 0);
-
- /* draw bottom of screen */
- clip.set(8*16, 8*32-1, visarea.min_y, visarea.max_y);
-
- if ((m_layer_ctrl & 0x40) == 0x00)
- m_bgbot_tilemap->draw(screen, bitmap, clip, 0, 0);
-
- draw_sprites(bitmap, clip, 0x40);
-
- if ((m_layer_ctrl & 0x20) == 0x00)
- m_tx_tilemap->draw(screen, bitmap, clip, 0, 0);
-
- return 0;
-}
diff --git a/src/mame/video/crgolf.cpp b/src/mame/video/crgolf.cpp
deleted file mode 100644
index 43d5bb8802f..00000000000
--- a/src/mame/video/crgolf.cpp
+++ /dev/null
@@ -1,131 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Aaron Giles
-/***************************************************************************
-
- Kitco Crowns Golf hardware
-
-***************************************************************************/
-
-#include "emu.h"
-#include "includes/crgolf.h"
-
-
-#define NUM_PENS (0x20)
-#define VIDEORAM_SIZE (0x2000 * 3)
-
-
-
-
-
-/*************************************
- *
- * Video startup
- *
- *************************************/
-
-void crgolf_state::crgolf_palette(palette_device &palette) const
-{
- uint8_t const *const prom = memregion("proms")->base();
-
- for (offs_t offs = 0; offs < NUM_PENS; offs++)
- {
- int bit0, bit1, bit2;
-
- uint8_t const data = prom[offs];
-
- // red component
- bit0 = BIT(data, 0);
- bit1 = BIT(data, 1);
- bit2 = BIT(data, 2);
- int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
-
- // green component
- bit0 = BIT(data, 3);
- bit1 = BIT(data, 4);
- bit2 = BIT(data, 5);
- int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
-
- // blue component
- bit0 = BIT(data, 6);
- bit1 = BIT(data, 7);
- int const b = 0x4f * bit0 + 0xa8 * bit1;
-
- m_palette->set_pen_color(offs, r, g, b);
- }
-}
-
-void crgolf_state::mastrglf_palette(palette_device &palette) const
-{
-}
-
-/*************************************
- *
- * Video update
- *
- *************************************/
-
-uint32_t crgolf_state::screen_update_crgolf(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
-{
- int flip = m_screen_flip;
-
- /* for each byte in the video RAM */
- for (offs_t offs = 0; offs < VIDEORAM_SIZE / 3; offs++)
- {
- uint8_t y = (offs & 0x1fe0) >> 5;
- uint8_t x = (offs & 0x001f) << 3;
-
- uint8_t data_a0 = m_videoram_a[0x2000 | offs];
- uint8_t data_a1 = m_videoram_a[0x0000 | offs];
- uint8_t data_a2 = m_videoram_a[0x4000 | offs];
- uint8_t data_b0 = m_videoram_b[0x2000 | offs];
- uint8_t data_b1 = m_videoram_b[0x0000 | offs];
- uint8_t data_b2 = m_videoram_b[0x4000 | offs];
-
- if (flip)
- {
- y = ~y;
- x = ~x;
- }
-
- /* for each pixel in the byte */
- for (int i = 0; i < 8; i++)
- {
- offs_t color;
- uint8_t data_b = 0;
- uint8_t data_a = 0;
-
- if (!m_screena_enable)
- data_a = ((data_a0 & 0x80) >> 7) | ((data_a1 & 0x80) >> 6) | ((data_a2 & 0x80) >> 5);
-
- if (!m_screenb_enable)
- data_b = ((data_b0 & 0x80) >> 7) | ((data_b1 & 0x80) >> 6) | ((data_b2 & 0x80) >> 5);
-
- /* screen A has priority over B */
- if (data_a)
- color = data_a;
- else
- color = data_b | 0x08;
-
- /* add HI bit if enabled */
- if (m_color_select)
- color = color | 0x10;
-
- bitmap.pix(y, x) = color;
-
- /* next pixel */
- data_a0 = data_a0 << 1;
- data_a1 = data_a1 << 1;
- data_a2 = data_a2 << 1;
- data_b0 = data_b0 << 1;
- data_b1 = data_b1 << 1;
- data_b2 = data_b2 << 1;
-
- if (flip)
- x = x - 1;
- else
- x = x + 1;
- }
- }
-
- return 0;
-}