More complete Galaxy Games emulation: [Luca Elia]

- Created devices for the galaxy games carts (EEPROM + Flash + PIC) and the slot(s)
- Removed code patches and emulated the PIC communication and bank switching
- Converted the blitter to a device (cesblit.cpp)
- moved the Galaxy Games from tmaster.cpp to their own driver (galgames.cpp)

Provided the PIC code for all four StarPak cartridges [Keith M. Kolmos]

New working machines
--------------------
Galaxy Games StarPak 3
  [Keith M. Kolmos, Rod_Wod, Sean Sutton, Soren Skou Nielsen, Russell Howard, Francis Ramirez,
   Tourniquet, BrianT, coolmod, Smitdogg, The Dumping Union, Luca Elia]
This commit is contained in:
Luca Elia 2017-02-05 22:26:58 +01:00
parent 3bf389d079
commit 4170ed789e
8 changed files with 495 additions and 874 deletions

View File

@ -77,6 +77,18 @@ if (VIDEOS["CDP1862"]~=null) then
}
end
--------------------------------------------------
--
--@src/devices/video/cesblit.h,VIDEOS["CESBLIT"] = true
--------------------------------------------------
if (VIDEOS["CESBLIT"]~=null) then
files {
MAME_DIR .. "src/devices/video/cesblit.cpp",
MAME_DIR .. "src/devices/video/cesblit.h",
}
end
--------------------------------------------------
--
--@src/devices/video/crt9007.h,VIDEOS["CRT9007"] = true

View File

