Previous 199869 Revisions Next

r31947 Saturday 6th September, 2014 at 10:59:23 UTC by Fabio Priuli
d'oh. sorry.
[src/emu/bus/a7800]cpuwiz.c* cpuwiz.h*

trunk/src/emu/bus/a7800/cpuwiz.c
r0r31947
1/***********************************************************************************************************
2
3 A7800 CPUWIZ's homebrew boards (MegaCart+ and VersaBoard)
4 
5 Here we emulate the base configurations of these two boards:
6
7 MegaCart+ = up to 512K (31 banks at $8000, 1 at $C000) of ROM and 2 x 16K RAM @ $4000
8 VersaBoard = up to 256K of ROM and 2 x 16K RAM
9 
10 Plus, for the moment, a VersaBoard with POKEY mapped at 0x0450 and support for 144K ROM,
11 since a few demo homebrew programs seems to use this to combine compatibility with
12 XBoarD & XM expansions
13
14 Note that the VersaBoard can be configured to work with different banking hardware
15 e.g. with SG 9bank games or with SG + RAM (so to allow reproduction of games which
16 could have worked on old carts without sacrifying original carts), but games running
17 on those "standard" variants can be emulated with the standard code from rom.c ;-)
18 
19 
20 TO DO:
21 - investigate whether the POKEY detection routines in homebrew do fail due to emulation
22   issues or not
23 
24***********************************************************************************************************/
25
26
27#include "emu.h"
28#include "cpuwiz.h"
29
30
31//-------------------------------------------------
32//  constructor
33//-------------------------------------------------
34
35const device_type A78_ROM_VERSABOARD = &device_creator<a78_versaboard_device>;
36const device_type A78_ROM_VERSAPOKEY = &device_creator<a78_versapokey_device>;
37const device_type A78_ROM_MEGACART = &device_creator<a78_megacart_device>;
38
39
40a78_versaboard_device::a78_versaboard_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)
41               : a78_rom_sg_device(mconfig, type, name, tag, owner, clock, shortname, source)
42{
43}
44
45a78_versaboard_device::a78_versaboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
46               : a78_rom_sg_device(mconfig, A78_ROM_VERSABOARD, "Atari 7800 VersaBoard Cart", tag, owner, clock, "a78_versaboard", __FILE__)
47{
48}
49
50a78_versapokey_device::a78_versapokey_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
51               : a78_versaboard_device(mconfig, A78_ROM_VERSAPOKEY, "Atari 7800 VersaBoard + POKEY @ 0x0450 Cart", tag, owner, clock, "a78_versapokey", __FILE__),
52                  m_pokey(*this, "pokey")
53{
54}
55
56a78_megacart_device::a78_megacart_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
57               : a78_versaboard_device(mconfig, A78_ROM_MEGACART, "Atari 7800 MegaCart+", tag, owner, clock, "a78_megacart", __FILE__)
58{
59}
60
61
62void a78_versaboard_device::device_start()
63{
64   save_item(NAME(m_bank));
65   save_item(NAME(m_ram_bank));
66}
67
68void a78_versaboard_device::device_reset()
69{
70   m_bank = 0;
71   m_ram_bank = 0;
72}
73
74
75// VersaBoard
76
77READ8_MEMBER(a78_versaboard_device::read_40xx)
78{
79   if (offset < 0x4000)
80      return m_ram[offset + (m_ram_bank * 0x4000)];
81   else if (offset < 0x8000)
82      return m_rom[(offset & 0x3fff) + (m_bank * 0x4000)];
83   else
84      return m_rom[(offset & 0x3fff) + (m_bank_mask * 0x4000)];   // last bank
85}
86
87WRITE8_MEMBER(a78_versaboard_device::write_40xx)
88{
89   if (offset < 0x4000)
90      m_ram[offset + (m_ram_bank * 0x4000)] = data;
91   else if (offset < 0x8000)
92   {
93      // hardware allows up to 256K ROM
94      m_bank = (data & 0x0f) & m_bank_mask;
95      m_ram_bank = BIT(data, 5);
96   }
97}
98
99
100// VersaBoard + POKEY @ 0x0450
101
102static MACHINE_CONFIG_FRAGMENT( a78_pokey )
103   MCFG_SPEAKER_STANDARD_MONO("addon")
104
105   MCFG_SOUND_ADD("pokey", POKEY, XTAL_14_31818MHz/8)
106   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "addon", 1.00)
107MACHINE_CONFIG_END
108
109machine_config_constructor a78_versapokey_device::device_mconfig_additions() const
110{
111   return MACHINE_CONFIG_NAME( a78_pokey );
112}
113
114READ8_MEMBER(a78_versapokey_device::read_04xx)
115{
116   if (offset >= 0x50 && offset < 0x60)
117      return m_pokey->read(space, offset & 0x0f);
118   else
119      return 0xff;
120}
121
122WRITE8_MEMBER(a78_versapokey_device::write_04xx)
123{
124   if (offset >= 0x50 && offset < 0x60)
125      m_pokey->write(space, offset & 0x0f, data);
126}
127
128READ8_MEMBER(a78_versapokey_device::read_40xx)
129{
130   if (offset < 0x4000)
131      return m_rom[(offset & 0x3fff)];
132   else if (offset < 0x8000)
133      return m_rom[(offset & 0x3fff) + (m_bank * 0x4000)];
134   else
135      return m_rom[(offset & 0x3fff) + ((m_bank_mask + 1) * 0x4000)];   // last bank
136}
137
138WRITE8_MEMBER(a78_versapokey_device::write_40xx)
139{
140   if (offset >= 0x4000 && offset < 0x8000)
141      m_bank = (data & m_bank_mask) + 1;
142}
143
144
145// MegaCart+
146
147WRITE8_MEMBER(a78_megacart_device::write_40xx)
148{
149   if (offset < 0x4000)
150      m_ram[offset + (m_ram_bank * 0x4000)] = data;
151   else if (offset < 0x8000)
152   {
153      // hardware allows up to 512K ROM
154      m_bank = (data & 0x1f) & m_bank_mask;
155      m_ram_bank = BIT(data, 5);
156   }
157}
158
Property changes on: trunk/src/emu/bus/a7800/cpuwiz.c
Added: svn:eol-style
   + native
