Previous 15994 Revisions Next

r14471 Wednesday 15th February, 2012 at 19:24:16 UTC by Curt Coder
[C64] Added support for the EasyFlash cartridge. [Curt Coder]
[src/emu/machine]intelfsh.c intelfsh.h
[src/mess]mess.mak
[src/mess/drivers]c64.c
[src/mess/machine]c64_easyflash.c* c64_easyflash.h* c64_ieee488.c c64_magic_formel.c c64exp.c c64exp.h cbmipt.c cbmipt.h

src/emu/machine/intelfsh.c
r14470r14471
4747// device type definition
4848const device_type INTEL_28F016S5 = &device_creator<intel_28f016s5_device>;
4949const device_type SHARP_LH28F016S = &device_creator<sharp_lh28f016s_device>;
50const device_type AMD_29F040 = &device_creator<amd_29f040_device>;
5051const device_type AMD_29F080 = &device_creator<amd_29f080_device>;
5152const device_type FUJITSU_29F016A = &device_creator<fujitsu_29f016a_device>;
5253const device_type FUJITSU_29DL16X = &device_creator<fujitsu_29dl16x_device>;
r14470r14471
6869   AM_RANGE(0x00000, 0x01ffff) AM_RAM
6970ADDRESS_MAP_END
7071
72static ADDRESS_MAP_START( memory_map8_4Mb, AS_PROGRAM, 8 )
73   AM_RANGE(0x00000, 0x07ffff) AM_RAM
74ADDRESS_MAP_END
75
7176static ADDRESS_MAP_START( memory_map8_8Mb, AS_PROGRAM, 8 )
7277   AM_RANGE(0x00000, 0x0fffff) AM_RAM
7378ADDRESS_MAP_END
r14470r14471
128133      m_device_id = 0xaa;
129134      map = ADDRESS_MAP_NAME( memory_map8_16Mb );
130135      break;
136   case FLASH_AMD_29F040:
137      m_bits = 8;
138      m_size = 0x80000;
139      m_maker_id = 0x01;
140      m_device_id = 0xa4;
141      map = ADDRESS_MAP_NAME( memory_map8_4Mb );
142      break;
131143   case FLASH_AMD_29F080:
132144      m_bits = 8;
133145      m_size = 0x100000;
r14470r14471
230242sharp_lh28f016s_device::sharp_lh28f016s_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
231243   : intelfsh8_device(mconfig, SHARP_LH28F016S, "Sharp LH28F016S Flash", tag, owner, clock, FLASH_SHARP_LH28F016S) { }
232244
245amd_29f040_device::amd_29f040_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
246   : intelfsh8_device(mconfig, AMD_29F040, "AMD 29F040 Flash", tag, owner, clock, FLASH_AMD_29F040) { }
247
233248amd_29f080_device::amd_29f080_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
234249   : intelfsh8_device(mconfig, AMD_29F080, "AMD 29F080 Flash", tag, owner, clock, FLASH_AMD_29F080) { }
235250
src/emu/machine/intelfsh.h
r14470r14471
1616#define MCFG_SHARP_LH28F016S_ADD(_tag) \
1717   MCFG_DEVICE_ADD(_tag, SHARP_LH28F016S, 0)
1818
19#define MCFG_AMD_29F040_ADD(_tag) \
20   MCFG_DEVICE_ADD(_tag, AMD_29F040, 0)
21
1922#define MCFG_AMD_29F080_ADD(_tag) \
2023   MCFG_DEVICE_ADD(_tag, AMD_29F080, 0)
2124
r14470r14471
7174      FLASH_INTEL_28F016S5 = 0x0800,
7275      FLASH_FUJITSU_29F016A,
7376      FLASH_FUJITSU_29DL16X,
77      FLASH_AMD_29F040,
7478      FLASH_AMD_29F080,
7579      FLASH_SHARP_LH28F016S,
7680      FLASH_INTEL_E28F008SA,
r14470r14471
182186   fujitsu_29dl16x_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
183187};
184188
189class amd_29f040_device : public intelfsh8_device
190{
191public:
192   amd_29f040_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
193};
194
185195class amd_29f080_device : public intelfsh8_device
186196{
187197public:
r14470r14471
249259// device type definition
250260extern const device_type INTEL_28F016S5;
251261extern const device_type SHARP_LH28F016S;
262extern const device_type AMD_29F040;
252263extern const device_type AMD_29F080;
253264extern const device_type FUJITSU_29F016A;
254265extern const device_type FUJITSU_29DL16X;
src/mess/machine/cbmipt.c
r14470r14471
11451145SLOT_INTERFACE_START( c64_expansion_cards )
11461146   SLOT_INTERFACE("georam", C64_GEORAM)
11471147   SLOT_INTERFACE("xl80", C64_XL80)
1148   SLOT_INTERFACE("easyflash", C64_EASYFLASH)
11481149   
11491150   // the following need ROMs from the software list
11501151   SLOT_INTERFACE("ieee488", C64_IEEE488)
src/mess/machine/cbmipt.h
r14470r14471
99#include "machine/c64_dela_ep7x8.h"
1010#include "machine/c64_dinamic.h"
1111#include "machine/c64_easy_calc_result.h"
12#include "machine/c64_easyflash.h"
1213#include "machine/c64_epyx_fast_load.h"
1314#include "machine/c64_fun_play.h"
1415#include "machine/c64_georam.h"
src/mess/machine/c64_ieee488.c
r14470r14471
267267 
268268UINT8 c64_ieee488_device::c64_cd_r(address_space &space, offs_t offset, int roml, int romh, int io1, int io2)
269269{
270   UINT8 data = 0;
271 
270   UINT8 data = m_exp->cd_r(space, offset, roml, romh, io1, io2);
271   
272272   if (!roml)
273273   {
274274      if (m_roml_sel)
275275      {
276276         data = m_roml[offset & 0xfff];
277277      }
278      else
279      {
280         data = m_exp->roml_r(space, offset);
281      }
282278   }
283   else if (!romh)
284   {
285      data = m_exp->romh_r(space, offset);
286   }
287   else if (!io1)
288   {
289      data = m_exp->io1_r(space, offset);
290   }
291279   else if (!io2)
292280   {
293      data = m_exp->io2_r(space, offset);
294       
295281      data |= tpi6525_r(m_tpi, offset & 0x07);
296282   }
297   else
298   {
299      data = m_exp->read(space, offset);
300   }
301283 
302284   return data;
303285}
r14470r14471
309291 
310292void c64_ieee488_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int roml, int romh, int io1, int io2)
311293{
312   if (!io1)
294   if (!io2)
313295   {
314      m_exp->io1_w(space, offset, data);
315   }
316   else if (!io2)
317   {
318      m_exp->io2_w(space, offset, data);
319       
320296      tpi6525_w(m_tpi, offset & 0x07, data);
321297   }
322   else
323   {
324      m_exp->write(space, offset, data);
325   }
298   
299   m_exp->cd_w(space, offset, data, roml, romh, io1, io2);
326300}
327301 
328302 
src/mess/machine/c64_easyflash.c
r0r14471
1/**********************************************************************
2 
3    EasyFlash cartridge emulation
4 
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7 
8**********************************************************************/
9 
10#include "c64_easyflash.h"
11 
12 
13//**************************************************************************
14//  MACROS/CONSTANTS
15//**************************************************************************
16 
17#define AM29F040_0_TAG   "u3"
18#define AM29F040_1_TAG   "u4"
19 
20 
21 
22//**************************************************************************
23//  DEVICE DEFINITIONS
24//**************************************************************************
25 
26const device_type C64_EASYFLASH = &device_creator<c64_easyflash_cartridge_device>;
27 
28 
29//-------------------------------------------------
30//  MACHINE_CONFIG_FRAGMENT( c64_easyflash )
31//-------------------------------------------------
32 
33static MACHINE_CONFIG_FRAGMENT( c64_easyflash )
34   MCFG_AMD_29F040_ADD(AM29F040_0_TAG)
35   MCFG_AMD_29F040_ADD(AM29F040_1_TAG)
36MACHINE_CONFIG_END
37 
38 
39//-------------------------------------------------
40//  machine_config_additions - device-specific
41//  machine configurations
42//-------------------------------------------------
43 
44machine_config_constructor c64_easyflash_cartridge_device::device_mconfig_additions() const
45{
46   return MACHINE_CONFIG_NAME( c64_easyflash );
47}
48 
49 
50//-------------------------------------------------
51//  INPUT_PORTS( c64_easyflash )
52//-------------------------------------------------
53 
54INPUT_CHANGED( c64_easyflash_cartridge_device::reset )
55{
56   // TODO
57}
58 
59static INPUT_PORTS_START( c64_easyflash )
60   PORT_START("JP1")
61   PORT_DIPNAME( 0x01, 0x00, "Boot" )
62   PORT_DIPSETTING(    0x00, "Disable" )
63   PORT_DIPSETTING(    0x01, "Boot" )
64   
65   PORT_START("RESET")
66   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_NAME("Reset") PORT_CHANGED(c64_easyflash_cartridge_device::reset, 0)
67INPUT_PORTS_END
68 
69 
70//-------------------------------------------------
71//  input_ports - device-specific input ports
72//-------------------------------------------------
73 
74ioport_constructor c64_easyflash_cartridge_device::device_input_ports() const
75{
76   return INPUT_PORTS_NAME( c64_easyflash );
77}
78 
79 
80 
81//**************************************************************************
82//  LIVE DEVICE
83//**************************************************************************
84 
85//-------------------------------------------------
86//  c64_easyflash_cartridge_device - constructor
87//-------------------------------------------------
88 
89c64_easyflash_cartridge_device::c64_easyflash_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
90   device_t(mconfig, C64_EASYFLASH, "C64 EasyFlash cartridge", tag, owner, clock),
91   device_c64_expansion_card_interface(mconfig, *this),
92   m_flash_roml(*this, AM29F040_0_TAG),
93   m_flash_romh(*this, AM29F040_1_TAG),
94   m_bank(0),
95   m_mode(0)
96{
97}
98 
99 
100//-------------------------------------------------
101//  device_start - device-specific startup
102//-------------------------------------------------
103 
104void c64_easyflash_cartridge_device::device_start()
105{
106   m_ram = auto_alloc_array(machine(), UINT8, 0x100);
107 
108   // state saving
109   save_item(NAME(m_bank));
110   save_item(NAME(m_mode));
111}
112 
113 
114//-------------------------------------------------
115//  device_reset - device-specific reset
116//-------------------------------------------------
117 
118void c64_easyflash_cartridge_device::device_reset()
119{
120   m_bank = 0;
121   m_mode = 0;
122}
123 
124 
125//-------------------------------------------------
126//  c64_cd_r - cartridge data read
127//-------------------------------------------------
128 
129UINT8 c64_easyflash_cartridge_device::c64_cd_r(address_space &space, offs_t offset, int roml, int romh, int io1, int io2)
130{
131   UINT8 data = 0;
132   
133   if (!roml)
134   {
135      offs_t addr = (m_bank << 13) | (offset & 0x1fff);
136      data = m_flash_roml->read(addr);
137   }
138   else if (!romh)
139   {
140      offs_t addr = (m_bank << 13) | (offset & 0x1fff);
141      data = m_flash_romh->read(addr);
142   }
143   else if (!io2)
144   {
145      data = m_ram[offset & 0xff];
146   }
147 
148   return data;
149}
150 
151 
152//-------------------------------------------------
153//  c64_cd_w - cartridge data write
154//-------------------------------------------------
155 
156void c64_easyflash_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int roml, int romh, int io1, int io2)
157{
158   if (!roml)
159   {
160      offs_t addr = (m_bank << 13) | (offset & 0x1fff);
161      m_flash_roml->write(addr, data);
162   }
163   else if (!romh)
164   {
165      offs_t addr = (m_bank << 13) | (offset & 0x1fff);
166      m_flash_romh->write(addr, data);
167   }
168   else if (!io1)
169   {
170      if (!BIT(offset, 1))
171      {
172         /*
173         
174            bit      description
175             
176            0      BA13
177            1      BA14
178            2      BA15
179            3      BA16
180            4      BA17
181            5      BA18
182            6       
183            7       
184         
185         */
186         
187         m_bank = data & 0x3f;
188      }
189      else
190      {
191         /*
192         
193            bit      description
194             
195            0      GAME
196            1      EXROM
197            2      MODE
198            3       
199            4       
200            5       
201            6       
202            7      LED
203         
204         */
205         
206         m_mode = data;
207      }
208   }
209   else if (!io2)
210   {
211      m_ram[offset & 0xff] = data;
212   }
213}
214 
215 
216//-------------------------------------------------
217//  c64_exrom_r - EXROM read
218//-------------------------------------------------
219 
220int c64_easyflash_cartridge_device::c64_exrom_r()
221{
222   return !BIT(m_mode, 1);
223}
224 
225 
226//-------------------------------------------------
227//  c64_game_r - GAME read
228//-------------------------------------------------
229 
230int c64_easyflash_cartridge_device::c64_game_r(offs_t offset, int ba, int rw)
231{
232   return !(BIT(m_mode, 0) | !(BIT(m_mode, 2) | input_port_read(device(), "JP1")));
233}
src/mess/machine/c64_easyflash.h
r0r14471
1/**********************************************************************
2 
3    EasyFlash cartridge emulation
4 
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7 
8**********************************************************************/
9 
10#pragma once
11 
12#ifndef __EASYFLASH__
13#define __EASYFLASH__
14 
15#define ADDRESS_MAP_MODERN
16 
17#include "emu.h"
18#include "machine/c64exp.h"
19#include "machine/intelfsh.h"
20#include "machine/nvram.h"
21 
22 
23 
24//**************************************************************************
25//  TYPE DEFINITIONS
26//**************************************************************************
27 
28// ======================> c64_easyflash_cartridge_device
29 
30class c64_easyflash_cartridge_device : public device_t,
31                              public device_c64_expansion_card_interface
32{
33public:
34   // construction/destruction
35   c64_easyflash_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
36 
37   // optional information overrides
38   virtual machine_config_constructor device_mconfig_additions() const;
39   virtual ioport_constructor device_input_ports() const;
40   
41   static INPUT_CHANGED( reset );
42   
43protected:
44   // device-level overrides
45   virtual void device_start();
46   virtual void device_reset();
47 
48   // device_c64_expansion_card_interface overrides
49   virtual UINT8 c64_cd_r(address_space &space, offs_t offset, int roml, int romh, int io1, int io2);
50   virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int roml, int romh, int io1, int io2);
51   virtual int c64_exrom_r();
52   virtual int c64_game_r(offs_t offset, int ba, int rw);
53 
54private:
55   required_device<amd_29f040_device> m_flash_roml;
56   required_device<amd_29f040_device> m_flash_romh;
57   
58   UINT8 m_bank;
59   UINT8 m_mode;
60};
61 
62 
63// device type definition
64extern const device_type C64_EASYFLASH;
65 
66 
67#endif
src/mess/machine/c64_magic_formel.c
r14470r14471
270270 
271271 
272272//-------------------------------------------------
273//  c64_cd_w - GAME read
273//  c64_game_r - GAME read
274274//-------------------------------------------------
275275 
276276int c64_magic_formel_cartridge_device::c64_game_r(offs_t offset, int ba, int rw)
src/mess/machine/c64exp.c
r14470r14471
280280
281281
282282//-------------------------------------------------
283//  read -
283//  cd_r -
284284//-------------------------------------------------
285285
286READ8_MEMBER( c64_expansion_slot_device::read )
286UINT8 c64_expansion_slot_device::cd_r(address_space &space, offs_t offset, int roml, int romh, int io1, int io2)
287287{
288288   UINT8 data = 0;
289289
290290   if (m_cart != NULL)
291291   {
292      data = m_cart->c64_cd_r(space, offset, 1, 1, 1, 1);
292      data = m_cart->c64_cd_r(space, offset, roml, romh, io1, io2);
293293   }
294294
295295   return data;
r14470r14471
297297
298298
299299//-------------------------------------------------
300//  write -
300//  cd_w -
301301//-------------------------------------------------
302302
303WRITE8_MEMBER( c64_expansion_slot_device::write )
303void c64_expansion_slot_device::cd_w(address_space &space, offs_t offset, UINT8 data, int roml, int romh, int io1, int io2)
304304{
305305   if (m_cart != NULL)
306306   {
307      m_cart->c64_cd_w(space, offset, data, 1, 1, 1, 1);
307      m_cart->c64_cd_w(space, offset, data, roml, romh, io1, io2);
308308   }
309309}
310310
311311
312312//-------------------------------------------------
313//  roml_r - low ROM read
314//-------------------------------------------------
315
316READ8_MEMBER( c64_expansion_slot_device::roml_r )
317{
318   UINT8 data = 0;
319
320   if (m_cart != NULL)
321   {
322      data = m_cart->c64_cd_r(space, offset, 0, 1, 1, 1);
323   }
324
325   return data;
326}
327
328
329//-------------------------------------------------
330//  romh_r - high ROM read
331//-------------------------------------------------
332
333READ8_MEMBER( c64_expansion_slot_device::romh_r )
334{
335   UINT8 data = 0;
336
337   if (m_cart != NULL)
338   {
339      data = m_cart->c64_cd_r(space, offset, 1, 0, 1, 1);
340   }
341
342   return data;
343}
344
345
346//-------------------------------------------------
347//  io1_r - I/O 1 read
348//-------------------------------------------------
349
350READ8_MEMBER( c64_expansion_slot_device::io1_r )
351{
352   UINT8 data = 0;
353
354   if (m_cart != NULL)
355   {
356      data = m_cart->c64_cd_r(space, offset, 1, 1, 0, 1);
357   }
358
359   return data;
360}
361
362
363//-------------------------------------------------
364//  io1_w - low ROM write
365//-------------------------------------------------
366
367WRITE8_MEMBER( c64_expansion_slot_device::io1_w )
368{
369   if (m_cart != NULL)
370   {
371      m_cart->c64_cd_w(space, offset, data, 1, 1, 0, 1);
372   }
373}
374
375
376//-------------------------------------------------
377//  io2_r - I/O 2 read
378//-------------------------------------------------
379
380READ8_MEMBER( c64_expansion_slot_device::io2_r )
381{
382   UINT8 data = 0;
383
384   if (m_cart != NULL)
385   {
386      data = m_cart->c64_cd_r(space, offset, 1, 1, 1, 0);
387   }
388
389   return data;
390}
391
392
393//-------------------------------------------------
394//  io2_w - low ROM write
395//-------------------------------------------------
396
397WRITE8_MEMBER( c64_expansion_slot_device::io2_w )
398{
399   if (m_cart != NULL)
400   {
401      m_cart->c64_cd_w(space, offset, data, 1, 1, 1, 0);
402   }
403}
404
405
406//-------------------------------------------------
407313//  game_r - GAME read
408314//-------------------------------------------------
409315
src/mess/machine/c64exp.h
r14470r14471
9393   c64_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
9494   virtual ~c64_expansion_slot_device();
9595
96   DECLARE_READ8_MEMBER( read );
97   DECLARE_WRITE8_MEMBER( write );
98   DECLARE_READ8_MEMBER( roml_r );
99   DECLARE_READ8_MEMBER( romh_r );
100   DECLARE_READ8_MEMBER( io1_r );
101   DECLARE_WRITE8_MEMBER( io1_w );
102   DECLARE_READ8_MEMBER( io2_r );
103   DECLARE_WRITE8_MEMBER( io2_w );
96   UINT8 cd_r(address_space &space, offs_t offset, int roml, int romh, int io1, int io2);
97   void cd_w(address_space &space, offs_t offset, UINT8 data, int roml, int romh, int io1, int io2);
10498   int game_r(offs_t offset, int ba, int rw);
10599   DECLARE_READ_LINE_MEMBER( exrom_r );
106100
src/mess/mess.mak
r14470r14471
759759   $(MESS_MACHINE)/c64_dela_ep7x8.o   \
760760   $(MESS_MACHINE)/c64_dinamic.o   \
761761   $(MESS_MACHINE)/c64_easy_calc_result.o   \
762   $(MESS_MACHINE)/c64_easyflash.o   \
762763   $(MESS_MACHINE)/c64_epyx_fast_load.o   \
763764   $(MESS_MACHINE)/c64_fun_play.o   \
764765   $(MESS_MACHINE)/c64_georam.o   \
src/mess/drivers/c64.c
r14470r14471
8383
8484UINT8 c64_state::read_memory(address_space &space, offs_t offset, int casram, int basic, int kernal, int charom, int io, int roml, int romh)
8585{
86   int io1 = 1;
87   int io2 = 1;
88   
8689   UINT8 data = 0;
8790
8891   if (!casram)
r14470r14471
134137            break;
135138
136139         case 2: // I/O1
137            data = m_exp->io1_r(space, offset);
140            io1 = 0;
138141            break;
139
142           
140143         case 3: // I/O2
141            data = m_exp->io2_r(space, offset);
144            io2 = 0;
142145            break;
143146         }
144147         break;
145148      }
146149   }
147   else if (!roml)
148   {
149      data = m_exp->roml_r(space, offset);
150   }
151   else if (!romh)
152   {
153      data = m_exp->romh_r(space, offset);
154   }
150   
151   data |= m_exp->cd_r(space, offset, roml, romh, io1, io2);
155152
156153   return data;
157154}
r14470r14471
177174
178175WRITE8_MEMBER( c64_state::write )
179176{
177   int io1 = 1;
178   int io2 = 1;
179
180180   int casram, basic, kernal, charom, grw, io, roml, romh;
181181
182182   bankswitch(offset, 0, 0, 0, 1, 0, &casram, &basic, &kernal, &charom, &grw, &io, &roml, &romh);
183
183     
184184   if (!casram)
185185   {
186186      m_ram->pointer()[offset] = data;
187     
188      if (offset == 0x0001 || (offset >= 0x8000 && offset < 0xc000))
189      {
190         m_exp->write(space, offset, data);
191      }
192187   }
193188   else if (!io)
194189   {
r14470r14471
218213            break;
219214
220215         case 2: // I/O1
221            m_exp->io1_w(space, offset, data);
216            io1 = 0;
222217            break;
223218
224219         case 3: // I/O2
225            m_exp->io2_w(space, offset, data);
220            io2 = 0;
226221            break;
227222         }
228223         break;
229224      }
230225   }
226   
227   m_exp->cd_w(space, offset, data, roml, romh, io1, io2);
231228}
232229
233230

Previous 15994 Revisions Next


© 1998-2018 The MESS Team