(MESS) a7800.c: [Fabio Priuli]

- Fixed YM2151 clock in XM expansion, thanks to info from 
    tep392 and GroovyBee
  - Added support for homebrew boards MegaCart+ and
    VersaBoard by CPUWIZ (ROM respectively up to 512K
    and 256K + 32K of RAM)
  - Misc cleanups


out of whatsnew: I have also added, for debugging purposes, a VersaBoard with SG 9banks + POKEY at 0x0450
in the hope to find out exactly what goes currently wrong in the emulation of some homebrew games... let's see...
This commit is contained in:
Fabio Priuli 2014-09-06 06:49:07 +00:00
parent 14fb245bf6
commit 1ddc69fe10
9 changed files with 80 additions and 128 deletions

View File

@ -2449,9 +2449,9 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="a7800_cart">
<feature name="pcb_type" value="TYPE-XM" />
<feature name="slot" value="a78_xmc" />
<dataarea name="rom" size="0x24000">
<rom name="dkxm_final_demo_pal.a78" size="0x24000" crc="d362712e" sha1="118c462d6698bd23c378785f80062fdd7d65ca00" offset="0" />
<feature name="slot" value="a78_sg9" />
<dataarea name="rom" size="147456">
<rom name="dkxm_final_demo_pal.bin" size="147456" crc="d362712e" sha1="118c462d6698bd23c378785f80062fdd7d65ca00" offset="0" />
</dataarea>
</part>
</software>
@ -2464,9 +2464,9 @@ almost nothing like the prototype.
<sharedfeat name="compatibility" value="NTSC"/>
<part name="cart" interface="a7800_cart">
<feature name="pcb_type" value="TYPE-XM" />
<feature name="slot" value="a78_xmc" />
<dataarea name="rom" size="0x24000">
<rom name="dkxm_final_demo_ntsc.a78" size="0x24000" crc="6e170055" sha1="f4da231312da06ff9e8af5681b5013b14886b455" offset="0" />
<feature name="slot" value="a78_sg9" />
<dataarea name="rom" size="147456">
<rom name="dkxm_final_demo_ntsc.bin" size="147456" crc="6e170055" sha1="f4da231312da06ff9e8af5681b5013b14886b455" offset="0" />
</dataarea>
</part>
</software>

View File

@ -1,12 +1,12 @@
#ifndef __A78_CARTS_H
#define __A78_CARTS_H
#include "emu.h"
#include "rom.h"
#include "xboard.h"
#include "hiscore.h"
#include "cpuwiz.h"
static SLOT_INTERFACE_START(a7800_cart)
SLOT_INTERFACE_INTERNAL("a78_rom", A78_ROM)
@ -14,15 +14,16 @@ static SLOT_INTERFACE_START(a7800_cart)
SLOT_INTERFACE_INTERNAL("a78_sg", A78_ROM_SG)
SLOT_INTERFACE_INTERNAL("a78_sg_pokey", A78_ROM_SG_POKEY)
SLOT_INTERFACE_INTERNAL("a78_sg_ram", A78_ROM_SG_RAM)
// not sure which dev cart support banked ram, nor whether there shall be a 9banks or a non-sg version of this...
SLOT_INTERFACE_INTERNAL("a78_bankram", A78_ROM_BANKRAM)
SLOT_INTERFACE_INTERNAL("a78_sg9", A78_ROM_SG_9BANKS)
SLOT_INTERFACE_INTERNAL("a78_xmc", A78_ROM_XM) // carts compatible with the expansions below (basically a 9Banks+POKEY)
SLOT_INTERFACE_INTERNAL("a78_sg9", A78_ROM_SG9)
SLOT_INTERFACE_INTERNAL("a78_sg9_pokey",A78_ROM_SG9_POKEY) // carts compatible with the expansions below (basically a 9Banks+POKEY)
SLOT_INTERFACE_INTERNAL("a78_abs", A78_ROM_ABSOLUTE)
SLOT_INTERFACE_INTERNAL("a78_act", A78_ROM_ACTIVISION)
SLOT_INTERFACE_INTERNAL("a78_hsc", A78_HISCORE)
SLOT_INTERFACE_INTERNAL("a78_xboard", A78_XBOARD) // the actual XBoarD expansion (as passthru)
SLOT_INTERFACE_INTERNAL("a78_xm", A78_XM) // the actual XM expansion (as passthru)
SLOT_INTERFACE_INTERNAL("a78_megacart", A78_ROM_MEGACART)
SLOT_INTERFACE_INTERNAL("a78_versa", A78_ROM_VERSABOARD)
SLOT_INTERFACE_INTERNAL("a78_versap", A78_ROM_VERSAPOKEY) // For debugging purposes
SLOT_INTERFACE_END

