Previous 199869 Revisions Next

r22668 Saturday 4th May, 2013 at 18:34:31 UTC by Wilbert Pol
(MESS) electron.c: Added cartridge support.  [Wilbert Pol]
[src/mess/drivers]electron.c
[src/mess/includes]electron.h
[src/mess/machine]electron.c

trunk/src/mess/includes/electron.h
r22667r22668
9090   inline UINT8 read_vram( UINT16 addr );
9191   inline void electron_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color);
9292   void electron_interrupt_handler(int mode, int interrupt);
93   DECLARE_DEVICE_IMAGE_LOAD_MEMBER( electron_cart );
9394};
9495
9596
trunk/src/mess/drivers/electron.c
r22667r22668
1313    - Graphics (seems to be wrong for several games)
1414    - 1 MHz bus is not emulated
1515    - Bus claiming by ULA is not implemented
16    - Currently the cartridge support always loads the upper rom in page 12
17      and the lower rom in page 0. This might need further documentation in
18      the software list and loading code.
1619
1720Missing:
18    - Support for ROM images
1921    - Support for floppy disks
2022    - Other peripherals
2123    - Keyboard is missing the 'Break' key
r22667r22668
2628#include "cpu/m6502/m6502.h"
2729#include "includes/electron.h"
2830#include "imagedev/cassette.h"
31#include "imagedev/cartslot.h"
2932#include "formats/uef_cas.h"
3033#include "sound/beep.h"
3134
r22667r22668
196199   MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.00 )
197200
198201   MCFG_CASSETTE_ADD( "cassette", electron_cassette_interface )
202
203   MCFG_CARTSLOT_ADD("cart")
204   MCFG_CARTSLOT_EXTENSION_LIST("bin")
205   MCFG_CARTSLOT_NOT_MANDATORY
206   MCFG_CARTSLOT_LOAD(electron_state, electron_cart)
207   MCFG_CARTSLOT_INTERFACE("electron_cart")
208   /* software lists */
209   MCFG_SOFTWARE_LIST_ADD("cart_list","electron_cart")
199210MACHINE_CONFIG_END
200211
201212
trunk/src/mess/machine/electron.c
r22667r22668
338338   machine().scheduler().timer_set(attotime::zero, timer_expired_delegate(FUNC(electron_state::setup_beep),this));
339339   m_tape_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(electron_state::electron_tape_timer_handler),this));
340340}
341
342DEVICE_IMAGE_LOAD_MEMBER( electron_state, electron_cart )
343{
344   UINT8 *user1 = memregion("user1")->base() + 0x4000;
345
346   if (image.software_entry() == NULL)
347   {
348      UINT32 filesize = image.length();
349
350      if ( filesize != 16384 )
351      {
352         image.seterror(IMAGE_ERROR_UNSPECIFIED, "Invalid size. Only size 16384 is supported");
353         return IMAGE_INIT_FAIL;
354      }
355
356      if (image.fread( user1 + 12 * 16384, filesize) != filesize)
357      {
358         image.seterror(IMAGE_ERROR_UNSPECIFIED, "Error loading file");
359         return IMAGE_INIT_FAIL;
360      }
361
362      return IMAGE_INIT_PASS;
363   }
364
365   int upsize = image.get_software_region_length("uprom");
366   int losize = image.get_software_region_length("lorom");
367
368   if ( upsize != 16384 && upsize != 0 )
369   {
370      image.seterror(IMAGE_ERROR_UNSPECIFIED, "Invalid size for uprom");
371      return IMAGE_INIT_FAIL;
372   }
373
374   if ( losize != 16384 && losize != 0 )
375   {
376      image.seterror(IMAGE_ERROR_UNSPECIFIED, "Invalid size for lorom");
377      return IMAGE_INIT_FAIL;
378   }
379
380   if ( upsize )
381   {
382      memcpy( user1 + 12 * 16384, image.get_software_region("uprom"), upsize );
383   }
384
385   if ( losize )
386   {
387      memcpy( user1 + 0 * 16384, image.get_software_region("lorom"), losize );
388   }
389
390   return IMAGE_INIT_PASS;
391}

Previous 199869 Revisions Next


© 1997-2024 The MAME Team