Previous 199869 Revisions Next

r31943 Saturday 6th September, 2014 at 06:49:07 UTC by Fabio Priuli
(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...
[hash]a7800.xml
[src/emu/bus]bus.mak
[src/emu/bus/a7800]a78_carts.h a78_slot.c a78_slot.h rom.c rom.h xboard.c
[src/mess/drivers]a7800.c

trunk/src/emu/bus/bus.mak
r31942r31943
2525BUSOBJS += $(BUSOBJ)/a7800/rom.o
2626BUSOBJS += $(BUSOBJ)/a7800/hiscore.o
2727BUSOBJS += $(BUSOBJ)/a7800/xboard.o
28BUSOBJS += $(BUSOBJ)/a7800/cpuwiz.o
2829endif
2930
3031
trunk/src/emu/bus/a7800/a78_carts.h
r31942r31943
11#ifndef __A78_CARTS_H
22#define __A78_CARTS_H
33
4
54#include "emu.h"
65
76#include "rom.h"
87#include "xboard.h"
98#include "hiscore.h"
9#include "cpuwiz.h"
1010
1111static SLOT_INTERFACE_START(a7800_cart)
1212   SLOT_INTERFACE_INTERNAL("a78_rom",      A78_ROM)
r31942r31943
1414   SLOT_INTERFACE_INTERNAL("a78_sg",       A78_ROM_SG)
1515   SLOT_INTERFACE_INTERNAL("a78_sg_pokey", A78_ROM_SG_POKEY)
1616   SLOT_INTERFACE_INTERNAL("a78_sg_ram",   A78_ROM_SG_RAM)
17   // not sure which dev cart support banked ram, nor whether there shall be a 9banks or a non-sg version of this...
18   SLOT_INTERFACE_INTERNAL("a78_bankram",  A78_ROM_BANKRAM)   
19   SLOT_INTERFACE_INTERNAL("a78_sg9",      A78_ROM_SG_9BANKS)
20   SLOT_INTERFACE_INTERNAL("a78_xmc",      A78_ROM_XM)    // carts compatible with the expansions below (basically a 9Banks+POKEY)
17   SLOT_INTERFACE_INTERNAL("a78_sg9",      A78_ROM_SG9)
18   SLOT_INTERFACE_INTERNAL("a78_sg9_pokey",A78_ROM_SG9_POKEY)    // carts compatible with the expansions below (basically a 9Banks+POKEY)
2119   SLOT_INTERFACE_INTERNAL("a78_abs",      A78_ROM_ABSOLUTE)
2220   SLOT_INTERFACE_INTERNAL("a78_act",      A78_ROM_ACTIVISION)
2321   SLOT_INTERFACE_INTERNAL("a78_hsc",      A78_HISCORE)
2422   SLOT_INTERFACE_INTERNAL("a78_xboard",   A78_XBOARD)   // the actual XBoarD expansion (as passthru)
2523   SLOT_INTERFACE_INTERNAL("a78_xm",       A78_XM)       // the actual XM expansion (as passthru)
24   SLOT_INTERFACE_INTERNAL("a78_megacart", A78_ROM_MEGACART)   
25   SLOT_INTERFACE_INTERNAL("a78_versa",    A78_ROM_VERSABOARD)   
26   SLOT_INTERFACE_INTERNAL("a78_versap",   A78_ROM_VERSAPOKEY)   // For debugging purposes
2627SLOT_INTERFACE_END
2728
2829
trunk/src/emu/bus/a7800/a78_slot.c
r31942r31943
170170// Here, we take the feature attribute from .xml (i.e. the PCB name) and we assign a unique ID to it
171171static const a78_slot slot_list[] =
172172{
173   { A78_TYPE0,    "a78_rom" },
174   { A78_TYPE1,    "a78_pokey" },
175   { A78_TYPE2,    "a78_sg" },
176   { A78_TYPE3,    "a78_sg_pokey" },
177   { A78_TYPE6,    "a78_sg_ram" },
178   { A78_TYPEA,    "a78_sg9" },
179   { A78_TYPEB,    "a78_xmc" },
180   { A78_ABSOLUTE, "a78_abs" },
173   { A78_TYPE0,      "a78_rom" },
174   { A78_TYPE1,      "a78_pokey" },
175   { A78_TYPE2,      "a78_sg" },
176   { A78_TYPE3,      "a78_sg_pokey" },
177   { A78_TYPE6,      "a78_sg_ram" },
178   { A78_TYPEA,      "a78_sg9" },
179   { A78_TYPEB,      "a78_sg9_pokey" },
180   { A78_ABSOLUTE,   "a78_abs" },
181181   { A78_ACTIVISION, "a78_act" },
182   { A78_HSC,      "a78_hsc" },
183   { A78_BANKRAM,  "a78_bankram" },
184   { A78_XB_BOARD, "a78_xboard" },
185   { A78_XM_BOARD, "a78_xm" },
186   { A78_NOCART,   "empty" },
182   { A78_HSC,        "a78_hsc" },
183   { A78_XB_BOARD,   "a78_xboard" },
184   { A78_XM_BOARD,   "a78_xm" },
185   { A78_MEGACART,   "a78_megacart" },
186   { A78_VERSABOARD, "a78_versa" },
187   { A78_VERSAPOKEY, "a78_versap" },
188   { A78_NOCART,     "empty" },   // the code should never get here, of course...
187189};
188190
189191static int a78_get_pcb_id(const char *slot)
r31942r31943
269271               m_type = A78_TYPEB;
270272               break;
271273            case 0x0020:
272               m_type = A78_BANKRAM;
274               if (len > 0x40000)
275                  m_type = A78_MEGACART;
276               else
277                  m_type = A78_VERSABOARD;
273278               break;
279            case 0x0021:
280               m_type = A78_VERSAPOKEY;
281               break;
274282            case 0x0100:
275283               m_type = A78_ACTIVISION;
276284               break;
r31942r31943
291299     
292300      if (m_type == A78_TYPE6)
293301         m_cart->ram_alloc(0x4000);
294      if (m_type == A78_BANKRAM)
302      if (m_type == A78_MEGACART || m_type == A78_VERSABOARD || m_type == A78_VERSAPOKEY)
295303         m_cart->ram_alloc(0x8000);
296304      if (m_type == A78_XB_BOARD || m_type == A78_XM_BOARD)
297305         m_cart->ram_alloc(0x20000);
r31942r31943
394402            type = A78_TYPEB;
395403            break;
396404         case 0x0020:
397            m_type = A78_BANKRAM;
405            if (core_fsize(m_file) > 0x40000)
406               type = A78_MEGACART;
407            else
408               type = A78_VERSABOARD;
398409            break;
410         case 0x0021:
411            type = A78_VERSAPOKEY;
412            break;
399413         case 0x0100:
400414            type = A78_ACTIVISION;
401415            break;
trunk/src/emu/bus/a7800/rom.h
r31942r31943
9898};
9999
100100
101// ======================> a78_rom_bankram_device
101// ======================> a78_rom_sg9_device
102102
103class a78_rom_bankram_device : public a78_rom_sg_device
103class a78_rom_sg9_device : public a78_rom_sg_device
104104{
105105public:
106106   // construction/destruction
107   a78_rom_bankram_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
107   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);
108   a78_rom_sg9_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
108109   
109   // device-level overrides
110   virtual void device_start();
111   virtual void device_reset();
112   
113110   // reading and writing
114111   virtual DECLARE_READ8_MEMBER(read_40xx);
115112   virtual DECLARE_WRITE8_MEMBER(write_40xx);
116
117protected:
118   int m_ram_bank;
119113};
120114
121115
122// ======================> a78_rom_sg_9banks_device
116// ======================> a78_rom_sg9_pokey_device
123117
124class a78_rom_sg_9banks_device : public a78_rom_sg_device
118class a78_rom_sg9_pokey_device : public a78_rom_sg9_device
125119{
126120public:
127121   // construction/destruction
128   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);
129   a78_rom_sg_9banks_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
122   a78_rom_sg9_pokey_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
130123   
131   // reading and writing
132   virtual DECLARE_READ8_MEMBER(read_40xx);
133   virtual DECLARE_WRITE8_MEMBER(write_40xx);
134};
135
136
137// ======================> a78_rom_xm_device
138
139class a78_rom_xm_device : public a78_rom_sg_9banks_device
140{
141public:
142   // construction/destruction
143   a78_rom_xm_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
144   
145124   // device-level overrides
146125   virtual machine_config_constructor device_mconfig_additions() const;
147126   
r31942r31943
201180extern const device_type A78_ROM_POKEY;
202181extern const device_type A78_ROM_SG_POKEY;
203182extern const device_type A78_ROM_SG_RAM;
204extern const device_type A78_ROM_BANKRAM;
205extern const device_type A78_ROM_SG_9BANKS;
206extern const device_type A78_ROM_XM;
183extern const device_type A78_ROM_SG9;
184extern const device_type A78_ROM_SG9_POKEY;
207185extern const device_type A78_ROM_ABSOLUTE;
208186extern const device_type A78_ROM_ACTIVISION;
209187
trunk/src/emu/bus/a7800/a78_slot.h
r31942r31943
1616   A78_TYPE3,         // as TYPE1 + POKEY chip on the PCB
1717   A78_TYPE6,         // as TYPE1 + RAM IC on the PCB
1818   A78_TYPEA,         // Alien Brigade, Crossbow (9x16K banks with diff bankswitch)
19   A78_TYPEB,         // Cart exploiting the XB board, but possibly also compatible with non-expanded A7800
1920   A78_ABSOLUTE,      // F18 Hornet
2021   A78_ACTIVISION,      // Double Dragon, Rampage
2122   A78_HSC,         // Atari HighScore cart
22   A78_BANKRAM,      // SuperGame + 32K RAM banked (untested)
2323   A78_XB_BOARD,      // A7800 Expansion Board (it shall more or less apply to the Expansion Module too, but this is not officially released yet)
2424   A78_XM_BOARD,      // A7800 XM Expansion Module (theoretical specs only, since this is not officially released yet)
25   A78_TYPEB,         // Cart exploiting the XB board, but possibly also compatible with non-expanded A7800
25   A78_MEGACART,      // Homebrew by CPUWIZ, consists of SuperGame bank up to 512K + 32K RAM banked
26   A78_VERSABOARD,      // Homebrew by CPUWIZ, consists of SuperGame bank up to 256K + 32K RAM banked
27   A78_VERSAPOKEY,      // For debugging purpose, same as VersaBoard + SG 9 Banks + POKEY at 0x0450
2628   A78_NOCART
2729};
2830
trunk/src/emu/bus/a7800/rom.c
r31942r31943
2626const device_type A78_ROM_POKEY = &device_creator<a78_rom_pokey_device>;
2727const device_type A78_ROM_SG_POKEY = &device_creator<a78_rom_sg_pokey_device>;
2828const device_type A78_ROM_SG_RAM = &device_creator<a78_rom_sg_ram_device>;
29const device_type A78_ROM_BANKRAM = &device_creator<a78_rom_bankram_device>;
30const device_type A78_ROM_SG_9BANKS = &device_creator<a78_rom_sg_9banks_device>;
31const device_type A78_ROM_XM = &device_creator<a78_rom_xm_device>;
29const device_type A78_ROM_SG9 = &device_creator<a78_rom_sg9_device>;
30const device_type A78_ROM_SG9_POKEY = &device_creator<a78_rom_sg9_pokey_device>;
3231const device_type A78_ROM_ABSOLUTE = &device_creator<a78_rom_abs_device>;
3332const device_type A78_ROM_ACTIVISION = &device_creator<a78_rom_act_device>;
3433
r31942r31943
7574}
7675
7776
78a78_rom_bankram_device::a78_rom_bankram_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
79               : a78_rom_sg_device(mconfig, A78_ROM_BANKRAM, "Atari 7800 ROM Carts w/SuperGame Bankswitch + Banked RAM", tag, owner, clock, "a78_rom_bankram", __FILE__)
80{
81}
82
83
84a78_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)
77a78_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)
8578               : a78_rom_sg_device(mconfig, type, name, tag, owner, clock, shortname, source)
8679{
8780}
8881
89a78_rom_sg_9banks_device::a78_rom_sg_9banks_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
90               : a78_rom_sg_device(mconfig, A78_ROM_SG_9BANKS, "Atari 7800 ROM Carts w/SuperGame 9Banks", tag, owner, clock, "a78_rom_sg9", __FILE__)
82a78_rom_sg9_device::a78_rom_sg9_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
83               : a78_rom_sg_device(mconfig, A78_ROM_SG9, "Atari 7800 ROM Carts w/SuperGame 9Banks", tag, owner, clock, "a78_rom_sg9", __FILE__)
9184{
9285}
9386
9487
95a78_rom_xm_device::a78_rom_xm_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
96               : 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__),
88a78_rom_sg9_pokey_device::a78_rom_sg9_pokey_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
89               : a78_rom_sg9_device(mconfig, A78_ROM_SG9_POKEY, "Atari 7800 ROM Carts w/SuperGame 9Banks + POKEY", tag, owner, clock, "a78_rom_sg9p", __FILE__),
9790                  m_pokey(*this, "pokey")
9891{
9992}
r31942r31943
130123   m_bank = 0;
131124}
132125
133void a78_rom_bankram_device::device_start()
134{
135   save_item(NAME(m_bank));
136   save_item(NAME(m_ram_bank));
137}
138
139void a78_rom_bankram_device::device_reset()
140{
141   m_bank = 0;
142   m_ram_bank = 0;
143}
144
145126void a78_rom_abs_device::device_start()
146127{
147128   save_item(NAME(m_bank));
r31942r31943
301282
302283
303284/*-------------------------------------------------
304 
305 Carts with SuperGame bankswitch + 32K RAM:
306 RAM bank is selected by writing with bit5 enabled
307 in 0x4000-0x7fff range (bit0-bit4 give the ROM bank)
308 
309 GAMES:
310 
311 -------------------------------------------------*/
312285
313READ8_MEMBER(a78_rom_bankram_device::read_40xx)
314{
315   if (offset < 0x4000)
316      return m_ram[offset + (m_ram_bank * 0x4000)];
317   else if (offset < 0x8000)
318      return m_rom[(offset & 0x3fff) + (m_bank * 0x4000)];
319   else
320      return m_rom[(offset & 0x3fff) + (m_bank_mask * 0x4000)];   // last bank
321}
322
323WRITE8_MEMBER(a78_rom_bankram_device::write_40xx)
324{
325   if (offset < 0x4000)
326      m_ram[offset] = data;
327   else if (offset < 0x8000)
328   {
329      m_bank = data & m_bank_mask;
330      m_ram_bank = BIT(data, 5);
331   }
332}
333
334
335/*-------------------------------------------------
336
337286 Carts with SuperGame bankswitch 9banks:
338287 9 x 16K banks mappable in 0x8000-0xbfff
339288 bank 7 is always mapped in 0xc000-0xffff
r31942r31943
342291 
343292 -------------------------------------------------*/
344293
345READ8_MEMBER(a78_rom_sg_9banks_device::read_40xx)
294READ8_MEMBER(a78_rom_sg9_device::read_40xx)
346295{
347296   if (offset < 0x4000)
348297      return m_rom[(offset & 0x3fff)];
r31942r31943
352301      return m_rom[(offset & 0x3fff) + ((m_bank_mask + 1) * 0x4000)];   // last bank
353302}
354303
355WRITE8_MEMBER(a78_rom_sg_9banks_device::write_40xx)
304WRITE8_MEMBER(a78_rom_sg9_device::write_40xx)
356305{
357306   if (offset >= 0x4000 && offset < 0x8000)
358307      m_bank = (data & m_bank_mask) + 1;
r31942r31943
360309
361310/*-------------------------------------------------
362311 
363 Carts using XM expansion module or XBoarD expansion
364 The only game using this (Donkey Kong XM demo) is
365 144K + POKEY, so that it's like the above with the
366 addition of the POKEY.
312 Carts with SuperGame bankswitch 9banks + POKEY:
313 This was not used in any commercial game released
314 during A7800 lifespan, but it is used by Donkey
315 Kong XM demo and by Bentley Bear's Crystal Quest
316 for use with XM expansion module or XBoarD expansion
367317 
368 GAMES: Donkey Kong XM demo
318 GAMES: Donkey Kong XM demo, Bentley Bear's Crystal
319 Quest
369320 
370321 -------------------------------------------------*/
371322
372WRITE8_MEMBER(a78_rom_xm_device::write_40xx)
323WRITE8_MEMBER(a78_rom_sg9_pokey_device::write_40xx)
373324{
374325   if (offset < 0x4000)
326   {
327      printf("write offs 0x%X data 0x%X\n", offset, data);
375328      m_pokey->write(space, offset & 0x0f, data);
329   }
376330   else if (offset < 0x8000)
377331      m_bank = (data & m_bank_mask) + 1;
378332}
379333
380machine_config_constructor a78_rom_xm_device::device_mconfig_additions() const
334machine_config_constructor a78_rom_sg9_pokey_device::device_mconfig_additions() const
381335{
382336   return MACHINE_CONFIG_NAME( a78_pokey );
383337}
trunk/src/emu/bus/a7800/xboard.c
r31942r31943
121121   MCFG_SOUND_ADD("xb_pokey", POKEY, XTAL_14_31818MHz/8)
122122   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "xb_speaker", 1.00)
123123
124   MCFG_SOUND_ADD("xm_ym2151", YM2151, XTAL_14_31818MHz/8)
124   MCFG_SOUND_ADD("xm_ym2151", YM2151, XTAL_14_31818MHz/4)
125125   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "xb_speaker", 1.00)
126126MACHINE_CONFIG_END
127127
r31942r31943
228228      m_xbslot->write_04xx(space, offset - 0x10, data);   // access second POKEY
229229   else if (offset >= 0x70 && offset < 0x80)
230230   {
231      //printf("regs 0x%X\n", data);
231232      if (data == 0x84)
232233         m_ym_enabled = 1;
233234      m_reg = data;
trunk/src/mess/drivers/a7800.c
r31942r31943
13231323         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));
13241324         break;
13251325      case A78_XB_BOARD:
1326      case A78_VERSAPOKEY:
13261327         // POKEY and RAM regs at 0x400-0x47f
13271328         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));
13281329         break;
trunk/hash/a7800.xml
r31942r31943
24492449      <sharedfeat name="compatibility" value="PAL"/>
24502450      <part name="cart" interface="a7800_cart">
24512451         <feature name="pcb_type" value="TYPE-XM" />
2452         <feature name="slot" value="a78_xmc" />
2453         <dataarea name="rom" size="0x24000">
2454            <rom name="dkxm_final_demo_pal.a78" size="0x24000" crc="d362712e" sha1="118c462d6698bd23c378785f80062fdd7d65ca00" offset="0" />
2452         <feature name="slot" value="a78_sg9" />
2453         <dataarea name="rom" size="147456">
2454            <rom name="dkxm_final_demo_pal.bin" size="147456" crc="d362712e" sha1="118c462d6698bd23c378785f80062fdd7d65ca00" offset="0" />
24552455         </dataarea>
24562456      </part>
24572457   </software>
r31942r31943
24642464      <sharedfeat name="compatibility" value="NTSC"/>
24652465      <part name="cart" interface="a7800_cart">
24662466         <feature name="pcb_type" value="TYPE-XM" />
2467         <feature name="slot" value="a78_xmc" />
2468         <dataarea name="rom" size="0x24000">
2469            <rom name="dkxm_final_demo_ntsc.a78" size="0x24000" crc="6e170055" sha1="f4da231312da06ff9e8af5681b5013b14886b455" offset="0" />
2467         <feature name="slot" value="a78_sg9" />
2468         <dataarea name="rom" size="147456">
2469            <rom name="dkxm_final_demo_ntsc.bin" size="147456" crc="6e170055" sha1="f4da231312da06ff9e8af5681b5013b14886b455" offset="0" />
24702470         </dataarea>
24712471      </part>
24722472   </software>

Previous 199869 Revisions Next


© 1997-2024 The MAME Team