View File

@ -170,20 +170,22 @@ struct a78_slot
// Here, we take the feature attribute from .xml (i.e. the PCB name) and we assign a unique ID to it
static const a78_slot slot_list[] =
{
{ A78_TYPE0, "a78_rom" },
{ A78_TYPE1, "a78_pokey" },
{ A78_TYPE2, "a78_sg" },
{ A78_TYPE3, "a78_sg_pokey" },
{ A78_TYPE6, "a78_sg_ram" },
{ A78_TYPEA, "a78_sg9" },
{ A78_TYPEB, "a78_xmc" },
{ A78_ABSOLUTE, "a78_abs" },
{ A78_TYPE0, "a78_rom" },
{ A78_TYPE1, "a78_pokey" },
{ A78_TYPE2, "a78_sg" },
{ A78_TYPE3, "a78_sg_pokey" },
{ A78_TYPE6, "a78_sg_ram" },
{ A78_TYPEA, "a78_sg9" },
{ A78_TYPEB, "a78_sg9_pokey" },
{ A78_ABSOLUTE, "a78_abs" },
{ A78_ACTIVISION, "a78_act" },
{ A78_HSC, "a78_hsc" },
{ A78_BANKRAM, "a78_bankram" },
{ A78_XB_BOARD, "a78_xboard" },
{ A78_XM_BOARD, "a78_xm" },
{ A78_NOCART, "empty" },
{ A78_HSC, "a78_hsc" },
{ A78_XB_BOARD, "a78_xboard" },
{ A78_XM_BOARD, "a78_xm" },
{ A78_MEGACART, "a78_megacart" },
{ A78_VERSABOARD, "a78_versa" },
{ A78_VERSAPOKEY, "a78_versap" },
{ A78_NOCART, "empty" }, // the code should never get here, of course...
};
static int a78_get_pcb_id(const char *slot)
@ -269,7 +271,13 @@ bool a78_cart_slot_device::call_load()
m_type = A78_TYPEB;
break;
case 0x0020:
m_type = A78_BANKRAM;
if (len > 0x40000)
m_type = A78_MEGACART;
else
m_type = A78_VERSABOARD;
break;
case 0x0021:
m_type = A78_VERSAPOKEY;
break;
case 0x0100:
m_type = A78_ACTIVISION;
@ -291,7 +299,7 @@ bool a78_cart_slot_device::call_load()
if (m_type == A78_TYPE6)
m_cart->ram_alloc(0x4000);
if (m_type == A78_BANKRAM)
if (m_type == A78_MEGACART || m_type == A78_VERSABOARD || m_type == A78_VERSAPOKEY)
m_cart->ram_alloc(0x8000);
if (m_type == A78_XB_BOARD || m_type == A78_XM_BOARD)
m_cart->ram_alloc(0x20000);
@ -394,7 +402,13 @@ void a78_cart_slot_device::get_default_card_software(astring &result)
type = A78_TYPEB;
break;
case 0x0020:
m_type = A78_BANKRAM;
if (core_fsize(m_file) > 0x40000)
type = A78_MEGACART;
else
type = A78_VERSABOARD;
break;
case 0x0021:
type = A78_VERSAPOKEY;
break;
case 0x0100:
type = A78_ACTIVISION;

View File

