- misc/falgas_m89.cpp: mapped some devices, rmontercarlo runs but needs implementation of the comms between main and video CPUs

- dooyong/gundealer.cpp, misc/aztarac.cpp: consolidated drivers in single files, minor cleanups
This commit is contained in:
Ivan Vangelista 2022-08-10 21:57:42 +02:00
parent 120cc5a33a
commit 176a606b3c
8 changed files with 539 additions and 500 deletions

View File

@ -69,14 +69,209 @@ Z80 CPU - 12MHz/2
***************************************************************************/
#include "emu.h"
#include "gundealr.h"
#include "cpu/z80/z80.h"
#include "machine/timer.h"
#include "sound/ymopn.h"
#include "emupal.h"
#include "screen.h"
#include "speaker.h"
#include "tilemap.h"
// configurable logging
#define LOG_MCUSIM (1U << 1)
//#define VERBOSE (LOG_GENERAL | LOG_MCUSIM)
#include "logmacro.h"
#define LOGMCUSIM(...) LOGMASKED(LOG_MCUSIM, __VA_ARGS__)
namespace {
class gundealr_state : public driver_device
{
public:
gundealr_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag)
, m_paletteram(*this, "paletteram")
, m_bg_videoram(*this, "bg_videoram")
, m_fg_videoram(*this, "fg_videoram")
, m_mainbank(*this, "mainbank")
, m_maincpu(*this, "maincpu")
, m_gfxdecode(*this, "gfxdecode")
, m_palette(*this, "palette")
{ }
void gundealr(machine_config &config);
void gundealrbl(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_paletteram;
required_shared_ptr<uint8_t> m_bg_videoram;
required_shared_ptr<uint8_t> m_fg_videoram;
required_memory_bank m_mainbank;
// devices
required_device<cpu_device> m_maincpu;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
// video-related
tilemap_t *m_bg_tilemap = nullptr;
tilemap_t *m_fg_tilemap = nullptr;
uint8_t m_scroll[4]{};
// misc
void bankswitch_w(uint8_t data);
void bg_videoram_w(offs_t offset, uint8_t data);
void fg_videoram_w(offs_t offset, uint8_t data);
void paletteram_w(offs_t offset, uint8_t data);
template<int Xor> void fg_scroll_w(offs_t offset, uint8_t data);
template<int Bit> void flipscreen_w(uint8_t data);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
TILEMAP_MAPPER_MEMBER(pagescan);
TILE_GET_INFO_MEMBER(get_fg_tile_info);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(scanline);
void base_map(address_map &map);
void gundealr_main_map(address_map &map);
void main_portmap(address_map &map);
void yamyam_main_map(address_map &map);
};
class yamyam_mcu_state : public gundealr_state
{
public:
yamyam_mcu_state(const machine_config &mconfig, device_type type, const char *tag)
: gundealr_state(mconfig, type, tag)
, m_rambase(*this, "rambase")
, m_port_in(*this, "IN%u", 0)
{ }
void yamyam(machine_config &config);
private:
required_shared_ptr<uint8_t> m_rambase;
required_ioport_array<3> m_port_in;
TIMER_DEVICE_CALLBACK_MEMBER(mcu_sim);
};
// video
/***************************************************************************
Callbacks for the TileMap code
***************************************************************************/
TILE_GET_INFO_MEMBER(gundealr_state::get_bg_tile_info)
{
uint8_t attr = m_bg_videoram[2 * tile_index + 1];
tileinfo.set(0,
m_bg_videoram[2 * tile_index] + ((attr & 0x07) << 8),
(attr & 0xf0) >> 4,
0);
}
TILEMAP_MAPPER_MEMBER(gundealr_state::pagescan)
{
// logical (col,row) -> memory offset
return (row & 0x0f) + ((col & 0x3f) << 4) + ((row & 0x10) << 6);
}
TILE_GET_INFO_MEMBER(gundealr_state::get_fg_tile_info)
{
uint8_t attr = m_fg_videoram[2 * tile_index + 1];
tileinfo.set(1,
m_fg_videoram[2 * tile_index] + ((attr & 0x03) << 8),
(attr & 0xf0) >> 4,
0);
}
/***************************************************************************
Start the video hardware emulation.
***************************************************************************/
void gundealr_state::video_start()
{
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(gundealr_state::get_bg_tile_info)), TILEMAP_SCAN_COLS, 8, 8, 32, 32);
m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(gundealr_state::get_fg_tile_info)), tilemap_mapper_delegate(*this, FUNC(gundealr_state::pagescan)), 16, 16, 64, 32);
m_fg_tilemap->set_transparent_pen(15);
}
/***************************************************************************
Memory handlers
***************************************************************************/
void gundealr_state::bg_videoram_w(offs_t offset, uint8_t data)
{
m_bg_videoram[offset] = data;
m_bg_tilemap->mark_tile_dirty(offset / 2);
}
void gundealr_state::fg_videoram_w(offs_t offset, uint8_t data)
{
m_fg_videoram[offset] = data;
m_fg_tilemap->mark_tile_dirty(offset / 2);
}
void gundealr_state::paletteram_w(offs_t offset, uint8_t data)
{
int val;
m_paletteram[offset] = data;
val = m_paletteram[offset & ~1];
const int r = (val >> 4) & 0x0f;
const int g = (val >> 0) & 0x0f;
val = m_paletteram[offset | 1];
const int b = (val >> 4) & 0x0f;
// TODO: the bottom 4 bits are used as well, but I'm not sure about the meaning
m_palette->set_pen_color(offset / 2, pal4bit(r), pal4bit(g), pal4bit(b));
}
/***************************************************************************
Display refresh
***************************************************************************/
uint32_t gundealr_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
return 0;
}
// machine
void gundealr_state::bankswitch_w(uint8_t data)
{
m_mainbank->set_entry(data & 0x07);
@ -87,8 +282,8 @@ template<int Xor>
void gundealr_state::fg_scroll_w(offs_t offset, uint8_t data)
{
m_scroll[offset] = data;
m_fg_tilemap->set_scrollx(0, m_scroll[0^Xor] | ((m_scroll[1^Xor] & 0x03) << 8));
m_fg_tilemap->set_scrolly(0, m_scroll[2^Xor] | ((m_scroll[3^Xor] & 0x03) << 8));
m_fg_tilemap->set_scrollx(0, m_scroll[0 ^ Xor] | ((m_scroll[1 ^ Xor] & 0x03) << 8));
m_fg_tilemap->set_scrolly(0, m_scroll[2 ^ Xor] | ((m_scroll[3 ^ Xor] & 0x03) << 8));
}
template<int Bit>
@ -101,16 +296,16 @@ void gundealr_state::flipscreen_w(uint8_t data)
void gundealr_state::base_map(address_map &map)
{
map(0x0000, 0x7fff).rom();
map(0x8000, 0xbfff).bankr("mainbank");
map(0x8000, 0xbfff).bankr(m_mainbank);
map(0xc000, 0xc000).portr("DSW0");
map(0xc001, 0xc001).portr("DSW1");
map(0xc004, 0xc004).portr("IN0");
map(0xc005, 0xc005).portr("IN1");
map(0xc006, 0xc006).portr("IN2");
map(0xc016, 0xc016).w(FUNC(gundealr_state::bankswitch_w));
map(0xc400, 0xc7ff).ram().w(FUNC(gundealr_state::paletteram_w)).share("paletteram");
map(0xc800, 0xcfff).ram().w(FUNC(gundealr_state::bg_videoram_w)).share("bg_videoram");
map(0xd000, 0xdfff).ram().w(FUNC(gundealr_state::fg_videoram_w)).share("fg_videoram");
map(0xc400, 0xc7ff).ram().w(FUNC(gundealr_state::paletteram_w)).share(m_paletteram);
map(0xc800, 0xcfff).ram().w(FUNC(gundealr_state::bg_videoram_w)).share(m_bg_videoram);
map(0xd000, 0xdfff).ram().w(FUNC(gundealr_state::fg_videoram_w)).share(m_fg_videoram);
map(0xe000, 0xffff).ram().share("rambase");
}
@ -139,10 +334,10 @@ void gundealr_state::main_portmap(address_map &map)
static INPUT_PORTS_START( gundealr )
PORT_START("DSW0")
PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:8") /* Listed in the manual as always OFF */
PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:8") // Listed in the manual as always OFF
PORT_DIPSETTING( 0x01, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:7") /* Listed in the manual as always OFF */
PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:7") // Listed in the manual as always OFF
PORT_DIPSETTING( 0x02, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:6,5")
@ -150,10 +345,10 @@ static INPUT_PORTS_START( gundealr )
PORT_DIPSETTING( 0x08, DEF_STR( Medium ) )
PORT_DIPSETTING( 0x04, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) )
PORT_DIPNAME( 0x10, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:4") /* Listed in the manual as always OFF */
PORT_DIPNAME( 0x10, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:4") // Listed in the manual as always OFF
PORT_DIPSETTING( 0x10, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:3") /* Listed in the manual as always OFF */
PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:3") // Listed in the manual as always OFF
PORT_DIPSETTING( 0x20, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x40, 0x00, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW1:2")
@ -182,7 +377,7 @@ static INPUT_PORTS_START( gundealr )
PORT_DIPSETTING( 0x30, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x28, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x20, DEF_STR( 1C_4C ) )
PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:2,1") /* Both switch 1 & 2 are listed in the manual as always OFF */
PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:2,1") // Both switch 1 & 2 are listed in the manual as always OFF
PORT_DIPSETTING( 0x00, "0" )
PORT_DIPSETTING( 0x40, "1" )
PORT_DIPSETTING( 0x80, "2" )
@ -205,8 +400,8 @@ static INPUT_PORTS_START( gundealr )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(2)
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) // probably unused
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) // probably unused
PORT_START("IN2")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(1)
@ -215,8 +410,8 @@ static INPUT_PORTS_START( gundealr )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(1)
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) // probably unused
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) // probably unused
INPUT_PORTS_END
static INPUT_PORTS_START( gundealt )
@ -277,8 +472,8 @@ static INPUT_PORTS_START( gundealt )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(1)
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) // probably unused
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) // probably unused
PORT_START("IN1")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(2)
@ -287,8 +482,8 @@ static INPUT_PORTS_START( gundealt )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(2)
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) // probably unused
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) // probably unused
PORT_START("IN2")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
@ -332,18 +527,18 @@ static INPUT_PORTS_START( yamyam )
PORT_DIPSETTING( 0x06, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x05, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x04, DEF_STR( 2C_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( 0x00, DEF_STR( 1C_1C ) )
PORT_DIPNAME( 0x38, 0x00, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW2:4,5,6")
PORT_DIPSETTING( 0x38, DEF_STR( 5C_1C ) )
PORT_DIPSETTING( 0x30, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x28, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x20, DEF_STR( 2C_1C ) )
/* PORT_DIPSETTING( 0x18, DEF_STR( 1C_1C ) ) */
/* PORT_DIPSETTING( 0x10, DEF_STR( 1C_1C ) ) */
/* PORT_DIPSETTING( 0x08, DEF_STR( 1C_1C ) ) */
PORT_DIPSETTING( 0x18, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x10, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x08, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) )
PORT_DIPNAME( 0x40, 0x00, DEF_STR( Free_Play ) ) PORT_DIPLOCATION("SW2:7")
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
@ -356,7 +551,7 @@ static INPUT_PORTS_START( yamyam )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_TILT ) /* "TEST" */
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_TILT ) // "TEST"
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
@ -367,8 +562,8 @@ static INPUT_PORTS_START( yamyam )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(2)
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) // probably unused
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) // probably unused
PORT_START("IN2")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(1)
@ -377,15 +572,15 @@ static INPUT_PORTS_START( yamyam )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(1)
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) // probably unused
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) // probably unused
INPUT_PORTS_END
static GFXDECODE_START( gfx_gundealr )
GFXDECODE_ENTRY( "gfx1", 0, gfx_8x8x4_packed_msb, 0, 16 ) /* colors 0-255 */
GFXDECODE_ENTRY( "gfx2", 0, gfx_8x8x4_col_2x2_group_packed_msb, 256, 16 ) /* colors 256-511 */
GFXDECODE_ENTRY( "gfx1", 0, gfx_8x8x4_packed_msb, 0, 16 ) // colors 0-255
GFXDECODE_ENTRY( "gfx2", 0, gfx_8x8x4_col_2x2_group_packed_msb, 256, 16 ) // colors 256-511
GFXDECODE_END
@ -410,21 +605,21 @@ TIMER_DEVICE_CALLBACK_MEMBER(gundealr_state::scanline)
{
int scanline = param;
if(scanline == 240) // vblank-out irq
m_maincpu->set_input_line_and_vector(0, HOLD_LINE,0xd7); /* Z80 - RST 10h */
else if((scanline == 0) || (scanline == 120) ) //timer irq
m_maincpu->set_input_line_and_vector(0, HOLD_LINE,0xcf); /* Z80 - RST 10h */
if (scanline == 240) // vblank-out irq
m_maincpu->set_input_line_and_vector(0, HOLD_LINE, 0xd7); // Z80 - RST 10h
else if ((scanline == 0) || (scanline == 120) ) //timer irq
m_maincpu->set_input_line_and_vector(0, HOLD_LINE, 0xcf); // Z80 - RST 10h
}
void gundealr_state::gundealr(machine_config &config)
{
/* basic machine hardware */
Z80(config, m_maincpu, XTAL(12'000'000)/2); /* 6 MHz verified for Yam! Yam!? */
// basic machine hardware
Z80(config, m_maincpu, XTAL(12'000'000) / 2); // 6 MHz verified for Yam! Yam!?
m_maincpu->set_addrmap(AS_PROGRAM, &gundealr_state::gundealr_main_map);
m_maincpu->set_addrmap(AS_IO, &gundealr_state::main_portmap);
TIMER(config, "scantimer").configure_scanline(FUNC(gundealr_state::scanline), "screen", 0, 1);
/* 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));
@ -436,13 +631,13 @@ void gundealr_state::gundealr(machine_config &config)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_gundealr);
PALETTE(config, m_palette).set_entries(512);
/* sound hardware */
// sound hardware
SPEAKER(config, "mono").front_center();
YM2203(config, "ymsnd", XTAL(12'000'000)/8).add_route(ALL_OUTPUTS, "mono", 0.25); /* 1.5Mhz verified for Yam! Yam!? */
YM2203(config, "ymsnd", XTAL(12'000'000) / 8).add_route(ALL_OUTPUTS, "mono", 0.25); // 1.5Mhz verified for Yam! Yam!?
}
TIMER_DEVICE_CALLBACK_MEMBER(gundealr_state::yamyam_mcu_sim)
TIMER_DEVICE_CALLBACK_MEMBER(yamyam_mcu_state::mcu_sim)
{
static const uint8_t snipped_cmd03[8] = { 0x3a, 0x00, 0xc0, 0x47, 0x3a, 0x01, 0xc0, 0xc9 };
static const uint8_t snipped_cmd05_1[5] = { 0xcd, 0x20, 0xe0, 0x7e, 0xc9 };
@ -450,7 +645,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(gundealr_state::yamyam_mcu_sim)
int i;
//logerror("e000 = %02x\n", m_rambase[0x000]);
LOGMCUSIM("e000 = %02x\n", m_rambase[0x000]);
switch(m_rambase[0x000])
{
case 0x03:
@ -462,8 +657,8 @@ TIMER_DEVICE_CALLBACK_MEMBER(gundealr_state::yamyam_mcu_sim)
3a 01 c0 ld a,($c001)
c9 ret
*/
for(i=0;i<8;i++)
m_rambase[0x010+i] = snipped_cmd03[i];
for(i = 0; i < 8; i++)
m_rambase[0x010 + i] = snipped_cmd03[i];
break;
case 0x04:
@ -480,8 +675,8 @@ TIMER_DEVICE_CALLBACK_MEMBER(gundealr_state::yamyam_mcu_sim)
c1 pop bc
c9 ret
*/
for(i=0;i<8;i++)
m_rambase[0x020+i] = snipped_cmd05_2[i];
for(i = 0; i < 8; i++)
m_rambase[0x020 + i] = snipped_cmd05_2[i];
/*
lookup data in table
@ -489,8 +684,8 @@ TIMER_DEVICE_CALLBACK_MEMBER(gundealr_state::yamyam_mcu_sim)
7e ld a,(hl)
c9 ret
*/
for(i=0;i<5;i++)
m_rambase[0x010+i] = snipped_cmd05_1[i];
for(i = 0; i < 5; i++)
m_rambase[0x010 + i] = snipped_cmd05_1[i];
break;
case 0x0a:
@ -506,18 +701,17 @@ TIMER_DEVICE_CALLBACK_MEMBER(gundealr_state::yamyam_mcu_sim)
m_rambase[0x006] = m_port_in[0]->read();
}
void gundealr_state::yamyam(machine_config &config)
void gundealr_state::gundealrbl(machine_config &config)
{
gundealr(config);
m_maincpu->set_addrmap(AS_PROGRAM, &gundealr_state::yamyam_main_map);
TIMER(config, "mcusim").configure_periodic(FUNC(gundealr_state::yamyam_mcu_sim), attotime::from_hz(6000000/60)); /* 6mhz confirmed */
}
void gundealr_state::gundealrbl(machine_config &config)
void yamyam_mcu_state::yamyam(machine_config &config)
{
yamyam(config);
config.device_remove("mcusim");
gundealrbl(config);
TIMER(config, "mcusim").configure_periodic(FUNC(yamyam_mcu_state::mcu_sim), attotime::from_hz(6000000 / 60)); // 6mhz confirmed
}
@ -528,15 +722,15 @@ void gundealr_state::gundealrbl(machine_config &config)
***************************************************************************/
ROM_START( gundealr )
ROM_REGION( 0x20000, "maincpu", 0 ) /* 64k for code + 128k for banks */
ROM_LOAD( "1.3j", 0x00000, 0x10000, CRC(5797e830) SHA1(54bd9fbcafdf3fff55d73ecfe26d8e8df0dd55d9) ) /* 27c512; NOTE: the socket is labeled 1, but the rom has a '2' sticker on it! */
/* banked at 0x8000-0xbfff */
ROM_REGION( 0x10000, "maincpu", 0 )
ROM_LOAD( "1.3j", 0x00000, 0x10000, CRC(5797e830) SHA1(54bd9fbcafdf3fff55d73ecfe26d8e8df0dd55d9) ) // 27c512; NOTE: the socket is labeled 1, but the ROM has a '2' sticker on it!
// banked at 0x8000-0xbfff
ROM_REGION( 0x10000, "gfx1", 0 )
ROM_LOAD( "3.6p", 0x00000, 0x10000, CRC(01f99de2) SHA1(2d9e9c50b0669811beb6fa53c0ff1b240fa939c7) )
ROM_REGION( 0x20000, "gfx2", 0 )
ROM_LOAD( "2.6b", 0x00000, 0x20000, CRC(7874ec41) SHA1(2d2ff013cc37ce5966aa4b6c6724234655196102) ) /* NOTE: the socket is labeled 2, but the rom has a '1' sticker on it! */
ROM_LOAD( "2.6b", 0x00000, 0x20000, CRC(7874ec41) SHA1(2d2ff013cc37ce5966aa4b6c6724234655196102) ) // NOTE: the socket is labeled 2, but the ROM has a '1' sticker on it!
ROM_REGION( 0x0200, "proms", 0 )
ROM_LOAD( "82s135.7l", 0x0000, 0x0100, NO_DUMP)
@ -544,9 +738,9 @@ ROM_START( gundealr )
ROM_END
ROM_START( gundealra )
ROM_REGION( 0x20000, "maincpu", 0 ) /* 64k for code + 128k for banks */
ROM_REGION( 0x10000, "maincpu", 0 )
ROM_LOAD( "gundeala.1.3j", 0x00000, 0x10000, CRC(d87e24f1) SHA1(5ac3e20e5848b9cab2a23e083d2566bfd54502d4) )
/* banked at 0x8000-0xbfff */
// banked at 0x8000-0xbfff
ROM_REGION( 0x10000, "gfx1", 0 )
ROM_LOAD( "gundeala.3.6p", 0x00000, 0x10000, CRC(836cf1a3) SHA1(ca57e7fc3e4497d249af963d1c8610e80ca65aa7) )
@ -560,9 +754,9 @@ ROM_START( gundealra )
ROM_END
ROM_START( gundealrt )
ROM_REGION( 0x20000, "maincpu", 0 ) /* 64k for code + 128k for banks */
ROM_REGION( 0x10000, "maincpu", 0 )
ROM_LOAD( "1.3j", 0x00000, 0x10000, CRC(1d951292) SHA1(a8bd34dfaf31c7dc4f9e0ec1fd7d4e10c5b29a85) )
/* banked at 0x8000-0xbfff */
// banked at 0x8000-0xbfff
ROM_REGION( 0x10000, "gfx1", 0 )
ROM_LOAD( "3.6p", 0x00000, 0x10000, CRC(01f99de2) SHA1(2d9e9c50b0669811beb6fa53c0ff1b240fa939c7) )
@ -576,9 +770,9 @@ ROM_START( gundealrt )
ROM_END
ROM_START( gundealrbl ) // gfx customs done out in TTL logic, different proms, patched code rom
ROM_REGION( 0x20000, "maincpu", 0 ) /* 64k for code + 128k for banks */
ROM_REGION( 0x10000, "maincpu", 0 )
ROM_LOAD( "29.2.am27c512.f10", 0x00000, 0x10000, CRC(7981751e) SHA1(3138581bcff84a11670ba54cbca608d590055b4e) ) // almost == gundealr "1.3j", 5 bytes different: (what does this change?)
/* banked at 0x8000-0xbfff */
// banked at 0x8000-0xbfff
// address gundealr gundealrbl
// 009a 07 00
// 6d4a 21 10
@ -599,15 +793,15 @@ ROM_START( gundealrbl ) // gfx customs done out in TTL logic, different proms, p
ROM_LOAD( "ep320pc.jed", 0x0000, 0x0400, NO_DUMP) // altera ep320pc on a daughterboard, undumped
ROM_END
ROM_START( yamyam ) /* DY-90010001 PCB */
ROM_REGION( 0x20000, "maincpu", 0 ) /* 64k for code + 128k for banks */
ROM_START( yamyam ) // DY-90010001 PCB
ROM_REGION( 0x20000, "maincpu", 0 )
ROM_LOAD( "3.10f", 0x00000, 0x20000, CRC(96ae9088) SHA1(a605882dcdcf1e8cf8b0112f614e696d59acfd97) )
/* banked at 0x8000-0xbfff */
// banked at 0x8000-0xbfff
ROM_REGION( 0x10000, "mcu", 0 ) // unknown 64 pin MCU at J9 with internal ROM code
ROM_LOAD( "mcu", 0x0000, 0x10000, NO_DUMP)
ROM_REGION( 0x10000, "gfx1", 0 ) /* only gfx are different, code is the same */
ROM_REGION( 0x10000, "gfx1", 0 ) // only gfx are different, code is the same
ROM_LOAD( "b2.16d", 0x00000, 0x10000, CRC(cb4f84ee) SHA1(54319ecbd74b763757eb6d17c8f7be0705ab0714) )
ROM_REGION( 0x20000, "gfx2", 0 )
@ -617,15 +811,15 @@ ROM_START( yamyam ) /* DY-90010001 PCB */
ROM_LOAD( "4.7e", 0x0000, 0x0100, NO_DUMP)
ROM_END
ROM_START( yamyamk ) /* DY-90010001 PCB */
ROM_REGION( 0x20000, "maincpu", 0 ) /* 64k for code + 128k for banks */
ROM_START( yamyamk ) // DY-90010001 PCB
ROM_REGION( 0x20000, "maincpu", 0 )
ROM_LOAD( "3.10f", 0x00000, 0x20000, CRC(96ae9088) SHA1(a605882dcdcf1e8cf8b0112f614e696d59acfd97) )
/* banked at 0x8000-0xbfff */
// banked at 0x8000-0xbfff
ROM_REGION( 0x10000, "mcu", 0 ) // unknown 64 pin MCU at J9 with internal ROM code
ROM_LOAD( "mcu", 0x0000, 0x10000, NO_DUMP)
ROM_REGION( 0x10000, "gfx1", 0 ) /* only gfx are different, code is the same */
ROM_REGION( 0x10000, "gfx1", 0 ) // only gfx are different, code is the same
ROM_LOAD( "2.16d", 0x00000, 0x10000, CRC(dc9691d8) SHA1(118a05a1c94020d6739ed8c805c61b8ab003b6af) )
ROM_REGION( 0x20000, "gfx2", 0 )
@ -635,15 +829,15 @@ ROM_START( yamyamk ) /* DY-90010001 PCB */
ROM_LOAD( "4.7e", 0x0000, 0x0100, NO_DUMP)
ROM_END
ROM_START( wiseguy ) /* DY-90010001 PCB */
ROM_REGION( 0x20000, "maincpu", 0 ) /* 64k for code + 128k for banks */
ROM_START( wiseguy ) // DY-90010001 PCB
ROM_REGION( 0x20000, "maincpu", 0 )
ROM_LOAD( "b3.f10", 0x00000, 0x20000, CRC(96ae9088) SHA1(a605882dcdcf1e8cf8b0112f614e696d59acfd97) )
/* banked at 0x8000-0xbfff */
// banked at 0x8000-0xbfff
ROM_REGION( 0x10000, "mcu", 0 ) // unknown 64 pin MCU at J9 with internal ROM code
ROM_LOAD( "mcu", 0x0000, 0x10000, NO_DUMP)
ROM_REGION( 0x10000, "gfx1", 0 ) /* only gfx are different, code is the same */
ROM_REGION( 0x10000, "gfx1", 0 ) // only gfx are different, code is the same
ROM_LOAD( "wguyb2.16d", 0x00000, 0x10000, CRC(1c684c46) SHA1(041bc500e31b02a8bf3ce4683a67de998f938ccc) )
ROM_REGION( 0x20000, "gfx2", 0 )
@ -653,13 +847,14 @@ ROM_START( wiseguy ) /* DY-90010001 PCB */
ROM_LOAD( "4.7e", 0x0000, 0x0100, NO_DUMP)
ROM_END
} // anonymous namespace
GAME( 1990, gundealr, 0, gundealr, gundealr, gundealr_state, empty_init, ROT270, "Dooyong", "Gun Dealer", MACHINE_SUPPORTS_SAVE )
GAME( 1990, gundealra, gundealr, gundealr, gundealr, gundealr_state, empty_init, ROT270, "Dooyong", "Gun Dealer (alt card set)", MACHINE_SUPPORTS_SAVE )
GAME( 1990, gundealrt, gundealr, gundealr, gundealt, gundealr_state, empty_init, ROT270, "Dooyong (Tecmo license)", "Gun Dealer (Japan)", MACHINE_SUPPORTS_SAVE )
GAME( 1990, gundealrbl, gundealr, gundealrbl, gundealr, gundealr_state, empty_init, ROT270, "Dooyong", "Gun Dealer (Yam! Yam!? hardware)", MACHINE_SUPPORTS_SAVE )
GAME( 1990, gundealr, 0, gundealr, gundealr, gundealr_state, empty_init, ROT270, "Dooyong", "Gun Dealer", MACHINE_SUPPORTS_SAVE )
GAME( 1990, gundealra, gundealr, gundealr, gundealr, gundealr_state, empty_init, ROT270, "Dooyong", "Gun Dealer (alt card set)", MACHINE_SUPPORTS_SAVE )
GAME( 1990, gundealrt, gundealr, gundealr, gundealt, gundealr_state, empty_init, ROT270, "Dooyong (Tecmo license)", "Gun Dealer (Japan)", MACHINE_SUPPORTS_SAVE )
GAME( 1990, gundealrbl, gundealr, gundealrbl, gundealr, gundealr_state, empty_init, ROT270, "Dooyong", "Gun Dealer (Yam! Yam!? hardware)", MACHINE_SUPPORTS_SAVE )
GAME( 1990, yamyam, 0, yamyam, yamyam, gundealr_state, empty_init, ROT0, "Dooyong", "Yam! Yam!?", MACHINE_SUPPORTS_SAVE )
GAME( 1990, yamyamk, yamyam, yamyam, yamyam, gundealr_state, empty_init, ROT0, "Dooyong", "Yam! Yam! (Korea)", MACHINE_SUPPORTS_SAVE )
GAME( 1990, wiseguy, yamyam, yamyam, yamyam, gundealr_state, empty_init, ROT0, "Dooyong", "Wise Guy", MACHINE_SUPPORTS_SAVE )
GAME( 1990, yamyam, 0, yamyam, yamyam, yamyam_mcu_state, empty_init, ROT0, "Dooyong", "Yam! Yam!?", MACHINE_SUPPORTS_SAVE )
GAME( 1990, yamyamk, yamyam, yamyam, yamyam, yamyam_mcu_state, empty_init, ROT0, "Dooyong", "Yam! Yam! (Korea)", MACHINE_SUPPORTS_SAVE )
GAME( 1990, wiseguy, yamyam, yamyam, yamyam, yamyam_mcu_state, empty_init, ROT0, "Dooyong", "Wise Guy", MACHINE_SUPPORTS_SAVE )