@ -277,6 +277,7 @@ VIDEOS["SEGA315_5313"] = true
VIDEOS["BUFSPRITE"] = true
--VIDEOS["CDP1861"] = true
--VIDEOS["CDP1862"] = true
VIDEOS["CESBLIT"] = true
--VIDEOS["CRT9007"] = true
--VIDEOS["CRT9021"] = true
--VIDEOS["CRT9212"] = true
@ -722,6 +723,7 @@ function linkProjects_mame_arcade(_target, _subtarget)
"bfm",
"bmc",
"capcom",
"ces",
"cinemat",
"comad",
"cvs",
@ -1394,6 +1396,12 @@ files {
MAME_DIR .. "src/mame/drivers/instantm.cpp",
}
createMAMEProjects(_target, _subtarget, "ces")
files {
MAME_DIR .. "src/mame/drivers/cesclass.cpp",
MAME_DIR .. "src/mame/drivers/galgames.cpp",
}
createMAMEProjects(_target, _subtarget, "cinemat")
files {
MAME_DIR .. "src/mame/drivers/cinemat.cpp",
@ -4392,7 +4400,6 @@ files {
MAME_DIR .. "src/mame/machine/cdislave.h",
MAME_DIR .. "src/mame/machine/cdicdic.cpp",
MAME_DIR .. "src/mame/machine/cdicdic.h",
MAME_DIR .. "src/mame/drivers/cesclass.cpp",
MAME_DIR .. "src/mame/drivers/chance32.cpp",
MAME_DIR .. "src/mame/drivers/chexx.cpp",
MAME_DIR .. "src/mame/drivers/chicago.cpp",

View File

@ -278,6 +278,7 @@ VIDEOS["SEGA315_5313"] = true
--VIDEOS+= BUFSPRITE"] = true
VIDEOS["CDP1861"] = true
VIDEOS["CDP1862"] = true
--VIDEOS["CESBLIT"] = true
VIDEOS["CRT9007"] = true
VIDEOS["CRT9021"] = true
VIDEOS["CRT9212"] = true

View File

@ -0,0 +1,282 @@
// license:BSD-3-Clause
// copyright-holders:Luca Elia
/***************************************************************************
CES Blitter, with two layers and double buffering (Xilinx FPGA)
Offset: Bits: Value:
00
02 fedc ba-- ---- ----
---- --9- ---- ---- Layer 1 Buffer To Display
---- ---8 ---- ---- Layer 0 Buffer To Display
---- ---- 7654 3210
04 Width
06 X
08 Height - 1
0A Y
0C Source Address (low)
0E Source Address (mid)
10 fedc ba-- ---- ----
---- --9- ---- ---- Pen Replacement Mode
---- ---8 ---- ----
---- ---- 7--- ---- Layer
---- ---- -6-- ---- Buffer
---- ---- --5- ---- Solid Fill
---- ---- ---4 ---- Enable VBlank IRQ (e.g. level 3) (0 clears the IRQ line too)
---- ---- ---- 3--- Enable Blitter Finished IRQ (e.g. level 2) ""
---- ---- ---- -2-- Enable Scanline IRQ (e.g. level 1) ""
---- ---- ---- --1- Flip Y
---- ---- ---- ---0 Flip X
Addr_Hi Register:
fedc ba98 ---- ---- Solid Fill Pen
---- ---- 7654 3210 Source Address (high)
Color Register:
fedc ba98 ---- ---- Source Pen (Pen Replacement Mode)
---- ---- 7654 3210 Palette (0-f) / Destination Pen (Pen Replacement Mode)
A write to the source address (mid) triggers the blit.
A the end of the blit, an IRQ is issued.
***************************************************************************/
#include "emu.h"
#include "cesblit.h"
/***************************************************************************
GLOBAL VARIABLES
***************************************************************************/
// device type definition
const device_type CESBLIT = &device_creator<cesblit_device>;
/***************************************************************************
LIVE DEVICE
***************************************************************************/
//-------------------------------------------------
// cesblit_device - constructor
//-------------------------------------------------
cesblit_device::cesblit_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, CESBLIT, "CES Blitter FPGA", tag, owner, clock, "cesblit", __FILE__),
device_video_interface(mconfig, *this),
device_memory_interface(mconfig, *this),
m_space_config("blitter_space", ENDIANNESS_BIG, 16,23),
m_blit_irq_cb(*this)
{ }
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void cesblit_device::device_start()
{
// resolve callbacks
m_blit_irq_cb.resolve();
// default to rom reading from a region
m_space = &space(AS_PROGRAM);
memory_region *region = memregion(tag());
if (region)
m_space->install_rom(0, region->bytes() - 1, region->base());
// bitmaps
for (int layer = 0; layer < 2; ++layer)
{
for (int buffer = 0; buffer < 2; ++buffer)
{
m_screen->register_screen_bitmap(m_bitmap[layer][buffer]);
m_bitmap[layer][buffer].fill(0xff);
}
}
}
/***************************************************************************
READ/WRITE HANDLERS
***************************************************************************/
READ16_MEMBER(cesblit_device::status_r)
{
return 0x0000; // bit 7 = blitter busy
}
WRITE16_MEMBER(cesblit_device::regs_w)
{
uint16_t olddata = m_regs[offset];
uint16_t newdata = COMBINE_DATA( &m_regs[offset] );
switch (offset)
{
// case 0x00/2: // bit 15: FPGA programming serial in (lsb first)
case 0x10/2:
if (!m_blit_irq_cb.isnull() && !BIT(olddata, 3) && BIT(newdata, 3))
m_blit_irq_cb(CLEAR_LINE);
break;
case 0x0e/2:
do_blit();
if (!m_blit_irq_cb.isnull() && BIT(m_regs[0x10/2], 3))
m_blit_irq_cb(ASSERT_LINE);
break;
}
}
WRITE16_MEMBER(cesblit_device::color_w)
{
COMBINE_DATA( &m_color );
}
WRITE16_MEMBER(cesblit_device::addr_hi_w)
{
COMBINE_DATA( &m_addr_hi );
}
void cesblit_device::do_blit()
{
int buffer = (m_regs[0x02/2] >> 8) & 3; // 1 bit per layer, selects the currently displayed buffer
int sw = m_regs[0x04/2];
int sx = m_regs[0x06/2];
int sh = m_regs[0x08/2] + 1;
int sy = m_regs[0x0a/2];
int addr = (*m_compute_addr)(m_regs[0x0c/2], m_regs[0x0e/2], m_addr_hi);
int mode = m_regs[0x10/2];
int layer = (mode >> 7) & 1; // layer to draw to
buffer = ((mode >> 6) & 1) ^ ((buffer >> layer) & 1); // bit 6 selects whether to use the opposite buffer to that displayed
addr <<= 1;
#ifdef MAME_DEBUG
#if 0
logerror("%s: blit w %03x, h %02x, x %03x, y %02x, src %06x, fill/addr_hi %04x, repl/color %04x, mode %02x\n", machine().describe_context(),
sw,sh,sx,sy, addr, m_addr_hi, m_color, mode
);
#endif
#endif
int flipx = mode & 1;
int flipy = mode & 2;
int x0,x1,y0,y1,dx,dy;
if (flipx) { x0 = sw-1; x1 = -1; dx = -1; sx -= sw-1; }
else { x0 = 0; x1 = sw; dx = +1; }
if (flipy) { y0 = sh-1; y1 = -1; dy = -1; sy -= sh-1; }
else { y0 = 0; y1 = sh; dy = +1; }
sx = (sx & 0x7fff) - (sx & 0x8000);
sy = (sy & 0x7fff) - (sy & 0x8000);
int color = (m_color & 0x0f) << 8;
// Draw
bitmap_ind16 &bitmap = m_bitmap[layer][buffer];
int x,y;
uint16_t pen;
switch (mode & 0x20)
{
case 0x00: // blit from ROM
if ( mode & 0x200 )
{
// copy from ROM, replacing occurrences of src pen with dst pen
uint8_t dst_pen = (m_color >> 8) & 0xff;
uint8_t src_pen = (m_color >> 0) & 0xff;
for (y = y0; y != y1; y += dy)
{
for (x = x0; x != x1; x += dx)
{
if ((sx + x >= 0) && (sx + x < 400) && (sy + y >= 0) && (sy + y < 256))
{
pen = m_space->read_byte(addr);
if (pen == src_pen)
pen = dst_pen;
if (pen != 0xff)
bitmap.pix16(sy + y, sx + x) = pen + color;
}
++addr;
}
if ( (dy > 0 && (sy + y >= 256-1)) || (dy < 0 && (sy + y <= 0)) )
break;
}
}
else
{
// copy from ROM as is
for (y = y0; y != y1; y += dy)
{
for (x = x0; x != x1; x += dx)
{
if ((sx + x >= 0) && (sx + x < 400) && (sy + y >= 0) && (sy + y < 256))
{
pen = m_space->read_byte(addr);
if (pen != 0xff)
bitmap.pix16(sy + y, sx + x) = pen + color;
}
++addr;
}
if ( (dy > 0 && (sy + y >= 256-1)) || (dy < 0 && (sy + y <= 0)) )
break;
}
}
break;
case 0x20: // solid fill
pen = ((m_addr_hi >> 8) & 0xff) + color;
if ((pen & 0xff) == 0xff)
pen = 0xff;
for (y = y0; y != y1; y += dy)
{
for (x = x0; x != x1; x += dx)
{
if ((sx + x >= 0) && (sx + x < 400) && (sy + y >= 0) && (sy + y < 256))
bitmap.pix16(sy + y, sx + x) = pen;
}
if ( (dy > 0 && (sy + y >= 256-1)) || (dy < 0 && (sy + y <= 0)) )
break;
}
break;
}
}
uint32_t cesblit_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
int layers_ctrl = -1;
#ifdef MAME_DEBUG
if (machine().input().code_pressed(KEYCODE_Z))
{
int mask = 0;
if (machine().input().code_pressed(KEYCODE_Q)) mask |= 1;
if (machine().input().code_pressed(KEYCODE_W)) mask |= 2;
if (mask != 0) layers_ctrl &= mask;
}
#endif
if (layers_ctrl & 1) copybitmap_trans(bitmap, m_bitmap[0][(m_regs[0x02/2]>>8)&1], 0,0,0,0, cliprect, 0xff);
if (layers_ctrl & 2) copybitmap_trans(bitmap, m_bitmap[1][(m_regs[0x02/2]>>9)&1], 0,0,0,0, cliprect, 0xff);
return 0;
}