Added: svn:mime-type
   + text/plain
trunk/src/emu/bus/a7800/cpuwiz.h
r0r31947
1#ifndef __A78_CPUWIZ_H
2#define __A78_CPUWIZ_H
3
4#include "a78_slot.h"
5#include "rom.h"
6
7
8// ======================> a78_versaboard_device
9
10class a78_versaboard_device : public a78_rom_sg_device
11{
12public:
13   // construction/destruction
14   a78_versaboard_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);
15   a78_versaboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
16   
17   // device-level overrides
18   virtual void device_start();
19   virtual void device_reset();
20   
21   // reading and writing
22   virtual DECLARE_READ8_MEMBER(read_40xx);
23   virtual DECLARE_WRITE8_MEMBER(write_40xx);
24   
25protected:
26   int m_ram_bank;
27};
28
29
30// ======================> a78_versapokey_device
31
32class a78_versapokey_device : public a78_versaboard_device
33{
34public:
35   // construction/destruction
36   a78_versapokey_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
37   
38   // device-level overrides
39   virtual machine_config_constructor device_mconfig_additions() const;
40   
41   // reading and writing
42   virtual DECLARE_READ8_MEMBER(read_04xx);
43   virtual DECLARE_WRITE8_MEMBER(write_04xx);
44   virtual DECLARE_READ8_MEMBER(read_40xx);
45   virtual DECLARE_WRITE8_MEMBER(write_40xx);
46
47protected:
48   required_device<pokey_device> m_pokey;
49};
50
51
52// ======================> a78_megacart_device
53
54class a78_megacart_device : public a78_versaboard_device
55{
56public:
57   // construction/destruction
58   a78_megacart_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
59   
60   // reading and writing
61   virtual DECLARE_WRITE8_MEMBER(write_40xx);
62};
63
64
65
66// device type definition
67extern const device_type A78_ROM_VERSABOARD;
68extern const device_type A78_ROM_VERSAPOKEY;
69extern const device_type A78_ROM_MEGACART;
70
71
72#endif
Property changes on: trunk/src/emu/bus/a7800/cpuwiz.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native

Previous 199869 Revisions Next


© 1997-2024 The MAME Team