View File

@ -1,72 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:Nicola Salmoria
/*************************************************************************
Gun Dealer
*************************************************************************/
#include "machine/timer.h"
#include "emupal.h"
#include "tilemap.h"
class gundealr_state : public driver_device
{
public:
gundealr_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag)
, m_paletteram(*this, "paletteram")
, m_bg_videoram(*this, "bg_videoram")
, m_fg_videoram(*this, "fg_videoram")
, m_rambase(*this, "rambase")
, m_mainbank(*this, "mainbank")
, m_port_in(*this, "IN%u", 0)
, m_maincpu(*this, "maincpu")
, m_gfxdecode(*this, "gfxdecode")
, m_palette(*this, "palette")
{ }
void gundealr(machine_config &config);
void gundealrbl(machine_config &config);
void yamyam(machine_config &config);
private:
/* memory pointers */
required_shared_ptr<uint8_t> m_paletteram;
required_shared_ptr<uint8_t> m_bg_videoram;
required_shared_ptr<uint8_t> m_fg_videoram;
required_shared_ptr<uint8_t> m_rambase;
required_memory_bank m_mainbank;
optional_ioport_array<3> m_port_in;
/* video-related */
tilemap_t *m_bg_tilemap = nullptr;
tilemap_t *m_fg_tilemap = nullptr;
uint8_t m_scroll[4]{};
/* misc */
int m_input_ports_hack;
void bankswitch_w(uint8_t data);
void bg_videoram_w(offs_t offset, uint8_t data);
void fg_videoram_w(offs_t offset, uint8_t data);
void paletteram_w(offs_t offset, uint8_t data);
template<int Xor> void fg_scroll_w(offs_t offset, uint8_t data);
template<int Bit> void flipscreen_w(uint8_t data);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
TILEMAP_MAPPER_MEMBER(pagescan);
TILE_GET_INFO_MEMBER(get_fg_tile_info);
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(scanline);
TIMER_DEVICE_CALLBACK_MEMBER(yamyam_mcu_sim);
required_device<cpu_device> m_maincpu;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
void base_map(address_map &map);
void gundealr_main_map(address_map &map);
void main_portmap(address_map &map);
void yamyam_main_map(address_map &map);
};