View File

@ -0,0 +1,84 @@
// license:BSD-3-Clause
// copyright-holders:Luca Elia
/***************************************************************************
CES Blitter, with two layers and double buffering (Xilinx FPGA)
***************************************************************************/
#pragma once
#ifndef CESBLIT_H
#define CESBLIT_H
/***************************************************************************
INTERFACE CONFIGURATION MACROS
***************************************************************************/
#define MCFG_CESBLIT_ADD(_tag, _screen, _clock) \
MCFG_DEVICE_ADD(_tag, CESBLIT, _clock) \
MCFG_VIDEO_SET_SCREEN(_screen)
#define MCFG_CESBLIT_MAP MCFG_DEVICE_PROGRAM_MAP
#define MCFG_CESBLIT_COMPUTE_ADDR(_compute_addr) \
cesblit_device::static_set_compute_addr(*device, _compute_addr);
#define MCFG_CESBLIT_IRQ_CB(_devcb) \
devcb = &cesblit_device::static_set_irq_callback(*device, DEVCB_##_devcb);
/***************************************************************************
TYPE DEFINITIONS
***************************************************************************/
// ======================> cesblit_device
class cesblit_device : public device_t,
public device_video_interface,
public device_memory_interface
{
public:
typedef int (*compute_addr_t) (uint16_t reg_low, uint16_t reg_mid, uint16_t reg_high);
// construction/destruction
cesblit_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// static configuration
void set_compute_addr(compute_addr_t compute_addr) { m_compute_addr = compute_addr; }
static void static_set_compute_addr(device_t &device, compute_addr_t compute_addr) { downcast<cesblit_device &>(device).set_compute_addr(compute_addr); }
template<class _Object> static devcb_base &static_set_irq_callback(device_t &device, _Object object) { return downcast<cesblit_device &>(device).m_blit_irq_cb.set_callback(object); }
DECLARE_WRITE16_MEMBER(color_w);
DECLARE_WRITE16_MEMBER(addr_hi_w);
DECLARE_WRITE16_MEMBER(regs_w);
DECLARE_READ16_MEMBER(status_r);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
protected:
// device-level overrides
virtual void device_start() override;
virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_PROGRAM) const override { return (spacenum == AS_PROGRAM) ? &m_space_config: nullptr; }
void do_blit();
address_space_config m_space_config;
address_space *m_space;
devcb_write_line m_blit_irq_cb; // blit finished irq
bitmap_ind16 m_bitmap[2][2];
uint16_t m_regs[0x12/2];
uint16_t m_color;
uint16_t m_addr_hi;
compute_addr_t m_compute_addr;
};
/***************************************************************************
GLOBAL VARIABLES
***************************************************************************/
// device type definition
extern const device_type CESBLIT;
#endif

View File

@ -413,6 +413,7 @@ galaxia.cpp
galaxian.cpp
galaxold.cpp
galgame.cpp
galgames.cpp
galivan.cpp
galpani2.cpp
galpani3.cpp

File diff suppressed because it is too large Load Diff

View File

@ -12974,6 +12974,11 @@ galeb //
@source:galgame.cpp
galgame // (c) 1971 Computer Recreations, Inc
@source:galgames.cpp
galgame2 // (c) 1998 Creative Electronics & Software (CES) / Namco
galgame3 // (c) 1998 Creative Electronics & Software (CES) / Atari
galgbios // (c) 1998 Creative Electronics & Software (CES)
@source:galivan.cpp
dangar // (c) 1986
dangara // (c) 1986
@ -35803,8 +35808,6 @@ tk80bs //
990189v // 1980 TM 990/189 with Color Video Board
@source:tmaster.cpp
galgame2 // (c) 1998 Creative Electronics & Software (CES) / Namco
galgbios // (c) 1998 Creative Electronics & Software (CES)
tm // (c) 1996 Midway Games
tm2k // (c) 1996 Midway Games
tm2ka // (c) 1996 Midway Games