Previous 15994 Revisions Next

r14905 Friday 13th April, 2012 at 16:19:42 UTC by Curt Coder
Lots of CBM cartridge work. (nw)
[hash]c64_cart.xml
[src/mess/drivers]vic10.c
[src/mess/includes]vic10.h
[src/mess/machine]c64_currah_speech.h c64_dqbb.c c64_dqbb.h c64exp.c c64exp.h vic10exp.c vic10exp.h vic10std.c vic10std.h vic20_megacart.c vic20_megacart.h vic20exp.c vic20exp.h

hash/c64_cart.xml
r14904r14905
44
55   Hardware to be emulated
66
7   CPU accelerators:
7   CPU replacements:
88   - Turbo Master CPU (R65C02P4 @ 4.09 MHz)
99   - Turbo Process Accelerator (65C816P-4  @ 50kHz-4MHz)
1010   - Flash 8 (65816 @ 8 MHz, 4/8 MB RAM)
1111   - CMD SuperCPU 64 (65C816S, 64 KB RAM)
12   - Data 20 Z-80 Video Pak (Z80, 80 column video)
13   - Commodore CP/M (Z80)
1214
1315   Serial I/O:
1416   - CMD SwiftLink (6551 @ 3.6864 MHz)
src/mess/machine/vic20exp.c
r14904r14905
4545     m_blk3(NULL),
4646     m_blk5(NULL),
4747     m_ram(NULL),
48     m_nvram(NULL)
48     m_nvram(NULL),
49     m_nvram_size(0)
4950{
5051   m_slot = dynamic_cast<vic20_expansion_slot_device *>(device.owner());
5152}
r14904r14905
135136   if (m_nvram == NULL)
136137   {
137138      m_nvram = auto_alloc_array(machine, UINT8, size);
139
140      m_nvram_mask = size - 1;
141      m_nvram_size = size;
138142   }
139143
140144   return m_nvram;
r14904r14905
279283
280284         size = get_software_region_length("nvram");
281285         if (size) memcpy(m_cart->vic20_nvram_pointer(machine(), size), get_software_region("nvram"), size);
286
282287      }
283288   }
284289
src/mess/machine/vic20exp.h
r14904r14905
156156// class representing interface-specific live vic20_expansion card
157157class device_vic20_expansion_card_interface : public device_slot_card_interface
158158{
159   friend class vic20_expansion_slot_device;
160
159161public:
160162   // construction/destruction
161163   device_vic20_expansion_card_interface(const machine_config &mconfig, device_t &device);
162164   virtual ~device_vic20_expansion_card_interface();
163165
164   // memory access
165   virtual UINT8 vic20_cd_r(address_space &space, offs_t offset, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) { return 0; };
166   virtual void vic20_cd_w(address_space &space, offs_t offset, UINT8 data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) { };
167
168   virtual UINT32 vic20_screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { return false; }
169
166protected:
167   // initialization
170168   virtual UINT8* vic20_blk1_pointer(running_machine &machine, size_t size);
171169   virtual UINT8* vic20_blk2_pointer(running_machine &machine, size_t size);
172170   virtual UINT8* vic20_blk3_pointer(running_machine &machine, size_t size);
r14904r14905
174172   virtual UINT8* vic20_ram_pointer(running_machine &machine, size_t size);
175173   virtual UINT8* vic20_nvram_pointer(running_machine &machine, size_t size);
176174
177protected:
175   // runtime
176   virtual UINT8 vic20_cd_r(address_space &space, offs_t offset, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) { return 0; };
177   virtual void vic20_cd_w(address_space &space, offs_t offset, UINT8 data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) { };
178   virtual UINT32 vic20_screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { return false; }
179
178180   vic20_expansion_slot_device *m_slot;
179181
180182   UINT8 *m_blk1;
r14904r14905
183185   UINT8 *m_blk5;
184186   UINT8 *m_ram;
185187   UINT8 *m_nvram;
188
189   size_t m_nvram_size;
190
191   size_t m_nvram_mask;
186192};
187193
188194
src/mess/machine/vic20_megacart.c
r14904r14905
5050vic20_megacart_device::vic20_megacart_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
5151    : device_t(mconfig, VIC20_MEGACART, "Mega-Cart", tag, owner, clock),
5252     device_vic20_expansion_card_interface(mconfig, *this),
53       device_nvram_interface(mconfig, *this),
5354     m_nvram_en(0)
5455{
5556}
src/mess/machine/vic20_megacart.h
r14904r14905
2525// ======================> vic20_megacart_device
2626 
2727class vic20_megacart_device :  public device_t,
28                        public device_vic20_expansion_card_interface
28                        public device_vic20_expansion_card_interface,
29                        public device_nvram_interface
2930{
3031public:
3132    // construction/destruction
r14904r14905
4041   virtual void device_reset();
4142   virtual void device_config_complete() { m_shortname = "megacart"; }
4243 
44   // device_nvram_interface overrides
45   virtual void nvram_default() { }
46   virtual void nvram_read(emu_file &file) { if (m_nvram != NULL) { file.read(m_nvram, m_nvram_size); } }
47   virtual void nvram_write(emu_file &file) { if (m_nvram != NULL) { file.write(m_nvram, m_nvram_size); } }
48 
4349   // device_vic20_expansion_card_interface overrides
4450   virtual UINT8 vic20_cd_r(address_space &space, offs_t offset, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3);
4551   virtual void vic20_cd_w(address_space &space, offs_t offset, UINT8 data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3);
src/mess/machine/c64_currah_speech.h
r14904r14905
3838
3939protected:
4040   // device-level overrides
41    virtual void device_config_complete() { m_shortname = "c64_currah_speech"; }
41    virtual void device_config_complete() { m_shortname = "c64_cs"; }
4242   virtual void device_start();
4343   virtual void device_reset();
4444
src/mess/machine/vic10std.c
r14904r14905
4444 
4545 
4646//-------------------------------------------------
47//  vic10_exram_r - expanded RAM read
47//  vic10_cd_r - cartridge data read
4848//-------------------------------------------------
4949 
50UINT8 vic10_standard_cartridge_device::vic10_exram_r(address_space &space, offs_t offset)
50UINT8 vic10_standard_cartridge_device::vic10_cd_r(address_space &space, offs_t offset, int lorom, int uprom, int exram)
5151{
5252   UINT8 data = 0;
5353 
54   if (m_exram != NULL)
54   if (!lorom && (m_lorom != NULL))
5555   {
56      data = m_exram[offset & 0x7ff];
56      data = m_lorom[offset & 0x1fff];
5757   }
58 
59   return data;
60}
61 
62 
63//-------------------------------------------------
64//  vic10_exram_w - expanded RAM write
65//-------------------------------------------------
66 
67void vic10_standard_cartridge_device::vic10_exram_w(address_space &space, offs_t offset, UINT8 data)
68{
69   if (m_exram != NULL)
58   else if (!exram && (m_exram != NULL))
7059   {
71      m_exram[offset & 0x7ff] = data;
60      data = m_exram[offset & 0x7ff];
7261   }
73}
74 
75 
76//-------------------------------------------------
77//  vic10_lorom_r - lower ROM read
78//-------------------------------------------------
79 
80UINT8 vic10_standard_cartridge_device::vic10_lorom_r(address_space &space, offs_t offset)
81{
82   UINT8 data = 0;
83 
84   if (m_lorom != NULL)
62   else if (!uprom && (m_uprom != NULL))
8563   {
86      data = m_lorom[offset & 0x1fff];
64      data = m_uprom[offset & 0x1fff];
8765   }
8866 
8967   return data;
r14904r14905
9169 
9270 
9371//-------------------------------------------------
94//  vic10_uprom_r - upper ROM read
72//  vic10_cd_w - cartridge data write
9573//-------------------------------------------------
9674 
97UINT8 vic10_standard_cartridge_device::vic10_uprom_r(address_space &space, offs_t offset)
75void vic10_standard_cartridge_device::vic10_cd_w(address_space &space, offs_t offset, UINT8 data, int lorom, int uprom, int exram)
9876{
99   UINT8 data = 0;
100 
101   if (m_uprom != NULL)
77   if (!exram && (m_exram != NULL))
10278   {
103      data = m_uprom[offset & 0x1fff];
79      m_exram[offset & 0x7ff] = data;
10480   }
105 
106   return data;
10781}
src/mess/machine/vic10std.h
r14904r14905
3737   virtual void device_config_complete() { m_shortname = "vic10_standard"; }
3838 
3939   // device_vic10_expansion_card_interface overrides
40   virtual UINT8 vic10_exram_r(address_space &space, offs_t offset);
41   virtual void vic10_exram_w(address_space &space, offs_t offset, UINT8 data);
42   virtual UINT8 vic10_lorom_r(address_space &space, offs_t offset);
43   virtual UINT8 vic10_uprom_r(address_space &space, offs_t offset);
40   virtual UINT8 vic10_cd_r(address_space &space, offs_t offset, int lorom, int uprom, int exram);
41   virtual void vic10_cd_w(address_space &space, offs_t offset, UINT8 data, int lorom, int uprom, int exram);
4442};
4543 
4644 
src/mess/machine/c64_dqbb.c
r14904r14905
3939 
4040c64_dqbb_cartridge_device::c64_dqbb_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
4141   device_t(mconfig, C64_DQBB, "C64 Double Quick Brown Box cartridge", tag, owner, clock),
42   device_c64_expansion_card_interface(mconfig, *this)
42   device_c64_expansion_card_interface(mconfig, *this),
43   device_nvram_interface(mconfig, *this)
4344{
4445}
4546 
r14904r14905
5152void c64_dqbb_cartridge_device::device_start()
5253{
5354   // allocate memory
54   m_ram = auto_alloc_array(machine(), UINT8, 0x4000);
55   c64_nvram_pointer(machine(), 0x4000);
5556 
5657   // state saving
5758   save_item(NAME(m_cs));
r14904r14905
8283 
8384   if (!m_cs && (!roml || !romh))
8485   {
85      data = m_ram[offset & 0x3fff];
86      data = m_nvram[offset & 0x3fff];
8687   }
8788 
8889   return data;
r14904r14905
9798{
9899   if (!m_cs && m_we && (offset >= 0x8000 && offset < 0xc000))
99100   {
100      m_ram[offset & 0x3fff] = data;
101      m_nvram[offset & 0x3fff] = data;
101102   }
102103   else if (!io1)
103104   {
src/mess/machine/c64_dqbb.h
r14904r14905
2626// ======================> c64_dqbb_cartridge_device
2727 
2828class c64_dqbb_cartridge_device : public device_t,
29                          public device_c64_expansion_card_interface
29                          public device_c64_expansion_card_interface,
30                             public device_nvram_interface
3031{
3132public:
3233   // construction/destruction
r14904r14905
3839   virtual void device_reset();
3940   virtual void device_config_complete() { m_shortname = "c64_dqbb"; }
4041 
42   // device_nvram_interface overrides
43   virtual void nvram_default() { }
44   virtual void nvram_read(emu_file &file) { if (m_nvram != NULL) { file.read(m_nvram, m_nvram_size); } }
45   virtual void nvram_write(emu_file &file) { if (m_nvram != NULL) { file.write(m_nvram, m_nvram_size); } }
46 
4147   // device_c64_expansion_card_interface overrides
4248   virtual UINT8 c64_cd_r(address_space &space, offs_t offset, int roml, int romh, int io1, int io2);
4349   virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int roml, int romh, int io1, int io2);
src/mess/machine/c64exp.c
r14904r14905
4040     m_roml(NULL),
4141     m_romh(NULL),
4242     m_ram(NULL),
43     m_nvram(NULL),
44     m_nvram_size(0),
4345     m_roml_mask(0),
4446     m_romh_mask(0),
4547     m_ram_mask(0),
r14904r14905
6870   if (m_roml == NULL)
6971   {
7072      m_roml = auto_alloc_array(machine, UINT8, size);
73     
7174      m_roml_mask = size - 1;
7275   }
7376
r14904r14905
8487   if (m_romh == NULL)
8588   {
8689      m_romh = auto_alloc_array(machine, UINT8, size);
90
8791      m_romh_mask = size - 1;
8892   }
8993
r14904r14905
100104   if (m_ram == NULL)
101105   {
102106      m_ram = auto_alloc_array(machine, UINT8, size);
107
103108      m_ram_mask = size - 1;
104109   }
105110
r14904r14905
107112}
108113
109114
115//-------------------------------------------------
116//  c64_ram_pointer - get NVRAM pointer
117//-------------------------------------------------
110118
119UINT8* device_c64_expansion_card_interface::c64_nvram_pointer(running_machine &machine, size_t size)
120{
121   if (m_nvram == NULL)
122   {
123      m_nvram = auto_alloc_array(machine, UINT8, size);
124
125      m_nvram_mask = size - 1;
126      m_nvram_size = size;
127   }
128
129   return m_nvram;
130}
131
132
133
111134//**************************************************************************
112135//  LIVE DEVICE
113136//**************************************************************************
r14904r14905
199222         if (!mame_stricmp(filetype(), "80"))
200223         {
201224            fread(m_cart->c64_roml_pointer(machine(), size), size);
202            m_cart->c64_exrom_w(0);
225            m_cart->m_exrom = (0);
203226
204227            if (size == 0x4000)
205228            {
206               m_cart->c64_game_w(0);
229               m_cart->m_game = 0;
207230            }
208231         }
209232         else if (!mame_stricmp(filetype(), "a0"))
210233         {
211234            fread(m_cart->c64_romh_pointer(machine(), 0x2000), 0x2000);
212235
213            m_cart->c64_exrom_w(0);
214            m_cart->c64_game_w(0);
236            m_cart->m_exrom = 0;
237            m_cart->m_game = 0;
215238         }
216239         else if (!mame_stricmp(filetype(), "e0"))
217240         {
218241            fread(m_cart->c64_romh_pointer(machine(), 0x2000), 0x2000);
219242
220            m_cart->c64_game_w(0);
243            m_cart->m_game = 0;
221244         }
222245         else if (!mame_stricmp(filetype(), "crt"))
223246         {
r14904r14905
237260               cbm_crt_read_data(m_file, roml, romh);
238261            }
239262
240            m_cart->c64_exrom_w(exrom);
241            m_cart->c64_game_w(game);
263            m_cart->m_exrom = exrom;
264            m_cart->m_game = game;
242265         }
243266      }
244267      else
r14904r14905
253276            size = get_software_region_length("lorom");
254277            if (size) memcpy(m_cart->c64_roml_pointer(machine(), size), get_software_region("lorom"), size);
255278
256            m_cart->c64_exrom_w(1);
257            m_cart->c64_game_w(0);
279            m_cart->m_exrom = 1;
280            m_cart->m_game = 0;
258281         }
259282         else
260283         {
r14904r14905
268291            size = get_software_region_length("ram");
269292            if (size) memset(m_cart->c64_ram_pointer(machine(), size), 0, size);
270293
271            m_cart->c64_exrom_w(atol(get_feature("exrom")));
272            m_cart->c64_game_w(atol(get_feature("game")));
294            size = get_software_region_length("nvram");
295            if (size) memset(m_cart->c64_nvram_pointer(machine(), size), 0, size);
296
297            m_cart->m_exrom = (atol(get_feature("exrom")));
298            m_cart->m_game = atol(get_feature("game"));
273299         }
274300      }
275301   }
src/mess/machine/c64exp.h
r14904r14905
151151
152152class device_c64_expansion_card_interface : public device_slot_card_interface
153153{
154   friend class c64_expansion_slot_device;
155
154156public:
155157   // construction/destruction
156158   device_c64_expansion_card_interface(const machine_config &mconfig, device_t &device);
157159   virtual ~device_c64_expansion_card_interface();
158160
159   // memory access
161protected:
162   // initialization
163   virtual UINT8* c64_roml_pointer(running_machine &machine, size_t size);
164   virtual UINT8* c64_romh_pointer(running_machine &machine, size_t size);
165   virtual UINT8* c64_ram_pointer(running_machine &machine, size_t size);
166   virtual UINT8* c64_nvram_pointer(running_machine &machine, size_t size);
167
168   // runtime
160169   virtual UINT8 c64_cd_r(address_space &space, offs_t offset, int roml, int romh, int io1, int io2) { return 0; };
161170   virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int roml, int romh, int io1, int io2) { };
162
163   // memory banking
164171   virtual int c64_game_r(offs_t offset, int ba, int rw, int hiram) { return m_game; }
165172   virtual int c64_exrom_r() { return m_exrom; }
166   virtual void c64_game_w(int state) { m_game = state; }
167   virtual void c64_exrom_w(int state) { m_exrom = state; }
168
169   // reset
170173   virtual void c64_reset_w() { };
171
172   // video
173174   virtual UINT32 c64_screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { return false; }
174175
175   // standard ROM cartridge
176   virtual UINT8* c64_roml_pointer(running_machine &machine, size_t size);
177   virtual UINT8* c64_romh_pointer(running_machine &machine, size_t size);
178   virtual UINT8* c64_ram_pointer(running_machine &machine, size_t size);
179
180protected:
181176   c64_expansion_slot_device *m_slot;
182177
183178   UINT8 *m_roml;
184179   UINT8 *m_romh;
185180   UINT8 *m_ram;
181   UINT8 *m_nvram;
186182
187   int m_roml_mask;
188   int m_romh_mask;
189   int m_ram_mask;
183   size_t m_nvram_size;
190184
185   size_t m_roml_mask;
186   size_t m_romh_mask;
187   size_t m_ram_mask;
188   size_t m_nvram_mask;
189
191190   int m_game;
192191   int m_exrom;
193192};
src/mess/machine/vic10exp.c
r14904r14905
276276}
277277 
278278 
279READ8_MEMBER( vic10_expansion_slot_device::lorom_r ) { UINT8 data = 0; if (m_cart != NULL) data = m_cart->vic10_lorom_r(space, offset); return data; }
280WRITE8_MEMBER( vic10_expansion_slot_device::lorom_w ) { if (m_cart != NULL) m_cart->vic10_lorom_w(space, offset, data); }
281READ8_MEMBER( vic10_expansion_slot_device::uprom_r ) { UINT8 data = 0; if (m_cart != NULL) data = m_cart->vic10_uprom_r(space, offset); return data; }
282WRITE8_MEMBER( vic10_expansion_slot_device::uprom_w ) { if (m_cart != NULL) m_cart->vic10_uprom_w(space, offset, data); }
283READ8_MEMBER( vic10_expansion_slot_device::exram_r ) { UINT8 data = 0; if (m_cart != NULL) data = m_cart->vic10_exram_r(space, offset); return data; }
284WRITE8_MEMBER( vic10_expansion_slot_device::exram_w ) { if (m_cart != NULL) m_cart->vic10_exram_w(space, offset, data); }
279//-------------------------------------------------
280//  cd_r - cartridge data read
281//-------------------------------------------------
285282 
283UINT8 vic10_expansion_slot_device::cd_r(address_space &space, offs_t offset, int lorom, int uprom, int exram)
284{
285   UINT8 data = 0;
286 
287   if (m_cart != NULL)
288   {
289      data = m_cart->vic10_cd_r(space, offset, lorom, uprom, exram);
290   }
291 
292   return data;
293}
294 
295 
296//-------------------------------------------------
297//  cd_w - cartridge data write
298//-------------------------------------------------
299 
300void vic10_expansion_slot_device::cd_w(address_space &space, offs_t offset, UINT8 data, int lorom, int uprom, int exram)
301{
302   if (m_cart != NULL)
303   {
304      m_cart->vic10_cd_w(space, offset, data, lorom, uprom, exram);
305   }
306}
307 
308 
286309READ_LINE_MEMBER( vic10_expansion_slot_device::p0_r ) { int state = 0; if (m_cart != NULL) state = m_cart->vic10_p0_r(); return state; }
287310WRITE_LINE_MEMBER( vic10_expansion_slot_device::p0_w ) { if (m_cart != NULL) m_cart->vic10_p0_w(state); }
288311WRITE_LINE_MEMBER( vic10_expansion_slot_device::irq_w ) { m_out_irq_func(state); }
src/mess/machine/vic10exp.h
r14904r14905
9494   vic10_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
9595   virtual ~vic10_expansion_slot_device();
9696 
97   DECLARE_READ8_MEMBER( lorom_r );
98   DECLARE_WRITE8_MEMBER( lorom_w );
99   DECLARE_READ8_MEMBER( uprom_r );
100   DECLARE_WRITE8_MEMBER( uprom_w );
101   DECLARE_READ8_MEMBER( exram_r );
102   DECLARE_WRITE8_MEMBER( exram_w );
97   UINT8 cd_r(address_space &space, offs_t offset, int lorom, int uprom, int exram);
98   void cd_w(address_space &space, offs_t offset, UINT8 data, int lorom, int uprom, int exram);
10399 
104100   DECLARE_READ_LINE_MEMBER( p0_r );
105101   DECLARE_WRITE_LINE_MEMBER( p0_w );
r14904r14905
148144// class representing interface-specific live vic10_expansion card
149145class device_vic10_expansion_card_interface : public device_slot_card_interface
150146{
147   friend class vic10_expansion_slot_device;
148 
151149public:
152150   // construction/destruction
153151   device_vic10_expansion_card_interface(const machine_config &mconfig, device_t &device);
154152   virtual ~device_vic10_expansion_card_interface();
155153 
156   // RAM
154protected:
155   // initialization
157156   virtual UINT8* vic10_exram_pointer(running_machine &machine, size_t size);
158   virtual UINT8 vic10_exram_r(address_space &space, offs_t offset) { return 0; };
159   virtual void vic10_exram_w(address_space &space, offs_t offset, UINT8 data) { };
160 
161   // ROM
162157   virtual UINT8* vic10_lorom_pointer(running_machine &machine, size_t size);
163   virtual UINT8 vic10_lorom_r(address_space &space, offs_t offset) { return 0; };
164   virtual void vic10_lorom_w(address_space &space, offs_t offset, UINT8 data) { };
165 
166158   virtual UINT8* vic10_uprom_pointer(running_machine &machine, size_t size);
167   virtual UINT8 vic10_uprom_r(address_space &space, offs_t offset) { return 0; };
168   virtual void vic10_uprom_w(address_space &space, offs_t offset, UINT8 data) { };
169159 
170   // I/O
160   // runtime
161   virtual UINT8 vic10_cd_r(address_space &space, offs_t offset, int lorom, int uprom, int exram) { return 0; };
162   virtual void vic10_cd_w(address_space &space, offs_t offset, UINT8 data, int lorom, int uprom, int exram) { };
171163   virtual int vic10_p0_r() { return 0; };
172164   virtual void vic10_p0_w(int state) { };
173165   virtual void vic10_sp_w(int state) { };
174166   virtual void vic10_cnt_w(int state) { };
175 
176   // video
177167   virtual UINT32 vic10_screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { return false; }
178168 
179protected:
180169   vic10_expansion_slot_device *m_slot;
181170 
182171   UINT8 *m_exram;
src/mess/includes/vic10.h
r14904r14905
5252 
5353   void check_interrupts();
5454 
55   DECLARE_READ8_MEMBER( read );
56   DECLARE_WRITE8_MEMBER( write );
57 
5558   DECLARE_READ8_MEMBER( vic_lightpen_x_cb );
5659   DECLARE_READ8_MEMBER( vic_lightpen_y_cb );
5760   DECLARE_READ8_MEMBER( vic_lightpen_button_cb );
src/mess/drivers/vic10.c
r14904r14905
2727}
2828 
2929 
30//**************************************************************************
31//  MEMORY MANAGEMENT
32//**************************************************************************
3033 
34//-------------------------------------------------
35//  read -
36//-------------------------------------------------
37 
38READ8_MEMBER( vic10_state::read )
39{
40   // TODO this is really handled by the PLA
41 
42   UINT8 data = 0;
43   int lorom = 1, uprom = 1, exram = 1;
44 
45   if (offset < 0x800)
46   {
47      data = m_ram->pointer()[offset];
48   }
49   else if (offset < 0x1000)
50   {
51      exram = 0;
52   }
53   else if (offset >= 0x8000 && offset < 0xa000)
54   {
55      lorom = 0;
56   }
57   else if (offset >= 0xd000 && offset < 0xd400)
58   {
59      data = vic2_port_r(m_vic, offset & 0x3f);
60   }
61   else if (offset >= 0xd400 && offset < 0xd800)
62   {
63      data = sid6581_r(m_sid, offset & 0x1f);
64   }
65   else if (offset >= 0xd800 && offset < 0xdc00)
66   {
67      data = m_color_ram[offset & 0x3ff];
68   }
69   else if (offset >= 0xdc00 && offset < 0xe000)
70   {
71      data = mos6526_r(m_cia, offset & 0x0f);
72   }
73   else if (offset >= 0xe000)
74   {
75      uprom = 0;
76   }
77 
78   data |= m_exp->cd_r(space, offset, lorom, uprom, exram);
79 
80   return data;
81}
82 
83 
84//-------------------------------------------------
85//  write -
86//-------------------------------------------------
87 
88WRITE8_MEMBER( vic10_state::write )
89{
90   // TODO this is really handled by the PLA
91 
92   int lorom = 1, uprom = 1, exram = 1;
93 
94   if (offset < 0x800)
95   {
96      m_ram->pointer()[offset] = data;
97   }
98   else if (offset < 0x1000)
99   {
100      exram = 0;
101   }
102   else if (offset >= 0xd000 && offset < 0xd400)
103   {
104      vic2_port_w(m_vic, offset & 0x3f, data);
105   }
106   else if (offset >= 0xd400 && offset < 0xd800)
107   {
108      sid6581_w(m_sid, offset & 0x1f, data);
109   }
110   else if (offset >= 0xd800 && offset < 0xdc00)
111   {
112      m_color_ram[offset & 0x3ff] = data & 0x0f;
113   }
114   else if (offset >= 0xdc00 && offset < 0xe000)
115   {
116      mos6526_w(m_cia, offset & 0x0f, data);
117   }
118 
119   m_exp->cd_w(space, offset, data, lorom, uprom, exram);
120}
121 
122 
123 
31124//**************************************************************************
32125//  ADDRESS MAPS
33126//**************************************************************************
r14904r14905
37130//-------------------------------------------------
38131 
39132static ADDRESS_MAP_START( vic10_mem, AS_PROGRAM, 8, vic10_state )
40   AM_RANGE(0x0000, 0x07ff) AM_RAM
41   AM_RANGE(0x0800, 0x0fff) AM_DEVREADWRITE(VIC10_EXPANSION_SLOT_TAG, vic10_expansion_slot_device, exram_r, exram_w)
42   AM_RANGE(0x8000, 0x9fff) AM_DEVREADWRITE(VIC10_EXPANSION_SLOT_TAG, vic10_expansion_slot_device, lorom_r, lorom_w)
43   AM_RANGE(0xd000, 0xd3ff) AM_DEVREADWRITE_LEGACY(MOS6566_TAG, vic2_port_r, vic2_port_w)
44   AM_RANGE(0xd400, 0xd7ff) AM_DEVREADWRITE_LEGACY(MOS6581_TAG, sid6581_r, sid6581_w)
45   AM_RANGE(0xd800, 0xdbff) AM_RAM AM_BASE(m_color_ram)
46   AM_RANGE(0xdc00, 0xdcff) AM_DEVREADWRITE_LEGACY(MOS6526_TAG, mos6526_r, mos6526_w)
47   AM_RANGE(0xe000, 0xffff) AM_DEVREADWRITE(VIC10_EXPANSION_SLOT_TAG, vic10_expansion_slot_device, uprom_r, uprom_w)
133   AM_RANGE(0x0000, 0xffff) AM_READWRITE(read, write)
48134ADDRESS_MAP_END
49135 
50136 
r14904r14905
498584 
499585void vic10_state::machine_start()
500586{
587   // allocate memory
588   m_color_ram = auto_alloc_array(machine(), UINT8, 0x400);
589 
501590   // state saving
502591   save_item(NAME(m_cia_irq));
503592   save_item(NAME(m_vic_irq));

Previous 15994 Revisions Next


© 1998-2018 The MESS Team