View File

@ -1,110 +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 "gundealr.h"
/***************************************************************************
Callbacks for the TileMap code
***************************************************************************/
TILE_GET_INFO_MEMBER(gundealr_state::get_bg_tile_info)
{
uint8_t attr = m_bg_videoram[2 * tile_index + 1];
tileinfo.set(0,
m_bg_videoram[2 * tile_index] + ((attr & 0x07) << 8),
(attr & 0xf0) >> 4,
0);
}
TILEMAP_MAPPER_MEMBER(gundealr_state::pagescan)
{
/* logical (col,row) -> memory offset */
return (row & 0x0f) + ((col & 0x3f) << 4) + ((row & 0x10) << 6);
}
TILE_GET_INFO_MEMBER(gundealr_state::get_fg_tile_info)
{
uint8_t attr = m_fg_videoram[2 * tile_index + 1];
tileinfo.set(1,
m_fg_videoram[2 * tile_index] + ((attr & 0x03) << 8),
(attr & 0xf0) >> 4,
0);
}
/***************************************************************************
Start the video hardware emulation.
***************************************************************************/
void gundealr_state::video_start()
{
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(gundealr_state::get_bg_tile_info)), TILEMAP_SCAN_COLS, 8, 8, 32, 32);
m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(gundealr_state::get_fg_tile_info)), tilemap_mapper_delegate(*this, FUNC(gundealr_state::pagescan)), 16, 16, 64, 32);
m_fg_tilemap->set_transparent_pen(15);
}
/***************************************************************************
Memory handlers
***************************************************************************/
void gundealr_state::bg_videoram_w(offs_t offset, uint8_t data)
{
m_bg_videoram[offset] = data;
m_bg_tilemap->mark_tile_dirty(offset / 2);
}
void gundealr_state::fg_videoram_w(offs_t offset, uint8_t data)
{
m_fg_videoram[offset] = data;
m_fg_tilemap->mark_tile_dirty(offset / 2);
}
void gundealr_state::paletteram_w(offs_t offset, uint8_t data)
{
int r,g,b,val;
m_paletteram[offset] = data;
val = m_paletteram[offset & ~1];
r = (val >> 4) & 0x0f;
g = (val >> 0) & 0x0f;
val = m_paletteram[offset | 1];
b = (val >> 4) & 0x0f;
/* TODO: the bottom 4 bits are used as well, but I'm not sure about the meaning */
m_palette->set_pen_color(offset / 2, pal4bit(r), pal4bit(g), pal4bit(b));
}
/***************************************************************************
Display refresh
***************************************************************************/
uint32_t gundealr_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
return 0;
}