@ -16,13 +16,15 @@ enum
A78_TYPE3, // as TYPE1 + POKEY chip on the PCB
A78_TYPE6, // as TYPE1 + RAM IC on the PCB
A78_TYPEA, // Alien Brigade, Crossbow (9x16K banks with diff bankswitch)
A78_TYPEB, // Cart exploiting the XB board, but possibly also compatible with non-expanded A7800
A78_ABSOLUTE, // F18 Hornet
A78_ACTIVISION, // Double Dragon, Rampage
A78_HSC, // Atari HighScore cart
A78_BANKRAM, // SuperGame + 32K RAM banked (untested)
A78_XB_BOARD, // A7800 Expansion Board (it shall more or less apply to the Expansion Module too, but this is not officially released yet)
A78_XM_BOARD, // A7800 XM Expansion Module (theoretical specs only, since this is not officially released yet)
A78_TYPEB, // Cart exploiting the XB board, but possibly also compatible with non-expanded A7800
A78_MEGACART, // Homebrew by CPUWIZ, consists of SuperGame bank up to 512K + 32K RAM banked
A78_VERSABOARD, // Homebrew by CPUWIZ, consists of SuperGame bank up to 256K + 32K RAM banked
A78_VERSAPOKEY, // For debugging purpose, same as VersaBoard + SG 9 Banks + POKEY at 0x0450
A78_NOCART
};

View File