View File

@ -16,14 +16,216 @@
***************************************************************************/
#include "emu.h"
#include "aztarac.h"
#include "cpu/m68000/m68000.h"
#include "cpu/z80/z80.h"
#include "machine/gen_latch.h"
#include "machine/watchdog.h"
#include "machine/x2212.h"
#include "sound/ay8910.h"
#include "video/vector.h"
#include "screen.h"
#include "speaker.h"
namespace {
class aztarac_state : public driver_device
{
public:
aztarac_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_nvram(*this, "nvram"),
m_vector(*this, "vector"),
m_screen(*this, "screen"),
m_soundlatch(*this, "soundlatch"),
m_vectorram(*this, "vectorram"),
m_sticky(*this, "STICKY"),
m_stickz(*this, "STICKZ") { }
void aztarac(machine_config &config);
protected:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
private:
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
required_device<x2212_device> m_nvram;
required_device<vector_device> m_vector;
required_device<screen_device> m_screen;
required_device<generic_latch_8_device> m_soundlatch;
required_shared_ptr<uint16_t> m_vectorram;
required_ioport m_sticky;
required_ioport m_stickz;
uint8_t m_sound_status = 0;
uint32_t m_xcenter = 0;
uint32_t m_ycenter = 0;
void nvram_store_w(uint16_t data);
uint16_t joystick_r();
void ubr_w(uint8_t data);
uint8_t sound_r();
void sound_w(uint8_t data);
uint8_t snd_command_r();
uint8_t snd_status_r();
void snd_status_w(uint8_t data);
DECLARE_WRITE_LINE_MEMBER(video_interrupt);
INTERRUPT_GEN_MEMBER(snd_timed_irq);
inline void read_vectorram(int addr, int *x, int *y, int *c);
void main_map(address_map &map);
void sound_map(address_map &map);
};
// audio
uint8_t aztarac_state::sound_r()
{
return m_sound_status & 0x01;
}
void aztarac_state::sound_w(uint8_t data)
{
m_soundlatch->write(data);
m_sound_status ^= 0x21;
if (m_sound_status & 0x20)
m_audiocpu->set_input_line(0, HOLD_LINE);
}
uint8_t aztarac_state::snd_command_r()
{
m_sound_status |= 0x01;
m_sound_status &= ~0x20;
return m_soundlatch->read();
}
uint8_t aztarac_state::snd_status_r()
{
return m_sound_status & ~0x01;
}
void aztarac_state::snd_status_w(uint8_t data)
{
m_sound_status &= ~0x10;
}
INTERRUPT_GEN_MEMBER(aztarac_state::snd_timed_irq)
{
m_sound_status ^= 0x10;
if (m_sound_status & 0x10)
device.execute().set_input_line(0,HOLD_LINE);
}
// video
#define AVECTOR(x, y, color, intensity) \
m_vector->add_point(m_xcenter + ((x) << 16), m_ycenter - ((y) << 16), color, intensity)
WRITE_LINE_MEMBER(aztarac_state::video_interrupt)
{
if (state)
m_maincpu->set_input_line(M68K_IRQ_4, ASSERT_LINE);
}
inline void aztarac_state::read_vectorram(int addr, int *x, int *y, int *c)
{
*c = m_vectorram[addr] & 0xffff;
*x = m_vectorram[addr + 0x800] & 0x03ff;
*y = m_vectorram[addr + 0x1000] & 0x03ff;
if (*x & 0x200) *x |= 0xfffffc00;
if (*y & 0x200) *y |= 0xfffffc00;
}
void aztarac_state::ubr_w(uint8_t data)
{
int x, y, c, intensity, xoffset, yoffset, color;
int defaddr, objaddr = 0, ndefs;
m_maincpu->set_input_line(M68K_IRQ_4, CLEAR_LINE);
if (data) // data is the global intensity (always 0xff in Aztarac).
{
m_vector->clear_list();
while (1)
{
read_vectorram(objaddr, &xoffset, &yoffset, &c);
objaddr++;
if (c & 0x4000)
break;
if ((c & 0x2000) == 0)
{
defaddr = (c >> 1) & 0x7ff;
AVECTOR(xoffset, yoffset, 0, 0);
read_vectorram(defaddr, &x, &ndefs, &c);
ndefs++;
if (c & 0xff00)
{
// latch color only once
intensity = (c >> 8);
color = vector_device::color222(c & 0x3f);
while (ndefs--)
{
defaddr++;
read_vectorram(defaddr, &x, &y, &c);
if ((c & 0xff00) == 0)
AVECTOR(x + xoffset, y + yoffset, 0, 0);
else
AVECTOR(x + xoffset, y + yoffset, color, intensity);
}
}
else
{
// latch color for every definition
while (ndefs--)
{
defaddr++;
read_vectorram(defaddr, &x, &y, &c);
color = vector_device::color222(c & 0x3f);
AVECTOR(x + xoffset, y + yoffset, color, c >> 8);
}
}
}
}
}
}
void aztarac_state::video_start()
{
const rectangle &visarea = m_screen->visible_area();
int xmin = visarea.min_x;
int ymin = visarea.min_y;
int xmax = visarea.max_x;
int ymax = visarea.max_y;
m_xcenter = ((xmax + xmin) / 2) << 16;
m_ycenter = ((ymax + ymin) / 2) << 16;
}
// machine
/*************************************
*
* Machine init
@ -65,8 +267,8 @@ void aztarac_state::nvram_store_w(uint16_t data)
uint16_t aztarac_state::joystick_r()
{
return (((ioport("STICKZ")->read() - 0xf) << 8) |
((ioport("STICKY")->read() - 0xf) & 0xff));
return (((m_stickz->read() - 0xf) << 8) |
((m_sticky->read() - 0xf) & 0xff));
}
@ -84,10 +286,10 @@ void aztarac_state::main_map(address_map &map)
map(0x022000, 0x0221ff).rw(m_nvram, FUNC(x2212_device::read), FUNC(x2212_device::write)).umask16(0x00ff);
map(0x027000, 0x027001).r(FUNC(aztarac_state::joystick_r));
map(0x027004, 0x027005).portr("INPUTS");
map(0x027008, 0x027009).rw(FUNC(aztarac_state::sound_r), FUNC(aztarac_state::sound_w));
map(0x027009, 0x027009).rw(FUNC(aztarac_state::sound_r), FUNC(aztarac_state::sound_w));
map(0x02700c, 0x02700d).portr("DIAL");
map(0x02700e, 0x02700f).r("watchdog", FUNC(watchdog_timer_device::reset16_r));
map(0xff8000, 0xffafff).ram().share("vectorram");
map(0xff8000, 0xffafff).ram().share(m_vectorram);
map(0xffb000, 0xffb001).nopr();
map(0xffb001, 0xffb001).w(FUNC(aztarac_state::ubr_w));
map(0xffe000, 0xffffff).ram();
@ -123,10 +325,10 @@ void aztarac_state::sound_map(address_map &map)
static INPUT_PORTS_START( aztarac )
PORT_START("STICKZ")
PORT_BIT( 0x1f, 0xf, IPT_AD_STICK_Z ) PORT_MINMAX(0,0x1e) PORT_SENSITIVITY(100) PORT_KEYDELTA(1)
PORT_BIT( 0x1f, 0xf, IPT_AD_STICK_Z ) PORT_MINMAX(0, 0x1e) PORT_SENSITIVITY(100) PORT_KEYDELTA(1)
PORT_START("STICKY")
PORT_BIT( 0x1f, 0xf, IPT_AD_STICK_Y ) PORT_MINMAX(0,0x1e) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_REVERSE
PORT_BIT( 0x1f, 0xf, IPT_AD_STICK_Y ) PORT_MINMAX(0, 0x1e) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_REVERSE
PORT_START("DIAL")
PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_CODE_DEC(KEYCODE_Z) PORT_CODE_INC(KEYCODE_X) PORT_REVERSE
@ -152,7 +354,7 @@ INPUT_PORTS_END
void aztarac_state::aztarac(machine_config &config)
{
/* basic machine hardware */
// basic machine hardware
m68000_device &maincpu(M68000(config, m_maincpu, 16_MHz_XTAL / 2));
maincpu.set_addrmap(AS_PROGRAM, &aztarac_state::main_map);
maincpu.set_cpu_space(AS_PROGRAM);
@ -165,7 +367,7 @@ void aztarac_state::aztarac(machine_config &config)
WATCHDOG_TIMER(config, "watchdog");
/* video hardware */
// video hardware
VECTOR(config, m_vector, 0);
SCREEN(config, m_screen, SCREEN_TYPE_VECTOR);
m_screen->set_refresh_hz(40);
@ -174,7 +376,7 @@ void aztarac_state::aztarac(machine_config &config)
m_screen->set_screen_update("vector", FUNC(vector_device::screen_update));
m_screen->screen_vblank().set(FUNC(aztarac_state::video_interrupt));
/* sound hardware */
// sound hardware
SPEAKER(config, "mono").front_center();
GENERIC_LATCH_8(config, m_soundlatch);
@ -215,12 +417,13 @@ ROM_START( aztarac )
ROM_LOAD( "c.j4", 0x0000, 0x1000, CRC(e897dfcd) SHA1(750df3d08512d8098a13ec62677831efa164c126) )
ROM_LOAD( "d.j3", 0x1000, 0x1000, CRC(4016de77) SHA1(7232ec003f1b9d3623d762f3270108a1d1837846) )
ROM_REGION( 0x3000, "proms", 0 ) /* not hooked up */
ROM_REGION( 0x3000, "proms", 0 ) // not hooked up
ROM_LOAD( "l5.l5", 0x0000, 0x0020, CRC(317fb438) SHA1(3130e1dbde06228707ba46ae85d8df8cc8f32b67) )
ROM_LOAD( "k8.k8", 0x0000, 0x1000, CRC(596ad8d9) SHA1(7e2d2d3e02712911ef5ef55d1df5740f6ec28bcb) )
ROM_LOAD( "k9.k9", 0x0000, 0x1000, CRC(b8544823) SHA1(78ff1fcb7e640929765533592015cfccef690179) )
ROM_END
} // anonymous namespace
/*************************************

View File

@ -1,63 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:Mathis Rosenhauer
/*************************************************************************
Centuri Aztarac hardware
*************************************************************************/
#include "cpu/m68000/m68000.h"
#include "machine/gen_latch.h"
#include "machine/x2212.h"
#include "video/vector.h"
#include "screen.h"
class aztarac_state : public driver_device
{
public:
aztarac_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_nvram(*this, "nvram"),
m_vector(*this, "vector"),
m_screen(*this, "screen"),
m_soundlatch(*this, "soundlatch"),
m_vectorram(*this, "vectorram") { }
void aztarac(machine_config &config);
private:
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
required_device<x2212_device> m_nvram;
required_device<vector_device> m_vector;
required_device<screen_device> m_screen;
required_device<generic_latch_8_device> m_soundlatch;
required_shared_ptr<uint16_t> m_vectorram;
int m_sound_status = 0;
int m_xcenter = 0;
int m_ycenter = 0;
void nvram_store_w(uint16_t data);
uint16_t joystick_r();
void ubr_w(uint8_t data);
uint16_t sound_r();
void sound_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
uint8_t snd_command_r();
uint8_t snd_status_r();
void snd_status_w(uint8_t data);
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
DECLARE_WRITE_LINE_MEMBER(video_interrupt);
INTERRUPT_GEN_MEMBER(snd_timed_irq);
inline void read_vectorram(uint16_t *vectorram, int addr, int *x, int *y, int *c);
void main_map(address_map &map);
void sound_map(address_map &map);
};

View File

@ -1,54 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:Mathis Rosenhauer
/***************************************************************************
Centuri Aztarac hardware
***************************************************************************/
#include "emu.h"
#include "cpu/z80/z80.h"
#include "aztarac.h"
uint16_t aztarac_state::sound_r()
{
return m_sound_status & 0x01;
}
void aztarac_state::sound_w(offs_t offset, uint16_t data, uint16_t mem_mask)
{
if (ACCESSING_BITS_0_7)
{
data &= 0xff;
m_soundlatch->write(data);
m_sound_status ^= 0x21;
if (m_sound_status & 0x20)
m_audiocpu->set_input_line(0, HOLD_LINE);
}
}
uint8_t aztarac_state::snd_command_r()
{
m_sound_status |= 0x01;
m_sound_status &= ~0x20;
return m_soundlatch->read();
}
uint8_t aztarac_state::snd_status_r()
{
return m_sound_status & ~0x01;
}
void aztarac_state::snd_status_w(uint8_t data)
{
m_sound_status &= ~0x10;
}
INTERRUPT_GEN_MEMBER(aztarac_state::snd_timed_irq)
{
m_sound_status ^= 0x10;
if (m_sound_status & 0x10)
device.execute().set_input_line(0,HOLD_LINE);
}

View File

@ -1,102 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:Mathis Rosenhauer
/*************************************************************************
Centuri Aztarac hardware
*************************************************************************/
#include "emu.h"
#include "aztarac.h"
#define AVECTOR(x, y, color, intensity) \
m_vector->add_point (m_xcenter + ((x) << 16), m_ycenter - ((y) << 16), color, intensity)
WRITE_LINE_MEMBER(aztarac_state::video_interrupt)
{
if (state)
m_maincpu->set_input_line(M68K_IRQ_4, ASSERT_LINE);
}
inline void aztarac_state::read_vectorram(uint16_t *vectorram, int addr, int *x, int *y, int *c)
{
*c = vectorram[addr] & 0xffff;
*x = vectorram[addr + 0x800] & 0x03ff;
*y = vectorram[addr + 0x1000] & 0x03ff;
if (*x & 0x200) *x |= 0xfffffc00;
if (*y & 0x200) *y |= 0xfffffc00;
}
void aztarac_state::ubr_w(uint8_t data)
{
int x, y, c, intensity, xoffset, yoffset, color;
int defaddr, objaddr=0, ndefs;
m_maincpu->set_input_line(M68K_IRQ_4, CLEAR_LINE);
if (data) /* data is the global intensity (always 0xff in Aztarac). */
{
m_vector->clear_list();
while (1)
{
read_vectorram(m_vectorram, objaddr, &xoffset, &yoffset, &c);
objaddr++;
if (c & 0x4000)
break;
if ((c & 0x2000) == 0)
{
defaddr = (c >> 1) & 0x7ff;
AVECTOR (xoffset, yoffset, 0, 0);
read_vectorram(m_vectorram, defaddr, &x, &ndefs, &c);
ndefs++;
if (c & 0xff00)
{
/* latch color only once */
intensity = (c >> 8);
color = vector_device::color222(c & 0x3f);
while (ndefs--)
{
defaddr++;
read_vectorram(m_vectorram, defaddr, &x, &y, &c);
if ((c & 0xff00) == 0)
AVECTOR (x + xoffset, y + yoffset, 0, 0);
else
AVECTOR (x + xoffset, y + yoffset, color, intensity);
}
}
else
{
/* latch color for every definition */
while (ndefs--)
{
defaddr++;
read_vectorram(m_vectorram, defaddr, &x, &y, &c);
color = vector_device::color222(c & 0x3f);
AVECTOR (x + xoffset, y + yoffset, color, c >> 8);
}
}
}
}
}
}
void aztarac_state::video_start()
{
const rectangle &visarea = m_screen->visible_area();
int xmin = visarea.min_x;
int ymin = visarea.min_y;
int xmax = visarea.max_x;
int ymax = visarea.max_y;
m_xcenter=((xmax + xmin) / 2) << 16;
m_ycenter=((ymax + ymin) / 2) << 16;
}