@ -26,9 +26,8 @@ const device_type A78_ROM_SG = &device_creator<a78_rom_sg_device>;
const device_type A78_ROM_POKEY = &device_creator<a78_rom_pokey_device>;
const device_type A78_ROM_SG_POKEY = &device_creator<a78_rom_sg_pokey_device>;
const device_type A78_ROM_SG_RAM = &device_creator<a78_rom_sg_ram_device>;
const device_type A78_ROM_BANKRAM = &device_creator<a78_rom_bankram_device>;
const device_type A78_ROM_SG_9BANKS = &device_creator<a78_rom_sg_9banks_device>;
const device_type A78_ROM_XM = &device_creator<a78_rom_xm_device>;
const device_type A78_ROM_SG9 = &device_creator<a78_rom_sg9_device>;
const device_type A78_ROM_SG9_POKEY = &device_creator<a78_rom_sg9_pokey_device>;
const device_type A78_ROM_ABSOLUTE = &device_creator<a78_rom_abs_device>;
const device_type A78_ROM_ACTIVISION = &device_creator<a78_rom_act_device>;
@ -75,25 +74,19 @@ a78_rom_sg_ram_device::a78_rom_sg_ram_device(const machine_config &mconfig, cons
}
a78_rom_bankram_device::a78_rom_bankram_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: a78_rom_sg_device(mconfig, A78_ROM_BANKRAM, "Atari 7800 ROM Carts w/SuperGame Bankswitch + Banked RAM", tag, owner, clock, "a78_rom_bankram", __FILE__)
{
}
a78_rom_sg_9banks_device::a78_rom_sg_9banks_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source)
a78_rom_sg9_device::a78_rom_sg9_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source)
: a78_rom_sg_device(mconfig, type, name, tag, owner, clock, shortname, source)
{
}
a78_rom_sg_9banks_device::a78_rom_sg_9banks_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: a78_rom_sg_device(mconfig, A78_ROM_SG_9BANKS, "Atari 7800 ROM Carts w/SuperGame 9Banks", tag, owner, clock, "a78_rom_sg9", __FILE__)
a78_rom_sg9_device::a78_rom_sg9_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: a78_rom_sg_device(mconfig, A78_ROM_SG9, "Atari 7800 ROM Carts w/SuperGame 9Banks", tag, owner, clock, "a78_rom_sg9", __FILE__)
{
}
a78_rom_xm_device::a78_rom_xm_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: a78_rom_sg_9banks_device(mconfig, A78_ROM_XM, "Atari 7800 ROM Carts w/SuperGame 9Banks + POKEY (XM demo)", tag, owner, clock, "a78_rom_xm", __FILE__),
a78_rom_sg9_pokey_device::a78_rom_sg9_pokey_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: a78_rom_sg9_device(mconfig, A78_ROM_SG9_POKEY, "Atari 7800 ROM Carts w/SuperGame 9Banks + POKEY", tag, owner, clock, "a78_rom_sg9p", __FILE__),
m_pokey(*this, "pokey")
{
}
@ -130,18 +123,6 @@ void a78_rom_sg_device::device_reset()
m_bank = 0;
}
void a78_rom_bankram_device::device_start()
{
save_item(NAME(m_bank));
save_item(NAME(m_ram_bank));
}
void a78_rom_bankram_device::device_reset()
{
m_bank = 0;
m_ram_bank = 0;
}
void a78_rom_abs_device::device_start()
{
save_item(NAME(m_bank));
@ -300,38 +281,6 @@ WRITE8_MEMBER(a78_rom_sg_ram_device::write_40xx)
}
/*-------------------------------------------------
Carts with SuperGame bankswitch + 32K RAM:
RAM bank is selected by writing with bit5 enabled
in 0x4000-0x7fff range (bit0-bit4 give the ROM bank)
GAMES:
-------------------------------------------------*/
READ8_MEMBER(a78_rom_bankram_device::read_40xx)
{
if (offset < 0x4000)
return m_ram[offset + (m_ram_bank * 0x4000)];
else if (offset < 0x8000)
return m_rom[(offset & 0x3fff) + (m_bank * 0x4000)];
else
return m_rom[(offset & 0x3fff) + (m_bank_mask * 0x4000)]; // last bank
}
WRITE8_MEMBER(a78_rom_bankram_device::write_40xx)
{
if (offset < 0x4000)
m_ram[offset] = data;
else if (offset < 0x8000)
{
m_bank = data & m_bank_mask;
m_ram_bank = BIT(data, 5);
}
}
/*-------------------------------------------------
Carts with SuperGame bankswitch 9banks:
@ -342,7 +291,7 @@ WRITE8_MEMBER(a78_rom_bankram_device::write_40xx)
-------------------------------------------------*/
READ8_MEMBER(a78_rom_sg_9banks_device::read_40xx)
READ8_MEMBER(a78_rom_sg9_device::read_40xx)
{
if (offset < 0x4000)
return m_rom[(offset & 0x3fff)];
@ -352,7 +301,7 @@ READ8_MEMBER(a78_rom_sg_9banks_device::read_40xx)
return m_rom[(offset & 0x3fff) + ((m_bank_mask + 1) * 0x4000)]; // last bank
}
WRITE8_MEMBER(a78_rom_sg_9banks_device::write_40xx)
WRITE8_MEMBER(a78_rom_sg9_device::write_40xx)
{
if (offset >= 0x4000 && offset < 0x8000)
m_bank = (data & m_bank_mask) + 1;
@ -360,24 +309,29 @@ WRITE8_MEMBER(a78_rom_sg_9banks_device::write_40xx)
/*-------------------------------------------------
Carts using XM expansion module or XBoarD expansion
The only game using this (Donkey Kong XM demo) is
144K + POKEY, so that it's like the above with the
addition of the POKEY.
Carts with SuperGame bankswitch 9banks + POKEY:
This was not used in any commercial game released
during A7800 lifespan, but it is used by Donkey
Kong XM demo and by Bentley Bear's Crystal Quest
for use with XM expansion module or XBoarD expansion
GAMES: Donkey Kong XM demo
GAMES: Donkey Kong XM demo, Bentley Bear's Crystal
Quest
-------------------------------------------------*/
WRITE8_MEMBER(a78_rom_xm_device::write_40xx)
WRITE8_MEMBER(a78_rom_sg9_pokey_device::write_40xx)
{
if (offset < 0x4000)
{
printf("write offs 0x%X data 0x%X\n", offset, data);
m_pokey->write(space, offset & 0x0f, data);
}
else if (offset < 0x8000)
m_bank = (data & m_bank_mask) + 1;
}
machine_config_constructor a78_rom_xm_device::device_mconfig_additions() const
machine_config_constructor a78_rom_sg9_pokey_device::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( a78_pokey );
}

View File