View File

@ -71,6 +71,11 @@ SN74LS14N -> | | _________________|
| : |
|_____________________________________|
TODO (for games with video):
* main - video CPUs communications
* inputs
***************************************************************************/
#include "emu.h"
@ -104,6 +109,8 @@ public:
protected:
virtual void machine_start() override;
required_device<i8085a_cpu_device> m_maincpu;
private:
void psg_pa_w(u8 data);
u8 psg_pb_r();
@ -111,7 +118,6 @@ private:
void mem_map(address_map &map);
void io_map(address_map &map);
required_device<i8085a_cpu_device> m_maincpu;
required_ioport_array<4> m_inputs;
u8 m_psg_pa;
@ -130,6 +136,10 @@ public:
private:
required_device<i8085a_cpu_device> m_videocpu;
void main_io_map(address_map &map);
void video_mem_map(address_map &map);
void video_io_map(address_map &map);
};
void falgasm89_state::machine_start()
@ -154,7 +164,8 @@ u8 falgasm89_state::psg_pb_r()
void falgasm89_state::mem_map(address_map &map)
{
map(0x0000, 0xffff).rom().region("maincpu", 0);
map(0x0000, 0xbfff).rom().region("maincpu", 0);
map(0xfc00, 0xffff).ram();
}
void falgasm89_state::io_map(address_map &map)
@ -163,6 +174,28 @@ void falgasm89_state::io_map(address_map &map)
map(0x04, 0x04).w("psg", FUNC(ay8910_device::address_w));
}
void falgasm89_video_state::main_io_map(address_map &map)
{
map(0x00, 0x00).rw("psg", FUNC(ay8910_device::data_r), FUNC(ay8910_device::data_w));
map(0x04, 0x04).w("psg", FUNC(ay8910_device::address_w));
map(0x98, 0x98).lw8(NAME([this] (u8 data) { logerror("to video: %02x\n", data); }));
map(0x99, 0x99).lr8(NAME([this] () -> u8 { logerror("from video\n"); return 0xff; }));
}
void falgasm89_video_state::video_mem_map(address_map &map)
{
map(0x0000, 0x8fff).rom().region("videocpu", 0);
map(0xf800, 0xffff).ram();
//map(0xf800, 0xf8ff).rw("i8155", FUNC(i8155_device::memory_r), FUNC(i8155_device::memory_w)); // TODO: where's this?
}
void falgasm89_video_state::video_io_map(address_map &map)
{
map(0x00, 0x07).rw("i8155", FUNC(i8155_device::io_r), FUNC(i8155_device::io_w));
map(0x08, 0x08).rw("vdp", FUNC(tms9129_device::vram_read), FUNC(tms9129_device::vram_write));
map(0x09, 0x09).rw("vdp", FUNC(tms9129_device::register_read), FUNC(tms9129_device::register_write));
}
INPUT_PORTS_START(falgasm89)
PORT_START("IN0")
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNKNOWN)
@ -212,14 +245,23 @@ void falgasm89_video_state::falgasm89_video(machine_config &config)
{
falgasm89(config);
m_maincpu->set_addrmap(AS_IO, &falgasm89_video_state::main_io_map);
I8085A(config, m_videocpu, 6_MHz_XTAL); // OKI M80C85A-2
m_videocpu->set_addrmap(AS_PROGRAM, &falgasm89_video_state::video_mem_map);
m_videocpu->set_addrmap(AS_IO, &falgasm89_video_state::video_io_map);
tms9129_device &vdp(TMS9129(config, "vdp", 10.738635_MHz_XTAL));
vdp.set_screen("screen");
vdp.set_vram_size(0x10000); // 2 x UD61464DC
SCREEN(config, "screen", SCREEN_TYPE_RASTER);
I8155(config, "i8155", 6_MHz_XTAL); // NEC D8155HC
i8155_device &i8155(I8155(config, "i8155", 6_MHz_XTAL)); // NEC D8155HC
i8155.in_pa_callback().set([this] () { logerror("from main (i8155 PA in)\n"); return 0x00; }); // TODO: from main? returning rand() shows inputs come from here, probably sent from the main CPU
i8155.out_pb_callback().set([this] (u8 data) { logerror("to main (i8155 PB out): %02x\n", data); }); // TODO: to main? bit 7 toggles continuously
// other ports seem unused
i8155.out_to_callback().set_inputline(m_videocpu, I8085_TRAP_LINE);
i8155.out_to_callback().append_inputline("maincpu", I8085_TRAP_LINE); // TODO: wrong
}
ROM_START(cbully)