@ -98,35 +98,14 @@ public:
};
// ======================> a78_rom_bankram_device
// ======================> a78_rom_sg9_device
class a78_rom_bankram_device : public a78_rom_sg_device
class a78_rom_sg9_device : public a78_rom_sg_device
{
public:
// construction/destruction
a78_rom_bankram_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
// device-level overrides
virtual void device_start();
virtual void device_reset();
// reading and writing
virtual DECLARE_READ8_MEMBER(read_40xx);
virtual DECLARE_WRITE8_MEMBER(write_40xx);
protected:
int m_ram_bank;
};
// ======================> a78_rom_sg_9banks_device
class a78_rom_sg_9banks_device : public a78_rom_sg_device
{
public:
// construction/destruction
a78_rom_sg_9banks_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
a78_rom_sg_9banks_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
a78_rom_sg9_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
a78_rom_sg9_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
// reading and writing
virtual DECLARE_READ8_MEMBER(read_40xx);
@ -134,13 +113,13 @@ public:
};
// ======================> a78_rom_xm_device
// ======================> a78_rom_sg9_pokey_device
class a78_rom_xm_device : public a78_rom_sg_9banks_device
class a78_rom_sg9_pokey_device : public a78_rom_sg9_device
{
public:
// construction/destruction
a78_rom_xm_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
a78_rom_sg9_pokey_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
// device-level overrides
virtual machine_config_constructor device_mconfig_additions() const;
@ -201,9 +180,8 @@ extern const device_type A78_ROM_SG;
extern const device_type A78_ROM_POKEY;
extern const device_type A78_ROM_SG_POKEY;
extern const device_type A78_ROM_SG_RAM;
extern const device_type A78_ROM_BANKRAM;
extern const device_type A78_ROM_SG_9BANKS;
extern const device_type A78_ROM_XM;
extern const device_type A78_ROM_SG9;
extern const device_type A78_ROM_SG9_POKEY;
extern const device_type A78_ROM_ABSOLUTE;
extern const device_type A78_ROM_ACTIVISION;

View File

@ -121,7 +121,7 @@ static MACHINE_CONFIG_FRAGMENT( a78_xm )
MCFG_SOUND_ADD("xb_pokey", POKEY, XTAL_14_31818MHz/8)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "xb_speaker", 1.00)
MCFG_SOUND_ADD("xm_ym2151", YM2151, XTAL_14_31818MHz/8)
MCFG_SOUND_ADD("xm_ym2151", YM2151, XTAL_14_31818MHz/4)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "xb_speaker", 1.00)
MACHINE_CONFIG_END
@ -228,6 +228,7 @@ WRITE8_MEMBER(a78_xm_device::write_04xx)
m_xbslot->write_04xx(space, offset - 0x10, data); // access second POKEY
else if (offset >= 0x70 && offset < 0x80)
{
//printf("regs 0x%X\n", data);
if (data == 0x84)
m_ym_enabled = 1;
m_reg = data;

View File

@ -25,6 +25,7 @@ BUSOBJS += $(BUSOBJ)/a7800/a78_slot.o
BUSOBJS += $(BUSOBJ)/a7800/rom.o
BUSOBJS += $(BUSOBJ)/a7800/hiscore.o
BUSOBJS += $(BUSOBJ)/a7800/xboard.o
BUSOBJS += $(BUSOBJ)/a7800/cpuwiz.o
endif

View File

@ -1323,6 +1323,7 @@ void a7800_state::machine_start()
m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x3000, 0x3fff, read8_delegate(FUNC(a78_cart_slot_device::read_30xx),(a78_cart_slot_device*)m_cartslot), write8_delegate(FUNC(a78_cart_slot_device::write_30xx),(a78_cart_slot_device*)m_cartslot));
break;
case A78_XB_BOARD:
case A78_VERSAPOKEY:
// POKEY and RAM regs at 0x400-0x47f
m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x0400, 0x047f, read8_delegate(FUNC(a78_cart_slot_device::read_04xx),(a78_cart_slot_device*)m_cartslot), write8_delegate(FUNC(a78_cart_slot_device::write_04xx),(a78_cart_slot_device*)m_cartslot));
break;